pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Import electron34
Module Name: pkgsrc-wip
Committed By: kikadf <kikadf.01%gmail.com@localhost>
Pushed By: kikadf
Date: Mon May 26 14:17:49 2025 +0200
Changeset: 202b2f3c3416ffde25212c55b4f6e6d4220b8ca8
Modified Files:
Makefile
Added Files:
electron34/DESCR
electron34/Makefile
electron34/PLIST
electron34/TODO
electron34/distinfo
electron34/options.mk
electron34/patches/patch-.gitignore
electron34/patches/patch-.gn
electron34/patches/patch-AUTHORS
electron34/patches/patch-BUILD.gn
electron34/patches/patch-apps_ui_views_app__window__frame__view.cc
electron34/patches/patch-ash_display_mirror__window__controller.cc
electron34/patches/patch-base_BUILD.gn
electron34/patches/patch-base_allocator_dispatcher_tls.h
electron34/patches/patch-base_allocator_partition__allocator_partition__alloc.gni
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
electron34/patches/patch-base_atomicops.h
electron34/patches/patch-base_base__paths__posix.cc
electron34/patches/patch-base_compiler__specific.h
electron34/patches/patch-base_debug_debugger__posix.cc
electron34/patches/patch-base_debug_elf__reader.cc
electron34/patches/patch-base_debug_proc__maps__linux.cc
electron34/patches/patch-base_debug_stack__trace.cc
electron34/patches/patch-base_debug_stack__trace__posix.cc
electron34/patches/patch-base_enterprise__util__mac.mm
electron34/patches/patch-base_files_dir__reader__linux.h
electron34/patches/patch-base_files_dir__reader__posix.h
electron34/patches/patch-base_files_drive__info.h
electron34/patches/patch-base_files_drive__info__posix.cc
electron34/patches/patch-base_files_file__path__watcher.h
electron34/patches/patch-base_files_file__path__watcher__bsd.cc
electron34/patches/patch-base_files_file__path__watcher__kqueue.cc
electron34/patches/patch-base_files_file__path__watcher__kqueue.h
electron34/patches/patch-base_files_file__path__watcher__unittest.cc
electron34/patches/patch-base_files_file__util__posix.cc
electron34/patches/patch-base_files_file__util__unittest.cc
electron34/patches/patch-base_files_important__file__writer__cleaner.cc
electron34/patches/patch-base_files_scoped__file.cc
electron34/patches/patch-base_functional_callback__helpers.h
electron34/patches/patch-base_functional_unretained__traits.h
electron34/patches/patch-base_i18n_icu__util.cc
electron34/patches/patch-base_linux__util.cc
electron34/patches/patch-base_logging__unittest.cc
electron34/patches/patch-base_memory_discardable__memory.cc
electron34/patches/patch-base_memory_discardable__memory__internal.h
electron34/patches/patch-base_memory_madv__free__discardable__memory__posix.cc
electron34/patches/patch-base_memory_platform__shared__memory__region.h
electron34/patches/patch-base_memory_platform__shared__memory__region__posix.cc
electron34/patches/patch-base_memory_protected__memory.h
electron34/patches/patch-base_memory_protected__memory__posix.cc
electron34/patches/patch-base_message__loop_message__pump__epoll.cc
electron34/patches/patch-base_message__loop_message__pump__epoll.h
electron34/patches/patch-base_message__loop_message__pump__glib.cc
electron34/patches/patch-base_native__library__posix.cc
electron34/patches/patch-base_native__library__unittest.cc
electron34/patches/patch-base_posix_can__lower__nice__to.cc
electron34/patches/patch-base_posix_file__descriptor__shuffle.h
electron34/patches/patch-base_posix_sysctl.cc
electron34/patches/patch-base_posix_unix__domain__socket.cc
electron34/patches/patch-base_posix_unix__domain__socket__unittest.cc
electron34/patches/patch-base_process_internal__linux.h
electron34/patches/patch-base_process_kill.h
electron34/patches/patch-base_process_kill__posix.cc
electron34/patches/patch-base_process_launch.h
electron34/patches/patch-base_process_launch__mac.cc
electron34/patches/patch-base_process_launch__posix.cc
electron34/patches/patch-base_process_memory__linux.cc
electron34/patches/patch-base_process_process__handle.cc
electron34/patches/patch-base_process_process__handle.h
electron34/patches/patch-base_process_process__handle__freebsd.cc
electron34/patches/patch-base_process_process__handle__netbsd.cc
electron34/patches/patch-base_process_process__handle__openbsd.cc
electron34/patches/patch-base_process_process__info__mac.cc
electron34/patches/patch-base_process_process__iterator.h
electron34/patches/patch-base_process_process__iterator__freebsd.cc
electron34/patches/patch-base_process_process__iterator__netbsd.cc
electron34/patches/patch-base_process_process__iterator__openbsd.cc
electron34/patches/patch-base_process_process__metrics.cc
electron34/patches/patch-base_process_process__metrics.h
electron34/patches/patch-base_process_process__metrics__freebsd.cc
electron34/patches/patch-base_process_process__metrics__netbsd.cc
electron34/patches/patch-base_process_process__metrics__openbsd.cc
electron34/patches/patch-base_process_process__metrics__posix.cc
electron34/patches/patch-base_process_process__metrics__unittest.cc
electron34/patches/patch-base_process_process__posix.cc
electron34/patches/patch-base_process_process__unittest.cc
electron34/patches/patch-base_profiler_module__cache.cc
electron34/patches/patch-base_profiler_sampling__profiler__thread__token.cc
electron34/patches/patch-base_profiler_sampling__profiler__thread__token.h
electron34/patches/patch-base_profiler_stack__base__address__posix.cc
electron34/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc
electron34/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc
electron34/patches/patch-base_profiler_thread__delegate__posix.cc
electron34/patches/patch-base_rand__util.h
electron34/patches/patch-base_rand__util__posix.cc
electron34/patches/patch-base_strings_safe__sprintf__unittest.cc
electron34/patches/patch-base_synchronization_lock__impl.h
electron34/patches/patch-base_syslog__logging.cc
electron34/patches/patch-base_system_sys__info.cc
electron34/patches/patch-base_system_sys__info.h
electron34/patches/patch-base_system_sys__info__freebsd.cc
electron34/patches/patch-base_system_sys__info__netbsd.cc
electron34/patches/patch-base_system_sys__info__openbsd.cc
electron34/patches/patch-base_system_sys__info__posix.cc
electron34/patches/patch-base_system_sys__info__unittest.cc
electron34/patches/patch-base_task_thread__pool_environment__config__unittest.cc
electron34/patches/patch-base_test_launcher_test__launcher.cc
electron34/patches/patch-base_test_test__file__util__linux.cc
electron34/patches/patch-base_test_test__file__util__posix.cc
electron34/patches/patch-base_threading_platform__thread.h
electron34/patches/patch-base_threading_platform__thread__bsd.cc
electron34/patches/patch-base_threading_platform__thread__internal__posix.cc
electron34/patches/patch-base_threading_platform__thread__posix.cc
electron34/patches/patch-base_threading_platform__thread__unittest.cc
electron34/patches/patch-base_threading_thread__restrictions.h
electron34/patches/patch-base_time_time__now__posix.cc
electron34/patches/patch-base_trace__event_builtin__categories.h
electron34/patches/patch-base_trace__event_malloc__dump__provider.cc
electron34/patches/patch-base_trace__event_memory__dump__manager.cc
electron34/patches/patch-base_trace__event_process__memory__dump.cc
electron34/patches/patch-base_tracing_trace__time.cc
electron34/patches/patch-base_tracing_trace__time.h
electron34/patches/patch-base_version__info_version__info.h
electron34/patches/patch-base_win_shortcut.cc
electron34/patches/patch-base_win_win__util.h
electron34/patches/patch-base_win_win__util__unittest.cc
electron34/patches/patch-build_config_BUILD.gn
electron34/patches/patch-build_config_BUILDCONFIG.gn
electron34/patches/patch-build_config_clang_BUILD.gn
electron34/patches/patch-build_config_compiler_BUILD.gn
electron34/patches/patch-build_config_gcc_BUILD.gn
electron34/patches/patch-build_config_linux_BUILD.gn
electron34/patches/patch-build_config_linux_atk_BUILD.gn
electron34/patches/patch-build_config_linux_atspi2_BUILD.gn
electron34/patches/patch-build_config_linux_gtk_BUILD.gn
electron34/patches/patch-build_config_linux_libdrm_BUILD.gn
electron34/patches/patch-build_config_linux_pkg-config.py
electron34/patches/patch-build_config_ozone.gni
electron34/patches/patch-build_config_rust.gni
electron34/patches/patch-build_config_v8__target__cpu.gni
electron34/patches/patch-build_detect__host__arch.py
electron34/patches/patch-build_gn__run__binary.py
electron34/patches/patch-build_linux_chrome.map
electron34/patches/patch-build_linux_strip__binary.py
electron34/patches/patch-build_linux_unbundle_icu.gn
electron34/patches/patch-build_linux_unbundle_libevent.gn
electron34/patches/patch-build_linux_unbundle_libusb.gn
electron34/patches/patch-build_rust_allocator_BUILD.gn
electron34/patches/patch-build_rust_allocator_DEPS
electron34/patches/patch-build_rust_allocator_alias.cc
electron34/patches/patch-build_rust_allocator_alias.h
electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.cc
electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.h
electron34/patches/patch-build_rust_allocator_allocator__impls.cc
electron34/patches/patch-build_rust_allocator_allocator__impls.h
electron34/patches/patch-build_rust_allocator_allocator__impls__ffi.rs
electron34/patches/patch-build_rust_allocator_compiler__specific.h
electron34/patches/patch-build_rust_allocator_immediate__crash.h
electron34/patches/patch-build_rust_allocator_lib.rs
electron34/patches/patch-build_rust_cargo__crate.gni
electron34/patches/patch-build_rust_rust__bindgen.gni
electron34/patches/patch-build_rust_rust__bindgen__generator.gni
electron34/patches/patch-build_rust_rust__macro.gni
electron34/patches/patch-build_rust_rust__target.gni
electron34/patches/patch-build_rust_std_BUILD.gn
electron34/patches/patch-build_toolchain_freebsd_BUILD.gn
electron34/patches/patch-build_toolchain_gcc__solink__wrapper.py
electron34/patches/patch-build_toolchain_gcc__toolchain.gni
electron34/patches/patch-build_toolchain_netbsd_BUILD.gn
electron34/patches/patch-build_toolchain_openbsd_BUILD.gn
electron34/patches/patch-build_toolchain_toolchain.gni
electron34/patches/patch-build_toolchain_win_rc_rc.py
electron34/patches/patch-buildtools_reclient__cfgs_.gitignore
electron34/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py
electron34/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg
electron34/patches/patch-buildtools_third__party_libc++_BUILD.gn
electron34/patches/patch-buildtools_third__party_libc++_____config__site
electron34/patches/patch-buildtools_third__party_libc++abi_BUILD.gn
electron34/patches/patch-cc_base_features.cc
electron34/patches/patch-chrome_BUILD.gn
electron34/patches/patch-chrome_app_chrome__command__ids.h
electron34/patches/patch-chrome_app_chrome__main.cc
electron34/patches/patch-chrome_app_chrome__main__delegate.cc
electron34/patches/patch-chrome_browser_BUILD.gn
electron34/patches/patch-chrome_browser_about__flags.cc
electron34/patches/patch-chrome_browser_accessibility_page__colors.cc
electron34/patches/patch-chrome_browser_after__startup__task__utils.cc
electron34/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
electron34/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
electron34/patches/patch-chrome_browser_background_background__mode__manager.cc
electron34/patches/patch-chrome_browser_background_background__mode__optimizer.cc
electron34/patches/patch-chrome_browser_browser__features.cc
electron34/patches/patch-chrome_browser_browser__features.h
electron34/patches/patch-chrome_browser_browser__process__impl.cc
electron34/patches/patch-chrome_browser_browser__process__impl.h
electron34/patches/patch-chrome_browser_chrome__browser__field__trials.cc
electron34/patches/patch-chrome_browser_chrome__browser__field__trials.h
electron34/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
electron34/patches/patch-chrome_browser_chrome__browser__main.cc
electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
electron34/patches/patch-chrome_browser_chrome__browser__main__linux.cc
electron34/patches/patch-chrome_browser_chrome__browser__main__linux.h
electron34/patches/patch-chrome_browser_chrome__browser__main__posix.cc
electron34/patches/patch-chrome_browser_chrome__content__browser__client.cc
electron34/patches/patch-chrome_browser_chrome__content__browser__client.h
electron34/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
electron34/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
electron34/patches/patch-chrome_browser_defaults.cc
electron34/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
electron34/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h
electron34/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc
electron34/patches/patch-chrome_browser_download_download__commands.cc
electron34/patches/patch-chrome_browser_download_download__commands.h
electron34/patches/patch-chrome_browser_download_download__file__picker.cc
electron34/patches/patch-chrome_browser_download_download__item__model.cc
electron34/patches/patch-chrome_browser_download_download__prefs.cc
electron34/patches/patch-chrome_browser_download_download__prefs.h
electron34/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_common.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
electron34/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
electron34/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
electron34/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
electron34/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h
electron34/patches/patch-chrome_browser_enterprise_signin_interstitials_managed__profile__required__page.cc
electron34/patches/patch-chrome_browser_extensions_BUILD.gn
electron34/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
electron34/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
electron34/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
electron34/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc
electron34/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
electron34/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
electron34/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
electron34/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
electron34/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
electron34/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
electron34/patches/patch-chrome_browser_extensions_external__provider__impl.cc
electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc
electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.h
electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc
electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h
electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc
electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc
electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
electron34/patches/patch-chrome_browser_first__run_first__run__dialog.h
electron34/patches/patch-chrome_browser_first__run_first__run__internal.h
electron34/patches/patch-chrome_browser_flag__descriptions.cc
electron34/patches/patch-chrome_browser_flag__descriptions.h
electron34/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
electron34/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
electron34/patches/patch-chrome_browser_global__features.cc
electron34/patches/patch-chrome_browser_global__features.h
electron34/patches/patch-chrome_browser_headless_headless__mode__util.cc
electron34/patches/patch-chrome_browser_intranet__redirect__detector.h
electron34/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
electron34/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc
electron34/patches/patch-chrome_browser_media_audio__service__util.cc
electron34/patches/patch-chrome_browser_media_offscreen__tab.cc
electron34/patches/patch-chrome_browser_media_offscreen__tab.h
electron34/patches/patch-chrome_browser_media_router_discovery_BUILD.gn
electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h
electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc
electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h
electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc
electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h
electron34/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc
electron34/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
electron34/patches/patch-chrome_browser_memory__details.cc
electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
electron34/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
electron34/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc
electron34/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
electron34/patches/patch-chrome_browser_metrics_power_process__monitor.cc
electron34/patches/patch-chrome_browser_metrics_power_process__monitor.h
electron34/patches/patch-chrome_browser_net_profile__network__context__service.cc
electron34/patches/patch-chrome_browser_net_proxy__config__monitor.cc
electron34/patches/patch-chrome_browser_net_proxy__config__monitor.h
electron34/patches/patch-chrome_browser_net_system__network__context__manager.cc
electron34/patches/patch-chrome_browser_net_system__network__context__manager.h
electron34/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
electron34/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
electron34/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc
electron34/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc
electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h
electron34/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
electron34/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
electron34/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc
electron34/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc
electron34/patches/patch-chrome_browser_platform__util__linux.cc
electron34/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc
electron34/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc
electron34/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
electron34/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
electron34/patches/patch-chrome_browser_policy_device__management__service__configuration.cc
electron34/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
electron34/patches/patch-chrome_browser_predictors_preconnect__manager.cc
electron34/patches/patch-chrome_browser_predictors_preconnect__manager.h
electron34/patches/patch-chrome_browser_prefs_browser__prefs.cc
electron34/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
electron34/patches/patch-chrome_browser_printing_print__backend__service__manager.cc
electron34/patches/patch-chrome_browser_printing_print__job.cc
electron34/patches/patch-chrome_browser_printing_print__view__manager__base.cc
electron34/patches/patch-chrome_browser_printing_print__view__manager__base.h
electron34/patches/patch-chrome_browser_printing_printer__query.cc
electron34/patches/patch-chrome_browser_process__singleton.h
electron34/patches/patch-chrome_browser_process__singleton__posix.cc
electron34/patches/patch-chrome_browser_process__singleton__win.cc
electron34/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
electron34/patches/patch-chrome_browser_profiles_profile__impl.cc
electron34/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc
electron34/patches/patch-chrome_browser_profiles_profile__selections.cc
electron34/patches/patch-chrome_browser_profiles_profiles__state.cc
electron34/patches/patch-chrome_browser_renderer__preferences__util.cc
electron34/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
electron34/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
electron34/patches/patch-chrome_browser_resources_signin_signin__shared.css
electron34/patches/patch-chrome_browser_safe__browsing_chrome__password__protection__service.cc
electron34/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
electron34/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
electron34/patches/patch-chrome_browser_safe__browsing_safe__browsing__service.cc
electron34/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
electron34/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
electron34/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
electron34/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
electron34/patches/patch-chrome_browser_sessions_session__restore.cc
electron34/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
electron34/patches/patch-chrome_browser_shortcuts_icon__badging.cc
electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.cc
electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.h
electron34/patches/patch-chrome_browser_signin_signin__util.cc
electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc
electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h
electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc
electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.h
electron34/patches/patch-chrome_browser_supervised__user_classify__url__navigation__throttle.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.h
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.cc
electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.h
electron34/patches/patch-chrome_browser_sync_chrome__sync__controller__builder.cc
electron34/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc
electron34/patches/patch-chrome_browser_sync_sync__service__factory.cc
electron34/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc
electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.cc
electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.h
electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
electron34/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
electron34/patches/patch-chrome_browser_task__manager_task__manager__observer.h
electron34/patches/patch-chrome_browser_themes_theme__helper.cc
electron34/patches/patch-chrome_browser_themes_theme__service.cc
electron34/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc
electron34/patches/patch-chrome_browser_themes_theme__service__factory.cc
electron34/patches/patch-chrome_browser_ui_actions_chrome__action__id.h
electron34/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc
electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.cc
electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.h
electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
electron34/patches/patch-chrome_browser_ui_browser.cc
electron34/patches/patch-chrome_browser_ui_browser.h
electron34/patches/patch-chrome_browser_ui_browser__command__controller.cc
electron34/patches/patch-chrome_browser_ui_browser__commands.cc
electron34/patches/patch-chrome_browser_ui_browser__ui__prefs.cc
electron34/patches/patch-chrome_browser_ui_browser__view__prefs.cc
electron34/patches/patch-chrome_browser_ui_chrome__pages.cc
electron34/patches/patch-chrome_browser_ui_chrome__pages.h
electron34/patches/patch-chrome_browser_ui_color_BUILD.gn
electron34/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc
electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h
electron34/patches/patch-chrome_browser_ui_managed__ui.cc
electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc
electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h
electron34/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
electron34/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
electron34/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
electron34/patches/patch-chrome_browser_ui_sad__tab.cc
electron34/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc
electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
electron34/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc
electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
electron34/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc
electron34/patches/patch-chrome_browser_ui_tab__helpers.cc
electron34/patches/patch-chrome_browser_ui_tabs_features.cc
electron34/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc
electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.h
electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
electron34/patches/patch-chrome_browser_ui_test_popup__browsertest.cc
electron34/patches/patch-chrome_browser_ui_test_test__browser__ui.cc
electron34/patches/patch-chrome_browser_ui_ui__features.cc
electron34/patches/patch-chrome_browser_ui_ui__features.h
electron34/patches/patch-chrome_browser_ui_views_accelerator__table.cc
electron34/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
electron34/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h
electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
electron34/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.h
electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
electron34/patches/patch-chrome_browser_ui_views_frame_browser__view.cc
electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
electron34/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
electron34/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc
electron34/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc
electron34/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
electron34/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc
electron34/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc
electron34/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
electron34/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc
electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
electron34/patches/patch-chrome_browser_ui_views_tabs_tab.cc
electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.cc
electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.h
electron34/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
electron34/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
electron34/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.cc
electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.h
electron34/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
electron34/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
electron34/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.cc
electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.h
electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc
electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h
electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h
electron34/patches/patch-chrome_browser_ui_webui_app__settings_web__app__settings__ui.h
electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc
electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h
electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__configs.cc
electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
electron34/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
electron34/patches/patch-chrome_browser_ui_webui_internals_user__education_user__education__internals__page__handler__impl.cc
electron34/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc
electron34/patches/patch-chrome_browser_ui_webui_management_management__ui.cc
electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h
electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h
electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
electron34/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
electron34/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
electron34/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc
electron34/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc
electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.cc
electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.h
electron34/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
electron34/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc
electron34/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc
electron34/patches/patch-chrome_browser_web__applications_extension__status__utils.h
electron34/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc
electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
electron34/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
electron34/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
electron34/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
electron34/patches/patch-chrome_browser_web__applications_web__app__helpers.cc
electron34/patches/patch-chrome_browser_web__applications_web__app__install__info.h
electron34/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
electron34/patches/patch-chrome_browser_webauthn_enclave__manager.cc
electron34/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc
electron34/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc
electron34/patches/patch-chrome_browser_win_chrome__process__finder.cc
electron34/patches/patch-chrome_browser_win_chrome__process__finder.h
electron34/patches/patch-chrome_browser_win_titlebar__config.cc
electron34/patches/patch-chrome_common_channel__info.h
electron34/patches/patch-chrome_common_channel__info__posix.cc
electron34/patches/patch-chrome_common_chrome__features.cc
electron34/patches/patch-chrome_common_chrome__features.h
electron34/patches/patch-chrome_common_chrome__paths.cc
electron34/patches/patch-chrome_common_chrome__paths.h
electron34/patches/patch-chrome_common_chrome__paths__internal.h
electron34/patches/patch-chrome_common_chrome__switches.cc
electron34/patches/patch-chrome_common_chrome__switches.h
electron34/patches/patch-chrome_common_crash__keys.cc
electron34/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
electron34/patches/patch-chrome_common_media_cdm__host__file__path.cc
electron34/patches/patch-chrome_common_media_cdm__registration.cc
electron34/patches/patch-chrome_common_media_cdm__registration.h
electron34/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
electron34/patches/patch-chrome_common_pref__names.h
electron34/patches/patch-chrome_common_url__constants.h
electron34/patches/patch-chrome_common_webui__url__constants.cc
electron34/patches/patch-chrome_common_webui__url__constants.h
electron34/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc
electron34/patches/patch-chrome_enterprise__companion_lock.cc
electron34/patches/patch-chrome_installer_linux_BUILD.gn
electron34/patches/patch-chrome_services_printing_print__backend__service__impl.cc
electron34/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc
electron34/patches/patch-chrome_test_BUILD.gn
electron34/patches/patch-chrome_test_base_scoped__channel__override__posix.cc
electron34/patches/patch-chrome_test_chromedriver_chrome__launcher.cc
electron34/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
electron34/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc
electron34/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
electron34/patches/patch-chrome_test_supervised__user_google__auth__state__waiter__mixin.cc
electron34/patches/patch-chrome_updater_app_app__uninstall.cc
electron34/patches/patch-chrome_updater_configurator.cc
electron34/patches/patch-chrome_updater_lock.cc
electron34/patches/patch-chrome_updater_util_posix__util.cc
electron34/patches/patch-chrome_utility_services.cc
electron34/patches/patch-chromecast_browser_cast__browser__main__parts.cc
electron34/patches/patch-chromecast_browser_cast__content__browser__client.cc
electron34/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
electron34/patches/patch-chromecast_media_base_default__monotonic__clock.cc
electron34/patches/patch-components_autofill_core_browser_autofill__optimization__guide.cc
electron34/patches/patch-components_autofill_core_browser_payments__data__manager.cc
electron34/patches/patch-components_autofill_core_common_autofill__payments__features.cc
electron34/patches/patch-components_autofill_core_common_autofill__payments__features.h
electron34/patches/patch-components_autofill_core_common_autofill__prefs.cc
electron34/patches/patch-components_autofill_core_common_autofill__prefs.h
electron34/patches/patch-components_commerce_core_commerce__feature__list.cc
electron34/patches/patch-components_constrained__window_constrained__window__views.cc
electron34/patches/patch-components_content__settings_core_browser_website__settings__registry.cc
electron34/patches/patch-components_cookie__config_cookie__store__util.cc
electron34/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py
electron34/patches/patch-components_crash_core_app_BUILD.gn
electron34/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc
electron34/patches/patch-components_crash_core_app_crash__reporter__client.cc
electron34/patches/patch-components_crash_core_app_crash__reporter__client.h
electron34/patches/patch-components_crash_core_app_crashpad__handler__main.cc
electron34/patches/patch-components_crash_core_app_crashpad__linux.cc
electron34/patches/patch-components_crash_core_app_crashpad__mac.mm
electron34/patches/patch-components_crash_core_app_crashpad__win.cc
electron34/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
electron34/patches/patch-components_crash_core_common_BUILD.gn
electron34/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h
electron34/patches/patch-components_device__signals_core_browser_signals__aggregator.h
electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h
electron34/patches/patch-components_device__signals_core_browser_user__permission__service.h
electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc
electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h
electron34/patches/patch-components_device__signals_core_common_signals__features.cc
electron34/patches/patch-components_device__signals_core_common_signals__features.h
electron34/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc
electron34/patches/patch-components_device__signals_test_signals__contract.cc
electron34/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc
electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h
electron34/patches/patch-components_embedder__support_user__agent__utils.cc
electron34/patches/patch-components_embedder__support_user__agent__utils__unittest.cc
electron34/patches/patch-components_enterprise_watermarking_watermark.cc
electron34/patches/patch-components_eye__dropper_eye__dropper__view.cc
electron34/patches/patch-components_feature__engagement_public_event__constants.cc
electron34/patches/patch-components_feature__engagement_public_event__constants.h
electron34/patches/patch-components_feature__engagement_public_feature__configurations.cc
electron34/patches/patch-components_feature__engagement_public_feature__constants.cc
electron34/patches/patch-components_feature__engagement_public_feature__constants.h
electron34/patches/patch-components_feature__engagement_public_feature__list.cc
electron34/patches/patch-components_feature__engagement_public_feature__list.h
electron34/patches/patch-components_feed_core_proto_v2_wire_version.proto
electron34/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc
electron34/patches/patch-components_feed_core_v2_proto__util.cc
electron34/patches/patch-components_feed_core_v2_proto__util__unittest.cc
electron34/patches/patch-components_feed_core_v2_test_proto__printer.cc
electron34/patches/patch-components_flags__ui_flags__state.cc
electron34/patches/patch-components_gwp__asan_BUILD.gn
electron34/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
electron34/patches/patch-components_gwp__asan_client_gwp__asan.cc
electron34/patches/patch-components_gwp__asan_client_gwp__asan__features.cc
electron34/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
electron34/patches/patch-components_live__caption_caption__util.cc
electron34/patches/patch-components_live__caption_caption__util.h
electron34/patches/patch-components_media__router_common_media__source.cc
electron34/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
electron34/patches/patch-components_media__router_common_providers_cast_channel_enum__table.h
electron34/patches/patch-components_metrics_drive__metrics__provider__linux.cc
electron34/patches/patch-components_metrics_dwa_dwa__service.cc
electron34/patches/patch-components_metrics_metrics__log.cc
electron34/patches/patch-components_metrics_motherboard.cc
electron34/patches/patch-components_named__mojo__ipc__server_connection__info.h
electron34/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
electron34/patches/patch-components_named__system__lock_lock.h
electron34/patches/patch-components_neterror_resources_neterror.js
electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc
electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h
electron34/patches/patch-components_optimization__guide_core_optimization__guide__features.cc
electron34/patches/patch-components_optimization__guide_core_optimization__guide__util.cc
electron34/patches/patch-components_os__crypt_async_browser_secret__portal__key__provider.cc
electron34/patches/patch-components_os__crypt_async_common_encryptor.cc
electron34/patches/patch-components_os__crypt_sync_BUILD.gn
electron34/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
electron34/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc
electron34/patches/patch-components_os__crypt_sync_os__crypt.h
electron34/patches/patch-components_paint__preview_browser_paint__preview__client.cc
electron34/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
electron34/patches/patch-components_paint__preview_common_proto_paint__preview.proto
electron34/patches/patch-components_paint__preview_player_player__compositor__delegate.cc
electron34/patches/patch-components_password__manager_core_browser_features_password__features.cc
electron34/patches/patch-components_password__manager_core_browser_features_password__features.h
electron34/patches/patch-components_password__manager_core_browser_password__form__manager.cc
electron34/patches/patch-components_password__manager_core_browser_password__manager.cc
electron34/patches/patch-components_password__manager_core_browser_password__manager__client.h
electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.cc
electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.h
electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
electron34/patches/patch-components_password__manager_core_browser_password__store__factory__util.cc
electron34/patches/patch-components_password__manager_core_browser_password__store_login__database.cc
electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc
electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h
electron34/patches/patch-components_password__manager_core_common_password__manager__pref__names.h
electron34/patches/patch-components_performance__manager_decorators_process__metrics__decorator.cc
electron34/patches/patch-components_performance__manager_public_features.h
electron34/patches/patch-components_permissions_permission__util.cc
electron34/patches/patch-components_permissions_prediction__service_prediction__common.cc
electron34/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc
electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc
electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__refresh__scheduler.cc
electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc
electron34/patches/patch-components_policy_core_common_policy__loader__common.cc
electron34/patches/patch-components_policy_core_common_policy__paths.cc
electron34/patches/patch-components_policy_core_common_policy__utils.cc
electron34/patches/patch-components_policy_tools_generate__policy__source.py
electron34/patches/patch-components_power__metrics_BUILD.gn
electron34/patches/patch-components_power__metrics_energy__metrics__provider.cc
electron34/patches/patch-components_printing_browser_print__manager.cc
electron34/patches/patch-components_printing_browser_print__manager.h
electron34/patches/patch-components_printing_common_print.mojom
electron34/patches/patch-components_printing_renderer_print__render__frame__helper.cc
electron34/patches/patch-components_printing_renderer_print__render__frame__helper.h
electron34/patches/patch-components_remote__cocoa_app__shim_BUILD.gn
electron34/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
electron34/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm
electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h
electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
electron34/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
electron34/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
electron34/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
electron34/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
electron34/patches/patch-components_safe__browsing_core_common_features.cc
electron34/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
electron34/patches/patch-components_search__engines_template__url__service.cc
electron34/patches/patch-components_security__interstitials_content_utils.cc
electron34/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
electron34/patches/patch-components_services_on__device__translation_sandbox__hook.cc
electron34/patches/patch-components_services_on__device__translation_sandbox__hook.h
electron34/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
electron34/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc
electron34/patches/patch-components_soda_soda__util.cc
electron34/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc
electron34/patches/patch-components_storage__monitor_BUILD.gn
electron34/patches/patch-components_storage__monitor_removable__device__constants.cc
electron34/patches/patch-components_storage__monitor_removable__device__constants.h
electron34/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc
electron34/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
electron34/patches/patch-components_supervised__user_core_common_features.cc
electron34/patches/patch-components_supervised__user_core_common_features.h
electron34/patches/patch-components_supervised__user_core_common_pref__names.h
electron34/patches/patch-components_sync__device__info_local__device__info__util.cc
electron34/patches/patch-components_sync__device__info_local__device__info__util__linux.cc
electron34/patches/patch-components_sync_base_sync__util.cc
electron34/patches/patch-components_system__cpu_cpu__probe.cc
electron34/patches/patch-components_translate_core_common_translate__util.cc
electron34/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc
electron34/patches/patch-components_update__client_update__query__params.cc
electron34/patches/patch-components_upload__list_upload__list.cc
electron34/patches/patch-components_upload__list_upload__list.h
electron34/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
electron34/patches/patch-components_user__education_views_help__bubble__view.cc
electron34/patches/patch-components_variations_service_variations__service.cc
electron34/patches/patch-components_visited__url__ranking_public_url__visit__util.cc
electron34/patches/patch-components_viz_host_gpu__host__impl.cc
electron34/patches/patch-components_viz_host_host__display__client.cc
electron34/patches/patch-components_viz_host_host__display__client.h
electron34/patches/patch-components_viz_host_layered__window__updater__impl.cc
electron34/patches/patch-components_viz_host_layered__window__updater__impl.h
electron34/patches/patch-components_viz_service_BUILD.gn
electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider.h
electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc
electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h
electron34/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc
electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h
electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc
electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h
electron34/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc
electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.cc
electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.h
electron34/patches/patch-components_viz_service_display_skia__renderer.cc
electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
electron34/patches/patch-components_viz_test_fake__display__client.cc
electron34/patches/patch-components_viz_test_fake__display__client.h
electron34/patches/patch-components_viz_test_mock__display__client.h
electron34/patches/patch-components_viz_test_test__output__surface__provider.cc
electron34/patches/patch-components_viz_test_test__output__surface__provider.h
electron34/patches/patch-components_webrtc_media__stream__devices__controller.cc
electron34/patches/patch-components_webrtc_media__stream__devices__controller.h
electron34/patches/patch-content_app_BUILD.gn
electron34/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
electron34/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
electron34/patches/patch-content_app_content__main.cc
electron34/patches/patch-content_app_content__main__runner__impl.cc
electron34/patches/patch-content_browser_BUILD.gn
electron34/patches/patch-content_browser_audio_audio__service.cc
electron34/patches/patch-content_browser_browser__child__process__host__impl.cc
electron34/patches/patch-content_browser_browser__child__process__host__impl.h
electron34/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
electron34/patches/patch-content_browser_browser__main__loop.cc
electron34/patches/patch-content_browser_child__process__launcher.h
electron34/patches/patch-content_browser_child__process__launcher__helper.h
electron34/patches/patch-content_browser_child__process__launcher__helper__linux.cc
electron34/patches/patch-content_browser_child__process__launcher__helper__mac.cc
electron34/patches/patch-content_browser_child__process__launcher__helper__win.cc
electron34/patches/patch-content_browser_child__thread__type__switcher__linux.cc
electron34/patches/patch-content_browser_code__cache_generated__code__cache.cc
electron34/patches/patch-content_browser_code__cache_generated__code__cache.h
electron34/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc
electron34/patches/patch-content_browser_compositor_viz__process__transport__factory.cc
electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc
electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h
electron34/patches/patch-content_browser_devtools_protocol_system__info__handler.cc
electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h
electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc
electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h
electron34/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
electron34/patches/patch-content_browser_font__access_font__enumeration__data__source.cc
electron34/patches/patch-content_browser_gpu_compositor__util.cc
electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc
electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.h
electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h
electron34/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
electron34/patches/patch-content_browser_gpu_gpu__process__host.cc
electron34/patches/patch-content_browser_media_capture_desktop__capture__device.cc
electron34/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc
electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc
electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h
electron34/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
electron34/patches/patch-content_browser_media_frameless__media__interface__proxy.h
electron34/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc
electron34/patches/patch-content_browser_network__service__instance__impl.cc
electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.cc
electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.h
electron34/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc
electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.cc
electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.h
electron34/patches/patch-content_browser_permissions_permission__controller__impl.cc
electron34/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
electron34/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc
electron34/patches/patch-content_browser_renderer__host_delegated__frame__host.cc
electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc
electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h
electron34/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc
electron34/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
electron34/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc
electron34/patches/patch-content_browser_renderer__host_navigation__request.cc
electron34/patches/patch-content_browser_renderer__host_navigator.cc
electron34/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
electron34/patches/patch-content_browser_renderer__host_policy__container__host.cc
electron34/patches/patch-content_browser_renderer__host_policy__container__host.h
electron34/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc
electron34/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc
electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.cc
electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.h
electron34/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc
electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.cc
electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc
electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h
electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc
electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h
electron34/patches/patch-content_browser_renderer__host_text__input__manager.cc
electron34/patches/patch-content_browser_renderer__host_text__input__manager.h
electron34/patches/patch-content_browser_sandbox__host__linux.cc
electron34/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h
electron34/patches/patch-content_browser_service__process__host__impl.cc
electron34/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc
electron34/patches/patch-content_browser_service__worker_service__worker__registry.cc
electron34/patches/patch-content_browser_site__instance__impl.cc
electron34/patches/patch-content_browser_utility__process__host.cc
electron34/patches/patch-content_browser_utility__process__host.h
electron34/patches/patch-content_browser_utility__process__host__receiver__bindings.cc
electron34/patches/patch-content_browser_utility__sandbox__delegate.cc
electron34/patches/patch-content_browser_utility__sandbox__delegate.h
electron34/patches/patch-content_browser_v8__snapshot__files.cc
electron34/patches/patch-content_browser_web__contents_slow__web__preference__cache.cc
electron34/patches/patch-content_browser_web__contents_web__contents__impl.cc
electron34/patches/patch-content_browser_web__contents_web__contents__impl.h
electron34/patches/patch-content_browser_web__contents_web__contents__view__aura.cc
electron34/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc
electron34/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc
electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc
electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.h
electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h
electron34/patches/patch-content_child_BUILD.gn
electron34/patches/patch-content_child_child__process.cc
electron34/patches/patch-content_child_child__process.h
electron34/patches/patch-content_common_BUILD.gn
electron34/patches/patch-content_common_features.cc
electron34/patches/patch-content_common_features.h
electron34/patches/patch-content_common_font__list__unittest.cc
electron34/patches/patch-content_common_frame.mojom
electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h
electron34/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h
electron34/patches/patch-content_common_sandbox__init__win.cc
electron34/patches/patch-content_common_url__schemes.cc
electron34/patches/patch-content_common_user__agent.cc
electron34/patches/patch-content_gpu_gpu__child__thread.cc
electron34/patches/patch-content_gpu_gpu__main.cc
electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
electron34/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc
electron34/patches/patch-content_public_app_content__main__delegate.cc
electron34/patches/patch-content_public_app_content__main__delegate.h
electron34/patches/patch-content_public_browser_content__browser__client.cc
electron34/patches/patch-content_public_browser_content__browser__client.h
electron34/patches/patch-content_public_browser_desktop__media__id.h
electron34/patches/patch-content_public_browser_platform__notification__service.h
electron34/patches/patch-content_public_browser_render__view__host.h
electron34/patches/patch-content_public_browser_service__process__host.cc
electron34/patches/patch-content_public_browser_service__process__host.h
electron34/patches/patch-content_public_browser_service__process__info.h
electron34/patches/patch-content_public_browser_web__contents.h
electron34/patches/patch-content_public_browser_web__contents__delegate.cc
electron34/patches/patch-content_public_browser_web__contents__delegate.h
electron34/patches/patch-content_public_browser_web__contents__observer.h
electron34/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h
electron34/patches/patch-content_public_common_BUILD.gn
electron34/patches/patch-content_public_common_content__client.h
electron34/patches/patch-content_public_common_content__features.cc
electron34/patches/patch-content_public_common_content__switches.cc
electron34/patches/patch-content_public_common_content__switches.h
electron34/patches/patch-content_public_common_sandbox__init__win.h
electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc
electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h
electron34/patches/patch-content_public_common_zygote_features.gni
electron34/patches/patch-content_public_gpu_content__gpu__client.h
electron34/patches/patch-content_public_renderer_content__renderer__client.h
electron34/patches/patch-content_public_renderer_render__frame__observer.h
electron34/patches/patch-content_renderer_BUILD.gn
electron34/patches/patch-content_renderer_render__frame__impl.cc
electron34/patches/patch-content_renderer_render__frame__impl.h
electron34/patches/patch-content_renderer_render__process__impl.cc
electron34/patches/patch-content_renderer_render__thread__impl.cc
electron34/patches/patch-content_renderer_renderer__blink__platform__impl.cc
electron34/patches/patch-content_renderer_renderer__blink__platform__impl.h
electron34/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc
electron34/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
electron34/patches/patch-content_renderer_theme__helper__mac.mm
electron34/patches/patch-content_shell_BUILD.gn
electron34/patches/patch-content_shell_app_shell__main__delegate.cc
electron34/patches/patch-content_shell_browser_shell__browser__main__parts.cc
electron34/patches/patch-content_shell_browser_shell__paths.cc
electron34/patches/patch-content_shell_renderer_shell__content__renderer__client.cc
electron34/patches/patch-content_shell_utility_shell__content__utility__client.cc
electron34/patches/patch-content_test_BUILD.gn
electron34/patches/patch-content_test_mock__platform__notification__service.cc
electron34/patches/patch-content_test_mock__platform__notification__service.h
electron34/patches/patch-content_test_test__page__broadcast.h
electron34/patches/patch-content_utility_services.cc
electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
electron34/patches/patch-content_utility_utility__main.cc
electron34/patches/patch-content_utility_utility__thread__impl.cc
electron34/patches/patch-content_web__test_BUILD.gn
electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.cc
electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.h
electron34/patches/patch-content_zygote_BUILD.gn
electron34/patches/patch-content_zygote_zygote__linux.cc
electron34/patches/patch-content_zygote_zygote__main__linux.cc
electron34/patches/patch-device_bluetooth_BUILD.gn
electron34/patches/patch-device_bluetooth_bluetooth__adapter.cc
electron34/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
electron34/patches/patch-device_bluetooth_cast__bluetooth.gni
electron34/patches/patch-device_gamepad_BUILD.gn
electron34/patches/patch-device_gamepad_gamepad__provider.cc
electron34/patches/patch-device_gamepad_hid__writer__linux.cc
electron34/patches/patch-electron_BUILD.gn
electron34/patches/patch-electron_build_args_all.gn
electron34/patches/patch-electron_build_args_release.gn
electron34/patches/patch-electron_default__app_default__app.ts
electron34/patches/patch-electron_filenames.gni
electron34/patches/patch-electron_lib_browser_api_app.ts
electron34/patches/patch-electron_lib_browser_api_dialog.ts
electron34/patches/patch-electron_lib_browser_api_menu-item-roles.ts
electron34/patches/patch-electron_lib_browser_api_power-monitor.ts
electron34/patches/patch-electron_lib_browser_init.ts
electron34/patches/patch-electron_lib_browser_rpc-server.ts
electron34/patches/patch-electron_lib_renderer_api_clipboard.ts
electron34/patches/patch-electron_script_lib_config.py
electron34/patches/patch-electron_script_lib_utils.js
electron34/patches/patch-electron_script_spec-runner.js
electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.cc
electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.h
electron34/patches/patch-electron_shell_app_electron__main__delegate.cc
electron34/patches/patch-electron_shell_app_node__main.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__app.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.h
electron34/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h
electron34/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc
electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.h
electron34/patches/patch-electron_shell_browser_api_process__metric.h
electron34/patches/patch-electron_shell_browser_browser.cc
electron34/patches/patch-electron_shell_browser_browser.h
electron34/patches/patch-electron_shell_browser_browser__linux.cc
electron34/patches/patch-electron_shell_browser_browser__process__impl.cc
electron34/patches/patch-electron_shell_browser_browser__process__impl.h
electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.cc
electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.h
electron34/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
electron34/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
electron34/patches/patch-electron_shell_browser_native__window.cc
electron34/patches/patch-electron_shell_browser_native__window__views.cc
electron34/patches/patch-electron_shell_browser_native__window__views.h
electron34/patches/patch-electron_shell_browser_net_system__network__context__manager.cc
electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc
electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.h
electron34/patches/patch-electron_shell_browser_osr_osr__paint__event.h
electron34/patches/patch-electron_shell_browser_osr_osr__video__consumer.cc
electron34/patches/patch-electron_shell_browser_printing_printing__utils.cc
electron34/patches/patch-electron_shell_browser_relauncher__linux.cc
electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc
electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h
electron34/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc
electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.cc
electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.h
electron34/patches/patch-electron_shell_browser_ui_views_submenu__button.cc
electron34/patches/patch-electron_shell_common_api_electron__api__clipboard.cc
electron34/patches/patch-electron_shell_common_api_electron__api__native__image.cc
electron34/patches/patch-electron_shell_common_api_electron__api__native__image.h
electron34/patches/patch-electron_shell_common_api_electron__bindings.cc
electron34/patches/patch-electron_shell_common_electron__command__line.cc
electron34/patches/patch-electron_shell_common_electron__command__line.h
electron34/patches/patch-electron_shell_common_electron__paths.h
electron34/patches/patch-electron_shell_common_gin__converters_osr__converter.cc
electron34/patches/patch-electron_shell_common_gin__converters_std__converter.h
electron34/patches/patch-electron_shell_common_node__bindings.cc
electron34/patches/patch-electron_shell_common_node__bindings__linux.cc
electron34/patches/patch-electron_shell_common_platform__util.h
electron34/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
electron34/patches/patch-electron_shell_services_node_node__service.cc
electron34/patches/patch-electron_spec_api-app-spec.ts
electron34/patches/patch-electron_spec_api-browser-window-spec.ts
electron34/patches/patch-electron_spec_api-clipboard-spec.ts
electron34/patches/patch-electron_spec_api-content-tracing-spec.ts
electron34/patches/patch-electron_spec_api-crash-reporter-spec.ts
electron34/patches/patch-electron_spec_api-desktop-capturer-spec.ts
electron34/patches/patch-electron_spec_api-menu-spec.ts
electron34/patches/patch-electron_spec_api-native-image-spec.ts
electron34/patches/patch-electron_spec_api-net-log-spec.ts
electron34/patches/patch-electron_spec_api-notification-dbus-spec.ts
electron34/patches/patch-electron_spec_api-power-monitor-spec.ts
electron34/patches/patch-electron_spec_api-process-spec.ts
electron34/patches/patch-electron_spec_api-protocol-spec.ts
electron34/patches/patch-electron_spec_api-safe-storage-spec.ts
electron34/patches/patch-electron_spec_api-screen-spec.ts
electron34/patches/patch-electron_spec_api-shell-spec.ts
electron34/patches/patch-electron_spec_api-subframe-spec.ts
electron34/patches/patch-electron_spec_api-tray-spec.ts
electron34/patches/patch-electron_spec_api-utility-process-spec.ts
electron34/patches/patch-electron_spec_api-web-contents-spec.ts
electron34/patches/patch-electron_spec_api-web-frame-main-spec.ts
electron34/patches/patch-electron_spec_chromium-spec.ts
electron34/patches/patch-electron_spec_crash-spec.ts
electron34/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
electron34/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
electron34/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
electron34/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
electron34/patches/patch-electron_spec_node-spec.ts
electron34/patches/patch-electron_spec_version-bump-spec.ts
electron34/patches/patch-electron_spec_visibility-state-spec.ts
electron34/patches/patch-electron_spec_webview-spec.ts
electron34/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
electron34/patches/patch-extensions_browser_api_management_management__api.cc
electron34/patches/patch-extensions_browser_api_messaging_message__service.cc
electron34/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.cc
electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.h
electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc
electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h
electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc
electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h
electron34/patches/patch-extensions_browser_script__injection__tracker.cc
electron34/patches/patch-extensions_common_api___permission__features.json
electron34/patches/patch-extensions_common_api_runtime.json
electron34/patches/patch-extensions_common_command.cc
electron34/patches/patch-extensions_common_features_feature.cc
electron34/patches/patch-extensions_renderer_bindings_api__binding__util.cc
electron34/patches/patch-extensions_renderer_bindings_argument__spec.cc
electron34/patches/patch-extensions_renderer_script__injection.cc
electron34/patches/patch-extensions_shell_app_shell__main__delegate.cc
electron34/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
electron34/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc
electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc
electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.h
electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc
electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.h
electron34/patches/patch-gin_converter.cc
electron34/patches/patch-gin_converter.h
electron34/patches/patch-gin_isolate__holder.cc
electron34/patches/patch-gin_object__template__builder.cc
electron34/patches/patch-gin_object__template__builder.h
electron34/patches/patch-gin_public_gin__embedders.h
electron34/patches/patch-gin_public_isolate__holder.h
electron34/patches/patch-gin_public_v8__platform.h
electron34/patches/patch-gin_v8__initializer.cc
electron34/patches/patch-gin_v8__initializer.h
electron34/patches/patch-gin_v8__platform.cc
electron34/patches/patch-gin_wrappable.cc
electron34/patches/patch-gin_wrappable.h
electron34/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc
electron34/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc
electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__passthrough.cc
electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__unittest__base.cc
electron34/patches/patch-gpu_command__buffer_service_shared__context__state.cc
electron34/patches/patch-gpu_command__buffer_service_shared__context__state.h
electron34/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc
electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
electron34/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
electron34/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
electron34/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
electron34/patches/patch-gpu_config_gpu__control__list.cc
electron34/patches/patch-gpu_config_gpu__finch__features.cc
electron34/patches/patch-gpu_config_gpu__info__collector.cc
electron34/patches/patch-gpu_config_gpu__test__config.cc
electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h
electron34/patches/patch-gpu_ipc_service_BUILD.gn
electron34/patches/patch-gpu_ipc_service_gpu__init.cc
electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory__dxgi.cc
electron34/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h
electron34/patches/patch-gpu_ipc_service_x__util.h
electron34/patches/patch-gpu_vulkan_generate__bindings.py
electron34/patches/patch-gpu_vulkan_semaphore__handle.cc
electron34/patches/patch-gpu_vulkan_vulkan__device__queue.cc
electron34/patches/patch-gpu_vulkan_vulkan__device__queue.h
electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.cc
electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.h
electron34/patches/patch-gpu_vulkan_vulkan__image.h
electron34/patches/patch-gpu_vulkan_vulkan__util.cc
electron34/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
electron34/patches/patch-headless_lib_browser_headless__content__browser__client.cc
electron34/patches/patch-headless_lib_browser_headless__content__browser__client.h
electron34/patches/patch-headless_lib_browser_headless__web__contents__impl.cc
electron34/patches/patch-headless_lib_headless__content__main__delegate.cc
electron34/patches/patch-ipc_ipc__channel.h
electron34/patches/patch-ipc_ipc__channel__common.cc
electron34/patches/patch-ipc_ipc__channel__mojo.cc
electron34/patches/patch-ipc_ipc__message__utils.cc
electron34/patches/patch-ipc_ipc__message__utils.h
electron34/patches/patch-media_BUILD.gn
electron34/patches/patch-media_audio_BUILD.gn
electron34/patches/patch-media_audio_alsa_audio__manager__alsa.cc
electron34/patches/patch-media_audio_apple_audio__low__latency__input.cc
electron34/patches/patch-media_audio_audio__input__device.cc
electron34/patches/patch-media_audio_audio__output__proxy__unittest.cc
electron34/patches/patch-media_audio_pulse_pulse__util.cc
electron34/patches/patch-media_audio_sndio_audio__manager__sndio.cc
electron34/patches/patch-media_audio_sndio_audio__manager__sndio.h
electron34/patches/patch-media_audio_sndio_sndio__input.cc
electron34/patches/patch-media_audio_sndio_sndio__input.h
electron34/patches/patch-media_audio_sndio_sndio__output.cc
electron34/patches/patch-media_audio_sndio_sndio__output.h
electron34/patches/patch-media_base_audio__latency.cc
electron34/patches/patch-media_base_libaom__thread__wrapper.cc
electron34/patches/patch-media_base_libvpx__thread__wrapper.cc
electron34/patches/patch-media_base_media__switches.cc
electron34/patches/patch-media_base_media__switches.h
electron34/patches/patch-media_base_user__input__monitor__unittest.cc
electron34/patches/patch-media_base_video__frame.cc
electron34/patches/patch-media_base_video__frame.h
electron34/patches/patch-media_capture_content_video__capture__oracle.cc
electron34/patches/patch-media_capture_content_video__capture__oracle__unittest.cc
electron34/patches/patch-media_capture_video__capture__types.h
electron34/patches/patch-media_capture_video_create__video__capture__device__factory.cc
electron34/patches/patch-media_capture_video_fake__video__capture__device__factory.cc
electron34/patches/patch-media_capture_video_file__video__capture__device__factory.cc
electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc
electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.h
electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc
electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h
electron34/patches/patch-media_capture_video_linux_v4l2__capture__device.h
electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h
electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
electron34/patches/patch-media_capture_video_linux_video__capture__device__linux.cc
electron34/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
electron34/patches/patch-media_capture_video_video__capture__device__client.cc
electron34/patches/patch-media_cdm_cdm__paths__unittest.cc
electron34/patches/patch-media_cdm_library__cdm_cdm__paths.gni
electron34/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py
electron34/patches/patch-media_ffmpeg_scripts_robo__lib_config.py
electron34/patches/patch-media_gpu_buffer__validation.cc
electron34/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc
electron34/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
electron34/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
electron34/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc
electron34/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc
electron34/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
electron34/patches/patch-media_gpu_test_raw__video.cc
electron34/patches/patch-media_gpu_test_video__frame__file__writer.cc
electron34/patches/patch-media_gpu_test_video__frame__helpers.cc
electron34/patches/patch-media_gpu_test_video__frame__validator.cc
electron34/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc
electron34/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc
electron34/patches/patch-media_media__options.gni
electron34/patches/patch-media_mojo_mojom_stable_BUILD.gn
electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
electron34/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc
electron34/patches/patch-media_video_fake__gpu__memory__buffer.cc
electron34/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
electron34/patches/patch-media_video_renderable__gpu__memory__buffer__video__frame__pool.cc
electron34/patches/patch-media_video_video__encode__accelerator__adapter.cc
electron34/patches/patch-media_video_video__encode__accelerator__adapter__test.cc
electron34/patches/patch-media_webrtc_audio__processor.cc
electron34/patches/patch-media_webrtc_helpers.cc
electron34/patches/patch-media_webrtc_helpers__unittests.cc
electron34/patches/patch-mojo_core_BUILD.gn
electron34/patches/patch-mojo_core_channel.cc
electron34/patches/patch-mojo_core_embedder_features.h
electron34/patches/patch-mojo_core_ipcz__driver_transport.cc
electron34/patches/patch-mojo_core_platform__handle__in__transit.cc
electron34/patches/patch-mojo_public_cpp_platform_platform__handle.h
electron34/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc
electron34/patches/patch-mojo_public_tools_bindings_mojom.gni
electron34/patches/patch-net_BUILD.gn
electron34/patches/patch-net_base_features.cc
electron34/patches/patch-net_base_mock__network__change__notifier.cc
electron34/patches/patch-net_base_mock__network__change__notifier.h
electron34/patches/patch-net_base_network__change__notifier.cc
electron34/patches/patch-net_base_network__change__notifier.h
electron34/patches/patch-net_base_network__change__notifier__passive.cc
electron34/patches/patch-net_base_network__interfaces__posix.h
electron34/patches/patch-net_base_sockaddr__util__posix.cc
electron34/patches/patch-net_base_sockaddr__util__posix__unittest.cc
electron34/patches/patch-net_cert_cert__verify__proc.h
electron34/patches/patch-net_disk__cache_backend__experiment.h
electron34/patches/patch-net_disk__cache_simple_simple__file__tracker.cc
electron34/patches/patch-net_dns_BUILD.gn
electron34/patches/patch-net_dns_address__info.cc
electron34/patches/patch-net_dns_address__sorter__posix.cc
electron34/patches/patch-net_dns_dns__config__service__posix.cc
electron34/patches/patch-net_dns_dns__reloader.cc
electron34/patches/patch-net_dns_dns__util.cc
electron34/patches/patch-net_dns_host__resolver__proc.cc
electron34/patches/patch-net_dns_public_BUILD.gn
electron34/patches/patch-net_dns_public_resolv__reader.cc
electron34/patches/patch-net_dns_public_resolv__reader.h
electron34/patches/patch-net_dns_public_scoped__res__state.cc
electron34/patches/patch-net_dns_public_scoped__res__state.h
electron34/patches/patch-net_filter_zstd__source__stream.cc
electron34/patches/patch-net_http_http__auth__gssapi__posix.cc
electron34/patches/patch-net_http_http__auth__gssapi__posix.h
electron34/patches/patch-net_http_http__auth__handler__negotiate.cc
electron34/patches/patch-net_http_http__auth__preferences.cc
electron34/patches/patch-net_http_http__auth__preferences.h
electron34/patches/patch-net_http_http__network__session.cc
electron34/patches/patch-net_proxy__resolution_proxy__config__service.cc
electron34/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc
electron34/patches/patch-net_socket_socket__posix.cc
electron34/patches/patch-net_socket_socks5__client__socket.cc
electron34/patches/patch-net_socket_tcp__socket__posix.cc
electron34/patches/patch-net_socket_udp__socket__posix.cc
electron34/patches/patch-net_socket_udp__socket__unittest.cc
electron34/patches/patch-net_third__party_quiche_BUILD.gn
electron34/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
electron34/patches/patch-net_tools_net__watcher_net__watcher.cc
electron34/patches/patch-net_traffic__annotation_network__traffic__annotation.h
electron34/patches/patch-net_url__request_static__http__user__agent__settings.h
electron34/patches/patch-net_url__request_url__request__context.cc
electron34/patches/patch-net_url__request_url__request__context.h
electron34/patches/patch-net_url__request_url__request__context__builder.cc
electron34/patches/patch-pdf_pdfium_pdfium__engine.cc
electron34/patches/patch-ppapi_tests_test__utils.h
electron34/patches/patch-printing_backend_cups__ipp__helper.cc
electron34/patches/patch-printing_backend_print__backend__cups.cc
electron34/patches/patch-printing_mojom_printing__context__mojom__traits.cc
electron34/patches/patch-printing_mojom_printing__context__mojom__traits.h
electron34/patches/patch-printing_print__settings.cc
electron34/patches/patch-printing_print__settings.h
electron34/patches/patch-printing_print__settings__conversion.cc
electron34/patches/patch-printing_printing__context.cc
electron34/patches/patch-printing_printing__context.h
electron34/patches/patch-printing_printing__context__linux.cc
electron34/patches/patch-printing_printing__context__mac.h
electron34/patches/patch-printing_printing__context__mac.mm
electron34/patches/patch-printing_printing__context__system__dialog__win.cc
electron34/patches/patch-printing_printing__features.cc
electron34/patches/patch-printing_printing__features.h
electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
electron34/patches/patch-remoting_base_chromoting__event.cc
electron34/patches/patch-remoting_base_host__settings.cc
electron34/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc
electron34/patches/patch-remoting_host_base_desktop__environment__options.cc
electron34/patches/patch-remoting_host_base_switches.cc
electron34/patches/patch-remoting_host_base_switches.h
electron34/patches/patch-remoting_host_basic__desktop__environment.cc
electron34/patches/patch-remoting_host_chromoting__host.cc
electron34/patches/patch-remoting_host_chromoting__host.h
electron34/patches/patch-remoting_host_chromoting__host__context.cc
electron34/patches/patch-remoting_host_chromoting__host__services__client.cc
electron34/patches/patch-remoting_host_client__session.cc
electron34/patches/patch-remoting_host_crash_crash__file__uploader.cc
electron34/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc
electron34/patches/patch-remoting_host_desktop__capturer__proxy.cc
electron34/patches/patch-remoting_host_desktop__capturer__wrapper.cc
electron34/patches/patch-remoting_host_evaluate__capability.cc
electron34/patches/patch-remoting_host_host__attributes.cc
electron34/patches/patch-remoting_host_host__details.cc
electron34/patches/patch-remoting_host_host__main.cc
electron34/patches/patch-remoting_host_ipc__constants.cc
electron34/patches/patch-remoting_host_it2me_it2me__host.cc
electron34/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc
electron34/patches/patch-remoting_host_me2me__desktop__environment.cc
electron34/patches/patch-remoting_host_mojo__caller__security__checker.cc
electron34/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc
electron34/patches/patch-remoting_host_policy__watcher.cc
electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc
electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc
electron34/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc
electron34/patches/patch-remoting_host_remoting__me2me__host.cc
electron34/patches/patch-remoting_host_session__policies__from__dict.cc
electron34/patches/patch-remoting_host_setup_start__host__main.cc
electron34/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc
electron34/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc
electron34/patches/patch-remoting_protocol_webrtc__video__stream.cc
electron34/patches/patch-sandbox_BUILD.gn
electron34/patches/patch-sandbox_features.gni
electron34/patches/patch-sandbox_linux_BUILD.gn
electron34/patches/patch-sandbox_linux_services_init__process__reaper.cc
electron34/patches/patch-sandbox_linux_services_libc__interceptor.cc
electron34/patches/patch-sandbox_mac_BUILD.gn
electron34/patches/patch-sandbox_mac_sandbox__compiler.cc
electron34/patches/patch-sandbox_mac_sandbox__logging.cc
electron34/patches/patch-sandbox_mac_seatbelt.cc
electron34/patches/patch-sandbox_mac_seatbelt__extension.cc
electron34/patches/patch-sandbox_mac_system__services.cc
electron34/patches/patch-sandbox_policy_BUILD.gn
electron34/patches/patch-sandbox_policy_features.cc
electron34/patches/patch-sandbox_policy_features.h
electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
electron34/patches/patch-sandbox_policy_mac_sandbox__mac.mm
electron34/patches/patch-sandbox_policy_mojom_sandbox.mojom
electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc
electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
electron34/patches/patch-sandbox_policy_sandbox.cc
electron34/patches/patch-sandbox_policy_sandbox.h
electron34/patches/patch-sandbox_policy_sandbox__type.cc
electron34/patches/patch-sandbox_policy_switches.cc
electron34/patches/patch-sandbox_policy_switches.h
electron34/patches/patch-sandbox_policy_win_sandbox__win.cc
electron34/patches/patch-sandbox_policy_win_sandbox__win.h
electron34/patches/patch-services_audio_audio__sandbox__hook__linux.cc
electron34/patches/patch-services_audio_audio__sandbox__hook__linux.h
electron34/patches/patch-services_device_BUILD.gn
electron34/patches/patch-services_device_geolocation_location__provider__manager.cc
electron34/patches/patch-services_device_hid_BUILD.gn
electron34/patches/patch-services_device_hid_hid__connection__fido.cc
electron34/patches/patch-services_device_hid_hid__connection__fido.h
electron34/patches/patch-services_device_hid_hid__connection__freebsd.cc
electron34/patches/patch-services_device_hid_hid__connection__freebsd.h
electron34/patches/patch-services_device_hid_hid__service.cc
electron34/patches/patch-services_device_hid_hid__service__fido.cc
electron34/patches/patch-services_device_hid_hid__service__fido.h
electron34/patches/patch-services_device_hid_hid__service__freebsd.cc
electron34/patches/patch-services_device_hid_hid__service__freebsd.h
electron34/patches/patch-services_device_hid_hid__service__netbsd.cc
electron34/patches/patch-services_device_hid_hid__service__netbsd.h
electron34/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h
electron34/patches/patch-services_device_public_mojom_BUILD.gn
electron34/patches/patch-services_device_serial_BUILD.gn
electron34/patches/patch-services_device_serial_serial__device__enumerator.cc
electron34/patches/patch-services_device_serial_serial__io__handler__posix.cc
electron34/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc
electron34/patches/patch-services_device_usb_BUILD.gn
electron34/patches/patch-services_device_usb_usb__service.cc
electron34/patches/patch-services_device_usb_usb__service__fake.cc
electron34/patches/patch-services_device_usb_usb__service__fake.h
electron34/patches/patch-services_device_usb_usb__service__impl.cc
electron34/patches/patch-services_network_BUILD.gn
electron34/patches/patch-services_network_network__context.cc
electron34/patches/patch-services_network_network__context.h
electron34/patches/patch-services_network_network__sandbox__hook__linux.cc
electron34/patches/patch-services_network_network__sandbox__hook__linux.h
electron34/patches/patch-services_network_network__service.cc
electron34/patches/patch-services_network_network__service.h
electron34/patches/patch-services_network_public_cpp_BUILD.gn
electron34/patches/patch-services_network_public_cpp_features.cc
electron34/patches/patch-services_network_public_cpp_resource__request.cc
electron34/patches/patch-services_network_public_cpp_resource__request.h
electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc
electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.h
electron34/patches/patch-services_network_public_mojom_BUILD.gn
electron34/patches/patch-services_network_public_mojom_network__context.mojom
electron34/patches/patch-services_network_public_mojom_url__request.mojom
electron34/patches/patch-services_network_public_mojom_url__response__head.mojom
electron34/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h
electron34/patches/patch-services_network_test_test__network__context.h
electron34/patches/patch-services_network_url__loader.cc
electron34/patches/patch-services_network_url__loader.h
electron34/patches/patch-services_on__device__model_on__device__model__service.h
electron34/patches/patch-services_on__device__model_pre__sandbox__init.cc
electron34/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc
electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn
electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h
electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc
electron34/patches/patch-services_screen__ai_public_cpp_utilities.cc
electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc
electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h
electron34/patches/patch-services_service__manager_BUILD.gn
electron34/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn
electron34/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc
electron34/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom
electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.cc
electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.h
electron34/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom
electron34/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom
electron34/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom
electron34/patches/patch-skia_ext_SkMemory__new__handler.cpp
electron34/patches/patch-skia_ext_font__utils.cc
electron34/patches/patch-skia_ext_platform__canvas.h
electron34/patches/patch-skia_ext_skcolorspace__trfn.cc
electron34/patches/patch-third__party_.gitignore
electron34/patches/patch-third__party_abseil-cpp_absl_base_config.h
electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc
electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc
electron34/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h
electron34/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc
electron34/patches/patch-third__party_afl_src_afl-fuzz.c
electron34/patches/patch-third__party_angle_BUILD.gn
electron34/patches/patch-third__party_angle_src_common_platform.h
electron34/patches/patch-third__party_angle_src_common_platform__helpers.h
electron34/patches/patch-third__party_angle_src_common_system__utils.cpp
electron34/patches/patch-third__party_angle_src_common_system__utils__linux.cpp
electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
electron34/patches/patch-third__party_angle_src_libANGLE_Display.cpp
electron34/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp
electron34/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp
electron34/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h
electron34/patches/patch-third__party_angle_util_BUILD.gn
electron34/patches/patch-third__party_blink_common_features.cc
electron34/patches/patch-third__party_blink_common_permissions_permission__utils.cc
electron34/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc
electron34/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc
electron34/patches/patch-third__party_blink_public_common_features.h
electron34/patches/patch-third__party_blink_public_common_permissions_permission__utils.h
electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h
electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h
electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h
electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h
electron34/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom
electron34/patches/patch-third__party_blink_public_mojom_page_page.mojom
electron34/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom
electron34/patches/patch-third__party_blink_public_platform_platform.h
electron34/patches/patch-third__party_blink_public_platform_web__content__settings__client.h
electron34/patches/patch-third__party_blink_public_platform_web__vector.h
electron34/patches/patch-third__party_blink_public_web_web__blob.h
electron34/patches/patch-third__party_blink_public_web_web__document__loader.h
electron34/patches/patch-third__party_blink_public_web_web__local__frame.h
electron34/patches/patch-third__party_blink_public_web_web__local__frame__client.h
electron34/patches/patch-third__party_blink_public_web_web__message__port__converter.h
electron34/patches/patch-third__party_blink_public_web_web__script__execution__callback.h
electron34/patches/patch-third__party_blink_public_web_web__view.h
electron34/patches/patch-third__party_blink_public_web_web__window__features.h
electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc
electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc
electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h
electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc
electron34/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py
electron34/patches/patch-third__party_blink_renderer_build_scripts_gperf.py
electron34/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py
electron34/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc
electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc
electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h
electron34/patches/patch-third__party_blink_renderer_core_BUILD.gn
electron34/patches/patch-third__party_blink_renderer_core_animation_animation.cc
electron34/patches/patch-third__party_blink_renderer_core_animation_animation.h
electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.cc
electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.h
electron34/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc
electron34/patches/patch-third__party_blink_renderer_core_editing_build.gni
electron34/patches/patch-third__party_blink_renderer_core_editing_commands_clipboard__commands.cc
electron34/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc
electron34/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc
electron34/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc
electron34/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc
electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h
electron34/patches/patch-third__party_blink_renderer_core_frame_frame.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.h
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h
electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h
electron34/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc
electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h
electron34/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc
electron34/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc
electron34/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc
electron34/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc
electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc
electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.h
electron34/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h
electron34/patches/patch-third__party_blink_renderer_core_origin__trials_origin__trial__context.cc
electron34/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc
electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder.cc
electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.cc
electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.h
electron34/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc
electron34/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc
electron34/patches/patch-third__party_blink_renderer_core_view__transition_view__transition__test.cc
electron34/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc
electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h
electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc
electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc
electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc
electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_rtc__data__channel.cc
electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc
electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__global__scope.cc
electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.cc
electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.h
electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc
electron34/patches/patch-third__party_blink_renderer_modules_webaudio_script__processor__handler.h
electron34/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc
electron34/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc
electron34/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc
electron34/patches/patch-third__party_blink_renderer_platform_BUILD.gn
electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler.h
electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler__test.cc
electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc
electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc
electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc
electron34/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc
electron34/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc
electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.cc
electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.h
electron34/patches/patch-third__party_blink_renderer_platform_graphics_gpu_image__layer__bridge.cc
electron34/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc
electron34/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc
electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc
electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h
electron34/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc
electron34/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
electron34/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc
electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc
electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc
electron34/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h
electron34/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h
electron34/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc
electron34/patches/patch-third__party_boringssl_BUILD.gn
electron34/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c
electron34/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c
electron34/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c.inc
electron34/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c
electron34/patches/patch-third__party_boringssl_src_include_openssl_cipher.h
electron34/patches/patch-third__party_boringssl_src_include_openssl_digest.h
electron34/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc
electron34/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc
electron34/patches/patch-third__party_brotli_common_platform.h
electron34/patches/patch-third__party_cpuinfo_cpuinfo.gni
electron34/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni
electron34/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn
electron34/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc
electron34/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h
electron34/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h
electron34/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc
electron34/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc
electron34/patches/patch-third__party_crc32c_BUILD.gn
electron34/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h
electron34/patches/patch-third__party_dawn_src_dawn_common_Platform.h
electron34/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp
electron34/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts
electron34/patches/patch-third__party_electron__node_BUILD.gn
electron34/patches/patch-third__party_electron__node_common.gypi
electron34/patches/patch-third__party_electron__node_configure.py
electron34/patches/patch-third__party_electron__node_deps_ada_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_brotli_unofficial.gni
electron34/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h
electron34/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst
electron34/patches/patch-third__party_electron__node_deps_uv_include_uv.h
electron34/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h
electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h
electron34/patches/patch-third__party_electron__node_deps_uv_src_win_core.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_win_process.c
electron34/patches/patch-third__party_electron__node_deps_uv_src_win_util.c
electron34/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c
electron34/patches/patch-third__party_electron__node_deps_uv_test_test-list.h
electron34/patches/patch-third__party_electron__node_deps_uv_unofficial.gni
electron34/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn
electron34/patches/patch-third__party_electron__node_deps_uvwasi_src_uvwasi.c
electron34/patches/patch-third__party_electron__node_doc_api_cli.md
electron34/patches/patch-third__party_electron__node_electron__node.gni
electron34/patches/patch-third__party_electron__node_filenames.json
electron34/patches/patch-third__party_electron__node_lib_.eslintrc.yaml
electron34/patches/patch-third__party_electron__node_lib_child__process.js
electron34/patches/patch-third__party_electron__node_lib_internal_assert_utils.js
electron34/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js
electron34/patches/patch-third__party_electron__node_lib_internal_constants.js
electron34/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js
electron34/patches/patch-third__party_electron__node_lib_internal_http.js
electron34/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js
electron34/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js
electron34/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js
electron34/patches/patch-third__party_electron__node_lib_internal_url.js
electron34/patches/patch-third__party_electron__node_lib_internal_worker.js
electron34/patches/patch-third__party_electron__node_node.gypi
electron34/patches/patch-third__party_electron__node_src_api_environment.cc
electron34/patches/patch-third__party_electron__node_src_base__object-inl.h
electron34/patches/patch-third__party_electron__node_src_base__object.h
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc
electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.h
electron34/patches/patch-third__party_electron__node_src_env-inl.h
electron34/patches/patch-third__party_electron__node_src_env.cc
electron34/patches/patch-third__party_electron__node_src_env.h
electron34/patches/patch-third__party_electron__node_src_handle__wrap.cc
electron34/patches/patch-third__party_electron__node_src_histogram.cc
electron34/patches/patch-third__party_electron__node_src_inspector_BUILD.gn
electron34/patches/patch-third__party_electron__node_src_module__wrap.cc
electron34/patches/patch-third__party_electron__node_src_module__wrap.h
electron34/patches/patch-third__party_electron__node_src_node.cc
electron34/patches/patch-third__party_electron__node_src_node.h
electron34/patches/patch-third__party_electron__node_src_node__binding.cc
electron34/patches/patch-third__party_electron__node_src_node__binding.h
electron34/patches/patch-third__party_electron__node_src_node__buffer.h
electron34/patches/patch-third__party_electron__node_src_node__builtins.cc
electron34/patches/patch-third__party_electron__node_src_node__builtins.h
electron34/patches/patch-third__party_electron__node_src_node__constants.cc
electron34/patches/patch-third__party_electron__node_src_node__contextify.cc
electron34/patches/patch-third__party_electron__node_src_node__contextify.h
electron34/patches/patch-third__party_electron__node_src_node__env__var.cc
electron34/patches/patch-third__party_electron__node_src_node__errors.cc
electron34/patches/patch-third__party_electron__node_src_node__errors.h
electron34/patches/patch-third__party_electron__node_src_node__external__reference.h
electron34/patches/patch-third__party_electron__node_src_node__file.cc
electron34/patches/patch-third__party_electron__node_src_node__file.h
electron34/patches/patch-third__party_electron__node_src_node__i18n.cc
electron34/patches/patch-third__party_electron__node_src_node__internals.h
electron34/patches/patch-third__party_electron__node_src_node__messaging.cc
electron34/patches/patch-third__party_electron__node_src_node__metadata.h
electron34/patches/patch-third__party_electron__node_src_node__options.cc
electron34/patches/patch-third__party_electron__node_src_node__options.h
electron34/patches/patch-third__party_electron__node_src_node__platform.cc
electron34/patches/patch-third__party_electron__node_src_node__platform.h
electron34/patches/patch-third__party_electron__node_src_node__process__object.cc
electron34/patches/patch-third__party_electron__node_src_node__serdes.cc
electron34/patches/patch-third__party_electron__node_src_node__trace__events.cc
electron34/patches/patch-third__party_electron__node_src_node__wasi.cc
electron34/patches/patch-third__party_electron__node_src_stream__base.cc
electron34/patches/patch-third__party_electron__node_src_stream__base.h
electron34/patches/patch-third__party_electron__node_src_tracing_agent.cc
electron34/patches/patch-third__party_electron__node_src_tracing_agent.h
electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc
electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc
electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h
electron34/patches/patch-third__party_electron__node_src_tracing_trace__event.h
electron34/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc
electron34/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc
electron34/patches/patch-third__party_electron__node_test_cctest_test__environment.cc
electron34/patches/patch-third__party_electron__node_test_common_debugger.js
electron34/patches/patch-third__party_electron__node_test_common_globals.js
electron34/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js
electron34/patches/patch-third__party_electron__node_test_fixtures_errors_promise__unhandled__warn__with__error.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__error__with__getter__throw.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__null.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__undefined.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_eval_eval__messages.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_eval_stdin__messages.snapshot
electron34/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js
electron34/patches/patch-third__party_electron__node_test_parallel_parallel.status
electron34/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-cli-node-options.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs
electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs
electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-eval.mjs
electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs
electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js
electron34/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js
electron34/patches/patch-third__party_electron__node_test_sequential_sequential.status
electron34/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js
electron34/patches/patch-third__party_electron__node_test_wpt_status_streams.json
electron34/patches/patch-third__party_electron__node_tools_generate__gn__filenames__json.py
electron34/patches/patch-third__party_electron__node_tools_generate__original__fs.py
electron34/patches/patch-third__party_electron__node_tools_install.py
electron34/patches/patch-third__party_electron__node_tools_js2c.cc
electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg
electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg
electron34/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py
electron34/patches/patch-third__party_engflow-reclient-configs_python_python__remote__wrapper.template
electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg
electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg
electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg
electron34/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg
electron34/patches/patch-third__party_ffmpeg_BUILD.gn
electron34/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h
electron34/patches/patch-third__party_ffmpeg_libavutil_cpu.c
electron34/patches/patch-third__party_ffmpeg_libavutil_mem.c
electron34/patches/patch-third__party_ffmpeg_libavutil_random__seed.c
electron34/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm
electron34/patches/patch-third__party_fontconfig_include_config.h
electron34/patches/patch-third__party_fontconfig_src_src_fccompat.c
electron34/patches/patch-third__party_ipcz_src_reference__drivers_random.cc
electron34/patches/patch-third__party_ipcz_src_standalone_base_logging.cc
electron34/patches/patch-third__party_leveldatabase_env__chromium.cc
electron34/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c
electron34/patches/patch-third__party_libc++_src_src_chrono.cpp
electron34/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp
electron34/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h
electron34/patches/patch-third__party_libdrm_src_xf86drmMode.c
electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h
electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h
electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h
electron34/patches/patch-third__party_libsync_src_include_sync_sync.h
electron34/patches/patch-third__party_libsync_src_sync.c
electron34/patches/patch-third__party_libusb_BUILD.gn
electron34/patches/patch-third__party_libusb_src_libusb_core.c
electron34/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c
electron34/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
electron34/patches/patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S
electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm
electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm
electron34/patches/patch-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm
electron34/patches/patch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm
electron34/patches/patch-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm
electron34/patches/patch-third__party_lzma__sdk_BUILD.gn
electron34/patches/patch-third__party_lzma__sdk_C_7z.h
electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.c
electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.h
electron34/patches/patch-third__party_lzma__sdk_C_7zArcIn.c
electron34/patches/patch-third__party_lzma__sdk_C_7zBuf.h
electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.c
electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.h
electron34/patches/patch-third__party_lzma__sdk_C_7zCrcOpt.c
electron34/patches/patch-third__party_lzma__sdk_C_7zDec.c
electron34/patches/patch-third__party_lzma__sdk_C_7zFile.c
electron34/patches/patch-third__party_lzma__sdk_C_7zFile.h
electron34/patches/patch-third__party_lzma__sdk_C_7zStream.c
electron34/patches/patch-third__party_lzma__sdk_C_7zTypes.h
electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.h
electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.rc
electron34/patches/patch-third__party_lzma__sdk_C_7zWindows.h
electron34/patches/patch-third__party_lzma__sdk_C_Alloc.c
electron34/patches/patch-third__party_lzma__sdk_C_Alloc.h
electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.c
electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.h
electron34/patches/patch-third__party_lzma__sdk_C_Bra.c
electron34/patches/patch-third__party_lzma__sdk_C_Bra.h
electron34/patches/patch-third__party_lzma__sdk_C_Bra86.c
electron34/patches/patch-third__party_lzma__sdk_C_BraIA64.c
electron34/patches/patch-third__party_lzma__sdk_C_Compiler.h
electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.c
electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.h
electron34/patches/patch-third__party_lzma__sdk_C_Delta.h
electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.c
electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.h
electron34/patches/patch-third__party_lzma__sdk_C_LzFind.c
electron34/patches/patch-third__party_lzma__sdk_C_LzFind.h
electron34/patches/patch-third__party_lzma__sdk_C_LzHash.h
electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.c
electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.h
electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.c
electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.h
electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.c
electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.h
electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.c
electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.h
electron34/patches/patch-third__party_lzma__sdk_C_Precomp.h
electron34/patches/patch-third__party_lzma__sdk_C_RotateDefs.h
electron34/patches/patch-third__party_lzma__sdk_C_Sha256.c
electron34/patches/patch-third__party_lzma__sdk_C_Sha256.h
electron34/patches/patch-third__party_lzma__sdk_C_Sha256Opt.c
electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn
electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_Precomp.h
electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c
electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_chromium.patch
electron34/patches/patch-third__party_lzma__sdk_C_Xz.c
electron34/patches/patch-third__party_lzma__sdk_C_Xz.h
electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.c
electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.h
electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64Opt.c
electron34/patches/patch-third__party_lzma__sdk_C_XzDec.c
electron34/patches/patch-third__party_lzma__sdk_C_XzIn.c
electron34/patches/patch-third__party_lzma__sdk_DEPS
electron34/patches/patch-third__party_lzma__sdk_README.chromium
electron34/patches/patch-third__party_lzma__sdk_chromium.patch
electron34/patches/patch-third__party_lzma__sdk_chromium__ubsan.patch
electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader.cc
electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader__unittest.cc
electron34/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc
electron34/patches/patch-third__party_nan_nan.h
electron34/patches/patch-third__party_nan_nan__callbacks__12__inl.h
electron34/patches/patch-third__party_nan_nan__persistent__12__inl.h
electron34/patches/patch-third__party_nan_nan__scriptorigin.h
electron34/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp
electron34/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp
electron34/patches/patch-third__party_nan_test_cpp_news.cpp
electron34/patches/patch-third__party_nan_test_js_accessors-test.js
electron34/patches/patch-third__party_nasm_BUILD.gn
electron34/patches/patch-third__party_nasm_config_config-linux.h
electron34/patches/patch-third__party_node_node.gni
electron34/patches/patch-third__party_node_node.py
electron34/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp
electron34/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp
electron34/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp
electron34/patches/patch-third__party_pdfium_pdfium.gni
electron34/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp
electron34/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h
electron34/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h
electron34/patches/patch-third__party_perfetto_include_perfetto_base_time.h
electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h
electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h
electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h
electron34/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h
electron34/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto
electron34/patches/patch-third__party_perfetto_src_base_clock__snapshots.cc
electron34/patches/patch-third__party_perfetto_src_base_event__fd.cc
electron34/patches/patch-third__party_perfetto_src_base_periodic__task.cc
electron34/patches/patch-third__party_perfetto_src_base_string__utils.cc
electron34/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc
electron34/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc
electron34/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc
electron34/patches/patch-third__party_perfetto_src_base_unix__socket.cc
electron34/patches/patch-third__party_perfetto_src_base_utils.cc
electron34/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc
electron34/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc
electron34/patches/patch-third__party_perfetto_src_tracing_platform__posix.cc
electron34/patches/patch-third__party_perfetto_src_tracing_track.cc
electron34/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h
electron34/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h
electron34/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp
electron34/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp
electron34/patches/patch-third__party_speech-dispatcher_libspeechd__version.h
electron34/patches/patch-third__party_speech-dispatcher_speechd__types.h
electron34/patches/patch-third__party_sqlite_BUILD.gn
electron34/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c
electron34/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c
electron34/patches/patch-third__party_squirrel.mac_.gitignore
electron34/patches/patch-third__party_squirrel.mac_BUILD.gn
electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h
electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m
electron34/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
electron34/patches/patch-third__party_squirrel.mac_build_xcrun.gni
electron34/patches/patch-third__party_squirrel.mac_build_xcrun.py
electron34/patches/patch-third__party_squirrel.mac_filenames.gni
electron34/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m
electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m
electron34/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp
electron34/patches/patch-third__party_swiftshader_src_System_Configurator.cpp
electron34/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp
electron34/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp
electron34/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp
electron34/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h
electron34/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h
electron34/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp
electron34/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp
electron34/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn
electron34/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc
electron34/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc
electron34/patches/patch-third__party_tflite_features.gni
electron34/patches/patch-third__party_unrar_src_crc.cpp
electron34/patches/patch-third__party_unrar_src_crypt.cpp
electron34/patches/patch-third__party_unrar_src_os.hpp
electron34/patches/patch-third__party_unrar_src_rijndael.cpp
electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h
electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp
electron34/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h
electron34/patches/patch-third__party_wayland_BUILD.gn
electron34/patches/patch-third__party_wayland_include_config.h
electron34/patches/patch-third__party_webrtc_BUILD.gn
electron34/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc
electron34/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc
electron34/patches/patch-third__party_webrtc_modules_video__capture_linux_pipewire__session.cc
electron34/patches/patch-third__party_webrtc_modules_video__coding_codecs_av1_libaom__av1__encoder.cc
electron34/patches/patch-third__party_webrtc_rtc__base_byte__order.h
electron34/patches/patch-third__party_webrtc_rtc__base_ip__address.cc
electron34/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc
electron34/patches/patch-third__party_webrtc_rtc__base_network.cc
electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc
electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h
electron34/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc
electron34/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h
electron34/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn
electron34/patches/patch-third__party_widevine_cdm_widevine.gni
electron34/patches/patch-third__party_zlib_BUILD.gn
electron34/patches/patch-third__party_zlib_cpu__features.c
electron34/patches/patch-tools_clang_scripts_update.py
electron34/patches/patch-tools_generate__shim__headers_generate__shim__headers.py
electron34/patches/patch-tools_generate__stubs_rules.gni
electron34/patches/patch-tools_gn_build_build__linux.ninja.template
electron34/patches/patch-tools_gn_build_gen.py
electron34/patches/patch-tools_gn_src_base_files_file__posix.cc
electron34/patches/patch-tools_gn_src_gn_version.h
electron34/patches/patch-tools_gn_src_util_exe__path.cc
electron34/patches/patch-tools_grit_grit_node_base.py
electron34/patches/patch-tools_gritsettings_resource__ids.spec
electron34/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py
electron34/patches/patch-tools_json__schema__compiler_feature__compiler.py
electron34/patches/patch-tools_licenses_licenses.py
electron34/patches/patch-tools_memory_partition__allocator_inspect__utils.h
electron34/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn
electron34/patches/patch-tools_protoc__wrapper_protoc__wrapper.py
electron34/patches/patch-tools_v8__context__snapshot_BUILD.gn
electron34/patches/patch-tools_variations_fieldtrial__to__struct.py
electron34/patches/patch-ui_accelerated__widget__mac_BUILD.gn
electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h
electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm
electron34/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
electron34/patches/patch-ui_accessibility_platform_BUILD.gn
electron34/patches/patch-ui_accessibility_platform_browser__accessibility__manager__mac.mm
electron34/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
electron34/patches/patch-ui_aura_client_drag__drop__client.h
electron34/patches/patch-ui_aura_screen__ozone.cc
electron34/patches/patch-ui_aura_screen__ozone.h
electron34/patches/patch-ui_base_BUILD.gn
electron34/patches/patch-ui_base_accelerators_accelerator.cc
electron34/patches/patch-ui_base_accelerators_accelerator.h
electron34/patches/patch-ui_base_accelerators_accelerator__unittest.cc
electron34/patches/patch-ui_base_accelerators_media__keys__listener.cc
electron34/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm
electron34/patches/patch-ui_base_clipboard_clipboard__constants.cc
electron34/patches/patch-ui_base_clipboard_clipboard__constants.h
electron34/patches/patch-ui_base_clipboard_clipboard__non__backed.cc
electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc
electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h
electron34/patches/patch-ui_base_cocoa_remote__accessibility__api.h
electron34/patches/patch-ui_base_cocoa_remote__layer__api.h
electron34/patches/patch-ui_base_cocoa_remote__layer__api.mm
electron34/patches/patch-ui_base_cursor_cursor__factory.cc
electron34/patches/patch-ui_base_cursor_cursor__factory.h
electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc
electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc
electron34/patches/patch-ui_base_ime_dummy__text__input__client.cc
electron34/patches/patch-ui_base_ime_dummy__text__input__client.h
electron34/patches/patch-ui_base_ime_fake__text__input__client.cc
electron34/patches/patch-ui_base_ime_fake__text__input__client.h
electron34/patches/patch-ui_base_ime_init_input__method__initializer.cc
electron34/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc
electron34/patches/patch-ui_base_ime_text__input__client.h
electron34/patches/patch-ui_base_resource_resource__bundle.cc
electron34/patches/patch-ui_base_test_skia__gold__pixel__diff.cc
electron34/patches/patch-ui_base_test_ui__controls.h
electron34/patches/patch-ui_base_ui__base__features.cc
electron34/patches/patch-ui_base_ui__base__features.h
electron34/patches/patch-ui_base_ui__base__switches.cc
electron34/patches/patch-ui_base_ui__base__switches.h
electron34/patches/patch-ui_base_webui_web__ui__util.cc
electron34/patches/patch-ui_base_x_x11__cursor__factory.cc
electron34/patches/patch-ui_base_x_x11__cursor__factory.h
electron34/patches/patch-ui_base_x_x11__cursor__loader.cc
electron34/patches/patch-ui_base_x_x11__display__manager.cc
electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.cc
electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.h
electron34/patches/patch-ui_base_x_x11__shm__image__pool.cc
electron34/patches/patch-ui_color_color__id.h
electron34/patches/patch-ui_color_color__provider__utils.cc
electron34/patches/patch-ui_color_system__theme.h
electron34/patches/patch-ui_color_ui__color__mixer.cc
electron34/patches/patch-ui_color_win_native__color__mixers__win.cc
electron34/patches/patch-ui_compositor_compositor.cc
electron34/patches/patch-ui_compositor_compositor.h
electron34/patches/patch-ui_compositor_compositor__observer.h
electron34/patches/patch-ui_display_BUILD.gn
electron34/patches/patch-ui_display_mac_screen__mac.mm
electron34/patches/patch-ui_display_screen.cc
electron34/patches/patch-ui_display_screen.h
electron34/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc
electron34/patches/patch-ui_events_event.cc
electron34/patches/patch-ui_events_event.h
electron34/patches/patch-ui_events_event__switches.cc
electron34/patches/patch-ui_events_event__switches.h
electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.cc
electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.h
electron34/patches/patch-ui_events_x_events__x__utils.cc
electron34/patches/patch-ui_gfx_BUILD.gn
electron34/patches/patch-ui_gfx_ca__layer__params.h
electron34/patches/patch-ui_gfx_canvas__skia.cc
electron34/patches/patch-ui_gfx_font__fallback__linux.cc
electron34/patches/patch-ui_gfx_font__render__params.h
electron34/patches/patch-ui_gfx_font__render__params__linux.cc
electron34/patches/patch-ui_gfx_font__util.cc
electron34/patches/patch-ui_gfx_gpu__memory__buffer.cc
electron34/patches/patch-ui_gfx_gpu__memory__buffer.h
electron34/patches/patch-ui_gfx_linux_dmabuf__uapi.h
electron34/patches/patch-ui_gfx_linux_gbm__wrapper.cc
electron34/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc
electron34/patches/patch-ui_gfx_mojom_ca__layer__params.mojom
electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc
electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h
electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc
electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h
electron34/patches/patch-ui_gfx_native__pixmap__handle.cc
electron34/patches/patch-ui_gfx_native__pixmap__handle.h
electron34/patches/patch-ui_gfx_native__widget__types.h
electron34/patches/patch-ui_gfx_platform__font__mac.mm
electron34/patches/patch-ui_gfx_platform__font__skia.cc
electron34/patches/patch-ui_gfx_render__text__api__fuzzer.cc
electron34/patches/patch-ui_gfx_render__text__fuzzer.cc
electron34/patches/patch-ui_gfx_switches.cc
electron34/patches/patch-ui_gfx_switches.h
electron34/patches/patch-ui_gfx_x_atom__cache.cc
electron34/patches/patch-ui_gfx_x_generated__protos_dri3.cc
electron34/patches/patch-ui_gfx_x_generated__protos_shm.cc
electron34/patches/patch-ui_gfx_x_xlib__support.cc
electron34/patches/patch-ui_gl_BUILD.gn
electron34/patches/patch-ui_gl_gl__context.cc
electron34/patches/patch-ui_gl_gl__fence.cc
electron34/patches/patch-ui_gl_gl__implementation.cc
electron34/patches/patch-ui_gl_gl__switches.cc
electron34/patches/patch-ui_gl_sync__control__vsync__provider.cc
electron34/patches/patch-ui_gl_sync__control__vsync__provider.h
electron34/patches/patch-ui_gtk_gtk__compat.cc
electron34/patches/patch-ui_gtk_gtk__compat.h
electron34/patches/patch-ui_gtk_gtk__ui.cc
electron34/patches/patch-ui_gtk_gtk__ui.h
electron34/patches/patch-ui_gtk_printing_print__dialog__gtk.cc
electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc
electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.h
electron34/patches/patch-ui_gtk_window__frame__provider__gtk.cc
electron34/patches/patch-ui_gtk_window__frame__provider__gtk.h
electron34/patches/patch-ui_linux_fallback__linux__ui.cc
electron34/patches/patch-ui_linux_fallback__linux__ui.h
electron34/patches/patch-ui_linux_linux__ui.h
electron34/patches/patch-ui_menus_simple__menu__model.cc
electron34/patches/patch-ui_menus_simple__menu__model.h
electron34/patches/patch-ui_message__center_views_message__popup__view.cc
electron34/patches/patch-ui_native__theme_native__theme.cc
electron34/patches/patch-ui_native__theme_native__theme.h
electron34/patches/patch-ui_native__theme_native__theme__base.cc
electron34/patches/patch-ui_native__theme_native__theme__features.cc
electron34/patches/patch-ui_native__theme_native__theme__win.cc
electron34/patches/patch-ui_ozone_common_egl__util.cc
electron34/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc
electron34/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc
electron34/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc
electron34/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc
electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc
electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h
electron34/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context__unittest.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc
electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h
electron34/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc
electron34/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc
electron34/patches/patch-ui_ozone_platform_x11_BUILD.gn
electron34/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc
electron34/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc
electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc
electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h
electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc
electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h
electron34/patches/patch-ui_ozone_platform_x11_x11__window.cc
electron34/patches/patch-ui_ozone_public_ozone__platform.h
electron34/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h
electron34/patches/patch-ui_ozone_test_mock__platform__window__delegate.h
electron34/patches/patch-ui_platform__window_platform__window__delegate.cc
electron34/patches/patch-ui_platform__window_platform__window__delegate.h
electron34/patches/patch-ui_platform__window_platform__window__init__properties.h
electron34/patches/patch-ui_qt_BUILD.gn
electron34/patches/patch-ui_qt_qt.gni
electron34/patches/patch-ui_qt_qt__ui.cc
electron34/patches/patch-ui_qt_qt__ui.h
electron34/patches/patch-ui_shell__dialogs_select__file__dialog.h
electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc
electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h
electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc
electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h
electron34/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__th.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb
electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb
electron34/patches/patch-ui_strings_ui__strings.grd
electron34/patches/patch-ui_views_BUILD.gn
electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h
electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
electron34/patches/patch-ui_views_controls_button_label__button.cc
electron34/patches/patch-ui_views_controls_menu_menu__controller.cc
electron34/patches/patch-ui_views_controls_menu_menu__controller.h
electron34/patches/patch-ui_views_controls_menu_menu__runner.cc
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.cc
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h
electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm
electron34/patches/patch-ui_views_controls_prefix__selector.cc
electron34/patches/patch-ui_views_controls_prefix__selector.h
electron34/patches/patch-ui_views_controls_textfield_textfield.cc
electron34/patches/patch-ui_views_controls_textfield_textfield.h
electron34/patches/patch-ui_views_controls_webview_BUILD.gn
electron34/patches/patch-ui_views_controls_webview_web__dialog__view.cc
electron34/patches/patch-ui_views_controls_webview_web__dialog__view.h
electron34/patches/patch-ui_views_corewm_tooltip__aura.cc
electron34/patches/patch-ui_views_examples_widget__example.cc
electron34/patches/patch-ui_views_focus_focus__manager.cc
electron34/patches/patch-ui_views_style_platform__style.cc
electron34/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc
electron34/patches/patch-ui_views_views__delegate.cc
electron34/patches/patch-ui_views_views__delegate.h
electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc
electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h
electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc
electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc
electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h
electron34/patches/patch-ui_views_widget_root__view.cc
electron34/patches/patch-ui_views_widget_widget.cc
electron34/patches/patch-ui_views_win_hwnd__message__handler.cc
electron34/patches/patch-ui_views_win_hwnd__message__handler__delegate.h
electron34/patches/patch-ui_views_window_custom__frame__view.cc
electron34/patches/patch-ui_views_window_dialog__delegate.cc
electron34/patches/patch-ui_views_window_frame__background.cc
electron34/patches/patch-ui_views_window_frame__caption__button.cc
electron34/patches/patch-ui_views_window_frame__caption__button.h
electron34/patches/patch-url_url__util.cc
electron34/patches/patch-url_url__util.h
electron34/patches/patch-v8_BUILD.gn
electron34/patches/patch-v8_include_v8-fast-api-calls.h
electron34/patches/patch-v8_include_v8-internal.h
electron34/patches/patch-v8_include_v8-microtask-queue.h
electron34/patches/patch-v8_include_v8-object.h
electron34/patches/patch-v8_include_v8config.h
electron34/patches/patch-v8_src_api_api.cc
electron34/patches/patch-v8_src_base_atomicops.h
electron34/patches/patch-v8_src_base_platform_memory.h
electron34/patches/patch-v8_src_base_platform_platform-freebsd.cc
electron34/patches/patch-v8_src_base_platform_platform-openbsd.cc
electron34/patches/patch-v8_src_base_platform_platform-posix.cc
electron34/patches/patch-v8_src_base_small-vector.h
electron34/patches/patch-v8_src_base_strings.h
electron34/patches/patch-v8_src_base_sys-info.cc
electron34/patches/patch-v8_src_base_utils_random-number-generator.cc
electron34/patches/patch-v8_src_builtins_x64_builtins-x64.cc
electron34/patches/patch-v8_src_compiler_escape-analysis.cc
electron34/patches/patch-v8_src_diagnostics_perf-jit.cc
electron34/patches/patch-v8_src_diagnostics_perf-jit.h
electron34/patches/patch-v8_src_execution_isolate.cc
electron34/patches/patch-v8_src_execution_microtask-queue.h
electron34/patches/patch-v8_src_flags_flags.cc
electron34/patches/patch-v8_src_libsampler_sampler.cc
electron34/patches/patch-v8_src_maglev_maglev-graph-builder.cc
electron34/patches/patch-v8_src_sandbox_sandbox.cc
electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc
electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h
electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc
electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.cc
electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.h
electron34/patches/patch-v8_src_trap-handler_trap-handler.h
electron34/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h
electron34/patches/patch-v8_tools_run-paxctl.py
electron34/patches/patch-v8_tools_run.py
electron34/platform.mk
Log Message:
Import electron34
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=202b2f3c3416ffde25212c55b4f6e6d4220b8ca8
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 1 +
electron34/DESCR | 5 +
electron34/Makefile | 334 +++
electron34/PLIST | 257 +++
electron34/TODO | 4 +
electron34/distinfo | 2334 ++++++++++++++++++++
electron34/options.mk | 55 +
electron34/patches/patch-.gitignore | 16 +
electron34/patches/patch-.gn | 17 +
electron34/patches/patch-AUTHORS | 16 +
electron34/patches/patch-BUILD.gn | 95 +
...patch-apps_ui_views_app__window__frame__view.cc | 17 +
...patch-ash_display_mirror__window__controller.cc | 20 +
electron34/patches/patch-base_BUILD.gn | 181 ++
.../patches/patch-base_allocator_dispatcher_tls.h | 17 +
...cator_partition__allocator_partition__alloc.gni | 26 +
...tition__allocator_src_partition__alloc_BUILD.gn | 17 +
...artition__alloc_address__space__randomization.h | 26 +
...llocator_src_partition__alloc_page__allocator.h | 17 +
...c_partition__alloc_page__allocator__constants.h | 19 +
...ion__alloc_page__allocator__internals__posix.cc | 17 +
...tion__alloc_page__allocator__internals__posix.h | 22 +
...rtition__alloc__base_debug_proc__maps__linux.cc | 17 +
...ition__alloc__base_debug_stack__trace__posix.cc | 40 +
...loc_partition__alloc__base_rand__util__posix.cc | 19 +
...ition__alloc__base_threading_platform__thread.h | 17 +
...e_threading_platform__thread__internal__posix.h | 17 +
...lloc__base_threading_platform__thread__posix.cc | 17 +
...src_partition__alloc_partition__alloc__config.h | 37 +
..._partition__alloc_partition__alloc__constants.h | 26 +
...rc_partition__alloc_partition__alloc__forward.h | 22 +
...locator_src_partition__alloc_partition__root.cc | 35 +
...locator_src_partition__alloc_spinning__mutex.cc | 65 +
...__allocator_src_partition__alloc_stack_stack.cc | 56 +
..._src_partition__alloc_thread__isolation_pkey.cc | 17 +
electron34/patches/patch-base_atomicops.h | 20 +
.../patches/patch-base_base__paths__posix.cc | 128 ++
electron34/patches/patch-base_compiler__specific.h | 16 +
.../patches/patch-base_debug_debugger__posix.cc | 106 +
electron34/patches/patch-base_debug_elf__reader.cc | 19 +
.../patches/patch-base_debug_proc__maps__linux.cc | 17 +
.../patches/patch-base_debug_stack__trace.cc | 35 +
.../patch-base_debug_stack__trace__posix.cc | 109 +
.../patches/patch-base_enterprise__util__mac.mm | 38 +
.../patches/patch-base_files_dir__reader__linux.h | 45 +
.../patches/patch-base_files_dir__reader__posix.h | 26 +
electron34/patches/patch-base_files_drive__info.h | 17 +
.../patches/patch-base_files_drive__info__posix.cc | 17 +
.../patches/patch-base_files_file__path__watcher.h | 17 +
.../patch-base_files_file__path__watcher__bsd.cc | 63 +
...patch-base_files_file__path__watcher__kqueue.cc | 24 +
.../patch-base_files_file__path__watcher__kqueue.h | 16 +
...tch-base_files_file__path__watcher__unittest.cc | 35 +
.../patches/patch-base_files_file__util__posix.cc | 61 +
.../patch-base_files_file__util__unittest.cc | 26 +
...-base_files_important__file__writer__cleaner.cc | 18 +
.../patches/patch-base_files_scoped__file.cc | 17 +
.../patch-base_functional_callback__helpers.h | 31 +
.../patch-base_functional_unretained__traits.h | 17 +
electron34/patches/patch-base_i18n_icu__util.cc | 26 +
electron34/patches/patch-base_linux__util.cc | 23 +
electron34/patches/patch-base_logging__unittest.cc | 37 +
.../patch-base_memory_discardable__memory.cc | 44 +
...tch-base_memory_discardable__memory__internal.h | 17 +
...emory_madv__free__discardable__memory__posix.cc | 27 +
...-base_memory_platform__shared__memory__region.h | 35 +
...mory_platform__shared__memory__region__posix.cc | 35 +
.../patches/patch-base_memory_protected__memory.h | 50 +
.../patch-base_memory_protected__memory__posix.cc | 26 +
...atch-base_message__loop_message__pump__epoll.cc | 17 +
...patch-base_message__loop_message__pump__epoll.h | 20 +
...patch-base_message__loop_message__pump__glib.cc | 44 +
.../patches/patch-base_native__library__posix.cc | 17 +
.../patch-base_native__library__unittest.cc | 17 +
.../patch-base_posix_can__lower__nice__to.cc | 22 +
.../patch-base_posix_file__descriptor__shuffle.h | 17 +
electron34/patches/patch-base_posix_sysctl.cc | 38 +
.../patch-base_posix_unix__domain__socket.cc | 63 +
...ch-base_posix_unix__domain__socket__unittest.cc | 17 +
.../patches/patch-base_process_internal__linux.h | 26 +
electron34/patches/patch-base_process_kill.h | 17 +
.../patches/patch-base_process_kill__posix.cc | 17 +
electron34/patches/patch-base_process_launch.h | 31 +
.../patches/patch-base_process_launch__mac.cc | 65 +
.../patches/patch-base_process_launch__posix.cc | 27 +
.../patches/patch-base_process_memory__linux.cc | 50 +
.../patches/patch-base_process_process__handle.cc | 17 +
.../patches/patch-base_process_process__handle.h | 17 +
.../patch-base_process_process__handle__freebsd.cc | 33 +
.../patch-base_process_process__handle__netbsd.cc | 64 +
.../patch-base_process_process__handle__openbsd.cc | 140 ++
.../patch-base_process_process__info__mac.cc | 36 +
.../patches/patch-base_process_process__iterator.h | 29 +
...atch-base_process_process__iterator__freebsd.cc | 57 +
...patch-base_process_process__iterator__netbsd.cc | 141 ++
...atch-base_process_process__iterator__openbsd.cc | 51 +
.../patches/patch-base_process_process__metrics.cc | 55 +
.../patches/patch-base_process_process__metrics.h | 121 +
...patch-base_process_process__metrics__freebsd.cc | 308 +++
.../patch-base_process_process__metrics__netbsd.cc | 184 ++
...patch-base_process_process__metrics__openbsd.cc | 239 ++
.../patch-base_process_process__metrics__posix.cc | 26 +
...atch-base_process_process__metrics__unittest.cc | 18 +
.../patches/patch-base_process_process__posix.cc | 100 +
.../patch-base_process_process__unittest.cc | 17 +
.../patches/patch-base_profiler_module__cache.cc | 17 +
...e_profiler_sampling__profiler__thread__token.cc | 26 +
...se_profiler_sampling__profiler__thread__token.h | 26 +
...ch-base_profiler_stack__base__address__posix.cc | 69 +
...ofiler_stack__sampling__profiler__test__util.cc | 17 +
...profiler_stack__sampling__profiler__unittest.cc | 17 +
.../patch-base_profiler_thread__delegate__posix.cc | 26 +
electron34/patches/patch-base_rand__util.h | 17 +
electron34/patches/patch-base_rand__util__posix.cc | 68 +
.../patch-base_strings_safe__sprintf__unittest.cc | 24 +
.../patch-base_synchronization_lock__impl.h | 29 +
electron34/patches/patch-base_syslog__logging.cc | 26 +
electron34/patches/patch-base_system_sys__info.cc | 17 +
electron34/patches/patch-base_system_sys__info.h | 26 +
.../patch-base_system_sys__info__freebsd.cc | 118 +
.../patches/patch-base_system_sys__info__netbsd.cc | 97 +
.../patch-base_system_sys__info__openbsd.cc | 88 +
.../patches/patch-base_system_sys__info__posix.cc | 35 +
.../patch-base_system_sys__info__unittest.cc | 26 +
...k_thread__pool_environment__config__unittest.cc | 26 +
.../patch-base_test_launcher_test__launcher.cc | 27 +
.../patch-base_test_test__file__util__linux.cc | 19 +
.../patch-base_test_test__file__util__posix.cc | 17 +
.../patch-base_threading_platform__thread.h | 17 +
.../patch-base_threading_platform__thread__bsd.cc | 40 +
..._threading_platform__thread__internal__posix.cc | 17 +
...patch-base_threading_platform__thread__posix.cc | 59 +
...ch-base_threading_platform__thread__unittest.cc | 44 +
.../patch-base_threading_thread__restrictions.h | 42 +
.../patches/patch-base_time_time__now__posix.cc | 17 +
.../patch-base_trace__event_builtin__categories.h | 16 +
...tch-base_trace__event_malloc__dump__provider.cc | 36 +
...atch-base_trace__event_memory__dump__manager.cc | 17 +
...atch-base_trace__event_process__memory__dump.cc | 26 +
.../patches/patch-base_tracing_trace__time.cc | 36 +
.../patches/patch-base_tracing_trace__time.h | 17 +
.../patch-base_version__info_version__info.h | 17 +
electron34/patches/patch-base_win_shortcut.cc | 46 +
electron34/patches/patch-base_win_win__util.h | 34 +
.../patches/patch-base_win_win__util__unittest.cc | 21 +
electron34/patches/patch-build_config_BUILD.gn | 19 +
.../patches/patch-build_config_BUILDCONFIG.gn | 64 +
.../patches/patch-build_config_clang_BUILD.gn | 22 +
.../patches/patch-build_config_compiler_BUILD.gn | 137 ++
electron34/patches/patch-build_config_gcc_BUILD.gn | 19 +
.../patches/patch-build_config_linux_BUILD.gn | 17 +
.../patches/patch-build_config_linux_atk_BUILD.gn | 17 +
.../patch-build_config_linux_atspi2_BUILD.gn | 16 +
.../patches/patch-build_config_linux_gtk_BUILD.gn | 16 +
.../patch-build_config_linux_libdrm_BUILD.gn | 17 +
.../patches/patch-build_config_linux_pkg-config.py | 17 +
electron34/patches/patch-build_config_ozone.gni | 33 +
electron34/patches/patch-build_config_rust.gni | 28 +
.../patches/patch-build_config_v8__target__cpu.gni | 19 +
.../patches/patch-build_detect__host__arch.py | 17 +
electron34/patches/patch-build_gn__run__binary.py | 17 +
electron34/patches/patch-build_linux_chrome.map | 19 +
.../patches/patch-build_linux_strip__binary.py | 16 +
.../patches/patch-build_linux_unbundle_icu.gn | 49 +
.../patches/patch-build_linux_unbundle_libevent.gn | 21 +
.../patches/patch-build_linux_unbundle_libusb.gn | 36 +
.../patches/patch-build_rust_allocator_BUILD.gn | 115 +
electron34/patches/patch-build_rust_allocator_DEPS | 18 +
.../patches/patch-build_rust_allocator_alias.cc | 31 +
.../patches/patch-build_rust_allocator_alias.h | 46 +
...d_rust_allocator_alloc__error__handler__impl.cc | 26 +
...ld_rust_allocator_alloc__error__handler__impl.h | 30 +
.../patch-build_rust_allocator_allocator__impls.cc | 114 +
.../patch-build_rust_allocator_allocator__impls.h | 33 +
...h-build_rust_allocator_allocator__impls__ffi.rs | 28 +
...patch-build_rust_allocator_compiler__specific.h | 47 +
.../patch-build_rust_allocator_immediate__crash.h | 180 ++
.../patches/patch-build_rust_allocator_lib.rs | 128 ++
.../patches/patch-build_rust_cargo__crate.gni | 31 +
.../patches/patch-build_rust_rust__bindgen.gni | 25 +
.../patch-build_rust_rust__bindgen__generator.gni | 25 +
.../patches/patch-build_rust_rust__macro.gni | 18 +
.../patches/patch-build_rust_rust__target.gni | 19 +
electron34/patches/patch-build_rust_std_BUILD.gn | 90 +
.../patches/patch-build_toolchain_freebsd_BUILD.gn | 75 +
.../patch-build_toolchain_gcc__solink__wrapper.py | 17 +
.../patch-build_toolchain_gcc__toolchain.gni | 59 +
.../patches/patch-build_toolchain_netbsd_BUILD.gn | 75 +
.../patches/patch-build_toolchain_openbsd_BUILD.gn | 75 +
.../patches/patch-build_toolchain_toolchain.gni | 17 +
.../patches/patch-build_toolchain_win_rc_rc.py | 20 +
.../patch-buildtools_reclient__cfgs_.gitignore | 14 +
...ols_reclient__cfgs_configure__reclient__cfgs.py | 23 +
...dtools_reclient__cfgs_nacl_rewrapper__linux.cfg | 19 +
.../patch-buildtools_third__party_libc++_BUILD.gn | 29 +
...buildtools_third__party_libc++_____config__site | 18 +
...atch-buildtools_third__party_libc++abi_BUILD.gn | 17 +
electron34/patches/patch-cc_base_features.cc | 17 +
electron34/patches/patch-chrome_BUILD.gn | 48 +
.../patch-chrome_app_chrome__command__ids.h | 23 +
.../patches/patch-chrome_app_chrome__main.cc | 49 +
.../patch-chrome_app_chrome__main__delegate.cc | 153 ++
electron34/patches/patch-chrome_browser_BUILD.gn | 31 +
.../patches/patch-chrome_browser_about__flags.cc | 340 +++
...ch-chrome_browser_accessibility_page__colors.cc | 26 +
...h-chrome_browser_after__startup__task__utils.cc | 17 +
...apps_app__service_publishers_extension__apps.cc | 17 +
...er_apps_platform__apps_platform__app__launch.cc | 71 +
...ser_apps_platform__apps_platform__app__launch.h | 17 +
...ete_chrome__autocomplete__scheme__classifier.cc | 17 +
...browser_background_background__mode__manager.cc | 17 +
...owser_background_background__mode__optimizer.cc | 17 +
.../patch-chrome_browser_browser__features.cc | 35 +
.../patch-chrome_browser_browser__features.h | 26 +
.../patch-chrome_browser_browser__process__impl.cc | 62 +
.../patch-chrome_browser_browser__process__impl.h | 17 +
...hrome_browser_chrome__browser__field__trials.cc | 26 +
...chrome_browser_chrome__browser__field__trials.h | 17 +
..._browser_chrome__browser__interface__binders.cc | 103 +
.../patch-chrome_browser_chrome__browser__main.cc | 124 ++
...r_chrome__browser__main__extra__parts__linux.cc | 17 +
...r_chrome__browser__main__extra__parts__ozone.cc | 17 +
...-chrome_browser_chrome__browser__main__linux.cc | 45 +
...h-chrome_browser_chrome__browser__main__linux.h | 17 +
...-chrome_browser_chrome__browser__main__posix.cc | 17 +
...ome_browser_chrome__content__browser__client.cc | 177 ++
...rome_browser_chrome__content__browser__client.h | 17 +
..._updater_widevine__cdm__component__installer.cc | 44 +
...hrome__protocol__handler__registry__delegate.cc | 17 +
.../patches/patch-chrome_browser_defaults.cc | 17 +
...tity_device__oauth2__token__service__factory.cc | 17 +
...hrome_browser_diagnostics_diagnostics__writer.h | 17 +
...download_chrome__download__manager__delegate.cc | 35 +
...h-chrome_browser_download_download__commands.cc | 26 +
...ch-chrome_browser_download_download__commands.h | 17 +
...rome_browser_download_download__file__picker.cc | 26 +
...hrome_browser_download_download__item__model.cc | 35 +
...atch-chrome_browser_download_download__prefs.cc | 96 +
...patch-chrome_browser_download_download__prefs.h | 26 +
...nectors_analysis_analysis__service__settings.cc | 17 +
...-chrome_browser_enterprise_connectors_common.cc | 26 +
...er_enterprise_connectors_connectors__service.cc | 17 +
...t_device__trust__connector__service__factory.cc | 35 +
...evice__trust_device__trust__service__factory.cc | 35 +
...ser_commands_key__rotation__command__factory.cc | 26 +
...sistence_key__persistence__delegate__factory.cc | 26 +
...ice__trust_signals_signals__service__factory.cc | 26 +
...tors_reporting_browser__crash__event__router.cc | 26 +
...nnectors_reporting_crash__reporting__context.cc | 17 +
...ectors_reporting_realtime__reporting__client.cc | 44 +
...nectors_reporting_realtime__reporting__client.h | 35 +
...rise_identifiers_profile__id__delegate__impl.cc | 26 +
...nt_profile__management__navigation__throttle.cc | 19 +
...te__commands_cbcm__remote__commands__factory.cc | 26 +
...ser_enterprise_signals_device__info__fetcher.cc | 26 +
...erprise_signals_device__info__fetcher__linux.cc | 83 +
...enterprise_signin_enterprise__signin__service.h | 17 +
...terstitials_managed__profile__required__page.cc | 17 +
.../patch-chrome_browser_extensions_BUILD.gn | 19 +
..._browser__context__keyed__service__factories.cc | 26 +
...ate_chrome__desktop__report__request__helper.cc | 35 +
...rprise__reporting__private_conversion__utils.cc | 17 +
...erprise__reporting__private_conversion__utils.h | 17 +
..._private_enterprise__reporting__private__api.cc | 53 +
...__private_enterprise__reporting__private__api.h | 35 +
...writer__private_removable__storage__provider.cc | 26 +
...management_chrome__management__api__delegate.cc | 17 +
...ensions_api_messaging_launch__context__posix.cc | 17 +
...__private_passwords__private__delegate__impl.cc | 17 +
...s_api_runtime_chrome__runtime__api__delegate.cc | 21 +
...extensions_api_settings__private_prefs__util.cc | 35 +
...chrome_browser_extensions_api_tabs_tabs__api.cc | 17 +
...gging__private_webrtc__logging__private__api.cc | 35 +
...api_webstore__private_webstore__private__api.cc | 17 +
..._browser_extensions_external__provider__impl.cc | 26 +
...rowser_extensions_global__shortcut__listener.cc | 39 +
...browser_extensions_global__shortcut__listener.h | 17 +
...extensions_global__shortcut__listener__ozone.cc | 45 +
..._extensions_global__shortcut__listener__ozone.h | 18 +
...r_extensions_global__shortcut__listener__win.cc | 25 +
...e__file__system__access__permission__context.cc | 149 ++
...me__file__system__access__permission__context.h | 165 ++
...-chrome_browser_first__run_first__run__dialog.h | 17 +
...hrome_browser_first__run_first__run__internal.h | 17 +
.../patch-chrome_browser_flag__descriptions.cc | 164 ++
.../patch-chrome_browser_flag__descriptions.h | 151 ++
...e_browser_gcm_gcm__profile__service__factory.cc | 26 +
...__id_instance__id__profile__service__factory.cc | 26 +
.../patch-chrome_browser_global__features.cc | 35 +
.../patch-chrome_browser_global__features.h | 44 +
...chrome_browser_headless_headless__mode__util.cc | 35 +
...h-chrome_browser_intranet__redirect__detector.h | 17 +
..._galleries_fileapi_mtp__device__map__service.cc | 21 +
...dia__galleries_media__file__system__registry.cc | 22 +
...ch-chrome_browser_media_audio__service__util.cc | 26 +
.../patch-chrome_browser_media_offscreen__tab.cc | 18 +
.../patch-chrome_browser_media_offscreen__tab.h | 18 +
...-chrome_browser_media_router_discovery_BUILD.gn | 17 +
...er_discovery_discovery__network__list__posix.cc | 54 +
...covery_discovery__network__list__wifi__linux.cc | 36 +
...wser_media_webrtc_chrome__screen__enumerator.cc | 53 +
...owser_media_webrtc_chrome__screen__enumerator.h | 26 +
...ome_browser_media_webrtc_desktop__media__list.h | 27 +
...wser_media_webrtc_desktop__media__list__base.cc | 36 +
...owser_media_webrtc_desktop__media__list__base.h | 17 +
...ia_webrtc_desktop__media__picker__controller.cc | 17 +
...wser_media_webrtc_fake__desktop__media__list.cc | 18 +
...owser_media_webrtc_fake__desktop__media__list.h | 18 +
...er_media_webrtc_native__desktop__media__list.cc | 51 +
...e_browser_media_webrtc_webrtc__log__uploader.cc | 17 +
...ser_media_webrtc_webrtc__logging__controller.cc | 39 +
...wser_media_webrtc_webrtc__logging__controller.h | 26 +
.../patch-chrome_browser_memory__details.cc | 17 +
...chrome__browser__main__extra__parts__metrics.cc | 49 +
..._chrome__browser__main__extra__parts__metrics.h | 26 +
...ser_metrics_chrome__metrics__service__client.cc | 94 +
...ch-chrome_browser_metrics_perf_cpu__identity.cc | 17 +
...trics_power_process__metrics__recorder__util.cc | 17 +
...hrome_browser_metrics_power_process__monitor.cc | 35 +
...chrome_browser_metrics_power_process__monitor.h | 17 +
...owser_net_profile__network__context__service.cc | 35 +
...ch-chrome_browser_net_proxy__config__monitor.cc | 62 +
...tch-chrome_browser_net_proxy__config__monitor.h | 31 +
...rowser_net_system__network__context__manager.cc | 153 ++
...browser_net_system__network__context__manager.h | 26 +
...page_modules_file__suggestion_drive__service.cc | 17 +
..._browser_new__tab__page_new__tab__page__util.cc | 17 +
...cations_notification__display__service__impl.cc | 44 +
...ns_notification__platform__bridge__delegator.cc | 17 +
...ations_platform__notification__service__impl.cc | 16 +
...cations_platform__notification__service__impl.h | 16 +
...d__manager_chrome__password__manager__client.cc | 26 +
...d__manager_password__reuse__manager__factory.cc | 17 +
...me_browser_pdf_chrome__pdf__stream__delegate.cc | 24 +
...icture_picture__in__picture__window__manager.cc | 70 +
.../patch-chrome_browser_platform__util__linux.cc | 18 +
...response__interceptor__url__loader__throttle.cc | 19 +
...wser_policy_browser__signin__policy__handler.cc | 17 +
...wser__cloud__management__controller__desktop.cc | 44 +
...onfiguration__policy__handler__list__factory.cc | 269 +++
...y_device__management__service__configuration.cc | 17 +
...olicy_policy__value__and__status__aggregator.cc | 17 +
...hrome_browser_predictors_preconnect__manager.cc | 57 +
...chrome_browser_predictors_preconnect__manager.h | 48 +
.../patch-chrome_browser_prefs_browser__prefs.cc | 81 +
...er_prefs_pref__service__incognito__allowlist.cc | 17 +
...er_printing_print__backend__service__manager.cc | 35 +
.../patch-chrome_browser_printing_print__job.cc | 61 +
..._browser_printing_print__view__manager__base.cc | 433 ++++
...e_browser_printing_print__view__manager__base.h | 84 +
...patch-chrome_browser_printing_printer__query.cc | 41 +
.../patch-chrome_browser_process__singleton.h | 56 +
...tch-chrome_browser_process__singleton__posix.cc | 239 ++
...patch-chrome_browser_process__singleton__win.cc | 166 ++
...hrome__browser__main__extra__parts__profiles.cc | 124 ++
.../patch-chrome_browser_profiles_profile__impl.cc | 46 +
...er_profiles_profile__keyed__service__factory.cc | 18 +
...-chrome_browser_profiles_profile__selections.cc | 42 +
...atch-chrome_browser_profiles_profiles__state.cc | 35 +
...h-chrome_browser_renderer__preferences__util.cc | 35 +
...tch-chrome_browser_resources_pdf_pdf__viewer.ts | 130 ++
...s_settings_autofill__page_passwords__shared.css | 17 +
...ome_browser_resources_signin_signin__shared.css | 17 +
...owsing_chrome__password__protection__service.cc | 17 +
...d__content__scanning_binary__upload__service.cc | 26 +
...dent__reporting_incident__reporting__service.cc | 17 +
...owser_safe__browsing_safe__browsing__service.cc | 26 +
...rowser_screen__ai_screen__ai__install__state.cc | 26 +
...owser_screen__ai_screen__ai__service__router.cc | 26 +
...b__to__self_receiving__ui__handler__registry.cc | 26 +
...o__self_send__tab__to__self__client__service.cc | 26 +
...tch-chrome_browser_sessions_session__restore.cc | 26 +
...ser_sharing_sharing__handler__registry__impl.cc | 26 +
...patch-chrome_browser_shortcuts_icon__badging.cc | 17 +
...ome_browser_signin_accounts__policy__manager.cc | 44 +
...rome_browser_signin_accounts__policy__manager.h | 35 +
.../patch-chrome_browser_signin_signin__util.cc | 17 +
...pellchecker_spellcheck__hunspell__dictionary.cc | 46 +
...spellchecker_spellcheck__hunspell__dictionary.h | 17 +
...ome_browser_spellchecker_spellcheck__service.cc | 60 +
...rome_browser_spellchecker_spellcheck__service.h | 26 +
...ed__user_classify__url__navigation__throttle.cc | 17 +
...vised__user_supervised__user__browser__utils.cc | 26 +
...rvised__user_supervised__user__browser__utils.h | 17 +
...supervised__user__extensions__delegate__impl.cc | 17 +
...__user_supervised__user__extensions__manager.cc | 26 +
...d__user_supervised__user__extensions__manager.h | 17 +
...ed__user__google__auth__navigation__throttle.cc | 26 +
..._supervised__user__metrics__service__factory.cc | 26 +
..._user_supervised__user__navigation__observer.cc | 26 +
..._user_supervised__user__navigation__throttle.cc | 26 +
...__user_supervised__user__navigation__throttle.h | 17 +
...owser_sync_chrome__sync__controller__builder.cc | 17 +
...rowser_sync_device__info__sync__client__impl.cc | 17 +
...h-chrome_browser_sync_sync__service__factory.cc | 44 +
...oup__sync_tab__group__sync__service__factory.cc | 26 +
...e_browser_task__manager_sampling_task__group.cc | 44 +
...me_browser_task__manager_sampling_task__group.h | 44 +
..._task__manager_sampling_task__group__sampler.cc | 53 +
...r_task__manager_sampling_task__group__sampler.h | 44 +
...r_task__manager_sampling_task__manager__impl.cc | 17 +
...browser_task__manager_task__manager__observer.h | 17 +
.../patch-chrome_browser_themes_theme__helper.cc | 17 +
.../patch-chrome_browser_themes_theme__service.cc | 26 +
...e_browser_themes_theme__service__aura__linux.cc | 17 +
...hrome_browser_themes_theme__service__factory.cc | 43 +
...-chrome_browser_ui_actions_chrome__action__id.h | 17 +
...ash_keyboard_chrome__keyboard__web__contents.cc | 18 +
...rowser_ui_ash_web__view_ash__web__view__impl.cc | 21 +
...browser_ui_ash_web__view_ash__web__view__impl.h | 18 +
..._payments_desktop__payments__window__manager.cc | 26 +
...l_payments_desktop__payments__window__manager.h | 44 +
.../patches/patch-chrome_browser_ui_browser.cc | 23 +
.../patches/patch-chrome_browser_ui_browser.h | 27 +
...rome_browser_ui_browser__command__controller.cc | 86 +
.../patch-chrome_browser_ui_browser__commands.cc | 17 +
.../patch-chrome_browser_ui_browser__ui__prefs.cc | 26 +
...patch-chrome_browser_ui_browser__view__prefs.cc | 26 +
.../patch-chrome_browser_ui_chrome__pages.cc | 35 +
.../patch-chrome_browser_ui_chrome__pages.h | 26 +
.../patches/patch-chrome_browser_ui_color_BUILD.gn | 18 +
...rowser_ui_color_native__chrome__color__mixer.cc | 17 +
..._ui_exclusive__access_fullscreen__controller.cc | 139 ++
...r_ui_exclusive__access_fullscreen__controller.h | 21 +
.../patches/patch-chrome_browser_ui_managed__ui.cc | 26 +
...r_presentation__receiver__window__controller.cc | 18 +
...er_presentation__receiver__window__controller.h | 18 +
...r_ui_omnibox_omnibox__pedal__implementations.cc | 17 +
...rollers_relaunch__chrome__bubble__controller.cc | 26 +
..._passwords_manage__passwords__ui__controller.cc | 26 +
.../patches/patch-chrome_browser_ui_sad__tab.cc | 17 +
...sharing__hub_sharing__hub__bubble__controller.h | 17 +
...e_browser_ui_signin_signin__view__controller.cc | 17 +
..._ui_signin_signin__view__controller__delegate.h | 17 +
...chrome_browser_ui_startup_bad__flags__prompt.cc | 17 +
...browser_ui_startup_startup__browser__creator.cc | 44 +
...r_ui_startup_startup__browser__creator__impl.cc | 35 +
...me_browser_ui_startup_startup__tab__provider.cc | 26 +
.../patch-chrome_browser_ui_tab__helpers.cc | 32 +
.../patch-chrome_browser_ui_tabs_features.cc | 17 +
...tch-chrome_browser_ui_tabs_tab__strip__prefs.cc | 17 +
...owser_ui_task__manager_task__manager__columns.h | 17 +
...ui_task__manager_task__manager__table__model.cc | 35 +
...ch-chrome_browser_ui_test_popup__browsertest.cc | 26 +
...tch-chrome_browser_ui_test_test__browser__ui.cc | 26 +
.../patch-chrome_browser_ui_ui__features.cc | 35 +
.../patches/patch-chrome_browser_ui_ui__features.h | 26 +
...h-chrome_browser_ui_views_accelerator__table.cc | 40 +
...pps_chrome__native__app__window__views__aura.cc | 26 +
...s_chrome__browser__main__extra__parts__views.cc | 26 +
...rome_browser_ui_views_chrome__views__delegate.h | 17 +
...wser_ui_views_chrome__views__delegate__linux.cc | 26 +
...owser_ui_views_compose_compose__dialog__view.cc | 17 +
...chrome_browser_ui_views_frame_browser__frame.cc | 62 +
...-chrome_browser_ui_views_frame_browser__frame.h | 26 +
...ws_frame_browser__frame__view__layout__linux.cc | 17 +
..._browser__frame__view__layout__linux__native.cc | 17 +
...r_ui_views_frame_browser__frame__view__linux.cc | 26 +
...er__non__client__frame__view__factory__views.cc | 26 +
...-chrome_browser_ui_views_frame_browser__view.cc | 17 +
..._ui_views_frame_opaque__browser__frame__view.cc | 44 +
...r_ui_views_frame_opaque__browser__frame__view.h | 26 +
...paque__browser__frame__view__layout__delegate.h | 26 +
...e_picture__in__picture__browser__frame__view.cc | 98 +
...me_picture__in__picture__browser__frame__view.h | 44 +
..._ui_views_frame_system__menu__model__builder.cc | 35 +
...ui_views_frame_system__menu__model__delegate.cc | 35 +
...wser_ui_views_frame_tab__strip__region__view.cc | 17 +
...rowser_ui_views_hats_hats__next__web__dialog.cc | 18 +
...chrome_browser_ui_views_hung__renderer__view.cc | 17 +
...rowser_ui_views_omnibox_omnibox__view__views.cc | 17 +
...rowser_ui_views_overlay_close__image__button.cc | 33 +
..._views_overlay_video__overlay__window__views.cc | 52 +
...views_passwords_password__bubble__view__base.cc | 26 +
...rowser_ui_views_profiles_profile__menu__view.cc | 26 +
..._ui_views_profiles_profile__menu__view__base.cc | 17 +
...wser_ui_views_profiles_profile__picker__view.cc | 26 +
...es_signin__view__controller__delegate__views.cc | 53 +
...les_signin__view__controller__delegate__views.h | 26 +
.../patch-chrome_browser_ui_views_tabs_tab.cc | 17 +
...ome_browser_ui_views_tabs_tab__close__button.cc | 46 +
...rome_browser_ui_views_tabs_tab__close__button.h | 18 +
..._browser_ui_views_tabs_tab__drag__controller.cc | 53 +
...ui_views_tabs_tab__hover__card__bubble__view.cc | 17 +
...rome_browser_ui_views_tabs_tab__style__views.cc | 17 +
...ome_browser_ui_views_toolbar_toolbar__button.cc | 46 +
...rome_browser_ui_views_toolbar_toolbar__button.h | 18 +
..._education_browser__user__education__service.cc | 26 +
...eb__apps_web__app__integration__test__driver.cc | 89 +
...rowser_ui_web__applications_web__app__dialogs.h | 17 +
...eb__applications_web__app__ui__manager__impl.cc | 26 +
...web__applications_web__app__ui__manager__impl.h | 17 +
...atch-chrome_browser_ui_webui_about_about__ui.cc | 35 +
...patch-chrome_browser_ui_webui_about_about__ui.h | 17 +
...ser_ui_webui_accessibility_accessibility__ui.cc | 122 +
...wser_ui_webui_accessibility_accessibility__ui.h | 26 +
..._ui_webui_app__home_app__home__page__handler.cc | 17 +
...r_ui_webui_app__home_app__home__page__handler.h | 17 +
...ui_webui_app__settings_web__app__settings__ui.h | 24 +
...icate__manager_certificate__manager__handler.cc | 17 +
...i_certificate__manager_client__cert__sources.cc | 71 +
...ui_certificate__manager_client__cert__sources.h | 26 +
...me_browser_ui_webui_chrome__web__ui__configs.cc | 104 +
...i_webui_chrome__web__ui__controller__factory.cc | 46 +
...i_connectors__internals_device__trust__utils.cc | 35 +
...r__education__internals__page__handler__impl.cc | 35 +
...wser_ui_webui_interstitials_interstitial__ui.cc | 35 +
...e_browser_ui_webui_management_management__ui.cc | 22 +
...i_webui_management_management__ui__constants.cc | 23 +
...ui_webui_management_management__ui__constants.h | 25 +
..._ui_webui_management_management__ui__handler.cc | 44 +
...r_ui_webui_management_management__ui__handler.h | 26 +
...ebui_password__manager_promo__cards__handler.cc | 26 +
...manager_promo__cards_relaunch__chrome__promo.cc | 26 +
...rowser_ui_webui_searchbox_searchbox__handler.cc | 35 +
...rowser_ui_webui_settings_appearance__handler.cc | 17 +
...tings_settings__localized__strings__provider.cc | 62 +
...ser_ui_webui_signin_profile__picker__handler.cc | 26 +
...hrome_browser_ui_window__sizer_window__sizer.cc | 17 +
...-chrome_browser_usb_usb__chooser__controller.cc | 65 +
...h-chrome_browser_usb_usb__chooser__controller.h | 28 +
...king_visited__url__ranking__service__factory.cc | 26 +
...lications_commands_launch__web__app__command.cc | 17 +
...s_commands_set__user__display__mode__command.cc | 17 +
...er_web__applications_extension__status__utils.h | 17 +
...ications_extensions_extension__status__utils.cc | 26 +
...ons_os__integration_os__integration__manager.cc | 17 +
...__integration_os__integration__test__override.h | 17 +
...integration_run__on__os__login__sub__manager.cc | 17 +
...tions_os__integration_shortcut__sub__manager.cc | 17 +
...gration_web__app__file__handler__registration.h | 17 +
...lications_os__integration_web__app__shortcut.cc | 26 +
...plications_os__integration_web__app__shortcut.h | 26 +
...pplications_policy_web__app__policy__manager.cc | 17 +
...s_test_os__integration__test__override__impl.cc | 125 ++
...ns_test_os__integration__test__override__impl.h | 44 +
..._browser_web__applications_web__app__helpers.cc | 17 +
...ser_web__applications_web__app__install__info.h | 17 +
...thn_chrome__authenticator__request__delegate.cc | 17 +
...tch-chrome_browser_webauthn_enclave__manager.cc | 26 +
...ser_webauthn_gpm__user__verification__policy.cc | 17 +
...me_browser_webauthn_unexportable__key__utils.cc | 17 +
...h-chrome_browser_win_chrome__process__finder.cc | 50 +
...ch-chrome_browser_win_chrome__process__finder.h | 27 +
.../patch-chrome_browser_win_titlebar__config.cc | 19 +
.../patches/patch-chrome_common_channel__info.h | 26 +
.../patch-chrome_common_channel__info__posix.cc | 26 +
.../patch-chrome_common_chrome__features.cc | 71 +
.../patches/patch-chrome_common_chrome__features.h | 60 +
.../patches/patch-chrome_common_chrome__paths.cc | 90 +
.../patches/patch-chrome_common_chrome__paths.h | 35 +
.../patch-chrome_common_chrome__paths__internal.h | 17 +
.../patch-chrome_common_chrome__switches.cc | 26 +
.../patches/patch-chrome_common_chrome__switches.h | 24 +
.../patches/patch-chrome_common_crash__keys.cc | 34 +
...rmissions_chrome__permission__message__rules.cc | 17 +
...ch-chrome_common_media_cdm__host__file__path.cc | 17 +
.../patch-chrome_common_media_cdm__registration.cc | 62 +
.../patch-chrome_common_media_cdm__registration.h | 17 +
...a_component__widevine__cdm__hint__file__linux.h | 17 +
.../patches/patch-chrome_common_pref__names.h | 97 +
.../patches/patch-chrome_common_url__constants.h | 17 +
.../patch-chrome_common_webui__url__constants.cc | 43 +
.../patch-chrome_common_webui__url__constants.h | 62 +
...ise__companion_enterprise__companion__client.cc | 17 +
.../patch-chrome_enterprise__companion_lock.cc | 26 +
.../patches/patch-chrome_installer_linux_BUILD.gn | 35 +
...vices_printing_print__backend__service__impl.cc | 53 +
...services_speech_audio__source__fetcher__impl.cc | 17 +
electron34/patches/patch-chrome_test_BUILD.gn | 41 +
...e_test_base_scoped__channel__override__posix.cc | 17 +
...ch-chrome_test_chromedriver_chrome__launcher.cc | 16 +
...rome_test_chromedriver_chrome_chrome__finder.cc | 35 +
...e_test_chromedriver_key__converter__unittest.cc | 26 +
...medriver_keycode__text__conversion__unittest.cc | 26 +
...sed__user_google__auth__state__waiter__mixin.cc | 17 +
.../patch-chrome_updater_app_app__uninstall.cc | 17 +
.../patches/patch-chrome_updater_configurator.cc | 17 +
electron34/patches/patch-chrome_updater_lock.cc | 17 +
.../patch-chrome_updater_util_posix__util.cc | 17 +
.../patches/patch-chrome_utility_services.cc | 35 +
...hromecast_browser_cast__browser__main__parts.cc | 44 +
...ecast_browser_cast__content__browser__client.cc | 17 +
..._browser_runtime__application__service__impl.cc | 17 +
...omecast_media_base_default__monotonic__clock.cc | 26 +
...l_core_browser_autofill__optimization__guide.cc | 17 +
...utofill_core_browser_payments__data__manager.cc | 17 +
...ill_core_common_autofill__payments__features.cc | 26 +
...fill_core_common_autofill__payments__features.h | 17 +
...ponents_autofill_core_common_autofill__prefs.cc | 17 +
...mponents_autofill_core_common_autofill__prefs.h | 17 +
...onents_commerce_core_commerce__feature__list.cc | 44 +
...nstrained__window_constrained__window__views.cc | 17 +
...ngs_core_browser_website__settings__registry.cc | 17 +
...omponents_cookie__config_cookie__store__util.cc | 17 +
...sh_content_tools_generate__breakpad__symbols.py | 17 +
.../patch-components_crash_core_app_BUILD.gn | 49 +
...nts_crash_core_app_chrome__crashpad__handler.cc | 18 +
...nents_crash_core_app_crash__reporter__client.cc | 26 +
...onents_crash_core_app_crash__reporter__client.h | 36 +
...nents_crash_core_app_crashpad__handler__main.cc | 26 +
...ch-components_crash_core_app_crashpad__linux.cc | 30 +
...atch-components_crash_core_app_crashpad__mac.mm | 31 +
...atch-components_crash_core_app_crashpad__win.cc | 30 +
...h_core_browser_crash__upload__list__crashpad.cc | 32 +
.../patch-components_crash_core_common_BUILD.gn | 17 +
...ignals_core_browser_mock__signals__aggregator.h | 17 +
...ice__signals_core_browser_signals__aggregator.h | 17 +
...gnals_core_browser_signals__aggregator__impl.cc | 17 +
...ignals_core_browser_signals__aggregator__impl.h | 17 +
...ignals_core_browser_user__permission__service.h | 17 +
...core_browser_user__permission__service__impl.cc | 17 +
..._core_browser_user__permission__service__impl.h | 17 +
...evice__signals_core_common_signals__features.cc | 17 +
...device__signals_core_common_signals__features.h | 17 +
...nals_core_system__signals_platform__delegate.cc | 17 +
...nents_device__signals_test_signals__contract.cc | 17 +
...service_discardable__shared__memory__manager.cc | 17 +
...id_delegate_web__contents__delegate__android.cc | 25 +
...oid_delegate_web__contents__delegate__android.h | 18 +
...ponents_embedder__support_user__agent__utils.cc | 18 +
...bedder__support_user__agent__utils__unittest.cc | 35 +
...components_enterprise_watermarking_watermark.cc | 26 +
...h-components_eye__dropper_eye__dropper__view.cc | 17 +
..._feature__engagement_public_event__constants.cc | 17 +
...s_feature__engagement_public_event__constants.h | 17 +
...e__engagement_public_feature__configurations.cc | 36 +
...eature__engagement_public_feature__constants.cc | 36 +
...feature__engagement_public_feature__constants.h | 36 +
...nts_feature__engagement_public_feature__list.cc | 36 +
...ents_feature__engagement_public_feature__list.h | 64 +
...omponents_feed_core_proto_v2_wire_version.proto | 19 +
...s_feed_core_v2_feed__network__impl__unittest.cc | 19 +
.../patch-components_feed_core_v2_proto__util.cc | 30 +
...omponents_feed_core_v2_proto__util__unittest.cc | 19 +
...-components_feed_core_v2_test_proto__printer.cc | 19 +
.../patch-components_flags__ui_flags__state.cc | 17 +
.../patches/patch-components_gwp__asan_BUILD.gn | 17 +
..._asan_client_guarded__page__allocator__posix.cc | 19 +
.../patch-components_gwp__asan_client_gwp__asan.cc | 17 +
...ponents_gwp__asan_client_gwp__asan__features.cc | 17 +
...nts_gwp__asan_crash__handler_crash__analyzer.cc | 26 +
...patch-components_live__caption_caption__util.cc | 17 +
.../patch-components_live__caption_caption__util.h | 17 +
...omponents_media__router_common_media__source.cc | 17 +
...n_providers_cast_channel_cast__message__util.cc | 17 +
...ter_common_providers_cast_channel_enum__table.h | 21 +
...ents_metrics_drive__metrics__provider__linux.cc | 22 +
.../patch-components_metrics_dwa_dwa__service.cc | 17 +
.../patch-components_metrics_metrics__log.cc | 44 +
.../patch-components_metrics_motherboard.cc | 16 +
...nts_named__mojo__ipc__server_connection__info.h | 33 +
...erver_named__mojo__ipc__server__client__util.cc | 17 +
.../patch-components_named__system__lock_lock.h | 17 +
...patch-components_neterror_resources_neterror.js | 17 +
...kground__loader_background__loader__contents.cc | 18 +
...ckground__loader_background__loader__contents.h | 18 +
...on__guide_core_optimization__guide__features.cc | 17 +
...zation__guide_core_optimization__guide__util.cc | 17 +
..._async_browser_secret__portal__key__provider.cc | 18 +
...-components_os__crypt_async_common_encryptor.cc | 17 +
.../patch-components_os__crypt_sync_BUILD.gn | 16 +
...nents_os__crypt_sync_keychain__password__mac.mm | 100 +
...onents_os__crypt_sync_libsecret__util__linux.cc | 33 +
.../patch-components_os__crypt_sync_os__crypt.h | 78 +
...aint__preview_browser_paint__preview__client.cc | 19 +
...iew_browser_paint__preview__client__unittest.cc | 19 +
...aint__preview_common_proto_paint__preview.proto | 19 +
..._preview_player_player__compositor__delegate.cc | 19 +
...ger_core_browser_features_password__features.cc | 26 +
...ager_core_browser_features_password__features.h | 17 +
...manager_core_browser_password__form__manager.cc | 35 +
...word__manager_core_browser_password__manager.cc | 26 +
...anager_core_browser_password__manager__client.h | 26 +
...ger_core_browser_password__manager__switches.cc | 17 +
...ager_core_browser_password__manager__switches.h | 17 +
...ore_browser_password__manual__fallback__flow.cc | 35 +
...core_browser_password__manual__fallback__flow.h | 26 +
..._core_browser_password__store__factory__util.cc | 17 +
...core_browser_password__store_login__database.cc | 26 +
...ssword__store_login__database__async__helper.cc | 17 +
...er_password__store_login__database__unittest.cc | 17 +
...core_browser_stub__password__manager__client.cc | 17 +
..._core_browser_stub__password__manager__client.h | 17 +
...er_core_common_password__manager__pref__names.h | 26 +
...nager_decorators_process__metrics__decorator.cc | 17 +
...mponents_performance__manager_public_features.h | 17 +
...atch-components_permissions_permission__util.cc | 16 +
...sions_prediction__service_prediction__common.cc | 26 +
...icy_core_browser_policy__pref__mapping__test.cc | 17 +
...licy_core_common_cloud_cloud__policy__client.cc | 17 +
...mmon_cloud_cloud__policy__refresh__scheduler.cc | 26 +
...policy_core_common_cloud_cloud__policy__util.cc | 61 +
...ts_policy_core_common_policy__loader__common.cc | 26 +
...-components_policy_core_common_policy__paths.cc | 19 +
...-components_policy_core_common_policy__utils.cc | 17 +
...onents_policy_tools_generate__policy__source.py | 20 +
.../patch-components_power__metrics_BUILD.gn | 17 +
...nts_power__metrics_energy__metrics__provider.cc | 27 +
...h-components_printing_browser_print__manager.cc | 17 +
...ch-components_printing_browser_print__manager.h | 16 +
.../patch-components_printing_common_print.mojom | 27 +
...inting_renderer_print__render__frame__helper.cc | 178 ++
...rinting_renderer_print__render__frame__helper.h | 47 +
...tch-components_remote__cocoa_app__shim_BUILD.gn | 16 +
..._remote__cocoa_app__shim_application__bridge.mm | 44 +
...p__shim_browser__native__widget__window__mac.mm | 52 +
...him_native__widget__mac__frameless__nswindow.mm | 39 +
...cocoa_app__shim_native__widget__mac__nswindow.h | 32 +
...ocoa_app__shim_native__widget__mac__nswindow.mm | 71 +
...app__shim_native__widget__ns__window__bridge.mm | 29 +
...ontent_common_file__type__policies__unittest.cc | 17 +
...ing_content_resources_gen__file__type__proto.py | 27 +
..._core_browser_db_v4__protocol__manager__util.cc | 17 +
..._browser_realtime_url__lookup__service__base.cc | 17 +
...mponents_safe__browsing_core_common_features.cc | 17 +
...gine__choice_search__engine__choice__service.cc | 17 +
...nents_search__engines_template__url__service.cc | 17 +
...onents_security__interstitials_content_utils.cc | 17 +
..._default__model_cross__device__user__segment.cc | 17 +
...rvices_on__device__translation_sandbox__hook.cc | 49 +
...ervices_on__device__translation_sandbox__hook.h | 22 +
...paint__preview__compositor__collection__impl.cc | 35 +
...storage_dom__storage_dom__storage__constants.cc | 19 +
.../patches/patch-components_soda_soda__util.cc | 35 +
..._metric__utils_common_startup__metric__utils.cc | 17 +
.../patch-components_storage__monitor_BUILD.gn | 26 +
...torage__monitor_removable__device__constants.cc | 17 +
...storage__monitor_removable__device__constants.h | 17 +
...e_browser_supervised__user__metrics__service.cc | 17 +
...r_core_browser_supervised__user__preferences.cc | 17 +
...onents_supervised__user_core_common_features.cc | 60 +
...ponents_supervised__user_core_common_features.h | 40 +
...ents_supervised__user_core_common_pref__names.h | 17 +
...sync__device__info_local__device__info__util.cc | 35 +
...evice__info_local__device__info__util__linux.cc | 20 +
.../patch-components_sync_base_sync__util.cc | 17 +
.../patch-components_system__cpu_cpu__probe.cc | 18 +
...onents_translate_core_common_translate__util.cc | 17 +
...sted__vault_trusted__vault__connection__impl.cc | 17 +
...ponents_update__client_update__query__params.cc | 19 +
.../patch-components_upload__list_upload__list.cc | 19 +
.../patch-components_upload__list_upload__list.h | 17 +
..._formatter_spoof__checks_idn__spoof__checker.cc | 17 +
...nts_user__education_views_help__bubble__view.cc | 17 +
...nents_variations_service_variations__service.cc | 17 +
...isited__url__ranking_public_url__visit__util.cc | 17 +
.../patch-components_viz_host_gpu__host__impl.cc | 17 +
...ch-components_viz_host_host__display__client.cc | 43 +
...tch-components_viz_host_host__display__client.h | 32 +
...ents_viz_host_layered__window__updater__impl.cc | 19 +
...nents_viz_host_layered__window__updater__impl.h | 17 +
.../patches/patch-components_viz_service_BUILD.gn | 33 +
...e_display__embedder_output__surface__provider.h | 18 +
...ay__embedder_output__surface__provider__impl.cc | 67 +
...lay__embedder_output__surface__provider__impl.h | 28 +
...isplay__embedder_skia__output__surface__impl.cc | 17 +
...play__embedder_software__output__device__mac.cc | 25 +
...splay__embedder_software__output__device__mac.h | 16 +
...ay__embedder_software__output__device__proxy.cc | 170 ++
...lay__embedder_software__output__device__proxy.h | 107 +
...play__embedder_software__output__device__win.cc | 17 +
..._display__embedder_software__output__surface.cc | 26 +
...e_display__embedder_software__output__surface.h | 26 +
...omponents_viz_service_display_skia__renderer.cc | 17 +
...e__sinks_root__compositor__frame__sink__impl.cc | 36 +
...me__sinks_root__compositor__frame__sink__impl.h | 17 +
...ch-components_viz_test_fake__display__client.cc | 17 +
...tch-components_viz_test_fake__display__client.h | 17 +
...tch-components_viz_test_mock__display__client.h | 17 +
...nts_viz_test_test__output__surface__provider.cc | 18 +
...ents_viz_test_test__output__surface__provider.h | 18 +
...ts_webrtc_media__stream__devices__controller.cc | 78 +
...nts_webrtc_media__stream__devices__controller.h | 18 +
electron34/patches/patch-content_app_BUILD.gn | 21 +
...emote__cocoa_ns__view__bridge__factory__impl.mm | 55 +
...ote__cocoa_render__widget__host__view__cocoa.mm | 100 +
.../patches/patch-content_app_content__main.cc | 51 +
...atch-content_app_content__main__runner__impl.cc | 186 ++
electron34/patches/patch-content_browser_BUILD.gn | 59 +
.../patch-content_browser_audio_audio__service.cc | 26 +
..._browser_browser__child__process__host__impl.cc | 25 +
...t_browser_browser__child__process__host__impl.h | 26 +
...ild__process__host__impl__receiver__bindings.cc | 17 +
.../patch-content_browser_browser__main__loop.cc | 43 +
...atch-content_browser_child__process__launcher.h | 44 +
...tent_browser_child__process__launcher__helper.h | 17 +
...wser_child__process__launcher__helper__linux.cc | 151 ++
...rowser_child__process__launcher__helper__mac.cc | 30 +
...rowser_child__process__launcher__helper__win.cc | 58 +
...browser_child__thread__type__switcher__linux.cc | 26 +
...t_browser_code__cache_generated__code__cache.cc | 112 +
...nt_browser_code__cache_generated__code__cache.h | 27 +
...e__cache_generated__code__cache__browsertest.cc | 123 ++
..._compositor_viz__process__transport__factory.cc | 34 +
...wser_devtools_devtools__frontend__host__impl.cc | 44 +
...owser_devtools_devtools__frontend__host__impl.h | 17 +
...wser_devtools_protocol_system__info__handler.cc | 17 +
...ccess_file__path__watcher_file__path__watcher.h | 17 +
...file__path__watcher_file__path__watcher__bsd.cc | 64 +
...le__path__watcher_file__path__watcher__kqueue.h | 16 +
...s_file__system__access__local__path__watcher.cc | 17 +
...font__access_font__enumeration__data__source.cc | 35 +
.../patch-content_browser_gpu_compositor__util.cc | 26 +
...content_browser_gpu_gpu__data__manager__impl.cc | 17 +
...-content_browser_gpu_gpu__data__manager__impl.h | 17 +
...rowser_gpu_gpu__data__manager__impl__private.cc | 17 +
...browser_gpu_gpu__data__manager__impl__private.h | 26 +
..._gpu_gpu__memory__buffer__manager__singleton.cc | 26 +
...patch-content_browser_gpu_gpu__process__host.cc | 25 +
...owser_media_capture_desktop__capture__device.cc | 42 +
..._media_capture_desktop__capture__device__mac.cc | 17 +
...ture_io__surface__capture__device__base__mac.cc | 17 +
...pture_io__surface__capture__device__base__mac.h | 17 +
...ia_capture_screen__capture__kit__device__mac.mm | 288 +++
...wser_media_frameless__media__interface__proxy.h | 26 +
...r_media_media__keys__listener__manager__impl.cc | 75 +
...ent_browser_network__service__instance__impl.cc | 35 +
...fications_blink__notification__service__impl.cc | 32 +
...ifications_blink__notification__service__impl.h | 24 +
...blink__notification__service__impl__unittest.cc | 17 +
...ations_platform__notification__context__impl.cc | 25 +
...cations_platform__notification__context__impl.h | 24 +
...ser_permissions_permission__controller__impl.cc | 16 +
...i__plugin__process__host__receiver__bindings.cc | 26 +
...owser_renderer__host_code__cache__host__impl.cc | 124 ++
...rowser_renderer__host_delegated__frame__host.cc | 17 +
...erer__host_legacy__render__widget__host__win.cc | 35 +
...derer__host_legacy__render__widget__host__win.h | 16 +
...n__process__video__capture__device__launcher.cc | 43 +
...ia_service__video__capture__device__launcher.cc | 26 +
..._host_navigation__controller__impl__unittest.cc | 21 +
...t_browser_renderer__host_navigation__request.cc | 21 +
...tch-content_browser_renderer__host_navigator.cc | 24 +
...renderer__host_pepper_pepper__file__io__host.cc | 26 +
...owser_renderer__host_policy__container__host.cc | 21 +
...rowser_renderer__host_policy__container__host.h | 18 +
...ser_renderer__host_render__frame__host__impl.cc | 45 +
..._renderer__host_render__frame__host__manager.cc | 18 +
...r_renderer__host_render__process__host__impl.cc | 90 +
...er_renderer__host_render__process__host__impl.h | 35 +
...der__process__host__impl__receiver__bindings.cc | 26 +
...wser_renderer__host_render__view__host__impl.cc | 29 +
...owser_renderer__host_render__view__host__impl.h | 16 +
...renderer__host_render__widget__host__delegate.h | 26 +
...er_renderer__host_render__widget__host__impl.cc | 41 +
...ser_renderer__host_render__widget__host__impl.h | 18 +
...derer__host_render__widget__host__view__aura.cc | 86 +
...nderer__host_render__widget__host__view__aura.h | 26 +
...derer__host_render__widget__host__view__base.cc | 22 +
...nderer__host_render__widget__host__view__base.h | 53 +
...t_render__widget__host__view__event__handler.cc | 17 +
...enderer__host_render__widget__host__view__mac.h | 38 +
...nderer__host_render__widget__host__view__mac.mm | 90 +
...erer__sandboxed__process__launcher__delegate.cc | 28 +
...derer__sandboxed__process__launcher__delegate.h | 32 +
..._browser_renderer__host_text__input__manager.cc | 29 +
...t_browser_renderer__host_text__input__manager.h | 27 +
.../patch-content_browser_sandbox__host__linux.cc | 24 +
...scheduler_responsiveness_jank__monitor__impl.cc | 17 +
...duler_responsiveness_native__event__observer.cc | 26 +
...eduler_responsiveness_native__event__observer.h | 53 +
...content_browser_service__process__host__impl.cc | 63 +
...ce__worker_service__worker__context__wrapper.cc | 57 +
...er_service__worker_service__worker__registry.cc | 18 +
.../patch-content_browser_site__instance__impl.cc | 17 +
...patch-content_browser_utility__process__host.cc | 137 ++
.../patch-content_browser_utility__process__host.h | 94 +
...r_utility__process__host__receiver__bindings.cc | 26 +
...h-content_browser_utility__sandbox__delegate.cc | 111 +
...ch-content_browser_utility__sandbox__delegate.h | 64 +
.../patch-content_browser_v8__snapshot__files.cc | 17 +
...r_web__contents_slow__web__preference__cache.cc | 35 +
...nt_browser_web__contents_web__contents__impl.cc | 171 ++
...ent_browser_web__contents_web__contents__impl.h | 16 +
...wser_web__contents_web__contents__view__aura.cc | 35 +
...contents_web__contents__view__aura__unittest.cc | 17 +
...ts_web__contents__view__drag__security__info.cc | 17 +
...browser_webui_web__ui__main__frame__observer.cc | 44 +
..._browser_webui_web__ui__main__frame__observer.h | 26 +
...owser_zygote__host_zygote__host__impl__linux.cc | 87 +
...rowser_zygote__host_zygote__host__impl__linux.h | 35 +
electron34/patches/patch-content_child_BUILD.gn | 22 +
.../patches/patch-content_child_child__process.cc | 26 +
.../patches/patch-content_child_child__process.h | 17 +
electron34/patches/patch-content_common_BUILD.gn | 50 +
.../patches/patch-content_common_features.cc | 26 +
electron34/patches/patch-content_common_features.h | 26 +
.../patch-content_common_font__list__unittest.cc | 17 +
.../patches/patch-content_common_frame.mojom | 19 +
...-content_common_gpu__pre__sandbox__hook__bsd.cc | 77 +
...h-content_common_gpu__pre__sandbox__hook__bsd.h | 29 +
...content_common_gpu__pre__sandbox__hook__linux.h | 22 +
.../patch-content_common_sandbox__init__win.cc | 26 +
.../patches/patch-content_common_url__schemes.cc | 23 +
.../patches/patch-content_common_user__agent.cc | 43 +
.../patch-content_gpu_gpu__child__thread.cc | 27 +
electron34/patches/patch-content_gpu_gpu__main.cc | 98 +
...t_ppapi__plugin_ppapi__blink__platform__impl.cc | 35 +
...nt_ppapi__plugin_ppapi__blink__platform__impl.h | 17 +
...ch-content_ppapi__plugin_ppapi__plugin__main.cc | 29 +
...h-content_public_app_content__main__delegate.cc | 28 +
...ch-content_public_app_content__main__delegate.h | 25 +
...tent_public_browser_content__browser__client.cc | 26 +
...ntent_public_browser_content__browser__client.h | 37 +
...tch-content_public_browser_desktop__media__id.h | 17 +
...ublic_browser_platform__notification__service.h | 25 +
...tch-content_public_browser_render__view__host.h | 18 +
...ontent_public_browser_service__process__host.cc | 62 +
...content_public_browser_service__process__host.h | 87 +
...content_public_browser_service__process__info.h | 22 +
.../patch-content_public_browser_web__contents.h | 33 +
...ntent_public_browser_web__contents__delegate.cc | 36 +
...ontent_public_browser_web__contents__delegate.h | 40 +
...ontent_public_browser_web__contents__observer.h | 26 +
...blic_browser_zygote__host_zygote__host__linux.h | 22 +
.../patches/patch-content_public_common_BUILD.gn | 17 +
.../patch-content_public_common_content__client.h | 18 +
...atch-content_public_common_content__features.cc | 41 +
...atch-content_public_common_content__switches.cc | 26 +
...patch-content_public_common_content__switches.h | 25 +
...atch-content_public_common_sandbox__init__win.h | 17 +
...ommon_sandboxed__process__launcher__delegate.cc | 34 +
...common_sandboxed__process__launcher__delegate.h | 38 +
...patch-content_public_common_zygote_features.gni | 14 +
...patch-content_public_gpu_content__gpu__client.h | 19 +
...ent_public_renderer_content__renderer__client.h | 25 +
...ntent_public_renderer_render__frame__observer.h | 17 +
electron34/patches/patch-content_renderer_BUILD.gn | 16 +
.../patch-content_renderer_render__frame__impl.cc | 32 +
.../patch-content_renderer_render__frame__impl.h | 17 +
...patch-content_renderer_render__process__impl.cc | 18 +
.../patch-content_renderer_render__thread__impl.cc | 53 +
...ent_renderer_renderer__blink__platform__impl.cc | 76 +
...tent_renderer_renderer__blink__platform__impl.h | 27 +
...er_renderer__main__platform__delegate__linux.cc | 24 +
...erer_renderer__main__platform__delegate__mac.mm | 40 +
.../patch-content_renderer_theme__helper__mac.mm | 38 +
electron34/patches/patch-content_shell_BUILD.gn | 17 +
...atch-content_shell_app_shell__main__delegate.cc | 17 +
...nt_shell_browser_shell__browser__main__parts.cc | 53 +
.../patch-content_shell_browser_shell__paths.cc | 26 +
...ll_renderer_shell__content__renderer__client.cc | 17 +
...hell_utility_shell__content__utility__client.cc | 26 +
electron34/patches/patch-content_test_BUILD.gn | 49 +
...t_test_mock__platform__notification__service.cc | 16 +
...nt_test_mock__platform__notification__service.h | 16 +
.../patch-content_test_test__page__broadcast.h | 16 +
.../patches/patch-content_utility_services.cc | 80 +
...ch_speech__recognition__sandbox__hook__linux.cc | 43 +
...ech_speech__recognition__sandbox__hook__linux.h | 22 +
...link__platform__with__sandbox__support__impl.cc | 35 +
...blink__platform__with__sandbox__support__impl.h | 17 +
.../patches/patch-content_utility_utility__main.cc | 161 ++
.../patch-content_utility_utility__thread__impl.cc | 27 +
.../patches/patch-content_web__test_BUILD.gn | 16 +
..._browser_web__test__content__browser__client.cc | 17 +
...t_browser_web__test__content__browser__client.h | 17 +
electron34/patches/patch-content_zygote_BUILD.gn | 17 +
.../patches/patch-content_zygote_zygote__linux.cc | 21 +
.../patch-content_zygote_zygote__main__linux.cc | 64 +
electron34/patches/patch-device_bluetooth_BUILD.gn | 16 +
.../patch-device_bluetooth_bluetooth__adapter.cc | 17 +
...tch-device_bluetooth_bluetooth__adapter__mac.mm | 50 +
.../patch-device_bluetooth_cast__bluetooth.gni | 15 +
electron34/patches/patch-device_gamepad_BUILD.gn | 17 +
.../patch-device_gamepad_gamepad__provider.cc | 17 +
.../patch-device_gamepad_hid__writer__linux.cc | 17 +
electron34/patches/patch-electron_BUILD.gn | 66 +
.../patches/patch-electron_build_args_all.gn | 19 +
.../patches/patch-electron_build_args_release.gn | 17 +
.../patch-electron_default__app_default__app.ts | 17 +
electron34/patches/patch-electron_filenames.gni | 19 +
.../patches/patch-electron_lib_browser_api_app.ts | 17 +
.../patch-electron_lib_browser_api_dialog.ts | 17 +
...tch-electron_lib_browser_api_menu-item-roles.ts | 17 +
...patch-electron_lib_browser_api_power-monitor.ts | 17 +
.../patches/patch-electron_lib_browser_init.ts | 17 +
.../patch-electron_lib_browser_rpc-server.ts | 17 +
.../patch-electron_lib_renderer_api_clipboard.ts | 17 +
.../patches/patch-electron_script_lib_config.py | 19 +
.../patches/patch-electron_script_lib_utils.js | 17 +
.../patches/patch-electron_script_spec-runner.js | 17 +
..._shell_app_electron__crash__reporter__client.cc | 26 +
...n_shell_app_electron__crash__reporter__client.h | 26 +
...-electron_shell_app_electron__main__delegate.cc | 69 +
.../patches/patch-electron_shell_app_node__main.cc | 43 +
...lectron_shell_browser_api_electron__api__app.cc | 80 +
...hell_browser_api_electron__api__base__window.cc | 44 +
...shell_browser_api_electron__api__base__window.h | 17 +
...l_browser_api_electron__api__crash__reporter.cc | 78 +
...browser_api_electron__api__desktop__capturer.cc | 17 +
...ll_browser_api_electron__api__power__monitor.cc | 29 +
...ell_browser_api_electron__api__power__monitor.h | 17 +
...ell_browser_api_electron__api__safe__storage.cc | 35 +
...ell_browser_api_electron__api__web__contents.cc | 83 +
...hell_browser_api_electron__api__web__contents.h | 17 +
...ch-electron_shell_browser_api_process__metric.h | 26 +
.../patch-electron_shell_browser_browser.cc | 17 +
.../patches/patch-electron_shell_browser_browser.h | 30 +
.../patch-electron_shell_browser_browser__linux.cc | 26 +
...lectron_shell_browser_browser__process__impl.cc | 26 +
...electron_shell_browser_browser__process__impl.h | 35 +
...shell_browser_electron__browser__main__parts.cc | 90 +
..._shell_browser_electron__browser__main__parts.h | 26 +
...rowser_electron__browser__main__parts__posix.cc | 26 +
...api_runtime_electron__runtime__api__delegate.cc | 19 +
.../patch-electron_shell_browser_native__window.cc | 17 +
...electron_shell_browser_native__window__views.cc | 197 ++
...-electron_shell_browser_native__window__views.h | 35 +
...rowser_net_system__network__context__manager.cc | 17 +
...shell_browser_osr_osr__host__display__client.cc | 17 +
..._shell_browser_osr_osr__host__display__client.h | 17 +
...-electron_shell_browser_osr_osr__paint__event.h | 17 +
...ctron_shell_browser_osr_osr__video__consumer.cc | 17 +
...ctron_shell_browser_printing_printing__utils.cc | 17 +
...tch-electron_shell_browser_relauncher__linux.cc | 38 +
..._shell_browser_ui_inspectable__web__contents.cc | 17 +
...ui_inspectable__web__contents__view__delegate.h | 17 +
...l_browser_ui_views_electron__views__delegate.cc | 44 +
...ll_browser_ui_views_electron__views__delegate.h | 17 +
...iews_inspectable__web__contents__view__views.cc | 17 +
...ch-electron_shell_browser_ui_views_menu__bar.cc | 44 +
...tch-electron_shell_browser_ui_views_menu__bar.h | 17 +
...ctron_shell_browser_ui_views_submenu__button.cc | 17 +
...on_shell_common_api_electron__api__clipboard.cc | 26 +
...hell_common_api_electron__api__native__image.cc | 17 +
...shell_common_api_electron__api__native__image.h | 17 +
...electron_shell_common_api_electron__bindings.cc | 17 +
...lectron_shell_common_electron__command__line.cc | 17 +
...electron_shell_common_electron__command__line.h | 17 +
.../patch-electron_shell_common_electron__paths.h | 17 +
..._shell_common_gin__converters_osr__converter.cc | 17 +
...n_shell_common_gin__converters_std__converter.h | 17 +
.../patch-electron_shell_common_node__bindings.cc | 35 +
...-electron_shell_common_node__bindings__linux.cc | 75 +
.../patch-electron_shell_common_platform__util.h | 17 +
...api_electron__api__crash__reporter__renderer.cc | 42 +
...h-electron_shell_services_node_node__service.cc | 26 +
.../patches/patch-electron_spec_api-app-spec.ts | 130 ++
.../patch-electron_spec_api-browser-window-spec.ts | 188 ++
.../patch-electron_spec_api-clipboard-spec.ts | 35 +
...patch-electron_spec_api-content-tracing-spec.ts | 17 +
.../patch-electron_spec_api-crash-reporter-spec.ts | 62 +
...atch-electron_spec_api-desktop-capturer-spec.ts | 53 +
.../patches/patch-electron_spec_api-menu-spec.ts | 17 +
.../patch-electron_spec_api-native-image-spec.ts | 17 +
.../patch-electron_spec_api-net-log-spec.ts | 35 +
...tch-electron_spec_api-notification-dbus-spec.ts | 17 +
.../patch-electron_spec_api-power-monitor-spec.ts | 17 +
.../patch-electron_spec_api-process-spec.ts | 17 +
.../patch-electron_spec_api-protocol-spec.ts | 17 +
.../patch-electron_spec_api-safe-storage-spec.ts | 26 +
.../patches/patch-electron_spec_api-screen-spec.ts | 35 +
.../patches/patch-electron_spec_api-shell-spec.ts | 34 +
.../patch-electron_spec_api-subframe-spec.ts | 17 +
.../patches/patch-electron_spec_api-tray-spec.ts | 17 +
...patch-electron_spec_api-utility-process-spec.ts | 26 +
.../patch-electron_spec_api-web-contents-spec.ts | 17 +
.../patch-electron_spec_api-web-frame-main-spec.ts | 17 +
.../patches/patch-electron_spec_chromium-spec.ts | 50 +
.../patches/patch-electron_spec_crash-spec.ts | 17 +
...c_fixtures_api_safe-storage_decrypt-app_main.js | 17 +
...c_fixtures_api_safe-storage_encrypt-app_main.js | 17 +
...spec_fixtures_crash-cases_safe-storage_index.js | 17 +
...n_spec_fixtures_native-addon_uv-dlopen_index.js | 17 +
.../patches/patch-electron_spec_node-spec.ts | 17 +
.../patch-electron_spec_version-bump-spec.ts | 17 +
.../patch-electron_spec_visibility-state-spec.ts | 17 +
.../patches/patch-electron_spec_webview-spec.ts | 17 +
..._browser__context__keyed__service__factories.cc | 17 +
...sions_browser_api_management_management__api.cc | 17 +
...sions_browser_api_messaging_message__service.cc | 26 +
...ivate_networking__private__delegate__factory.cc | 35 +
...owser_guest__view_app__view_app__view__guest.cc | 18 +
...rowser_guest__view_app__view_app__view__guest.h | 26 +
...extension__options_extension__options__guest.cc | 18 +
..._extension__options_extension__options__guest.h | 18 +
...me__handler__view_mime__handler__view__guest.cc | 18 +
...ime__handler__view_mime__handler__view__guest.h | 18 +
...xtensions_browser_script__injection__tracker.cc | 16 +
...tensions_common_api___permission__features.json | 35 +
.../patch-extensions_common_api_runtime.json | 17 +
.../patches/patch-extensions_common_command.cc | 17 +
.../patch-extensions_common_features_feature.cc | 17 +
...ensions_renderer_bindings_api__binding__util.cc | 17 +
...-extensions_renderer_bindings_argument__spec.cc | 17 +
.../patch-extensions_renderer_script__injection.cc | 16 +
...h-extensions_shell_app_shell__main__delegate.cc | 26 +
...er_api_runtime_shell__runtime__api__delegate.cc | 17 +
...ns_shell_browser_shell__browser__main__parts.cc | 17 +
...shell_browser_shell__extensions__api__client.cc | 26 +
..._shell_browser_shell__extensions__api__client.h | 25 +
...h-fuchsia__web_webengine_browser_frame__impl.cc | 18 +
...ch-fuchsia__web_webengine_browser_frame__impl.h | 18 +
electron34/patches/patch-gin_converter.cc | 37 +
electron34/patches/patch-gin_converter.h | 24 +
electron34/patches/patch-gin_isolate__holder.cc | 96 +
.../patches/patch-gin_object__template__builder.cc | 22 +
.../patches/patch-gin_object__template__builder.h | 18 +
.../patches/patch-gin_public_gin__embedders.h | 17 +
.../patches/patch-gin_public_isolate__holder.h | 57 +
electron34/patches/patch-gin_public_v8__platform.h | 16 +
electron34/patches/patch-gin_v8__initializer.cc | 58 +
electron34/patches/patch-gin_v8__initializer.h | 35 +
electron34/patches/patch-gin_v8__platform.cc | 19 +
electron34/patches/patch-gin_wrappable.cc | 65 +
electron34/patches/patch-gin_wrappable.h | 22 +
...h-google__apis_gcm_engine_heartbeat__manager.cc | 35 +
...mand__buffer_service_dawn__context__provider.cc | 17 +
..._command__buffer_service_gles2__cmd__decoder.cc | 31 +
...fer_service_gles2__cmd__decoder__passthrough.cc | 38 +
..._service_gles2__cmd__decoder__unittest__base.cc | 22 +
...mmand__buffer_service_shared__context__state.cc | 35 +
...ommand__buffer_service_shared__context__state.h | 26 +
...image_angle__vulkan__image__backing__factory.cc | 17 +
...e_shared__image_external__vk__image__backing.cc | 26 +
..._image_external__vk__image__backing__factory.cc | 17 +
...service_shared__image_shared__image__factory.cc | 35 +
...service_shared__image_shared__image__manager.cc | 17 +
...ce_shared__image_wrapped__sk__image__backing.cc | 17 +
...ommand__buffer_service_webgpu__decoder__impl.cc | 26 +
...ffer_tests_gl__gpu__memory__buffer__unittest.cc | 26 +
.../patches/patch-gpu_config_gpu__control__list.cc | 26 +
.../patch-gpu_config_gpu__finch__features.cc | 18 +
.../patch-gpu_config_gpu__info__collector.cc | 17 +
.../patches/patch-gpu_config_gpu__test__config.cc | 17 +
...-gpu_ipc_common_gpu__memory__buffer__support.cc | 26 +
...h-gpu_ipc_common_gpu__memory__buffer__support.h | 17 +
electron34/patches/patch-gpu_ipc_service_BUILD.gn | 16 +
.../patches/patch-gpu_ipc_service_gpu__init.cc | 80 +
...gpu_ipc_service_gpu__memory__buffer__factory.cc | 26 +
...c_service_gpu__memory__buffer__factory__dxgi.cc | 29 +
...rvice_image__transport__surface__overlay__mac.h | 26 +
electron34/patches/patch-gpu_ipc_service_x__util.h | 17 +
.../patches/patch-gpu_vulkan_generate__bindings.py | 17 +
.../patches/patch-gpu_vulkan_semaphore__handle.cc | 26 +
.../patch-gpu_vulkan_vulkan__device__queue.cc | 26 +
.../patch-gpu_vulkan_vulkan__device__queue.h | 17 +
.../patch-gpu_vulkan_vulkan__function__pointers.cc | 26 +
.../patch-gpu_vulkan_vulkan__function__pointers.h | 33 +
.../patches/patch-gpu_vulkan_vulkan__image.h | 26 +
.../patches/patch-gpu_vulkan_vulkan__util.cc | 17 +
...rowser_headless__browser__main__parts__posix.cc | 45 +
...b_browser_headless__content__browser__client.cc | 26 +
...ib_browser_headless__content__browser__client.h | 17 +
...ss_lib_browser_headless__web__contents__impl.cc | 27 +
...adless_lib_headless__content__main__delegate.cc | 17 +
electron34/patches/patch-ipc_ipc__channel.h | 17 +
.../patches/patch-ipc_ipc__channel__common.cc | 17 +
electron34/patches/patch-ipc_ipc__channel__mojo.cc | 17 +
.../patches/patch-ipc_ipc__message__utils.cc | 17 +
electron34/patches/patch-ipc_ipc__message__utils.h | 17 +
electron34/patches/patch-media_BUILD.gn | 21 +
electron34/patches/patch-media_audio_BUILD.gn | 64 +
.../patch-media_audio_alsa_audio__manager__alsa.cc | 60 +
...media_audio_apple_audio__low__latency__input.cc | 40 +
.../patch-media_audio_audio__input__device.cc | 17 +
...h-media_audio_audio__output__proxy__unittest.cc | 20 +
.../patches/patch-media_audio_pulse_pulse__util.cc | 21 +
...atch-media_audio_sndio_audio__manager__sndio.cc | 222 ++
...patch-media_audio_sndio_audio__manager__sndio.h | 75 +
.../patch-media_audio_sndio_sndio__input.cc | 209 ++
.../patches/patch-media_audio_sndio_sndio__input.h | 100 +
.../patch-media_audio_sndio_sndio__output.cc | 196 ++
.../patch-media_audio_sndio_sndio__output.h | 97 +
.../patches/patch-media_base_audio__latency.cc | 17 +
.../patch-media_base_libaom__thread__wrapper.cc | 30 +
.../patch-media_base_libvpx__thread__wrapper.cc | 31 +
.../patches/patch-media_base_media__switches.cc | 132 ++
.../patches/patch-media_base_media__switches.h | 73 +
...ch-media_base_user__input__monitor__unittest.cc | 35 +
.../patches/patch-media_base_video__frame.cc | 53 +
electron34/patches/patch-media_base_video__frame.h | 53 +
...media_capture_content_video__capture__oracle.cc | 122 +
...ure_content_video__capture__oracle__unittest.cc | 111 +
.../patch-media_capture_video__capture__types.h | 17 +
...ideo_create__video__capture__device__factory.cc | 26 +
..._video_fake__video__capture__device__factory.cc | 17 +
..._video_file__video__capture__device__factory.cc | 17 +
...h-media_capture_video_linux_fake__v4l2__impl.cc | 17 +
...ch-media_capture_video_linux_fake__v4l2__impl.h | 31 +
..._capture_video_linux_v4l2__capture__delegate.cc | 183 ++
...a_capture_video_linux_v4l2__capture__delegate.h | 66 +
...dia_capture_video_linux_v4l2__capture__device.h | 17 +
...ture_video_linux_v4l2__capture__device__impl.cc | 17 +
...pture_video_linux_v4l2__capture__device__impl.h | 17 +
..._linux_video__capture__device__factory__v4l2.cc | 107 +
...o_linux_video__capture__device__factory__v4l2.h | 17 +
...re_video_linux_video__capture__device__linux.cc | 17 +
...deo__capture__buffer__tracker__factory__impl.cc | 26 +
...capture_video_video__capture__device__client.cc | 17 +
.../patch-media_cdm_cdm__paths__unittest.cc | 17 +
.../patch-media_cdm_library__cdm_cdm__paths.gni | 17 +
.../patch-media_ffmpeg_scripts_build__ffmpeg.py | 82 +
.../patch-media_ffmpeg_scripts_robo__lib_config.py | 64 +
.../patches/patch-media_gpu_buffer__validation.cc | 35 +
...a_gpu_chromeos_gl__image__processor__backend.cc | 19 +
...u_chromeos_libyuv__image__processor__backend.cc | 35 +
...pu_chromeos_mailbox__video__frame__converter.cc | 17 +
...a_gpu_chromeos_platform__video__frame__utils.cc | 17 +
...-media_gpu_chromeos_video__decoder__pipeline.cc | 35 +
...gpu_gpu__video__encode__accelerator__factory.cc | 26 +
...dware__video__decoding__sandbox__hook__linux.cc | 50 +
...rdware__video__decoding__sandbox__hook__linux.h | 22 +
...dware__video__encoding__sandbox__hook__linux.cc | 32 +
...rdware__video__encoding__sandbox__hook__linux.h | 29 +
.../patches/patch-media_gpu_test_raw__video.cc | 17 +
...ch-media_gpu_test_video__frame__file__writer.cc | 17 +
.../patch-media_gpu_test_video__frame__helpers.cc | 17 +
...patch-media_gpu_test_video__frame__validator.cc | 17 +
.../patch-media_gpu_vaapi_vaapi__video__decoder.cc | 17 +
.../patch-media_gpu_vaapi_vaapi__wrapper.cc | 17 +
electron34/patches/patch-media_media__options.gni | 28 +
.../patches/patch-media_mojo_mojom_stable_BUILD.gn | 17 +
...stable__video__decoder__types__mojom__traits.cc | 26 +
..._stable__video__decoder__types__mojom__traits.h | 17 +
...media_mojo_mojom_video__frame__mojom__traits.cc | 17 +
.../patch-media_video_fake__gpu__memory__buffer.cc | 44 +
...ideo_gpu__memory__buffer__video__frame__pool.cc | 35 +
...ble__gpu__memory__buffer__video__frame__pool.cc | 50 +
...ia_video_video__encode__accelerator__adapter.cc | 26 +
...eo_video__encode__accelerator__adapter__test.cc | 17 +
.../patches/patch-media_webrtc_audio__processor.cc | 17 +
electron34/patches/patch-media_webrtc_helpers.cc | 25 +
.../patch-media_webrtc_helpers__unittests.cc | 44 +
electron34/patches/patch-mojo_core_BUILD.gn | 17 +
electron34/patches/patch-mojo_core_channel.cc | 20 +
.../patches/patch-mojo_core_embedder_features.h | 17 +
.../patch-mojo_core_ipcz__driver_transport.cc | 42 +
...atch-mojo_core_platform__handle__in__transit.cc | 46 +
...tch-mojo_public_cpp_platform_platform__handle.h | 26 +
...ojo_public_cpp_platform_socket__utils__posix.cc | 17 +
.../patch-mojo_public_tools_bindings_mojom.gni | 35 +
electron34/patches/patch-net_BUILD.gn | 101 +
electron34/patches/patch-net_base_features.cc | 30 +
...tch-net_base_mock__network__change__notifier.cc | 17 +
...atch-net_base_mock__network__change__notifier.h | 26 +
.../patch-net_base_network__change__notifier.cc | 45 +
.../patch-net_base_network__change__notifier.h | 35 +
...-net_base_network__change__notifier__passive.cc | 17 +
.../patch-net_base_network__interfaces__posix.h | 17 +
.../patch-net_base_sockaddr__util__posix.cc | 18 +
...tch-net_base_sockaddr__util__posix__unittest.cc | 18 +
.../patches/patch-net_cert_cert__verify__proc.h | 17 +
.../patch-net_disk__cache_backend__experiment.h | 17 +
...net_disk__cache_simple_simple__file__tracker.cc | 26 +
electron34/patches/patch-net_dns_BUILD.gn | 58 +
electron34/patches/patch-net_dns_address__info.cc | 22 +
.../patch-net_dns_address__sorter__posix.cc | 16 +
.../patch-net_dns_dns__config__service__posix.cc | 50 +
electron34/patches/patch-net_dns_dns__reloader.cc | 25 +
electron34/patches/patch-net_dns_dns__util.cc | 17 +
.../patches/patch-net_dns_host__resolver__proc.cc | 19 +
electron34/patches/patch-net_dns_public_BUILD.gn | 17 +
.../patches/patch-net_dns_public_resolv__reader.cc | 17 +
.../patches/patch-net_dns_public_resolv__reader.h | 16 +
.../patch-net_dns_public_scoped__res__state.cc | 17 +
.../patch-net_dns_public_scoped__res__state.h | 16 +
.../patch-net_filter_zstd__source__stream.cc | 16 +
.../patch-net_http_http__auth__gssapi__posix.cc | 20 +
.../patch-net_http_http__auth__gssapi__posix.h | 18 +
...atch-net_http_http__auth__handler__negotiate.cc | 17 +
.../patch-net_http_http__auth__preferences.cc | 17 +
.../patch-net_http_http__auth__preferences.h | 35 +
.../patch-net_http_http__network__session.cc | 18 +
...net_proxy__resolution_proxy__config__service.cc | 41 +
...xy__resolution_proxy__config__service__linux.cc | 46 +
.../patches/patch-net_socket_socket__posix.cc | 17 +
.../patch-net_socket_socks5__client__socket.cc | 18 +
.../patches/patch-net_socket_tcp__socket__posix.cc | 26 +
.../patches/patch-net_socket_udp__socket__posix.cc | 132 ++
.../patch-net_socket_udp__socket__unittest.cc | 53 +
.../patches/patch-net_third__party_quiche_BUILD.gn | 17 +
..._tools_cert__verify__tool_cert__verify__tool.cc | 35 +
.../patch-net_tools_net__watcher_net__watcher.cc | 35 +
...ffic__annotation_network__traffic__annotation.h | 26 +
...__request_static__http__user__agent__settings.h | 27 +
...patch-net_url__request_url__request__context.cc | 17 +
.../patch-net_url__request_url__request__context.h | 17 +
..._url__request_url__request__context__builder.cc | 17 +
.../patches/patch-pdf_pdfium_pdfium__engine.cc | 26 +
electron34/patches/patch-ppapi_tests_test__utils.h | 27 +
.../patch-printing_backend_cups__ipp__helper.cc | 17 +
.../patch-printing_backend_print__backend__cups.cc | 35 +
...nting_mojom_printing__context__mojom__traits.cc | 35 +
...inting_mojom_printing__context__mojom__traits.h | 17 +
.../patches/patch-printing_print__settings.cc | 44 +
.../patches/patch-printing_print__settings.h | 53 +
.../patch-printing_print__settings__conversion.cc | 17 +
.../patches/patch-printing_printing__context.cc | 16 +
.../patches/patch-printing_printing__context.h | 28 +
.../patch-printing_printing__context__linux.cc | 44 +
.../patch-printing_printing__context__mac.h | 19 +
.../patch-printing_printing__context__mac.mm | 41 +
...nting_printing__context__system__dialog__win.cc | 42 +
.../patches/patch-printing_printing__features.cc | 23 +
.../patches/patch-printing_printing__features.h | 17 +
...sandbox_print__backend__sandbox__hook__linux.cc | 56 +
..._sandbox_print__backend__sandbox__hook__linux.h | 22 +
.../patch-remoting_base_chromoting__event.cc | 17 +
.../patches/patch-remoting_base_host__settings.cc | 26 +
...h-remoting_codec_webrtc__video__encoder__vpx.cc | 17 +
...ting_host_base_desktop__environment__options.cc | 17 +
.../patches/patch-remoting_host_base_switches.cc | 24 +
.../patches/patch-remoting_host_base_switches.h | 24 +
...ch-remoting_host_basic__desktop__environment.cc | 17 +
.../patch-remoting_host_chromoting__host.cc | 17 +
.../patches/patch-remoting_host_chromoting__host.h | 35 +
...atch-remoting_host_chromoting__host__context.cc | 17 +
...ting_host_chromoting__host__services__client.cc | 26 +
.../patches/patch-remoting_host_client__session.cc | 17 +
...ch-remoting_host_crash_crash__file__uploader.cc | 17 +
..._desktop__and__cursor__conditional__composer.cc | 26 +
...patch-remoting_host_desktop__capturer__proxy.cc | 35 +
...tch-remoting_host_desktop__capturer__wrapper.cc | 35 +
.../patch-remoting_host_evaluate__capability.cc | 17 +
.../patch-remoting_host_host__attributes.cc | 17 +
.../patches/patch-remoting_host_host__details.cc | 17 +
.../patches/patch-remoting_host_host__main.cc | 44 +
.../patches/patch-remoting_host_ipc__constants.cc | 26 +
.../patch-remoting_host_it2me_it2me__host.cc | 35 +
...t_it2me_it2me__native__messaging__host__main.cc | 53 +
...ch-remoting_host_me2me__desktop__environment.cc | 44 +
...emoting_host_mojo__caller__security__checker.cc | 35 +
...-remoting_host_mouse__cursor__monitor__proxy.cc | 17 +
.../patches/patch-remoting_host_policy__watcher.cc | 17 +
..._remote__open__url_remote__open__url__client.cc | 26 +
...st_remote__open__url_remote__open__url__util.cc | 17 +
...mote__open__url_url__forwarder__configurator.cc | 17 +
.../patch-remoting_host_remoting__me2me__host.cc | 166 ++
...-remoting_host_session__policies__from__dict.cc | 17 +
.../patch-remoting_host_setup_start__host__main.cc | 35 +
...hn_remote__webauthn__caller__security__utils.cc | 35 +
...bauthn_remote__webauthn__extension__notifier.cc | 34 +
...atch-remoting_protocol_webrtc__video__stream.cc | 17 +
electron34/patches/patch-sandbox_BUILD.gn | 17 +
electron34/patches/patch-sandbox_features.gni | 17 +
electron34/patches/patch-sandbox_linux_BUILD.gn | 41 +
...sandbox_linux_services_init__process__reaper.cc | 21 +
...tch-sandbox_linux_services_libc__interceptor.cc | 27 +
electron34/patches/patch-sandbox_mac_BUILD.gn | 32 +
.../patches/patch-sandbox_mac_sandbox__compiler.cc | 34 +
.../patches/patch-sandbox_mac_sandbox__logging.cc | 40 +
electron34/patches/patch-sandbox_mac_seatbelt.cc | 176 ++
.../patch-sandbox_mac_seatbelt__extension.cc | 66 +
.../patches/patch-sandbox_mac_system__services.cc | 45 +
electron34/patches/patch-sandbox_policy_BUILD.gn | 67 +
.../patches/patch-sandbox_policy_features.cc | 29 +
electron34/patches/patch-sandbox_policy_features.h | 17 +
...atch-sandbox_policy_freebsd_sandbox__freebsd.cc | 220 ++
...patch-sandbox_policy_freebsd_sandbox__freebsd.h | 285 +++
.../patch-sandbox_policy_mac_sandbox__mac.mm | 19 +
.../patch-sandbox_policy_mojom_sandbox.mojom | 24 +
.../patch-sandbox_policy_netbsd_sandbox__netbsd.cc | 220 ++
.../patch-sandbox_policy_netbsd_sandbox__netbsd.h | 285 +++
...atch-sandbox_policy_openbsd_sandbox__openbsd.cc | 401 ++++
...patch-sandbox_policy_openbsd_sandbox__openbsd.h | 289 +++
electron34/patches/patch-sandbox_policy_sandbox.cc | 28 +
electron34/patches/patch-sandbox_policy_sandbox.h | 32 +
.../patches/patch-sandbox_policy_sandbox__type.cc | 138 ++
.../patches/patch-sandbox_policy_switches.cc | 41 +
electron34/patches/patch-sandbox_policy_switches.h | 40 +
.../patch-sandbox_policy_win_sandbox__win.cc | 80 +
.../patch-sandbox_policy_win_sandbox__win.h | 26 +
...h-services_audio_audio__sandbox__hook__linux.cc | 37 +
...ch-services_audio_audio__sandbox__hook__linux.h | 22 +
electron34/patches/patch-services_device_BUILD.gn | 17 +
...vice_geolocation_location__provider__manager.cc | 17 +
.../patches/patch-services_device_hid_BUILD.gn | 50 +
...ch-services_device_hid_hid__connection__fido.cc | 225 ++
...tch-services_device_hid_hid__connection__fido.h | 69 +
...services_device_hid_hid__connection__freebsd.cc | 249 +++
...-services_device_hid_hid__connection__freebsd.h | 76 +
.../patch-services_device_hid_hid__service.cc | 46 +
...patch-services_device_hid_hid__service__fido.cc | 405 ++++
.../patch-services_device_hid_hid__service__fido.h | 74 +
...ch-services_device_hid_hid__service__freebsd.cc | 404 ++++
...tch-services_device_hid_hid__service__freebsd.h | 58 +
...tch-services_device_hid_hid__service__netbsd.cc | 36 +
...atch-services_device_hid_hid__service__netbsd.h | 42 +
...ce_public_cpp_generic__sensor_sensor__reading.h | 17 +
.../patch-services_device_public_mojom_BUILD.gn | 17 +
.../patches/patch-services_device_serial_BUILD.gn | 17 +
...ces_device_serial_serial__device__enumerator.cc | 26 +
...ces_device_serial_serial__io__handler__posix.cc | 17 +
...me__zone__monitor_time__zone__monitor__linux.cc | 20 +
.../patches/patch-services_device_usb_BUILD.gn | 40 +
.../patch-services_device_usb_usb__service.cc | 42 +
...patch-services_device_usb_usb__service__fake.cc | 58 +
.../patch-services_device_usb_usb__service__fake.h | 57 +
...patch-services_device_usb_usb__service__impl.cc | 17 +
electron34/patches/patch-services_network_BUILD.gn | 16 +
.../patch-services_network_network__context.cc | 176 ++
.../patch-services_network_network__context.h | 51 +
...rvices_network_network__sandbox__hook__linux.cc | 43 +
...ervices_network_network__sandbox__hook__linux.h | 20 +
.../patch-services_network_network__service.cc | 35 +
.../patch-services_network_network__service.h | 35 +
.../patch-services_network_public_cpp_BUILD.gn | 26 +
.../patch-services_network_public_cpp_features.cc | 17 +
...ervices_network_public_cpp_resource__request.cc | 24 +
...services_network_public_cpp_resource__request.h | 16 +
...twork_public_cpp_url__request__mojom__traits.cc | 16 +
...etwork_public_cpp_url__request__mojom__traits.h | 19 +
.../patch-services_network_public_mojom_BUILD.gn | 31 +
...ces_network_public_mojom_network__context.mojom | 45 +
...ervices_network_public_mojom_url__request.mojom | 18 +
..._network_public_mojom_url__response__head.mojom | 26 +
...ionary_shared__dictionary__writer__in__memory.h | 17 +
...-services_network_test_test__network__context.h | 25 +
.../patches/patch-services_network_url__loader.cc | 47 +
.../patches/patch-services_network_url__loader.h | 17 +
..._on__device__model_on__device__model__service.h | 28 +
...ervices_on__device__model_pre__sandbox__init.cc | 44 +
..._instrumentation_queued__request__dispatcher.cc | 71 +
...tor_public_cpp_memory__instrumentation_BUILD.gn | 24 +
...ublic_cpp_memory__instrumentation_os__metrics.h | 26 +
...cpp_memory__instrumentation_os__metrics__bsd.cc | 75 +
...tch-services_screen__ai_public_cpp_utilities.cc | 35 +
..._ai_sandbox_screen__ai__sandbox__hook__linux.cc | 24 +
...__ai_sandbox_screen__ai__sandbox__hook__linux.h | 22 +
.../patch-services_service__manager_BUILD.gn | 17 +
...manager_public_cpp_service__executable_BUILD.gn | 17 +
...p_stack__sampling_tracing__sampler__profiler.cc | 17 +
...ture_public_mojom_video__capture__service.mojom | 21 +
...effects_video__effects__sandbox__hook__linux.cc | 33 +
..._effects_video__effects__sandbox__hook__linux.h | 22 +
...ileged_mojom_compositing_display__private.mojom | 16 +
...ed_mojom_compositing_frame__sink__manager.mojom | 16 +
...ojom_compositing_layered__window__updater.mojom | 15 +
.../patch-skia_ext_SkMemory__new__handler.cpp | 26 +
electron34/patches/patch-skia_ext_font__utils.cc | 26 +
.../patches/patch-skia_ext_platform__canvas.h | 17 +
.../patches/patch-skia_ext_skcolorspace__trfn.cc | 17 +
electron34/patches/patch-third__party_.gitignore | 35 +
...atch-third__party_abseil-cpp_absl_base_config.h | 28 +
...y_abseil-cpp_absl_base_internal_raw__logging.cc | 17 +
..._party_abseil-cpp_absl_base_internal_sysinfo.cc | 71 +
...l-cpp_absl_debugging_internal_elf__mem__image.h | 18 +
...sl_time_internal_cctz_src_time__zone__format.cc | 18 +
.../patches/patch-third__party_afl_src_afl-fuzz.c | 48 +
.../patches/patch-third__party_angle_BUILD.gn | 35 +
.../patch-third__party_angle_src_common_platform.h | 30 +
...ird__party_angle_src_common_platform__helpers.h | 17 +
...third__party_angle_src_common_system__utils.cpp | 17 +
...party_angle_src_common_system__utils__linux.cpp | 45 +
...ngle_src_gpu__info__util_SystemInfo__internal.h | 22 +
...ngle_src_gpu__info__util_SystemInfo__libpci.cpp | 96 +
...angle_src_gpu__info__util_SystemInfo__linux.cpp | 41 +
...y_angle_src_gpu__info__util_SystemInfo__x11.cpp | 67 +
...tch-third__party_angle_src_libANGLE_Display.cpp | 62 +
...third__party_angle_src_libANGLE_formatutils.cpp | 17 +
...e_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp | 21 +
...e_src_libANGLE_renderer_vulkan_DisplayVk__api.h | 17 +
.../patches/patch-third__party_angle_util_BUILD.gn | 17 +
.../patch-third__party_blink_common_features.cc | 21 +
...y_blink_common_permissions_permission__utils.cc | 25 +
...erences_renderer__preferences__mojom__traits.cc | 17 +
..._preferences_web__preferences__mojom__traits.cc | 28 +
...tch-third__party_blink_public_common_features.h | 16 +
...k_public_common_permissions_permission__utils.h | 16 +
...n_renderer__preferences_renderer__preferences.h | 17 +
...ferences_renderer__preferences__mojom__traits.h | 17 +
...blic_common_web__preferences_web__preferences.h | 37 +
...__preferences_web__preferences__mojom__traits.h | 69 +
...k_public_mojom_dom__storage_storage__area.mojom | 18 +
...third__party_blink_public_mojom_page_page.mojom | 16 +
...lic_mojom_webpreferences_web__preferences.mojom | 36 +
...h-third__party_blink_public_platform_platform.h | 27 +
...ublic_platform_web__content__settings__client.h | 18 +
...hird__party_blink_public_platform_web__vector.h | 17 +
...patch-third__party_blink_public_web_web__blob.h | 16 +
..._party_blink_public_web_web__document__loader.h | 25 +
...ird__party_blink_public_web_web__local__frame.h | 16 +
...ty_blink_public_web_web__local__frame__client.h | 18 +
...link_public_web_web__message__port__converter.h | 26 +
...k_public_web_web__script__execution__callback.h | 36 +
...patch-third__party_blink_public_web_web__view.h | 16 +
..._party_blink_public_web_web__window__features.h | 25 +
...nderer_bindings_core_v8_local__window__proxy.cc | 16 +
...nk_renderer_bindings_core_v8_v8__initializer.cc | 50 +
...ink_renderer_bindings_core_v8_v8__initializer.h | 26 +
...e_v8_worker__or__worklet__script__controller.cc | 16 +
...rer_bindings_scripts_bind__gen_style__format.py | 17 +
...rd__party_blink_renderer_build_scripts_gperf.py | 33 +
...renderer_build_scripts_run__with__pythonpath.py | 16 +
...blink_renderer_controller_blink__initializer.cc | 41 +
...rer_controller_memory__usage__monitor__posix.cc | 27 +
...erer_controller_memory__usage__monitor__posix.h | 53 +
...patch-third__party_blink_renderer_core_BUILD.gn | 16 +
...arty_blink_renderer_core_animation_animation.cc | 111 +
...party_blink_renderer_core_animation_animation.h | 38 +
..._renderer_core_animation_element__animations.cc | 96 +
...k_renderer_core_animation_element__animations.h | 17 +
..._renderer_core_css_font__face__set__document.cc | 51 +
...rd__party_blink_renderer_core_editing_build.gni | 24 +
...er_core_editing_commands_clipboard__commands.cc | 26 +
...link_renderer_core_editing_editing__behavior.cc | 17 +
...erer_core_execution__context_navigator__base.cc | 17 +
...party_blink_renderer_core_exported_web__blob.cc | 31 +
..._core_exported_web__message__port__converter.cc | 32 +
...blink_renderer_core_exported_web__view__impl.cc | 77 +
..._blink_renderer_core_exported_web__view__impl.h | 25 +
...third__party_blink_renderer_core_frame_frame.cc | 38 +
...blink_renderer_core_frame_local__dom__window.cc | 17 +
...party_blink_renderer_core_frame_local__frame.cc | 48 +
..._party_blink_renderer_core_frame_local__frame.h | 16 +
...link_renderer_core_frame_local__frame__client.h | 17 +
...nderer_core_frame_local__frame__client__impl.cc | 22 +
...enderer_core_frame_local__frame__client__impl.h | 17 +
...derer_core_frame_local__frame__mojo__handler.cc | 16 +
...nderer_core_frame_pausable__script__executor.cc | 69 +
...enderer_core_frame_pausable__script__executor.h | 34 +
...y_blink_renderer_core_frame_web__frame__test.cc | 34 +
..._renderer_core_frame_web__local__frame__impl.cc | 26 +
...k_renderer_core_frame_web__local__frame__impl.h | 16 +
...ty_blink_renderer_core_fullscreen_fullscreen.cc | 17 +
...ore_html_canvas_canvas__async__blob__creator.cc | 17 +
...erer_core_inspector_inspector__memory__agent.cc | 17 +
...arty_blink_renderer_core_layout_layout__view.cc | 26 +
..._blink_renderer_core_loader_document__loader.cc | 30 +
...y_blink_renderer_core_loader_document__loader.h | 17 +
...rty_blink_renderer_core_loader_empty__clients.h | 17 +
...r_core_origin__trials_origin__trial__context.cc | 17 +
...party_blink_renderer_core_paint_paint__layer.cc | 17 +
...er_core_paint_paint__property__tree__builder.cc | 47 +
...e_paint_paint__property__tree__builder__test.cc | 146 ++
...re_paint_paint__property__tree__builder__test.h | 16 +
...uler__integration__tests_virtual__time__test.cc | 16 +
..._renderer_core_scroll_scrollbar__theme__aura.cc | 26 +
...core_view__transition_view__transition__test.cc | 125 ++
...y_blink_renderer_core_workers_worker__thread.cc | 21 +
...party_blink_renderer_core_xml_xslt__processor.h | 20 +
...k_renderer_core_xml_xslt__processor__libxslt.cc | 20 +
...r_modules_media_audio_audio__device__factory.cc | 17 +
..._audio_audio__renderer__mixer__manager__test.cc | 17 +
...er_modules_peerconnection_rtc__data__channel.cc | 16 +
...peerconnection_webrtc__audio__renderer__test.cc | 17 +
...dules_webaudio_audio__worklet__global__scope.cc | 26 +
...rer_modules_webaudio_audio__worklet__handler.cc | 52 +
...erer_modules_webaudio_audio__worklet__handler.h | 29 +
...odules_webaudio_audio__worklet__thread__test.cc | 17 +
...r_modules_webaudio_script__processor__handler.h | 16 +
...odules_webgl_webgl__rendering__context__base.cc | 30 +
...rty_blink_renderer_modules_webgpu_gpu__queue.cc | 17 +
..._modules_websockets_websocket__channel__impl.cc | 38 +
...h-third__party_blink_renderer_platform_BUILD.gn | 25 +
...nk_renderer_platform_audio_denormal__disabler.h | 190 ++
...erer_platform_audio_denormal__disabler__test.cc | 60 +
...ink_renderer_platform_bindings_script__state.cc | 37 +
...link_renderer_platform_bindings_script__state.h | 42 +
...ty_blink_renderer_platform_fonts_font__cache.cc | 26 +
...rty_blink_renderer_platform_fonts_font__cache.h | 53 +
...nk_renderer_platform_fonts_font__description.cc | 26 +
..._blink_renderer_platform_fonts_font__metrics.cc | 35 +
...renderer_platform_fonts_font__platform__data.cc | 26 +
...er_platform_fonts_font__unique__name__lookup.cc | 26 +
...nderer_platform_fonts_skia_font__cache__skia.cc | 26 +
...rer_platform_graphics_begin__frame__provider.cc | 21 +
...hics_compositing_paint__artifact__compositor.cc | 24 +
...phics_compositing_paint__artifact__compositor.h | 17 +
...r_platform_graphics_gpu_image__layer__bridge.cc | 17 +
...er_platform_graphics_video__frame__submitter.cc | 17 +
...ion_partition__alloc__memory__dump__provider.cc | 34 +
...r_platform_media_multi__buffer__data__source.cc | 56 +
...er_platform_media_multi__buffer__data__source.h | 25 +
..._peerconnection_rtc__video__encoder__factory.cc | 23 +
...derer_platform_runtime__enabled__features.json5 | 89 +
...nk_renderer_platform_scheduler_common_thread.cc | 17 +
...g_blink__categorized__worker__pool__delegate.cc | 17 +
...latform_widget_compositing_layer__tree__view.cc | 24 +
..._renderer_platform_wtf_container__annotations.h | 17 +
...arty_blink_renderer_platform_wtf_math__extras.h | 29 +
...arty_blink_renderer_platform_wtf_stack__util.cc | 82 +
.../patches/patch-third__party_boringssl_BUILD.gn | 30 +
...ingssl_src_crypto_cipher__extra_cipher__extra.c | 40 +
...ingssl_src_crypto_digest__extra_digest__extra.c | 16 +
...gssl_src_crypto_fipsmodule_digest_digests.c.inc | 44 +
...party_boringssl_src_decrepit_evp_evp__do__all.c | 74 +
...d__party_boringssl_src_include_openssl_cipher.h | 16 +
...d__party_boringssl_src_include_openssl_digest.h | 18 +
...h-third__party_boringssl_src_ssl_ssl__buffer.cc | 16 +
...atch-third__party_boringssl_src_ssl_ssl__lib.cc | 32 +
.../patch-third__party_brotli_common_platform.h | 17 +
.../patches/patch-third__party_cpuinfo_cpuinfo.gni | 17 +
...ashpad_crashpad_build_crashpad__buildconfig.gni | 17 +
...-third__party_crashpad_crashpad_client_BUILD.gn | 22 +
...hpad_crashpad_client_crashpad__client__posix.cc | 49 +
...ashpad_minidump_minidump__misc__info__writer.cc | 21 +
...ty_crashpad_crashpad_util_misc_address__types.h | 26 +
..._crashpad_crashpad_util_misc_capture__context.h | 28 +
...d__party_crashpad_crashpad_util_misc_metrics.cc | 17 +
...hird__party_crashpad_crashpad_util_misc_uuid.cc | 17 +
...crashpad_crashpad_util_posix_close__multiple.cc | 17 +
...rashpad_crashpad_util_posix_drop__privileges.cc | 17 +
...__party_crashpad_crashpad_util_posix_signals.cc | 39 +
...ashpad_util_posix_symbolic__constants__posix.cc | 26 +
...crashpad_util_win_exception__handler__server.cc | 25 +
.../patches/patch-third__party_crc32c_BUILD.gn | 17 +
..._party_dawn_include_dawn_native_VulkanBackend.h | 18 +
...ch-third__party_dawn_src_dawn_common_Platform.h | 20 +
...party_dawn_src_dawn_native_vulkan_BackendVk.cpp | 17 +
...end_src_front__end_entrypoints_main_MainImpl.ts | 17 +
.../patch-third__party_electron__node_BUILD.gn | 426 ++++
.../patch-third__party_electron__node_common.gypi | 102 +
.../patch-third__party_electron__node_configure.py | 16 +
...h-third__party_electron__node_deps_ada_BUILD.gn | 31 +
...party_electron__node_deps_brotli_unofficial.gni | 17 +
...third__party_electron__node_deps_cares_BUILD.gn | 218 ++
...__party_electron__node_deps_googletest_BUILD.gn | 84 +
...d__party_electron__node_deps_histogram_BUILD.gn | 38 +
...electron__node_deps_histogram_src_hdr__atomic.h | 22 +
...hird__party_electron__node_deps_llhttp_BUILD.gn | 36 +
...ird__party_electron__node_deps_nghttp2_BUILD.gn | 71 +
...rd__party_electron__node_deps_simdjson_BUILD.gn | 23 +
...ird__party_electron__node_deps_simdutf_BUILD.gn | 40 +
...ch-third__party_electron__node_deps_uv_BUILD.gn | 234 ++
..._party_electron__node_deps_uv_docs_src_loop.rst | 24 +
...hird__party_electron__node_deps_uv_include_uv.h | 26 +
...party_electron__node_deps_uv_include_uv_errno.h | 27 +
...__party_electron__node_deps_uv_src_unix_async.c | 65 +
...d__party_electron__node_deps_uv_src_unix_core.c | 38 +
...d__party_electron__node_deps_uv_src_unix_loop.c | 61 +
...d__party_electron__node_deps_uv_src_unix_pipe.c | 24 +
...d__party_electron__node_deps_uv_src_uv-common.h | 28 +
...rd__party_electron__node_deps_uv_src_win_core.c | 29 +
..._party_electron__node_deps_uv_src_win_process.c | 70 +
...rd__party_electron__node_deps_uv_src_win_util.c | 26 +
..._party_electron__node_deps_uv_test_test-embed.c | 227 ++
...__party_electron__node_deps_uv_test_test-list.h | 24 +
...rd__party_electron__node_deps_uv_unofficial.gni | 22 +
...hird__party_electron__node_deps_uvwasi_BUILD.gn | 59 +
...__party_electron__node_deps_uvwasi_src_uvwasi.c | 35 +
...atch-third__party_electron__node_doc_api_cli.md | 16 +
...-third__party_electron__node_electron__node.gni | 13 +
...atch-third__party_electron__node_filenames.json | 749 +++++++
...-third__party_electron__node_lib_.eslintrc.yaml | 19 +
...ird__party_electron__node_lib_child__process.js | 55 +
...rty_electron__node_lib_internal_assert_utils.js | 35 +
...y_electron__node_lib_internal_bootstrap_node.js | 19 +
..._party_electron__node_lib_internal_constants.js | 24 +
...arty_electron__node_lib_internal_fs_watchers.js | 28 +
...hird__party_electron__node_lib_internal_http.js | 35 +
...ctron__node_lib_internal_main_worker__thread.js | 17 +
...ectron__node_lib_internal_modules_cjs_loader.js | 63 +
...n__node_lib_internal_modules_esm_get__format.js | 16 +
...electron__node_lib_internal_modules_esm_load.js | 71 +
...ctron__node_lib_internal_modules_esm_resolve.js | 189 ++
...n__node_lib_internal_modules_esm_translators.js | 76 +
...lectron__node_lib_internal_modules_esm_utils.js | 33 +
...e_lib_internal_modules_package__json__reader.js | 26 +
...lectron__node_lib_internal_modules_run__main.js | 44 +
...on__node_lib_internal_process_pre__execution.js | 29 +
...third__party_electron__node_lib_internal_url.js | 17 +
...rd__party_electron__node_lib_internal_worker.js | 18 +
.../patch-third__party_electron__node_node.gypi | 19 +
...rd__party_electron__node_src_api_environment.cc | 33 +
...rd__party_electron__node_src_base__object-inl.h | 36 +
...-third__party_electron__node_src_base__object.h | 23 +
...rty_electron__node_src_crypto_crypto__cipher.cc | 25 +
...rty_electron__node_src_crypto_crypto__common.cc | 75 +
...ty_electron__node_src_crypto_crypto__context.cc | 30 +
...__party_electron__node_src_crypto_crypto__dh.cc | 82 +
..._party_electron__node_src_crypto_crypto__dsa.cc | 28 +
...party_electron__node_src_crypto_crypto__keys.cc | 26 +
...rty_electron__node_src_crypto_crypto__random.cc | 17 +
..._party_electron__node_src_crypto_crypto__rsa.cc | 24 +
...party_electron__node_src_crypto_crypto__util.cc | 130 ++
..._party_electron__node_src_crypto_crypto__util.h | 17 +
...patch-third__party_electron__node_src_env-inl.h | 40 +
.../patch-third__party_electron__node_src_env.cc | 98 +
.../patch-third__party_electron__node_src_env.h | 37 +
...third__party_electron__node_src_handle__wrap.cc | 18 +
...ch-third__party_electron__node_src_histogram.cc | 18 +
...rd__party_electron__node_src_inspector_BUILD.gn | 228 ++
...third__party_electron__node_src_module__wrap.cc | 105 +
...-third__party_electron__node_src_module__wrap.h | 49 +
.../patch-third__party_electron__node_src_node.cc | 21 +
.../patch-third__party_electron__node_src_node.h | 54 +
...hird__party_electron__node_src_node__binding.cc | 41 +
...third__party_electron__node_src_node__binding.h | 17 +
...-third__party_electron__node_src_node__buffer.h | 17 +
...ird__party_electron__node_src_node__builtins.cc | 73 +
...hird__party_electron__node_src_node__builtins.h | 25 +
...rd__party_electron__node_src_node__constants.cc | 45 +
...d__party_electron__node_src_node__contextify.cc | 380 ++++
...rd__party_electron__node_src_node__contextify.h | 68 +
...ird__party_electron__node_src_node__env__var.cc | 153 ++
...third__party_electron__node_src_node__errors.cc | 45 +
...-third__party_electron__node_src_node__errors.h | 17 +
..._electron__node_src_node__external__reference.h | 40 +
...h-third__party_electron__node_src_node__file.cc | 195 ++
...ch-third__party_electron__node_src_node__file.h | 22 +
...h-third__party_electron__node_src_node__i18n.cc | 44 +
...ird__party_electron__node_src_node__internals.h | 28 +
...rd__party_electron__node_src_node__messaging.cc | 28 +
...hird__party_electron__node_src_node__metadata.h | 17 +
...hird__party_electron__node_src_node__options.cc | 47 +
...third__party_electron__node_src_node__options.h | 17 +
...ird__party_electron__node_src_node__platform.cc | 107 +
...hird__party_electron__node_src_node__platform.h | 75 +
...rty_electron__node_src_node__process__object.cc | 72 +
...third__party_electron__node_src_node__serdes.cc | 87 +
...party_electron__node_src_node__trace__events.cc | 38 +
...h-third__party_electron__node_src_node__wasi.cc | 35 +
...third__party_electron__node_src_stream__base.cc | 58 +
...-third__party_electron__node_src_stream__base.h | 22 +
...hird__party_electron__node_src_tracing_agent.cc | 85 +
...third__party_electron__node_src_tracing_agent.h | 58 +
...ectron__node_src_tracing_node__trace__buffer.cc | 24 +
...ectron__node_src_tracing_node__trace__writer.cc | 26 +
...lectron__node_src_tracing_node__trace__writer.h | 18 +
...party_electron__node_src_tracing_trace__event.h | 118 +
...ctron__node_test_addons_cppgc-object_binding.cc | 45 +
...party_electron__node_test_cctest_test__cppgc.cc | 72 +
...electron__node_test_cctest_test__environment.cc | 21 +
...d__party_electron__node_test_common_debugger.js | 33 +
...rd__party_electron__node_test_common_globals.js | 16 +
...de_test_es-module_test-cjs-legacyMainResolve.js | 53 +
..._promise__unhandled__warn__with__error.snapshot | 15 +
...rors_throw__error__with__getter__throw.snapshot | 16 +
..._node_test_fixtures_errors_throw__null.snapshot | 16 +
..._test_fixtures_errors_throw__undefined.snapshot | 16 +
...node_test_fixtures_eval_eval__messages.snapshot | 26 +
...ode_test_fixtures_eval_stdin__messages.snapshot | 26 +
..._test-runner_output_arbitrary-output-colored.js | 17 +
...ty_electron__node_test_parallel_parallel.status | 25 +
...ode_test_parallel_test-buffer-tostring-range.js | 18 +
...on__node_test_parallel_test-cli-node-options.js | 16 +
..._test_parallel_test-crypto-async-sign-verify.js | 24 +
...node_test_parallel_test-crypto-authenticated.js | 139 ++
...__node_test_parallel_test-crypto-certificate.js | 33 +
...de_test_parallel_test-crypto-cipher-decipher.js | 113 +
...est_parallel_test-crypto-cipheriv-decipheriv.js | 19 +
...tron__node_test_parallel_test-crypto-classes.js | 19 +
...on__node_test_parallel_test-crypto-dh-curves.js | 17 +
...on__node_test_parallel_test-crypto-dh-errors.js | 20 +
..._electron__node_test_parallel_test-crypto-dh.js | 54 +
...node_test_parallel_test-crypto-getcipherinfo.js | 23 +
...e_test_parallel_test-crypto-hash-stream-pipe.js | 25 +
...lectron__node_test_parallel_test-crypto-hash.js | 24 +
...lectron__node_test_parallel_test-crypto-hkdf.js | 17 +
...tron__node_test_parallel_test-crypto-padding.js | 36 +
...tron__node_test_parallel_test-crypto-rsa-dsa.js | 50 +
...ctron__node_test_parallel_test-crypto-scrypt.js | 17 +
...__node_test_parallel_test-crypto-sign-verify.js | 68 +
...ctron__node_test_parallel_test-crypto-stream.js | 23 +
...lectron__node_test_parallel_test-crypto-x509.js | 21 +
...rty_electron__node_test_parallel_test-crypto.js | 94 +
...n__node_test_parallel_test-debugger-address.mjs | 16 +
...tron__node_test_parallel_test-debugger-break.js | 35 +
..._test-debugger-random-port-with-inspect-port.js | 16 +
...arallel_test-debugger-run-after-quit-restart.js | 17 +
...y_electron__node_test_parallel_test-fs-write.js | 17 +
...parallel_test-https-agent-additional-options.js | 26 +
...t_parallel_test-https-agent-session-eviction.js | 17 +
..._node_test_parallel_test-node-output-errors.mjs | 33 +
...n__node_test_parallel_test-node-output-eval.mjs | 37 +
...e_test_parallel_test-node-output-v8-warning.mjs | 40 +
...ron__node_test_parallel_test-tls-getprotocol.js | 17 +
...ron__node_test_parallel_test-tls-write-error.js | 17 +
...y_electron__node_test_parallel_test-v8-stats.js | 19 +
...node_test_parallel_test-webcrypto-derivebits.js | 21 +
..._node_test_parallel_test-webcrypto-derivekey.js | 21 +
...ode_test_parallel_test-webcrypto-sign-verify.js | 21 +
...ode_test_parallel_test-webcrypto-wrap-unwrap.js | 36 +
...test_parallel_test-worker-unsupported-things.js | 29 +
...ctron__node_test_parallel_test-x509-escaping.js | 32 +
...lectron__node_test_sequential_sequential.status | 27 +
...tron__node_test_sequential_test-debugger-pid.js | 16 +
...rty_electron__node_test_wpt_status_streams.json | 19 +
...on__node_tools_generate__gn__filenames__json.py | 126 ++
..._electron__node_tools_generate__original__fs.py | 27 +
...ch-third__party_electron__node_tools_install.py | 34 +
...patch-third__party_electron__node_tools_js2c.cc | 155 ++
...nfigs_chromium-browser-clang_rewrapper__mac.cfg | 16 +
...s_chromium-browser-clang_rewrapper__windows.cfg | 16 +
...engflow-reclient-configs_configure__reclient.py | 82 +
...configs_python_python__remote__wrapper.template | 38 +
...ow-reclient-configs_python_rewrapper__linux.cfg | 16 +
...flow-reclient-configs_python_rewrapper__mac.cfg | 16 +
...-reclient-configs_python_rewrapper__windows.cfg | 14 +
...ird__party_engflow-reclient-configs_reproxy.cfg | 13 +
.../patches/patch-third__party_ffmpeg_BUILD.gn | 25 +
...atch-third__party_ffmpeg_libavcodec_x86_cabac.h | 18 +
.../patch-third__party_ffmpeg_libavutil_cpu.c | 20 +
.../patch-third__party_ffmpeg_libavutil_mem.c | 18 +
...ch-third__party_ffmpeg_libavutil_random__seed.c | 31 +
...ch-third__party_ffmpeg_libavutil_x86_x86inc.asm | 29 +
.../patch-third__party_fontconfig_include_config.h | 55 +
...atch-third__party_fontconfig_src_src_fccompat.c | 19 +
...rd__party_ipcz_src_reference__drivers_random.cc | 55 +
...hird__party_ipcz_src_standalone_base_logging.cc | 18 +
...tch-third__party_leveldatabase_env__chromium.cc | 18 +
...m_source_libaom_aom__ports_aarch64__cpudetect.c | 56 +
.../patch-third__party_libc++_src_src_chrono.cpp | 17 +
...libc++_src_src_filesystem_filesystem__clock.cpp | 17 +
...ird__party_libc++abi_src_src_cxa__guard__impl.h | 26 +
.../patch-third__party_libdrm_src_xf86drmMode.c | 29 +
...st_cpp_src_phonenumbers_base_memory_singleton.h | 18 +
...pp_src_phonenumbers_base_synchronization_lock.h | 18 +
...ist_cpp_src_phonenumbers_base_thread__checker.h | 29 +
...ch-third__party_libsync_src_include_sync_sync.h | 18 +
.../patches/patch-third__party_libsync_src_sync.c | 31 +
.../patches/patch-third__party_libusb_BUILD.gn | 58 +
.../patch-third__party_libusb_src_libusb_core.c | 17 +
...rd__party_libusb_src_libusb_os_threads__posix.c | 30 +
...x_source_libvpx_vpx__ports_aarch64__cpudetect.c | 34 +
.../patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S | 203 ++
.../patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm | 141 ++
...tch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm | 189 ++
...h-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm | 81 +
...ch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm | 24 +
...h-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm | 681 ++++++
.../patches/patch-third__party_lzma__sdk_BUILD.gn | 84 +
.../patches/patch-third__party_lzma__sdk_C_7z.h | 47 +
.../patch-third__party_lzma__sdk_C_7zAlloc.c | 128 ++
.../patch-third__party_lzma__sdk_C_7zAlloc.h | 20 +
.../patch-third__party_lzma__sdk_C_7zArcIn.c | 1269 +++++++++++
.../patches/patch-third__party_lzma__sdk_C_7zBuf.h | 20 +
.../patches/patch-third__party_lzma__sdk_C_7zCrc.c | 644 ++++++
.../patches/patch-third__party_lzma__sdk_C_7zCrc.h | 41 +
.../patch-third__party_lzma__sdk_C_7zCrcOpt.c | 289 +++
.../patches/patch-third__party_lzma__sdk_C_7zDec.c | 453 ++++
.../patch-third__party_lzma__sdk_C_7zFile.c | 96 +
.../patch-third__party_lzma__sdk_C_7zFile.h | 30 +
.../patch-third__party_lzma__sdk_C_7zStream.c | 183 ++
.../patch-third__party_lzma__sdk_C_7zTypes.h | 508 +++++
.../patch-third__party_lzma__sdk_C_7zVersion.h | 36 +
.../patch-third__party_lzma__sdk_C_7zVersion.rc | 64 +
.../patch-third__party_lzma__sdk_C_7zWindows.h | 110 +
.../patches/patch-third__party_lzma__sdk_C_Alloc.c | 577 +++++
.../patches/patch-third__party_lzma__sdk_C_Alloc.h | 65 +
.../patches/patch-third__party_lzma__sdk_C_Bcj2.c | 439 ++++
.../patches/patch-third__party_lzma__sdk_C_Bcj2.h | 358 +++
.../patches/patch-third__party_lzma__sdk_C_Bra.c | 860 ++++++++
.../patches/patch-third__party_lzma__sdk_C_Bra.h | 156 ++
.../patches/patch-third__party_lzma__sdk_C_Bra86.c | 254 +++
.../patch-third__party_lzma__sdk_C_BraIA64.c | 71 +
.../patch-third__party_lzma__sdk_C_Compiler.h | 261 +++
.../patch-third__party_lzma__sdk_C_CpuArch.c | 1210 ++++++++++
.../patch-third__party_lzma__sdk_C_CpuArch.h | 572 +++++
.../patches/patch-third__party_lzma__sdk_C_Delta.h | 20 +
.../patch-third__party_lzma__sdk_C_DllSecur.c | 174 ++
.../patch-third__party_lzma__sdk_C_DllSecur.h | 20 +
.../patch-third__party_lzma__sdk_C_LzFind.c | 1259 +++++++++++
.../patch-third__party_lzma__sdk_C_LzFind.h | 125 ++
.../patch-third__party_lzma__sdk_C_LzHash.h | 21 +
.../patch-third__party_lzma__sdk_C_Lzma2Dec.c | 61 +
.../patch-third__party_lzma__sdk_C_Lzma2Dec.h | 43 +
.../patch-third__party_lzma__sdk_C_LzmaDec.c | 580 +++++
.../patch-third__party_lzma__sdk_C_LzmaDec.h | 53 +
.../patch-third__party_lzma__sdk_C_LzmaEnc.c | 1084 +++++++++
.../patch-third__party_lzma__sdk_C_LzmaEnc.h | 76 +
.../patch-third__party_lzma__sdk_C_LzmaLib.c | 34 +
.../patch-third__party_lzma__sdk_C_LzmaLib.h | 45 +
.../patch-third__party_lzma__sdk_C_Precomp.h | 141 ++
.../patch-third__party_lzma__sdk_C_RotateDefs.h | 60 +
.../patch-third__party_lzma__sdk_C_Sha256.c | 564 +++++
.../patch-third__party_lzma__sdk_C_Sha256.h | 61 +
.../patch-third__party_lzma__sdk_C_Sha256Opt.c | 535 +++++
...third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn | 22 +
...hird__party_lzma__sdk_C_Util_SfxSetup_Precomp.h | 19 +
...ird__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c | 202 ++
..._party_lzma__sdk_C_Util_SfxSetup_chromium.patch | 62 +
.../patches/patch-third__party_lzma__sdk_C_Xz.c | 40 +
.../patches/patch-third__party_lzma__sdk_C_Xz.h | 164 ++
.../patch-third__party_lzma__sdk_C_XzCrc64.c | 189 ++
.../patch-third__party_lzma__sdk_C_XzCrc64.h | 42 +
.../patch-third__party_lzma__sdk_C_XzCrc64Opt.c | 308 +++
.../patches/patch-third__party_lzma__sdk_C_XzDec.c | 936 ++++++++
.../patches/patch-third__party_lzma__sdk_C_XzIn.c | 254 +++
.../patches/patch-third__party_lzma__sdk_DEPS | 15 +
.../patch-third__party_lzma__sdk_README.chromium | 73 +
.../patch-third__party_lzma__sdk_chromium.patch | 192 ++
...ch-third__party_lzma__sdk_chromium__ubsan.patch | 34 +
...d__party_lzma__sdk_google_seven__zip__reader.cc | 17 +
...zma__sdk_google_seven__zip__reader__unittest.cc | 33 +
...ial__color__utilities_src_cpp_palettes_tones.cc | 17 +
electron34/patches/patch-third__party_nan_nan.h | 135 ++
...atch-third__party_nan_nan__callbacks__12__inl.h | 214 ++
...tch-third__party_nan_nan__persistent__12__inl.h | 24 +
.../patch-third__party_nan_nan__scriptorigin.h | 35 +
...ird__party_nan_test_cpp_indexedinterceptors.cpp | 20 +
...third__party_nan_test_cpp_namedinterceptors.cpp | 20 +
.../patch-third__party_nan_test_cpp_news.cpp | 26 +
...atch-third__party_nan_test_js_accessors-test.js | 23 +
.../patches/patch-third__party_nasm_BUILD.gn | 22 +
.../patch-third__party_nasm_config_config-linux.h | 108 +
.../patches/patch-third__party_node_node.gni | 17 +
electron34/patches/patch-third__party_node_node.py | 18 +
...ird__party_pdfium_core_fxge_cfx__fontmapper.cpp | 17 +
...arty_pdfium_core_fxge_linux_fx__linux__impl.cpp | 31 +
...-third__party_pdfium_fxjs_fx__date__helpers.cpp | 28 +
.../patches/patch-third__party_pdfium_pdfium.gni | 17 +
...fium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp | 47 +
..._perfetto_include_perfetto_base_build__config.h | 72 +
..._perfetto_include_perfetto_base_thread__utils.h | 28 +
...rd__party_perfetto_include_perfetto_base_time.h | 40 +
..._perfetto_include_perfetto_ext_base_event__fd.h | 17 +
...perfetto_include_perfetto_ext_base_sys__types.h | 21 +
...fetto_include_perfetto_ext_base_thread__utils.h | 21 +
...erfetto_tracing_internal_track__event__legacy.h | 17 +
...erfetto_protos_perfetto_trace_ftrace_v4l2.proto | 62 +
...rd__party_perfetto_src_base_clock__snapshots.cc | 18 +
...tch-third__party_perfetto_src_base_event__fd.cc | 28 +
...hird__party_perfetto_src_base_periodic__task.cc | 26 +
...third__party_perfetto_src_base_string__utils.cc | 21 +
...d__party_perfetto_src_base_subprocess__posix.cc | 28 +
...party_perfetto_src_base_test_vm__test__utils.cc | 17 +
...party_perfetto_src_base_thread__task__runner.cc | 20 +
...-third__party_perfetto_src_base_unix__socket.cc | 46 +
.../patch-third__party_perfetto_src_base_utils.cc | 57 +
...ce__processor_importers_ftrace_v4l2__tracker.cc | 62 +
...-third__party_perfetto_src_tracing_ipc_memfd.cc | 18 +
...__party_perfetto_src_tracing_platform__posix.cc | 25 +
...atch-third__party_perfetto_src_tracing_track.cc | 29 +
...uf_src_google_protobuf_stubs_platform__macros.h | 17 +
..._party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h | 17 +
...hird__party_skia_src_ports_SkMemory__malloc.cpp | 27 +
...third__party_skia_src_ports_SkOSFile__posix.cpp | 17 +
...__party_speech-dispatcher_libspeechd__version.h | 38 +
...third__party_speech-dispatcher_speechd__types.h | 148 ++
.../patches/patch-third__party_sqlite_BUILD.gn | 17 +
...d__party_sqlite_src_amalgamation__dev_sqlite3.c | 18 +
...-third__party_sqlite_src_amalgamation_sqlite3.c | 47 +
.../patch-third__party_squirrel.mac_.gitignore | 20 +
.../patch-third__party_squirrel.mac_BUILD.gn | 251 +++
..._Squirrel_RACSignal+SQRLTransactionExtensions.h | 17 +
..._Squirrel_RACSignal+SQRLTransactionExtensions.m | 17 +
...party_squirrel.mac_Squirrel_SQRLCodeSignature.m | 28 +
...ty_squirrel.mac_Squirrel_SQRLDirectoryManager.m | 17 +
...ty_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m | 17 +
...rd__party_squirrel.mac_Squirrel_SQRLInstaller.h | 18 +
...rd__party_squirrel.mac_Squirrel_SQRLInstaller.m | 192 ++
...arty_squirrel.mac_Squirrel_SQRLShipItLauncher.m | 20 +
...party_squirrel.mac_Squirrel_SQRLShipItRequest.m | 17 +
...squirrel.mac_Squirrel_SQRLTerminationListener.m | 27 +
...third__party_squirrel.mac_Squirrel_SQRLUpdate.m | 17 +
...hird__party_squirrel.mac_Squirrel_SQRLUpdater.h | 28 +
...hird__party_squirrel.mac_Squirrel_SQRLUpdater.m | 123 ++
...__party_squirrel.mac_Squirrel_SQRLZipArchiver.m | 28 +
...hird__party_squirrel.mac_Squirrel_ShipIt-main.m | 149 ++
...patch-third__party_squirrel.mac_build_xcrun.gni | 27 +
.../patch-third__party_squirrel.mac_build_xcrun.py | 23 +
.../patch-third__party_squirrel.mac_filenames.gni | 252 +++
...arty_squirrel.mac_vendor_Mantle_Mantle_Mantle.h | 16 +
...C_ReactiveObjC_NSControl+RACTextSignalSupport.m | 20 +
..._ReactiveObjC_NSNotificationCenter+RACSupport.m | 20 +
...eObjC_ReactiveObjC_NSObject+RACAppKitBindings.m | 25 +
...ctiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m | 25 +
...ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m | 20 +
..._ReactiveObjC_NSObject+RACPropertySubscribing.h | 20 +
..._ReactiveObjC_NSObject+RACPropertySubscribing.m | 20 +
...eObjC_ReactiveObjC_NSObject+RACSelectorSignal.m | 20 +
...tiveObjC_ReactiveObjC_NSText+RACSignalSupport.m | 20 +
...veObjC_ReactiveObjC_NSUserDefaults+RACSupport.m | 20 +
...c_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m | 20 +
...or_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m | 20 +
...endor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h | 20 +
...endor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m | 20 +
...r_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m | 19 +
...c_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m | 20 +
...endor_ReactiveObjC_ReactiveObjC_RACSubscriber.m | 20 +
...ctiveObjC_RACSubscriptingAssignmentTrampoline.h | 20 +
...or_ReactiveObjC_ReactiveObjC_RACTestScheduler.m | 20 +
...mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m | 20 +
...or_ReactiveObjC_ReactiveObjC_RACUnarySequence.m | 20 +
...eactiveObjC_UIBarButtonItem+RACCommandSupport.m | 20 +
...eObjC_ReactiveObjC_UIButton+RACCommandSupport.m | 20 +
...eObjC_ReactiveObjC_UIControl+RACSignalSupport.m | 20 +
...jC_ReactiveObjC_UIDatePicker+RACSignalSupport.m | 20 +
...tiveObjC_UIGestureRecognizer+RACSignalSupport.m | 20 +
...activeObjC_UIRefreshControl+RACCommandSupport.m | 20 +
...ctiveObjC_UISegmentedControl+RACSignalSupport.m | 20 +
...veObjC_ReactiveObjC_UISlider+RACSignalSupport.m | 20 +
...eObjC_ReactiveObjC_UIStepper+RACSignalSupport.m | 20 +
...veObjC_ReactiveObjC_UISwitch+RACSignalSupport.m | 20 +
...bjC_ReactiveObjC_UITextField+RACSignalSupport.m | 25 +
...ObjC_ReactiveObjC_UITextView+RACSignalSupport.m | 20 +
...-third__party_swiftshader_src_Reactor_Debug.cpp | 18 +
...__party_swiftshader_src_System_Configurator.cpp | 18 +
...d__party_swiftshader_src_System_Linux_MemFd.cpp | 43 +
...tshader_src_Vulkan_VkSemaphoreExternalLinux.hpp | 26 +
...tch-third__party_swiftshader_src_WSI_libXCB.cpp | 26 +
...10.0_configs_linux_include_llvm_Config_config.h | 180 ++
...ubzero_build_Linux_include_llvm_Config_config.h | 53 +
...ty_swiftshader_third__party_marl_src_memory.cpp | 18 +
...ty_swiftshader_third__party_marl_src_thread.cpp | 29 +
...ch-third__party_test__fonts_fontconfig_BUILD.gn | 34 +
...st__fonts_fontconfig_fontconfig__util__linux.cc | 33 +
...onts_fontconfig_generate__fontconfig__caches.cc | 26 +
.../patches/patch-third__party_tflite_features.gni | 19 +
.../patches/patch-third__party_unrar_src_crc.cpp | 28 +
.../patches/patch-third__party_unrar_src_crypt.cpp | 17 +
.../patches/patch-third__party_unrar_src_os.hpp | 23 +
.../patch-third__party_unrar_src_rijndael.cpp | 30 +
...layers_src_layers_external_vma_vk__mem__alloc.h | 17 +
...ers_vulkan_generated_vk__function__pointers.cpp | 18 +
...kan__memory__allocator_include_vk__mem__alloc.h | 17 +
.../patches/patch-third__party_wayland_BUILD.gn | 20 +
.../patch-third__party_wayland_include_config.h | 35 +
.../patches/patch-third__party_webrtc_BUILD.gn | 18 +
...rd__party_webrtc_modules_audio__device_BUILD.gn | 17 +
...c_modules_desktop__capture_desktop__capturer.cc | 17 +
...pture_linux_wayland_base__capturer__pipewire.cc | 16 +
...s_desktop__capture_linux_wayland_egl__dmabuf.cc | 24 +
...__capture_linux_x11_x__server__pixel__buffer.cc | 21 +
...les_desktop__capture_screen__capturer__linux.cc | 23 +
...les_desktop__capture_window__capturer__linux.cc | 23 +
...dules_video__capture_linux_pipewire__session.cc | 26 +
...ideo__coding_codecs_av1_libaom__av1__encoder.cc | 29 +
...tch-third__party_webrtc_rtc__base_byte__order.h | 17 +
...ch-third__party_webrtc_rtc__base_ip__address.cc | 18 +
...d__party_webrtc_rtc__base_net__test__helpers.cc | 16 +
.../patch-third__party_webrtc_rtc__base_network.cc | 21 +
...ty_webrtc_rtc__base_physical__socket__server.cc | 120 +
...rty_webrtc_rtc__base_physical__socket__server.h | 17 +
...rty_webrtc_rtc__base_platform__thread__types.cc | 43 +
...webrtc_rtc__base_third__party_sigslot_sigslot.h | 29 +
...h-third__party_webrtc_system__wrappers_BUILD.gn | 17 +
.../patch-third__party_widevine_cdm_widevine.gni | 18 +
.../patches/patch-third__party_zlib_BUILD.gn | 48 +
.../patch-third__party_zlib_cpu__features.c | 57 +
.../patches/patch-tools_clang_scripts_update.py | 17 +
...erate__shim__headers_generate__shim__headers.py | 27 +
.../patches/patch-tools_generate__stubs_rules.gni | 16 +
...atch-tools_gn_build_build__linux.ninja.template | 17 +
electron34/patches/patch-tools_gn_build_gen.py | 40 +
.../patch-tools_gn_src_base_files_file__posix.cc | 17 +
electron34/patches/patch-tools_gn_src_gn_version.h | 21 +
.../patches/patch-tools_gn_src_util_exe__path.cc | 96 +
.../patches/patch-tools_grit_grit_node_base.py | 18 +
.../patch-tools_gritsettings_resource__ids.spec | 20 +
...son__schema__compiler_cpp__bundle__generator.py | 17 +
...ols_json__schema__compiler_feature__compiler.py | 18 +
.../patches/patch-tools_licenses_licenses.py | 40 +
...ls_memory_partition__allocator_inspect__utils.h | 17 +
...ch-tools_perf_chrome__telemetry__build_BUILD.gn | 26 +
.../patch-tools_protoc__wrapper_protoc__wrapper.py | 30 +
.../patch-tools_v8__context__snapshot_BUILD.gn | 61 +
...atch-tools_variations_fieldtrial__to__struct.py | 18 +
.../patch-ui_accelerated__widget__mac_BUILD.gn | 16 +
...ted__widget__mac_ca__layer__tree__coordinator.h | 36 +
...ed__widget__mac_ca__layer__tree__coordinator.mm | 46 +
...erated__widget__mac_display__ca__layer__tree.mm | 34 +
.../patch-ui_accessibility_platform_BUILD.gn | 16 +
...latform_browser__accessibility__manager__mac.mm | 57 +
...sibility_platform_inspect_ax__transform__mac.mm | 32 +
.../patch-ui_aura_client_drag__drop__client.h | 17 +
electron34/patches/patch-ui_aura_screen__ozone.cc | 17 +
electron34/patches/patch-ui_aura_screen__ozone.h | 26 +
electron34/patches/patch-ui_base_BUILD.gn | 35 +
.../patch-ui_base_accelerators_accelerator.cc | 66 +
.../patch-ui_base_accelerators_accelerator.h | 25 +
...h-ui_base_accelerators_accelerator__unittest.cc | 17 +
...h-ui_base_accelerators_media__keys__listener.cc | 18 +
...base_accelerators_media__keys__listener__mac.mm | 33 +
...patch-ui_base_clipboard_clipboard__constants.cc | 17 +
.../patch-ui_base_clipboard_clipboard__constants.h | 17 +
...tch-ui_base_clipboard_clipboard__non__backed.cc | 17 +
...-ui_base_clipboard_scoped__clipboard__writer.cc | 25 +
...h-ui_base_clipboard_scoped__clipboard__writer.h | 19 +
...atch-ui_base_cocoa_remote__accessibility__api.h | 28 +
.../patch-ui_base_cocoa_remote__layer__api.h | 33 +
.../patch-ui_base_cocoa_remote__layer__api.mm | 43 +
.../patch-ui_base_cursor_cursor__factory.cc | 17 +
.../patches/patch-ui_base_cursor_cursor__factory.h | 17 +
...agdrop_os__exchange__data__provider__factory.cc | 26 +
...op_os__exchange__data__provider__non__backed.cc | 17 +
...patch-ui_base_ime_dummy__text__input__client.cc | 17 +
.../patch-ui_base_ime_dummy__text__input__client.h | 17 +
.../patch-ui_base_ime_fake__text__input__client.cc | 17 +
.../patch-ui_base_ime_fake__text__input__client.h | 17 +
...-ui_base_ime_init_input__method__initializer.cc | 35 +
...linux_linux__input__method__context__factory.cc | 26 +
.../patch-ui_base_ime_text__input__client.h | 17 +
.../patch-ui_base_resource_resource__bundle.cc | 17 +
.../patch-ui_base_test_skia__gold__pixel__diff.cc | 17 +
.../patches/patch-ui_base_test_ui__controls.h | 17 +
.../patches/patch-ui_base_ui__base__features.cc | 35 +
.../patches/patch-ui_base_ui__base__features.h | 17 +
.../patches/patch-ui_base_ui__base__switches.cc | 24 +
.../patches/patch-ui_base_ui__base__switches.h | 22 +
.../patches/patch-ui_base_webui_web__ui__util.cc | 26 +
.../patch-ui_base_x_x11__cursor__factory.cc | 26 +
.../patches/patch-ui_base_x_x11__cursor__factory.h | 26 +
.../patches/patch-ui_base_x_x11__cursor__loader.cc | 47 +
.../patch-ui_base_x_x11__display__manager.cc | 26 +
...ch-ui_base_x_x11__global__shortcut__listener.cc | 84 +
...tch-ui_base_x_x11__global__shortcut__listener.h | 42 +
.../patch-ui_base_x_x11__shm__image__pool.cc | 77 +
electron34/patches/patch-ui_color_color__id.h | 36 +
.../patch-ui_color_color__provider__utils.cc | 17 +
electron34/patches/patch-ui_color_system__theme.h | 17 +
.../patches/patch-ui_color_ui__color__mixer.cc | 34 +
...atch-ui_color_win_native__color__mixers__win.cc | 43 +
.../patches/patch-ui_compositor_compositor.cc | 54 +
.../patches/patch-ui_compositor_compositor.h | 85 +
.../patch-ui_compositor_compositor__observer.h | 17 +
electron34/patches/patch-ui_display_BUILD.gn | 21 +
.../patches/patch-ui_display_mac_screen__mac.mm | 34 +
electron34/patches/patch-ui_display_screen.cc | 17 +
electron34/patches/patch-ui_display_screen.h | 26 +
...vents_devices_x11_device__data__manager__x11.cc | 16 +
electron34/patches/patch-ui_events_event.cc | 35 +
electron34/patches/patch-ui_events_event.h | 27 +
.../patches/patch-ui_events_event__switches.cc | 17 +
.../patches/patch-ui_events_event__switches.h | 17 +
...ch-ui_events_keycodes_dom_keycode__converter.cc | 44 +
...tch-ui_events_keycodes_dom_keycode__converter.h | 17 +
.../patches/patch-ui_events_x_events__x__utils.cc | 18 +
electron34/patches/patch-ui_gfx_BUILD.gn | 30 +
.../patches/patch-ui_gfx_ca__layer__params.h | 25 +
electron34/patches/patch-ui_gfx_canvas__skia.cc | 17 +
.../patches/patch-ui_gfx_font__fallback__linux.cc | 17 +
.../patches/patch-ui_gfx_font__render__params.h | 26 +
.../patch-ui_gfx_font__render__params__linux.cc | 26 +
electron34/patches/patch-ui_gfx_font__util.cc | 26 +
.../patches/patch-ui_gfx_gpu__memory__buffer.cc | 17 +
.../patches/patch-ui_gfx_gpu__memory__buffer.h | 26 +
.../patches/patch-ui_gfx_linux_dmabuf__uapi.h | 42 +
.../patches/patch-ui_gfx_linux_gbm__wrapper.cc | 17 +
...ch-ui_gfx_mojom_buffer__types__mojom__traits.cc | 26 +
.../patch-ui_gfx_mojom_ca__layer__params.mojom | 15 +
...i_gfx_mojom_ca__layer__params__mojom__traits.cc | 18 +
...ui_gfx_mojom_ca__layer__params__mojom__traits.h | 19 +
...x_mojom_native__handle__types__mojom__traits.cc | 40 +
...fx_mojom_native__handle__types__mojom__traits.h | 42 +
.../patches/patch-ui_gfx_native__pixmap__handle.cc | 68 +
.../patches/patch-ui_gfx_native__pixmap__handle.h | 44 +
.../patches/patch-ui_gfx_native__widget__types.h | 26 +
.../patches/patch-ui_gfx_platform__font__mac.mm | 42 +
.../patches/patch-ui_gfx_platform__font__skia.cc | 26 +
.../patch-ui_gfx_render__text__api__fuzzer.cc | 26 +
.../patches/patch-ui_gfx_render__text__fuzzer.cc | 26 +
electron34/patches/patch-ui_gfx_switches.cc | 17 +
electron34/patches/patch-ui_gfx_switches.h | 17 +
electron34/patches/patch-ui_gfx_x_atom__cache.cc | 16 +
.../patch-ui_gfx_x_generated__protos_dri3.cc | 17 +
.../patch-ui_gfx_x_generated__protos_shm.cc | 17 +
electron34/patches/patch-ui_gfx_x_xlib__support.cc | 27 +
electron34/patches/patch-ui_gl_BUILD.gn | 32 +
electron34/patches/patch-ui_gl_gl__context.cc | 17 +
electron34/patches/patch-ui_gl_gl__fence.cc | 17 +
.../patches/patch-ui_gl_gl__implementation.cc | 17 +
electron34/patches/patch-ui_gl_gl__switches.cc | 35 +
.../patch-ui_gl_sync__control__vsync__provider.cc | 44 +
.../patch-ui_gl_sync__control__vsync__provider.h | 26 +
electron34/patches/patch-ui_gtk_gtk__compat.cc | 68 +
electron34/patches/patch-ui_gtk_gtk__compat.h | 18 +
electron34/patches/patch-ui_gtk_gtk__ui.cc | 24 +
electron34/patches/patch-ui_gtk_gtk__ui.h | 27 +
.../patch-ui_gtk_printing_print__dialog__gtk.cc | 42 +
...atch-ui_gtk_select__file__dialog__linux__gtk.cc | 134 ++
...patch-ui_gtk_select__file__dialog__linux__gtk.h | 31 +
.../patch-ui_gtk_window__frame__provider__gtk.cc | 104 +
.../patch-ui_gtk_window__frame__provider__gtk.h | 26 +
.../patches/patch-ui_linux_fallback__linux__ui.cc | 18 +
.../patches/patch-ui_linux_fallback__linux__ui.h | 18 +
electron34/patches/patch-ui_linux_linux__ui.h | 18 +
.../patches/patch-ui_menus_simple__menu__model.cc | 45 +
.../patches/patch-ui_menus_simple__menu__model.h | 42 +
...i_message__center_views_message__popup__view.cc | 17 +
.../patch-ui_native__theme_native__theme.cc | 17 +
.../patches/patch-ui_native__theme_native__theme.h | 49 +
.../patch-ui_native__theme_native__theme__base.cc | 17 +
...tch-ui_native__theme_native__theme__features.cc | 26 +
.../patch-ui_native__theme_native__theme__win.cc | 17 +
.../patches/patch-ui_ozone_common_egl__util.cc | 20 +
...platform_headless_headless__surface__factory.cc | 26 +
..._platform_headless_ozone__platform__headless.cc | 17 +
...rm_headless_vulkan__implementation__headless.cc | 35 +
..._ozone_platform_wayland_common_wayland__util.cc | 26 +
...form_wayland_emulate_wayland__input__emulate.cc | 17 +
...tform_wayland_emulate_wayland__input__emulate.h | 17 +
..._wayland_gpu_vulkan__implementation__wayland.cc | 20 +
...ne_platform_wayland_host_wayland__connection.cc | 17 +
...wayland_host_wayland__input__method__context.cc | 44 +
...st_wayland__input__method__context__unittest.cc | 67 +
...i_ozone_platform_wayland_host_wayland__popup.cc | 17 +
...tform_wayland_host_wayland__toplevel__window.cc | 17 +
...atform_wayland_host_wayland__toplevel__window.h | 17 +
..._ozone_platform_wayland_host_wayland__window.cc | 50 +
...i_ozone_platform_wayland_host_wayland__window.h | 44 +
...m_wayland_host_zwp__text__input__wrapper__v1.cc | 27 +
...ne_platform_wayland_ozone__platform__wayland.cc | 60 +
.../patches/patch-ui_ozone_platform_x11_BUILD.gn | 17 +
...h-ui_ozone_platform_x11_ozone__platform__x11.cc | 16 +
...one_platform_x11_vulkan__implementation__x11.cc | 20 +
...m_x11_x11__global__shortcut__listener__ozone.cc | 45 +
...rm_x11_x11__global__shortcut__listener__ozone.h | 32 +
...tch-ui_ozone_platform_x11_x11__screen__ozone.cc | 35 +
...atch-ui_ozone_platform_x11_x11__screen__ozone.h | 44 +
.../patch-ui_ozone_platform_x11_x11__window.cc | 17 +
.../patch-ui_ozone_public_ozone__platform.h | 19 +
...e_public_platform__global__shortcut__listener.h | 34 +
...i_ozone_test_mock__platform__window__delegate.h | 17 +
..._platform__window_platform__window__delegate.cc | 17 +
...i_platform__window_platform__window__delegate.h | 17 +
...rm__window_platform__window__init__properties.h | 26 +
electron34/patches/patch-ui_qt_BUILD.gn | 46 +
electron34/patches/patch-ui_qt_qt.gni | 38 +
electron34/patches/patch-ui_qt_qt__ui.cc | 18 +
electron34/patches/patch-ui_qt_qt__ui.h | 18 +
.../patch-ui_shell__dialogs_select__file__dialog.h | 30 +
...i_shell__dialogs_select__file__dialog__linux.cc | 26 +
...ui_shell__dialogs_select__file__dialog__linux.h | 45 +
...ll__dialogs_select__file__dialog__linux__kde.cc | 117 +
..._dialogs_select__file__dialog__linux__portal.cc | 146 ++
...__dialogs_select__file__dialog__linux__portal.h | 47 +
...ings_translations_app__locale__settings__bn.xtb | 17 +
...ings_translations_app__locale__settings__ja.xtb | 17 +
...ings_translations_app__locale__settings__ko.xtb | 17 +
...ings_translations_app__locale__settings__ml.xtb | 17 +
...ings_translations_app__locale__settings__th.xtb | 17 +
...s_translations_app__locale__settings__zh-CN.xtb | 17 +
...s_translations_app__locale__settings__zh-TW.xtb | 17 +
.../patches/patch-ui_strings_ui__strings.grd | 17 +
electron34/patches/patch-ui_views_BUILD.gn | 26 +
...s_cocoa_native__widget__mac__ns__window__host.h | 39 +
..._cocoa_native__widget__mac__ns__window__host.mm | 81 +
...patch-ui_views_controls_button_label__button.cc | 43 +
...atch-ui_views_controls_menu_menu__controller.cc | 70 +
...patch-ui_views_controls_menu_menu__controller.h | 16 +
.../patch-ui_views_controls_menu_menu__runner.cc | 17 +
...ch-ui_views_controls_menu_menu__runner__impl.cc | 25 +
...tch-ui_views_controls_menu_menu__runner__impl.h | 24 +
...ws_controls_menu_menu__runner__impl__adapter.cc | 22 +
...ews_controls_menu_menu__runner__impl__adapter.h | 24 +
...views_controls_menu_menu__runner__impl__cocoa.h | 24 +
...iews_controls_menu_menu__runner__impl__cocoa.mm | 16 +
...s_controls_menu_menu__runner__impl__interface.h | 24 +
...i_views_controls_menu_menu__runner__impl__mac.h | 24 +
..._views_controls_menu_menu__runner__impl__mac.mm | 27 +
...ntrols_menu_menu__runner__impl__remote__cocoa.h | 24 +
...trols_menu_menu__runner__impl__remote__cocoa.mm | 16 +
.../patch-ui_views_controls_prefix__selector.cc | 17 +
.../patch-ui_views_controls_prefix__selector.h | 17 +
.../patch-ui_views_controls_textfield_textfield.cc | 70 +
.../patch-ui_views_controls_textfield_textfield.h | 26 +
.../patch-ui_views_controls_webview_BUILD.gn | 21 +
...-ui_views_controls_webview_web__dialog__view.cc | 18 +
...h-ui_views_controls_webview_web__dialog__view.h | 18 +
.../patches/patch-ui_views_corewm_tooltip__aura.cc | 17 +
.../patch-ui_views_examples_widget__example.cc | 17 +
.../patches/patch-ui_views_focus_focus__manager.cc | 26 +
.../patch-ui_views_style_platform__style.cc | 35 +
..._ui__controls__factory__desktop__aura__ozone.cc | 17 +
.../patches/patch-ui_views_views__delegate.cc | 17 +
.../patches/patch-ui_views_views__delegate.h | 17 +
...top__aura_desktop__drag__drop__client__ozone.cc | 17 +
...ktop__aura_desktop__drag__drop__client__ozone.h | 26 +
...__aura_desktop__window__tree__host__platform.cc | 35 +
...sktop__aura_desktop__window__tree__host__win.cc | 28 +
...esktop__aura_desktop__window__tree__host__win.h | 16 +
.../patches/patch-ui_views_widget_root__view.cc | 17 +
electron34/patches/patch-ui_views_widget_widget.cc | 26 +
.../patch-ui_views_win_hwnd__message__handler.cc | 194 ++
...ui_views_win_hwnd__message__handler__delegate.h | 19 +
.../patch-ui_views_window_custom__frame__view.cc | 17 +
.../patch-ui_views_window_dialog__delegate.cc | 17 +
.../patch-ui_views_window_frame__background.cc | 17 +
...patch-ui_views_window_frame__caption__button.cc | 40 +
.../patch-ui_views_window_frame__caption__button.h | 36 +
electron34/patches/patch-url_url__util.cc | 34 +
electron34/patches/patch-url_url__util.h | 24 +
electron34/patches/patch-v8_BUILD.gn | 139 ++
.../patches/patch-v8_include_v8-fast-api-calls.h | 17 +
electron34/patches/patch-v8_include_v8-internal.h | 17 +
.../patches/patch-v8_include_v8-microtask-queue.h | 18 +
electron34/patches/patch-v8_include_v8-object.h | 39 +
electron34/patches/patch-v8_include_v8config.h | 64 +
electron34/patches/patch-v8_src_api_api.cc | 62 +
electron34/patches/patch-v8_src_base_atomicops.h | 30 +
.../patches/patch-v8_src_base_platform_memory.h | 24 +
.../patch-v8_src_base_platform_platform-freebsd.cc | 38 +
.../patch-v8_src_base_platform_platform-openbsd.cc | 53 +
.../patch-v8_src_base_platform_platform-posix.cc | 101 +
.../patches/patch-v8_src_base_small-vector.h | 17 +
electron34/patches/patch-v8_src_base_strings.h | 18 +
electron34/patches/patch-v8_src_base_sys-info.cc | 21 +
...ch-v8_src_base_utils_random-number-generator.cc | 17 +
.../patch-v8_src_builtins_x64_builtins-x64.cc | 17 +
.../patch-v8_src_compiler_escape-analysis.cc | 25 +
.../patches/patch-v8_src_diagnostics_perf-jit.cc | 17 +
.../patches/patch-v8_src_diagnostics_perf-jit.h | 17 +
.../patches/patch-v8_src_execution_isolate.cc | 33 +
.../patch-v8_src_execution_microtask-queue.h | 21 +
electron34/patches/patch-v8_src_flags_flags.cc | 30 +
.../patches/patch-v8_src_libsampler_sampler.cc | 25 +
.../patch-v8_src_maglev_maglev-graph-builder.cc | 23 +
electron34/patches/patch-v8_src_sandbox_sandbox.cc | 17 +
..._embedded_platform-embedded-file-writer-base.cc | 17 +
...t_embedded_platform-embedded-file-writer-base.h | 16 +
...bedded_platform-embedded-file-writer-generic.cc | 48 +
...tch-v8_src_trap-handler_handler-inside-posix.cc | 43 +
...atch-v8_src_trap-handler_handler-inside-posix.h | 17 +
.../patch-v8_src_trap-handler_trap-handler.h | 17 +
...wasm_baseline_ia32_liftoff-assembler-ia32-inl.h | 134 ++
electron34/patches/patch-v8_tools_run-paxctl.py | 25 +
electron34/patches/patch-v8_tools_run.py | 17 +
electron34/platform.mk | 118 +
2304 files changed, 102326 insertions(+)
diffs:
diff --git a/Makefile b/Makefile
index 53c3c6ec63..36bfc4689b 100644
--- a/Makefile
+++ b/Makefile
@@ -831,6 +831,7 @@ SUBDIR+= eksctl
SUBDIR+= electricsheep
SUBDIR+= electricsheep-git
SUBDIR+= electron32
+SUBDIR+= electron34
SUBDIR+= elegent
SUBDIR+= elementary-calculator
SUBDIR+= elementary-code
diff --git a/electron34/DESCR b/electron34/DESCR
new file mode 100644
index 0000000000..e528f88331
--- /dev/null
+++ b/electron34/DESCR
@@ -0,0 +1,5 @@
+Electron is a framework for building desktop applications
+using JavaScript, HTML, and CSS. By embedding Chromium and
+Node.js into its binary, Electron allows you to maintain
+one JavaScript codebase and create cross-platform apps that
+work on the supported operating systems.
diff --git a/electron34/Makefile b/electron34/Makefile
new file mode 100644
index 0000000000..0c007f5660
--- /dev/null
+++ b/electron34/Makefile
@@ -0,0 +1,334 @@
+# $NetBSD$
+
+DISTNAME= ${ELECTRON}-${ELECTRON_VER}
+# See ${WRKSRC}/electron/DEPS for versions
+CHROMIUM_VERSION= 132.0.6834.210
+AUDIOIO_VERSION= 130.0
+NODE_VERSION= 20.19.1
+NAN_VERSION= e14bdcd1f72d62bca1d541b66da43130384ec213
+SQUIRREL_VERSION= 0e5d146ba13101a1302d59ea6e6e0b3cace4ae38
+REACTIVEOBJC_VERSION= 74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76
+MANTLE_VERSION= 78d3966b3c331292ea29ec38661b25df0a245948
+ENGFLOW_VERSION= 955335c30a752e9ef7bff375baab5e0819b6c00d
+LLVM_MV= 19
+CATEGORIES= devel
+MASTER_SITES= ${MASTER_SITE_GITHUB:=electron/}
+GITHUB_PROJECT= electron
+GITHUB_TAG= v${PKGVERSION_NOREV}
+EXTRACT_SUFX_C= .tar.xz
+
+CHROMIUM_DISTFILE= chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}
+CHROMIUM_DISTFILES= chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}.0
+CHROMIUM_DISTFILES+= chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}.1
+CHROMIUM_DISTFILES+= chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}.2
+NODE_MODULES= ${ELECTRON}-node_modules-${ELECTRON_VER}.tar.gz
+SITES.${CHROMIUM_DISTFILE}.0= https://github.com/tagattie/FreeBSD-Electron/releases/download/v34.3.2/
+SITES.${CHROMIUM_DISTFILE}.1= https://github.com/tagattie/FreeBSD-Electron/releases/download/v34.3.2/
+SITES.${CHROMIUM_DISTFILE}.2= https://github.com/tagattie/FreeBSD-Electron/releases/download/v34.3.2/
+#NOTE: SITES.${NODE_MODULES} doesn't work
+MASTER_SITES+= ${MASTER_SITE_SOURCEFORGE:=kikadf/NetBSD/}
+DISTFILES+= ${CHROMIUM_DISTFILES}
+DISTFILES+= ${NODE_MODULES}
+DISTFILES+= ${DEFAULT_DISTFILES}
+
+GITHUB_SUBMODULES= kikadf chromium-audioio v${AUDIOIO_VERSION} media/audio/audioio
+GITHUB_SUBMODULES+= nodejs node v${NODE_VERSION} third_party/electron_node
+GITHUB_SUBMODULES+= nodejs nan ${NAN_VERSION} third_party/nan
+GITHUB_SUBMODULES+= Squirrel Squirrel.Mac ${SQUIRREL_VERSION} third_party/squirrel.mac
+GITHUB_SUBMODULES+= ReactiveCocoa ReactiveObjC ${REACTIVEOBJC_VERSION} third_party/squirrel.mac/vendor/ReactiveObjC
+GITHUB_SUBMODULES+= Mantle Mantle ${MANTLE_VERSION} third_party/squirrel.mac/vendor/Mantle
+GITHUB_SUBMODULES+= EngFlow reclient-configs ${ENGFLOW_VERSION} third_party/engflow-reclient-configs
+
+EXTRACT_ONLY= ${CHROMIUM_DISTFILE}
+EXTRACT_ONLY+= ${DISTFILES:C/${CHROMIUM_DISTFILE}\.[0-9]//}
+
+MAINTAINER= kikadf.01%gmail.com@localhost
+HOMEPAGE= https://electronjs.org/
+COMMENT= Build cross-platform desktop apps with JavaScript, HTML, and CSS
+LICENSE= modified-bsd AND gnu-lgpl-v3 AND mpl-2.0 AND mit
+
+USE_TOOLS+= bash bison flex:pkgsrc gmake pax perl pkg-config
+TOOLS_PLATFORM.flex= # override the platform definition to use pkgsrc's flex.
+USE_LANGUAGES= c c++
+
+CHECK_PORTABILITY_SKIP+= third_party/dawn/third_party/dxc/utils/buildit/build_llvm
+CHECK_PORTABILITY_SKIP+= third_party/sqlite/src/configure
+CHECK_PORTABILITY_SKIP+= third_party/protobuf/post_process_dist.sh
+CHECK_PORTABILITY_SKIP+= third_party/ffmpeg/configure
+CHECK_PORTABILITY_SKIP+= third_party/nearby/src/embedded/build.sh
+CHECK_PORTABILITY_SKIP+= third_party/xdg-utils/scripts/xdg-terminal
+CHECK_PORTABILITY_SKIP+= third_party/xdg-utils/scripts/xdg-terminal.in
+CHECK_PORTABILITY_SKIP+= third_party/llvm/flang/tools/f18/flang.sh.in
+CHECK_PORTABILITY_SKIP+= third_party/rust-src/vendor/libdbus-sys-0.2.5/vendor/dbus/tools/cmake-format
+CHECK_PORTABILITY_SKIP+= third_party/rust-toolchain/lib/rustlib/src/rust/vendor/libdbus-sys-0.2.5/vendor/dbus/tools/cmake-format
+CHECK_PORTABILITY_SKIP+= v8/tools/run-llprof.sh
+CHECK_PORTABILITY_SKIP+= v8/tools/profiling/run-llprof.sh
+CHECK_PORTABILITY_SKIP+= third_party/electron_node/deps/v8/tools/profiling/run-llprof.sh
+
+TOOL_DEPENDS+= gperf>=3.0.1:../../devel/gperf
+TOOL_DEPENDS+= nasm-[0-9]*:../../devel/nasm
+TOOL_DEPENDS+= ninja-build-[0-9]*:../../devel/ninja-build
+TOOL_DEPENDS+= ${PYPKGPREFIX}-html5lib-[0-9]*:../../textproc/py-html5lib
+TOOL_DEPENDS+= ${PYPKGPREFIX}-beautifulsoup4-[0-9]*:../../www/py-beautifulsoup4
+TOOL_DEPENDS+= ${PYPKGPREFIX}-ply-[0-9]*:../../devel/py-ply
+TOOL_DEPENDS+= rust-bindgen-[0-9]*:../../devel/rust-bindgen
+TOOL_DEPENDS+= yarn-[0-9]*:../../devel/yarn
+
+DEPENDS+= xdg-utils-[0-9]*:../../misc/xdg-utils
+
+.include "platform.mk"
+.include "../../mk/compiler.mk"
+
+# Workaround for brotli and other commands.
+#BUILDLINK_TRANSFORM.NetBSD+= rm:-ldl
+
+# Let to chromium use the -Wl,-z,relro flag
+BUILDLINK_TRANSFORM+= rm:-Wl,-zrelro
+
+# Do not use alloca(3) in libc.
+BUILDLINK_TRANSFORM+= opt:-std=c11:-std=gnu11
+BUILDLINK_TRANSFORM+= opt:-std=c99:-std=gnu99
+BUILDLINK_TRANSFORM+= opt:-std=c++14:-std=gnu++14
+BUILDLINK_TRANSFORM+= opt:-std=c++17:-std=gnu++17
+BUILDLINK_TRANSFORM+= opt:-std=c++20:-std=gnu++20
+
+REPLACE_BASH= chrome/tools/build/linux/chrome-wrapper
+FILES_SUBST+= PYTHONBIN=${PYTHONBIN:Q}
+
+SUBST_CLASSES+= path
+SUBST_STAGE.path= pre-configure
+SUBST_MESSAGE.path= Fixing pathes
+SUBST_FILES.path+= base/base_paths_posix.cc
+SUBST_FILES.path+= base/process/process_handle_openbsd.cc
+SUBST_FILES.path+= build/gn_run_binary.py
+SUBST_FILES.path+= build/rust/rust_bindgen.gni
+SUBST_FILES.path+= build/rust/rust_bindgen_generator.gni
+SUBST_FILES.path+= chrome/common/chrome_paths.cc
+SUBST_FILES.path+= chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
+SUBST_FILES.path+= components/policy/core/common/policy_paths.cc
+SUBST_FILES.path+= sandbox/policy/openbsd/sandbox_openbsd.cc
+SUBST_FILES.path+= services/device/hid/hid_service_freebsd.cc
+SUBST_FILES.path+= services/device/time_zone_monitor/time_zone_monitor_linux.cc
+SUBST_FILES.path+= third_party/blink/renderer/build/scripts/run_with_pythonpath.py
+SUBST_FILES.path+= third_party/electron_node/tools/generate_gn_filenames_json.py
+SUBST_FILES.path+= third_party/engflow-reclient-configs/python/python_remote_wrapper.template
+SUBST_FILES.path+= third_party/squirrel.mac/build/xcrun.py
+SUBST_FILES.path+= third_party/perfetto/src/base/utils.cc
+SUBST_FILES.path+= tools/protoc_wrapper/protoc_wrapper.py
+SUBST_FILES.path+= ui/qt/qt.gni
+SUBST_FILES.path+= v8/tools/run.py
+SUBST_FILES.path+= v8/tools/run-paxctl.py
+SUBST_VARS.path+= PREFIX PKG_SYSCONFBASE VARBASE QTDIR X11BASE PYTHONBIN
+SUBST_VARS.path+= WRKSRC SH
+
+.include "options.mk"
+
+MAKE_ENV+= BUILDTYPE=${BUILDTYPE}
+MAKE_ENV+= GPERF=${PREFIX}/bin/gperf
+TARGET= electron electron:node_headers
+#TARGET+= chromedriver
+TARGET+= licenses version
+
+# These libraries are used from the system and the build infrastructure
+# removes them from the bundled third_party directory and replaces them
+# with hooks to use them from the system.
+GN_SYSTEM_LIBS= dav1d
+GN_SYSTEM_LIBS+= fontconfig
+GN_SYSTEM_LIBS+= icu
+GN_SYSTEM_LIBS+= libaom
+GN_SYSTEM_LIBS+= libevent
+GN_SYSTEM_LIBS+= libjpeg # libjpeg-turbo
+GN_SYSTEM_LIBS+= libpng
+GN_SYSTEM_LIBS+= libvpx
+GN_SYSTEM_LIBS+= libxml
+GN_SYSTEM_LIBS+= libxslt
+GN_SYSTEM_LIBS+= openh264
+GN_SYSTEM_LIBS+= opus
+
+GN_ARGS+= chrome_pgo_phase=0
+GN_ARGS+= clang_use_chrome_plugins=false
+GN_ARGS+= disable_fieldtrial_testing_config=true
+GN_ARGS+= enable_backup_ref_ptr_support=false
+GN_ARGS+= enable_hangout_services_extension=true
+GN_ARGS+= enable_nacl=false
+GN_ARGS+= enable_remoting=false
+GN_ARGS+= fatal_linker_warnings=false
+GN_ARGS+= icu_use_data_file=false
+GN_ARGS+= is_cfi=false
+GN_ARGS+= is_clang=true
+GN_ARGS+= moc_qt6_path="${PREFIX}/qt6/libexec"
+GN_ARGS+= optimize_webui=true
+GN_ARGS+= override_electron_version="${ELECTRON_VER}"
+GN_ARGS+= thin_lto_enable_optimizations=true
+GN_ARGS+= treat_warnings_as_errors=false
+GN_ARGS+= use_allocator_shim=false
+GN_ARGS+= use_cups=true
+GN_ARGS+= use_custom_libcxx=true
+GN_ARGS+= use_custom_libunwind=true
+GN_ARGS+= use_kerberos=false
+GN_ARGS+= use_lld=false
+GN_ARGS+= use_partition_alloc=true
+GN_ARGS+= use_partition_alloc_as_malloc=false
+GN_ARGS+= use_qt5=false
+GN_ARGS+= use_qt6=true
+GN_ARGS+= use_sndio=false
+GN_ARGS+= use_sysroot=false
+GN_ARGS+= use_system_freetype=true
+GN_ARGS+= use_system_harfbuzz=true
+GN_ARGS+= use_system_libdrm=true
+GN_ARGS+= use_system_libjpeg=true #libjpeg-turbo
+GN_ARGS+= use_thin_lto=false
+GN_ARGS+= use_udev=false
+GN_ARGS+= use_vaapi=false
+GN_ARGS+= v8_enable_cet_ibt=true
+
+# flags
+CFLAGS+= -fno-stack-protector
+CFLAGS+= -isystem${PREFIX}/lib/clang/${LLVM_MV}/include # third_party/zlib with clang
+CFLAGS+= -Wno-error=unused-command-line-argument
+CFLAGS+= -Wno-unknown-warning-option
+
+EXTRA_LDFLAGS= -L${PREFIX}/lib \
+ -L${X11BASE}/lib \
+ ${COMPILER_RPATH_FLAG}${PREFIX}/lib \
+ ${COMPILER_RPATH_FLAG}${PREFIX}/lib/nspr \
+ ${COMPILER_RPATH_FLAG}${PREFIX}/lib/nss \
+ ${COMPILER_RPATH_FLAG}${X11BASE}/lib
+EXTRA_CXXFLAGS= -Wno-unknown-warning-option \
+ -I${BUILDLINK_DIR}/include \
+ -I${BUILDLINK_DIR}/include/libepoll-shim \
+ -I${BUILDLINK_DIR}/include/glib \
+ -I${BUILDLINK_DIR}/include/nss
+
+# rust
+RUSTC_VERSION= rustc -V
+MAKE_ENV+= RUSTC_BOOTSTRAP=1
+GN_ARGS+= enable_rust=true \
+ rust_sysroot_absolute="${PREFIX}" \
+ rustc_version="${RUSTC_VERSION:sh}"
+
+.if ${MACHINE_ARCH} == "aarch64"
+FFMPEG_TARGET= arm64
+.elif ${MACHINE_ARCH} == "x86_64"
+FFMPEG_TARGET= x64
+.endif
+
+GN_ARGS+= extra_cxxflags="${EXTRA_CXXFLAGS}" \
+ extra_ldflags="${EXTRA_LDFLAGS}"
+
+# Proprietary codecs are enabled.
+FFMPEG_BRAND= Chrome
+FFMPEG_BDIR= ${WRKSRC}/third_party/ffmpeg/build.${FFMPEG_TARGET}.${LOWER_OPSYS}/${FFMPEG_BRAND}
+FFMPEG_CDIR= ${WRKSRC}/third_party/ffmpeg/chromium/config/${FFMPEG_BRAND}/${LOWER_OPSYS}/${FFMPEG_TARGET}
+
+GN_ARGS+= proprietary_codecs=true \
+ ffmpeg_branding="${FFMPEG_BRAND}"
+
+GN_BOOTSTRAP_FLAGS+= --no-clean --no-rebuild
+GN_BOOTSTRAP_FLAGS+= --skip-generate-buildfiles
+
+# API key and OAuth credential for Google.
+# This is pkgsrc use only.
+#GN_ARGS+= google_api_key=\"AIzaSyAT_3ogzNMKbBMFk3xQ6T35fg52Y9GrFBg\"
+
+NOT_PAX_MPROTECT_SAFE+= lib/${PKGBASE}/electron
+
+PKG_CC= clang
+PKG_CXX= clang++
+
+post-fetch:
+ if [ ! -f ${DISTDIR}/chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C} ]; then \
+ ${CAT} ${DISTDIR}/chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}.? > \
+ ${DISTDIR}/chromium-${CHROMIUM_VERSION}${EXTRACT_SUFX_C}; \
+ fi
+
+post-extract:
+ # Make source tree
+ ${MV} ${WRKSRC} ${WRKDIR}/temp
+ ${MV} ${WRKDIR}/chromium-${CHROMIUM_VERSION} ${WRKSRC}
+ ${MV} ${WRKDIR}/temp/media/audio/audioio ${WRKSRC}/media/audio/audioio
+ ${MV} ${WRKDIR}/temp/third_party/electron_node ${WRKSRC}/third_party/electron_node
+ ${MV} ${WRKDIR}/temp/third_party/nan ${WRKSRC}/third_party/nan
+ ${MV} ${WRKDIR}/temp/third_party/squirrel.mac ${WRKSRC}/third_party/squirrel.mac
+ ${MV} ${WRKDIR}/temp/third_party/engflow-reclient-configs ${WRKSRC}/third_party/engflow-reclient-configs
+ ${MV} ${WRKDIR}/temp ${WRKSRC}/electron
+ #${CP} ${FILESDIR}/chromium.sh.in ${WRKSRC}/chromium.sh
+
+ # Install node modules for electron
+ ${ECHO} "yarn-offline-mirror \"${WRKDIR}/${ELECTRON}-node_modules-${ELECTRON_VER}\"" \
+ >> ${WRKSRC}/electron/.yarnrc
+ ${SED} -i.bak '/.*prepare.*husky.*/d' ${WRKSRC}/electron/package.json
+ cd ${WRKSRC}/electron && \
+ ${SETENV} HOME=${WRKDIR}/.home XDG_CACHE_HOME=${HOME}/.cache \
+ yarn install --frozen-lockfile --offline
+
+pre-configure:
+ # Prepare internal ffmpeg
+ cd ${WRKSRC}/media/ffmpeg && \
+ ${PYTHONBIN} scripts/build_ffmpeg.py \
+ ${LOWER_OPSYS} ${FFMPEG_TARGET} --config-only --branding=${FFMPEG_BRAND}
+ cd ${FFMPEG_BDIR} && ${GMAKE} ffversion.h
+ ${INSTALL_DATA_DIR} ${FFMPEG_CDIR}
+.for ffmpeg_part in config.h config.asm config_components.h libavcodec libavformat libavutil
+ cp -pR ${FFMPEG_BDIR}/${ffmpeg_part} ${FFMPEG_CDIR}
+.endfor
+
+ # Create symlink to NetBSD nodejs command.
+ ${MKDIR} ${WRKSRC}/third_party/node/${LOWER_OPSYS}/node-${LOWER_OPSYS}/bin
+ ${LN} -sf ${PREFIX}/bin/node \
+ ${WRKSRC}/third_party/node/${LOWER_OPSYS}/node-${LOWER_OPSYS}/bin/node
+
+do-configure:
+ cd ${WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${PYTHONBIN} ./build/linux/unbundle/replace_gn_files.py \
+ --system-libraries ${GN_SYSTEM_LIBS} || ${FALSE}
+
+ cd ${WRKSRC}/tools/gn && \
+ ${SETENV} ${MAKE_ENV} ${PYTHONBIN} bootstrap/bootstrap.py ${GN_BOOTSTRAP_FLAGS}
+
+ cd ${WRKSRC} && \
+ ${SETENV} ${CONFIGURE_ENV} ./out/${BUILDTYPE}/gn \
+ gen --args='import("//electron/build/args/${GN_FILE}") ${GN_ARGS}' \
+ --script-executable="${PYTHONBIN}" ${GN_VERBOSE} out/${BUILDTYPE}
+
+do-build:
+ ${RUN} ${_ULIMIT_CMD} cd ${WRKSRC} && \
+ ${SETENV} ${MAKE_ENV} ${PREFIX}/bin/ninja -j ${_MAKE_JOBS_N} -C out/${BUILDTYPE} ${TARGET}
+
+
+BUILDDIR= ${WRKSRC}/out/${BUILDTYPE}
+INSTALLATION_DIRS+= lib/${PKGBASE}
+INSTALLATION_DIRS+= bin
+
+ELECTRON_LIBS+= libEGL.so
+ELECTRON_LIBS+= libGLESv2.so
+ELECTRON_LIBS+= libVkICD_mock_icd.so
+ELECTRON_LIBS+= libffmpeg.so
+.if ${MACHINE_ARCH} != "aarch64"
+ELECTRON_LIBS+= libvk_swiftshader.so
+ELECTRON_LIBS+= vk_swiftshader_icd.json
+.endif
+
+do-install:
+ ${INSTALL_PROGRAM} ${BUILDDIR}/electron ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+ ${LN} -s ${PREFIX}/lib/${PKGBASE}/electron ${DESTDIR}${PREFIX}/bin/${PKGBASE}
+ #${INSTALL_PROGRAM} ${BUILDDIR}/chromedriver.unstripped ${DESTDIR}${PREFIX}/lib/${PKGBASE}/chromedriver
+.for i in ${ELECTRON_LIBS}
+ ${INSTALL_LIB} ${BUILDDIR}/${i} ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+.endfor
+ ${INSTALL_LIB} ${BUILDDIR}/libvulkan.so.1 ${DESTDIR}${PREFIX}/lib/${PKGBASE}/libvulkan.so
+ ${INSTALL_DATA} ${BUILDDIR}/*.pak ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+.for i in locales resources gen/electron/buildflags gen/v8/embedded.S
+ cd ${WRKSRC}/out/${BUILDTYPE} && \
+ ${FIND} ${i} -type f -print | pax -rw -pmp ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+.endfor
+ cd ${WRKSRC}/out/${BUILDTYPE}/gen && \
+ ${FIND} node_headers -type f -print | pax -rw -pmp ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+.for f in snapshot_blob.bin v8_context_snapshot.bin LICENSE LICENSES.chromium.html version
+ ${INSTALL_DATA} ${BUILDDIR}/${f} ${DESTDIR}${PREFIX}/lib/${PKGBASE}
+.endfor
+
+BUILDLINK_DEPMETHOD.clang= build
+.include "../../lang/clang/buildlink3.mk"
+.include "../../sysutils/desktop-file-utils/desktopdb.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/electron34/PLIST b/electron34/PLIST
new file mode 100644
index 0000000000..52be0364ce
--- /dev/null
+++ b/electron34/PLIST
@@ -0,0 +1,257 @@
+@comment $NetBSD$
+bin/electron${ELECTRON_MAJOR}
+lib/electron${ELECTRON_MAJOR}/LICENSE
+lib/electron${ELECTRON_MAJOR}/LICENSES.chromium.html
+lib/electron${ELECTRON_MAJOR}/chrome_100_percent.pak
+lib/electron${ELECTRON_MAJOR}/chrome_200_percent.pak
+lib/electron${ELECTRON_MAJOR}/electron
+lib/electron${ELECTRON_MAJOR}/gen/electron/buildflags/buildflags.h
+lib/electron${ELECTRON_MAJOR}/gen/v8/embedded.S
+lib/electron${ELECTRON_MAJOR}/libEGL.so
+lib/electron${ELECTRON_MAJOR}/libGLESv2.so
+lib/electron${ELECTRON_MAJOR}/libVkICD_mock_icd.so
+lib/electron${ELECTRON_MAJOR}/libffmpeg.so
+${PLIST.swiftshader}lib/electron${ELECTRON_MAJOR}/libvk_swiftshader.so
+lib/electron${ELECTRON_MAJOR}/libvulkan.so
+lib/electron${ELECTRON_MAJOR}/locales/af.pak
+lib/electron${ELECTRON_MAJOR}/locales/af.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/am.pak
+lib/electron${ELECTRON_MAJOR}/locales/am.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ar.pak
+lib/electron${ELECTRON_MAJOR}/locales/ar.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/bg.pak
+lib/electron${ELECTRON_MAJOR}/locales/bg.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/bn.pak
+lib/electron${ELECTRON_MAJOR}/locales/bn.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ca.pak
+lib/electron${ELECTRON_MAJOR}/locales/ca.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/cs.pak
+lib/electron${ELECTRON_MAJOR}/locales/cs.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/da.pak
+lib/electron${ELECTRON_MAJOR}/locales/da.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/de.pak
+lib/electron${ELECTRON_MAJOR}/locales/de.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/el.pak
+lib/electron${ELECTRON_MAJOR}/locales/el.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/en-GB.pak
+lib/electron${ELECTRON_MAJOR}/locales/en-GB.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/en-US.pak
+lib/electron${ELECTRON_MAJOR}/locales/en-US.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/es-419.pak
+lib/electron${ELECTRON_MAJOR}/locales/es-419.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/es.pak
+lib/electron${ELECTRON_MAJOR}/locales/es.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/et.pak
+lib/electron${ELECTRON_MAJOR}/locales/et.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/fa.pak
+lib/electron${ELECTRON_MAJOR}/locales/fa.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/fi.pak
+lib/electron${ELECTRON_MAJOR}/locales/fi.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/fil.pak
+lib/electron${ELECTRON_MAJOR}/locales/fil.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/fr.pak
+lib/electron${ELECTRON_MAJOR}/locales/fr.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/gu.pak
+lib/electron${ELECTRON_MAJOR}/locales/gu.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/he.pak
+lib/electron${ELECTRON_MAJOR}/locales/he.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/hi.pak
+lib/electron${ELECTRON_MAJOR}/locales/hi.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/hr.pak
+lib/electron${ELECTRON_MAJOR}/locales/hr.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/hu.pak
+lib/electron${ELECTRON_MAJOR}/locales/hu.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/id.pak
+lib/electron${ELECTRON_MAJOR}/locales/id.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/it.pak
+lib/electron${ELECTRON_MAJOR}/locales/it.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ja.pak
+lib/electron${ELECTRON_MAJOR}/locales/ja.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/kn.pak
+lib/electron${ELECTRON_MAJOR}/locales/kn.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ko.pak
+lib/electron${ELECTRON_MAJOR}/locales/ko.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/lt.pak
+lib/electron${ELECTRON_MAJOR}/locales/lt.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/lv.pak
+lib/electron${ELECTRON_MAJOR}/locales/lv.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ml.pak
+lib/electron${ELECTRON_MAJOR}/locales/ml.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/mr.pak
+lib/electron${ELECTRON_MAJOR}/locales/mr.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ms.pak
+lib/electron${ELECTRON_MAJOR}/locales/ms.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/nb.pak
+lib/electron${ELECTRON_MAJOR}/locales/nb.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/nl.pak
+lib/electron${ELECTRON_MAJOR}/locales/nl.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/pl.pak
+lib/electron${ELECTRON_MAJOR}/locales/pl.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/pt-BR.pak
+lib/electron${ELECTRON_MAJOR}/locales/pt-BR.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/pt-PT.pak
+lib/electron${ELECTRON_MAJOR}/locales/pt-PT.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ro.pak
+lib/electron${ELECTRON_MAJOR}/locales/ro.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ru.pak
+lib/electron${ELECTRON_MAJOR}/locales/ru.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/sk.pak
+lib/electron${ELECTRON_MAJOR}/locales/sk.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/sl.pak
+lib/electron${ELECTRON_MAJOR}/locales/sl.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/sr.pak
+lib/electron${ELECTRON_MAJOR}/locales/sr.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/sv.pak
+lib/electron${ELECTRON_MAJOR}/locales/sv.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/sw.pak
+lib/electron${ELECTRON_MAJOR}/locales/sw.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ta.pak
+lib/electron${ELECTRON_MAJOR}/locales/ta.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/te.pak
+lib/electron${ELECTRON_MAJOR}/locales/te.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/th.pak
+lib/electron${ELECTRON_MAJOR}/locales/th.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/tr.pak
+lib/electron${ELECTRON_MAJOR}/locales/tr.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/uk.pak
+lib/electron${ELECTRON_MAJOR}/locales/uk.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/ur.pak
+lib/electron${ELECTRON_MAJOR}/locales/ur.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/vi.pak
+lib/electron${ELECTRON_MAJOR}/locales/vi.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/zh-CN.pak
+lib/electron${ELECTRON_MAJOR}/locales/zh-CN.pak.info
+lib/electron${ELECTRON_MAJOR}/locales/zh-TW.pak
+lib/electron${ELECTRON_MAJOR}/locales/zh-TW.pak.info
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/common.gypi
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/config.gypi
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/allocation.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/common.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/cross-thread-persistent.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/custom-space.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/default-platform.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/ephemeron-pair.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/explicit-management.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/garbage-collected.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/heap-consistency.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/heap-handle.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/heap-state.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/heap-statistics.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/heap.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/api-constants.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/atomic-entry-flag.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/base-page-handle.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/caged-heap-local-data.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/caged-heap.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/compiler-specific.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/finalizer-trait.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/gc-info.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/logging.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/member-storage.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/name-trait.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/persistent-node.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/pointer-policies.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/internal/write-barrier.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/liveness-broker.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/macros.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/member.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/name-provider.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/object-size-trait.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/persistent.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/platform.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/prefinalizer.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/process-heap-statistics.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/sentinel-pointer.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/source-location.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/testing.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/trace-trait.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/type-traits.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/cppgc/visitor.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/js_native_api.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/js_native_api_types.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/libplatform/libplatform-export.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/libplatform/libplatform.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/libplatform/v8-tracing.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node_api.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node_api_types.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node_buffer.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node_object_wrap.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/node_version.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/aix.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/bsd.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/darwin.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/errno.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/linux.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/os390.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/posix.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/sunos.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/threadpool.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/tree.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/unix.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/version.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/uv/win.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-array-buffer.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-callbacks.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-container.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-context.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-cppgc.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-data.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-date.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-debug.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-embedder-heap.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-embedder-state-scope.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-exception.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-extension.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-external.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-forward.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-function-callback.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-function.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-handle-base.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-initialization.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-internal.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-isolate.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-json.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-local-handle.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-locker.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-maybe.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-memory-span.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-message.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-microtask-queue.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-microtask.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-object.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-persistent-handle.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-platform.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-primitive-object.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-primitive.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-profiler.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-promise.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-proxy.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-regexp.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-sandbox.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-script.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-snapshot.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-source-location.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-statistics.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-template.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-traced-handle.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-typed-array.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-unwinder.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-value-serializer.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-value.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-version.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-wasm.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8-weak-callback-info.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/v8config.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/zconf.h
+lib/electron${ELECTRON_MAJOR}/node_headers/include/node/zlib.h
+lib/electron${ELECTRON_MAJOR}/resources.pak
+lib/electron${ELECTRON_MAJOR}/resources/default_app.asar
+lib/electron${ELECTRON_MAJOR}/resources/inspector_overlay/inspector_overlay_resources.grd
+lib/electron${ELECTRON_MAJOR}/resources/inspector_overlay/main.js
+lib/electron${ELECTRON_MAJOR}/snapshot_blob.bin
+lib/electron${ELECTRON_MAJOR}/v8_context_snapshot.bin
+lib/electron${ELECTRON_MAJOR}/version
+${PLIST.swiftshader}lib/electron${ELECTRON_MAJOR}/vk_swiftshader_icd.json
diff --git a/electron34/TODO b/electron34/TODO
new file mode 100644
index 0000000000..abac1ea10f
--- /dev/null
+++ b/electron34/TODO
@@ -0,0 +1,4 @@
+To Do:
+
+0) Built on NetBSD-10 amd64
+1) Successful building and packaging, not tested yet
diff --git a/electron34/distinfo b/electron34/distinfo
new file mode 100644
index 0000000000..b69c6b513f
--- /dev/null
+++ b/electron34/distinfo
@@ -0,0 +1,2334 @@
+$NetBSD$
+
+BLAKE2s (EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d.tar.gz) = 7d5feed48130ce5af89388957b252ff1d20eb0e94097d06a7de9cc206315a146
+SHA512 (EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d.tar.gz) = f01a5718c33196ffbb0089c16a7729360533be8953643879a4af9fde08bcea9acc6bc65c249875c708277564ad4f5b1b488f3ad333d299a6c69db6aff84de220
+Size (EngFlow-reclient-configs-955335c30a752e9ef7bff375baab5e0819b6c00d.tar.gz) = 13014 bytes
+BLAKE2s (Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948.tar.gz) = 38661b8c2529baff3d2ea0187e2f0afa444c33a147c0e1e01236f6fddeafdfee
+SHA512 (Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948.tar.gz) = 4e794c36fb5298f3207f18ba4dfb1b5f6149fa54c911c2e0215cfb6394c357eb8099bfc0663ce445a8527b06cefeb544f7e4aff759ae9cb194d51ff1bd5eb5c2
+Size (Mantle-Mantle-78d3966b3c331292ea29ec38661b25df0a245948.tar.gz) = 62962 bytes
+BLAKE2s (ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76.tar.gz) = 86a1c3a076e90f554e3d233086d6767e1d5ecf72dfe56dcb70c8405f28c6a44c
+SHA512 (ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76.tar.gz) = 66b114e2911555f32376fde8e11123d43d05e78574f0f955056e8de2fc7c24b520e1d39768820ed6f8e65021d7ab3e535892d377c805d8356783bc80ad0a8306
+Size (ReactiveCocoa-ReactiveObjC-74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76.tar.gz) = 1136238 bytes
+BLAKE2s (Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38.tar.gz) = f21ab409e850495114685cbbb6a824c90db1293f04d2fe650b8274d9fd8081cf
+SHA512 (Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38.tar.gz) = d266aa162ae4db22e84d2197b0b95ed90332fbb8cf9d21ba33c2992b41f6806e2510da9abef9a22df45bbc49720c38ce65e4aebea6603e63d431bb137efce3b1
+Size (Squirrel-Squirrel.Mac-0e5d146ba13101a1302d59ea6e6e0b3cace4ae38.tar.gz) = 2112918 bytes
+BLAKE2s (chromium-132.0.6834.210.tar.xz.0) = a1efd3e477600c85514a4a5d8bd0972bec3e2ccb6641adb325b97c1823289e9c
+SHA512 (chromium-132.0.6834.210.tar.xz.0) = fb4aa6c90a3d2fc659cae9d0a236c23e854857154b90fc1854f264166b408538b968319510c133071daa507cfdfe466fa13c9026598d4ae9fa4751e1031c707b
+Size (chromium-132.0.6834.210.tar.xz.0) = 2000000000 bytes
+BLAKE2s (chromium-132.0.6834.210.tar.xz.1) = 9648cb691cc1356050d5ee3ae38116a5fa49887f87172f172f1022bf663490a1
+SHA512 (chromium-132.0.6834.210.tar.xz.1) = f48396619f053551936440a907d0ec4f953e8f635f049ec684855274d5211c9ca4108c3d24918a711ce18dabf41329e51ca2439678a07de651056bdcbf559e46
+Size (chromium-132.0.6834.210.tar.xz.1) = 2000000000 bytes
+BLAKE2s (chromium-132.0.6834.210.tar.xz.2) = 60709f08a70b2110860a84a044d48efe6d482c304e63a0e20ed3372dfd0b2772
+SHA512 (chromium-132.0.6834.210.tar.xz.2) = 7d2dea762449e6b463e4048a47ae3f75485a9c813abf2cfe64451531a144e292c0b0024505e1e1d50db794c9aee9ec0d14e29d4bb102f8da9f5baa9760641564
+Size (chromium-132.0.6834.210.tar.xz.2) = 484148560 bytes
+BLAKE2s (electron34-34.5.6.tar.gz) = e7508fc0c309ba93fd023c4c097194aa6ce59beeb22213882f0d05341a42faeb
+SHA512 (electron34-34.5.6.tar.gz) = edbcc6d913822e9eff005af2660a2771e5d7d0a7cac142d6f6a2b52cc90518f6e9ba27a839b71899e07dc4e548bc511fa0025272c17a9943cf64d4bc822141e9
+Size (electron34-34.5.6.tar.gz) = 14851352 bytes
+BLAKE2s (electron34-node_modules-34.5.6.tar.gz) = d4cab0c31207d1bdcf64c65a6b468736488e6fd33a40ef4ecb31dda85529e07c
+SHA512 (electron34-node_modules-34.5.6.tar.gz) = d8f13ecc724f0931db794a186ddedac70c7b82b7cb282a6808789c95b973a3e7cc1d9641375cc20c975cac2bb4806f81f9ad46575dbf446d973ef74487cccd48
+Size (electron34-node_modules-34.5.6.tar.gz) = 29053725 bytes
+BLAKE2s (kikadf-chromium-audioio-v130.0.tar.gz) = 45fe07cb8280f81b8ef490059002da426b59fe69b5ebd53951fe1dc3e9495a10
+SHA512 (kikadf-chromium-audioio-v130.0.tar.gz) = 840aed119dc69982f14fd5f4767e144bfc8a66672b660f0f05f5459070d7f6a36b8719ae7c0de049f7345dec39266759aedcdd5ee37aa4e98bcd2b44d06a3a4c
+Size (kikadf-chromium-audioio-v130.0.tar.gz) = 7824 bytes
+BLAKE2s (nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213.tar.gz) = d8ac65b41212f092825b65c991b3c128766dbcda616bac78d8425fbccf098632
+SHA512 (nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213.tar.gz) = cb974a76e6323da6a37cda7f44385fe7a53b5f3358bf813ba5454094d00674c05183117c5a5806f5493a20bafb6195326bc820462812613ca8089fea50b85307
+Size (nodejs-nan-e14bdcd1f72d62bca1d541b66da43130384ec213.tar.gz) = 180646 bytes
+BLAKE2s (nodejs-node-v20.19.1.tar.gz) = d6f2b2cedc045b3e5ff9b85a2335fb816534692072ee7a9d122f66a3c0515ea4
+SHA512 (nodejs-node-v20.19.1.tar.gz) = d249c1e27873f17fc67ffaecb74f843176898397bc9a7afc0f729b79a675fba02f8babd68919c2ad6c55b47c1a46b6510016cb94c322f53ed124a3fca30c8684
+Size (nodejs-node-v20.19.1.tar.gz) = 116091586 bytes
+SHA1 (patch-.gitignore) = dc54ba97160fd82b44a92cd2e96e0a4d250ab221
+SHA1 (patch-.gn) = 9a43d978ff1a3869621fe38a6591d66e0a6cb30d
+SHA1 (patch-AUTHORS) = c30db84de3e0fa7095237cbd6e5a272146e7bdba
+SHA1 (patch-BUILD.gn) = 61715c24b11e871288435c0b8973e1bc1af93120
+SHA1 (patch-apps_ui_views_app__window__frame__view.cc) = 8b16819a1401cdef12afafe81bdafa2263957e56
+SHA1 (patch-ash_display_mirror__window__controller.cc) = 8a10fea0366005bcbb0ca54ff11f0898fa480f80
+SHA1 (patch-base_BUILD.gn) = 775323488f23957102a238b929d430ee4b9d68f9
+SHA1 (patch-base_allocator_dispatcher_tls.h) = a25a00aab69f0fd21c62a041589722a8ce2bb235
+SHA1 (patch-base_allocator_partition__allocator_partition__alloc.gni) = 105445f894c5ae092edbaa6294f7d5626ab899d5
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn) = 7286c6bb03b2d07ac260569e9b7e00573f8ff734
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h) = 86a078403c55013005dab505d80648d2c54eef06
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h) = 32d16e33989ec524e562ea0b52cf730054382509
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h) = 0476eb0733fa95f96dfc2181e20a02c919b9253d
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc) = 65b595bfb6b9b019d9e1014af1375b1657496a70
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h) = 367fb4cc9a4df9222e735961f70cfab67445116b
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc) = 70023b4f9c9192b0c32d57cd59e4d53ca96e35f0
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc) = f37da1788aa5bd1632515c23871339e3d3a9b3cb
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc) = 8ec1117633494b0dddd41b6ae5ee967df70f1af4
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h) = 993e08cbbd09713fcb0e0c7068eb3a21e7e65a64
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h) = c7dfe309971f0943e12974fe3231e902b542905d
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc) = c80a1d6675a8406af2f8109b03d27b44c8a87e70
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h) = 043d57b95737d7cf822d9dfc7b3513048c5efea1
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h) = 7bcb76e9a5be2a40a117e1d7d7125dea61eaf541
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h) = da9b06596455937c7ab07ca3436917470788ef74
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc) = 07bea58f1bbb49f281b4e2e3ff8aaae71b746ce3
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc) = 44859fe77935049feab38909f504956dd8fe4073
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc) = 0d31af3fb5e8d47c796b7addb67459eaabe7c395
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc) = 012e9c6330d487609d3449536675d54b60c13df6
+SHA1 (patch-base_atomicops.h) = db1344de1d0533dc207e1cb1fafe53267b95f3db
+SHA1 (patch-base_base__paths__posix.cc) = 517081553247573c756e8be24954225453db2a0e
+SHA1 (patch-base_compiler__specific.h) = a98204baf71b2c407a8a74fd1458c7802a707a7c
+SHA1 (patch-base_debug_debugger__posix.cc) = a2bd34101d98ad5733bb323866b9376bc8d2cf8e
+SHA1 (patch-base_debug_elf__reader.cc) = 956c83b46ecf7c5604f109a2978ccf1013d7b75c
+SHA1 (patch-base_debug_proc__maps__linux.cc) = f126005afadadf5e601737edc10976f5a1852a94
+SHA1 (patch-base_debug_stack__trace.cc) = 324173a2f70a6125640376aa049abfa1f6aebc89
+SHA1 (patch-base_debug_stack__trace__posix.cc) = c879e6cd7de65aa47e6071250ef75bdf7b2e2062
+SHA1 (patch-base_enterprise__util__mac.mm) = 6f3aefcc39e017eb722d2cb0d628f0198912bc7b
+SHA1 (patch-base_files_dir__reader__linux.h) = 8bc12b668dc060a3cf76d426ef3b6753861e7d36
+SHA1 (patch-base_files_dir__reader__posix.h) = a155a0e866d2a1a2f8ae787386fb52d3dae44eea
+SHA1 (patch-base_files_drive__info.h) = 56d8f120f9bcf1139fe7f7fcee7e9b694a158c93
+SHA1 (patch-base_files_drive__info__posix.cc) = a8b8bb58ea9c89d608cb42816125173f2da74b79
+SHA1 (patch-base_files_file__path__watcher.h) = 8f30fec584cddc4cd88964822110931edfb3216d
+SHA1 (patch-base_files_file__path__watcher__bsd.cc) = e29622d7c2e0c17ce3b27e23d1f21b7e8f4badb9
+SHA1 (patch-base_files_file__path__watcher__kqueue.cc) = 22b6069e09593a6cf6c7d1f6b2ce6910bfb34755
+SHA1 (patch-base_files_file__path__watcher__kqueue.h) = de643bfc348b3c25ef74f1d4a1dd20363760a8f6
+SHA1 (patch-base_files_file__path__watcher__unittest.cc) = 1d4f3739f6eedb1d0cc2c94e711bf30b5725fb59
+SHA1 (patch-base_files_file__util__posix.cc) = b459d15c53a53e500b4ec6925d078585e1107b50
+SHA1 (patch-base_files_file__util__unittest.cc) = d50dcfb7e127c4abccd3e8a4de23c0ebbe609941
+SHA1 (patch-base_files_important__file__writer__cleaner.cc) = 184cc3c425e2f7284bec7fab31e486e507bb8720
+SHA1 (patch-base_files_scoped__file.cc) = 3dff9d4e9a6943ea27a83563a949ed82c763ee0a
+SHA1 (patch-base_functional_callback__helpers.h) = 3884a8e9de1ccea34e4cd347c138397795874e3b
+SHA1 (patch-base_functional_unretained__traits.h) = c565b3f9f6f154e4fc002ec58c67e0ae61949554
+SHA1 (patch-base_i18n_icu__util.cc) = 31d0f49934c2368ec80cb8fd699b07cd5246b992
+SHA1 (patch-base_linux__util.cc) = 87b7d8adab988df2dcf167034c793c36ffe2dfc5
+SHA1 (patch-base_logging__unittest.cc) = dc66d56d1c3f0ff639d443c85a6697b83a445cb0
+SHA1 (patch-base_memory_discardable__memory.cc) = 447bd9e317a7f2b2c04bcbc5459eddb47d2a7979
+SHA1 (patch-base_memory_discardable__memory__internal.h) = 005933f480d713a0291e0031e912d77f2c2328ee
+SHA1 (patch-base_memory_madv__free__discardable__memory__posix.cc) = 211e8d24333b8b524a3a105c09c4349481ea390d
+SHA1 (patch-base_memory_platform__shared__memory__region.h) = 4c46586cdf60ad4eb9ad58ccfcac3236fecde7f3
+SHA1 (patch-base_memory_platform__shared__memory__region__posix.cc) = 5db7736f81952287fc8270fac75218a5c505af93
+SHA1 (patch-base_memory_protected__memory.h) = deaa8d83aa5805b4e401eea03b489e51b6cef04b
+SHA1 (patch-base_memory_protected__memory__posix.cc) = f83b294922efe959acac8d24120ab91b53d84921
+SHA1 (patch-base_message__loop_message__pump__epoll.cc) = 1e2e41fff983ba8bd27773076287f68e8fcfc3ff
+SHA1 (patch-base_message__loop_message__pump__epoll.h) = 7eae71a6251f051b3545a72c54b0ea472718fe3b
+SHA1 (patch-base_message__loop_message__pump__glib.cc) = cc487be80ac83ea5124daa4d89ae14f7fa12154a
+SHA1 (patch-base_native__library__posix.cc) = c3da2d31c039011445adbb1ea2aeec27a53a981d
+SHA1 (patch-base_native__library__unittest.cc) = 9125945d68f7b3c85ee96db0795dd93b4345fae6
+SHA1 (patch-base_posix_can__lower__nice__to.cc) = 8f3f1a29431643f67143ce9624b6d83183077e00
+SHA1 (patch-base_posix_file__descriptor__shuffle.h) = 793d256a1b7e5a956bb6acc6c2fc8f2d9a147c8d
+SHA1 (patch-base_posix_sysctl.cc) = a45c0a60bed3e6d121547292c65180cdad5075a4
+SHA1 (patch-base_posix_unix__domain__socket.cc) = 9ea9d89139b118afddd9a252dae1d896e177479a
+SHA1 (patch-base_posix_unix__domain__socket__unittest.cc) = af108e31004cb068ec34d0d230c8bc92ee192be4
+SHA1 (patch-base_process_internal__linux.h) = f37a47c3b3adb9fb12f0da1efcd65b485a9dba24
+SHA1 (patch-base_process_kill.h) = aefaf3534869d0a7ce004d15b1663a4b2a846f5e
+SHA1 (patch-base_process_kill__posix.cc) = 8cd79083740ed286ad3bd8422027f174b8d4ec4b
+SHA1 (patch-base_process_launch.h) = 3e5053c035f553fc41a9ae4dcc38db800d922112
+SHA1 (patch-base_process_launch__mac.cc) = ba0e408bdb45024614d1f20a490e1a8b41300057
+SHA1 (patch-base_process_launch__posix.cc) = 5ba8b5249cd813bd16c4ebe9bbc58a16131394b3
+SHA1 (patch-base_process_memory__linux.cc) = deb36a0affe959860ae6098131b6d14026986cc1
+SHA1 (patch-base_process_process__handle.cc) = abca9a9acbca7a37996b5e2241bc75343e69bb14
+SHA1 (patch-base_process_process__handle.h) = 14e1282d568e05f113a7cad6949d720b496b91dc
+SHA1 (patch-base_process_process__handle__freebsd.cc) = 45c02dde0f1607de13b18bf05872d172a698a3c3
+SHA1 (patch-base_process_process__handle__netbsd.cc) = 40ca016788b684844669576e6adf4e3b4059ca4d
+SHA1 (patch-base_process_process__handle__openbsd.cc) = d6650e290fe5a3c2410ac7776bd712a650f0bd20
+SHA1 (patch-base_process_process__info__mac.cc) = ee7d68b0f230d317c1fe33a79d21b5d61a554929
+SHA1 (patch-base_process_process__iterator.h) = 4d5aefbd8a54915ebcf1571cc5d0010bdc6ab14d
+SHA1 (patch-base_process_process__iterator__freebsd.cc) = d1dee0122505e06a26cbe07ca62bed0b35ae3fc8
+SHA1 (patch-base_process_process__iterator__netbsd.cc) = 13b7ceb3408872528c21cb336472e4c0e209d4f5
+SHA1 (patch-base_process_process__iterator__openbsd.cc) = fb2a2b37afc05dde42d462e1b40d22a07a6e2ecb
+SHA1 (patch-base_process_process__metrics.cc) = 31798ffeae86a3516ba7d7ae944400062b4a6917
+SHA1 (patch-base_process_process__metrics.h) = 640a383be25f1234e18d7ad106dc31666b60e2b5
+SHA1 (patch-base_process_process__metrics__freebsd.cc) = fd3d2418d1e9d74e9bcb4c0ffa7b32eba880c3ca
+SHA1 (patch-base_process_process__metrics__netbsd.cc) = b33ecbf00f9d4b00666765ccb83b20bbb37884b8
+SHA1 (patch-base_process_process__metrics__openbsd.cc) = ea95cbf40e8e5fbf8294b8919ab363359662e8fa
+SHA1 (patch-base_process_process__metrics__posix.cc) = 4448e053fc6249dbf25b8b187d33d1f5e5be80a3
+SHA1 (patch-base_process_process__metrics__unittest.cc) = 85dc0e736c7887ac9543c98b1233d55baebc58d3
+SHA1 (patch-base_process_process__posix.cc) = 176e9dbdee23ba54dc4e326d814273c37c9fa429
+SHA1 (patch-base_process_process__unittest.cc) = e8931b58e34cb5ed01f2538ef0d0bc0de170dcf1
+SHA1 (patch-base_profiler_module__cache.cc) = 63518cdb1e1e3f742788b047ef21d7ff53fd8619
+SHA1 (patch-base_profiler_sampling__profiler__thread__token.cc) = d7a7864495e911f190745fa439e6bd7151b54b19
+SHA1 (patch-base_profiler_sampling__profiler__thread__token.h) = 7e70ab588c053dff902600f99c5976179f82038f
+SHA1 (patch-base_profiler_stack__base__address__posix.cc) = f6572417a61f54ec3b7a38e4daf61c8da52d21d6
+SHA1 (patch-base_profiler_stack__sampling__profiler__test__util.cc) = bbb7e1efbbc894aa66a1dcc047e75771ca8fc6ea
+SHA1 (patch-base_profiler_stack__sampling__profiler__unittest.cc) = 1030178ca089e23bb9b9630492ac17dc890d5ebe
+SHA1 (patch-base_profiler_thread__delegate__posix.cc) = ac47b42c1237b9b8857fbbf3d3274ecc7550943d
+SHA1 (patch-base_rand__util.h) = a1c53d7c88b8541f114d1e4b4aa35f009f49a485
+SHA1 (patch-base_rand__util__posix.cc) = 5cc819f699700469f5428531599388daf6716445
+SHA1 (patch-base_strings_safe__sprintf__unittest.cc) = ac2425ecc882a15f113a91fb7ab81f915783fe6f
+SHA1 (patch-base_synchronization_lock__impl.h) = de998bbf2cbd07b952079175ffe8ecf223fd3369
+SHA1 (patch-base_syslog__logging.cc) = 9c47a134104cb44d793ad04fb909143a5c2ac6e0
+SHA1 (patch-base_system_sys__info.cc) = cfc69ecde8d6e104e977f18d2dcec6c6e728dce5
+SHA1 (patch-base_system_sys__info.h) = 5bf5e73acfe7b90a1dac32cc4774db9468c8dfab
+SHA1 (patch-base_system_sys__info__freebsd.cc) = afe9bd126c248d5741f53da34998609d8ba143d2
+SHA1 (patch-base_system_sys__info__netbsd.cc) = 37eb3bd10c4bb34d4b1d6fad63d7cafd7f434c97
+SHA1 (patch-base_system_sys__info__openbsd.cc) = 002f118f19ea477ade539bdfc5e17882216af8b2
+SHA1 (patch-base_system_sys__info__posix.cc) = ba57936a0795c444019f734366b1c191a54cc698
+SHA1 (patch-base_system_sys__info__unittest.cc) = 3e89dc966667df5c642f5359d68456209465d197
+SHA1 (patch-base_task_thread__pool_environment__config__unittest.cc) = 88fb96e1aedbb699258c76527b7cb41af73ecbce
+SHA1 (patch-base_test_launcher_test__launcher.cc) = 3ff3791cd6b3b59912fbc3f37e646c6f6436348c
+SHA1 (patch-base_test_test__file__util__linux.cc) = 11efbe550aa959989d05b60879cd6cdab08f52d3
+SHA1 (patch-base_test_test__file__util__posix.cc) = 596db1c98a75f785f53925c4d2edd0f4314eaa79
+SHA1 (patch-base_threading_platform__thread.h) = 89f163708d10716aef2da3bf5890e5e8ad86c34b
+SHA1 (patch-base_threading_platform__thread__bsd.cc) = 19139398f044a301d07d9a7cd34e51bcf0e732b3
+SHA1 (patch-base_threading_platform__thread__internal__posix.cc) = 54a9e0bbf06e73850d670173c80faf47beb520e4
+SHA1 (patch-base_threading_platform__thread__posix.cc) = 2f633876be55c639b775e04aa4389b8c89c93cd2
+SHA1 (patch-base_threading_platform__thread__unittest.cc) = 3a2cea4f3543a5464f12a0b99a468b1b92950100
+SHA1 (patch-base_threading_thread__restrictions.h) = 813d113a3a2267709f2d2961535e34baa06cdb64
+SHA1 (patch-base_time_time__now__posix.cc) = 62c279c6061a02422a28372ce1b2ba83c2dbab9d
+SHA1 (patch-base_trace__event_builtin__categories.h) = b3d42ce9e0ad3ab945d1f6fea58ee20641641165
+SHA1 (patch-base_trace__event_malloc__dump__provider.cc) = 62a9616b283231991a4e396b119e6b4eddef5a68
+SHA1 (patch-base_trace__event_memory__dump__manager.cc) = b68fd5c2b3f10fefd455da13142db10dd6ff3b26
+SHA1 (patch-base_trace__event_process__memory__dump.cc) = 09f67023c14da4206bf748c855f21c7f22f98314
+SHA1 (patch-base_tracing_trace__time.cc) = e0f533261e4edbf7891e8cdbc91952638ee7eace
+SHA1 (patch-base_tracing_trace__time.h) = f0e8b96d9d9bfb8412203408d0ac035ba094405a
+SHA1 (patch-base_version__info_version__info.h) = d8da5cef2c582c6c0cd83c18e8a5c14323a27088
+SHA1 (patch-base_win_shortcut.cc) = a8933ac4ee568b3a53c7ac699f05e21a389fc5f1
+SHA1 (patch-base_win_win__util.h) = 05cbc4c257550a701d1c122f915cd20a9367acc9
+SHA1 (patch-base_win_win__util__unittest.cc) = efcb7d97043b56d33575083d904442acc946ab7c
+SHA1 (patch-build_config_BUILD.gn) = 6e95edf1a3532940f2843299d22813047c0c627a
+SHA1 (patch-build_config_BUILDCONFIG.gn) = d45b63b4f5a0c1c1fc82cc160ffadc8143c06c93
+SHA1 (patch-build_config_clang_BUILD.gn) = e2f7957faf672bb2bde27b795f8d52f02f41491e
+SHA1 (patch-build_config_compiler_BUILD.gn) = faa82656c7c1d006b4c62c935e52e498e084a94e
+SHA1 (patch-build_config_gcc_BUILD.gn) = 11b26b801b3fc4dc3f368699be4db1406452ac9c
+SHA1 (patch-build_config_linux_BUILD.gn) = 1d65157ef6996e7b41ee29025b122d227481a3c6
+SHA1 (patch-build_config_linux_atk_BUILD.gn) = fafb5bb9274f56f5bc5b4d1a7c73bd31cff04d3e
+SHA1 (patch-build_config_linux_atspi2_BUILD.gn) = 948659d6b417e4cfec4adc75aec638927a36963f
+SHA1 (patch-build_config_linux_gtk_BUILD.gn) = 273b0b5bd6e331c30b6c3677ed9d325b1b033585
+SHA1 (patch-build_config_linux_libdrm_BUILD.gn) = 7cdfef6ecb41cfa3083c54dd978d4427f79882b3
+SHA1 (patch-build_config_linux_pkg-config.py) = 468d5dfab44ae88464f84a44e150f3fc62d05cfa
+SHA1 (patch-build_config_ozone.gni) = da364dceec18b9bed117de57de52156aaf71cf1a
+SHA1 (patch-build_config_rust.gni) = 5698a4c86f1b0943979b57a2cf927bc1e91e0065
+SHA1 (patch-build_config_v8__target__cpu.gni) = 32bc08af39e185f133a33b25c70df14cb5277e30
+SHA1 (patch-build_detect__host__arch.py) = 0013a46f9eadd2418e4a748bb396c6490f2b4dcf
+SHA1 (patch-build_gn__run__binary.py) = f15e9aa8f9194dd5c24c1184f7b7c7d5ab0b690f
+SHA1 (patch-build_linux_chrome.map) = eeda0b2ff592f0cda493e5f9b778feac034de7f3
+SHA1 (patch-build_linux_strip__binary.py) = 391c82c9cfb6b5e5d0bee6919a1b458f2c3b0c8e
+SHA1 (patch-build_linux_unbundle_icu.gn) = 9d119d988917727133874d68a8a919c182b0183a
+SHA1 (patch-build_linux_unbundle_libevent.gn) = 1eee1dd923aef01e609a631c8c050ea0f6981b3f
+SHA1 (patch-build_linux_unbundle_libusb.gn) = 17125e42a5affff7ae4f2d41f2bbd9a6e026b2f3
+SHA1 (patch-build_rust_allocator_BUILD.gn) = cc036a874ea1499d11b25e7846ecdb322097364b
+SHA1 (patch-build_rust_allocator_DEPS) = 049dbe9b830807da1b299c5f6e2f2779656530a2
+SHA1 (patch-build_rust_allocator_alias.cc) = 9fd99a7ef64250e8a8024324ac1ccc8e0de0d9b7
+SHA1 (patch-build_rust_allocator_alias.h) = b83cd7c441a4266ad7a6207ea62c75f8de13608d
+SHA1 (patch-build_rust_allocator_alloc__error__handler__impl.cc) = bb11a86bc5cc33a85facba5105a60161fc71b118
+SHA1 (patch-build_rust_allocator_alloc__error__handler__impl.h) = 865edd4a95fa75ff1e16e919815a5cddf4f2d8b6
+SHA1 (patch-build_rust_allocator_allocator__impls.cc) = 3ea4ccac0a38b6759e04531f9558e738cb2574f2
+SHA1 (patch-build_rust_allocator_allocator__impls.h) = 4929a95457dde2c4a5b030666f2e2845493ef53a
+SHA1 (patch-build_rust_allocator_allocator__impls__ffi.rs) = 36687ad05a7abe708a02ff071d7ed7b3b8749c81
+SHA1 (patch-build_rust_allocator_compiler__specific.h) = aeaa054a3f908a3643496d8f48fa7bb79e5907b6
+SHA1 (patch-build_rust_allocator_immediate__crash.h) = 1004fb44409f13921b5f48ef8d8a3c688809d039
+SHA1 (patch-build_rust_allocator_lib.rs) = aeb32c1a5b5098f92ade36ef1e09827862ee1d33
+SHA1 (patch-build_rust_cargo__crate.gni) = 242a2519ce2d43f85c9c92d1eb51148d42d12b56
+SHA1 (patch-build_rust_rust__bindgen.gni) = d2c28a6b9a070533b5b4e1ee016227e6d969a9a0
+SHA1 (patch-build_rust_rust__bindgen__generator.gni) = 842cd60272b94c8abc61467b7757af5a3b51a824
+SHA1 (patch-build_rust_rust__macro.gni) = f25f293a139e748d58ba070745a37cccaee19ea2
+SHA1 (patch-build_rust_rust__target.gni) = 0a816f0f6f01f9603f4260b6f0795cf06894fd27
+SHA1 (patch-build_rust_std_BUILD.gn) = 4af44742036179c3c616f9fd17697515f847e6a8
+SHA1 (patch-build_toolchain_freebsd_BUILD.gn) = fe2f0a514c2d757608f01005eecd7f171549baaa
+SHA1 (patch-build_toolchain_gcc__solink__wrapper.py) = 19b27ec42aab84d394519bf1264ea4aad0f2fdb4
+SHA1 (patch-build_toolchain_gcc__toolchain.gni) = 16e34c306a2b0dd2e0b5f458e665ec63ff456f39
+SHA1 (patch-build_toolchain_netbsd_BUILD.gn) = ecbe23e304b1f8746c3e5e680bf763df16815cca
+SHA1 (patch-build_toolchain_openbsd_BUILD.gn) = 09d4f1f9620332c4430e53a8edcd05729c2fbf1e
+SHA1 (patch-build_toolchain_toolchain.gni) = 2153f5e53532cc0cf052da60386cc4f653a5f597
+SHA1 (patch-build_toolchain_win_rc_rc.py) = 8e52d438d933e40637d99e14c53f7b89694b078b
+SHA1 (patch-buildtools_reclient__cfgs_.gitignore) = 67a78c244a8d10fe403f5069e503f20d75864d84
+SHA1 (patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py) = 6b13af90af17271d0f887e7f739bf56335646af3
+SHA1 (patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg) = 8be1730c31260ea2cb5b7cfde3894a4b92dad026
+SHA1 (patch-buildtools_third__party_libc++_BUILD.gn) = f95a2364ccf69d20037d150dfcdb7deb36f47b2f
+SHA1 (patch-buildtools_third__party_libc++_____config__site) = 736a27823af5d6ff5da6d65bfb44085b258e92b3
+SHA1 (patch-buildtools_third__party_libc++abi_BUILD.gn) = ce735ed2d8ac331a3dcef03dd42420b5ab1990c4
+SHA1 (patch-cc_base_features.cc) = 766144e8e4dd41fdec133b51ab00ad2aa93a0181
+SHA1 (patch-chrome_BUILD.gn) = 42a902f5579fc29a89b4fe2b75aee2dfbb9324ad
+SHA1 (patch-chrome_app_chrome__command__ids.h) = 004558bff0985d74a1bba806807731e4643444a0
+SHA1 (patch-chrome_app_chrome__main.cc) = b055c2168815e95cc85fd95a7c1cc1c80e0fe592
+SHA1 (patch-chrome_app_chrome__main__delegate.cc) = ca51f98c8c421edfa73614ffba8841594cb2d53e
+SHA1 (patch-chrome_browser_BUILD.gn) = f6ccba1d9b68a2924215c8ea3e1f455f8aa3ebe4
+SHA1 (patch-chrome_browser_about__flags.cc) = 06fb402b30ef4ff3d3f0bc0067ca3b61a6e86d19
+SHA1 (patch-chrome_browser_accessibility_page__colors.cc) = c408e9def36c714319688a85ca96c97e5c132029
+SHA1 (patch-chrome_browser_after__startup__task__utils.cc) = fd7125ef0f611987097849f7f2a544f3c237e82e
+SHA1 (patch-chrome_browser_apps_app__service_publishers_extension__apps.cc) = 3a6ab94fec76cf22245cfb2e337aeb323eba4181
+SHA1 (patch-chrome_browser_apps_platform__apps_platform__app__launch.cc) = 4a5784a0abeb91e47637c0a936ba23d331de1c15
+SHA1 (patch-chrome_browser_apps_platform__apps_platform__app__launch.h) = 9ed9cec3d9696371b9e37cd45b2b6c0e42b77d60
+SHA1 (patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc) = e78a4ec7cd68b431982ce0b941a7f275125ca860
+SHA1 (patch-chrome_browser_background_background__mode__manager.cc) = 1ff45daeb3ee1251accd3751b6e8bd6b173f3448
+SHA1 (patch-chrome_browser_background_background__mode__optimizer.cc) = c6739fdce2aeadc849c529193cb1d9e468325f02
+SHA1 (patch-chrome_browser_browser__features.cc) = 29c8946833b65644c15d8f9b9022545558418f0e
+SHA1 (patch-chrome_browser_browser__features.h) = 6a8c2bf51216b9218399f4e9e551ce5f8273e0f6
+SHA1 (patch-chrome_browser_browser__process__impl.cc) = d8a7b44fac454b5af8e27517e7d3d4b7a7102edc
+SHA1 (patch-chrome_browser_browser__process__impl.h) = ae1a27a896d88db6d244174dc0885d49a5c94c0c
+SHA1 (patch-chrome_browser_chrome__browser__field__trials.cc) = c2cfc1c7d4b6666e0cae768632b16d644e1328b2
+SHA1 (patch-chrome_browser_chrome__browser__field__trials.h) = a994961bb3659e7d846526a5c72c5d8696262c25
+SHA1 (patch-chrome_browser_chrome__browser__interface__binders.cc) = 8e7c75f935d1e843217f4f5831d924309e2d5e14
+SHA1 (patch-chrome_browser_chrome__browser__main.cc) = a8aea3e9c0610500be49a3c28632e36d7fc85c94
+SHA1 (patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc) = fb3c618ef59a2a75b8b587797af3e49c1210386d
+SHA1 (patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc) = 0980f6410a454c3b77856ad49fb0af69f5962c2e
+SHA1 (patch-chrome_browser_chrome__browser__main__linux.cc) = e7878cf567abefe85cb78002cfbb3312ae8ca390
+SHA1 (patch-chrome_browser_chrome__browser__main__linux.h) = 1b937e2e55356b43fee10f093fa3e70871eaa759
+SHA1 (patch-chrome_browser_chrome__browser__main__posix.cc) = 4678fe0196fb0ea2af78c435b6ce786aa5565ebb
+SHA1 (patch-chrome_browser_chrome__content__browser__client.cc) = a43deae631e19acc2baca23520c7b440ec7660a5
+SHA1 (patch-chrome_browser_chrome__content__browser__client.h) = ad313c696d0a8420c9f5b5c51ab25ef6dac8ba58
+SHA1 (patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc) = e167ee4846043f016915422a06bb0d7c9a3d6234
+SHA1 (patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc) = dd25d90cab14c9fc605a617053677331b4666670
+SHA1 (patch-chrome_browser_defaults.cc) = 27fe6fb428957740b827335cfab7fca126c04545
+SHA1 (patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc) = b663018976391b8320a3b91d9093b2daa0edaac4
+SHA1 (patch-chrome_browser_diagnostics_diagnostics__writer.h) = ff71fd8acc8ad5f3218fa9f76eb3d9984dd47943
+SHA1 (patch-chrome_browser_download_chrome__download__manager__delegate.cc) = f7ec263f63748612a5deff66eae4020704f518e2
+SHA1 (patch-chrome_browser_download_download__commands.cc) = a6c0968947288c8ab40ea18845afca1357b65ce9
+SHA1 (patch-chrome_browser_download_download__commands.h) = b770a5f19af17a30caec8ebbf0c310d57484d3e4
+SHA1 (patch-chrome_browser_download_download__file__picker.cc) = e5a5f8cdc16baff39ec75c3b3f556d73fd48175b
+SHA1 (patch-chrome_browser_download_download__item__model.cc) = 84b8564b77aa98760c17c119e776d3cfde9aa16c
+SHA1 (patch-chrome_browser_download_download__prefs.cc) = b526a5f862c15961d59d34aaf9010d7868702a8f
+SHA1 (patch-chrome_browser_download_download__prefs.h) = 8b3a036f9227832356e7302e61c256bd0a84220a
+SHA1 (patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc) = 75b1982cf66811af517ee3d6863c8a9b188a0253
+SHA1 (patch-chrome_browser_enterprise_connectors_common.cc) = cacdee75b6b55979cb3d16224d1124e635728797
+SHA1 (patch-chrome_browser_enterprise_connectors_connectors__service.cc) = 7f7c111384d5d0e3f0283d3b5a9fde23fcf0b34f
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc) = 94d95f6f14aa80eacc12c8213e5ab0b9ded860af
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc) = 683fded6da50320615c3455617d982e9a3e7ec7e
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc) = 0f034861141cb38fb4a68775524d95b637a601f6
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc) = 29c1a75deeb88a06644c942312223c75455e4e5f
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc) = 22680124e6bc65570c5805bfb692f4711d1299ae
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc) = 4c9bbd967668a82006523d20f3b98ce8fe35be13
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc) = 7193c5b9ce57026420d23c1dc9c592a62858d801
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc) = f1e9dea57f13f43789ec7509dea1dbbfabc94725
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h) = 535c45dd29534498eead05a37e0a8fe32c9fdc8a
+SHA1 (patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc) = 581c99d285fd3f4d6dd3aaf11750fe1f6512c1fe
+SHA1 (patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc) = fb3cb741c3c8dc35b56000b3c5038f165a905cb7
+SHA1 (patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc) = 2a3fb5ee0c22e331b26bd741577a122babd0894a
+SHA1 (patch-chrome_browser_enterprise_signals_device__info__fetcher.cc) = 2e937866cc048baa097e0ed2cea0798452e2228c
+SHA1 (patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc) = 6b23cee0463319c5ec43214f5886076bac653122
+SHA1 (patch-chrome_browser_enterprise_signin_enterprise__signin__service.h) = 8a82ae3c801326063d445d0fa6ef5f9874916e65
+SHA1 (patch-chrome_browser_enterprise_signin_interstitials_managed__profile__required__page.cc) = 4d71c1bdca2d8ecfbc27ce8a97885035d256e404
+SHA1 (patch-chrome_browser_extensions_BUILD.gn) = 3a3f1a599c2c08294f1bcaa10bd464e5d399bc3e
+SHA1 (patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc) = 4822e9d11ed8b1152e69826c4db904e18ec2d07d
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc) = dacf72e8d960ca6954cc1fb9579d7e34540572c4
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc) = 8d2415603969e9f9d2c85b06b2bd6a93ba4756f7
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h) = dec9b82a6977c972c22abe6c95de46c68541f058
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc) = e20894a5773e474f6bf9a3b16a29c93a4f45104e
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h) = 64991c1579603a7eb507a8c991f74c068ba4eda7
+SHA1 (patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc) = cd442d811487d8bfc25a7e641201b325b5c61764
+SHA1 (patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc) = 3fae43ad753b34bb11015a57c9efb107858d0c28
+SHA1 (patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc) = 6db58d2fd1142b662199e95c7fd7d7f19e4cbe2e
+SHA1 (patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc) = c74cc76487e762e1c6bd2c6f10b60409d54fccaa
+SHA1 (patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc) = 1a8805cccb03444f3f129654a50d0443313289b0
+SHA1 (patch-chrome_browser_extensions_api_settings__private_prefs__util.cc) = cfb630f7a28bc4574461970fb19ebc25e648fbac
+SHA1 (patch-chrome_browser_extensions_api_tabs_tabs__api.cc) = 0fdbfa79318e38aeefc4a827d15518853bd8f196
+SHA1 (patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc) = 7eb970c5f2eece40fe08d461d7448739d6e9dd79
+SHA1 (patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc) = 24a6e786faff70024135cbf4883c958b98f3bda2
+SHA1 (patch-chrome_browser_extensions_external__provider__impl.cc) = 3e00b98c37ba95818a3767ae6604ada5345e82c9
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener.cc) = 46f9c40448ee71130ad393c0b42f26e114cfea24
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener.h) = 3bdd8b144f6a955576c34c6cdf9d92516b60e681
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc) = da23cf618691d01a18da080c36a85c2f026fe754
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__ozone.h) = 19ec2bd2cf51e027448972cbd9da8157f2807554
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__win.cc) = 6614123f304919580e870e88b236409c9bd97537
+SHA1 (patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc) = 004bbd17ba678deb0673678025ab1ba814c15e2c
+SHA1 (patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h) = 21f8b98c2d67ccd06edd601f3d2d3d8048363c0d
+SHA1 (patch-chrome_browser_first__run_first__run__dialog.h) = 52d68383ec158d8c8284bd6909ad317e627a844c
+SHA1 (patch-chrome_browser_first__run_first__run__internal.h) = 905aa6a3841a99a29632638f9d60f0e1649ce75c
+SHA1 (patch-chrome_browser_flag__descriptions.cc) = 795ce2923bc36addd245f43025d5c581351a3ca2
+SHA1 (patch-chrome_browser_flag__descriptions.h) = 7d6e8fc64a843934b145169c45ee098d13b0e2a0
+SHA1 (patch-chrome_browser_gcm_gcm__profile__service__factory.cc) = 5dda563a39a04d59fc2ededd4db673817e72e2d2
+SHA1 (patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc) = 8ee1b3828a971ce579fef65534cacba7618ced66
+SHA1 (patch-chrome_browser_global__features.cc) = 2f33600315bd1c449b8aa95232e8c64e6b8fb027
+SHA1 (patch-chrome_browser_global__features.h) = 5266b1826de4b2a97b5db7911443699b5bcad1eb
+SHA1 (patch-chrome_browser_headless_headless__mode__util.cc) = d80b03d7266663c9ca9a999cf47ad3cbef4489df
+SHA1 (patch-chrome_browser_intranet__redirect__detector.h) = 32e2806446b13d9d643ccbf4fb277607b9dbf881
+SHA1 (patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc) = b157ccf204d8678089955d22c4a179a4102b5690
+SHA1 (patch-chrome_browser_media__galleries_media__file__system__registry.cc) = 728fc2781c16dc88da0158a589dd0006578dc744
+SHA1 (patch-chrome_browser_media_audio__service__util.cc) = 317ac53bd711d5dbd3382c27725d942b8c4ead28
+SHA1 (patch-chrome_browser_media_offscreen__tab.cc) = 3a283ccbfce6b0d72c3b23491b4b7a6fed478f23
+SHA1 (patch-chrome_browser_media_offscreen__tab.h) = bc8db4a8fa748fdfb26f6afb0060ae17b6445d2d
+SHA1 (patch-chrome_browser_media_router_discovery_BUILD.gn) = d9e91833fad819c14a382506d49522490ac758f0
+SHA1 (patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc) = 706c0c0c9099b6ce8589f185d1a76ea291e1103b
+SHA1 (patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc) = 8237d1d44cb90756c6d84eb66f69e825253dbbbc
+SHA1 (patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc) = ec0d1270ea23ccb58d9022846ed99d57ad9760c6
+SHA1 (patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h) = 50db445fc9de2ff449742bee1a30c572f3794019
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list.h) = be869212004d2826eb25a1db4e9a1d9bac7b4a4f
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list__base.cc) = 7f0716da0d42afd7efa1f66b6a6c71fbdfe8ac2d
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list__base.h) = e1bbd9fa18814c453c0366373f0325fd7e21aafb
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc) = 3ed726078634ea0dd148dbd7f7c5412241a040f1
+SHA1 (patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc) = 7fc6226b0ab1f88eea2525da7104442585bd60f5
+SHA1 (patch-chrome_browser_media_webrtc_fake__desktop__media__list.h) = 8934896198371fdbbb6c322af9ffcde3f34c9247
+SHA1 (patch-chrome_browser_media_webrtc_native__desktop__media__list.cc) = 1c1e291be5f1513497e57a430f605f144285ffc2
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc) = 97465d6858840387bade4ae19e2e4166fda2938b
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc) = 2cf9e9e8a2cbba2e0387808503a38e5faf890466
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__logging__controller.h) = d49b7755e67b3f0dd602b0572a96b57d69ffdcda
+SHA1 (patch-chrome_browser_memory__details.cc) = 81e18107277653b9dca6328094541f680b5bfc3e
+SHA1 (patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc) = aad5987a02edd4ec89c2e1efb886504e268e2f32
+SHA1 (patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h) = d2398d27dff48dc5815c83b16c5d7ad41be1d4f0
+SHA1 (patch-chrome_browser_metrics_chrome__metrics__service__client.cc) = ab28c9695b09e467afdbac607d3764e798a92c3b
+SHA1 (patch-chrome_browser_metrics_perf_cpu__identity.cc) = 4e6e3309359e389f3c8cdd3ec728583b97471412
+SHA1 (patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc) = d5aeec53c3188f223074dfce710decaa8c80440e
+SHA1 (patch-chrome_browser_metrics_power_process__monitor.cc) = 8ed6945489514a96076d396bf4bb9e2e5b38afe9
+SHA1 (patch-chrome_browser_metrics_power_process__monitor.h) = 753abec5c13c99d97f42773bc3fa500cec61b89b
+SHA1 (patch-chrome_browser_net_profile__network__context__service.cc) = 50954d4e6ada77adec42f465f03cd1989bb6cbe7
+SHA1 (patch-chrome_browser_net_proxy__config__monitor.cc) = 3f1b32b21c71d4df8f62c6e7df5973f98a07cc15
+SHA1 (patch-chrome_browser_net_proxy__config__monitor.h) = 5a231537241d42f1285ff99f6d0cf6dd35388246
+SHA1 (patch-chrome_browser_net_system__network__context__manager.cc) = f095bf676140bf6f42bac8207692dbafe6d30ce2
+SHA1 (patch-chrome_browser_net_system__network__context__manager.h) = 440405d7e8bc1c42524e76ded45cd750e5fc9da6
+SHA1 (patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc) = 6b3b58eac1ea4a00bccad41964ad047a56723076
+SHA1 (patch-chrome_browser_new__tab__page_new__tab__page__util.cc) = 65a1e423ed1365c3dc6b975950e9df6ac79317dc
+SHA1 (patch-chrome_browser_notifications_notification__display__service__impl.cc) = a258ae7acd3cfa5ae28dce80b3c4a876c1a3fa34
+SHA1 (patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc) = efe8edca2cbcd4f7b493f0842a9d2c1c5eecdf06
+SHA1 (patch-chrome_browser_notifications_platform__notification__service__impl.cc) = a00f34d02f834e75c66687ff4a6103b4b0df360b
+SHA1 (patch-chrome_browser_notifications_platform__notification__service__impl.h) = 77a4b79e8b05a7b4b849cab635bf0160fded4b63
+SHA1 (patch-chrome_browser_password__manager_chrome__password__manager__client.cc) = 72c3d4a520f5461154a558361f616f1ddf04426b
+SHA1 (patch-chrome_browser_password__manager_password__reuse__manager__factory.cc) = 0b1dfd05968cbcfe55ec1d91bcf7fd7fc66ad370
+SHA1 (patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc) = 518df53ef9aa2539221b7979a26cdd89d5d8bda0
+SHA1 (patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc) = 2f6ab6d118f9a37f7a271b60eb315c5f4b7dbf29
+SHA1 (patch-chrome_browser_platform__util__linux.cc) = 9b5785c31f4dfc8a04afd43fcad49b474ebef120
+SHA1 (patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc) = 610d092b4f885e465352b4f01b0a3c555ab0debc
+SHA1 (patch-chrome_browser_policy_browser__signin__policy__handler.cc) = c01b312aa2bb92d4b2251c018cf597268b44d86a
+SHA1 (patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc) = 28e80b276aab609dbb9aaa55ba7995e0cb47827e
+SHA1 (patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc) = afb45ad62e51c46910dc9e0251e8ed3ee9a3020e
+SHA1 (patch-chrome_browser_policy_device__management__service__configuration.cc) = cc58066423c11cefc1542d175f9db217e5942c9c
+SHA1 (patch-chrome_browser_policy_policy__value__and__status__aggregator.cc) = ad4af7d7c24db62143815fd47c00ba81ff85c866
+SHA1 (patch-chrome_browser_predictors_preconnect__manager.cc) = b4f4cd6e79e5d3cd430ea864748bb16aaf1fa8ae
+SHA1 (patch-chrome_browser_predictors_preconnect__manager.h) = 2cd826e089d781f8e2b585e1fc9d61c640dc86c8
+SHA1 (patch-chrome_browser_prefs_browser__prefs.cc) = ad2aa4c60e12fd3262b4d01147877dec373ec493
+SHA1 (patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc) = 96c7be319e70cb9a3d66846ab40b82ce083a89d0
+SHA1 (patch-chrome_browser_printing_print__backend__service__manager.cc) = 38300bb055d59538762a33642e06399b298d4676
+SHA1 (patch-chrome_browser_printing_print__job.cc) = 572f4d6f538c5560c5c4a6b49f8f97c24353bd84
+SHA1 (patch-chrome_browser_printing_print__view__manager__base.cc) = 4d1c3ca0fd57504d4191af92d8dc7cecc65a2019
+SHA1 (patch-chrome_browser_printing_print__view__manager__base.h) = d8ce350d46e4dab153c61175b02a6fc7df01186f
+SHA1 (patch-chrome_browser_printing_printer__query.cc) = c7d248e923f8e25992692c48dbd1c018153cec79
+SHA1 (patch-chrome_browser_process__singleton.h) = 207379f76c890df2bef15afe8926bfca0194d8df
+SHA1 (patch-chrome_browser_process__singleton__posix.cc) = f77a37ccb43c18f38c339240723c8381457726d6
+SHA1 (patch-chrome_browser_process__singleton__win.cc) = fdf63e24744a61d4d96a7c584ddbe80591af7c27
+SHA1 (patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc) = 0ffa0263668ecb07057eac4b310ae40ffc2685ea
+SHA1 (patch-chrome_browser_profiles_profile__impl.cc) = 75ea7774f267d99ee88f5308320ce8c50644ec70
+SHA1 (patch-chrome_browser_profiles_profile__keyed__service__factory.cc) = 5bdaef13f85257215af2fe9a3b3cba517ee82208
+SHA1 (patch-chrome_browser_profiles_profile__selections.cc) = 3c1955e28754ca2cc7ffd7872b8dfec1bb78db24
+SHA1 (patch-chrome_browser_profiles_profiles__state.cc) = 275589fe0a05f2b384fe1cd9e35f0ae0a8d322bc
+SHA1 (patch-chrome_browser_renderer__preferences__util.cc) = f1c22c5dd6acebd5fcbab433373b8a375c9c0566
+SHA1 (patch-chrome_browser_resources_pdf_pdf__viewer.ts) = 0ef452577cb21e15188b3080219c7fdb78aa5e65
+SHA1 (patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css) = 3ca1e55a0cafb383417b5f9113b039258ec1757e
+SHA1 (patch-chrome_browser_resources_signin_signin__shared.css) = 28cb16a3afcafed70d43f6b9c8ad17c2c5c25a77
+SHA1 (patch-chrome_browser_safe__browsing_chrome__password__protection__service.cc) = 682feff9e3aade584aae12ce8a600c5feefb729f
+SHA1 (patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc) = f63632ee3deddc391ab5e08c0363ae9c214bcea7
+SHA1 (patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc) = 20311f706ea7eb56ebb84278052f7dea1b1b798d
+SHA1 (patch-chrome_browser_safe__browsing_safe__browsing__service.cc) = 99aedcf227dc571970441523a40ea9fde6738a85
+SHA1 (patch-chrome_browser_screen__ai_screen__ai__install__state.cc) = ac45c56e56bbf36a8c2400a7a2480f1db044251e
+SHA1 (patch-chrome_browser_screen__ai_screen__ai__service__router.cc) = 1d79e844428cb22998d46806c9d995eea6be3b15
+SHA1 (patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc) = 661606b4bd092d54ff47f3b0f30aff83494fc2e0
+SHA1 (patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc) = 41a2b4ca3eb708151f46eaf7fa9f9a9bd76739d7
+SHA1 (patch-chrome_browser_sessions_session__restore.cc) = 42f30dc118a6ada8464e362205d1b08c863ad8f7
+SHA1 (patch-chrome_browser_sharing_sharing__handler__registry__impl.cc) = 2b2c3faf4350d2ea1f4ee3bac3deb671fd67c002
+SHA1 (patch-chrome_browser_shortcuts_icon__badging.cc) = 4eb4612c8d85ecab4b16f3e43142202ca2545741
+SHA1 (patch-chrome_browser_signin_accounts__policy__manager.cc) = 32d94316b17c4b6fbbf5cc93d043864c52766480
+SHA1 (patch-chrome_browser_signin_accounts__policy__manager.h) = 1d3201def695b61e046dde01899253e6967ed4e7
+SHA1 (patch-chrome_browser_signin_signin__util.cc) = 5ef6f3b1917b95b38e9c142da48f435f7fecf235
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc) = 375ef7e9aad8f19d796b1a780485496ea587afca
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h) = 785b84cf2d091664cbd87fc529c491335f03c568
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__service.cc) = 034231c2e7d032d9d1db1782a4302a4a60b55852
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__service.h) = 50ee0add58dcf22560a12cad69a07ff26dff848e
+SHA1 (patch-chrome_browser_supervised__user_classify__url__navigation__throttle.cc) = c39c8113864141753c367efa477afeb4c509ce1b
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__browser__utils.cc) = e1dfbcf8325a1df8b4b4c8c37644b32f4a7fdd46
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__browser__utils.h) = 14fb93d74331d7f94fee33b9582ee2c80039684e
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc) = 41451b47969d778fae31b34e4a486d3e44b53e5b
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc) = 15eaa410b0d41504155c5b892e53675a55e9fbae
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h) = c1dfa5a64b7e3ab7db5f500c0889e7af06d8dad2
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc) = df38f288438bbe17a666dff6d620b98478af27fe
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc) = b298c3d37c99701c8db7b35fd7be119e1e2141f7
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc) = e8ee5bff29d045b19dcb0d0a19c6cbc3a6251d5e
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.cc) = d77c337aab238dc9d814035d797e47e06ee29a52
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.h) = 7c322ee7df161b8072b8e0d3910b64a636fa23f9
+SHA1 (patch-chrome_browser_sync_chrome__sync__controller__builder.cc) = e0b829de9047f253feb950fa60c574e076efe776
+SHA1 (patch-chrome_browser_sync_device__info__sync__client__impl.cc) = b90621ccb017b5bab85a47eaf95ddbff07c5c8a7
+SHA1 (patch-chrome_browser_sync_sync__service__factory.cc) = 89ed31f46ebbb610f1714020f1ab449d5c1f3e75
+SHA1 (patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc) = 1ee31d5d4c387a0061af11523a662a0aa47c3434
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group.cc) = a0965a8492f7a2c04c721db5d3e27265c5b28fda
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group.h) = 689fb8845626d1664d2e9af0b3fd365a64c162cc
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group__sampler.cc) = a1fa2cf13a8cfd1fcfd80e59c3fe07b4d690db01
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group__sampler.h) = 69d4ceff9c082c1fcb7d98b2611f908e7ec70b4b
+SHA1 (patch-chrome_browser_task__manager_sampling_task__manager__impl.cc) = 6ba59f677026b23891342b435b0c88c6f533c3ad
+SHA1 (patch-chrome_browser_task__manager_task__manager__observer.h) = fbed6360c767c1c7c5dcc869353e07cb288f2a10
+SHA1 (patch-chrome_browser_themes_theme__helper.cc) = 1a472b321b6f6dda3363978b08f403bb8915c96f
+SHA1 (patch-chrome_browser_themes_theme__service.cc) = 43bd7d23af74b19c770a7774d062702dae9b590d
+SHA1 (patch-chrome_browser_themes_theme__service__aura__linux.cc) = 3bfa23a5b622f1d8e1fac1811f1964d57a58481d
+SHA1 (patch-chrome_browser_themes_theme__service__factory.cc) = a9142bdb9aadf279eeaacdcf63fcbc34a7b2bed8
+SHA1 (patch-chrome_browser_ui_actions_chrome__action__id.h) = 0b5fdfc582af2c4e07ecfb640854deb1be35aca5
+SHA1 (patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc) = 4c6639db5df7eaa2cf6187c744e6d148d782eb75
+SHA1 (patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.cc) = 750dd02f53fa1d430218b564a1fab9fcb6369403
+SHA1 (patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.h) = 833a33c83f0f60df9d77e0c9c23df2690354d22a
+SHA1 (patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc) = 7a0f9969a7605e4dc400850b7a6e97b4d61602a4
+SHA1 (patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h) = c3124e893ed29f043b1be16daf98dd64871cbf58
+SHA1 (patch-chrome_browser_ui_browser.cc) = 0798e20de652e8baf336e4f802a14fec78723047
+SHA1 (patch-chrome_browser_ui_browser.h) = f11563735a0268aac81858facc4686135199e84a
+SHA1 (patch-chrome_browser_ui_browser__command__controller.cc) = 9c2b8eaa143517a5a8e32c8247f9f9654f2829e5
+SHA1 (patch-chrome_browser_ui_browser__commands.cc) = 0b10ecb8cb94e57b821a29a69e7671bebb2eb32f
+SHA1 (patch-chrome_browser_ui_browser__ui__prefs.cc) = a67f7436c9edb1543959c389c70d643b1dc54d19
+SHA1 (patch-chrome_browser_ui_browser__view__prefs.cc) = 992689df9ff7a0283d08c26b6752c39e9a79ec64
+SHA1 (patch-chrome_browser_ui_chrome__pages.cc) = d5c2b7ba1d225fc46ec07abcb3d0a0301b32e595
+SHA1 (patch-chrome_browser_ui_chrome__pages.h) = c2a15a2ab65cb744999e3a853522a04f64b909b6
+SHA1 (patch-chrome_browser_ui_color_BUILD.gn) = 50e2004997fdc589ec22824d2513ddb12a9b8425
+SHA1 (patch-chrome_browser_ui_color_native__chrome__color__mixer.cc) = 28a68dd62418ab7f3d0cff4c577c90efaf5ad6df
+SHA1 (patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc) = 10fc5ecccbe966c9be0197e699de69d121cde285
+SHA1 (patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h) = af5ccd28e7d1378eb8a1aa2f3ba7a17c7efaea05
+SHA1 (patch-chrome_browser_ui_managed__ui.cc) = 61548d43d4721b93599280eef6e727f12fb8f24b
+SHA1 (patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc) = 329c27a709a431ffd56df2c30ba7d15e59b2dde4
+SHA1 (patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h) = 84b48acc2f64d092a22c51bd47a9793fc2eb992e
+SHA1 (patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc) = 8a93eb2978c118e93b1e02277382a38b9e0bc450
+SHA1 (patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc) = 37833e515dcea57c7bc7d73764b21ba308cbf6e6
+SHA1 (patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc) = da52ac9bb00ab6842bd121c05a128a0f2b63ebe9
+SHA1 (patch-chrome_browser_ui_sad__tab.cc) = 86f18e8fa862eac633a39a5cec4df4d1bbd64088
+SHA1 (patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h) = 8364764aed6ba417fe5d972daea7568c073cbcf4
+SHA1 (patch-chrome_browser_ui_signin_signin__view__controller.cc) = bdb824cad0d9c8f65ac7c749c63d8001821e4f0f
+SHA1 (patch-chrome_browser_ui_signin_signin__view__controller__delegate.h) = 429df26afad08fae06f2a4b05f83a9da6c13b883
+SHA1 (patch-chrome_browser_ui_startup_bad__flags__prompt.cc) = f8337f7ffbcdb8497d73a3af7aec54984a829fc8
+SHA1 (patch-chrome_browser_ui_startup_startup__browser__creator.cc) = 27c82d92552051ba5afe47f603fbf2a22f148285
+SHA1 (patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc) = df2f4a25cde2f38b1b22231e822c4ed16304b13a
+SHA1 (patch-chrome_browser_ui_startup_startup__tab__provider.cc) = db7047f74e62e2e60588aaccb83e68a8a9fede02
+SHA1 (patch-chrome_browser_ui_tab__helpers.cc) = e9492ae4d1d72b5b2cacc46e6faea460538028b6
+SHA1 (patch-chrome_browser_ui_tabs_features.cc) = 501970ab0c7113c26ce8af1fdf5726d79c2f0792
+SHA1 (patch-chrome_browser_ui_tabs_tab__strip__prefs.cc) = 81cd3343f79f285984c59590d95b5943097a46df
+SHA1 (patch-chrome_browser_ui_task__manager_task__manager__columns.h) = cae7c8a22328fd04f82cd60cf669f4ca73219581
+SHA1 (patch-chrome_browser_ui_task__manager_task__manager__table__model.cc) = c7df56a06519becf3524dad6c3fa3e4808bc229c
+SHA1 (patch-chrome_browser_ui_test_popup__browsertest.cc) = 58a8db18bf44961af752e9992b5984ce4ac1b302
+SHA1 (patch-chrome_browser_ui_test_test__browser__ui.cc) = 96ba7eeb139ca4bb7c0505a1d3eb27d8fbe803a4
+SHA1 (patch-chrome_browser_ui_ui__features.cc) = 37a172733ad6e015e90b60502d37099df5d34dc9
+SHA1 (patch-chrome_browser_ui_ui__features.h) = 994bf8c68b88c5df307f07af17d965eefc7a52b8
+SHA1 (patch-chrome_browser_ui_views_accelerator__table.cc) = e8f7640a4937fcf6caba17bd03da20122cf39be9
+SHA1 (patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc) = ccbc60c7371b637581d8e07451de7182157a6a61
+SHA1 (patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc) = 1321f0e278b23084d22737dc8ef6f35bf3a6a387
+SHA1 (patch-chrome_browser_ui_views_chrome__views__delegate.h) = cd98f465e6da8dcee4af0038baec62b25e2467c9
+SHA1 (patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc) = 021b2fbfb3b64faee099186fa9c8975ce93c12fb
+SHA1 (patch-chrome_browser_ui_views_compose_compose__dialog__view.cc) = 44bf229c38429dacd815d84f60bbbc83e5e02fde
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame.cc) = d7a64cc39c82a0577e77bbc06e541a6139b83a03
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame.h) = 26172519bfeb36c887d521bfd136eea88644022e
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc) = 799afb5d5d10e370fd25f0188536981814336976
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc) = b91622af62ff1b047ef2262000df9d4155c3df7f
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc) = 68ff55bb81feb4ef472802cd3ca60d7533f699a6
+SHA1 (patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc) = 9706375c35b4000704933a1f85a4073935707c25
+SHA1 (patch-chrome_browser_ui_views_frame_browser__view.cc) = 15192f7b388cc88e81bbd43d870f7034dedc8c39
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc) = 3d307b320d4205fe41bfabe784dfdd32c6689bc9
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h) = 4e0ca2dee5fe0f5ffbc873e110ce1767bd76db56
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h) = d88f3e07a5559106beca58f8a5a361c290c368d3
+SHA1 (patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc) = 59ad3ab6b9fe0f860e3188489f13da38a0daecee
+SHA1 (patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h) = 786719494a7c4c773c6039f7e5b3188eec87c6ef
+SHA1 (patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc) = 4d29a2a9aeb02ec7a5d5eef5b0388d1d2632efef
+SHA1 (patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc) = 7c4c5f1171238a9e5b06f2b78fcf1c5f412ef873
+SHA1 (patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc) = d4eba52de6f6fc4cb557de28f72f8b685081437d
+SHA1 (patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc) = d9ee67b5f2529731524777052ba22dd2a399774a
+SHA1 (patch-chrome_browser_ui_views_hung__renderer__view.cc) = 38fe4c9a714611efe949fdd86e4d95e86431d79d
+SHA1 (patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc) = e14df718e3463937a4d2143e704506c27a38e678
+SHA1 (patch-chrome_browser_ui_views_overlay_close__image__button.cc) = 4f96f88f52455bc6272ec4ce2f654030b871f6f3
+SHA1 (patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc) = 1727616980e22dc78e90ff52ed465360593636a3
+SHA1 (patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc) = e044da6142b1f9effe53553ca79089765f9c58a0
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__menu__view.cc) = 20c2c54a8ffef5f96ce893e771ed60407267912b
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc) = 761709a4de3777b80706977978c6f1b0fcf4665a
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__picker__view.cc) = f1b0cde9e4122747399c69a404c9773ac0a50fe1
+SHA1 (patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc) = 5191b34eb0495f4a12ca48a815139da6c33ad410
+SHA1 (patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h) = 375d490c005e29fa3274b9ddb8b0ad28d4c2fcc7
+SHA1 (patch-chrome_browser_ui_views_tabs_tab.cc) = 4bf0592b26e7cc8cf9580f622b6a57c2d6135544
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__close__button.cc) = 8275541aa0694c0123f0ec90b3ca1ef79b2e7d2b
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__close__button.h) = 34e75d56fb51406736d0507bc53bc8f5085436a0
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc) = 9682b05487f26dfee00dbe7e3826e37b85a96648
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc) = 9b2e0c45dc13e7f0b28d05d0d8120550593e19fc
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__style__views.cc) = 16d916c3c33c8edeab4410b7bd8930358b2ddb41
+SHA1 (patch-chrome_browser_ui_views_toolbar_toolbar__button.cc) = 156cb7b9429143319eeb2976f73590cf10a6c9d6
+SHA1 (patch-chrome_browser_ui_views_toolbar_toolbar__button.h) = a4b24f21573242efad509142560a741239c83da9
+SHA1 (patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc) = 2d7d3b762ca074f6782d0d5c53804de814499600
+SHA1 (patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc) = 92bbd4a0dba9bc3202e1bc68143411512ac4568c
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__dialogs.h) = 87eee71ce0a00294bd0713e2d05c522314b92785
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc) = 0bb55a681fad3c9b39b8f958a8dec24a71637428
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h) = 1ce961b7cc70ef207a06cac24832012e964a5215
+SHA1 (patch-chrome_browser_ui_webui_about_about__ui.cc) = e2cd18eaa682d398662156000e8791c86a7d0bbb
+SHA1 (patch-chrome_browser_ui_webui_about_about__ui.h) = aba21c006f090f5c52972f2f02525eea2a9a4f6b
+SHA1 (patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc) = 7488c40176ac7011fa8c063fb36ed2751ce826ca
+SHA1 (patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h) = 981789afeac5974391bc06fb89c4f6c2d9b89706
+SHA1 (patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc) = 4f4e71efed931d51d49d24e4dd85f400eab46aa1
+SHA1 (patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h) = f04bed8e5f89f9fc967f2c94fa4f46fc00cb2428
+SHA1 (patch-chrome_browser_ui_webui_app__settings_web__app__settings__ui.h) = a2c2c73cf9705095dd6a3b8cc5865f918180d779
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc) = 9145bb0dda132512c4aef4f9d71a57ed151ac3fa
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc) = 0ade6359ba6e64a346fe84d873bab17d45fe0610
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h) = 3a0e1dce79556e1eed5012e5c383188aaf8ab215
+SHA1 (patch-chrome_browser_ui_webui_chrome__web__ui__configs.cc) = 6cec01843d2cb6077e064a16d38e1b6a1c686442
+SHA1 (patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc) = 8a4dc1968771b86650bef15b9438701298ba9f69
+SHA1 (patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc) = 127a2ebbb7fa42a98d67c86267451e0943bd6254
+SHA1 (patch-chrome_browser_ui_webui_internals_user__education_user__education__internals__page__handler__impl.cc) = edb42f3af76bb0df2307e05e7c0aa244d8b604f0
+SHA1 (patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc) = 085d2f6f5530f85b7e6027f17c046a6418a1eccb
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui.cc) = dcee4ef56e264ccd9b4d206df190576b26d2ae9b
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__constants.cc) = 9c780a2f79155eaadd7d54b36bf09195f7a71259
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__constants.h) = 56d594b4bc1453cfcd73a09511dd273be18cad95
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__handler.cc) = 2628c95871bcc98b89bdc56ad0a63ebf9b496a5e
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__handler.h) = bbda34781eefe384b2a41c702ec99c0a3877554f
+SHA1 (patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc) = 8201fb7c23a2eb2b9ab9c5d0545b19207b170c4e
+SHA1 (patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc) = a2cc376041c66bf8542a04d859aa9767464ba46a
+SHA1 (patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc) = 63ec0dcc77c7d01139532591159e39cce05ca2dc
+SHA1 (patch-chrome_browser_ui_webui_settings_appearance__handler.cc) = 3bc55928f2ca5defbc08dfb18095b5df6e42a920
+SHA1 (patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc) = 4aaa5e692d498947452bd3015146e81bbd0bf882
+SHA1 (patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc) = 9d8fb427e04b80c51db367ebe4066134a9439cc6
+SHA1 (patch-chrome_browser_ui_window__sizer_window__sizer.cc) = 571c9ce7eca08336593b9102fea6029009705ad3
+SHA1 (patch-chrome_browser_usb_usb__chooser__controller.cc) = 2b1a04452bdb3dc41b44db224f6ab1c8a12be087
+SHA1 (patch-chrome_browser_usb_usb__chooser__controller.h) = 5c9a48390182fc23cef63f316c7d353b6d19aacb
+SHA1 (patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc) = 12275766eea50320127b6a0bd0250556c3170c28
+SHA1 (patch-chrome_browser_web__applications_commands_launch__web__app__command.cc) = 9a1bb4449c1050fff003e22e65d677ad54cfed7f
+SHA1 (patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc) = 59767ece6cdd7c72ec7852aee114634c68d126ff
+SHA1 (patch-chrome_browser_web__applications_extension__status__utils.h) = c648f09082d3fc4b136c4de2e3cf8b42e2310a68
+SHA1 (patch-chrome_browser_web__applications_extensions_extension__status__utils.cc) = ac5a25ac19943d2d682a8219c4882fd5584d4dc7
+SHA1 (patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc) = 6db56808d44b4c07a45d7708d413cb40778a144f
+SHA1 (patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h) = 3fc4162f4cfe9e338a0614ebc81442b9e690db78
+SHA1 (patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc) = 01a978bc49a14e564f248e6fdb8cbaa31c220cfc
+SHA1 (patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc) = 63922b85b1fb94ee6fae15b4b53daee8a59812e6
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h) = 8791a4dc63fcf13edc233c8eb9baab48450d350a
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc) = f984e5d27ae163ddc952fcbe35f7c1fa81f8b6c6
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h) = d836a4005274e1b7f086d2138fda72c292e86e06
+SHA1 (patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc) = 3dae9fa51feba9dca4d27bdb99f1335a4b9c94f6
+SHA1 (patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc) = ee74cb21987760a14754ad411a0b51be285b733c
+SHA1 (patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h) = ef1f13ce42f255eaaa2d95c19d6bc83f54ee016d
+SHA1 (patch-chrome_browser_web__applications_web__app__helpers.cc) = 9d861023c87a82c0258089e1314c65b26150f392
+SHA1 (patch-chrome_browser_web__applications_web__app__install__info.h) = ea1c72ffe22a2d872587b771049bed0f87f770b8
+SHA1 (patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc) = eceb4e3897d896118be864ba66b0dc4ab1275518
+SHA1 (patch-chrome_browser_webauthn_enclave__manager.cc) = 16cd164d1b23687dcb7f583154f6689f9b9959d9
+SHA1 (patch-chrome_browser_webauthn_gpm__user__verification__policy.cc) = b7f2f9d63aad51df2fbe176e6b767002106220a2
+SHA1 (patch-chrome_browser_webauthn_unexportable__key__utils.cc) = 803ff38c43d1732a8c1c08d1d37325c52fb28fb3
+SHA1 (patch-chrome_browser_win_chrome__process__finder.cc) = cd61963513f678c620b8d39ae82d8e800400d3f9
+SHA1 (patch-chrome_browser_win_chrome__process__finder.h) = 0b01f99db49acc37db9b8f5dfc2f2d5c0bb12285
+SHA1 (patch-chrome_browser_win_titlebar__config.cc) = 3c5a4748c8027ecc8b5970422a3feeec955a4916
+SHA1 (patch-chrome_common_channel__info.h) = 04e496004049c75206af138c3651ce25e7955b05
+SHA1 (patch-chrome_common_channel__info__posix.cc) = 6a5051f16ff07853ad0e8d7326b73dd4369bf546
+SHA1 (patch-chrome_common_chrome__features.cc) = 82fd0972b3d0027bcf3e88d6d056025355bef5c2
+SHA1 (patch-chrome_common_chrome__features.h) = 9e016e2bcde98105c20dbc3b918240975976ab35
+SHA1 (patch-chrome_common_chrome__paths.cc) = 37ce8ca4bbc5826e5c38d007551de07ca0a78121
+SHA1 (patch-chrome_common_chrome__paths.h) = e9a4f02fbbc73eb070c4aad3c3121906cbc42c64
+SHA1 (patch-chrome_common_chrome__paths__internal.h) = aad19d5530030114c7ce3630d5b7463822b8dec0
+SHA1 (patch-chrome_common_chrome__switches.cc) = b344da667c159667fef857a36a712ca1fe309d25
+SHA1 (patch-chrome_common_chrome__switches.h) = 49a4eaf474f80b53e056e09dfdae3dbf4a12ac94
+SHA1 (patch-chrome_common_crash__keys.cc) = 3926ce2ca15f63e30244391192af21591e77266e
+SHA1 (patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc) = 6107948c3339c9271a08a1740e0eb581573a74a0
+SHA1 (patch-chrome_common_media_cdm__host__file__path.cc) = 55ada26e5db9bde214d2e71076f47c5ef88a5517
+SHA1 (patch-chrome_common_media_cdm__registration.cc) = 1d0970cdbe0177a63c1987501c3843847ac9e26a
+SHA1 (patch-chrome_common_media_cdm__registration.h) = e7cb4c63b27c568042e5e785648a508dc9353afe
+SHA1 (patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h) = edf7a06d005516250923faa7997916659360a9d5
+SHA1 (patch-chrome_common_pref__names.h) = 1e51c8d6b30107f5bb89e08b7457d78dbc0f8710
+SHA1 (patch-chrome_common_url__constants.h) = dd4a2b21b59518ac2b5138af9b2d31d3084e3119
+SHA1 (patch-chrome_common_webui__url__constants.cc) = 0ed34c780c71080a88053d4b7a077ac1b64921c2
+SHA1 (patch-chrome_common_webui__url__constants.h) = 327eace8d13e06f05091e0183dc19e38ff3573e0
+SHA1 (patch-chrome_enterprise__companion_enterprise__companion__client.cc) = dfa11c48c372b43f4b555618c162aaf99f904f01
+SHA1 (patch-chrome_enterprise__companion_lock.cc) = b0067abd97ff6391e05a94a9c6f026dc191a533b
+SHA1 (patch-chrome_installer_linux_BUILD.gn) = d19d3400fd6c557f63d180abdd7e4c6d9d93b050
+SHA1 (patch-chrome_services_printing_print__backend__service__impl.cc) = b55aface67b707a0b99bc660113e5267b58596c4
+SHA1 (patch-chrome_services_speech_audio__source__fetcher__impl.cc) = 3935742090522cb15b038b9a19621865d0484c45
+SHA1 (patch-chrome_test_BUILD.gn) = 8f8dd94836c218a731616031e3706de588d554f0
+SHA1 (patch-chrome_test_base_scoped__channel__override__posix.cc) = 215c9f9df88c16ed009757ecf78f1a1a8d692752
+SHA1 (patch-chrome_test_chromedriver_chrome__launcher.cc) = 1ce940f52d4b3f76322bba6a724e1cd1327fb558
+SHA1 (patch-chrome_test_chromedriver_chrome_chrome__finder.cc) = e4b43771aa8f4234697330532dcf95bfb3943538
+SHA1 (patch-chrome_test_chromedriver_key__converter__unittest.cc) = f4a4651346098dfb158018577232622f1835e8cc
+SHA1 (patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc) = 56d8947ee760807cdf37dda5412906f04999eebd
+SHA1 (patch-chrome_test_supervised__user_google__auth__state__waiter__mixin.cc) = e4d65337aee8cf6f8f2363fb80c3129de40b661c
+SHA1 (patch-chrome_updater_app_app__uninstall.cc) = 3ec414a0bb3806b8a2e3614808f83189792e114b
+SHA1 (patch-chrome_updater_configurator.cc) = 1f209e23cb94d6ebac3147b1326f58519072ebb1
+SHA1 (patch-chrome_updater_lock.cc) = 44f1da9b454367fdc3d0147c95ee4d9a89d443d8
+SHA1 (patch-chrome_updater_util_posix__util.cc) = 70400f9f3fd44d3cfcf453118e5e4badd02e521f
+SHA1 (patch-chrome_utility_services.cc) = 2a908a7a4343e7e6f2e3996d319bc0d3e72d8341
+SHA1 (patch-chromecast_browser_cast__browser__main__parts.cc) = 5abeeb61cb122b651ba06fffe572a6d319d89ecd
+SHA1 (patch-chromecast_browser_cast__content__browser__client.cc) = ddd17a6c0a1d6be6ea4a348a36fdb5fd57c23ad6
+SHA1 (patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc) = cd2155fb8bfb3d9729c7be87e302e6e5161ce59d
+SHA1 (patch-chromecast_media_base_default__monotonic__clock.cc) = 700aec04a772ae741c7d065671611a4c4f1df42c
+SHA1 (patch-components_autofill_core_browser_autofill__optimization__guide.cc) = ccaa1401d46c4e86de3b28a7d13c8f83ff165550
+SHA1 (patch-components_autofill_core_browser_payments__data__manager.cc) = 5e1f9df2361dccf4db012a6dd9bf1d1c5d2a8ec3
+SHA1 (patch-components_autofill_core_common_autofill__payments__features.cc) = f4059d6920026c8260ee2c70bae766274cbc4e00
+SHA1 (patch-components_autofill_core_common_autofill__payments__features.h) = 13be8be80d947b7822b12348986bf734a9ac775d
+SHA1 (patch-components_autofill_core_common_autofill__prefs.cc) = 82f4bad3c5c084c949710ad1e06fb4ef86964cd9
+SHA1 (patch-components_autofill_core_common_autofill__prefs.h) = cc9702524307b103cc46324298f53a2faa5c2641
+SHA1 (patch-components_commerce_core_commerce__feature__list.cc) = 49975875bf74b7c403f87c03548fb456eeb898e9
+SHA1 (patch-components_constrained__window_constrained__window__views.cc) = e5024a6fa81ae80e5a8642f021d3431b8be57f3d
+SHA1 (patch-components_content__settings_core_browser_website__settings__registry.cc) = 0d1f3c4284ddbcb35be971320b7a0dd8e9a8c3f3
+SHA1 (patch-components_cookie__config_cookie__store__util.cc) = f73e744c328ffebd8cffd416e65cf68d8f88a848
+SHA1 (patch-components_crash_content_tools_generate__breakpad__symbols.py) = b262d52b5ce15f58b3ceeddf715886b9d4ceae97
+SHA1 (patch-components_crash_core_app_BUILD.gn) = add18aab89b7d3336461bafbee87ed333d46c07d
+SHA1 (patch-components_crash_core_app_chrome__crashpad__handler.cc) = 78a9064427313359d4adce541c49f29c46a3fd33
+SHA1 (patch-components_crash_core_app_crash__reporter__client.cc) = 770132462f0faabd20e038fa4f8cd181a78324ee
+SHA1 (patch-components_crash_core_app_crash__reporter__client.h) = b590a5ef7cb73fa982a695b827849ce716963aca
+SHA1 (patch-components_crash_core_app_crashpad__handler__main.cc) = 2532296a7672856d5e523170802171ef5c5eae10
+SHA1 (patch-components_crash_core_app_crashpad__linux.cc) = 1ff75476c96a89f4288e3a7280d5dc93c842fc87
+SHA1 (patch-components_crash_core_app_crashpad__mac.mm) = 2d40fb12425d4f808704b8b605316993a963dd1a
+SHA1 (patch-components_crash_core_app_crashpad__win.cc) = c6fd8ab5a2fba89b912717d0edd22c47b56c9991
+SHA1 (patch-components_crash_core_browser_crash__upload__list__crashpad.cc) = 2a410c8130e36ca32d8ebc3ba1a51b0ae7602a50
+SHA1 (patch-components_crash_core_common_BUILD.gn) = 56889c6669397c986e14c16f5f3141527142efb0
+SHA1 (patch-components_device__signals_core_browser_mock__signals__aggregator.h) = 4625eb8bef0b3c50940fac33c3d9d30160cee8c1
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator.h) = 08e182e0c75e022b3443037a1f85d2a22455d275
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator__impl.cc) = 66b02409143a9c427abe71d15e7f9196b67ab695
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator__impl.h) = 33d961185ea974ca64b44575b6d38108060393c8
+SHA1 (patch-components_device__signals_core_browser_user__permission__service.h) = c9988af9bbdc2230c3f38da84eb2b20499d0de2a
+SHA1 (patch-components_device__signals_core_browser_user__permission__service__impl.cc) = d244638c24e6fc4b204a0e99499356a955e9f7f0
+SHA1 (patch-components_device__signals_core_browser_user__permission__service__impl.h) = c447c7f32da7fadd059ca58067403fbc3bda00d9
+SHA1 (patch-components_device__signals_core_common_signals__features.cc) = 869c9c7661c7e878dca281ad9bc4372bd7400ea9
+SHA1 (patch-components_device__signals_core_common_signals__features.h) = b16ab55f931cca7ab945569ea407c4e1a1d182fc
+SHA1 (patch-components_device__signals_core_system__signals_platform__delegate.cc) = 33d6b4f3000349630b4837c1843608b6d0ab501e
+SHA1 (patch-components_device__signals_test_signals__contract.cc) = 460c95da6d0d20846995a4006bc948cea1be505b
+SHA1 (patch-components_discardable__memory_service_discardable__shared__memory__manager.cc) = b4ad920f41bf032181214bc572006ffab65e2df1
+SHA1 (patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc) = a08c497a56984696386d15ffda41c3b77a63cf2f
+SHA1 (patch-components_embedder__support_android_delegate_web__contents__delegate__android.h) = c6c909b9a6e4b8839533dc07cbb7c62465230fa8
+SHA1 (patch-components_embedder__support_user__agent__utils.cc) = 1144ddec545b4fb58befe9fbfeb52ab497c1dd28
+SHA1 (patch-components_embedder__support_user__agent__utils__unittest.cc) = c2ba57183ce474e07ed4dfad35594db6e06241f3
+SHA1 (patch-components_enterprise_watermarking_watermark.cc) = a81bc80d19a9b80530839e3943afe396c6584ecf
+SHA1 (patch-components_eye__dropper_eye__dropper__view.cc) = 126cbfcdd44a27a2fdf4e0dc42563fa8fbbaa153
+SHA1 (patch-components_feature__engagement_public_event__constants.cc) = 5841d55f106de78b0ea8f4701f8765ef4d13e822
+SHA1 (patch-components_feature__engagement_public_event__constants.h) = 4c3292318d26b21251e7f39f3850d9ae3a694e0c
+SHA1 (patch-components_feature__engagement_public_feature__configurations.cc) = 82b758a42c542807bb3d424cccd157ae76895cc9
+SHA1 (patch-components_feature__engagement_public_feature__constants.cc) = 4230eb3e204e4e2aab8e56b381629d3b91225c0f
+SHA1 (patch-components_feature__engagement_public_feature__constants.h) = 1e1bff1d76965056649d776c3eb3cc7c5431e7f7
+SHA1 (patch-components_feature__engagement_public_feature__list.cc) = a70458b20bdd1fd32d47f034ce83ff28195b29d9
+SHA1 (patch-components_feature__engagement_public_feature__list.h) = 3d8d3f1530ae7f34a62b814aeb17a27c3a4d6382
+SHA1 (patch-components_feed_core_proto_v2_wire_version.proto) = 770493c2a9bd1c2af36aece82e325743dc06cb0d
+SHA1 (patch-components_feed_core_v2_feed__network__impl__unittest.cc) = aaeed4fc5c0f67a312f5b70eb0282c3d6840d0ce
+SHA1 (patch-components_feed_core_v2_proto__util.cc) = 79b4f2af2a6faffcacfa1cafe5193453f14c4f54
+SHA1 (patch-components_feed_core_v2_proto__util__unittest.cc) = ca384a8144abf43e67a366b6564a2253f0797ca1
+SHA1 (patch-components_feed_core_v2_test_proto__printer.cc) = 06e0dc4e0193303fcd18ce1b0093ddb73f76f7f7
+SHA1 (patch-components_flags__ui_flags__state.cc) = 405285910ed079561c3e0b56b81123cd6e1adb76
+SHA1 (patch-components_gwp__asan_BUILD.gn) = 6b449d0e358a2a5e9e133b8815289898267bc30b
+SHA1 (patch-components_gwp__asan_client_guarded__page__allocator__posix.cc) = 8f94105213e915c4624330e74d99e3030b07e70b
+SHA1 (patch-components_gwp__asan_client_gwp__asan.cc) = a0d7d628d2e90f1a5c578056def018debceda138
+SHA1 (patch-components_gwp__asan_client_gwp__asan__features.cc) = ddcd3f108b2c8ca553f3695f9ab98a0c109346ef
+SHA1 (patch-components_gwp__asan_crash__handler_crash__analyzer.cc) = 53f6db276559484f17bc6e83eb256d13378bf4d7
+SHA1 (patch-components_live__caption_caption__util.cc) = 2bfef8e770d60b7cbba42c614f73ac1350443afb
+SHA1 (patch-components_live__caption_caption__util.h) = c5d23abd84db277a8c3919b5877a6a5df4736a11
+SHA1 (patch-components_media__router_common_media__source.cc) = f2cde8a3b51bdcf92c608f10b1f5f37c42d7719b
+SHA1 (patch-components_media__router_common_providers_cast_channel_cast__message__util.cc) = eb2349c155d02d72260a3be3c06c81f93c23c7e2
+SHA1 (patch-components_media__router_common_providers_cast_channel_enum__table.h) = a28c0e491d073550673268dd9dbdea4568fd4d48
+SHA1 (patch-components_metrics_drive__metrics__provider__linux.cc) = 7ca696bb7194256e34661cd0daae81452e67080f
+SHA1 (patch-components_metrics_dwa_dwa__service.cc) = 0364a3ab92351c9983999940e86912c22c82866a
+SHA1 (patch-components_metrics_metrics__log.cc) = 42072ee5af7a6086d1fcab1ec27e1dc271c4a710
+SHA1 (patch-components_metrics_motherboard.cc) = 069e27d0c663962a1d5ae147b1fae4f8288ffb74
+SHA1 (patch-components_named__mojo__ipc__server_connection__info.h) = fc3110fea82af65cda06c3335abee1d7e33fc2da
+SHA1 (patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc) = e796dfe49f9e268d0585d4f28ab303fced03d132
+SHA1 (patch-components_named__system__lock_lock.h) = 6d4e1c402a848fe60e6d763fde1cdf6fd2b7fbd4
+SHA1 (patch-components_neterror_resources_neterror.js) = d9b9fa09d6b56143e5920c930cc2af95ab267a30
+SHA1 (patch-components_offline__pages_content_background__loader_background__loader__contents.cc) = 7e9d90692500ea4b8bad546b63e0d4572090c506
+SHA1 (patch-components_offline__pages_content_background__loader_background__loader__contents.h) = e5facc9348b6b503cf1d3ee939b9cda6d27aa35a
+SHA1 (patch-components_optimization__guide_core_optimization__guide__features.cc) = e97e96a1e8ab0baf3b504649a3d33e12289e59b5
+SHA1 (patch-components_optimization__guide_core_optimization__guide__util.cc) = e920ef2a9f89c6e0ffd3f0f72f9ec27b021fb095
+SHA1 (patch-components_os__crypt_async_browser_secret__portal__key__provider.cc) = 08fe0c045e4271e171fdbd75c05f54ee13df5a22
+SHA1 (patch-components_os__crypt_async_common_encryptor.cc) = 7a1416f65f70f9197cbf79a4bf0b6da4b6f17974
+SHA1 (patch-components_os__crypt_sync_BUILD.gn) = b411514dbf338fbe11f8e5552ddaae1ec29b8c65
+SHA1 (patch-components_os__crypt_sync_keychain__password__mac.mm) = 250c6adf8cc40d0e66bef3f47b620d84ac360447
+SHA1 (patch-components_os__crypt_sync_libsecret__util__linux.cc) = 596a35d5c1d58db11a2b527f290efed970006c11
+SHA1 (patch-components_os__crypt_sync_os__crypt.h) = 6d18e367760b6f0a773ff9bac5af8d4e5180a0ca
+SHA1 (patch-components_paint__preview_browser_paint__preview__client.cc) = 3f3a1a596b46f877dfcd44e78f331edb2046744b
+SHA1 (patch-components_paint__preview_browser_paint__preview__client__unittest.cc) = 66151aac79ab83c9b51af5cb98fdd016f7027243
+SHA1 (patch-components_paint__preview_common_proto_paint__preview.proto) = d41c1973dc83e90780fa7cd28af4d5a98fcd06e9
+SHA1 (patch-components_paint__preview_player_player__compositor__delegate.cc) = ac0a3a4b121d5bbecf8f9f0627dea86717d8a2a8
+SHA1 (patch-components_password__manager_core_browser_features_password__features.cc) = 1b62bb110456b81e897077b2d85472a6193d62ae
+SHA1 (patch-components_password__manager_core_browser_features_password__features.h) = 82517ee74792809b7c7b41f2f8a0438183956020
+SHA1 (patch-components_password__manager_core_browser_password__form__manager.cc) = f63a40779739f9e717569741a2ed68aa61533c14
+SHA1 (patch-components_password__manager_core_browser_password__manager.cc) = 30c15b00f0d534c5db0e2fc8cfef39e4525f7717
+SHA1 (patch-components_password__manager_core_browser_password__manager__client.h) = e688a68d74e45fe10f9e66616b1dea3e548f6fb2
+SHA1 (patch-components_password__manager_core_browser_password__manager__switches.cc) = cd02e2e70ab1f8f5c15a021beffe5e2b8ae206a0
+SHA1 (patch-components_password__manager_core_browser_password__manager__switches.h) = d162ad06a81c26a584454bc0e199d5b1fbd3d8bc
+SHA1 (patch-components_password__manager_core_browser_password__manual__fallback__flow.cc) = 76952df9627e5419a1ee428eaaaba5c065ded250
+SHA1 (patch-components_password__manager_core_browser_password__manual__fallback__flow.h) = 1eb3d92cd9e833391a1a6fbaf989eb1142f31925
+SHA1 (patch-components_password__manager_core_browser_password__store__factory__util.cc) = 316c56225bda2287fb6085abef96ea6b58fea98f
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database.cc) = cadb871cf77a10be76ade10d125fd9f1b1bfb325
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc) = 16539e3f5f5d8518664c71b2fcf9879cf9fee457
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database__unittest.cc) = d03099b5d9f72546b4e9f92f00377d5f233b14c4
+SHA1 (patch-components_password__manager_core_browser_stub__password__manager__client.cc) = 0a325f447fb181ab46a4e758ccd07265a282b28e
+SHA1 (patch-components_password__manager_core_browser_stub__password__manager__client.h) = 6c0c20a7aaacc9d5621d986db312d62915f162dc
+SHA1 (patch-components_password__manager_core_common_password__manager__pref__names.h) = 236c64460ba54e6d37cacb24bdba472971361a18
+SHA1 (patch-components_performance__manager_decorators_process__metrics__decorator.cc) = 8beb02caaa7e8c80dd28a6308e505848c0e8ae5c
+SHA1 (patch-components_performance__manager_public_features.h) = 3a27e5ef6199b3c64cf26caad8a0593616c30f8d
+SHA1 (patch-components_permissions_permission__util.cc) = 990b495cb7a020e7779bd63c84e9b58c061ab4fe
+SHA1 (patch-components_permissions_prediction__service_prediction__common.cc) = 3c793ddf4df7021c51d7d9bcdfc25334878191ce
+SHA1 (patch-components_policy_core_browser_policy__pref__mapping__test.cc) = 2716f9887c248c43f8a6cd7672cda79e36d32826
+SHA1 (patch-components_policy_core_common_cloud_cloud__policy__client.cc) = c2923d7fb1581e002d40aaf74074791649386e00
+SHA1 (patch-components_policy_core_common_cloud_cloud__policy__refresh__scheduler.cc) = 7ea06a39e042dccd8a1d36f782c0f6fb0e20c41c
+SHA1 (patch-components_policy_core_common_cloud_cloud__policy__util.cc) = 202da235d3a46475139b9e259c7d8b48872236e7
+SHA1 (patch-components_policy_core_common_policy__loader__common.cc) = 8d2437bfe71c3aff50098db0c5cd1310d77b58ee
+SHA1 (patch-components_policy_core_common_policy__paths.cc) = b85678ac039cc862acf608eedaa9faa30cce7874
+SHA1 (patch-components_policy_core_common_policy__utils.cc) = 38b797ac01f21fd3e5a91a27973b1065502ec1b0
+SHA1 (patch-components_policy_tools_generate__policy__source.py) = 07622c25b389a9500421f1b915e627d5d5df4fb9
+SHA1 (patch-components_power__metrics_BUILD.gn) = 5a58dddfecd06691eb46034c8fc15e171db3ce3a
+SHA1 (patch-components_power__metrics_energy__metrics__provider.cc) = eae6bad521c9752768dc8e7b01e97a069deb17a0
+SHA1 (patch-components_printing_browser_print__manager.cc) = 5efa6504b53a43799eab3a0d15547c04f7f9b301
+SHA1 (patch-components_printing_browser_print__manager.h) = 218f73589e6ad75b372a8b1fa8680fe362c9be86
+SHA1 (patch-components_printing_common_print.mojom) = 1a09e8a038364207280d76609ff23061f5f3e13a
+SHA1 (patch-components_printing_renderer_print__render__frame__helper.cc) = d3dbac4409d2b9b5ad36c4f6b537b6b3377d70d9
+SHA1 (patch-components_printing_renderer_print__render__frame__helper.h) = 4b030821c4312185b5c0d28eb11de359ee705873
+SHA1 (patch-components_remote__cocoa_app__shim_BUILD.gn) = 8b0983950a8d902b1a61281d7d51553e2f77bac5
+SHA1 (patch-components_remote__cocoa_app__shim_application__bridge.mm) = 0e9cfbd4a9dd24f1b8bd137230758ecd10c09d78
+SHA1 (patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm) = 4524017ac6c16c2a411ea38067c96a5985411a36
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm) = 4be54da04a872cb6c940e60526a725a8eb61453f
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h) = 12392eeaecb24e4466d612ee8a975cf3bb1c6d55
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm) = 97f24f0178cfb70b0511de65b5a6228f02e4d875
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm) = 49aab39829ed409ea5a7867129aa542544be0835
+SHA1 (patch-components_safe__browsing_content_common_file__type__policies__unittest.cc) = 1028f04edef95adfbaddf6427ef3a5c98966171a
+SHA1 (patch-components_safe__browsing_content_resources_gen__file__type__proto.py) = 5fd19480f3faf995bcb4c093488c2de943c69e8b
+SHA1 (patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc) = 3bb904852caec4c95f83530794eb802678e244ca
+SHA1 (patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc) = 8a4348ddc928996eb9ef8c7e306726f611abd829
+SHA1 (patch-components_safe__browsing_core_common_features.cc) = d41a9428387127d3786321d03f7b20c0e1ccd011
+SHA1 (patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc) = 6da2e81d1f25198b2e65af2c683685aa48c11eac
+SHA1 (patch-components_search__engines_template__url__service.cc) = 6cded5ccddb99dcead9f2724bd31c0f280f01456
+SHA1 (patch-components_security__interstitials_content_utils.cc) = 505eab52ed5dbd70deeef8ee43f9edd139aa73bf
+SHA1 (patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc) = a0769d80a761c57ba86613305859dd4706b28de8
+SHA1 (patch-components_services_on__device__translation_sandbox__hook.cc) = 430171793fcdd0b6d5a566bb1146dff7007ba0d9
+SHA1 (patch-components_services_on__device__translation_sandbox__hook.h) = e86b8c8424497dc5bdc4d6ec2f7841c9e809f4c1
+SHA1 (patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc) = 6021ec477b45f0560f6286aadaff7860bd7e77a7
+SHA1 (patch-components_services_storage_dom__storage_dom__storage__constants.cc) = dcdaf5964c39217f30534eec2f2b21d9999cc08b
+SHA1 (patch-components_soda_soda__util.cc) = a54ebf0dd657b55587aa7868cb18c74675a23325
+SHA1 (patch-components_startup__metric__utils_common_startup__metric__utils.cc) = 803d8dffa7a1a8a1195de1a61b068b25837865f6
+SHA1 (patch-components_storage__monitor_BUILD.gn) = e1e5c5cac446d3190e3025182286e28e58e46da4
+SHA1 (patch-components_storage__monitor_removable__device__constants.cc) = 1cc25165fd59ace4cf9805f2c6bd7dc5d0220bf8
+SHA1 (patch-components_storage__monitor_removable__device__constants.h) = c4e0f91c6b048e81889956b065607aa73a10e637
+SHA1 (patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc) = 9f228fd701d01951f8b1ed85bae1dbb4ba46e4e7
+SHA1 (patch-components_supervised__user_core_browser_supervised__user__preferences.cc) = d9b1fbf82cc31b22dae05aec2dea3612565df4e5
+SHA1 (patch-components_supervised__user_core_common_features.cc) = 895cfaf5a1d627ddba349795a70f71d64a3733a5
+SHA1 (patch-components_supervised__user_core_common_features.h) = 92b1100c49480e3810ca49b5e12aed58fd7ada17
+SHA1 (patch-components_supervised__user_core_common_pref__names.h) = f40f4aa41e12aea229885d543a19cb4e7321d36e
+SHA1 (patch-components_sync__device__info_local__device__info__util.cc) = 873b59aae945ea1ce5e1287354a835bee2f0798d
+SHA1 (patch-components_sync__device__info_local__device__info__util__linux.cc) = 5dd00ba090bc6c382a99b0ce0272d9128bc51fe0
+SHA1 (patch-components_sync_base_sync__util.cc) = b456f8ebf7456542e24e9516c295d60735c74b1e
+SHA1 (patch-components_system__cpu_cpu__probe.cc) = 4841ea3bc3bf500764a965270ebf35f6e45640f4
+SHA1 (patch-components_translate_core_common_translate__util.cc) = 3c2f81f08f6f167769e133fcd5d3852467828d59
+SHA1 (patch-components_trusted__vault_trusted__vault__connection__impl.cc) = 2d2a5083d17015a8b112e261a3a06b403c59db9e
+SHA1 (patch-components_update__client_update__query__params.cc) = 7f746dfdec864886425a8811b19ca5c147645b69
+SHA1 (patch-components_upload__list_upload__list.cc) = b5b414503f7ddcf3eb8a5d6961e49d59adff8669
+SHA1 (patch-components_upload__list_upload__list.h) = ce7a49088616bc29837e888a8a15c2a1d362e14a
+SHA1 (patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc) = 27ec637bfcb20cbfeb797a2a7f75e570ff9491db
+SHA1 (patch-components_user__education_views_help__bubble__view.cc) = 1d87d94ec8af6756de4915139240feaee00c70dc
+SHA1 (patch-components_variations_service_variations__service.cc) = cdeb655f1ba31f8966ed411eaf2417c94129371b
+SHA1 (patch-components_visited__url__ranking_public_url__visit__util.cc) = bfa6fafa6c6802f60c1bc1398466785dfc7f14f7
+SHA1 (patch-components_viz_host_gpu__host__impl.cc) = 498943232fb3fc866f790e573b007a4f10393d26
+SHA1 (patch-components_viz_host_host__display__client.cc) = 8f115ebb1d23a0a96823d247c9cb268c731a4e75
+SHA1 (patch-components_viz_host_host__display__client.h) = 0a2940d3d93d846c918d1aee7fd6f3464e539157
+SHA1 (patch-components_viz_host_layered__window__updater__impl.cc) = 962e09e361b9e7f32dd6a29d9c15389fba569341
+SHA1 (patch-components_viz_host_layered__window__updater__impl.h) = 0f519335803a8023229b3d635c6a3736cf050cfb
+SHA1 (patch-components_viz_service_BUILD.gn) = 949fc8de2f7ea906ccf4185c659eaa032b08cb85
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider.h) = 6b7e1c74460d6e3f547d8018d73c4eeb4e8ca8f7
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider__impl.cc) = a4e384e4c2d424229aa643a94ffc168234c7ba3a
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider__impl.h) = 3314141a4983d6e4c8cff18de7de284c9428904e
+SHA1 (patch-components_viz_service_display__embedder_skia__output__surface__impl.cc) = d4236630b7a02ca464963703301fdfe29aad9652
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__mac.cc) = a64c99994e8f7fa56ce43eb3cfeea59ceda70b5d
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__mac.h) = f6cc8a62e8bff28848497d5143ad2a2944f95ae0
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__proxy.cc) = faff2f06e2299b651054f964e0373033f39b46f2
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__proxy.h) = 93aae51ef8aac7e37301ca1f91f2951d74134487
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__win.cc) = 8497463b1029040f8aebea8b3795d3699e53de63
+SHA1 (patch-components_viz_service_display__embedder_software__output__surface.cc) = ccae45494f84d377045012bb79a6b70d05f44748
+SHA1 (patch-components_viz_service_display__embedder_software__output__surface.h) = 20996cc7c1e74f9328728a351937a7a46a47a1bd
+SHA1 (patch-components_viz_service_display_skia__renderer.cc) = cb3c80c5d47fcaa0d79f1ec33ebe022a9bd3cfbe
+SHA1 (patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc) = 09fd2d66484c34af0d2fb31ea4469b976ea66456
+SHA1 (patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h) = b5e81632d988b1087a1442ae5c05373f6bc62584
+SHA1 (patch-components_viz_test_fake__display__client.cc) = a333984379ca08a27df9734c996d695640a0d1ff
+SHA1 (patch-components_viz_test_fake__display__client.h) = 661eeeead4c070f040cb2b087abfa62654b6f91f
+SHA1 (patch-components_viz_test_mock__display__client.h) = ebd72d00b491f5d55e5e95a9606db7d12929a583
+SHA1 (patch-components_viz_test_test__output__surface__provider.cc) = f89c450705159a30097c76483191df92fc84acba
+SHA1 (patch-components_viz_test_test__output__surface__provider.h) = db529d8ec647654bd8dc013292669ec60e9ad18a
+SHA1 (patch-components_webrtc_media__stream__devices__controller.cc) = 1ff28686ec8d06a0b2ca1af3bc1c3bace2ae43ba
+SHA1 (patch-components_webrtc_media__stream__devices__controller.h) = da5bdc0db7c90da1c3581be64fd8ec08fcd61954
+SHA1 (patch-content_app_BUILD.gn) = a59a7023d257777e2e6078f88a81cfd501a5b6c2
+SHA1 (patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm) = eb7836144fae36bcfa4ace8238f36410b9d215d2
+SHA1 (patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm) = c4406af56eca8189c4b72a413073e0a8a3be2b89
+SHA1 (patch-content_app_content__main.cc) = e3749c5bf79092866f61c254ae5ad97667a6d069
+SHA1 (patch-content_app_content__main__runner__impl.cc) = 96ffc7aa72170fa197644e71c1bbb21a2a861bee
+SHA1 (patch-content_browser_BUILD.gn) = b6957455cd81a9a6c8e5ae50887eb12d5b43afab
+SHA1 (patch-content_browser_audio_audio__service.cc) = 603375207703fddc1b86a12b7c9e1960b321cd0e
+SHA1 (patch-content_browser_browser__child__process__host__impl.cc) = e82c9721e006b96774e0f9ed0eb62b360a0c8708
+SHA1 (patch-content_browser_browser__child__process__host__impl.h) = 40394fa6600105a893ff49add3b5fe6b3b4df078
+SHA1 (patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc) = 395771190f1e9e57a80f485c2395601df26b6b8e
+SHA1 (patch-content_browser_browser__main__loop.cc) = 0850dbeba8cd334029d7d6805a00a981241cd37b
+SHA1 (patch-content_browser_child__process__launcher.h) = 1ef9452d56064d613338ff3bf733b2a914bf1314
+SHA1 (patch-content_browser_child__process__launcher__helper.h) = cbf10507c96ec3681d4e5639666c34c67fc3187b
+SHA1 (patch-content_browser_child__process__launcher__helper__linux.cc) = 14092e82977a619d2373dbe8d25ece35f9586b33
+SHA1 (patch-content_browser_child__process__launcher__helper__mac.cc) = a1c071b3501f8b56f91a0cfd92dc95a663c7db54
+SHA1 (patch-content_browser_child__process__launcher__helper__win.cc) = 30240cdafc700f29996e1e02d04d4c537911e7c2
+SHA1 (patch-content_browser_child__thread__type__switcher__linux.cc) = f598f57157b6a43f8fab800ab7e8dbfc9c1fbce0
+SHA1 (patch-content_browser_code__cache_generated__code__cache.cc) = c67e6f604a85d61a6831dbf965ab198f641d726a
+SHA1 (patch-content_browser_code__cache_generated__code__cache.h) = 54e28f3778cec9a12d3c35bcbe02944c2121d799
+SHA1 (patch-content_browser_code__cache_generated__code__cache__browsertest.cc) = 0dbad09f70bc06538abbb9c596d15d842c8eccc7
+SHA1 (patch-content_browser_compositor_viz__process__transport__factory.cc) = 018267126e63380a5d93369c0fceaec3c1c00d8a
+SHA1 (patch-content_browser_devtools_devtools__frontend__host__impl.cc) = fc5296a67607b399913cf1cc73e672291094c6e2
+SHA1 (patch-content_browser_devtools_devtools__frontend__host__impl.h) = 1d6df5f05eb48e9edc7549ed413da925f6180963
+SHA1 (patch-content_browser_devtools_protocol_system__info__handler.cc) = 19098b3b48a3111b675fe97f40eff331756a865d
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h) = 75b94ba17f3749d12e99eee71de6b2fc7fc05b69
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc) = e4836e108f8a0f502153b6aa5677b91501432ea0
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h) = 5dfdd57548145a4eb9ee3009096b500b53c0f987
+SHA1 (patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc) = 79896533ffa45e5d372290e9697f82b3ca977e38
+SHA1 (patch-content_browser_font__access_font__enumeration__data__source.cc) = 91045ed1900ec33b188d379f670ec1802d6a1abd
+SHA1 (patch-content_browser_gpu_compositor__util.cc) = 6bba6c6d4ed39284ff35661e433bd4791f6ccef1
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl.cc) = 43909ceb96dbbf3b5e3ab57a4d3c00982c805f99
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl.h) = 4b45dfc1fbf08181ebd5a6d507953033d46af16a
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl__private.cc) = da7d6380c7a4e11a7b11274e08440dc61721383c
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl__private.h) = f68fe33710b6dcf41930067336a2fd79a70937e4
+SHA1 (patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc) = cde43eb337a6689fb3476c91a9997d289ad7d028
+SHA1 (patch-content_browser_gpu_gpu__process__host.cc) = c8ef8db64480d404ad6ba6442847547cb70b6882
+SHA1 (patch-content_browser_media_capture_desktop__capture__device.cc) = 6c908f6210ed44a4bd9cba8051ebd3ccbfc2fa46
+SHA1 (patch-content_browser_media_capture_desktop__capture__device__mac.cc) = b89edab7877ddca98405af116faf211f33fc16ad
+SHA1 (patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc) = 91c4e5c0f14eaae0cddd5d3b6a7b2fe7e43f4306
+SHA1 (patch-content_browser_media_capture_io__surface__capture__device__base__mac.h) = a373b796b880791d863c7d72679db0299078d16a
+SHA1 (patch-content_browser_media_capture_screen__capture__kit__device__mac.mm) = c588f19868b4a2963ce7804536ad46deb32bb800
+SHA1 (patch-content_browser_media_frameless__media__interface__proxy.h) = 9f094907e815ca44303d85cdc6a4113734ce15c4
+SHA1 (patch-content_browser_media_media__keys__listener__manager__impl.cc) = 6e3940fbd34f2397539a2d4874aa09cfd95f3c89
+SHA1 (patch-content_browser_network__service__instance__impl.cc) = 525ad24fd9951728f8016ea881489f3dd1ab8bd0
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl.cc) = 059a9f9b10d599f85d4bc37b59d1c7d5b88861ca
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl.h) = fe450d1d795f0dc75a06248c8a153f8201e805d3
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl__unittest.cc) = 7d5616b8d504d7ae9363a1c63a2a8272124cb3c2
+SHA1 (patch-content_browser_notifications_platform__notification__context__impl.cc) = 2b1973c4ed12408d877883b7c1bc0d5976fff5db
+SHA1 (patch-content_browser_notifications_platform__notification__context__impl.h) = aefa21d6d287dea0642c015dbcbb56de7591d214
+SHA1 (patch-content_browser_permissions_permission__controller__impl.cc) = 449956c7d37c50134b07a7ba7971ac3f0dec86da
+SHA1 (patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc) = 38ed481d5d92c7a7d22733580b33112a175c7c21
+SHA1 (patch-content_browser_renderer__host_code__cache__host__impl.cc) = 8af4415d08487d80d6153c8e9ecd0cc8571a828b
+SHA1 (patch-content_browser_renderer__host_delegated__frame__host.cc) = d92319594df72c1681c3c3b751d1ab68fdd803f0
+SHA1 (patch-content_browser_renderer__host_legacy__render__widget__host__win.cc) = 70b22ea70e7fdb7e31b1189f95cccfdaacc3adc8
+SHA1 (patch-content_browser_renderer__host_legacy__render__widget__host__win.h) = 97cc1386ecb63b06f815e4e42d5872a33c7da301
+SHA1 (patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc) = 1a29a971846329b83870fdd69c46a6586163cd56
+SHA1 (patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc) = f6620e04c78e88101782857d19ccbcfa1fcc0529
+SHA1 (patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc) = b03b5d3661b957d0434102c3aad2aaca2895d6b2
+SHA1 (patch-content_browser_renderer__host_navigation__request.cc) = 2b6ccdeb179cf7bd844a5892d14b97d061edb78a
+SHA1 (patch-content_browser_renderer__host_navigator.cc) = 38dd46b43b65c98a5c0baf5edd0870a15aa0dcc7
+SHA1 (patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc) = 2d6cc7c31cf166695484de6a40ec53e9f0141860
+SHA1 (patch-content_browser_renderer__host_policy__container__host.cc) = 73d1e47a25ca7a8cd58688d46796aeec64c2c218
+SHA1 (patch-content_browser_renderer__host_policy__container__host.h) = 2841d218d579e8d2220de10def342ca1d8f05401
+SHA1 (patch-content_browser_renderer__host_render__frame__host__impl.cc) = 263f6a29106351edccfd10736c54e58ed0742daf
+SHA1 (patch-content_browser_renderer__host_render__frame__host__manager.cc) = afd87cad263faad159c1ef516cbfa6dfb63595de
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl.cc) = 333c3eee3e0969a69b83064e05708dc202a4ee35
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl.h) = 2bdd726f84eb135d64b7195574c1fcef76066d3a
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc) = 5e34e68ee5b78f2680ffffcc302fd57afda5c83b
+SHA1 (patch-content_browser_renderer__host_render__view__host__impl.cc) = c6d9db60034f5b4582eaa22486a381fd3a5a0093
+SHA1 (patch-content_browser_renderer__host_render__view__host__impl.h) = 5628f88503c133a953a5baa5119e2d88f252bab5
+SHA1 (patch-content_browser_renderer__host_render__widget__host__delegate.h) = 9eab35a611d85eded16960f965a593ddfc6bac1d
+SHA1 (patch-content_browser_renderer__host_render__widget__host__impl.cc) = 0409f872f7502749220c12b8b47298176b952361
+SHA1 (patch-content_browser_renderer__host_render__widget__host__impl.h) = 0f2d792a4dafc989672d232c8aba5ce9905989df
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__aura.cc) = 6fdb160aaf93860201a883efbdd99ccf025c7385
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__aura.h) = 4777ac14f740b4e7d533fa30c2bbedb86480dacb
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__base.cc) = 92a27223a2e77524a545844dbd0c27a23be20d59
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__base.h) = 0464f700a5f6a78fa764198687b06038d10e7f37
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc) = ed723d9232145f45d7e3b8657c422aa76e941f97
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__mac.h) = 00634ca24d73f89fb5f9342985e247df34f44558
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__mac.mm) = e3df4a344db299b0a154dd64b267d36fe0be6cfb
+SHA1 (patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc) = 92a1299361861eccd5ea092b1276cb17a12cb3a7
+SHA1 (patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h) = 5b2c5424535118aa36d40ddc190c944598f82351
+SHA1 (patch-content_browser_renderer__host_text__input__manager.cc) = 4ab20f962c2b582ac09a45a61fe3b930ee7d0363
+SHA1 (patch-content_browser_renderer__host_text__input__manager.h) = 673d279a5bdac5e4d2ab1ad791cb2f0d8a0277f0
+SHA1 (patch-content_browser_sandbox__host__linux.cc) = 7a48d6642a0aca488016d0f4692aae88cb0a2b8a
+SHA1 (patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc) = e5384681169a08d60390cc64a924becd44e1af31
+SHA1 (patch-content_browser_scheduler_responsiveness_native__event__observer.cc) = c96524df3f55dec403caa1564e194b8b125dcf91
+SHA1 (patch-content_browser_scheduler_responsiveness_native__event__observer.h) = 0f6c778f5d5807735e6cb43f6835e5ca9f123fdc
+SHA1 (patch-content_browser_service__process__host__impl.cc) = baaac1e0aec59930c6a17ff289ff3357686e4dfa
+SHA1 (patch-content_browser_service__worker_service__worker__context__wrapper.cc) = 06966fec7f62995b249f3b0c4c230bd5a8c83145
+SHA1 (patch-content_browser_service__worker_service__worker__registry.cc) = c17219fe25c47941bbe99260f7f9743d73fe13af
+SHA1 (patch-content_browser_site__instance__impl.cc) = 674e33ce0493180f3459cdae1b42423e28c041e8
+SHA1 (patch-content_browser_utility__process__host.cc) = ad4fcbec7fca8161eb2a30e6aa39a5387ad11a97
+SHA1 (patch-content_browser_utility__process__host.h) = 305f07903c3658ab93a0017e59d0c1901c0459cc
+SHA1 (patch-content_browser_utility__process__host__receiver__bindings.cc) = 913d8d8e7791018abdf36a2a21a67ba0fbce5daa
+SHA1 (patch-content_browser_utility__sandbox__delegate.cc) = 402ead01943927669004de2e7572e16403525e81
+SHA1 (patch-content_browser_utility__sandbox__delegate.h) = 31e5f90d3bece6affe84dd3698dbade092527cd6
+SHA1 (patch-content_browser_v8__snapshot__files.cc) = 79e049c85b2d02b8ca4249c193b2e052fa94789b
+SHA1 (patch-content_browser_web__contents_slow__web__preference__cache.cc) = d9a1214cb3ac84f3a7f1e2510e4fbb29de6acfe3
+SHA1 (patch-content_browser_web__contents_web__contents__impl.cc) = b26528bfc6a1056079c7c8e2f116e4d905cf2bd0
+SHA1 (patch-content_browser_web__contents_web__contents__impl.h) = cb5a2eaa12d94ddfab1c45031e7866b6f060982a
+SHA1 (patch-content_browser_web__contents_web__contents__view__aura.cc) = e20d002d10a73098ea05fdaff3567ddfc9ece45c
+SHA1 (patch-content_browser_web__contents_web__contents__view__aura__unittest.cc) = 3afbc32a1327f21ea9c59263af22dbd460ac1293
+SHA1 (patch-content_browser_web__contents_web__contents__view__drag__security__info.cc) = 952cb4b0cd069dc2768b63e7a95d191ca6da8230
+SHA1 (patch-content_browser_webui_web__ui__main__frame__observer.cc) = 5b5561ad14ef4f1ded1ad9ae4199e65ddba4ed00
+SHA1 (patch-content_browser_webui_web__ui__main__frame__observer.h) = b6010a57ada8d794685a018db228b2a7e59e056e
+SHA1 (patch-content_browser_zygote__host_zygote__host__impl__linux.cc) = c23a8c9573f1df1ef0f63a89a48c9faddd651418
+SHA1 (patch-content_browser_zygote__host_zygote__host__impl__linux.h) = f2e508dca92b81d2ab23be207c17b3e3f1b863be
+SHA1 (patch-content_child_BUILD.gn) = 7c3f8867f7f115e56745a3a90acf64d762d52239
+SHA1 (patch-content_child_child__process.cc) = 7a1ca32e8ffbe07428638c9fa5cd79e443cd6b31
+SHA1 (patch-content_child_child__process.h) = f8ffb1c4576ec65fc0c4ad4895481be6ee7b8a47
+SHA1 (patch-content_common_BUILD.gn) = 16bbd2d2bec20c52be061412422cacd8a68498cb
+SHA1 (patch-content_common_features.cc) = df3869d787685bdc9eb3f4acb7ff136959578726
+SHA1 (patch-content_common_features.h) = e4e8234445027920a41e26174f772575e6fcd477
+SHA1 (patch-content_common_font__list__unittest.cc) = 20c2b37a2bc34d5c04d0468f998b0a39e33ec756
+SHA1 (patch-content_common_frame.mojom) = e05772da2cf194759b278caa94c6df3095933e7f
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__bsd.cc) = babfb964e9ba10066079ee68f82fec5f183f8f6f
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__bsd.h) = 62b500a55577c8954bd66af44b7afb4ec55790c7
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__linux.h) = 021a4fbdf64494a6d240e977d2a09c704d7814e0
+SHA1 (patch-content_common_sandbox__init__win.cc) = e6d3055d4751f85f123adf6fa12f6f2ef4eaeeed
+SHA1 (patch-content_common_url__schemes.cc) = ba44f054986b87690c1df1321f67486b03888e69
+SHA1 (patch-content_common_user__agent.cc) = 4aae7cad4a5f52aae1e32116fd7485642928e003
+SHA1 (patch-content_gpu_gpu__child__thread.cc) = 245351ea389591e2f2e5a35adebcc13d918fa061
+SHA1 (patch-content_gpu_gpu__main.cc) = 36c5464d6afe481e552ebec66626f3437ca3611f
+SHA1 (patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc) = b4578d6a04c819a9234e6b3e42e2e0064b76d8e7
+SHA1 (patch-content_ppapi__plugin_ppapi__blink__platform__impl.h) = 292a049e9f44b81d6e57a21a5f4bb3d4d78f51fb
+SHA1 (patch-content_ppapi__plugin_ppapi__plugin__main.cc) = 0985abd8e7b1d273a85e9b739ff74dd05cbfcf30
+SHA1 (patch-content_public_app_content__main__delegate.cc) = fbbf0939f8806339e9773859e076e8970c3aa86c
+SHA1 (patch-content_public_app_content__main__delegate.h) = 611d1a2d08526e8c02ae4b4090c6de0a7b9ecc3f
+SHA1 (patch-content_public_browser_content__browser__client.cc) = 5e23a25535aa6743142b8481c52f9a4ee9b5195f
+SHA1 (patch-content_public_browser_content__browser__client.h) = 3d449b10b34ad5ed6e967fadd6ddc947a5ef1084
+SHA1 (patch-content_public_browser_desktop__media__id.h) = 1687a4b2b63e34ea6807b39186932ee62cd58487
+SHA1 (patch-content_public_browser_platform__notification__service.h) = 70f5be962875ab41a329e044ea148a114225115a
+SHA1 (patch-content_public_browser_render__view__host.h) = ee00b66d55da49eac3c9ea71d6b086fd773de7be
+SHA1 (patch-content_public_browser_service__process__host.cc) = 78ad248b07ebb2a7e949967787aa584678d9034a
+SHA1 (patch-content_public_browser_service__process__host.h) = cd33ead6124a743869e647af3b4ba4c30c449123
+SHA1 (patch-content_public_browser_service__process__info.h) = fb944c02faacd72da122b5478c25f81cba3272f6
+SHA1 (patch-content_public_browser_web__contents.h) = 309a134ab09dfd6913e99c9d61a17f82e24fb8f4
+SHA1 (patch-content_public_browser_web__contents__delegate.cc) = 6d427aee6f7c39d2e365b358fabc8a1d760f3823
+SHA1 (patch-content_public_browser_web__contents__delegate.h) = 09fd8bf083549fbe32845fb504a437317a0b7ee3
+SHA1 (patch-content_public_browser_web__contents__observer.h) = c69104b61e602f376bbe9fff3dcc675865879db9
+SHA1 (patch-content_public_browser_zygote__host_zygote__host__linux.h) = 81831fb3e2c12db4ad34a5932ecff31f49079c00
+SHA1 (patch-content_public_common_BUILD.gn) = 41f93b950d0e7ec2b461dff1a68aa1b1fea6da07
+SHA1 (patch-content_public_common_content__client.h) = 01740b82615266a914b61b13b67816dc63213c2e
+SHA1 (patch-content_public_common_content__features.cc) = dd6e5020c475afd29395e29d7a6aa76d30d3850e
+SHA1 (patch-content_public_common_content__switches.cc) = 743f037687f5ee4402e7ab8a935eaff414805c9f
+SHA1 (patch-content_public_common_content__switches.h) = 8617180db03bb2a3fb0931f3003b91d76eaaa250
+SHA1 (patch-content_public_common_sandbox__init__win.h) = 8972ddaa76f925470a99eb7b0cdab2e065a6ca6e
+SHA1 (patch-content_public_common_sandboxed__process__launcher__delegate.cc) = a235432ef62ada12dda14416917e9629ef550386
+SHA1 (patch-content_public_common_sandboxed__process__launcher__delegate.h) = d103dcceec7f20aa97cf45e91aa753a49c0b0606
+SHA1 (patch-content_public_common_zygote_features.gni) = fb71fd4474b46fd23d4be963811787b214881880
+SHA1 (patch-content_public_gpu_content__gpu__client.h) = 73f409f0f724d2393cbdc8ccee840bce713b45b8
+SHA1 (patch-content_public_renderer_content__renderer__client.h) = e2fbc49b3e704e5da9ec9cb82c6a47c7a3c5bdbc
+SHA1 (patch-content_public_renderer_render__frame__observer.h) = d303fc4132730319b168ce42232180cc3947aa5a
+SHA1 (patch-content_renderer_BUILD.gn) = cdc0a567344df0056694d3fab2f135b61ed3b7b3
+SHA1 (patch-content_renderer_render__frame__impl.cc) = a28cc2068df1f0d8dc2da6890ae04af58d5b0741
+SHA1 (patch-content_renderer_render__frame__impl.h) = 13f5970f93bafb061ca46c23499b7da47998d71d
+SHA1 (patch-content_renderer_render__process__impl.cc) = 009d2197586036ae545c6e0ff41f871f404a6aa5
+SHA1 (patch-content_renderer_render__thread__impl.cc) = f4b66064703b2a5fc7cebaa0a500678ab66245b9
+SHA1 (patch-content_renderer_renderer__blink__platform__impl.cc) = b86bb3e704356b8e651d6b1244a961829d25d405
+SHA1 (patch-content_renderer_renderer__blink__platform__impl.h) = 72e184877e2ed193e6bc332d9816c4bfea61b497
+SHA1 (patch-content_renderer_renderer__main__platform__delegate__linux.cc) = 2d12ffea899ef8895b3ec02a35e69aea3fb6354d
+SHA1 (patch-content_renderer_renderer__main__platform__delegate__mac.mm) = 910159243c3e5e84238a5af115a10d06a2c03510
+SHA1 (patch-content_renderer_theme__helper__mac.mm) = 530b0c6f05eff0ebddc3ff7c51f0df3afe3b7264
+SHA1 (patch-content_shell_BUILD.gn) = c1947d8a672675b9dc7d37f9fb2293efa61d86e0
+SHA1 (patch-content_shell_app_shell__main__delegate.cc) = 11a85c794af2402e84a29efdfd739dfc27e34d86
+SHA1 (patch-content_shell_browser_shell__browser__main__parts.cc) = f59b622a86f4c21ae9fc34ff477b38178c104fb2
+SHA1 (patch-content_shell_browser_shell__paths.cc) = 93cdbd715dd82a2f871186ab9da71da26402a8ca
+SHA1 (patch-content_shell_renderer_shell__content__renderer__client.cc) = 1c0cac47a96834f5cacab0b143b9ff2294e04275
+SHA1 (patch-content_shell_utility_shell__content__utility__client.cc) = fa9ce3cef1a5343f510c0b6850071a75cdf4c47f
+SHA1 (patch-content_test_BUILD.gn) = 2441d8fd0842510b091fab1bb1176d21fcefce7a
+SHA1 (patch-content_test_mock__platform__notification__service.cc) = bf21b1f0b4d57021cdf191be5390b0a280561e3f
+SHA1 (patch-content_test_mock__platform__notification__service.h) = 07f04d0d97c07bf5bd1f86785f3f5922cf97fd6c
+SHA1 (patch-content_test_test__page__broadcast.h) = 43c18deaa79a70f1cf8b414d41596c08db03add5
+SHA1 (patch-content_utility_services.cc) = a0b2c8943db22ae743d512d19b5ea1c7e65b3dd0
+SHA1 (patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc) = 23eca0fd2dbe0efb11ddfddcb498e1a38a0dad22
+SHA1 (patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h) = b70dce7f7c25eeef756561759a02dbe40ac53a44
+SHA1 (patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc) = a1fb60f64bd74d20b76c49e3576236b83f1be3ab
+SHA1 (patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h) = 2891e1c7af2bb2d3a55d17a025449e08f3a47c3c
+SHA1 (patch-content_utility_utility__main.cc) = 378423cfb0e2fd9bba3a6a26ee09116f0c3521d6
+SHA1 (patch-content_utility_utility__thread__impl.cc) = eaeaf1a0df29a352f45e8eea215fa284191b065e
+SHA1 (patch-content_web__test_BUILD.gn) = a718c05bac6584797b498060a168f70408180c51
+SHA1 (patch-content_web__test_browser_web__test__content__browser__client.cc) = 875b62e79f281fbb1d398709914ae94b9cffd448
+SHA1 (patch-content_web__test_browser_web__test__content__browser__client.h) = 80d664c9e80fe23a0bb9ed79ffca18d59414c294
+SHA1 (patch-content_zygote_BUILD.gn) = 332f49c58e36b687e2b030e01b0811d6e24d2230
+SHA1 (patch-content_zygote_zygote__linux.cc) = 5900b619647e67d9f0ca9e3564605838ac321001
+SHA1 (patch-content_zygote_zygote__main__linux.cc) = 40d1da2d2626ee86ffec7931a64b0dda80d9a7f9
+SHA1 (patch-device_bluetooth_BUILD.gn) = 85cc5ce8fc11c945948e05efb02bba80def3a854
+SHA1 (patch-device_bluetooth_bluetooth__adapter.cc) = 16ea7a49dd2789481121cb9b29ffd937b1b479ad
+SHA1 (patch-device_bluetooth_bluetooth__adapter__mac.mm) = 162a596ea51c5c928090d40f11878f504af92fca
+SHA1 (patch-device_bluetooth_cast__bluetooth.gni) = f01547cf47e948395400bd85af4f080d151d1f8f
+SHA1 (patch-device_gamepad_BUILD.gn) = 73000269e2b21c4b97f8485ae63cb97990b65b0b
+SHA1 (patch-device_gamepad_gamepad__provider.cc) = 95a063cfd076f2e02287f1999349696b9e7c66f5
+SHA1 (patch-device_gamepad_hid__writer__linux.cc) = 9fa3045fb39d43590a63155229b1234b852f7413
+SHA1 (patch-electron_BUILD.gn) = 4df0584638ec836afaf921e43b9b1a6d795ed88b
+SHA1 (patch-electron_build_args_all.gn) = efd8724c7acaed447341c27bbca8004fac8684ed
+SHA1 (patch-electron_build_args_release.gn) = c116f639dd0e49559f5ab6d6f04818461c075397
+SHA1 (patch-electron_default__app_default__app.ts) = 8fca4ba9804f75625a424e3eca2c8e3c0ec23e6d
+SHA1 (patch-electron_filenames.gni) = 55c2b3d0f7805ec2fa999e3c4c45ec6a4e6a8211
+SHA1 (patch-electron_lib_browser_api_app.ts) = 0d25d3ca3b411b7990579e86138e5ca2bbec985c
+SHA1 (patch-electron_lib_browser_api_dialog.ts) = e556b11a949bc9a340c7bb5fb18c8f7a4bd2f273
+SHA1 (patch-electron_lib_browser_api_menu-item-roles.ts) = 3f243029486ae3668c971952fac0e3898fe45f78
+SHA1 (patch-electron_lib_browser_api_power-monitor.ts) = 91bcd0cdf4159a72d828a1b0cd454ed7744235ac
+SHA1 (patch-electron_lib_browser_init.ts) = f496933ca96df9b7d357c31b47322b18334cb03c
+SHA1 (patch-electron_lib_browser_rpc-server.ts) = 0cfe991de0dcd71e1ac7cc01010d41866876f217
+SHA1 (patch-electron_lib_renderer_api_clipboard.ts) = c07e0f889a79727160f85119d453bc51e5b712fa
+SHA1 (patch-electron_script_lib_config.py) = 23208c03556ce1b3d9127fb20da3b59581a6f6fc
+SHA1 (patch-electron_script_lib_utils.js) = 3938fc9e99a72ee7205a1fcd99bff78d537fd90e
+SHA1 (patch-electron_script_spec-runner.js) = 267f00fda81ab8a04e6c92bef050af0afee75221
+SHA1 (patch-electron_shell_app_electron__crash__reporter__client.cc) = 44de887fff4ee405da5e67ca528eb6077428935f
+SHA1 (patch-electron_shell_app_electron__crash__reporter__client.h) = 5513f9d62fb998ab7b907acc74b2bb99dd2dedce
+SHA1 (patch-electron_shell_app_electron__main__delegate.cc) = 50b33a1df841e114d751adb04a4dd11b3ca4c618
+SHA1 (patch-electron_shell_app_node__main.cc) = ad2cb505a4f726d8e4e23f06660a2dc2e8f0f6f4
+SHA1 (patch-electron_shell_browser_api_electron__api__app.cc) = d1edecaee947ba1c44fc217f557fb05b3e59d081
+SHA1 (patch-electron_shell_browser_api_electron__api__base__window.cc) = f152f519ace72b51cdf69d0f425250d747840f59
+SHA1 (patch-electron_shell_browser_api_electron__api__base__window.h) = 843f89f5ba2e8457313be36e300e178eda5a7392
+SHA1 (patch-electron_shell_browser_api_electron__api__crash__reporter.cc) = 5ae0c677bd0952afe998ce30eceb23e8828cc553
+SHA1 (patch-electron_shell_browser_api_electron__api__desktop__capturer.cc) = 3501d17de905bdf4b750bb9e8d5c1793f3b5a1d0
+SHA1 (patch-electron_shell_browser_api_electron__api__power__monitor.cc) = b3ed78f50220c21bfba43c4dc4d1c76f995e791a
+SHA1 (patch-electron_shell_browser_api_electron__api__power__monitor.h) = bb5673d29e5b855df86606a76cf28c5d7528c568
+SHA1 (patch-electron_shell_browser_api_electron__api__safe__storage.cc) = 4983fae80bae554406c477d12310e18feacd5b4b
+SHA1 (patch-electron_shell_browser_api_electron__api__web__contents.cc) = db4a8396df31e16041e0c3998423aefe6f2bff02
+SHA1 (patch-electron_shell_browser_api_electron__api__web__contents.h) = d71c9e18aee6f315d9e707ed1c33bab3b7c5087b
+SHA1 (patch-electron_shell_browser_api_process__metric.h) = 74761b3d9ef7ffe15a220dbee3349cb350ca5c40
+SHA1 (patch-electron_shell_browser_browser.cc) = da5f6de8482bb684f875ee0d56817fea3a4b8006
+SHA1 (patch-electron_shell_browser_browser.h) = 97bba477f7fd7559d8d9df9ffa253bd2ab212d31
+SHA1 (patch-electron_shell_browser_browser__linux.cc) = 43c85b3af0b00275b735f16ee0d0fe85c892b829
+SHA1 (patch-electron_shell_browser_browser__process__impl.cc) = a1702c634edbb8028a3bf9db1b02792028675508
+SHA1 (patch-electron_shell_browser_browser__process__impl.h) = c03a5a121fdee7a2c45429b7fac24fa38eccdbe2
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts.cc) = d56654a25eb9761e002a8c4d82fafd023a31b1c5
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts.h) = cb9d9feef5ae3df1c3a72e9851fe1718828ee15f
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts__posix.cc) = 2eef11f6561774e60abc44d0226ddce71979ae49
+SHA1 (patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc) = 405dd78f63e2dcb652d6430608ed6b5f30e130a0
+SHA1 (patch-electron_shell_browser_native__window.cc) = d4ee0f15313f02f689119cdb90fae09c56969000
+SHA1 (patch-electron_shell_browser_native__window__views.cc) = 8438b3862dd82d2f89bad8c162ada36539b602c3
+SHA1 (patch-electron_shell_browser_native__window__views.h) = 72063a03040739c3b3ddf0ddc48a89fac1519f3d
+SHA1 (patch-electron_shell_browser_net_system__network__context__manager.cc) = 90773bc6206bf3a9d61ae47b930f7858df4592d3
+SHA1 (patch-electron_shell_browser_osr_osr__host__display__client.cc) = 7844c39ff8840094bc096559c632fded9fe622ba
+SHA1 (patch-electron_shell_browser_osr_osr__host__display__client.h) = 97f58acd4efadf16306b4a476544962d90e29a36
+SHA1 (patch-electron_shell_browser_osr_osr__paint__event.h) = d7fc8f21e35e760dbda5e71500481a22f6c77f7b
+SHA1 (patch-electron_shell_browser_osr_osr__video__consumer.cc) = 9b47e12328663d8a5b4a7a61d7f6c6ad10796592
+SHA1 (patch-electron_shell_browser_printing_printing__utils.cc) = 6da2042231040ee613ab6b7955881dfc83d4a4f6
+SHA1 (patch-electron_shell_browser_relauncher__linux.cc) = e6bff2e6c6701d0b9b5d1f8ec06a8ea62b6ddb63
+SHA1 (patch-electron_shell_browser_ui_inspectable__web__contents.cc) = 39eee2508571f6e9fa33b593bb0632d4376548c0
+SHA1 (patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h) = 4a7b4df16a1ebcf416756a8279cb26737327ded6
+SHA1 (patch-electron_shell_browser_ui_views_electron__views__delegate.cc) = 514edd38cfcf61a667ae7ea8330bf81fbfa89889
+SHA1 (patch-electron_shell_browser_ui_views_electron__views__delegate.h) = 76af15631ccb616cc04d538f90fc78a523d1d4f4
+SHA1 (patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc) = dec77f271295b7adec519e6cacab68caa3c8fe7f
+SHA1 (patch-electron_shell_browser_ui_views_menu__bar.cc) = bb4580d5d852afc751d43b46a2868cc5208a4189
+SHA1 (patch-electron_shell_browser_ui_views_menu__bar.h) = d3b2a4ad431544f15326c38275145f08c94d1529
+SHA1 (patch-electron_shell_browser_ui_views_submenu__button.cc) = bbac3aab6bd0be8450d6a5bcca8971227831dd8d
+SHA1 (patch-electron_shell_common_api_electron__api__clipboard.cc) = 36ffc0587556fb29a684afd49aca92898e2805e2
+SHA1 (patch-electron_shell_common_api_electron__api__native__image.cc) = e009ed1b79c6a4a7f5c5bd27cd1d59d559226a3e
+SHA1 (patch-electron_shell_common_api_electron__api__native__image.h) = 73379d95e4db649976904b60e66f7a21c0eea1ad
+SHA1 (patch-electron_shell_common_api_electron__bindings.cc) = 0703b508c47e218dec021ac472269f6bc0e47a67
+SHA1 (patch-electron_shell_common_electron__command__line.cc) = b9d3bc9ee71e4cf4aeef21dcf33eee9128f30a24
+SHA1 (patch-electron_shell_common_electron__command__line.h) = 99a8fb248162096ca50ad52e4460b24ddb29b849
+SHA1 (patch-electron_shell_common_electron__paths.h) = eadb5c99cf4313ef123969751ad78da389fbc142
+SHA1 (patch-electron_shell_common_gin__converters_osr__converter.cc) = 4a8ec9118bf28e7ffd20eea1c4079fbd57a77353
+SHA1 (patch-electron_shell_common_gin__converters_std__converter.h) = e9fd417bff679a7ab1b4ba02ab131f68d890c5e5
+SHA1 (patch-electron_shell_common_node__bindings.cc) = 6b9595ba34464a651617d738a327a37933602ae8
+SHA1 (patch-electron_shell_common_node__bindings__linux.cc) = 603cc6852299420421e75915d6376e8b86635f52
+SHA1 (patch-electron_shell_common_platform__util.h) = 24b2f8022e61145db74d6bb40ebfbbe0a91843d4
+SHA1 (patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc) = 499c9b48cdeabd24e9d410994a7506aa23a611ca
+SHA1 (patch-electron_shell_services_node_node__service.cc) = 614bee386b6ab8cc1bc7f9719eb1f70cfb7e378b
+SHA1 (patch-electron_spec_api-app-spec.ts) = d4eec5f9b5cb11da112c4318bf79fbec1aef98df
+SHA1 (patch-electron_spec_api-browser-window-spec.ts) = e08e7bff35640d41a6904317ae013af3b5eebb42
+SHA1 (patch-electron_spec_api-clipboard-spec.ts) = 4789179b63d5b3a6a72ca54eb8f430f908ea9b03
+SHA1 (patch-electron_spec_api-content-tracing-spec.ts) = 27bd25ebbd3883174cfcabc92d4cff5af35b4683
+SHA1 (patch-electron_spec_api-crash-reporter-spec.ts) = 00d1edc008e6ceeac1ece918a55d15710b06167f
+SHA1 (patch-electron_spec_api-desktop-capturer-spec.ts) = 14492c9e96f151894b13b9eba7a2746ad51b7515
+SHA1 (patch-electron_spec_api-menu-spec.ts) = de420eb82c3889dac303b6495afa0aa680963aa9
+SHA1 (patch-electron_spec_api-native-image-spec.ts) = 07c5bbf5e2a5289eff7d6252ef572d0673d62be7
+SHA1 (patch-electron_spec_api-net-log-spec.ts) = cc34f28faea2a9f7c441c4d40ca23d2489f61cdd
+SHA1 (patch-electron_spec_api-notification-dbus-spec.ts) = a5350d95a80cc4602515c35cae8f69938b35f910
+SHA1 (patch-electron_spec_api-power-monitor-spec.ts) = b7e8da7d18fe08ab78e33ab794827794c6e1d332
+SHA1 (patch-electron_spec_api-process-spec.ts) = 0ff4ffa730f5c15bbdc44deac32ff61d25f56741
+SHA1 (patch-electron_spec_api-protocol-spec.ts) = eea6969cca03a6e229d364c2713afe4961372559
+SHA1 (patch-electron_spec_api-safe-storage-spec.ts) = 52b654698e53fc3e713cfca9676a3cd5eb1989da
+SHA1 (patch-electron_spec_api-screen-spec.ts) = 131697ab42210011d08e3126aaae9fe011b4b85a
+SHA1 (patch-electron_spec_api-shell-spec.ts) = 9fe0aafead7a23c7b201bb47e68541605e91c43e
+SHA1 (patch-electron_spec_api-subframe-spec.ts) = 527ca45c6501792bfe32dd4f8c02670a05e18484
+SHA1 (patch-electron_spec_api-tray-spec.ts) = 0d522f39b8f9898e053eba48b4bc06ad033d1333
+SHA1 (patch-electron_spec_api-utility-process-spec.ts) = 00acac002bff2c9843cfd7faf31ae360f6808466
+SHA1 (patch-electron_spec_api-web-contents-spec.ts) = 9e8a68fbeb3af4c7e22df5320862582a353c0539
+SHA1 (patch-electron_spec_api-web-frame-main-spec.ts) = 0ea65928c562630b8778d26a5906794222b78033
+SHA1 (patch-electron_spec_chromium-spec.ts) = f5cdb4bbd4cd786758e28246a3a33068752635e1
+SHA1 (patch-electron_spec_crash-spec.ts) = e6b62a9d2904bb6701479e23e0531f9e947d4c34
+SHA1 (patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js) = 0fd0e44fa4b7782923a948de4015f5799e655346
+SHA1 (patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js) = d4d4db2228c95f883a3c9cf1480210970623d859
+SHA1 (patch-electron_spec_fixtures_crash-cases_safe-storage_index.js) = 98b04d94f45507ecbccddd275d21303637ef41fe
+SHA1 (patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js) = 662c182a09ed0fe6b05c711c5c3fc0e37f7f1fcb
+SHA1 (patch-electron_spec_node-spec.ts) = 413cda0a133b8dc7a4175bf84ca8c199b88c1998
+SHA1 (patch-electron_spec_version-bump-spec.ts) = 9eadd5c1769e4f00b934d8413baa705b8cbc54b9
+SHA1 (patch-electron_spec_visibility-state-spec.ts) = 558892e501379d7f594359f72908f1d03fe32971
+SHA1 (patch-electron_spec_webview-spec.ts) = 5178c5b34e6d248cfcb58eb2a11997e0d95ce77e
+SHA1 (patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc) = 510dce523fa6bc7e7d205e8ef28456d65355005e
+SHA1 (patch-extensions_browser_api_management_management__api.cc) = 00eb36eb1669b2ad2a55c44dddd449dde6a92bee
+SHA1 (patch-extensions_browser_api_messaging_message__service.cc) = 6f64b6a247880b2c01d1dfb46ae759b9797c29a0
+SHA1 (patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc) = 8c26454aff7659072605237a4a70cf9b440149a3
+SHA1 (patch-extensions_browser_guest__view_app__view_app__view__guest.cc) = e43a562de95955e902105f1ad3470c6538244fbd
+SHA1 (patch-extensions_browser_guest__view_app__view_app__view__guest.h) = a483f6fc57a5b8cf7a39b883095e0a6511a1ad60
+SHA1 (patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc) = 39483280c598e8ee9d05080b66add4a39bddacba
+SHA1 (patch-extensions_browser_guest__view_extension__options_extension__options__guest.h) = ccf36f0aaf2bb214d5ee3cc4e26978bd45847466
+SHA1 (patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc) = 1894fd7bc8c89deadff7177e21e4ed05253b1ea2
+SHA1 (patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h) = 059acae520ff80d26bb5975fdf6d155e8b1c5341
+SHA1 (patch-extensions_browser_script__injection__tracker.cc) = 2721dcdcc9603198a0ddecb4a3964d460a729c99
+SHA1 (patch-extensions_common_api___permission__features.json) = e789adfc95033412e173350ad046ea42c7d8eeca
+SHA1 (patch-extensions_common_api_runtime.json) = 8d7fe0a59f71a9cc6b64c9d7c5fb74442c71f4c6
+SHA1 (patch-extensions_common_command.cc) = 3934ddf5fddc8e5041a20ce1f9363eb033bc27d0
+SHA1 (patch-extensions_common_features_feature.cc) = 457d3aab18cec3e6a1a5cccac960d531f2da33fd
+SHA1 (patch-extensions_renderer_bindings_api__binding__util.cc) = 879046c9c1fd074a43de990a1520a1a9f6a8c3e9
+SHA1 (patch-extensions_renderer_bindings_argument__spec.cc) = a703b41d4771f1488670fd506a043b460c7948cb
+SHA1 (patch-extensions_renderer_script__injection.cc) = e05419fafe266a438614278e24de2c90cdeadb6c
+SHA1 (patch-extensions_shell_app_shell__main__delegate.cc) = 9830ecb4cf07982bac18739d9aa92e3bbe86f4cd
+SHA1 (patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc) = 3e5a08b2227121adcf58284b1d1dd7b4223fa82e
+SHA1 (patch-extensions_shell_browser_shell__browser__main__parts.cc) = 8e8d16f86d74d3b5f30ba9ce76a1a5cfaecf05bf
+SHA1 (patch-extensions_shell_browser_shell__extensions__api__client.cc) = 07f05452d0cb040545853285277ef033d60ff438
+SHA1 (patch-extensions_shell_browser_shell__extensions__api__client.h) = 8e3c3ebec57d598202e0b7f2d5249c7dd4dc0b9e
+SHA1 (patch-fuchsia__web_webengine_browser_frame__impl.cc) = 25b3539cfb0fbf7a1e83fdd73b8dbbca95c53251
+SHA1 (patch-fuchsia__web_webengine_browser_frame__impl.h) = 190003d4fd58df46b14c5bbae1f36544a1f1530b
+SHA1 (patch-gin_converter.cc) = a8e4b939c1c6ac3518d0c838727c67e3027db9e9
+SHA1 (patch-gin_converter.h) = 1ac6b82530b2b4affd07a096bfd0c8eedf8f1626
+SHA1 (patch-gin_isolate__holder.cc) = 2483fbd6b007a20eaf9ea4851dc78f68115213fa
+SHA1 (patch-gin_object__template__builder.cc) = 2593a372cbd68552d20d06bf5c77ebebdf836d21
+SHA1 (patch-gin_object__template__builder.h) = d0092a8b2ec436e5199a6977e3949cce2352e552
+SHA1 (patch-gin_public_gin__embedders.h) = c40bf028df94493582fa356255c81db399f921dd
+SHA1 (patch-gin_public_isolate__holder.h) = 80d8b9ead9fc75140f3f4a3d9c909dcf3dd88450
+SHA1 (patch-gin_public_v8__platform.h) = e41952be309561978693cbb04e8410f22bbf839d
+SHA1 (patch-gin_v8__initializer.cc) = 3dd33a8a6507b30ab9450c4bd8fa09691a5303b3
+SHA1 (patch-gin_v8__initializer.h) = 812cc436bdc30ca2df9bb3e2b9ad699e23eb4ff5
+SHA1 (patch-gin_v8__platform.cc) = e755ea471e7b48863818c84faeac4b472a040471
+SHA1 (patch-gin_wrappable.cc) = c22802eaef9c4f849647da190fc23c3e0d816ca1
+SHA1 (patch-gin_wrappable.h) = ec3eb481216370d28c8db885942bb6a7e4ec79db
+SHA1 (patch-google__apis_gcm_engine_heartbeat__manager.cc) = 62f832e9e3902b854043a4e12877f5dceadae1d7
+SHA1 (patch-gpu_command__buffer_service_dawn__context__provider.cc) = 11faddce2066d3d8ae0f58b8e41c515c984fe61b
+SHA1 (patch-gpu_command__buffer_service_gles2__cmd__decoder.cc) = 8360e50961b5077698e5876fcdcf1bc633b935ea
+SHA1 (patch-gpu_command__buffer_service_gles2__cmd__decoder__passthrough.cc) = 9d764a4ba034c1262fd9ec08e01477bc06e673bc
+SHA1 (patch-gpu_command__buffer_service_gles2__cmd__decoder__unittest__base.cc) = 9fe7b0e9e9667e32a9c83734f384da17447d87a8
+SHA1 (patch-gpu_command__buffer_service_shared__context__state.cc) = 650e15c6baf6c14b13763be95e594c7231c639e0
+SHA1 (patch-gpu_command__buffer_service_shared__context__state.h) = 8bab8359c06ad06a68212c22a77f40f7782fa76d
+SHA1 (patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc) = e2d9324660d00fda9490de922293ef6ac7a71a5f
+SHA1 (patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc) = c6e4b59fc892a9eb6cb2abc87387999ff32be96d
+SHA1 (patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc) = f04f9844ee6126ce60483622240f541a709213d9
+SHA1 (patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc) = 88cd2be166681177b09fea4eb6c0cfd6d9573430
+SHA1 (patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc) = eafc71748f74555064ddef8ee2480498cb4278b1
+SHA1 (patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc) = da8eb1405594fbda8a0471125fe9355c1ca29a96
+SHA1 (patch-gpu_command__buffer_service_webgpu__decoder__impl.cc) = 7d92a1dca7c619ab2cacb603bf79a1f4bf8bbd53
+SHA1 (patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc) = a21c0ed7efa241539bafc2f493b6fd801cdbe9c2
+SHA1 (patch-gpu_config_gpu__control__list.cc) = 2c69c4800e4ef1ac8ed649e42952c548c9ec2eea
+SHA1 (patch-gpu_config_gpu__finch__features.cc) = 9f1a244219ee4ff6c110f7282980d8152bbf28bf
+SHA1 (patch-gpu_config_gpu__info__collector.cc) = ed4b717a7108fb190a80294f1660bf589fd9cebb
+SHA1 (patch-gpu_config_gpu__test__config.cc) = a7e5f6bffd29f887eb8148eab1db270e050f5d3b
+SHA1 (patch-gpu_ipc_common_gpu__memory__buffer__support.cc) = 008d73d1bd0f3e9fcc1a92b548ccba2785b89678
+SHA1 (patch-gpu_ipc_common_gpu__memory__buffer__support.h) = 96294f0449f0c54119ca7f10e3294f3e9e7e3d45
+SHA1 (patch-gpu_ipc_service_BUILD.gn) = b15cb9f4436aab946d943c417d5121c35f65e6d3
+SHA1 (patch-gpu_ipc_service_gpu__init.cc) = 7d67ba76acf07e0e22d95143439747f78393aeae
+SHA1 (patch-gpu_ipc_service_gpu__memory__buffer__factory.cc) = 63ee8a589254fd64a2a84d950e2cf70dfeafa1d2
+SHA1 (patch-gpu_ipc_service_gpu__memory__buffer__factory__dxgi.cc) = 54e4e8c3e875579ac0385fda124a5a59a70c4866
+SHA1 (patch-gpu_ipc_service_image__transport__surface__overlay__mac.h) = b96bb62db83682aded52f89b9a31a61a3939a0e1
+SHA1 (patch-gpu_ipc_service_x__util.h) = b6fc2baf3de9c00347c09f21e6a0a836866f18d6
+SHA1 (patch-gpu_vulkan_generate__bindings.py) = 706d38709747bd4c62cd8499c14e716b51944ff0
+SHA1 (patch-gpu_vulkan_semaphore__handle.cc) = 88ebd19d44e833c47f197a59b64dde2eb8aa702e
+SHA1 (patch-gpu_vulkan_vulkan__device__queue.cc) = 5868d67f998e12a7471d8bdd3300c7e40ff5b19a
+SHA1 (patch-gpu_vulkan_vulkan__device__queue.h) = 425e3b2b59b8c591b0e7c9547a6a29430c284036
+SHA1 (patch-gpu_vulkan_vulkan__function__pointers.cc) = e47649e66bc6dc67f8da70f399980d962b9dd828
+SHA1 (patch-gpu_vulkan_vulkan__function__pointers.h) = 472a85afa96ebbb03235fec2bfb3b7debd66597c
+SHA1 (patch-gpu_vulkan_vulkan__image.h) = c1f2f8fcfb1646228517a21cc736a5211df717d1
+SHA1 (patch-gpu_vulkan_vulkan__util.cc) = af4df145a7dd8e08fa7284ce00b309704fd0f4aa
+SHA1 (patch-headless_lib_browser_headless__browser__main__parts__posix.cc) = 6a24eb7a409330a694ce4691a421f24ca8eec92a
+SHA1 (patch-headless_lib_browser_headless__content__browser__client.cc) = ad3db819f9ec8d6a021dfcdaf3deac086d569b35
+SHA1 (patch-headless_lib_browser_headless__content__browser__client.h) = d70b8d3c7f385240fc8fe43c7ddc329a10cab8b7
+SHA1 (patch-headless_lib_browser_headless__web__contents__impl.cc) = afe293962304876144e113c8d40b36b2e1f37af3
+SHA1 (patch-headless_lib_headless__content__main__delegate.cc) = b7ece72790ee7320b517bd5c7aec114d42d68f32
+SHA1 (patch-ipc_ipc__channel.h) = d12c3aac657ccbd711b6479ebc4cd31a104063fa
+SHA1 (patch-ipc_ipc__channel__common.cc) = 30b9cee016dec9f9c78cb7c9e4d8b9dab8342316
+SHA1 (patch-ipc_ipc__channel__mojo.cc) = d9ab8593e1a7782841a34fc250a0e7a4c27ca890
+SHA1 (patch-ipc_ipc__message__utils.cc) = 5deeb528abfed064129b9a73b49d2ba8119a2790
+SHA1 (patch-ipc_ipc__message__utils.h) = 26de8af36fb0ba5ed6a56c5e1fe2d7a45a49f801
+SHA1 (patch-media_BUILD.gn) = 0baad67e7cfb65d1d5a2d2e0d756794aab0149de
+SHA1 (patch-media_audio_BUILD.gn) = 4ee2cd128ffc7efecaa2f7b21a37141b09b1e190
+SHA1 (patch-media_audio_alsa_audio__manager__alsa.cc) = 0235d6b66cabe1296dbaf92252f6282d4e48e495
+SHA1 (patch-media_audio_apple_audio__low__latency__input.cc) = 91268e9f7af047caffc247c427fc85c79e4ba1ed
+SHA1 (patch-media_audio_audio__input__device.cc) = 0cbab6b89a973accdbc5c7697e9caa435eb48ded
+SHA1 (patch-media_audio_audio__output__proxy__unittest.cc) = f468b840202cbb5a26b71894b80f1a8c553640cd
+SHA1 (patch-media_audio_pulse_pulse__util.cc) = 5fe40fb5714d9bbbc339df4e7c381976694d4e8d
+SHA1 (patch-media_audio_sndio_audio__manager__sndio.cc) = 89a6c9325d8af0c85a2125588a15be0cfe977dcd
+SHA1 (patch-media_audio_sndio_audio__manager__sndio.h) = 74034b44210ce8dc684785cd20d854e63726524a
+SHA1 (patch-media_audio_sndio_sndio__input.cc) = 70b73c3dac3dccc61b0f15511951731f435f63bd
+SHA1 (patch-media_audio_sndio_sndio__input.h) = c72d84b730db17b3774b5efee26df036c55b8312
+SHA1 (patch-media_audio_sndio_sndio__output.cc) = 35424443e5f2bcda9be29c7dacecd28a4f3f4714
+SHA1 (patch-media_audio_sndio_sndio__output.h) = eb9c4b83fc0a7807ab89f641486a1b27c22dc4e1
+SHA1 (patch-media_base_audio__latency.cc) = be0c1fee18e5cf2ac6405fc9e39ce025216fc40a
+SHA1 (patch-media_base_libaom__thread__wrapper.cc) = 20f29fc0b3c2f00dd51e2bac33a10e9396130ef0
+SHA1 (patch-media_base_libvpx__thread__wrapper.cc) = 4aa8b18f2aa9713ba46c8e9868db627a07883bf8
+SHA1 (patch-media_base_media__switches.cc) = a7411e1169a608a7f15832ddb68287312ab01faf
+SHA1 (patch-media_base_media__switches.h) = 4301d6e25c72172e853a2267b59330e9af1fb628
+SHA1 (patch-media_base_user__input__monitor__unittest.cc) = 1cfc18a65072688621bb2464c51e4fd96fe76818
+SHA1 (patch-media_base_video__frame.cc) = 368e23f4be3cb727ca3e69df5adcb81572f14489
+SHA1 (patch-media_base_video__frame.h) = bda73183ad4c346ec78f0fa2b3e226b480f7da79
+SHA1 (patch-media_capture_content_video__capture__oracle.cc) = 64fb920e7c078d06e7a646989881ef124f4997d0
+SHA1 (patch-media_capture_content_video__capture__oracle__unittest.cc) = 9a926e7634436a3ce932f754c055a335259a6e6f
+SHA1 (patch-media_capture_video__capture__types.h) = d8bc2d728c5b5a425e81e6279613e83e4682eadf
+SHA1 (patch-media_capture_video_create__video__capture__device__factory.cc) = 69a98d795c6f56463de040447e7c897c550e7fcd
+SHA1 (patch-media_capture_video_fake__video__capture__device__factory.cc) = 761ad1387b108984719470fe2809b5d0ca57ce1a
+SHA1 (patch-media_capture_video_file__video__capture__device__factory.cc) = 30ec59644d554c7c80b8a66f623b3f4c32932298
+SHA1 (patch-media_capture_video_linux_fake__v4l2__impl.cc) = cb04c0fb5598255ac75c973839d2d4ae3ca0dd96
+SHA1 (patch-media_capture_video_linux_fake__v4l2__impl.h) = bf71765f20aaa16e39a9f93743466d8fb0bdb9d6
+SHA1 (patch-media_capture_video_linux_v4l2__capture__delegate.cc) = d23a60df3cc06df129ca409e883c1851a889a936
+SHA1 (patch-media_capture_video_linux_v4l2__capture__delegate.h) = bb713c9547890e69e126c1115a180fb35a3b2f7d
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device.h) = 6bee8a6fdb98666a1897ef14f98b3443e9ddcea2
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device__impl.cc) = 0e3af08a989a4adf6775f3d1a0da228b24221fda
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device__impl.h) = 059988a2fa43a7632222638390fede7a2f7f3d40
+SHA1 (patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc) = 1f1729c74277b62d784f8c506f69e716cfa266f8
+SHA1 (patch-media_capture_video_linux_video__capture__device__factory__v4l2.h) = 8bb85057b524d2eed713021509a9c79b5d2877eb
+SHA1 (patch-media_capture_video_linux_video__capture__device__linux.cc) = 2ec6217a5884412554dded9041689d10e91105e9
+SHA1 (patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc) = bf805cabc54a24a53854d98d2ad99057cfdf47db
+SHA1 (patch-media_capture_video_video__capture__device__client.cc) = b1fe32d0f7575269ced1ec6240fb25eb90981f3f
+SHA1 (patch-media_cdm_cdm__paths__unittest.cc) = 1bf12f6e07bb083cffec9d623bb2b573a6a50c15
+SHA1 (patch-media_cdm_library__cdm_cdm__paths.gni) = 33873c4a65a99ee8506e9644e3f54341897d828b
+SHA1 (patch-media_ffmpeg_scripts_build__ffmpeg.py) = 2f311f07a554662724b55bd5af91df38e44f8762
+SHA1 (patch-media_ffmpeg_scripts_robo__lib_config.py) = 835e565a650b207903eb0fffa57c477b345b8129
+SHA1 (patch-media_gpu_buffer__validation.cc) = 45d745f57f58bb8099bffb900bb1ecbc5e9c39ce
+SHA1 (patch-media_gpu_chromeos_gl__image__processor__backend.cc) = 65461df39ecc2bade3072fe4a12474f46f6b8c9e
+SHA1 (patch-media_gpu_chromeos_libyuv__image__processor__backend.cc) = a6cbfd0b8221d66890d74c6897a665010ebcdf69
+SHA1 (patch-media_gpu_chromeos_mailbox__video__frame__converter.cc) = 79927d5ba6d717f42de4dabd14142158cc51c3b5
+SHA1 (patch-media_gpu_chromeos_platform__video__frame__utils.cc) = 1bee0eb9a523c57acbb928bbda0ed14dcf219de9
+SHA1 (patch-media_gpu_chromeos_video__decoder__pipeline.cc) = 92d297912e23d75616ce10881c9919fa76b28a8c
+SHA1 (patch-media_gpu_gpu__video__encode__accelerator__factory.cc) = ab488a7396578015318e6105bb92dda5f78a7a2d
+SHA1 (patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc) = bf11609f114609e9b44de5cc95073044b2933025
+SHA1 (patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h) = 27f1a19d4744c5fba27d7451e48a1491ce34302e
+SHA1 (patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc) = 8334429c93c4bfae8901d0d987f2ff244f50f46b
+SHA1 (patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h) = 12fc93c557ff01aff63447d92bda17e304a5d5d8
+SHA1 (patch-media_gpu_test_raw__video.cc) = 1ba68c87eafa6cdc189f427565b5f0502e6fa31b
+SHA1 (patch-media_gpu_test_video__frame__file__writer.cc) = cc4a020801f7682fc2867745b641c4822e6f033a
+SHA1 (patch-media_gpu_test_video__frame__helpers.cc) = 9651f41de6b04f77b77a07721f2e62fe18c90f8b
+SHA1 (patch-media_gpu_test_video__frame__validator.cc) = 3ac759219d5bd8b4d0f49135163254b148f3ddf6
+SHA1 (patch-media_gpu_vaapi_vaapi__video__decoder.cc) = 03dc62f572c11eebf5e656e3dadddeffe98bba4e
+SHA1 (patch-media_gpu_vaapi_vaapi__wrapper.cc) = a696d588dcbb328d74e9fd61c12e65aaf9010220
+SHA1 (patch-media_media__options.gni) = db8451c3d56f9a46acd693940b0bcd19fa9ac19e
+SHA1 (patch-media_mojo_mojom_stable_BUILD.gn) = 6543a3cdb4aed97d3c5cac8849f14086ec6f4670
+SHA1 (patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc) = b3f159c5f5673c86cb4d71d7bf80f85674e75b01
+SHA1 (patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h) = 4bde1d40c424e986d3a75272db28e57f2bf6fa40
+SHA1 (patch-media_mojo_mojom_video__frame__mojom__traits.cc) = 38b859008d9a2213e2b944a1ae4a1e6d4e0ffd32
+SHA1 (patch-media_video_fake__gpu__memory__buffer.cc) = 0b896dba542497eef3b493f9a8c6a77489a1ea4a
+SHA1 (patch-media_video_gpu__memory__buffer__video__frame__pool.cc) = 1114c028001bbdc035eb24516c564c28427f8a0f
+SHA1 (patch-media_video_renderable__gpu__memory__buffer__video__frame__pool.cc) = b843594500e04e656cbf38e32a651723a9ee58ef
+SHA1 (patch-media_video_video__encode__accelerator__adapter.cc) = 51149789aecadab7163d92d92f674d9d51323c90
+SHA1 (patch-media_video_video__encode__accelerator__adapter__test.cc) = 0026f83975cae153be11a6b19ba00f249db3bdfb
+SHA1 (patch-media_webrtc_audio__processor.cc) = 789bfa50c6869561523a09e605f8c38c8f223fb0
+SHA1 (patch-media_webrtc_helpers.cc) = f5245bc62a2e70f824ae89cac6f061820f49acab
+SHA1 (patch-media_webrtc_helpers__unittests.cc) = 8eca8b9b8b19d72b507b9e9b9366c13ca50c4b01
+SHA1 (patch-mojo_core_BUILD.gn) = c05d683892121687d5d964b3f09b5f6730adad93
+SHA1 (patch-mojo_core_channel.cc) = 39066b36ea66d11ce3543745d6edd3f3969d5d5c
+SHA1 (patch-mojo_core_embedder_features.h) = c2098496dc8c90584c0e966212cc9e202baadd2e
+SHA1 (patch-mojo_core_ipcz__driver_transport.cc) = 51cb26fb48190120ea64358ad8a34b71c5a7aa7a
+SHA1 (patch-mojo_core_platform__handle__in__transit.cc) = ebd297f3e62c0564de8177387608d1d0e52ed40e
+SHA1 (patch-mojo_public_cpp_platform_platform__handle.h) = 67bba6d638fddeff19060f25a7d6cbe961f373f0
+SHA1 (patch-mojo_public_cpp_platform_socket__utils__posix.cc) = ca24cf63d4b8dca0d778536d74af9b474b733c9b
+SHA1 (patch-mojo_public_tools_bindings_mojom.gni) = 1eeb57802bff8d6d89faa665ac5c343c14926daa
+SHA1 (patch-net_BUILD.gn) = fd814b1ebd617324b79c617d520a6a416cf20fe9
+SHA1 (patch-net_base_features.cc) = 8ea4f42ce03b132edfe3ce94ac50580369e5537b
+SHA1 (patch-net_base_mock__network__change__notifier.cc) = 00e0e891e7e171005702885bf2616c32d7aed569
+SHA1 (patch-net_base_mock__network__change__notifier.h) = 3cfa91b8c31120bed9ff0ee74c5f9c38b8d10e4e
+SHA1 (patch-net_base_network__change__notifier.cc) = e13709c696cf8538e5185e441b67e079597d82e9
+SHA1 (patch-net_base_network__change__notifier.h) = e871ae7c1596aa7e15941b80fbc997b90d5f2930
+SHA1 (patch-net_base_network__change__notifier__passive.cc) = 1edefb248baadcb94ae74ad15d152941dc8f7c61
+SHA1 (patch-net_base_network__interfaces__posix.h) = a5f607f57b7d25fd5b718ef2ff771e79daceb3a6
+SHA1 (patch-net_base_sockaddr__util__posix.cc) = 4da8fb3bbbdbf92bdaadfe3b611d746923f65af7
+SHA1 (patch-net_base_sockaddr__util__posix__unittest.cc) = eef18908bbef6ebab2823635e62c8bacf0b0d588
+SHA1 (patch-net_cert_cert__verify__proc.h) = 4077ad17cdfeeaa331bc8bf5740113b366b9939a
+SHA1 (patch-net_disk__cache_backend__experiment.h) = 698b48724c7b245be532cb7c9a185891be5554f7
+SHA1 (patch-net_disk__cache_simple_simple__file__tracker.cc) = 983f963fced2e1086107cd0eb5ad72d23f26774a
+SHA1 (patch-net_dns_BUILD.gn) = 0ddc6b64833a80986f5bf220fed74f434147755a
+SHA1 (patch-net_dns_address__info.cc) = 467ff7f58672a7a1ba2dbc7c782154cce99d0cac
+SHA1 (patch-net_dns_address__sorter__posix.cc) = 0ee746247a3220009f79830a5013517727d79bd2
+SHA1 (patch-net_dns_dns__config__service__posix.cc) = 29c9dcb218857eb3aae1187331ebb707eb79ea63
+SHA1 (patch-net_dns_dns__reloader.cc) = 6f6d618e1e4809fbbbbecdad88ceb7b792790955
+SHA1 (patch-net_dns_dns__util.cc) = 4c73ea15a00b3e3a6a1ec424986d8a9dc91ff90a
+SHA1 (patch-net_dns_host__resolver__proc.cc) = e1b62063de3de2a97adc6fefabdbfb69d6ccbb98
+SHA1 (patch-net_dns_public_BUILD.gn) = a3c26a7d272a72cbb7a791d5fb052f3a0ba884f2
+SHA1 (patch-net_dns_public_resolv__reader.cc) = 5756283a89e6695751bcd72a1f6b043c6050d347
+SHA1 (patch-net_dns_public_resolv__reader.h) = 431bc25b228b6ef2c4e741ee30ebcdb88c0a11e6
+SHA1 (patch-net_dns_public_scoped__res__state.cc) = 33e4885040c67e9f65026a9e78dcade546cf23fb
+SHA1 (patch-net_dns_public_scoped__res__state.h) = 26b41bf16d5b896405badbc99031645f99548645
+SHA1 (patch-net_filter_zstd__source__stream.cc) = 11c6c22b3f3fed8830fe44a802ec14e7e12413db
+SHA1 (patch-net_http_http__auth__gssapi__posix.cc) = 5c005e13caa5f67f594cb3e53bf8cf5c538d357f
+SHA1 (patch-net_http_http__auth__gssapi__posix.h) = 65d7a09f12cfca0a2b84255ec2e0066959767c9f
+SHA1 (patch-net_http_http__auth__handler__negotiate.cc) = 54b0abdb23807220525fb488fb942453c42e186c
+SHA1 (patch-net_http_http__auth__preferences.cc) = 47f2f5e208df4a68be5d566e7cde5c6f130e6dbc
+SHA1 (patch-net_http_http__auth__preferences.h) = 555883037b755e819fa145b452257d5f3e6e7dfa
+SHA1 (patch-net_http_http__network__session.cc) = c0be9df7d85a091fd97f084a2373ae0824411950
+SHA1 (patch-net_proxy__resolution_proxy__config__service.cc) = 8fe95a643f1ca5d77b727c9ee5b4f4eea4bbea18
+SHA1 (patch-net_proxy__resolution_proxy__config__service__linux.cc) = 4f98787942d854df133fddd84d2c62ded866352f
+SHA1 (patch-net_socket_socket__posix.cc) = a17bfc409619d081c74fdbcabca8cf8031cbb250
+SHA1 (patch-net_socket_socks5__client__socket.cc) = dc94535ab0bd99f040c02ace2a3419185a97cf8e
+SHA1 (patch-net_socket_tcp__socket__posix.cc) = ca9117e26dd194c0c8bc41039b0a0631b1b28dd5
+SHA1 (patch-net_socket_udp__socket__posix.cc) = 76e97179c221065775586351769dce198d33ee74
+SHA1 (patch-net_socket_udp__socket__unittest.cc) = 218dbc364429c42f0141aa31fd28dc2fe2007a95
+SHA1 (patch-net_third__party_quiche_BUILD.gn) = 0c655feeffe9cfc109d60ec7980f687281f988c8
+SHA1 (patch-net_tools_cert__verify__tool_cert__verify__tool.cc) = 0166923bd473fdd500267893da242774fc4a8193
+SHA1 (patch-net_tools_net__watcher_net__watcher.cc) = dc111bcac36c1bf0c313221aafb5f979f70e09c1
+SHA1 (patch-net_traffic__annotation_network__traffic__annotation.h) = 0e30f4f4ffdc4feb8ba4ec7ad1e5cad12546fcfb
+SHA1 (patch-net_url__request_static__http__user__agent__settings.h) = 951b2ecbf671e8959702670aed2cc3d1f1ce4aa4
+SHA1 (patch-net_url__request_url__request__context.cc) = 71064d8d6f75e0cf41fb2bb8cf1352676ac5f4d4
+SHA1 (patch-net_url__request_url__request__context.h) = 6170b092b7cc99bb14c67d86f919b6c85fdb6c63
+SHA1 (patch-net_url__request_url__request__context__builder.cc) = 2158156cd881e1a1541bb424208ad17491d12309
+SHA1 (patch-pdf_pdfium_pdfium__engine.cc) = 71ef47489124833d19ab65366eb1fc23b5393bd0
+SHA1 (patch-ppapi_tests_test__utils.h) = 34b3528d95892660fe64106c0d80044199b0715f
+SHA1 (patch-printing_backend_cups__ipp__helper.cc) = 20e9a5ff6626ac2a8114a0f9e5f09c55bcf2248e
+SHA1 (patch-printing_backend_print__backend__cups.cc) = 5aab7cd02b74ce5953959d85dc974559a06d7728
+SHA1 (patch-printing_mojom_printing__context__mojom__traits.cc) = c0b03cff67d0fcff4435553f0352d1bfb43c29e6
+SHA1 (patch-printing_mojom_printing__context__mojom__traits.h) = ebd9b948af5d70c0fd8c9cdf496a00a1c000bcdb
+SHA1 (patch-printing_print__settings.cc) = 30bf749e2eda65a9d9f395062fcef0436afa7efc
+SHA1 (patch-printing_print__settings.h) = 2eb8d0ef07204bfbbf6aaec6ebcd4bb5b3ec0892
+SHA1 (patch-printing_print__settings__conversion.cc) = 7fbdf6b029fb974358ce1be7eb1534ef12587c11
+SHA1 (patch-printing_printing__context.cc) = e1fcb917d7b90dc37570e89172d0cc4bfbf5711e
+SHA1 (patch-printing_printing__context.h) = e5d835df99864c7b0e4fcc19be425e9c759291ae
+SHA1 (patch-printing_printing__context__linux.cc) = 882d1d2c1d01429283ba72de465e16884fa76c98
+SHA1 (patch-printing_printing__context__mac.h) = 38155bc2cfe8e0ff70af9feef761feee31315122
+SHA1 (patch-printing_printing__context__mac.mm) = 82b7fe013f470316800df924c2bd31be58698330
+SHA1 (patch-printing_printing__context__system__dialog__win.cc) = 2082acffd09b6d660ea5ab0e496887e0a039c164
+SHA1 (patch-printing_printing__features.cc) = 0cd504dcc45456add8ef752dcff9a7bcfa117198
+SHA1 (patch-printing_printing__features.h) = ea757689182ea96597b7d4e182fe5f74ee247330
+SHA1 (patch-printing_sandbox_print__backend__sandbox__hook__linux.cc) = dd009733459c49eee723ad108984f097d216d9a9
+SHA1 (patch-printing_sandbox_print__backend__sandbox__hook__linux.h) = f6e905bec4a4fedaed91932b9784e6e6e5c23b7e
+SHA1 (patch-remoting_base_chromoting__event.cc) = 27f1e7f7e9daefbb2a6df9d98b13eb2b63b088cb
+SHA1 (patch-remoting_base_host__settings.cc) = 8d5cbb37cf028fd0ff103e2d41f38d8c47af047d
+SHA1 (patch-remoting_codec_webrtc__video__encoder__vpx.cc) = d6b20f981473b3eb747ee9d33a2c040bb250fb93
+SHA1 (patch-remoting_host_base_desktop__environment__options.cc) = 59c438206a458c460daae74e5aec45ae94b623b7
+SHA1 (patch-remoting_host_base_switches.cc) = 1d95ccb73bfac28e9a0af2a3d4a32e42b457e993
+SHA1 (patch-remoting_host_base_switches.h) = 43c3179b9030ac99d5d090879d990667c075f5a7
+SHA1 (patch-remoting_host_basic__desktop__environment.cc) = 15b176fdbf8275ddcff415484f59612a965a5f36
+SHA1 (patch-remoting_host_chromoting__host.cc) = 401de406a19c9c3777e93de03ebf0067916c8bf9
+SHA1 (patch-remoting_host_chromoting__host.h) = dc4ede958dd883a394386ea02fd61a6cd3703d92
+SHA1 (patch-remoting_host_chromoting__host__context.cc) = 1270f3ce92c9801b18fbe31254418d190b50f133
+SHA1 (patch-remoting_host_chromoting__host__services__client.cc) = c7d29523aa34ee5c637b4cd8d0779bd48b755dc6
+SHA1 (patch-remoting_host_client__session.cc) = 76c62d9351debb40d7ee2792768de5778b37a101
+SHA1 (patch-remoting_host_crash_crash__file__uploader.cc) = 5dc84e1b847771a743d6eab83f38abc4510e2545
+SHA1 (patch-remoting_host_desktop__and__cursor__conditional__composer.cc) = 9aade9ea0e08221fa70effcdc6385adaa61d929d
+SHA1 (patch-remoting_host_desktop__capturer__proxy.cc) = 1247cfed02767d47b333960e99278215c05d718c
+SHA1 (patch-remoting_host_desktop__capturer__wrapper.cc) = 84ab98cee4282cbed0aef0bc1d2e50747c76b4fb
+SHA1 (patch-remoting_host_evaluate__capability.cc) = 0ede3e245bf33b1b5315cdcfbc3f8fb45dd0ae5b
+SHA1 (patch-remoting_host_host__attributes.cc) = a51f9d98411693804b79967996823790ba58b27e
+SHA1 (patch-remoting_host_host__details.cc) = 60c0ccff60b00e3bbcbcb388bd44cea887549559
+SHA1 (patch-remoting_host_host__main.cc) = a4dc6cd1409b8182dfd264832c1deb1ac4587864
+SHA1 (patch-remoting_host_ipc__constants.cc) = 921e32f41f4847d2425501a3463aa40152d0c77d
+SHA1 (patch-remoting_host_it2me_it2me__host.cc) = e7cf5489e42ba0a7a7fd9b2487d61ae304e5865a
+SHA1 (patch-remoting_host_it2me_it2me__native__messaging__host__main.cc) = 4f3af71b2c9e5d529ab1548e5c0f124a1fdd01d1
+SHA1 (patch-remoting_host_me2me__desktop__environment.cc) = 8397e0053f2c72300cbe7f41fa63e1bdb45772b9
+SHA1 (patch-remoting_host_mojo__caller__security__checker.cc) = 8233a11d496e72e6d3863c0d0a4e4d490504f619
+SHA1 (patch-remoting_host_mouse__cursor__monitor__proxy.cc) = 32d5e8e1273b90739840354350588363c05d473e
+SHA1 (patch-remoting_host_policy__watcher.cc) = 2393c368dc0bce64eabd9f1b94b9fa37904c296e
+SHA1 (patch-remoting_host_remote__open__url_remote__open__url__client.cc) = c09db8d858775c2a8a2f69c4e20ef4daf89473e5
+SHA1 (patch-remoting_host_remote__open__url_remote__open__url__util.cc) = fe081608e518fd0f6ee6a3d0b1678aa4f358d228
+SHA1 (patch-remoting_host_remote__open__url_url__forwarder__configurator.cc) = 718b4b9ccf6393e27596a8791ae4cf8559349e62
+SHA1 (patch-remoting_host_remoting__me2me__host.cc) = eeff2c9d56b00adcb16489bb5fe5c04d5236b269
+SHA1 (patch-remoting_host_session__policies__from__dict.cc) = 66efaaf1918e8705f94a2f7536b1de449239e580
+SHA1 (patch-remoting_host_setup_start__host__main.cc) = 2fbc3dcf8c7816ec04f0c4735ea79c3640f109b0
+SHA1 (patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc) = 65506f651c164227dbc1961d69d5b8b66e643370
+SHA1 (patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc) = c2e4995c7a56d1be7024afb767adb54a994676ad
+SHA1 (patch-remoting_protocol_webrtc__video__stream.cc) = ee2e21b6ed15bf0316a54a4dfade09a9465d3605
+SHA1 (patch-sandbox_BUILD.gn) = 11c3bf7d156dc5f62ec82a268d5d42107ad3ad65
+SHA1 (patch-sandbox_features.gni) = 1fbed89b452c3acaf6ec11b996c07c7b0ce36bd4
+SHA1 (patch-sandbox_linux_BUILD.gn) = f2a462c487dbf6371b494181eef286b5d88e6eec
+SHA1 (patch-sandbox_linux_services_init__process__reaper.cc) = da95d13f079c233683e17b695c03bb26166b2d4b
+SHA1 (patch-sandbox_linux_services_libc__interceptor.cc) = 171f0e119a08309924f2a3d96b60f46118a7e375
+SHA1 (patch-sandbox_mac_BUILD.gn) = 54b3f4e83e588b8086d73f7edb7d0cb7b0ba5dca
+SHA1 (patch-sandbox_mac_sandbox__compiler.cc) = 10cf1eec318b72edbe740d58d434b000cf9db841
+SHA1 (patch-sandbox_mac_sandbox__logging.cc) = fbcaf3d582b9b24b62e1381e4cf3359308e0f316
+SHA1 (patch-sandbox_mac_seatbelt.cc) = 902bb1a74602aa24b013aaa7710f99bd0e221f8a
+SHA1 (patch-sandbox_mac_seatbelt__extension.cc) = 76ee287b4b4ec7c9942aabf00590d14693458fd8
+SHA1 (patch-sandbox_mac_system__services.cc) = 8529c399e15f3762b6ea3d8533e7c114955bf153
+SHA1 (patch-sandbox_policy_BUILD.gn) = fabf04d9b96f1ae683877487c48daa52333a0294
+SHA1 (patch-sandbox_policy_features.cc) = 238b41b7df51c0f41caaa7b81c6b0070c97869dd
+SHA1 (patch-sandbox_policy_features.h) = 405fec21dc85223c939fae109af01359137f1a9b
+SHA1 (patch-sandbox_policy_freebsd_sandbox__freebsd.cc) = f07a679f2daf8a93f1879710989bad4277e8d364
+SHA1 (patch-sandbox_policy_freebsd_sandbox__freebsd.h) = fd44df9aba130584dcf345e4cb07cf8e4cf778c7
+SHA1 (patch-sandbox_policy_mac_sandbox__mac.mm) = ecf6b130e61b9434549961f007fbcec2311f7e9e
+SHA1 (patch-sandbox_policy_mojom_sandbox.mojom) = 8002797d6adfeca0880ab9b7e79e3646d1dad96d
+SHA1 (patch-sandbox_policy_netbsd_sandbox__netbsd.cc) = 028714ed6155d8f68d544a5292923ce2e33d06e4
+SHA1 (patch-sandbox_policy_netbsd_sandbox__netbsd.h) = 4f9181b100e0a472867875f1cfc3164d24589a1d
+SHA1 (patch-sandbox_policy_openbsd_sandbox__openbsd.cc) = 22e3bd144f3671278690392d2973e5f889a20e1f
+SHA1 (patch-sandbox_policy_openbsd_sandbox__openbsd.h) = 78e591ff7dec50e6ca48e3e34f073ea457db4524
+SHA1 (patch-sandbox_policy_sandbox.cc) = ef2d60ba06713f063bd0ec628a22786fef45d814
+SHA1 (patch-sandbox_policy_sandbox.h) = be739ceb5ce050f949e3d33ed89dc97689654bea
+SHA1 (patch-sandbox_policy_sandbox__type.cc) = 99f6b1f1fa0e84dba6c842e8b6959831505198e9
+SHA1 (patch-sandbox_policy_switches.cc) = 1025754f8231ea43cb9136af8f26fb9d3f536bcc
+SHA1 (patch-sandbox_policy_switches.h) = 601e4799f62dfb5ddd6a45eddbab7c4ce107beb4
+SHA1 (patch-sandbox_policy_win_sandbox__win.cc) = f72b04fe3915676f5a6c72c31d76a09b7e78e2a7
+SHA1 (patch-sandbox_policy_win_sandbox__win.h) = 1d99375ebb2f78b8555c26493e8e121da418c338
+SHA1 (patch-services_audio_audio__sandbox__hook__linux.cc) = ded5d991aa539645c6257dce3d7b4ab690a2fa82
+SHA1 (patch-services_audio_audio__sandbox__hook__linux.h) = fe38782b963f092fa230e351186b36f620586f3c
+SHA1 (patch-services_device_BUILD.gn) = 832a36ef43779f3d255a41625d148d94e44c2ca2
+SHA1 (patch-services_device_geolocation_location__provider__manager.cc) = dd5b59e92f9bae823afd0cdb66db19a2f139a756
+SHA1 (patch-services_device_hid_BUILD.gn) = bbe8624a8158f5fecf00df730ffc10c231165406
+SHA1 (patch-services_device_hid_hid__connection__fido.cc) = db0f10e90e0716fb3d8170698b464ffaeebf7bb2
+SHA1 (patch-services_device_hid_hid__connection__fido.h) = 199513ef732e4f7a8b2f6ba9d0dd8929582f3c4f
+SHA1 (patch-services_device_hid_hid__connection__freebsd.cc) = dbf6254139000c43279f80d0b63aa1494c70e5ef
+SHA1 (patch-services_device_hid_hid__connection__freebsd.h) = b54490029bd349e32827d1e4656d30d2c0eebfcc
+SHA1 (patch-services_device_hid_hid__service.cc) = 4adc27a951d4437e9eb1b621094f2e9d78287436
+SHA1 (patch-services_device_hid_hid__service__fido.cc) = d469a1a0cd0874b6abca8e8c021c1d4e41935656
+SHA1 (patch-services_device_hid_hid__service__fido.h) = 1d5f8fcbaa861378c79094518a1ea564cf84a3dd
+SHA1 (patch-services_device_hid_hid__service__freebsd.cc) = 2d6d5ba020405923ed0a1818a50fea6f4f52a48d
+SHA1 (patch-services_device_hid_hid__service__freebsd.h) = 4d459aeb918c9323f6da8b569efd5b55145a4353
+SHA1 (patch-services_device_hid_hid__service__netbsd.cc) = 34d86223a8d92323ad5b37ccc00aa4f3d475a4bd
+SHA1 (patch-services_device_hid_hid__service__netbsd.h) = 4c32811644e0743f975f25b8a4f04881c53f4c64
+SHA1 (patch-services_device_public_cpp_generic__sensor_sensor__reading.h) = 11b2e7744eb29850db5f95c5f5aa19ff4b57e546
+SHA1 (patch-services_device_public_mojom_BUILD.gn) = be70537e7ec25249dcaf32b622cb3a72da559dc0
+SHA1 (patch-services_device_serial_BUILD.gn) = 525fa8be07ab1dfd6d51e306e478f13fcde17103
+SHA1 (patch-services_device_serial_serial__device__enumerator.cc) = 20e7f8feb9af47f52626077277dc0b217b2656b4
+SHA1 (patch-services_device_serial_serial__io__handler__posix.cc) = add272696458e41d18460bb1a6995dc88b76bae3
+SHA1 (patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc) = ab368824ee61a87f74650c40fae75d10f3ac64b2
+SHA1 (patch-services_device_usb_BUILD.gn) = 8e2ccfc1ff59b1b01f9bd333fb92b39a359612f1
+SHA1 (patch-services_device_usb_usb__service.cc) = c9a3ec40eff946eeb4b9097f649e0088ed1692f2
+SHA1 (patch-services_device_usb_usb__service__fake.cc) = 35f4d13d2f5b108d511136ef4317533fe4c81b3e
+SHA1 (patch-services_device_usb_usb__service__fake.h) = 5a9f2a5094abbdf96b221182f627dbd7590893d6
+SHA1 (patch-services_device_usb_usb__service__impl.cc) = 83dcc15a9e11e9769aeef6ee68297f68cc33cffe
+SHA1 (patch-services_network_BUILD.gn) = 920805332245dbdecc5c35c2d2c4be452fe647de
+SHA1 (patch-services_network_network__context.cc) = 7066c6108581e5fa83a192008e8319b2351d692d
+SHA1 (patch-services_network_network__context.h) = 523b08e06b62b243aa957da4b919f693c05086f1
+SHA1 (patch-services_network_network__sandbox__hook__linux.cc) = d1f0373a0cbf76dd4efdc0ceeac007e6208c175c
+SHA1 (patch-services_network_network__sandbox__hook__linux.h) = 7abc793cb90b64a4e1603fc00631756726a04e87
+SHA1 (patch-services_network_network__service.cc) = ec6318d43339363541ca43ec7a60ee8d8e59a9b1
+SHA1 (patch-services_network_network__service.h) = 0f0789ee2504f5d50ed9ea02b08b0484915f1fe8
+SHA1 (patch-services_network_public_cpp_BUILD.gn) = 3b534cddae62db04d6857054e66eb3dbbbcfa46d
+SHA1 (patch-services_network_public_cpp_features.cc) = 7cc6695aa0568403f049a7a485c5f9c9eed90457
+SHA1 (patch-services_network_public_cpp_resource__request.cc) = 9d0ae88abc57996852d622f4ec8e463f81f39c93
+SHA1 (patch-services_network_public_cpp_resource__request.h) = 1fd7121c13cbf819b097c670590635f052b238de
+SHA1 (patch-services_network_public_cpp_url__request__mojom__traits.cc) = e1c0b4f1333ad08cc7bd9d4982a1fb808823f67a
+SHA1 (patch-services_network_public_cpp_url__request__mojom__traits.h) = b42a00af2d7b2f6bdde9350896fd8b0337a2e4de
+SHA1 (patch-services_network_public_mojom_BUILD.gn) = 5e5ca94a276937bece21d563cbeba1589553dba3
+SHA1 (patch-services_network_public_mojom_network__context.mojom) = 57f3584dc5354d83c75b536c5e76f18386f9e4c8
+SHA1 (patch-services_network_public_mojom_url__request.mojom) = 83fae545fa56482ca3ffe26c28606d12f5665418
+SHA1 (patch-services_network_public_mojom_url__response__head.mojom) = 7fae970e214aec7de4e80955d34e17f88f822951
+SHA1 (patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h) = dd7f32b6914926f248461648ae395ec1b25d3c75
+SHA1 (patch-services_network_test_test__network__context.h) = ae80f72a016b82adb0bf4502b004697f157209bc
+SHA1 (patch-services_network_url__loader.cc) = 28a6963372da9bc2bb0b3431fbe085eac0acf4d6
+SHA1 (patch-services_network_url__loader.h) = 8fc670605cf433f181ebe1d7464bed9bba85e338
+SHA1 (patch-services_on__device__model_on__device__model__service.h) = 2c0dd4e46e5cb05ea8babd408ad6d34685b39076
+SHA1 (patch-services_on__device__model_pre__sandbox__init.cc) = 271a90be021d3fd2f74c9d6383387c1ac37cbd14
+SHA1 (patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc) = 66796336e644c2cbab356fca121548d52e0b68ee
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn) = 065debe81739459b64e4df5142e60f75c5c65db0
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h) = f0f43e9dcdb675e6ae497dccf257a2e2bd89a7da
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc) = 129f1845b1d5ca0161295caf63b2b8773e626388
+SHA1 (patch-services_screen__ai_public_cpp_utilities.cc) = 1b05b3c2df942b35c07eb8554ea3adb5d554ac9d
+SHA1 (patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc) = c62ee420472dcf642c311a08fb52c84f00bf2d00
+SHA1 (patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h) = 9bdb943a5fac7cc8bde208b7a2950a3ec6c24fce
+SHA1 (patch-services_service__manager_BUILD.gn) = 56b4daf0cadb5a3bfb672b0aa57d705b3caaef10
+SHA1 (patch-services_service__manager_public_cpp_service__executable_BUILD.gn) = fea4e8983a36bed30598ca691fc73f45b74884ec
+SHA1 (patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc) = 896c08113906ce2bb696017e035f5e029b2916eb
+SHA1 (patch-services_video__capture_public_mojom_video__capture__service.mojom) = 6a24a48a9eac06143c5150235cdeeb9f73d12968
+SHA1 (patch-services_video__effects_video__effects__sandbox__hook__linux.cc) = a4baae12feca30d4a8cb0e2a6200c78be0ef4762
+SHA1 (patch-services_video__effects_video__effects__sandbox__hook__linux.h) = 91d151a454875994986716028d21c97818e58c35
+SHA1 (patch-services_viz_privileged_mojom_compositing_display__private.mojom) = 5066b1f9fbb8c8e0fdaee598c582b2518ce9fb52
+SHA1 (patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom) = edee114a3397fd1d2c2ad2d449010555ad6c3426
+SHA1 (patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom) = 50092342d09c8bcee5a068240b58e69e86b19178
+SHA1 (patch-skia_ext_SkMemory__new__handler.cpp) = b23b1f0328fd7713df3c8eef1cb0e13d4abde4a4
+SHA1 (patch-skia_ext_font__utils.cc) = 893f48aacb2ad6eacf73a7aede60fa5a40b682ae
+SHA1 (patch-skia_ext_platform__canvas.h) = 45150dedf208c0aed45a7f4270a165b046ccb71c
+SHA1 (patch-skia_ext_skcolorspace__trfn.cc) = 61aad59cde0b752c8cfc983e92e305bac44a2c03
+SHA1 (patch-third__party_.gitignore) = 7e0f5f12261268d957818307a2fcdcbf58afef6e
+SHA1 (patch-third__party_abseil-cpp_absl_base_config.h) = e786cb1cfc7d8b7e1414935f612b9faf35e14f22
+SHA1 (patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc) = ccca626447d29b51665388f443485e0baf255586
+SHA1 (patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc) = 71f1b32c94aac0d8b0b7ad55d7366e2b0980af3b
+SHA1 (patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h) = 9f7c7ac9a1659e8a40ac170ca35b2df02aff6585
+SHA1 (patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc) = 72f04f991036f6cd25aee7dd4cd07bcbd2500f70
+SHA1 (patch-third__party_afl_src_afl-fuzz.c) = e6608fc6677f895f18bcf58c10c599b73766c83b
+SHA1 (patch-third__party_angle_BUILD.gn) = 4ca0941a25b75877ad83638cd6d53a5bf3108646
+SHA1 (patch-third__party_angle_src_common_platform.h) = c615992ea09fe9ba28dae77024c6c6636e16e5cd
+SHA1 (patch-third__party_angle_src_common_platform__helpers.h) = 8d01434e601c4b6acc104b88a2d236167a197020
+SHA1 (patch-third__party_angle_src_common_system__utils.cpp) = 33e2c2cd5b5a2872a9c9ff0b921c995cf630bf70
+SHA1 (patch-third__party_angle_src_common_system__utils__linux.cpp) = 24cad2b0170f26e722bb57c95720f9e16e641776
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h) = 41b2490b834db43efad58f1219ed97725098afdc
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp) = f3733449a554a2b155c07b3af3b8e33f66a6ab8c
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp) = 85a4574df9eb5207e239639543ed36b775ed2037
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp) = aed0710baca1dd72df1dd9d938fa8faefe13e546
+SHA1 (patch-third__party_angle_src_libANGLE_Display.cpp) = bb51381f754ad7203cc028ea0c9ea4f93c469a21
+SHA1 (patch-third__party_angle_src_libANGLE_formatutils.cpp) = c74fff4f54284923b6e189782e12ffbba0136b8d
+SHA1 (patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp) = b05539637553df263230e3e0c0e0e6e0fe87b17a
+SHA1 (patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h) = 319402c751d26bb51100a549830502ceb0f05462
+SHA1 (patch-third__party_angle_util_BUILD.gn) = 2b3ffad9d156fc8298c32cbc23eef7e4d57bdfb5
+SHA1 (patch-third__party_blink_common_features.cc) = 1da7b90f5b5be58f0bfd4b7206d8afdb89f04108
+SHA1 (patch-third__party_blink_common_permissions_permission__utils.cc) = 91d63e0ae7091b6b8c7e8dea3e817b675b8afc8f
+SHA1 (patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc) = 7a7bc81d8bb7a164538815518da00bcf6ee1a7cb
+SHA1 (patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc) = e08000ec3b07633a0abf6e07bfd231a2e0fdf9be
+SHA1 (patch-third__party_blink_public_common_features.h) = decc5ec9b685c8bbef858dc372bb2005043a455d
+SHA1 (patch-third__party_blink_public_common_permissions_permission__utils.h) = c6b7d7d6e0517de5e3d52cb801f059ab7cd4faaf
+SHA1 (patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h) = f50712565b1aac7251e481f66cacf369db00d697
+SHA1 (patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h) = 158adbc17a2bc5feaafbf273d0d0d43752ded43b
+SHA1 (patch-third__party_blink_public_common_web__preferences_web__preferences.h) = 902c95b45a08f69b912399227119f19e69569475
+SHA1 (patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h) = 36c5e1f59a989f4f3e4e520a3bf48c781a16ceef
+SHA1 (patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom) = 6ac0d2f04face11fe1e6981dd7b498d60f19a427
+SHA1 (patch-third__party_blink_public_mojom_page_page.mojom) = 2c387bf55dece255459261fd1a56a2b73d408657
+SHA1 (patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom) = 2ad7ea60cc972985af766ca0561f8b3dcb1aec94
+SHA1 (patch-third__party_blink_public_platform_platform.h) = aae5a281ad314ee892c5c4129648e6e9cde83421
+SHA1 (patch-third__party_blink_public_platform_web__content__settings__client.h) = 03dd1c35d75ca164ee4e6f91be43099d8b438a77
+SHA1 (patch-third__party_blink_public_platform_web__vector.h) = e98fc3c65f0ae0d422b6e016f24776fd2ff002c1
+SHA1 (patch-third__party_blink_public_web_web__blob.h) = 2bb7b4cc0031198f4ebc80408ebbf67b18a432de
+SHA1 (patch-third__party_blink_public_web_web__document__loader.h) = 1cecf316950f8dfd50fd4a7a27bd3f7365c4ac20
+SHA1 (patch-third__party_blink_public_web_web__local__frame.h) = 931540ca9f5fc0aa8c24e4591e2a7a3084a543f6
+SHA1 (patch-third__party_blink_public_web_web__local__frame__client.h) = 443a1cafeb713618b560b3f23950aa8e522335dc
+SHA1 (patch-third__party_blink_public_web_web__message__port__converter.h) = a67e19557584aeec00a3bd68c79458abfcb2e1ad
+SHA1 (patch-third__party_blink_public_web_web__script__execution__callback.h) = 87bf935e985be7c0a735c9ecec6fda99b96cad14
+SHA1 (patch-third__party_blink_public_web_web__view.h) = 578c12459242a00bc3ac2924f207472ccae54aa3
+SHA1 (patch-third__party_blink_public_web_web__window__features.h) = 8e22e14fc853547f7d1f23e8cb46e40b55e0eafa
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc) = 38de0c87ac1a8fd715125d3bac4e99eb64cd6ad6
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc) = 5ca52679683a7e894b6fe770bb6310069cdf3ada
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h) = 35d76c217a224bc8fc2e5240e89e06992f97b2a3
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc) = 9d1011cc8d9a96a464e68a755ea412d9bdb36078
+SHA1 (patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py) = 99617f96727d01e230feb01c1317b16733389975
+SHA1 (patch-third__party_blink_renderer_build_scripts_gperf.py) = 3d046d792ea9a6fafeb9d3327ba98a4cedaea5af
+SHA1 (patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py) = 9e8fa2cfad3e849ef209faed7e3f83432073a205
+SHA1 (patch-third__party_blink_renderer_controller_blink__initializer.cc) = 934e07d33d0dbf5f0f090843685071fffb4fa9bd
+SHA1 (patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc) = 1eec3f92010de53a829ed78a01ebe722f8c3017b
+SHA1 (patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h) = b028576fc0bb3a4520f077ff481ae732cc54d3f2
+SHA1 (patch-third__party_blink_renderer_core_BUILD.gn) = 3ecf0202ec55bd6fbbf3a7c8753f0d4b1a61a688
+SHA1 (patch-third__party_blink_renderer_core_animation_animation.cc) = 8b14b269782c89bd7fe52b464cfceee435f54a1d
+SHA1 (patch-third__party_blink_renderer_core_animation_animation.h) = d9bb5e4199928c0278289911f64af0cbce6c7df6
+SHA1 (patch-third__party_blink_renderer_core_animation_element__animations.cc) = b473f2918c7381dffad4043a07ce0553ab8d3dbb
+SHA1 (patch-third__party_blink_renderer_core_animation_element__animations.h) = 1a0a1d993c202faa253277a3f474f9664baf1ca6
+SHA1 (patch-third__party_blink_renderer_core_css_font__face__set__document.cc) = 4661095f8f4b86fd8f5040a42a4afd280180c376
+SHA1 (patch-third__party_blink_renderer_core_editing_build.gni) = 020642c484849eeb9939f31b7d26727ff06a2cbd
+SHA1 (patch-third__party_blink_renderer_core_editing_commands_clipboard__commands.cc) = 6cc20c779355c3ad7132fb8f0901c47950c527ee
+SHA1 (patch-third__party_blink_renderer_core_editing_editing__behavior.cc) = b2ce11eb1348cd42e13abc01546fe8005fcbec18
+SHA1 (patch-third__party_blink_renderer_core_execution__context_navigator__base.cc) = 6e9a7dfb949797f3f2bc1f0602d1906a63b06c5d
+SHA1 (patch-third__party_blink_renderer_core_exported_web__blob.cc) = e88b318c3525d3d88c87aa157c0224f48df1fef1
+SHA1 (patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc) = 20895b64777e7bf13368fef26573477254813c1e
+SHA1 (patch-third__party_blink_renderer_core_exported_web__view__impl.cc) = f5382c7e235b4594167f0ea7cf1cd458ae3c2853
+SHA1 (patch-third__party_blink_renderer_core_exported_web__view__impl.h) = 653058ff5874a7cfb66c71ab0edd465089919c6f
+SHA1 (patch-third__party_blink_renderer_core_frame_frame.cc) = 68d7fba2b72cee8cfaa11b602647c02cf7203c37
+SHA1 (patch-third__party_blink_renderer_core_frame_local__dom__window.cc) = 26714f37bf8fb203e5c6c93521e930ee60d85ab7
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame.cc) = f1ab8b61be8e54b0010ba5e1bb36a497408ad550
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame.h) = 4a2168d0ad73dd51add73ec42524678bf909c597
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client.h) = a6a1fd594f5fdff9bcb832f50c2eb1a34f01a89e
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc) = a9d8566d0d10dcfc94253eac4db24c12d05306a0
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h) = 5f228782965a2ad68d5e2ec2de0f12d7784e8137
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc) = 99b67821b887caa6da332abb1f313857b3b73212
+SHA1 (patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc) = a2572adfa84a21c807a960429ec0bb639b3895b7
+SHA1 (patch-third__party_blink_renderer_core_frame_pausable__script__executor.h) = c1911b04e6c4371646bd65305157736634cbddef
+SHA1 (patch-third__party_blink_renderer_core_frame_web__frame__test.cc) = cc85c60c199d336ab72b00c76458e6d2e00172f0
+SHA1 (patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc) = 445a69600e69828b3c0ebe9427adb846dd907d96
+SHA1 (patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h) = af783f9cb2af954450f1fda4487fff19c533ff6c
+SHA1 (patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc) = 49efbe1ac5bf11b5df4abef3bd2c052e8667314e
+SHA1 (patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc) = 52e28208fe0ee66433f6d2f329a9a8989fd6fe55
+SHA1 (patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc) = 90fad351d802f73ef295c47bbbf366c5400bec45
+SHA1 (patch-third__party_blink_renderer_core_layout_layout__view.cc) = c7005fe7952648f5179ef866b803ddf7101bfefa
+SHA1 (patch-third__party_blink_renderer_core_loader_document__loader.cc) = 6b5b3b2712ef84aef9f48eba64b8c051627565d3
+SHA1 (patch-third__party_blink_renderer_core_loader_document__loader.h) = 81aa05f72ec79a8b0d1940a96d8b5052e2f66a62
+SHA1 (patch-third__party_blink_renderer_core_loader_empty__clients.h) = 588aa131ff9a943a1d3731513acbf1fc3dbea9ec
+SHA1 (patch-third__party_blink_renderer_core_origin__trials_origin__trial__context.cc) = a0d7054794cedcf2068b0e647612e3e7f5f51a69
+SHA1 (patch-third__party_blink_renderer_core_paint_paint__layer.cc) = 60e35e5322ae4163acd45f2a78832ea28f946c6c
+SHA1 (patch-third__party_blink_renderer_core_paint_paint__property__tree__builder.cc) = d707f34157fb510e82821002147442f2dbfaab97
+SHA1 (patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.cc) = eb8ed975d6222532a97bf3b9689d8038118038bc
+SHA1 (patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.h) = 64b7eb51431ccc00ef0f1f59a01ab319c5b66b27
+SHA1 (patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc) = da1f54e63a1040077db8ef1f2d5444379b1ac886
+SHA1 (patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc) = 2d0bd39c7151e81c169baf55abe05912d39bdf33
+SHA1 (patch-third__party_blink_renderer_core_view__transition_view__transition__test.cc) = d855a967183bd6b6ff95747486a5cb825c07f688
+SHA1 (patch-third__party_blink_renderer_core_workers_worker__thread.cc) = f9f479b8f5b964c773f410ffaa8f3167d036386b
+SHA1 (patch-third__party_blink_renderer_core_xml_xslt__processor.h) = 2c49f33ce9d0bc8a1326e78da732a50cb79072c9
+SHA1 (patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc) = 0b498e3369ed9a87668829658813a87166106595
+SHA1 (patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc) = 12735006ccdec2ef1e04b6265c66a15ac628456c
+SHA1 (patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc) = 9181825eb04b4aace26011bf037f7a248efb2c41
+SHA1 (patch-third__party_blink_renderer_modules_peerconnection_rtc__data__channel.cc) = d7ad64b7df08206b242278346af8a1a283e89b4b
+SHA1 (patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc) = 575329d1e5f8c92fde9a3b79b0bad2d8d9b3787d
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_audio__worklet__global__scope.cc) = 9c5dc6d6f8cf635a681d0ac9d1724d47b6076613
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.cc) = a4265192bb9b4fb921acdc4100455f78f1888cb9
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.h) = fd4cb5574188552b4d9f1465a7f31b7c64abdbb9
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc) = 68824ca58155a71ef90d3d3d9f65708474a5dbbd
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_script__processor__handler.h) = a4fed0ab943d1ec448d1fdf5ae794a643bcf4734
+SHA1 (patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc) = 913f26b9449e59d2ccc6f7c494fd04d31c50828a
+SHA1 (patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc) = 6887e412859bbd4583094906ba04ad66809db190
+SHA1 (patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc) = c2fffacb38c51bdc07ac40551c2c4f865f5a9d4e
+SHA1 (patch-third__party_blink_renderer_platform_BUILD.gn) = 066f1a6e3295f29cec415e0d27e09be05e489635
+SHA1 (patch-third__party_blink_renderer_platform_audio_denormal__disabler.h) = 83957f524b3ebe843bba71e7325742c97b9c9baf
+SHA1 (patch-third__party_blink_renderer_platform_audio_denormal__disabler__test.cc) = 876f000e49b940f5bc676253dba8f8e0d6a42a77
+SHA1 (patch-third__party_blink_renderer_platform_bindings_script__state.cc) = 30718bf5e24616e5a18bf81818f6032475ecf76f
+SHA1 (patch-third__party_blink_renderer_platform_bindings_script__state.h) = 11533808296d976f3149cc32103a7b9bcf5a0302
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__cache.cc) = 47d56408f2d8b41091d7ed7680351badd6890a1c
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__cache.h) = 4c6f61e731dbf31e4aa7766b6715124baf2e1c40
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__description.cc) = a8fbc773264b1503a737dde0c67aeb207a6d6c39
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__metrics.cc) = 33291a6bec07c1615516d930b5e636c4d56a12d4
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc) = 70bf14f73855847c4f9c8fcab4ec259b8f66b944
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc) = 2303894411e71d7cd2ca79107246ed35057fde90
+SHA1 (patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc) = f61224faed2b1f2dcc69183e142854fe49bfbe05
+SHA1 (patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc) = fa7544e72e4636833703f7bf273084a88ea482c8
+SHA1 (patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.cc) = 678d1970c56777d066e3ecace7864439efc6d284
+SHA1 (patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.h) = f2e09efcbbaee693412908f0da5449ae2ecd1baf
+SHA1 (patch-third__party_blink_renderer_platform_graphics_gpu_image__layer__bridge.cc) = da7ad1be384ec1cfe1313a4099c801a0f58c5b72
+SHA1 (patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc) = e50b80fe886a0fd36313988a787407b77ce8b238
+SHA1 (patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc) = 2ca68222e9cdca7e8d710bfc8039833e9e7d588a
+SHA1 (patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc) = 40479d2089fc5eb63513601c432ec69d1259a5e3
+SHA1 (patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h) = 5e5482c37a24b9ee51b049e4d2ef14b7425d29eb
+SHA1 (patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc) = 822e149dfab064d1280c5d24430f13e287fc307c
+SHA1 (patch-third__party_blink_renderer_platform_runtime__enabled__features.json5) = 201d76b5e4df70d8b11f3f3219491dd48a7e4e6f
+SHA1 (patch-third__party_blink_renderer_platform_scheduler_common_thread.cc) = 1dd0d7a38400bb25eaa668fdcaf93c87446e4bba
+SHA1 (patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc) = a9c90ce38ed83f7f1738c62a1766cc25b866fff0
+SHA1 (patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc) = 84f1085fda8d61237337542ae5773e626fde5bd5
+SHA1 (patch-third__party_blink_renderer_platform_wtf_container__annotations.h) = 2355c8e823b1a75c95666af92d005de8befd653d
+SHA1 (patch-third__party_blink_renderer_platform_wtf_math__extras.h) = b24381556a37452e7521bd54f603bbf4cb74afcb
+SHA1 (patch-third__party_blink_renderer_platform_wtf_stack__util.cc) = f4d9089baa79329c9ca37d084a25cc81c133ee9f
+SHA1 (patch-third__party_boringssl_BUILD.gn) = 3c20fb8b1238faade8fe2ba0f0543a97504dc2de
+SHA1 (patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c) = da70cd731ee1926dc340d781cfeedeb78a7cce3c
+SHA1 (patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c) = 74f2a0c2a2e61afe93dafda5478a400f8bc37d40
+SHA1 (patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c.inc) = b947a900a274c9f20529c34a500a6818393f4cc6
+SHA1 (patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c) = 900d24f5273a41014e9344ab8f51bd8ad024fa54
+SHA1 (patch-third__party_boringssl_src_include_openssl_cipher.h) = 61615a186eb206214ae04c1071181f8bb5373485
+SHA1 (patch-third__party_boringssl_src_include_openssl_digest.h) = 24588829d168a87928a2200d778ed36b6f4ff552
+SHA1 (patch-third__party_boringssl_src_ssl_ssl__buffer.cc) = 9e3fb832e8238edf32d4d5ab78f2a076100d3382
+SHA1 (patch-third__party_boringssl_src_ssl_ssl__lib.cc) = 2ba977621df915bee2e2a4cc001bcd96d13a318c
+SHA1 (patch-third__party_brotli_common_platform.h) = 5531c6ba9b0cc24c085b8b91ff38a0436dcdb1b5
+SHA1 (patch-third__party_cpuinfo_cpuinfo.gni) = 2a5cba4577a9702ef8884871a490a122bb45b0b5
+SHA1 (patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni) = d315d424a9c44232051d9dd901937e7b0bbc3357
+SHA1 (patch-third__party_crashpad_crashpad_client_BUILD.gn) = a6c4ab0e087ff2bf68f970b6a8cbeb3a7a0da585
+SHA1 (patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc) = 6d4c666c12991e112ff8de4b94dc2ac656e254aa
+SHA1 (patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc) = 48c1e77019e3a0f1c24c2104c5b86b0bd6750055
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_address__types.h) = 739196fa66b4e505c3ecf41e8e4c94ee5de77dcb
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_capture__context.h) = e426058d96f321bcf21c2831b3bc6caf684deb22
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_metrics.cc) = 00bc2b391f87ca6c5fb84b4356f8441ce1b0db51
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_uuid.cc) = 6e1adc388fcc7daa7be3721b52140fee1c1a3ee7
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc) = ee4611fb5843b7448d71328a9c9875369589e8a1
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc) = d13827503646446d8bf9aa7c245cbcce0990d248
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_signals.cc) = 542915a6c83c50b36a72b8c075f14ac74eb0c990
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc) = 050da583bef18b8298f1879e5b1dbf9802a7af3b
+SHA1 (patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc) = d5c90173e07a26cd689a04ea4cd19b77bded89ca
+SHA1 (patch-third__party_crc32c_BUILD.gn) = 4b16ab13e8d356be1bcee0197acd19616b81c2a2
+SHA1 (patch-third__party_dawn_include_dawn_native_VulkanBackend.h) = 5e1e6f1a82da06b845ae2158e1a54d552819e545
+SHA1 (patch-third__party_dawn_src_dawn_common_Platform.h) = d2654415d6d6ab3c93de5235e61666a8a3abeae9
+SHA1 (patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp) = 7154645a7668f2dd9dc3af7b470f0d8e73e2a4c4
+SHA1 (patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts) = 757ddc1f096b3bb5ef4d55bc386abbc1cff0e864
+SHA1 (patch-third__party_electron__node_BUILD.gn) = 6a9f012fdc0b98ec2f14166a0b484883ecc34fde
+SHA1 (patch-third__party_electron__node_common.gypi) = fa2c8660006eebeeea24465047ac561d522734cb
+SHA1 (patch-third__party_electron__node_configure.py) = 1e60ad3da71f035595bf8f9b626e71d0fe349b75
+SHA1 (patch-third__party_electron__node_deps_ada_BUILD.gn) = 817ab2427e8a856aab0e0b055f9b3bcb0f0a198b
+SHA1 (patch-third__party_electron__node_deps_brotli_unofficial.gni) = a72b7696daa12ad4e1e8e148dd2036162dbfe214
+SHA1 (patch-third__party_electron__node_deps_cares_BUILD.gn) = 2e93c0e7f8b3892f09d712eccbdf6c4d87823646
+SHA1 (patch-third__party_electron__node_deps_googletest_BUILD.gn) = 38d6acd86fa4000398576782ac908b68a51b1a80
+SHA1 (patch-third__party_electron__node_deps_histogram_BUILD.gn) = da256176e8a41633fcf0b19b15a43fbddcfb4c39
+SHA1 (patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h) = e1d34d02ccb7f929a3b4dee2a0b427675aaf84a5
+SHA1 (patch-third__party_electron__node_deps_llhttp_BUILD.gn) = 09ea80cc2b2a3306d691e0ebdde98eceda17c09a
+SHA1 (patch-third__party_electron__node_deps_nghttp2_BUILD.gn) = bb6bc728533aa2dca53ac24d4c138b8694261609
+SHA1 (patch-third__party_electron__node_deps_simdjson_BUILD.gn) = a9f32d66a644755c25cbdd64a66e2adde5d81889
+SHA1 (patch-third__party_electron__node_deps_simdutf_BUILD.gn) = 6350aef1a38d1fec3a5487b4ebbedd44a77754b5
+SHA1 (patch-third__party_electron__node_deps_uv_BUILD.gn) = 7220f35f9a076eade14f21b514197437e7c1ddd0
+SHA1 (patch-third__party_electron__node_deps_uv_docs_src_loop.rst) = 1d021e0ee0da65dd729aaa0d645395d7dff34baf
+SHA1 (patch-third__party_electron__node_deps_uv_include_uv.h) = cd1a5016cd1ed00720a665623aced3a7daa38fa0
+SHA1 (patch-third__party_electron__node_deps_uv_include_uv_errno.h) = dea65240f9b553edff20424a3c5602b9de846e39
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_async.c) = 37189a8f9d5a7faaccb1d78d030b187c9dfcb0c3
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_core.c) = adaa2d74a4c3723960943d27507f8e9819967fb5
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_loop.c) = 0dc45a0ed3ee5ef39c1b3da77be72f67e46fd758
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_pipe.c) = b153a6ef98eb5deca2ae421e9eb78b8047327e83
+SHA1 (patch-third__party_electron__node_deps_uv_src_uv-common.h) = 2481963a13d7d66bcaf807b4b28fdb721abf3190
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_core.c) = a1f46108a8828e9083cfbd1e2d4f1a78b7fc72cb
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_process.c) = fb88602950c1fa221fdf1104e6b49fb3c0300695
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_util.c) = dc779e33aa8baf152536cacd8c77cae2411af724
+SHA1 (patch-third__party_electron__node_deps_uv_test_test-embed.c) = cd1494d608c1a719a985b3cf8838d08e12399e4c
+SHA1 (patch-third__party_electron__node_deps_uv_test_test-list.h) = 97427c3d51c32e62999d611d667e7bb377dc5eef
+SHA1 (patch-third__party_electron__node_deps_uv_unofficial.gni) = 8944264952b2e9ada66bf7ac95aa43d5ecf9a3a8
+SHA1 (patch-third__party_electron__node_deps_uvwasi_BUILD.gn) = 4079b93104fa673b3b45662146c17f1c43d6cea7
+SHA1 (patch-third__party_electron__node_deps_uvwasi_src_uvwasi.c) = 1878259e25dd96fedc05c6f7e265913d3460bd05
+SHA1 (patch-third__party_electron__node_doc_api_cli.md) = 63e78eb37b55655cfc936febd511ccd9af618883
+SHA1 (patch-third__party_electron__node_electron__node.gni) = 397551257c161c382158d03c6cb85f9994f57d49
+SHA1 (patch-third__party_electron__node_filenames.json) = a40e1ff4038e86586653bfdb4c16b9d79ce33924
+SHA1 (patch-third__party_electron__node_lib_.eslintrc.yaml) = 061260fb52493be8b51d7999a8b7e08760d8bcff
+SHA1 (patch-third__party_electron__node_lib_child__process.js) = 64f5e9adefc2213cd81c202ae55ae7115869d7f0
+SHA1 (patch-third__party_electron__node_lib_internal_assert_utils.js) = 1b9ba3d9f3942a7c8ec4d396cd86a201d86875e8
+SHA1 (patch-third__party_electron__node_lib_internal_bootstrap_node.js) = 567a4d42470b6a1b34f1e2d73c1aceaa62915601
+SHA1 (patch-third__party_electron__node_lib_internal_constants.js) = 31193fe532f031c4d7daa2ad315c3ad61c788812
+SHA1 (patch-third__party_electron__node_lib_internal_fs_watchers.js) = e978bf9536693c81f6c4a2605cedadba541e1236
+SHA1 (patch-third__party_electron__node_lib_internal_http.js) = a2a195e4ec28ac093e86fe27bf711355eff99a0c
+SHA1 (patch-third__party_electron__node_lib_internal_main_worker__thread.js) = 9bf8a18edba685044c1ce88d76a721597326b8ce
+SHA1 (patch-third__party_electron__node_lib_internal_modules_cjs_loader.js) = 1f17552523da9f94740ecee6e725f31d856c6f86
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_get__format.js) = ac434489c83004d6ddea22fa408812292f066249
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_load.js) = 4232517c5b4a4e26429877baefad976774837f27
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_resolve.js) = b744366392968133e2fe51e7eec75faed38ed17b
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_translators.js) = 7a70c9f6dd1475fa283907870580502d552ade52
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_utils.js) = ef6f37b31866f23e81bce53bf4342187b47d1566
+SHA1 (patch-third__party_electron__node_lib_internal_modules_package__json__reader.js) = 8b7426ca23d8822f6524fc1af7f48554fb9cf67e
+SHA1 (patch-third__party_electron__node_lib_internal_modules_run__main.js) = ed977465d7f2e2d1c7647482d9ec6bd5a48721be
+SHA1 (patch-third__party_electron__node_lib_internal_process_pre__execution.js) = 529be374aa451eb8a3a9130e73d3f30bf376f0a1
+SHA1 (patch-third__party_electron__node_lib_internal_url.js) = 760caebc86b064f7bf0b25f215e8954b229751a2
+SHA1 (patch-third__party_electron__node_lib_internal_worker.js) = 10ec1854512e5073f3b3368d858b0969550bd96f
+SHA1 (patch-third__party_electron__node_node.gypi) = b5e051a442afb246c1605765a61e8bb6d890fb8a
+SHA1 (patch-third__party_electron__node_src_api_environment.cc) = 7c76baaee79c019a75b02d07f24dfc0b469089de
+SHA1 (patch-third__party_electron__node_src_base__object-inl.h) = cb050719fea2034ef4bd51e25637a85d57d3f416
+SHA1 (patch-third__party_electron__node_src_base__object.h) = a611d21b2553440c7c3f64c33775227f6653fe4b
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__cipher.cc) = 464e2d3422f2243e82bda6d303aa2bb638b2d950
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__common.cc) = 5b27e2c34bd0eb93ba858da8e66f8aa76691976a
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__context.cc) = 787e23beff3ec45af82bc3d5fd7a97124386be49
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__dh.cc) = edf6be87de8c57b1906b77a8a6bd58e3a0195fee
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__dsa.cc) = 05edcf4dc2403e2211d7930f6cc73d7ee631fa9d
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__keys.cc) = ae30126dc3fc1c35b860cf3ceeb0d2e59d97890e
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__random.cc) = d391343084772c2707f72758348adf6c527f6e83
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__rsa.cc) = ed2c6f947ce90aaba6a6e607d72cf8ba618992b3
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__util.cc) = 74a463ecae3cbb991e7d99bf7de9ddb7528575e2
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__util.h) = 728136c0f83946acb6ff7f70233b9f2174e8b6a3
+SHA1 (patch-third__party_electron__node_src_env-inl.h) = 65973a576d2f3d4904fd6d7717658069ab0fea06
+SHA1 (patch-third__party_electron__node_src_env.cc) = b4fb4e1408ddbb0ed03826b43c3156c3e4cbe5d2
+SHA1 (patch-third__party_electron__node_src_env.h) = 902e18932180ae2d1a184a72d9d2687706c968c8
+SHA1 (patch-third__party_electron__node_src_handle__wrap.cc) = 64e061e3b10867f295a50b0bb8d8f4f0cf3c1ac7
+SHA1 (patch-third__party_electron__node_src_histogram.cc) = 668af5eb8114bc5e3b624be4915fe412fd1e3d5e
+SHA1 (patch-third__party_electron__node_src_inspector_BUILD.gn) = 89bf3b6a0d435447a274a12b03a0df4c92429fda
+SHA1 (patch-third__party_electron__node_src_module__wrap.cc) = edd1ded77741b9c71fe94f60200ce20d8d3afb82
+SHA1 (patch-third__party_electron__node_src_module__wrap.h) = 46b746ad8a34c5fc5764315aa2e438c4ba6a6b4f
+SHA1 (patch-third__party_electron__node_src_node.cc) = 48bf344e22432895d06988a9aa30dba8432bcc09
+SHA1 (patch-third__party_electron__node_src_node.h) = 9a1896ab1ebaee912ffb34a647fa9f321a3c1025
+SHA1 (patch-third__party_electron__node_src_node__binding.cc) = 7adc814d47e1eeb95f4c8dc7096c5de4b0a640df
+SHA1 (patch-third__party_electron__node_src_node__binding.h) = e99fbf848695dc220b385ba397085f874d344487
+SHA1 (patch-third__party_electron__node_src_node__buffer.h) = f74e5012d567be5d91fe362f0cd3bd7296d5c81f
+SHA1 (patch-third__party_electron__node_src_node__builtins.cc) = bd9d1fb9d7c137bb8bd33390376fedbedbbec457
+SHA1 (patch-third__party_electron__node_src_node__builtins.h) = 81e30032c20f6e7a591b6c76cf4d04a5b3231824
+SHA1 (patch-third__party_electron__node_src_node__constants.cc) = b516233d64c8c0836a2fc7a7c86743252658bd81
+SHA1 (patch-third__party_electron__node_src_node__contextify.cc) = 4a29ea9e5fb00c0152b77b0141920c47838efdbc
+SHA1 (patch-third__party_electron__node_src_node__contextify.h) = 3d9329e910a89d97119ea76ad51641800fb2bcc7
+SHA1 (patch-third__party_electron__node_src_node__env__var.cc) = c58064ffd40df34e074b78c0e5759b854b3c59bb
+SHA1 (patch-third__party_electron__node_src_node__errors.cc) = 68777f3a55387eb418b93e9104da4bc87ddc8b72
+SHA1 (patch-third__party_electron__node_src_node__errors.h) = 2a208a4a1ccbc928fe7efaca2edecd3f2e11b517
+SHA1 (patch-third__party_electron__node_src_node__external__reference.h) = 61959e9e722031904ee2a38f717ce15c6b71c0b8
+SHA1 (patch-third__party_electron__node_src_node__file.cc) = af75ce24e332971c1c62e6e06a1c7b2cb6ab231a
+SHA1 (patch-third__party_electron__node_src_node__file.h) = 8c8481d1fe6cdd1c15f0680b57a4c044fa1bf3a3
+SHA1 (patch-third__party_electron__node_src_node__i18n.cc) = cb28ca8d5e541b67f635b969b39b98a355c2223f
+SHA1 (patch-third__party_electron__node_src_node__internals.h) = 4c6b97e2f32b9bdfade6cc726b30c6c42a496a36
+SHA1 (patch-third__party_electron__node_src_node__messaging.cc) = 3ece95578fadb5985069a63014e8f3090049a531
+SHA1 (patch-third__party_electron__node_src_node__metadata.h) = 1404a52d8944fa3a261e539626c0c835fd6a1dfd
+SHA1 (patch-third__party_electron__node_src_node__options.cc) = e1dd7485198d7b538869ba171634c14bde528333
+SHA1 (patch-third__party_electron__node_src_node__options.h) = a9286f2224d5020fb12539e19fdcb3e94a3b6c1f
+SHA1 (patch-third__party_electron__node_src_node__platform.cc) = 4b142dcea407b2c64f4fb95557fba74dcc81222a
+SHA1 (patch-third__party_electron__node_src_node__platform.h) = b1d0180043f58f94d1880663bdf5d0a7d7a49205
+SHA1 (patch-third__party_electron__node_src_node__process__object.cc) = 0d08646f7e85822a9456087ba941c1bebb34af2c
+SHA1 (patch-third__party_electron__node_src_node__serdes.cc) = 9eea39406d4049faf6fd815c9473ba06f640ddc2
+SHA1 (patch-third__party_electron__node_src_node__trace__events.cc) = 2d85f7a87ab7324c9f4909abca03d7ef6d3082b5
+SHA1 (patch-third__party_electron__node_src_node__wasi.cc) = 99c518516e2e9ab5d1cbfd5dde20d46a415ea802
+SHA1 (patch-third__party_electron__node_src_stream__base.cc) = 393c402a031a01fb33079459319d638a32d71871
+SHA1 (patch-third__party_electron__node_src_stream__base.h) = a8e08894a996e98095f33a29b1c4461c2ef1e937
+SHA1 (patch-third__party_electron__node_src_tracing_agent.cc) = 540cfb0a33191364e8cff24cdf1acddf38e64742
+SHA1 (patch-third__party_electron__node_src_tracing_agent.h) = 06b189d7d280a635c78ab1f800758f3ea0b03442
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__buffer.cc) = 6c396daf9a5affcaa0d44c823b54ea6d29ed6075
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__writer.cc) = c7b6efcbf8c9392e4a7d96326d9b687e1b44fd1c
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__writer.h) = 71213dc5042f7d10f81efe9c3038a79bf72824c9
+SHA1 (patch-third__party_electron__node_src_tracing_trace__event.h) = 6ccdc9833ff48ab212bf1621013048ccb8b4b9d9
+SHA1 (patch-third__party_electron__node_test_addons_cppgc-object_binding.cc) = f90705a67b3f73d32e7d889d40eddc417dee9150
+SHA1 (patch-third__party_electron__node_test_cctest_test__cppgc.cc) = e47230544d1c5a14b63ce67df28e6c67f67f7a9a
+SHA1 (patch-third__party_electron__node_test_cctest_test__environment.cc) = 1cf12cee2447dc08565ae3ece4d29bce2335f6cd
+SHA1 (patch-third__party_electron__node_test_common_debugger.js) = 5dc77dcf0d77d51108cbaa6fdd0e4732f8f13ac1
+SHA1 (patch-third__party_electron__node_test_common_globals.js) = a7381cef78d1b013ad5bd3a33c3c7b9e662a55bc
+SHA1 (patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js) = 00cf451600ef36a96b1ccbbae85b068f251e98de
+SHA1 (patch-third__party_electron__node_test_fixtures_errors_promise__unhandled__warn__with__error.snapshot) = a8522d03d2a6051f95c9eb91df772334364eff9d
+SHA1 (patch-third__party_electron__node_test_fixtures_errors_throw__error__with__getter__throw.snapshot) = 492cdfea3b99f0a9e7da6a61c4f3a3b34dafa654
+SHA1 (patch-third__party_electron__node_test_fixtures_errors_throw__null.snapshot) = c30d195eaf7eeed166a3689f5cc1e1570b8930f2
+SHA1 (patch-third__party_electron__node_test_fixtures_errors_throw__undefined.snapshot) = bc41c26ba036725ff3b995efd3503a1a57c2de35
+SHA1 (patch-third__party_electron__node_test_fixtures_eval_eval__messages.snapshot) = e3fd76417f38b069d20d06deb8c08fe1f8c607b8
+SHA1 (patch-third__party_electron__node_test_fixtures_eval_stdin__messages.snapshot) = 217d15af9e9ba9cc52394c3b0e67736eab491cf7
+SHA1 (patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js) = 99aef89175b6dc94e450eb52d7cebf898fb0a3d0
+SHA1 (patch-third__party_electron__node_test_parallel_parallel.status) = e697b658c2e84e7301bcf7174232ede583347faa
+SHA1 (patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js) = 75e42db004dd7f541b2cb74c6d0dd8b464eed354
+SHA1 (patch-third__party_electron__node_test_parallel_test-cli-node-options.js) = 3dfd5a0edce7026ab4a736c71249c84a1144c8e0
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js) = 6e2907030ed768b63630c8ba4b274fbb26c2d733
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js) = 66b4df3f09f173f621419e53e22bfc1b98bb86ae
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-certificate.js) = ec3bafcdce7f9edd9afde0d5b21eb5c9c6da6631
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js) = 5d32b8bbf3ba12464ac21bc4fc784f9156271f2d
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js) = 47164e9c78ea8b1f01cfccf86230205f6342f17a
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-classes.js) = d06599f409abe1872e5e6e4bbce12da6f57c78e5
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js) = 23b885e810b88974057e4257b653e720f2f05fa3
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js) = d45303ca92ba7302e00229e3b5125ead02b65dd8
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh.js) = 266de8352a5800019d110aac54962d16075e3c5a
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js) = 6d8d43d4d4828493304a9becd82e9a0d3463cdc8
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js) = f3e6d9eae77b4d98fd8c67bfbb1fafe3e3eedecd
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hash.js) = aef10fd82ec63358c65e9a458ef52c47d6c63da2
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js) = f29e1723f93b43924cc5af15a3fb00fdd9b6d858
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-padding.js) = 5a374f5ad2e340b800b679031494984eeebd5156
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js) = 687e8199e7ce0626344244102477916630728e1c
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js) = 2c336851eec8e023fea781cd2e6ef129e07c143f
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js) = 7505af1154a578f9cd3f64e8e16783c3e39eb4ee
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-stream.js) = c67d900d14ac44560c413ea109fb5407b4ef9179
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-x509.js) = 034686c06fabb6a469345715c75510f592b30919
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto.js) = 1f2a60c113e81744fd8950eb5a044b764712d015
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-address.mjs) = 08e2ab2b35361d8db0231a5370aeb7cc1194ed41
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-break.js) = e60b860b41dbdf7509078eeb4524b830042749cb
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js) = 73709d021955752b2250a651589c51e7478a6be2
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js) = 410fb9d5cfa9c63f9c86275db26624eed80247f3
+SHA1 (patch-third__party_electron__node_test_parallel_test-fs-write.js) = 1c0ec838d22cc2203a18efdf45764874c272da1f
+SHA1 (patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js) = 1dbdedea720f1303f26823831f08814576368cf5
+SHA1 (patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js) = d8c2bbe494aea9cfdc66fa658525a26cbee9f5b8
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs) = 510315cb19f93fd7e4ed4bc26bde35cf5781c303
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-eval.mjs) = 601f5fd57c9fc60ec51d6b46aae553ffdff03123
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs) = c10af61e1ded9cf5d0845dc095bc341ccdd318d4
+SHA1 (patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js) = e5dfbfdd89383674124f13f0d83ba6faa3fe09a3
+SHA1 (patch-third__party_electron__node_test_parallel_test-tls-write-error.js) = 080dfad3f5b3b483852ac34184045bedf8e362f1
+SHA1 (patch-third__party_electron__node_test_parallel_test-v8-stats.js) = 5204437aacc5b1fca17c447e4434c645b6b59c3f
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js) = 6d58c5f3cb61698224a66fd189b00f24071cf554
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js) = e7c03578624c8d48a9b6205ece4019510c33d42e
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js) = 8bd3cac05e2b78b67b21fa905670fb45a16c95e5
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js) = c102a63d642b042f8f70b4ffe1f430fc10c46896
+SHA1 (patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js) = f9ee088cae6d741725833a21e1f622e2cac6a970
+SHA1 (patch-third__party_electron__node_test_parallel_test-x509-escaping.js) = f8160be248c388903f067aa3ad6ab26cb53ecc29
+SHA1 (patch-third__party_electron__node_test_sequential_sequential.status) = d7b992d946c0ba568d91d04ce4e4ff3dce27ada0
+SHA1 (patch-third__party_electron__node_test_sequential_test-debugger-pid.js) = ddba2d4ac4c10be36db913d4fc4d06e16b639b0f
+SHA1 (patch-third__party_electron__node_test_wpt_status_streams.json) = a05166b9b63bbe313f37a62ed667da6ba5fd07ee
+SHA1 (patch-third__party_electron__node_tools_generate__gn__filenames__json.py) = 8f100694ed3b87e1821e5d5988dafe0b1a6d9bcc
+SHA1 (patch-third__party_electron__node_tools_generate__original__fs.py) = 625b912ede441e9441649a77f26f80f0b035d530
+SHA1 (patch-third__party_electron__node_tools_install.py) = 2a252b8a02f82591d863c57f50e1bac9e1471677
+SHA1 (patch-third__party_electron__node_tools_js2c.cc) = ba48a995ca51c65137d64a8aeef39df89d032fb7
+SHA1 (patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg) = c87df18f95bc92a6b8db680fe809c605e5e141c6
+SHA1 (patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg) = 238675c967ba4ea559841a599a7af6fcfcadd93b
+SHA1 (patch-third__party_engflow-reclient-configs_configure__reclient.py) = 694a9ddf7b6fc5227efbe217e884e4a52a551fba
+SHA1 (patch-third__party_engflow-reclient-configs_python_python__remote__wrapper.template) = 663e01869b9f2d1e423305e7e86970c3f3a946ed
+SHA1 (patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg) = 8b3b231dc92f50544472a8fb6c62d6e872dedf7d
+SHA1 (patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg) = 098765d1cc47364faa3ffc3161b1791edce9cdd7
+SHA1 (patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg) = c120e008c18f10698c1a26f06167f56729b88be6
+SHA1 (patch-third__party_engflow-reclient-configs_reproxy.cfg) = af7183f2f9f50019fe41953e3d588632cada87a4
+SHA1 (patch-third__party_ffmpeg_BUILD.gn) = 3f2453a41120b4b69af0db0ac7dad87ea309aee0
+SHA1 (patch-third__party_ffmpeg_libavcodec_x86_cabac.h) = 21a429fdfe8adae28f7831b19bd21aee8ce4c055
+SHA1 (patch-third__party_ffmpeg_libavutil_cpu.c) = f574ea7f09041ec9fc481432e0e4c2ec8f060324
+SHA1 (patch-third__party_ffmpeg_libavutil_mem.c) = 2ff91b951d0a7cb90a6cb61b43d7917b738d2a9a
+SHA1 (patch-third__party_ffmpeg_libavutil_random__seed.c) = bc27cc9ebe9d03de729d532823d6e344de024d4a
+SHA1 (patch-third__party_ffmpeg_libavutil_x86_x86inc.asm) = 331c8e4f898bb844cd026a6978aae7cf6c84a054
+SHA1 (patch-third__party_fontconfig_include_config.h) = 58697456b6cbb9e3494450e9c7e8e1701ba17af1
+SHA1 (patch-third__party_fontconfig_src_src_fccompat.c) = 462d1e63c07b6f2077576d55cd0d8846cf11885d
+SHA1 (patch-third__party_ipcz_src_reference__drivers_random.cc) = 59efa09f256f2ba39ff7e79b09645be84dd39926
+SHA1 (patch-third__party_ipcz_src_standalone_base_logging.cc) = e9a9911d9d6b0db2d7ba9543866fcc89f7e70d06
+SHA1 (patch-third__party_leveldatabase_env__chromium.cc) = 932e9ec5bce2b966c4799825964d9683f6ef4d1f
+SHA1 (patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c) = 15d26fde898def635dc0c702e7268127727fa78a
+SHA1 (patch-third__party_libc++_src_src_chrono.cpp) = fd9ed680d592fb70fbc9a364d45e3a2da42a00bb
+SHA1 (patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp) = 340046b51630ceab055dcf70c062968f68e3d0db
+SHA1 (patch-third__party_libc++abi_src_src_cxa__guard__impl.h) = 5e66411729acdb492ad779181773665a86ebf201
+SHA1 (patch-third__party_libdrm_src_xf86drmMode.c) = 758935187b40a62817859b667b51afc164e7dc48
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h) = 019db62e5c29c9be474e7b1a9c6ad8033f7b1ef8
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h) = 9b2e1213ecd225ce5f03d6b2ba878c0269467a95
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h) = eb2fd66da21f0847cbc70d101ac08586a0dc277f
+SHA1 (patch-third__party_libsync_src_include_sync_sync.h) = 9a1f23a23a09d882ea8505fff3067832c7ab62f0
+SHA1 (patch-third__party_libsync_src_sync.c) = 7a65665a711aadf2c2e2d18706920be6d72c7d94
+SHA1 (patch-third__party_libusb_BUILD.gn) = 7953157e89d3ce4caefc0f0e0ceb6192fb6879cd
+SHA1 (patch-third__party_libusb_src_libusb_core.c) = 1bb4f2ea72ef4182722a74dab77f47bc643cc40e
+SHA1 (patch-third__party_libusb_src_libusb_os_threads__posix.c) = 463378a75f8f689d1c6871b36bfcc720f47efc6c
+SHA1 (patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c) = 4947851d99c07485cfe02e1e1697ea77661ddf69
+SHA1 (patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S) = 7c42d43e099077c9cb1eadc9ef721b35bd0fdcd1
+SHA1 (patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm) = 6ef54cf64dd1cbf6a34c14105932dcce9661aa2e
+SHA1 (patch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm) = 2a525731f81ea7c51609fe39bcd6c24a41350d57
+SHA1 (patch-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm) = 33f856cdad160be82f07f2d176cb2d12b57de43f
+SHA1 (patch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm) = 46437a26ddc19f7f799c641b57067b0051b59173
+SHA1 (patch-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm) = 5c2964ff1665cdb00658ad70a496e576470ceb99
+SHA1 (patch-third__party_lzma__sdk_BUILD.gn) = 1e14ffb4a80954b47a7a90ed641d98e3cfd87f7d
+SHA1 (patch-third__party_lzma__sdk_C_7z.h) = 77f6b8a3ae66efde8150e7f6ae11d9dfb56a789c
+SHA1 (patch-third__party_lzma__sdk_C_7zAlloc.c) = ce753b419bc7f2ab469eda302e9273ddbee9e142
+SHA1 (patch-third__party_lzma__sdk_C_7zAlloc.h) = bdb45f998e8cb243bdeeaf93b9e032b46230e070
+SHA1 (patch-third__party_lzma__sdk_C_7zArcIn.c) = a27984cca9f22155ec51469b745fcc0d3ea074bd
+SHA1 (patch-third__party_lzma__sdk_C_7zBuf.h) = 25489fd2101d7aa40b9ce6778b389ab0ae03bf45
+SHA1 (patch-third__party_lzma__sdk_C_7zCrc.c) = 6268ecc7023676e679dfe7ebfd22dd7895fe16c0
+SHA1 (patch-third__party_lzma__sdk_C_7zCrc.h) = 228c0c2a33c0acfff96e0258352f87455c83bdfd
+SHA1 (patch-third__party_lzma__sdk_C_7zCrcOpt.c) = 8d672d3bd9ddae7e05b6d1b0e10365488643d1eb
+SHA1 (patch-third__party_lzma__sdk_C_7zDec.c) = 8440c6be8afb219b4553a2c1894cf9fd38fde59e
+SHA1 (patch-third__party_lzma__sdk_C_7zFile.c) = 346caa8fd83f8d00a959d5918f2963276e196e86
+SHA1 (patch-third__party_lzma__sdk_C_7zFile.h) = 8955533a839012fb65a12e530023db781412dd0f
+SHA1 (patch-third__party_lzma__sdk_C_7zStream.c) = 1944d52dfc98e271f155a05bed1e925e77d8d918
+SHA1 (patch-third__party_lzma__sdk_C_7zTypes.h) = 5ce2f661d5bdcb9d75bb34842f2903ec7297c60f
+SHA1 (patch-third__party_lzma__sdk_C_7zVersion.h) = 5bd47f8883ca1ef8cae914795a4e8b9975707c48
+SHA1 (patch-third__party_lzma__sdk_C_7zVersion.rc) = e5011d713188051f5457752482e13bce700c93a3
+SHA1 (patch-third__party_lzma__sdk_C_7zWindows.h) = 4fbdb782c1c467ff03ad0c9421d993f641dc98ca
+SHA1 (patch-third__party_lzma__sdk_C_Alloc.c) = ced9e48040a146c6948e1843b5260da2a4c692b8
+SHA1 (patch-third__party_lzma__sdk_C_Alloc.h) = 03c32a5cb6b497eafabd7b0a9db4b24b21861bf5
+SHA1 (patch-third__party_lzma__sdk_C_Bcj2.c) = 3c538e624ed051821e713fdd618be3b2b795e99d
+SHA1 (patch-third__party_lzma__sdk_C_Bcj2.h) = 77f34965bf3ce8da28622a40b1b9a75d59b9ba2e
+SHA1 (patch-third__party_lzma__sdk_C_Bra.c) = d463b3f81394ef9192b328c9d08f937368a7ec0b
+SHA1 (patch-third__party_lzma__sdk_C_Bra.h) = 2782d0ceba188da837055212f59a92545e033778
+SHA1 (patch-third__party_lzma__sdk_C_Bra86.c) = 7d3090f4329d630390903957310ff74e4fab874e
+SHA1 (patch-third__party_lzma__sdk_C_BraIA64.c) = b774f421f15e25c892b5dc0fa4ae9c64f90d4660
+SHA1 (patch-third__party_lzma__sdk_C_Compiler.h) = 800e6888023d9f0cf08a7aca86db0830d52a9cbc
+SHA1 (patch-third__party_lzma__sdk_C_CpuArch.c) = 7d91aab20dc667ac1a59d4002141ffba8fdbe15d
+SHA1 (patch-third__party_lzma__sdk_C_CpuArch.h) = 62aa048973ac4fe0da5bbbd142b0840b01223963
+SHA1 (patch-third__party_lzma__sdk_C_Delta.h) = d0031a2803e57ff6ef464ff24d6c899af5f836e8
+SHA1 (patch-third__party_lzma__sdk_C_DllSecur.c) = b868eabe941d47b2566aee4b25cbf65aaeda6d22
+SHA1 (patch-third__party_lzma__sdk_C_DllSecur.h) = a5d07e28e4a1e8f55a554969594df2e9585e775d
+SHA1 (patch-third__party_lzma__sdk_C_LzFind.c) = 8afbfa33d08c271244f0cbd053e614e5deb4e47a
+SHA1 (patch-third__party_lzma__sdk_C_LzFind.h) = 62a65861d682ddc4309d18df8e13a50c9530183c
+SHA1 (patch-third__party_lzma__sdk_C_LzHash.h) = 7f776b3e503ec74b904e83b90bcf8f4ef6a6623e
+SHA1 (patch-third__party_lzma__sdk_C_Lzma2Dec.c) = fe67847ab1f7269c322482a0cc6db7f1f693775e
+SHA1 (patch-third__party_lzma__sdk_C_Lzma2Dec.h) = c204ffe580b4119acc53023507194ad0c5753010
+SHA1 (patch-third__party_lzma__sdk_C_LzmaDec.c) = 8fe9e2c33862e059da3e8bc26c8b0eeb4df6b1d0
+SHA1 (patch-third__party_lzma__sdk_C_LzmaDec.h) = f97ad7149b6224fdbcb6ba3485e5fa1f0866d11f
+SHA1 (patch-third__party_lzma__sdk_C_LzmaEnc.c) = 7145c6db91868f7ae6524ca97852657c68043813
+SHA1 (patch-third__party_lzma__sdk_C_LzmaEnc.h) = 7193e22b04c0790736f380c1732b0ff7967ff26b
+SHA1 (patch-third__party_lzma__sdk_C_LzmaLib.c) = ee56951d130d517064747c11c6b02900fbd8d76b
+SHA1 (patch-third__party_lzma__sdk_C_LzmaLib.h) = f49017a1ea22e4d8a0246df305ac2538ab53f4f1
+SHA1 (patch-third__party_lzma__sdk_C_Precomp.h) = 3af351e480a71644b2ab1921a3c9befe80a38f28
+SHA1 (patch-third__party_lzma__sdk_C_RotateDefs.h) = a0d18faa3f03c25e7c45af4f87c8d6d0ce1b2676
+SHA1 (patch-third__party_lzma__sdk_C_Sha256.c) = fe5fc3790a1c71013e21b1ed1e08a4e4027a93ed
+SHA1 (patch-third__party_lzma__sdk_C_Sha256.h) = cc3188bacac9b6dd3b4c192fe8372ca61d6e502a
+SHA1 (patch-third__party_lzma__sdk_C_Sha256Opt.c) = cb1a7990600dea457ed61458106b27299a90b1f2
+SHA1 (patch-third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn) = 6d762d5e869dce365b7f86b715682c3b9891da50
+SHA1 (patch-third__party_lzma__sdk_C_Util_SfxSetup_Precomp.h) = 9db295194a0ffdfe6183f56d8cba1db2b54f08f9
+SHA1 (patch-third__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c) = 32a730d8012bb819edf6f6078e9176692a674772
+SHA1 (patch-third__party_lzma__sdk_C_Util_SfxSetup_chromium.patch) = 0def0c50fcc4e8e1c51f21fb510abcecbb8464c3
+SHA1 (patch-third__party_lzma__sdk_C_Xz.c) = d2d540637906d08a7b616cf83903fdf04bb6fb14
+SHA1 (patch-third__party_lzma__sdk_C_Xz.h) = 285e821f4e0cc18d0275e2d41a6cc8c9ad62ad17
+SHA1 (patch-third__party_lzma__sdk_C_XzCrc64.c) = b355553d040eea5e06b5b2246b1d8f89a1a2e3bb
+SHA1 (patch-third__party_lzma__sdk_C_XzCrc64.h) = 170c8f2f497a0bf3f237a0b88e7ca3711739d0cd
+SHA1 (patch-third__party_lzma__sdk_C_XzCrc64Opt.c) = d7f1a2500d807d5b0608d7433bf91224b1ef2b74
+SHA1 (patch-third__party_lzma__sdk_C_XzDec.c) = 5bd4eaede49e2d104224a8aaf406ee8b375d445c
+SHA1 (patch-third__party_lzma__sdk_C_XzIn.c) = e9570e574da41d7731c41725ac61733862a15e3e
+SHA1 (patch-third__party_lzma__sdk_DEPS) = ad84a06c9b6344bbe88394b8fab7cef50d6cdd43
+SHA1 (patch-third__party_lzma__sdk_README.chromium) = a8bcf00553ccb6d74efa9df113e09176dfde7d31
+SHA1 (patch-third__party_lzma__sdk_chromium.patch) = 185ed061ceb9d6e25b37bcd6c43f31c3b57cad0f
+SHA1 (patch-third__party_lzma__sdk_chromium__ubsan.patch) = 911e5587c90deafcc63e1fd6ad5a01a9512f7ddb
+SHA1 (patch-third__party_lzma__sdk_google_seven__zip__reader.cc) = 32b3848a49c3a319bd97825081095735b48cb83e
+SHA1 (patch-third__party_lzma__sdk_google_seven__zip__reader__unittest.cc) = 2be34a5e071fbbe381121c6a0fc6a441c79c25b1
+SHA1 (patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc) = 8caaabebc1925e1698d294dcbb9bcdf2c102911d
+SHA1 (patch-third__party_nan_nan.h) = 9ffdba367cf18e7a4881fbd8722df62f18b68b3c
+SHA1 (patch-third__party_nan_nan__callbacks__12__inl.h) = c9dfc861c8a04bed5dc9689c488cf89111cf7504
+SHA1 (patch-third__party_nan_nan__persistent__12__inl.h) = 4e94b761106ff447fd3557923d9103710078eee7
+SHA1 (patch-third__party_nan_nan__scriptorigin.h) = 59b41814478fb68c53f4d8d74e11450d8bd4740f
+SHA1 (patch-third__party_nan_test_cpp_indexedinterceptors.cpp) = 16898f42a8b22c248cc2cc60ae06ff256a41b7b0
+SHA1 (patch-third__party_nan_test_cpp_namedinterceptors.cpp) = ad5970e5817be5bd131941182265ce4765edb08b
+SHA1 (patch-third__party_nan_test_cpp_news.cpp) = 5ac098da4e345b4413c1d95b47c4613f622af963
+SHA1 (patch-third__party_nan_test_js_accessors-test.js) = 28e721e75af74a57807842c11737374c2ac945e6
+SHA1 (patch-third__party_nasm_BUILD.gn) = c034b7acbaaa9f82999dbecdb8ad67270b917b9a
+SHA1 (patch-third__party_nasm_config_config-linux.h) = 015eaf9a1b4ac8bdc437e97902b66bcb1501cda3
+SHA1 (patch-third__party_node_node.gni) = c60313cafe9eca85ec25bd55f5b513bba43ce43a
+SHA1 (patch-third__party_node_node.py) = 48565ff99ebb1bdbe9f037a787e034302ab465b5
+SHA1 (patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp) = d6573f14cc0939658bf44e8a9f6ff41e0ecab4a9
+SHA1 (patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp) = 908461ba14666f24c2c07d0287d61542f119063a
+SHA1 (patch-third__party_pdfium_fxjs_fx__date__helpers.cpp) = b7c8bb7af83e45be7049b4eee899e8b55edb8ad6
+SHA1 (patch-third__party_pdfium_pdfium.gni) = 2cad868adbaf4192b0259f30e5df780071a49c6f
+SHA1 (patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp) = f6fbba367436e413948d3bd31681ca4151e34061
+SHA1 (patch-third__party_perfetto_include_perfetto_base_build__config.h) = 0160f104bb0b57c2bad1d91907747988b7906ce5
+SHA1 (patch-third__party_perfetto_include_perfetto_base_thread__utils.h) = 9c459b29f8182de4468454b861f1a756e7957af5
+SHA1 (patch-third__party_perfetto_include_perfetto_base_time.h) = 4628726347a88076e3f4e715872a8415d6d6765b
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h) = 7c063ab7d9c6ed4f40d533fd25212b5fc34e3bbd
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h) = b84e5a23c5764db1ac3c7985e8ab8b9e5c24c917
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h) = 9de9021abaed8d589c82dcfa06f010a00a6549ce
+SHA1 (patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h) = 32cadf1ba4a2fc7933a09651aae50219c1a5a4c3
+SHA1 (patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto) = 11f3130fed9d9fa6df7c4c7d5a0ca572cddedfd8
+SHA1 (patch-third__party_perfetto_src_base_clock__snapshots.cc) = a51f3d13c14a82763d63177c44b780c1762d113c
+SHA1 (patch-third__party_perfetto_src_base_event__fd.cc) = a2c978ef7d7d98a6ace3be545731892081a7779c
+SHA1 (patch-third__party_perfetto_src_base_periodic__task.cc) = a170c66df51ad73069addd4fd4a7dd9e4b4a99eb
+SHA1 (patch-third__party_perfetto_src_base_string__utils.cc) = 164c70e432ab6b90bd91825f282915271210eb7d
+SHA1 (patch-third__party_perfetto_src_base_subprocess__posix.cc) = ee50ecf079455007b28511e86f41d6062062f485
+SHA1 (patch-third__party_perfetto_src_base_test_vm__test__utils.cc) = cf367f54d7588575ad0230f5806f9eec6646c55e
+SHA1 (patch-third__party_perfetto_src_base_thread__task__runner.cc) = 30b1f7852236c958b5c490d0b47b29fdd5ac65ac
+SHA1 (patch-third__party_perfetto_src_base_unix__socket.cc) = e5e0ac061526438fb9a3dbedcf79f0ff7205d49a
+SHA1 (patch-third__party_perfetto_src_base_utils.cc) = cf8590bfc92ce36be5d2ffd240d6bb6bac2fc403
+SHA1 (patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc) = fdc99b249be07c9057fe2b686d07a8fb1ada0839
+SHA1 (patch-third__party_perfetto_src_tracing_ipc_memfd.cc) = 9da790d450a2567e994de1e75e6679f4a47c0a40
+SHA1 (patch-third__party_perfetto_src_tracing_platform__posix.cc) = bed12b79c42958f628e0161cf86bc6409129b2f7
+SHA1 (patch-third__party_perfetto_src_tracing_track.cc) = b4189a86b0518f4a3eb3cd5dc6821d39756a18af
+SHA1 (patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h) = db4b5ceab3407d7d2806c91b5d40b12ff4358ff9
+SHA1 (patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h) = 87413e5aaadc17b86acc35c0dfe0f696d73e61bd
+SHA1 (patch-third__party_skia_src_ports_SkMemory__malloc.cpp) = 5fcb950c6410e914ed250010fddd1ee9825664d3
+SHA1 (patch-third__party_skia_src_ports_SkOSFile__posix.cpp) = 43f9ef698244c59e3b4024c8c5409a7ca2c4a7df
+SHA1 (patch-third__party_speech-dispatcher_libspeechd__version.h) = 2bfd59cdd108658613df752d8cb9e18daeac73be
+SHA1 (patch-third__party_speech-dispatcher_speechd__types.h) = 9831e3aa9b476ac2460a4a059a74c2a42eb55416
+SHA1 (patch-third__party_sqlite_BUILD.gn) = 3bf257aaa3ec0946b4211a224f0dd5c4b454b2e3
+SHA1 (patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c) = c82e0ed480579bbd8fdc37e54d6cedf7039bc95c
+SHA1 (patch-third__party_sqlite_src_amalgamation_sqlite3.c) = 84acf0a91b5b3ed4061a0ee6cc63c543d87b9f6e
+SHA1 (patch-third__party_squirrel.mac_.gitignore) = 1131e4cd58c3b8356eb889e5e5e7d176dba1b559
+SHA1 (patch-third__party_squirrel.mac_BUILD.gn) = f595fc0a2f8bbf3e8d0fcff7aa5c93b2bc39989a
+SHA1 (patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h) = 4478238b20dda7143fe9cf415ca3138364631b92
+SHA1 (patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m) = 5afd7a8803038611bb0d5118bddc8fc44447dfa0
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m) = 34448fb08b1a37537a30087ae0e5108201eedd38
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m) = d7dcc2f18fc5ea7b2fd39cf2c3a7117f4606bcbf
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m) = 3d777d69ccaa3644b54643c0a11249898c8f8d11
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h) = 3acac560107b80ba741f3d97b0d22894094880d1
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m) = a2ea10f7a02a33dcee5440da4404d10bd80d39ab
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m) = 43be7e8fe004357345c6b6af8325ebf032f4bee7
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m) = 30f69171b7772fc1495d64ae5ecf1c73bfb362c4
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m) = b37a4f92c4826842e29dc12f09c3f751ab871b17
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m) = 9580dbf78181e48c0d9289c38ac473ad9c8fffa5
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h) = 35986df83374c248c688b69b07d6463c9a36577e
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m) = 086b0bc859b4ed84b8863622dcba745f535952e9
+SHA1 (patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m) = 84bf3ca7b3d73052e1e4c0e17c87e20333d93f37
+SHA1 (patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m) = 11ff6c6e395ed048f428f68dbeff773bd3b20073
+SHA1 (patch-third__party_squirrel.mac_build_xcrun.gni) = a6ae9d0b1c69723d35c1af783d008228afc23b31
+SHA1 (patch-third__party_squirrel.mac_build_xcrun.py) = 7f99e6dbb83e99e9059db7c6123ebb049ff4fb9f
+SHA1 (patch-third__party_squirrel.mac_filenames.gni) = 10feffa02ef1a19d9589d32a0f8ae60a4db80642
+SHA1 (patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h) = 3499baf0b4fe8ec5c16c857aa92b0251e00bc66a
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m) = 619a56e715ebffacffc8b5f9ad6fc60b3a83b0ea
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m) = ee34e6e6783e4371c38b594dc9b1733005074c53
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m) = 0e8752233d83cf3e36672bbdfbf0250eb3e6ccbd
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m) = 32248194ae6cc51ce445ef450a85b3a80114964c
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m) = 89d2ae0d8d97e7e33077bfa17f188a8a764b1f14
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h) = 5391464fa3518b2526780a118fe7f6e89c42c9a4
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m) = a8f3d18cb0d35a3e5bc8be91733d45ab950194b7
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m) = 4fef1f60b338ff6cdf9df4612883778c0a874d93
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m) = e41dd09431a7d7255f14de044f3dee3d19921d6d
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m) = dfe4085fa29648e93de85de3efdd9ae7dcc5b477
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m) = 453bc1fee080a883bf9a6d8eeb88fb719696df00
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m) = 05ecda4fcef0fb107445199351854a64f2bbcc2a
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h) = df26a979a71005ae1af5d025b0c8bf4d8e2686a6
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m) = c3afffda893f8a91d5586386a7f606f66885a766
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m) = e7a09cc2a081ab3d97f6b7f03a4696542cbef41c
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m) = 6d1a12d4169c7cdb8441294a29c0e3ee55c94740
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m) = c099fc613743cb594368a265ec24672b50dfc60f
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h) = a4978bc2f86caa2ecc9eab48b32b443998f4f2e9
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m) = c62bc5d76aa2224cbff6addfcd0b2f4bb027e1fc
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m) = 99ab2878465eabe8b1d084e216cff48720ee9e49
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m) = e3777bf474b488fefb0bf7133866b3ca37b47a2f
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m) = 2ea27be267fdba683d62207f853e5cbc221ee38f
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m) = c27c0cd49bffe2edc233e6f662ee257ecde2e870
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m) = 30a0385df39d4aef18368a3063410ab7342b5cb6
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m) = 5ea0d210f5bccb2c9678d61282f9d6ea3dcbd218
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m) = c8a33e3123a2431c487766f253df72844a2aa4b0
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m) = 497fa0b39cc48c9e8a4a1303af65cddfef2d233e
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m) = b84cf379041f09844c58258ef4e02995f48246b3
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m) = b6086139648e89d29bf847623669c6344b8ed145
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m) = f67a83af04e34e2adaf0e3b51a652642fcb4f8a8
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m) = e67ed5948cc265d62458045b67d9f1312251c089
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m) = 1b82103a82c627a235b774be6c78cd935099b8ba
+SHA1 (patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m) = a84b7f110adf6b34a76522dfff3eb8c9d7b20b3f
+SHA1 (patch-third__party_swiftshader_src_Reactor_Debug.cpp) = f14c545507e62ec09568ec826dfddad83414bdab
+SHA1 (patch-third__party_swiftshader_src_System_Configurator.cpp) = ea02835c5bc7aee9a0cea4ddb1067786ae043e7b
+SHA1 (patch-third__party_swiftshader_src_System_Linux_MemFd.cpp) = 36622c0473dda289f29c7cc63b17d920b3010f6c
+SHA1 (patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp) = d31a1cab4162aab8f2066e235a6c41fff6ca36c3
+SHA1 (patch-third__party_swiftshader_src_WSI_libXCB.cpp) = 4051a190170c758a8d192a7d7aefe2da8ba0ff17
+SHA1 (patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h) = d0419b12bd85dfcc266f1ad9a407e1c3d46f8cf8
+SHA1 (patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h) = 9ceeb7a4ff018d4969cf8faffde7b302462f240f
+SHA1 (patch-third__party_swiftshader_third__party_marl_src_memory.cpp) = 735a26f1ac9e50ac9f42fe122d3c3b6c3e1df46c
+SHA1 (patch-third__party_swiftshader_third__party_marl_src_thread.cpp) = 7ecc7339bada2b0827cca437267e1184497218dd
+SHA1 (patch-third__party_test__fonts_fontconfig_BUILD.gn) = 6f1e5b8fb73bce32ecf0a7ab52a24af448f87fef
+SHA1 (patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc) = b94ac3c9b86a80cd1c38e1fcbb45fbd4f32b6e54
+SHA1 (patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc) = 82b47d5eecbe256f68f558f97b7bb3f7a4412d3a
+SHA1 (patch-third__party_tflite_features.gni) = 4866aff306408f79f97ab15ff459fb83b1fcf138
+SHA1 (patch-third__party_unrar_src_crc.cpp) = 1b23230764f2f7d836cc2a922645fd6a35536997
+SHA1 (patch-third__party_unrar_src_crypt.cpp) = 8c050b81b39d89e231bc33889cdbd440eba18dbc
+SHA1 (patch-third__party_unrar_src_os.hpp) = 4a617cfb0926006dea1e299c9d9f06430f21775b
+SHA1 (patch-third__party_unrar_src_rijndael.cpp) = 93bcf37f2bda5dbf509fa48c0f0e9c73b3976763
+SHA1 (patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h) = 3a961f0621489080ec7aec700695c875309fd2bb
+SHA1 (patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp) = 91f261542f2f92e1119f0425bc1a7fab3da8099c
+SHA1 (patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h) = c8518641867c4598296ec69a2bbd07a477eeaddd
+SHA1 (patch-third__party_wayland_BUILD.gn) = 98aafab171e4fc04f159089418b14626323434b7
+SHA1 (patch-third__party_wayland_include_config.h) = 82972ac128309ea450cd25425e902c4ded22ef21
+SHA1 (patch-third__party_webrtc_BUILD.gn) = 0702cb9b93b21ffb46e3ac007d52e27335d4f238
+SHA1 (patch-third__party_webrtc_modules_audio__device_BUILD.gn) = 71494618187002ce543d95526696af9a89d6a8e9
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc) = 40ce9a877f383a4145b7241ea74205ca09673d7a
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc) = cecbdadaef6427307d060cc330d08c82a049da69
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc) = e7b5018b3151ea95d229e4ebb85df4ddaccf9880
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc) = bb35a2c27aee7c0c5c49f9c029992080e9626d5c
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc) = e0db60e224435b0d6c772bb3a70cf69b94ba3909
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc) = d6751d2eee84d028a72fadc0d8e4b6c65205faf4
+SHA1 (patch-third__party_webrtc_modules_video__capture_linux_pipewire__session.cc) = d33f1084666e590fb5478178604ccabe529619af
+SHA1 (patch-third__party_webrtc_modules_video__coding_codecs_av1_libaom__av1__encoder.cc) = 562c50dd0d6a535d583ced342bf2a7168aa45f0f
+SHA1 (patch-third__party_webrtc_rtc__base_byte__order.h) = 2ebf301dd45c4269208e82bac98a8ea74394dbb3
+SHA1 (patch-third__party_webrtc_rtc__base_ip__address.cc) = 9be5d013018b3195d9954ab0dd789e83986df5e1
+SHA1 (patch-third__party_webrtc_rtc__base_net__test__helpers.cc) = 2613e56d307e95a224be6994101db934cc85a3f0
+SHA1 (patch-third__party_webrtc_rtc__base_network.cc) = a5148783a1a5d40f4ac2824ee741ec04a0bb6c51
+SHA1 (patch-third__party_webrtc_rtc__base_physical__socket__server.cc) = 214701aac13d58483619b127c42ab68fb896141c
+SHA1 (patch-third__party_webrtc_rtc__base_physical__socket__server.h) = ffbe926dd5ad873e446c18c5e4d37f9843636b93
+SHA1 (patch-third__party_webrtc_rtc__base_platform__thread__types.cc) = 3fd5c1168f0ff602e208908bd9033ee477ea5314
+SHA1 (patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h) = bf9496c6b08c6fa80adeefd45bbcc867cd3580a6
+SHA1 (patch-third__party_webrtc_system__wrappers_BUILD.gn) = f62a6c62c1b36788bc88c55bf63df7819aeac43e
+SHA1 (patch-third__party_widevine_cdm_widevine.gni) = 86f613207e79a81ee036476a41777bfe22303f3f
+SHA1 (patch-third__party_zlib_BUILD.gn) = d2d1415298f7c42c9ef55646b72eb65af977ed42
+SHA1 (patch-third__party_zlib_cpu__features.c) = 50817be1e2474decdf9c8e21972e2453eb01230b
+SHA1 (patch-tools_clang_scripts_update.py) = 5a4340711320131251bf67da99efe5d314a15c74
+SHA1 (patch-tools_generate__shim__headers_generate__shim__headers.py) = 559baa40359125e0790a7481c5f333d2ee14c750
+SHA1 (patch-tools_generate__stubs_rules.gni) = 7cd680fbf5d065837b4aa9687c1697dbea028d29
+SHA1 (patch-tools_gn_build_build__linux.ninja.template) = 35af8ab356966c894821576499ee0f517f14e55e
+SHA1 (patch-tools_gn_build_gen.py) = dce279d7af7236f291409a1a82eb5e9d7dacd6e8
+SHA1 (patch-tools_gn_src_base_files_file__posix.cc) = eb05480716259dba2bf375779ecdde623eb36d56
+SHA1 (patch-tools_gn_src_gn_version.h) = f74e763fad5a498ff731732b5690d6ff08183e42
+SHA1 (patch-tools_gn_src_util_exe__path.cc) = c8ea81a7e4428fce871842279abc60ba1f83af58
+SHA1 (patch-tools_grit_grit_node_base.py) = 5d68469ae5fb6369bbe5096fdf9e028876bceb7b
+SHA1 (patch-tools_gritsettings_resource__ids.spec) = dfd868c1ec1f7a79755a2f0da393fa6d884b6fc9
+SHA1 (patch-tools_json__schema__compiler_cpp__bundle__generator.py) = 3fde41ff75a7d79273f430a9878673986c312aee
+SHA1 (patch-tools_json__schema__compiler_feature__compiler.py) = 9717789a9e1425884fae4e8dd7e39c197936b59c
+SHA1 (patch-tools_licenses_licenses.py) = 2cb84e039cb7a2823ef03fbf02daa11ec872a583
+SHA1 (patch-tools_memory_partition__allocator_inspect__utils.h) = 25f49dff55a527d9227e278a6737cfed5ea4780b
+SHA1 (patch-tools_perf_chrome__telemetry__build_BUILD.gn) = 2b3fa1acd6142c90f4106e1cfe2bb7f3bef39db9
+SHA1 (patch-tools_protoc__wrapper_protoc__wrapper.py) = 6233ae7b13bfcb2111f0097422ebcf77ed21149b
+SHA1 (patch-tools_v8__context__snapshot_BUILD.gn) = fe6477097400db4202800d4ca6e1770a55e2ec34
+SHA1 (patch-tools_variations_fieldtrial__to__struct.py) = b3039e9a8b965f82953150c7b7e2f2b0b3376d66
+SHA1 (patch-ui_accelerated__widget__mac_BUILD.gn) = 306fa406f86452c3812800b49fefd72aff2523be
+SHA1 (patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h) = 3c858e67d0fed3fbcb3bf56ae7644e92d2af7375
+SHA1 (patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm) = 574b1292ca16837c2d240914e468fcf9c67d5573
+SHA1 (patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm) = cb90e34113ae55444d7e559a267ecc862bf1e63f
+SHA1 (patch-ui_accessibility_platform_BUILD.gn) = aeca363f683ed0e8d1b63a38ca42fdf28817ba60
+SHA1 (patch-ui_accessibility_platform_browser__accessibility__manager__mac.mm) = 406c5d034ff5ec3a2da38b90fa4caeb3bb948e64
+SHA1 (patch-ui_accessibility_platform_inspect_ax__transform__mac.mm) = 69d7f762f447bf3751f95c4292b2f2d44dab210d
+SHA1 (patch-ui_aura_client_drag__drop__client.h) = 19db68816172794bb52ac145c8953a98c0198e6e
+SHA1 (patch-ui_aura_screen__ozone.cc) = bfa1296d63e02373c2601fbde719674b72164d02
+SHA1 (patch-ui_aura_screen__ozone.h) = e09a9e4f082794ac0d84ddf7810bf51a1fbea94e
+SHA1 (patch-ui_base_BUILD.gn) = f96286c69b70625c4dbb16cbf63f7a6618cb81f6
+SHA1 (patch-ui_base_accelerators_accelerator.cc) = 92f5d4a8252fdcc29e6dc91ba847ffe6f60028b2
+SHA1 (patch-ui_base_accelerators_accelerator.h) = 3f21f261eb529d6884a56aec25948f0254017b31
+SHA1 (patch-ui_base_accelerators_accelerator__unittest.cc) = 1f695d64ca9c3b3c96deb5b245365de088c6ded4
+SHA1 (patch-ui_base_accelerators_media__keys__listener.cc) = 8f209baf49b06ccc6c4be54a8ad2975b965a7caa
+SHA1 (patch-ui_base_accelerators_media__keys__listener__mac.mm) = c204e1e20f46e51a38e0e960fb35565ec83b6178
+SHA1 (patch-ui_base_clipboard_clipboard__constants.cc) = 5042aacbc6550ea5340dc721effdfd548c09f7a2
+SHA1 (patch-ui_base_clipboard_clipboard__constants.h) = 698ad36338f9b19b614e12b4fd1b07a90965e876
+SHA1 (patch-ui_base_clipboard_clipboard__non__backed.cc) = 54c122b5c4999b5d40fb4f7194712026a6f99a15
+SHA1 (patch-ui_base_clipboard_scoped__clipboard__writer.cc) = 4e32672ed99d0a06b8554c97b8838965223be399
+SHA1 (patch-ui_base_clipboard_scoped__clipboard__writer.h) = ad8765fe3183a27ba3de0c6d2dd2556880517832
+SHA1 (patch-ui_base_cocoa_remote__accessibility__api.h) = e45ff95f3e5f88db6f944cab49ead120dea4981e
+SHA1 (patch-ui_base_cocoa_remote__layer__api.h) = ebd34a11cba0ea528909c1d41d409c45702dd12f
+SHA1 (patch-ui_base_cocoa_remote__layer__api.mm) = fe1ad312dcba7d4482bddca7bf9359c04720191e
+SHA1 (patch-ui_base_cursor_cursor__factory.cc) = 7bb4976d3fa313133d7700d5969cf7f268ac5ec5
+SHA1 (patch-ui_base_cursor_cursor__factory.h) = 9d377c15da7ab444301806871847835a5967a05a
+SHA1 (patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc) = 4f1da7968a75ee433b307e123b0726c0fbd9076e
+SHA1 (patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc) = 28875ccec310cb7003f2d658fbfd4ed63826686e
+SHA1 (patch-ui_base_ime_dummy__text__input__client.cc) = 027e6cd5c347d843a49a50908e71d2b72e659359
+SHA1 (patch-ui_base_ime_dummy__text__input__client.h) = 9d477c3193a7d38158176e951b1863aae0e9c87c
+SHA1 (patch-ui_base_ime_fake__text__input__client.cc) = 56dc5037f290816d5f0fd2346e258a48f1ba021f
+SHA1 (patch-ui_base_ime_fake__text__input__client.h) = cc61cd0ed55bb45e36f489a4a972d8111b091094
+SHA1 (patch-ui_base_ime_init_input__method__initializer.cc) = e8dd4171f6e27b1d23ab74fd0afc2e25ec9fa7c3
+SHA1 (patch-ui_base_ime_linux_linux__input__method__context__factory.cc) = d0aea13774078223f8959e008febc970db34d94a
+SHA1 (patch-ui_base_ime_text__input__client.h) = 4585fe648d3f5359e6631755e881e74aa2f914e9
+SHA1 (patch-ui_base_resource_resource__bundle.cc) = 01ae068707383e5611b57d3423fc7d6714ae9c4e
+SHA1 (patch-ui_base_test_skia__gold__pixel__diff.cc) = 33814e939ce7710b1b8e2e7196a45ebf96130949
+SHA1 (patch-ui_base_test_ui__controls.h) = a12383dd4b9cbad6d40f0d1a2207e7bd1fe96308
+SHA1 (patch-ui_base_ui__base__features.cc) = c16b097747beb20af5cf40f6f7af99e495e99d55
+SHA1 (patch-ui_base_ui__base__features.h) = b107cbf79b9d71d35da352b2ad84da98f198ebae
+SHA1 (patch-ui_base_ui__base__switches.cc) = e7a94255e71d238d78aa1029fa47694ba5632577
+SHA1 (patch-ui_base_ui__base__switches.h) = 40073be498facab7fa304160ff4bd04951fe6162
+SHA1 (patch-ui_base_webui_web__ui__util.cc) = f66f33672d2dfd200faf37094d70f2eea62dc685
+SHA1 (patch-ui_base_x_x11__cursor__factory.cc) = 3642feb4815fd1c0d7693ceef86ba13e92c74564
+SHA1 (patch-ui_base_x_x11__cursor__factory.h) = 1ec4710fa3e7a936649d491cf732f21c8b32c15d
+SHA1 (patch-ui_base_x_x11__cursor__loader.cc) = 4f8526b3c08c08d0962dec798fa0cb9f8bcc0e88
+SHA1 (patch-ui_base_x_x11__display__manager.cc) = b620769aaea63c7787d90484678ddfcf6e5ba1e8
+SHA1 (patch-ui_base_x_x11__global__shortcut__listener.cc) = f0645447728fd62e319657ef218f2ca8bb0ccf0f
+SHA1 (patch-ui_base_x_x11__global__shortcut__listener.h) = b0e6b38dd079abb89b2cf3e7d3ccbb28fe405e49
+SHA1 (patch-ui_base_x_x11__shm__image__pool.cc) = e4b19f6e17c075f8ff678d2174409a8e7485478c
+SHA1 (patch-ui_color_color__id.h) = 355981d532a68fe2b180110bca96db4d41ee212a
+SHA1 (patch-ui_color_color__provider__utils.cc) = 39f348e704aa4756de72281ef8ec420719fed0e4
+SHA1 (patch-ui_color_system__theme.h) = c3e2c2ddd4f9684fc5ce37b80a0fa9794e6ca203
+SHA1 (patch-ui_color_ui__color__mixer.cc) = de7f0e67e91bedfbe51f33fa534553e35d4086a7
+SHA1 (patch-ui_color_win_native__color__mixers__win.cc) = 3e71ba5f9ed3c197f28e593a9d105df2a0ea8037
+SHA1 (patch-ui_compositor_compositor.cc) = aa746939efcb660befa5a2f303ef1670b9400365
+SHA1 (patch-ui_compositor_compositor.h) = 4fbdaf6855d5e1a700f1f21da0bc299b7b2f49b1
+SHA1 (patch-ui_compositor_compositor__observer.h) = 0297a6db43522a44402ba8b97ecea39fe7c11160
+SHA1 (patch-ui_display_BUILD.gn) = de7c66df86d5553fb33c625d456a60df90c2290e
+SHA1 (patch-ui_display_mac_screen__mac.mm) = 57e0990e099d42211178cd2f9a7b27d0178228a9
+SHA1 (patch-ui_display_screen.cc) = e734631f46fa1ae2b3700ce6a9e7db70229acf8b
+SHA1 (patch-ui_display_screen.h) = 3866b156d9937bf5fb618e4b7d657357b98ffb0a
+SHA1 (patch-ui_events_devices_x11_device__data__manager__x11.cc) = 16676778297bf3b8cf931f989a0e2851a7b911cd
+SHA1 (patch-ui_events_event.cc) = cd8a85913d10da5336d4d99f247a79a9338ae8c7
+SHA1 (patch-ui_events_event.h) = 4dbb0282a2ce6618fc097accf76ad6ddeaf970d2
+SHA1 (patch-ui_events_event__switches.cc) = b954acab094d65a3fb9ff5a7930e6ed776c356b4
+SHA1 (patch-ui_events_event__switches.h) = 3b54b4009c2b580bef646440b3d92f8e8061a763
+SHA1 (patch-ui_events_keycodes_dom_keycode__converter.cc) = d75876f29e0c10e351580527d4271c8fbfb06eea
+SHA1 (patch-ui_events_keycodes_dom_keycode__converter.h) = f178bb85b797d06b6f09679b7353e7c3f854c07c
+SHA1 (patch-ui_events_x_events__x__utils.cc) = 8a5acc9c813246fcc139a8fc8d05fe4838884de0
+SHA1 (patch-ui_gfx_BUILD.gn) = 6081a84e6e6b33f30d2475d7e43a5eefbaa8ca3a
+SHA1 (patch-ui_gfx_ca__layer__params.h) = 9a6192aee2dd75ec72ff155188cb0abbbc500029
+SHA1 (patch-ui_gfx_canvas__skia.cc) = ea8e951a57002cc190188e378fdded47667ad130
+SHA1 (patch-ui_gfx_font__fallback__linux.cc) = c1d391ebdd7fbcfd25215ad8ce24861acadb5512
+SHA1 (patch-ui_gfx_font__render__params.h) = 9ec8d691a2ca1a6c8fd9dde992519f93a887a7e5
+SHA1 (patch-ui_gfx_font__render__params__linux.cc) = 0f931cdee2b2263f94c1fac8f468f50355114cbb
+SHA1 (patch-ui_gfx_font__util.cc) = f1c17af4268f6ce882751eca327e8be5f8262dff
+SHA1 (patch-ui_gfx_gpu__memory__buffer.cc) = a9b63d94f1e8b7983d51bf2573a4f2a8a1640ce0
+SHA1 (patch-ui_gfx_gpu__memory__buffer.h) = 86f2b077cb074143fb90fe913c5ade26125d43b8
+SHA1 (patch-ui_gfx_linux_dmabuf__uapi.h) = 975f46816cbddece0f2e9de6027eed9fcae0085e
+SHA1 (patch-ui_gfx_linux_gbm__wrapper.cc) = f449d5f24e79a872cf2b2edd5d3bc9f317de6580
+SHA1 (patch-ui_gfx_mojom_buffer__types__mojom__traits.cc) = 96f6478c97caad6035eecf75c0cc83becb327a5b
+SHA1 (patch-ui_gfx_mojom_ca__layer__params.mojom) = c26a2a7db388bf7ec7812e595972c79e5e6c58ca
+SHA1 (patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc) = 865f82322089e61beb479cf75b957b49a1365b23
+SHA1 (patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h) = 3ee7b6c783b242d2353c4da85e340791a08252a9
+SHA1 (patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc) = 72978bbb992a25c199616def59668f65d0b4bd73
+SHA1 (patch-ui_gfx_mojom_native__handle__types__mojom__traits.h) = 22a9939508b7635b2c23d7265f98c4836f8c4eb5
+SHA1 (patch-ui_gfx_native__pixmap__handle.cc) = c6b45f66eef3c15c33b23c07bf2afa0ee025728b
+SHA1 (patch-ui_gfx_native__pixmap__handle.h) = e3773830a2b49616a55d94322205dc65a3d55a9d
+SHA1 (patch-ui_gfx_native__widget__types.h) = c371c94bb547e0d27b7d5186d052a0ab92d27cb2
+SHA1 (patch-ui_gfx_platform__font__mac.mm) = f040c6f6c2ddc610d9edd6e64e76a77ed0442852
+SHA1 (patch-ui_gfx_platform__font__skia.cc) = 0c971ddddea224b68ce6950019046c0752368a55
+SHA1 (patch-ui_gfx_render__text__api__fuzzer.cc) = 56b073113466a1de06ea9efd63e164fe091c1c81
+SHA1 (patch-ui_gfx_render__text__fuzzer.cc) = aab6b66576b0371a529830102c55908109f59e18
+SHA1 (patch-ui_gfx_switches.cc) = 5949e4c9063bc20e271cae0d522a00a543bb1dab
+SHA1 (patch-ui_gfx_switches.h) = c627d7d06aee4409566b374aca52d1083bb362bf
+SHA1 (patch-ui_gfx_x_atom__cache.cc) = ca1f9a28e81c5ac795d5bcb8cfe39842492b1fd5
+SHA1 (patch-ui_gfx_x_generated__protos_dri3.cc) = 2120a93eaee907529b9392c0b79f41f1ae2caf40
+SHA1 (patch-ui_gfx_x_generated__protos_shm.cc) = 4acdd6e7409533b3f17d362920ce9586a980b38d
+SHA1 (patch-ui_gfx_x_xlib__support.cc) = 3f335d8447bda393243893591e82561ee6069578
+SHA1 (patch-ui_gl_BUILD.gn) = 9a404290a89e00bc10c2da1f03fcf7f6054bb00b
+SHA1 (patch-ui_gl_gl__context.cc) = 1aa471a7c7dc3fb1b9b5f7bab30fcd1322f5bb7a
+SHA1 (patch-ui_gl_gl__fence.cc) = b2f822b3f1cced067c5be33a49a68f88e74f81cc
+SHA1 (patch-ui_gl_gl__implementation.cc) = ff0d7fa7fe676509f3d1b02994e16564101a01f1
+SHA1 (patch-ui_gl_gl__switches.cc) = 11d28d7ff42b022a5cecadbbb8815ffda72af918
+SHA1 (patch-ui_gl_sync__control__vsync__provider.cc) = 98be145c409735bd8768e88bce4f051a9bfff310
+SHA1 (patch-ui_gl_sync__control__vsync__provider.h) = 40b6432080e57c56b9e05ec51f57772576fa9bc4
+SHA1 (patch-ui_gtk_gtk__compat.cc) = bc2db029d29c4bf6603689cf3c7f20f0958c8458
+SHA1 (patch-ui_gtk_gtk__compat.h) = 8377d4e685071f82f5c739a881adb97d7a94f53a
+SHA1 (patch-ui_gtk_gtk__ui.cc) = c64993c7f0d652734419f697cecf917fcb99c59a
+SHA1 (patch-ui_gtk_gtk__ui.h) = 7bb0a13622fc3d21ea8c3d467dea3c0613473172
+SHA1 (patch-ui_gtk_printing_print__dialog__gtk.cc) = 1701402735b4f1992d21fb2b8e3d92af7cc8dfe2
+SHA1 (patch-ui_gtk_select__file__dialog__linux__gtk.cc) = e3ba51ca89ae5cbe19a9f7f285f8adbc193a5fb3
+SHA1 (patch-ui_gtk_select__file__dialog__linux__gtk.h) = 145b1c749be114d5aa7c95d6a35422abb2f75041
+SHA1 (patch-ui_gtk_window__frame__provider__gtk.cc) = 007f3a19de2eab4e6a081347290f7c4d9399186f
+SHA1 (patch-ui_gtk_window__frame__provider__gtk.h) = a8efa378e09a8575d87170a4d73d0daf3fbc920b
+SHA1 (patch-ui_linux_fallback__linux__ui.cc) = bd89ff6bd37f3334a6b6b21e5a9b9f082b5793a3
+SHA1 (patch-ui_linux_fallback__linux__ui.h) = aa56dc483da80d43369035acf288806afda1f492
+SHA1 (patch-ui_linux_linux__ui.h) = 35535283dd98feaeeafc44b0fcaf7c821a985f75
+SHA1 (patch-ui_menus_simple__menu__model.cc) = 4ce86a486ff71112dc2cfbe5b9aea0daf7d263d8
+SHA1 (patch-ui_menus_simple__menu__model.h) = 8b77ea68becd7ea37d0643deb3a4ab71ec06ed2c
+SHA1 (patch-ui_message__center_views_message__popup__view.cc) = c66d7b84d7ef749556bc13267903b7d93e0af555
+SHA1 (patch-ui_native__theme_native__theme.cc) = b272a46bdce7c50192873ab344dbeaedaae5549f
+SHA1 (patch-ui_native__theme_native__theme.h) = 182c9357a1b123c76ce80cacba6884e7e78450cb
+SHA1 (patch-ui_native__theme_native__theme__base.cc) = 9b095db7d273b30e7261910ea841a78eba697731
+SHA1 (patch-ui_native__theme_native__theme__features.cc) = 42845e1462b7c2514edb2de85b2a2dff7ecaf30c
+SHA1 (patch-ui_native__theme_native__theme__win.cc) = b774e9428c5ae13299885cbbfd436230c1dbe8e7
+SHA1 (patch-ui_ozone_common_egl__util.cc) = 405a110f5ff05ea09651afc27dc0870b16c8d778
+SHA1 (patch-ui_ozone_platform_headless_headless__surface__factory.cc) = 8cd4d9fe8b41fc7463a56caf320e0466836a3c60
+SHA1 (patch-ui_ozone_platform_headless_ozone__platform__headless.cc) = b262858bcd52510c48682da4156326179c46de9c
+SHA1 (patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc) = b8d0fb80726827cc33b6a1dc786f26efd32eaac2
+SHA1 (patch-ui_ozone_platform_wayland_common_wayland__util.cc) = aa56b057f5bd20fa55c3a42f0e53e5948da9cc41
+SHA1 (patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc) = 1e0a08749b8cd2310093516a36270551c286447f
+SHA1 (patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h) = 1a966b62ac5e350217d19ad517c6114296d2c820
+SHA1 (patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc) = 5999ef11db46024f9ca1a0ae2277b16dab32794b
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__connection.cc) = 7cbb42aa12c41f8c1e6a46b4c6830cef6c65a6f2
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc) = 89392eea1cd270780c4a1e83ea4bf84ff28f8f0e
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__input__method__context__unittest.cc) = 0306fe92921b6cbd7dade53546641b71f387c4c8
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__popup.cc) = 1833b8aa7d4b41bf6f3c12358068b2140117d8e0
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc) = 9cea37c3c31744076b1dd3d3d0ae002057e6af8b
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h) = 1d9198d88843a2d73a9d7cdebc004fe198f6cb95
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__window.cc) = 945ccd03b2d74e7aa480f9fae24856bce31334ce
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__window.h) = b6909f2f630526864f7d4cd5f0ab165d27077a0b
+SHA1 (patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc) = 037ae210aa85d2a37d3bce9552cdb7a78c0c37e3
+SHA1 (patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc) = 968141b2751696329cfd3f85652ce2a1576b1951
+SHA1 (patch-ui_ozone_platform_x11_BUILD.gn) = c183c5e7113e51d36fc229478c57e93b80f0086a
+SHA1 (patch-ui_ozone_platform_x11_ozone__platform__x11.cc) = 7dc9c5a78b4384c4f618c095faf55940a1051466
+SHA1 (patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc) = 0c050c3cfaafe45d416f23b94e63c6cf6f366ad3
+SHA1 (patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc) = 35d7f219093d8eee4616df483d0596227896c770
+SHA1 (patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h) = 385cb177852d38c3ea91c7398801ded512d0681f
+SHA1 (patch-ui_ozone_platform_x11_x11__screen__ozone.cc) = 73c20ea764bc0891e34cadf5f26158c8ad81c572
+SHA1 (patch-ui_ozone_platform_x11_x11__screen__ozone.h) = c766f1e016aa7fd7b0d80fccd1d9592b9b981a71
+SHA1 (patch-ui_ozone_platform_x11_x11__window.cc) = 2b1cb54355c778d9c2d85458c4695ba74beba2ec
+SHA1 (patch-ui_ozone_public_ozone__platform.h) = fad6a73355a12766c94c1d7e1884e3cd45cd6315
+SHA1 (patch-ui_ozone_public_platform__global__shortcut__listener.h) = c5f1ee8dc5c1dc71de924c253fac7e4e4f8c192e
+SHA1 (patch-ui_ozone_test_mock__platform__window__delegate.h) = c66ad3e330ac4fd77adfb1640ed34880ebb2ba7e
+SHA1 (patch-ui_platform__window_platform__window__delegate.cc) = fd68067bdb743fd01e641a211dc04a89aa4b523a
+SHA1 (patch-ui_platform__window_platform__window__delegate.h) = a1c6c62221bc091542e380e1aff613e4a967163d
+SHA1 (patch-ui_platform__window_platform__window__init__properties.h) = 2fb7629ec4a9a3be5f3035c2f201053705868daa
+SHA1 (patch-ui_qt_BUILD.gn) = 4bac99c6b1fff9c99343dd4f60a827397514a5b7
+SHA1 (patch-ui_qt_qt.gni) = 40893be2e78d473f0eb259704b2001e5707a3a39
+SHA1 (patch-ui_qt_qt__ui.cc) = 402d6673a9db0ca1e227fb06892d54b7df47b8e5
+SHA1 (patch-ui_qt_qt__ui.h) = f0b83228cdcfb075207908aa28f62d9b00b27f54
+SHA1 (patch-ui_shell__dialogs_select__file__dialog.h) = 71f30fd76ed11100efab67c45f6e8a9fe93a5491
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux.cc) = 53bfa362872d0f21280dd0abebfbf23d4c1a3106
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux.h) = b897a260c0118e7bf6a32abe072346a86bcf2b8c
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc) = 76bc1e05099bca9e3b60c18a56fc8ceebfe8a260
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc) = a9be2ace60e0f0f751d1d15dae1f538ed75e4208
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__portal.h) = c9786354ad7a84333f794c600f8e3bba78dd3061
+SHA1 (patch-ui_strings_translations_app__locale__settings__bn.xtb) = 8e31bd1fb784dc036049b47f210bde034f0d5071
+SHA1 (patch-ui_strings_translations_app__locale__settings__ja.xtb) = 75af5ae19c9d9f722fc5f3dcc59595764343ce8b
+SHA1 (patch-ui_strings_translations_app__locale__settings__ko.xtb) = 91861194619959ac3d6f00eacce214cd40d21f64
+SHA1 (patch-ui_strings_translations_app__locale__settings__ml.xtb) = b92d61a85544780d1c3f2ef89c832766fc858261
+SHA1 (patch-ui_strings_translations_app__locale__settings__th.xtb) = 5760d50275ba68780350e901906a40a6be989425
+SHA1 (patch-ui_strings_translations_app__locale__settings__zh-CN.xtb) = 62516e15b96375dfe54ec0b52c3d8434c87c060a
+SHA1 (patch-ui_strings_translations_app__locale__settings__zh-TW.xtb) = 7bec98956f2e22427a47da197ba872152c6010e5
+SHA1 (patch-ui_strings_ui__strings.grd) = c74f7cf986b0d9900cb2ef177d28e14285db7d11
+SHA1 (patch-ui_views_BUILD.gn) = 382627a90aeb766eff3293b218d0c682500c1f99
+SHA1 (patch-ui_views_cocoa_native__widget__mac__ns__window__host.h) = 69dedfd6bd68e23a54b925190e4f61f6f07641c8
+SHA1 (patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm) = c6fdf92034df3e0fbe4d833964eeae10f353294f
+SHA1 (patch-ui_views_controls_button_label__button.cc) = d346e133728e80a0fb850f3ef7b31b129cdc1003
+SHA1 (patch-ui_views_controls_menu_menu__controller.cc) = af9abdd8b300699351ce489eff0e6ea71179997e
+SHA1 (patch-ui_views_controls_menu_menu__controller.h) = afcadcf364a58a4376da43b6c22c04da4a026511
+SHA1 (patch-ui_views_controls_menu_menu__runner.cc) = 074966209a36356aafc9ad4284a92d9b50192dfb
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl.cc) = 28dc50c122698062ddf8bf3c8e80520148174e65
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl.h) = 3690372074646ea810e3617a098b38fb22772711
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__adapter.cc) = 5f93b0ee0c4d881706c4d6351ca9cea9d2f5ad84
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__adapter.h) = 954c592a143038354579e7afcd58918c5548d4e9
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__cocoa.h) = fad52359e0166b317632e04c71f284c057126cc0
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm) = de25b1798c2b1d00fe199312f3aa75a743daf147
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__interface.h) = 203bf13ff663d199eb998085f3244d287f3b3fdf
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__mac.h) = 5209a87a9e5058261974364a1dcd8a7a5a2f4eee
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__mac.mm) = 499e17659e9bcf7fea9453884aeb706ed2151899
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h) = 2817817c9dccfa52e0eb484370d6713da05b7176
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm) = 8c9d44c7aa4444fea6baee4511d48f5a8859f88e
+SHA1 (patch-ui_views_controls_prefix__selector.cc) = a5cf085c2fc132e40206bc4af7348fa98fb9c53c
+SHA1 (patch-ui_views_controls_prefix__selector.h) = 74adae9addcc1854b19db03fb35d2c6f3d277b7d
+SHA1 (patch-ui_views_controls_textfield_textfield.cc) = fb440d3c98f4bedb227e53491458a5e2ec3ee480
+SHA1 (patch-ui_views_controls_textfield_textfield.h) = d3d42117aafd6db93c520b209a2aff246fe93841
+SHA1 (patch-ui_views_controls_webview_BUILD.gn) = 7bd1944f55f37fb9d6aeb92660079c704f59f9c6
+SHA1 (patch-ui_views_controls_webview_web__dialog__view.cc) = 495d50b2e0ef56d627386dc024ddffb53538c257
+SHA1 (patch-ui_views_controls_webview_web__dialog__view.h) = f972b99e0fd5c02ba7656f8147c7ae5ea66e9342
+SHA1 (patch-ui_views_corewm_tooltip__aura.cc) = 764e29c28a41212c5b3ea8d822eacc99e4bd432d
+SHA1 (patch-ui_views_examples_widget__example.cc) = 361a4d41fb6de84e5e68de10a5f10784d8818045
+SHA1 (patch-ui_views_focus_focus__manager.cc) = a6a08d710960d402935737da44c96c5ebfca1e76
+SHA1 (patch-ui_views_style_platform__style.cc) = 57786e6c710604c47aff1cc096749784707db60d
+SHA1 (patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc) = 364ab4ad2db1cdefa68137debbf6cce0cc8ca3f3
+SHA1 (patch-ui_views_views__delegate.cc) = e2007194d534900a3bbcde187bd1da6865b3d94f
+SHA1 (patch-ui_views_views__delegate.h) = 75715fd5382955123f95f1c84547d050684035d9
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc) = 66b38e99c3aed429a88e20b302205c8ecd0ee9bd
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h) = 136b112e9cd3f2b43e3b732487f557882a43994e
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc) = 06788933f1c4b10f6ad4af3cde4572ca3d0f5344
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc) = 1dad7435c27ce43a0e8be4487dcf1d4e8313a532
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h) = d415653f66b3d06a09a3f14f86ca43fa9b4e09a3
+SHA1 (patch-ui_views_widget_root__view.cc) = 895fb4af465d301eb5f8a940c13adb3111fca115
+SHA1 (patch-ui_views_widget_widget.cc) = 59b127e4450d0c1578645225f30ee0ad67a5fa01
+SHA1 (patch-ui_views_win_hwnd__message__handler.cc) = 37f28fbfc2ae064f572d7dcfc20b1b82c36ba46e
+SHA1 (patch-ui_views_win_hwnd__message__handler__delegate.h) = b1e6b3262f4f676eca934367395a0d14a0a071e1
+SHA1 (patch-ui_views_window_custom__frame__view.cc) = 5d20e6f43f10ff2cce976162101123a82382ac58
+SHA1 (patch-ui_views_window_dialog__delegate.cc) = c7d068cfb9297c33e89500bd1649d7d48ccc77e3
+SHA1 (patch-ui_views_window_frame__background.cc) = 9bdddc9304c280daefc457c8fd4bda6fddb7a45d
+SHA1 (patch-ui_views_window_frame__caption__button.cc) = ac17bc94aebc862f6c9e8f892679f902e44327e3
+SHA1 (patch-ui_views_window_frame__caption__button.h) = 3093d68b5e3a7e42fc9131a9ade783cf6cb9a142
+SHA1 (patch-url_url__util.cc) = 90ed7dd79202645b9dab49b0b4b4843a55f2cdf8
+SHA1 (patch-url_url__util.h) = 700c703c93115f7b03458fc11a42f036a6d249c2
+SHA1 (patch-v8_BUILD.gn) = 7f8a7942373193dbae1ad18df7914993fb27114f
+SHA1 (patch-v8_include_v8-fast-api-calls.h) = 51f418c0b8cbfb532e489309c804d7386fbfd703
+SHA1 (patch-v8_include_v8-internal.h) = 95f6fedf8d09861abe36676e242c9f6427a8dfb0
+SHA1 (patch-v8_include_v8-microtask-queue.h) = afd07994882b6bed3a6f46b8a5a5101c39872b56
+SHA1 (patch-v8_include_v8-object.h) = b4d7ecfc7a39f6951b7ce7bb474484e75d33380b
+SHA1 (patch-v8_include_v8config.h) = 815dadac371915d4676aece6d2cc5cb4e5efd0d8
+SHA1 (patch-v8_src_api_api.cc) = 247a153b098d07366dc156fd980803c134ef058f
+SHA1 (patch-v8_src_base_atomicops.h) = 3d7ee8471bff63a67e9d94f1e9b333cbdabb2c34
+SHA1 (patch-v8_src_base_platform_memory.h) = 9e365a833de3bc0b399e0d1da266d1fd8279c7b3
+SHA1 (patch-v8_src_base_platform_platform-freebsd.cc) = b2ca4c5f2ceeaee5582d657e4b2db4fd8efd4e25
+SHA1 (patch-v8_src_base_platform_platform-openbsd.cc) = d42a205ff364ea58f971b2062415c83e29d293be
+SHA1 (patch-v8_src_base_platform_platform-posix.cc) = a5ffcca8fc59f99af5840ee1394642acd565d062
+SHA1 (patch-v8_src_base_small-vector.h) = 366aae281e6615084093e058e4bb9e3de717eb3c
+SHA1 (patch-v8_src_base_strings.h) = 75abd848518b3e9b6167f68b1e44fc6d82d25190
+SHA1 (patch-v8_src_base_sys-info.cc) = d7031378199363da90480b38e47f975cb281ee22
+SHA1 (patch-v8_src_base_utils_random-number-generator.cc) = 1e595f2d99fc85a22247840dc22e818b34cf80af
+SHA1 (patch-v8_src_builtins_x64_builtins-x64.cc) = 0011c14cdb305f5abcdd40a694d9774fa896d8bb
+SHA1 (patch-v8_src_compiler_escape-analysis.cc) = 98bf3d19ec88ce0268b030cbf13e1a5cbdfa3896
+SHA1 (patch-v8_src_diagnostics_perf-jit.cc) = 527e75d26b3d053f79ae44f9a41b2a26fd78e360
+SHA1 (patch-v8_src_diagnostics_perf-jit.h) = 518adb56023d71f69998920aea0379334b6aaa4f
+SHA1 (patch-v8_src_execution_isolate.cc) = 8450747751f80ef8e45860a9ee463bfb3dbe74fd
+SHA1 (patch-v8_src_execution_microtask-queue.h) = 495b878d054ca466effada12e9918da93a6b5909
+SHA1 (patch-v8_src_flags_flags.cc) = 91913874396ffb6c4ec92bea8c8de46111542e8a
+SHA1 (patch-v8_src_libsampler_sampler.cc) = abef969a27ab6619b05a8427e5050d12a2a77740
+SHA1 (patch-v8_src_maglev_maglev-graph-builder.cc) = 6c695b098fd60e1078fe9e616eb68b9f5d958996
+SHA1 (patch-v8_src_sandbox_sandbox.cc) = 68cf013051ba33cf94939a28d4b0fc3bf892780c
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc) = ba4bbc704d5e437eb9ed22a0d892c3eafeff67f7
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h) = e59ee4dd7dd0a125656a845b7b3d04b84927afc0
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc) = 5d0ca5a9dc4421829e1a0869a30a279b2fa1da98
+SHA1 (patch-v8_src_trap-handler_handler-inside-posix.cc) = f8aaa8e1640e07d652dca93a27265f671e471049
+SHA1 (patch-v8_src_trap-handler_handler-inside-posix.h) = 01b8bc605f372df03acca6a118fc9913a95ad4f8
+SHA1 (patch-v8_src_trap-handler_trap-handler.h) = 8f1364de48151010a4822891600ae4833c27bf0e
+SHA1 (patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h) = 366d8c369f5ff3d4bf285dd6279816d9d97173f9
+SHA1 (patch-v8_tools_run-paxctl.py) = ada6026916a211f40b241b1163ce939148f4b137
+SHA1 (patch-v8_tools_run.py) = 079603f0490828b07fa071c3b9feff98f9763124
diff --git a/electron34/options.mk b/electron34/options.mk
new file mode 100644
index 0000000000..9375a18f7a
--- /dev/null
+++ b/electron34/options.mk
@@ -0,0 +1,55 @@
+# $NetBSD: options.mk,v 1.32 2016/08/20 11:17:32 ryoon Exp $
+
+PKG_OPTIONS_VAR= PKG_OPTIONS.electron
+PKG_OPTIONS_REQUIRED_GROUPS= audio
+PKG_OPTIONS_GROUP.audio= alsa pulseaudio sunaudio
+PKG_SUPPORTED_OPTIONS+= debug
+
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= sunaudio
+.else
+PKG_SUGGESTED_OPTIONS+= pulseaudio
+.endif
+
+.include "../../mk/bsd.options.mk"
+
+.if !empty(PKG_OPTIONS:Msunaudio)
+GN_ARGS+= use_audioio=true
+.else
+GN_ARGS+= use_audioio=false
+.endif
+
+.if !empty(PKG_OPTIONS:Malsa)
+GN_ARGS+= use_alsa=true
+.include "../../audio/alsa-lib/buildlink3.mk"
+.else
+GN_ARGS+= use_alsa=false
+.endif
+
+.if !empty(PKG_OPTIONS:Mpulseaudio)
+#WITH_PA= yes
+GN_ARGS+= use_pulseaudio=true
+.include "../../audio/pulseaudio/buildlink3.mk"
+.else
+#WITH_PA= no
+GN_ARGS+= use_pulseaudio=false
+.endif
+
+.if !empty(PKG_OPTIONS:Mdebug)
+BUILDTYPE= Debug
+GN_FILE= testing.gn
+GN_ARGS+= is_debug=true
+GN_ARGS+= symbol_level=1
+GN_BOOTSTRAP_FLAGS+= --debug
+GN_VERBOSE= #-v
+INSTALL_UNSTRIPPED= yes
+.else
+BUILDTYPE= Release
+GN_FILE= release.gn
+GN_ARGS+= is_official_build=true
+GN_ARGS+= is_component_build=false
+GN_ARGS+= is_debug=false
+GN_ARGS+= blink_symbol_level=0
+GN_ARGS+= symbol_level=0
+GN_VERBOSE= # empty
+.endif
diff --git a/electron34/patches/patch-.gitignore b/electron34/patches/patch-.gitignore
new file mode 100644
index 0000000000..3e78ec8ec4
--- /dev/null
+++ b/electron34/patches/patch-.gitignore
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- .gitignore.orig 2025-02-24 19:59:26.000000000 +0000
++++ .gitignore
+@@ -216,6 +216,7 @@ vs-chromium-project.txt
+ /data
+ /delegate_execute
+ /device/serial/device_serial_mojo.xml
++/electronXXX
+ /google_apis/gcm/gcm.xml
+ /googleurl
+ /gpu/gles2_conform_test
diff --git a/electron34/patches/patch-.gn b/electron34/patches/patch-.gn
new file mode 100644
index 0000000000..af539f854e
--- /dev/null
+++ b/electron34/patches/patch-.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- .gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ .gn
+@@ -172,4 +172,8 @@ exec_script_whitelist =
+
+ "//tools/grit/grit_rule.gni",
+ "//tools/gritsettings/BUILD.gn",
++
++ "//electron/BUILD.gn",
++ "//third_party/electron_node/deps/base64/BUILD.gn",
++ "//third_party/electron_node/deps/base64/unofficial.gni",
+ ]
diff --git a/electron34/patches/patch-AUTHORS b/electron34/patches/patch-AUTHORS
new file mode 100644
index 0000000000..b4ad468ca5
--- /dev/null
+++ b/electron34/patches/patch-AUTHORS
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- AUTHORS.orig 2025-02-24 19:59:26.000000000 +0000
++++ AUTHORS
+@@ -336,6 +336,7 @@ David Futcher <david.mike.futcher@gmail.
+ David Jin <davidjin%amazon.com@localhost>
+ David Lechner <david%pybricks.com@localhost>
+ David Leen <davileen%amazon.com@localhost>
++David Lönnhager <dv.lnh.d%gmail.com@localhost>
+ David Manouchehri <david%davidmanouchehri.com@localhost>
+ David McAllister <mcdavid%amazon.com@localhost>
+ David Michael Barr <david.barr%samsung.com@localhost>
diff --git a/electron34/patches/patch-BUILD.gn b/electron34/patches/patch-BUILD.gn
new file mode 100644
index 0000000000..0254c0d3f8
--- /dev/null
+++ b/electron34/patches/patch-BUILD.gn
@@ -0,0 +1,95 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ BUILD.gn
+@@ -68,7 +68,7 @@ declare_args() {
+ root_extra_deps = []
+ }
+
+-if (is_official_build) {
++if (is_official_build && !is_bsd) {
+ # An official (maximally optimized!) component (optimized for build times)
+ # build doesn't make sense and usually doesn't work.
+ assert(!is_component_build)
+@@ -100,7 +100,6 @@ group("gn_all") {
+ "//codelabs",
+ "//components:components_unittests",
+ "//components/gwp_asan:gwp_asan_unittests",
+- "//infra/orchestrator:orchestrator_all",
+ "//net:net_unittests",
+ "//sandbox:sandbox_unittests",
+ "//services:services_unittests",
+@@ -446,7 +445,7 @@ group("gn_all") {
+ }
+ }
+
+- if (is_linux || is_chromeos || is_android) {
++ if ((is_linux && !is_bsd) || is_chromeos || is_android) {
+ deps += [
+ "//third_party/breakpad:breakpad_unittests",
+ "//third_party/breakpad:core-2-minidump",
+@@ -636,6 +635,15 @@ group("gn_all") {
+ }
+ }
+
++ if (is_bsd) {
++ deps -= [
++ "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)",
++ "//third_party/breakpad:microdump_stackwalk($host_system_allocator_toolchain)",
++ "//third_party/breakpad:minidump_dump($host_system_allocator_toolchain)",
++ "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)",
++ ]
++ }
++
+ if (is_mac) {
+ deps += [
+ "//third_party/breakpad:dump_syms($host_system_allocator_toolchain)",
+@@ -684,7 +692,7 @@ group("gn_all") {
+ }
+ }
+
+- if (!is_fuchsia) {
++ if (!is_fuchsia && !is_bsd) {
+ # The official builders use this binary from the default toolchain's
+ # output directory after building in order to upload the symbols of that
+ # binary. They build the binary like `ninja symupload` which requires the
+@@ -1172,7 +1180,7 @@ if (use_blink && !is_cronet_build) {
+ ]
+ }
+
+- if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos) {
++ if (!is_chromeos_ash && !is_ios && !is_fuchsia && !is_android && !is_castos && !is_bsd) {
+ script_test("chrome_wpt_tests") {
+ script = "//third_party/blink/tools/run_wpt_tests.py"
+ args = _common_web_test_options + [ "--product=chrome" ]
+@@ -1265,7 +1273,7 @@ if (use_blink && !is_cronet_build) {
+ data_deps += [ "//content/web_test:web_test_common_mojom_js_data_deps" ]
+ }
+
+- if (!is_win && !is_android) {
++ if (!is_win && !is_android && !is_bsd) {
+ # Using the default toolchain for this tool, as it's run during tests not
+ # during the build. This places a symlink in the root_build_dir for scrips
+ # to use.
+@@ -1279,7 +1287,7 @@ if (use_blink && !is_cronet_build) {
+ data_deps += [ "//third_party/breakpad:dump_syms" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux && !is_bsd) || is_chromeos) {
+ # Using the default toolchain for this tool, as it's run during tests not
+ # during the build. This places a symlink in the root_build_dir for scrips
+ # to use.
+@@ -1743,7 +1751,7 @@ group("chromium_builder_perf") {
+ data_deps += [ "//chrome/test:performance_browser_tests" ]
+ }
+
+- if (!is_win) {
++ if (!is_win && !is_bsd) {
+ data_deps += [ "//third_party/breakpad:minidump_stackwalk($host_system_allocator_toolchain)" ]
+ }
+ }
diff --git a/electron34/patches/patch-apps_ui_views_app__window__frame__view.cc b/electron34/patches/patch-apps_ui_views_app__window__frame__view.cc
new file mode 100644
index 0000000000..9073b7d514
--- /dev/null
+++ b/electron34/patches/patch-apps_ui_views_app__window__frame__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- apps/ui/views/app_window_frame_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ apps/ui/views/app_window_frame_view.cc
+@@ -149,7 +149,7 @@ gfx::Rect AppWindowFrameView::GetWindowB
+ gfx::Rect window_bounds = client_bounds;
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Get the difference between the widget's client area bounds and window
+ // bounds, and grow |window_bounds| by that amount.
+ gfx::Insets native_frame_insets =
diff --git a/electron34/patches/patch-ash_display_mirror__window__controller.cc b/electron34/patches/patch-ash_display_mirror__window__controller.cc
new file mode 100644
index 0000000000..9786c804f9
--- /dev/null
+++ b/electron34/patches/patch-ash_display_mirror__window__controller.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ash/display/mirror_window_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ash/display/mirror_window_controller.cc
+@@ -295,7 +295,11 @@ void MirrorWindowController::UpdateWindo
+ if (!base::Contains(display_info_list, iter->first,
+ &display::ManagedDisplayInfo::id)) {
+ CloseAndDeleteHost(iter->second, true);
++#if defined(__llvm__)
++ mirroring_host_info_map_.erase(iter++);
++#else
+ iter = mirroring_host_info_map_.erase(iter);
++#endif
+ } else {
+ ++iter;
+ }
diff --git a/electron34/patches/patch-base_BUILD.gn b/electron34/patches/patch-base_BUILD.gn
new file mode 100644
index 0000000000..81004a7495
--- /dev/null
+++ b/electron34/patches/patch-base_BUILD.gn
@@ -0,0 +1,181 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/BUILD.gn
+@@ -920,7 +920,7 @@ component("base") {
+ #"system/sys_info_openbsd.cc",
+ ]
+
+- if (is_apple || current_os == "freebsd" || current_os == "openbsd") {
++ if (is_apple || current_os == "freebsd" || current_os == "openbsd" || current_os == "netbsd") {
+ sources += [
+ "posix/sysctl.cc",
+ "posix/sysctl.h",
+@@ -1017,6 +1017,7 @@ component("base") {
+ "//build:ios_buildflags",
+ "//build/config/compiler:compiler_buildflags",
+ "//third_party/modp_b64",
++ "//electron/build/config:generate_mas_config",
+ ]
+ if (!is_nacl) {
+ # Used by metrics/crc32, except on NaCl builds.
+@@ -1077,11 +1078,27 @@ component("base") {
+ # Needed for <atomic> if using newer C++ library than sysroot, except if
+ # building inside the cros_sdk environment - use host_toolchain as a
+ # more robust check for this.
+- if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos)) &&
++ if (!use_sysroot && (is_android || is_chromeos || (is_linux && !is_castos && !is_bsd)) &&
+ host_toolchain != "//build/toolchain/cros:host") {
+ libs += [ "atomic" ]
+ }
+
++ # *BSD needs libkvm
++ if (is_bsd) {
++ libs += [
++ "kvm",
++ "epoll-shim",
++ ]
++ }
++
++ if (is_freebsd) {
++ libs += [
++ "execinfo",
++ "util",
++ "z",
++ ]
++ }
++
+ if (use_allocator_shim) {
+ if (is_apple) {
+ sources += [ "allocator/early_zone_registration_apple.h" ]
+@@ -1101,7 +1118,7 @@ component("base") {
+
+ # Allow more direct string conversions on platforms with native utf8
+ # strings
+- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
+ defines += [ "SYSTEM_NATIVE_UTF8" ]
+ }
+
+@@ -2095,6 +2112,29 @@ component("base") {
+ ]
+ }
+
++ if (is_openbsd) {
++ sources += [
++ "process/process_handle_openbsd.cc",
++ "process/process_iterator_openbsd.cc",
++ "process/process_metrics_openbsd.cc",
++ "system/sys_info_openbsd.cc",
++ ]
++ } else if (is_freebsd) {
++ sources += [
++ "process/process_handle_freebsd.cc",
++ "process/process_iterator_freebsd.cc",
++ "process/process_metrics_freebsd.cc",
++ "system/sys_info_freebsd.cc",
++ ]
++ } else if (is_netbsd) {
++ sources += [
++ "process/process_handle_netbsd.cc",
++ "process/process_iterator_netbsd.cc",
++ "process/process_metrics_netbsd.cc",
++ "system/sys_info_netbsd.cc",
++ ]
++ }
++
+ # iOS
+ if (is_ios) {
+ sources += [
+@@ -2239,6 +2279,33 @@ component("base") {
+ }
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "files/file_path_watcher_inotify.cc",
++ "files/scoped_file_linux.cc",
++ "process/set_process_title_linux.cc",
++ "process/set_process_title_linux.h",
++ "system/sys_info_linux.cc",
++ "process/process_iterator_linux.cc",
++ "process/process_linux.cc",
++ "process/process_metrics_linux.cc",
++ "process/process_handle_linux.cc",
++ "profiler/stack_copier_signal.cc",
++ "profiler/stack_copier_signal.h",
++ "profiler/thread_delegate_posix.cc",
++ "profiler/thread_delegate_posix.h",
++ "threading/platform_thread_linux.cc",
++ "stack_canary_linux.cc",
++ "stack_canary_linux.h",
++ ]
++ sources += [
++ "files/file_path_watcher_kqueue.cc",
++ "files/file_path_watcher_kqueue.h",
++ "files/file_path_watcher_bsd.cc",
++ "threading/platform_thread_bsd.cc",
++ ]
++ }
++
+ if (use_blink) {
+ sources += [
+ "files/file_path_watcher.cc",
+@@ -2594,7 +2661,7 @@ buildflag_header("protected_memory_build
+ header = "protected_memory_buildflags.h"
+ header_dir = "base/memory"
+
+- protected_memory_enabled = !is_component_build && is_clang &&
++ protected_memory_enabled = !is_openbsd && !is_component_build && is_clang &&
+ (is_win || is_linux || is_android || is_mac)
+
+ flags = [ "PROTECTED_MEMORY_ENABLED=$protected_memory_enabled" ]
+@@ -3079,7 +3146,7 @@ if (is_apple) {
+ }
+ }
+
+-if (!is_nacl && (is_linux || is_chromeos)) {
++if (!is_nacl && !is_bsd && (is_linux || is_chromeos)) {
+ # This test must compile with -fstack-protector-all
+ source_set("stack_canary_linux_unittests") {
+ testonly = true
+@@ -3756,7 +3823,7 @@ test("base_unittests") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if (!is_bsd && (is_linux || is_chromeos)) {
+ sources += [
+ "debug/proc_maps_linux_unittest.cc",
+ "files/scoped_file_linux_unittest.cc",
+@@ -3783,7 +3850,7 @@ test("base_unittests") {
+ "posix/file_descriptor_shuffle_unittest.cc",
+ "posix/unix_domain_socket_unittest.cc",
+ ]
+- if (!is_nacl && !is_apple) {
++ if (!is_nacl && !is_apple && !is_bsd) {
+ sources += [
+ "profiler/stack_base_address_posix_unittest.cc",
+ "profiler/stack_copier_signal_unittest.cc",
+@@ -3794,7 +3861,7 @@ test("base_unittests") {
+
+ # Allow more direct string conversions on platforms with native utf8
+ # strings
+- if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia) {
++ if (is_apple || is_chromeos || is_castos || is_cast_android || is_fuchsia || is_bsd) {
+ defines += [ "SYSTEM_NATIVE_UTF8" ]
+ }
+
+@@ -3984,7 +4051,7 @@ test("base_unittests") {
+ deps += [ ":base_profiler_test_support_library" ]
+ }
+
+- if (is_fuchsia || is_linux || is_chromeos) {
++ if ((is_fuchsia || is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "debug/elf_reader_unittest.cc",
+ "debug/test_elf_image_builder.cc",
diff --git a/electron34/patches/patch-base_allocator_dispatcher_tls.h b/electron34/patches/patch-base_allocator_dispatcher_tls.h
new file mode 100644
index 0000000000..9cd1f8befa
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_dispatcher_tls.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/dispatcher/tls.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/dispatcher/tls.h
+@@ -77,7 +77,7 @@ struct BASE_EXPORT MMapAllocator {
+ constexpr static size_t AllocationChunkSize = 16384;
+ #elif BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS)
+ constexpr static size_t AllocationChunkSize = 16384;
+-#elif BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_ARM64)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_ARM64)
+ constexpr static size_t AllocationChunkSize = 16384;
+ #else
+ constexpr static size_t AllocationChunkSize = 4096;
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_partition__alloc.gni b/electron34/patches/patch-base_allocator_partition__allocator_partition__alloc.gni
new file mode 100644
index 0000000000..2d58b21a2f
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_partition__alloc.gni
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/partition_alloc.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/partition_alloc.gni
+@@ -38,7 +38,7 @@ if (is_nacl) {
+ use_large_empty_slot_span_ring = true
+
+ has_memory_tagging =
+- current_cpu == "arm64" && is_clang && !is_asan && (is_linux || is_android)
++ current_cpu == "arm64" && is_clang && !is_asan && !is_bsd && (is_linux || is_android)
+
+ declare_args() {
+ # Causes all the allocations to be routed via allocator_shim.cc. Usually,
+@@ -432,7 +432,7 @@ assert(!use_asan_backup_ref_ptr || use_r
+ # dependencies that use partition_allocator are compiled in AOSP against a
+ # version of glibc that does not include pkeys syscall numbers.
+ is_pkeys_available =
+- (is_linux || is_chromeos) && current_cpu == "x64" && !is_cronet_build
++ !is_bsd && (is_linux || is_chromeos) && current_cpu == "x64" && !is_cronet_build
+ declare_args() {
+ enable_pkeys = is_pkeys_available
+ }
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
new file mode 100644
index 0000000000..331788286c
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
+@@ -863,7 +863,7 @@ if (is_clang_or_gcc) {
+ configs -= [ partition_alloc_enable_arc_config ]
+ }
+ }
+- if (is_chromeos || is_linux) {
++ if ((is_chromeos || is_linux) && !is_bsd) {
+ shim_headers += [
+ "shim/allocator_shim_override_cpp_symbols.h",
+ "shim/allocator_shim_override_glibc_weak_symbols.h",
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
new file mode 100644
index 0000000000..20781188d5
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/address_space_randomization.h
+@@ -38,7 +38,7 @@ AslrMask(uintptr_t bits) {
+
+ #if PA_BUILDFLAG(PA_ARCH_CPU_64_BITS)
+
+- #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
++ #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) && !PA_BUILDFLAG(IS_BSD)
+
+ // We shouldn't allocate system pages at all for sanitizer builds. However,
+ // we do, and if random hint addresses interfere with address ranges
+@@ -125,7 +125,7 @@ AslrMask(uintptr_t bits) {
+ return AslrAddress(0x20000000ULL);
+ }
+ #elif PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
+- #if PA_BUILDFLAG(IS_LINUX)
++ #if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)
+
+ // Linux on arm64 can use 39, 42, 48, or 52-bit user space, depending on
+ // page size and number of levels of translation pages used. We use
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
new file mode 100644
index 0000000000..5e33f4ec1a
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator.h
+@@ -269,7 +269,7 @@ bool DecommitAndZeroSystemPages(void* ad
+ // recommitted. Do not assume that this will not change over time.
+ constexpr PA_COMPONENT_EXPORT(
+ PARTITION_ALLOC) bool DecommittedMemoryIsAlwaysZeroed() {
+-#if PA_BUILDFLAG(IS_APPLE)
++#if PA_BUILDFLAG(IS_APPLE) || PA_BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
new file mode 100644
index 0000000000..b9f3699c1f
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_constants.h
+@@ -26,8 +26,8 @@
+ #define PAGE_ALLOCATOR_CONSTANTS_DECLARE_CONSTEXPR __attribute__((const))
+
+ #elif (PA_BUILDFLAG(IS_ANDROID) && PA_BUILDFLAG(PA_ARCH_CPU_64_BITS)) || \
+- (PA_BUILDFLAG(IS_LINUX) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)) || \
+- (PA_BUILDFLAG(IS_LINUX) && PA_BUILDFLAG(PA_ARCH_CPU_PPC64))
++ ((PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)) || \
++ ((PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)) && PA_BUILDFLAG(PA_ARCH_CPU_PPC64))
+ // This should work for all POSIX (if needed), but currently all other
+ // supported OS/architecture combinations use either hard-coded values
+ // (such as x86) or have means to determine these values without needing
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc
new file mode 100644
index 0000000000..15ea55c51a
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.cc
+@@ -39,7 +39,7 @@ uint32_t SecTaskGetCodeSignStatus(SecTas
+
+ #if PA_BUILDFLAG(HAS_MEMORY_TAGGING) || \
+ (defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1) && \
+- __has_include(<sys/ifunc.h>))
++ __has_include(<sys/ifunc.h>) && !PA_BUILDFLAG(IS_BSD))
+ struct __ifunc_arg_t;
+
+ #include "partition_alloc/aarch64_support.h"
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
new file mode 100644
index 0000000000..d7cc522e83
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
+@@ -302,8 +302,12 @@ bool TryRecommitSystemPagesInternal(
+
+ void DiscardSystemPagesInternal(uintptr_t address, size_t length) {
+ void* ptr = reinterpret_cast<void*>(address);
+-#if PA_BUILDFLAG(IS_APPLE)
++#if PA_BUILDFLAG(IS_APPLE) || PA_BUILDFLAG(IS_BSD)
++#if PA_BUILDFLAG(IS_BSD)
++ int ret = madvise(ptr, length, MADV_FREE);
++#else
+ int ret = madvise(ptr, length, MADV_FREE_REUSABLE);
++#endif
+ if (ret) {
+ // MADV_FREE_REUSABLE sometimes fails, so fall back to MADV_DONTNEED.
+ ret = madvise(ptr, length, MADV_DONTNEED);
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc
new file mode 100644
index 0000000000..a1da4a570e
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/proc_maps_linux.cc
+@@ -19,7 +19,7 @@
+ #include "partition_alloc/partition_alloc_check.h"
+
+ #if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || \
+- PA_BUILDFLAG(IS_ANDROID)
++ PA_BUILDFLAG(IS_ANDROID) || PA_BUILDFLAG(IS_BSD)
+ #include <inttypes.h>
+ #endif
+
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
new file mode 100644
index 0000000000..e0b7fb261c
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/debug/stack_trace_posix.cc
+@@ -13,11 +13,11 @@
+ #include "partition_alloc/partition_alloc_base/posix/eintr_wrapper.h"
+ #include "partition_alloc/partition_alloc_base/strings/safe_sprintf.h"
+
+-#if !PA_BUILDFLAG(IS_ANDROID) && !PA_BUILDFLAG(IS_APPLE)
++#if !PA_BUILDFLAG(IS_ANDROID) && !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_BSD)
+ #include <link.h> // For ElfW() macro.
+ #endif
+
+-#if PA_BUILDFLAG(IS_APPLE)
++#if PA_BUILDFLAG(IS_APPLE) || PA_BUILDFLAG(IS_BSD)
+ #include <dlfcn.h>
+ #endif
+
+@@ -25,7 +25,7 @@ namespace partition_alloc::internal::bas
+
+ namespace {
+
+-#if !PA_BUILDFLAG(IS_APPLE)
++#if !PA_BUILDFLAG(IS_APPLE) && !PA_BUILDFLAG(IS_BSD)
+
+ // On Android the 'open' function has two versions:
+ // int open(const char *pathname, int flags);
+@@ -369,7 +369,7 @@ void PrintStackTraceInternal(const void*
+ }
+ #endif // !PA_BUILDFLAG(IS_APPLE)
+
+-#if PA_BUILDFLAG(IS_APPLE)
++#if PA_BUILDFLAG(IS_APPLE) || PA_BUILDFLAG(IS_BSD)
+ // Since /proc/self/maps is not available, use dladdr() to obtain module
+ // names and offsets inside the modules from the given addresses.
+ void PrintStackTraceInternal(const void* const* trace, size_t size) {
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
new file mode 100644
index 0000000000..16130a05d5
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/rand_util_posix.cc
+@@ -102,6 +102,10 @@ void RandBytes(void* output, size_t outp
+ if (getentropy(output, output_length) == 0) {
+ return;
+ }
++#elif PA_BUILDFLAG(IS_BSD)
++ if (getentropy(output, output_length) == 0) {
++ return;
++ }
+ #endif
+ // If getrandom(2) above returned with an error and the /dev/urandom fallback
+ // took place on Linux/ChromeOS bots, they would fail with a CHECK in
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
new file mode 100644
index 0000000000..3e248a1962
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread.h
+@@ -37,6 +37,8 @@ typedef DWORD PlatformThreadId;
+ typedef zx_handle_t PlatformThreadId;
+ #elif PA_BUILDFLAG(IS_APPLE)
+ typedef mach_port_t PlatformThreadId;
++#elif PA_BUILDFLAG(IS_BSD)
++typedef uint64_t PlatformThreadId;
+ #elif PA_BUILDFLAG(IS_POSIX)
+ typedef pid_t PlatformThreadId;
+ #endif
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
new file mode 100644
index 0000000000..fb309838ec
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h
+@@ -10,7 +10,7 @@
+
+ namespace partition_alloc::internal::base::internal {
+
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || PA_BUILDFLAG(IS_BSD)
+ // Current thread id is cached in thread local storage for performance reasons.
+ // In some rare cases it's important to invalidate that cache explicitly (e.g.
+ // after going through clone() syscall which does not call pthread_atfork()
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
new file mode 100644
index 0000000000..ba73b908eb
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_base/threading/platform_thread_posix.cc
+@@ -18,7 +18,7 @@
+ #include "partition_alloc/partition_alloc_base/logging.h"
+ #include "partition_alloc/partition_alloc_base/threading/platform_thread_internal_posix.h"
+
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || PA_BUILDFLAG(IS_BSD)
+ #include <sys/syscall.h>
+ #include <atomic>
+ #endif
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
new file mode 100644
index 0000000000..c4c0be23cb
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h
+@@ -51,8 +51,8 @@ static_assert(sizeof(void*) != 8, "");
+ // POSIX is not only UNIX, e.g. macOS and other OSes. We do use Linux-specific
+ // features such as futex(2).
+ #define PA_CONFIG_HAS_LINUX_KERNEL() \
+- (PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || \
+- PA_BUILDFLAG(IS_ANDROID))
++ ((PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || \
++ PA_BUILDFLAG(IS_ANDROID)) && !PA_BUILDFLAG(IS_NETBSD))
+
+ // If defined, enables zeroing memory on Free() with roughly 1% probability.
+ // This applies only to normal buckets, as direct-map allocations are always
+@@ -170,7 +170,7 @@ constexpr bool kUseLazyCommit = false;
+ // This may be required on more platforms in the future.
+ #define PA_CONFIG_HAS_ATFORK_HANDLER() \
+ (PA_BUILDFLAG(IS_APPLE) || PA_BUILDFLAG(IS_LINUX) || \
+- PA_BUILDFLAG(IS_CHROMEOS))
++ PA_BUILDFLAG(IS_CHROMEOS) || PA_BUILDFLAG(IS_BSD))
+
+ // Enable shadow metadata.
+ //
+@@ -233,7 +233,7 @@ constexpr bool kUseLazyCommit = false;
+ // Also enabled on ARM64 macOS and iOS, as the 16kiB pages on this platform lead
+ // to larger slot spans.
+ #if PA_BUILDFLAG(IS_LINUX) || \
+- (PA_BUILDFLAG(IS_APPLE) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64))
++ (PA_BUILDFLAG(IS_APPLE) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)) || PA_BUILDFLAG(IS_BSD)
+ #define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 1
+ #else
+ #define PA_CONFIG_PREFER_SMALLER_SLOT_SPANS() 0
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
new file mode 100644
index 0000000000..f133c5a7b7
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_constants.h
+@@ -329,7 +329,7 @@ PA_DEFINE_OPERATORS_FOR_FLAGS(PoolHandle
+ // 8GB for each of the glued pools).
+ #if PA_BUILDFLAG(HAS_64_BIT_POINTERS)
+ #if PA_BUILDFLAG(IS_ANDROID) || PA_BUILDFLAG(IS_IOS) || \
+- PA_BUILDFLAG(ENABLE_POINTER_COMPRESSION)
++ PA_BUILDFLAG(ENABLE_POINTER_COMPRESSION) || PA_BUILDFLAG(IS_BSD)
+ constexpr size_t kPoolMaxSize = 8 * kGiB;
+ #else
+ constexpr size_t kPoolMaxSize = 16 * kGiB;
+@@ -446,7 +446,7 @@ PA_ALWAYS_INLINE constexpr size_t MaxDir
+ // TODO(casey.smalley%arm.com@localhost): under 64k pages we can end up in a situation
+ // where a normal slot span will be large enough to contain multiple items,
+ // but the address will go over the final partition page after being aligned.
+-#if PA_BUILDFLAG(IS_LINUX) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
++#if (PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
+ constexpr size_t kMaxSupportedAlignment = kSuperPageSize / 4;
+ #else
+ constexpr size_t kMaxSupportedAlignment = kSuperPageSize / 2;
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
new file mode 100644
index 0000000000..4cd3919478
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_forward.h
+@@ -28,9 +28,13 @@ namespace internal {
+ // the second one 16. We could technically return something different for
+ // malloc() and operator new(), but this would complicate things, and most of
+ // our allocations are presumably coming from operator new() anyway.
++#if defined(__i386__) && defined(OS_FREEBSD)
++constexpr size_t kAlignment = 8;
++#else
+ constexpr size_t kAlignment =
+ std::max(alignof(max_align_t),
+ static_cast<size_t>(__STDCPP_DEFAULT_NEW_ALIGNMENT__));
++#endif
+ static_assert(kAlignment <= 16,
+ "PartitionAlloc doesn't support a fundamental alignment larger "
+ "than 16 bytes.");
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
new file mode 100644
index 0000000000..c0230baf88
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/partition_root.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -44,7 +44,7 @@
+ #include "wow64apiset.h"
+ #endif
+
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || PA_BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+ #if PA_CONFIG(ENABLE_SHADOW_METADATA)
+ #include <sys/mman.h>
+@@ -293,7 +293,7 @@ void PartitionAllocMallocInitOnce() {
+ return;
+ }
+
+-#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS)
++#if PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_CHROMEOS) || PA_BUILDFLAG(IS_BSD)
+ // When fork() is called, only the current thread continues to execute in the
+ // child process. If the lock is held, but *not* by this thread when fork() is
+ // called, we have a deadlock.
+@@ -1113,7 +1113,7 @@ void PartitionRoot::Init(PartitionOption
+ // apple OSes.
+ PA_CHECK((internal::SystemPageSize() == (size_t{1} << 12)) ||
+ (internal::SystemPageSize() == (size_t{1} << 14)));
+-#elif PA_BUILDFLAG(IS_LINUX) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
++#elif (PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64)
+ // Check runtime pagesize. Though the code is currently the same, it is
+ // not merged with the IS_APPLE case above as a 1 << 16 case is only
+ // supported on Linux on AArch64.
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
new file mode 100644
index 0000000000..8b933c3703
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/spinning_mutex.cc
+@@ -17,7 +17,16 @@
+ #endif
+
+ #if PA_CONFIG(HAS_LINUX_KERNEL)
++#if defined(OS_OPENBSD) || defined(OS_NETBSD)
++#include <sys/time.h>
++#include <sys/futex.h>
++#elif defined(OS_FREEBSD)
++#include <sys/types.h>
++#include <sys/thr.h>
++#include <sys/umtx.h>
++#else
+ #include <linux/futex.h>
++#endif
+ #include <sys/syscall.h>
+ #include <unistd.h>
+
+@@ -106,8 +115,19 @@ void SpinningMutex::FutexWait() {
+ // |kLockedContended| anymore. Note that even without spurious wakeups, the
+ // value of |state_| is not guaranteed when this returns, as another thread
+ // may get the lock before we get to run.
++#if defined(OS_FREEBSD)
++ int err = _umtx_op(&state_, UMTX_OP_WAIT_UINT_PRIVATE,
++ kLockedContended, nullptr, nullptr);
++#elif defined(OS_OPENBSD)
++ int err = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
++ kLockedContended, nullptr, nullptr);
++#elif defined(OS_NETBSD)
++ int err = syscall(SYS___futex, reinterpret_cast<int *>(&state_), FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
++ kLockedContended, nullptr, nullptr, 0, 0);
++#else
+ int err = syscall(SYS_futex, &state_, FUTEX_WAIT | FUTEX_PRIVATE_FLAG,
+ kLockedContended, nullptr, nullptr, 0);
++#endif
+
+ if (err) {
+ // These are programming error, check them.
+@@ -119,8 +139,19 @@ void SpinningMutex::FutexWait() {
+
+ void SpinningMutex::FutexWake() {
+ int saved_errno = errno;
++#if defined(OS_FREEBSD)
++ long retval = _umtx_op(&state_, UMTX_OP_WAKE_PRIVATE,
++ 1 /* wake up a single waiter */, nullptr, nullptr);
++#elif defined(OS_OPENBSD)
++ long retval = futex(reinterpret_cast<volatile unsigned int *>(&state_), FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
++ 1 /* wake up a single waiter */, nullptr, nullptr);
++#elif defined(OS_NETBSD)
++ long retval = syscall(SYS___futex, reinterpret_cast<int *>(&state_), FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
++ 1 /* wake up a single waiter */, nullptr, nullptr, 0, 0);
++#else
+ long retval = syscall(SYS_futex, &state_, FUTEX_WAKE | FUTEX_PRIVATE_FLAG,
+ 1 /* wake up a single waiter */, nullptr, nullptr, 0);
++#endif
+ PA_CHECK(retval != -1);
+ errno = saved_errno;
+ }
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
new file mode 100644
index 0000000000..10beea29bb
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
@@ -0,0 +1,56 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/stack/stack.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/stack/stack.cc
+@@ -18,6 +18,10 @@
+ #include <pthread.h>
+ #endif
+
++#if PA_BUILDFLAG(IS_BSD) && !PA_BUILDFLAG(IS_NETBSD)
++#include <pthread_np.h>
++#endif
++
+ #if PA_BUILDFLAG(PA_LIBC_GLIBC)
+ extern "C" void* __libc_stack_end;
+ #endif
+@@ -50,6 +54,36 @@ void* GetStackTop() {
+ return pthread_get_stackaddr_np(pthread_self());
+ }
+
++#elif PA_BUILDFLAG(IS_OPENBSD)
++
++void* GetStackTop() {
++ stack_t ss;
++ if (pthread_stackseg_np(pthread_self(), &ss) != 0)
++ return nullptr;
++ return reinterpret_cast<uint8_t*>(ss.ss_sp);
++}
++
++#elif PA_BUILDFLAG(IS_FREEBSD) || PA_BUILDFLAG(IS_NETBSD)
++
++void* GetStackTop() {
++ pthread_attr_t attr;
++ int error = pthread_attr_init(&attr);
++ if (error) {
++ return nullptr;
++ }
++ error = pthread_attr_get_np(pthread_self(), &attr);
++ if (!error) {
++ void* base;
++ size_t size;
++ error = pthread_attr_getstack(&attr, &base, &size);
++ PA_CHECK(!error);
++ pthread_attr_destroy(&attr);
++ return reinterpret_cast<uint8_t*>(base) + size;
++ }
++ pthread_attr_destroy(&attr);
++ return nullptr;
++}
++
+ #elif PA_BUILDFLAG(IS_POSIX) || PA_BUILDFLAG(IS_FUCHSIA)
+
+ void* GetStackTop() {
diff --git a/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
new file mode 100644
index 0000000000..d73d3cea8d
--- /dev/null
+++ b/electron34/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/thread_isolation/pkey.cc
+@@ -16,7 +16,7 @@
+ #include "partition_alloc/partition_alloc_check.h"
+ #include "partition_alloc/thread_isolation/thread_isolation.h"
+
+-#if !PA_BUILDFLAG(IS_LINUX) && !PA_BUILDFLAG(IS_CHROMEOS)
++#if !PA_BUILDFLAG(IS_LINUX) && !PA_BUILDFLAG(IS_CHROMEOS) && !PA_BUILDFLAG(IS_BSD)
+ #error "This pkey code is currently only supported on Linux and ChromeOS"
+ #endif
+
diff --git a/electron34/patches/patch-base_atomicops.h b/electron34/patches/patch-base_atomicops.h
new file mode 100644
index 0000000000..b22d25a4e2
--- /dev/null
+++ b/electron34/patches/patch-base_atomicops.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/atomicops.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/atomicops.h
+@@ -71,7 +71,11 @@ typedef intptr_t Atomic64;
+
+ // Use AtomicWord for a machine-sized pointer. It will use the Atomic32 or
+ // Atomic64 routines below, depending on your architecture.
++#if !defined(OS_OPENBSD) && defined(__i386__)
++typedef Atomic32 AtomicWord;
++#else
+ typedef intptr_t AtomicWord;
++#endif
+
+ // Atomically execute:
+ // result = *ptr;
diff --git a/electron34/patches/patch-base_base__paths__posix.cc b/electron34/patches/patch-base_base__paths__posix.cc
new file mode 100644
index 0000000000..3aa16d7af6
--- /dev/null
+++ b/electron34/patches/patch-base_base__paths__posix.cc
@@ -0,0 +1,128 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/base_paths_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/base_paths_posix.cc
+@@ -15,6 +15,7 @@
+ #include <ostream>
+ #include <string>
+
++#include "base/command_line.h"
+ #include "base/environment.h"
+ #include "base/files/file_path.h"
+ #include "base/files/file_util.h"
+@@ -26,9 +27,13 @@
+ #include "base/process/process_metrics.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_BSD)
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
++#if BUILDFLAG(IS_OPENBSD)
++#include <kvm.h>
++#define MAXTOKENS 2
++#endif
+ #elif BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_AIX)
+ #include <stdlib.h>
+ #endif
+@@ -47,13 +52,21 @@ bool PathProviderPosix(int key, FilePath
+ *result = bin_dir;
+ return true;
+ #elif BUILDFLAG(IS_FREEBSD)
+- int name[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
+- std::optional<std::string> bin_dir = StringSysctl(name, std::size(name));
++ std::optional<std::string> bin_dir = StringSysctl({ CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 });
+ if (!bin_dir.has_value() || bin_dir.value().length() <= 1) {
+ NOTREACHED() << "Unable to resolve path.";
+ }
+ *result = FilePath(bin_dir.value());
+ return true;
++#elif BUILDFLAG(IS_NETBSD)
++ std::optional<std::string> bin_dir = StringSysctl({ CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_PATHNAME });
++ if (!bin_dir.has_value() || bin_dir.value().length() <= 1) {
++ NOTREACHED_IN_MIGRATION() << "Unable to resolve path.";
++ return false;
++ }
++ *result = FilePath(bin_dir.value());
++ VLOG(1) << "PathProviderPosix result: " << bin_dir.value();
++ return true;
+ #elif BUILDFLAG(IS_SOLARIS)
+ char bin_dir[PATH_MAX + 1];
+ if (realpath(getexecname(), bin_dir) == NULL) {
+@@ -62,13 +75,65 @@ bool PathProviderPosix(int key, FilePath
+ *result = FilePath(bin_dir);
+ return true;
+ #elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_AIX)
+- // There is currently no way to get the executable path on OpenBSD
+- char* cpath;
+- if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
+- *result = FilePath(cpath);
+- else
+- *result = FilePath("/usr/local/chrome/chrome");
+- return true;
++ char *cpath;
++#if !BUILDFLAG(IS_AIX)
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ char errbuf[_POSIX2_LINE_MAX];
++ static char retval[PATH_MAX];
++ int cnt;
++ struct stat sb;
++ pid_t cpid = getpid();
++ bool ret = false;
++
++ const base::CommandLine* command_line =
++ base::CommandLine::ForCurrentProcess();
++
++ VLOG(1) << "PathProviderPosix argv: " << command_line->argv()[0];
++
++ if (realpath(command_line->argv()[0].c_str(), retval) == NULL)
++ goto out;
++
++ if (stat(command_line->argv()[0].c_str(), &sb) < 0)
++ goto out;
++
++ if (!command_line->HasSwitch("no-sandbox")) {
++ ret = true;
++ *result = FilePath(retval);
++ VLOG(1) << "PathProviderPosix (sandbox) result: " << retval;
++ goto out;
++ }
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES, errbuf)) == NULL)
++ goto out;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
++ sizeof(struct kinfo_file), &cnt)) == NULL)
++ goto out;
++
++ for (int i = 0; i < cnt; i++) {
++ if (files[i].fd_fd == KERN_FILE_TEXT &&
++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
++ files[i].va_fileid == sb.st_ino) {
++ ret = true;
++ *result = FilePath(retval);
++ VLOG(1) << "PathProviderPosix result: " << retval;
++ }
++ }
++out:
++ if (kd)
++ kvm_close(kd);
++ if (!ret) {
++#endif
++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
++ *result = FilePath(cpath);
++ else
++ *result = FilePath("@PREFIX@/lib/chromium/chrome");
++ return true;
++#if !BUILDFLAG(IS_AIX)
++ }
++ return ret;
++#endif
+ #endif
+ }
+ case DIR_SRC_TEST_DATA_ROOT: {
diff --git a/electron34/patches/patch-base_compiler__specific.h b/electron34/patches/patch-base_compiler__specific.h
new file mode 100644
index 0000000000..e0ad3ad08f
--- /dev/null
+++ b/electron34/patches/patch-base_compiler__specific.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/compiler_specific.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/compiler_specific.h
+@@ -683,6 +683,7 @@ inline constexpr bool AnalyzerAssumeTrue
+ #if __has_cpp_attribute(clang::preserve_most) && \
+ (defined(ARCH_CPU_ARM64) || defined(ARCH_CPU_X86_64)) && \
+ !defined(COMPONENT_BUILD) && \
++ !BUILDFLAG(IS_OPENBSD) && \
+ !(BUILDFLAG(IS_WIN) && defined(ARCH_CPU_ARM64))
+ #define PRESERVE_MOST [[clang::preserve_most]]
+ #else
diff --git a/electron34/patches/patch-base_debug_debugger__posix.cc b/electron34/patches/patch-base_debug_debugger__posix.cc
new file mode 100644
index 0000000000..5a69c994f3
--- /dev/null
+++ b/electron34/patches/patch-base_debug_debugger__posix.cc
@@ -0,0 +1,106 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/debug/debugger_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/debug/debugger_posix.cc
+@@ -41,6 +41,10 @@
+ #include <sys/sysctl.h>
+ #endif
+
++#if BUILDFLAG(IS_OPENBSD)
++#include <sys/proc.h>
++#endif
++
+ #if BUILDFLAG(IS_FREEBSD)
+ #include <sys/user.h>
+ #endif
+@@ -86,6 +90,7 @@ bool BeingDebugged() {
+
+ // Initialize mib, which tells sysctl what info we want. In this case,
+ // we're looking for information about a specific process ID.
++#if !BUILDFLAG(IS_NETBSD)
+ int mib[] = {
+ CTL_KERN,
+ KERN_PROC,
+@@ -97,36 +102,75 @@ bool BeingDebugged() {
+ 0
+ #endif
+ };
++#else
++ int mib[] = {
++ CTL_KERN,
++ KERN_PROC2,
++ KERN_PROC_PID,
++ getpid(),
++ sizeof(struct kinfo_proc2),
++ 1
++ };
++#endif
+
+ // Caution: struct kinfo_proc is marked __APPLE_API_UNSTABLE. The source and
+ // binary interfaces may change.
++#if BUILDFLAG(IS_OPENBSD)
++ struct kinfo_proc *info;
++ size_t info_size;
++#elif BUILDFLAG(IS_NETBSD)
++ struct kinfo_proc2 info;
++ size_t info_size = sizeof(info);
++#else
+ struct kinfo_proc info;
+ size_t info_size = sizeof(info);
++#endif
+
+ #if BUILDFLAG(IS_OPENBSD)
+ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
+ return -1;
+
+- mib[5] = (info_size / sizeof(struct kinfo_proc));
++ mib[5] = static_cast<int>((info_size / sizeof(struct kinfo_proc)));
++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL) {
++ is_set = true;
++ being_debugged = false;
++ return being_debugged;
++ }
++
++ int sysctl_result = sysctl(mib, std::size(mib), info, &info_size, NULL, 0);
++#elif BUILDFLAG(IS_NETBSD)
++ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
++ return -1;
++
++ mib[5] = (info_size / sizeof(struct kinfo_proc2));
+ #endif
+
++#if !BUILDFLAG(IS_OPENBSD)
+ int sysctl_result = sysctl(mib, std::size(mib), &info, &info_size, NULL, 0);
++#endif
+ DCHECK_EQ(sysctl_result, 0);
+ if (sysctl_result != 0) {
+ is_set = true;
+ being_debugged = false;
+- return being_debugged;
++ goto out;
+ }
+
+ // This process is being debugged if the P_TRACED flag is set.
+ is_set = true;
+ #if BUILDFLAG(IS_FREEBSD)
+ being_debugged = (info.ki_flag & P_TRACED) != 0;
+-#elif BUILDFLAG(IS_BSD)
++#elif BUILDFLAG(IS_OPENBSD)
++ being_debugged = (info->p_psflags & PS_TRACED) != 0;
++#elif BUILDFLAG(IS_NETBSD)
+ being_debugged = (info.p_flag & P_TRACED) != 0;
+ #else
+ being_debugged = (info.kp_proc.p_flag & P_TRACED) != 0;
+ #endif
++
++out:
++#if BUILDFLAG(IS_OPENBSD)
++ free(info);
++#endif
+ return being_debugged;
+ }
+
diff --git a/electron34/patches/patch-base_debug_elf__reader.cc b/electron34/patches/patch-base_debug_elf__reader.cc
new file mode 100644
index 0000000000..db085e2675
--- /dev/null
+++ b/electron34/patches/patch-base_debug_elf__reader.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/debug/elf_reader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/debug/elf_reader.cc
+@@ -50,6 +50,10 @@ using Xword = Elf64_Xword;
+
+ constexpr char kGnuNoteName[] = "GNU";
+
++#ifndef NT_GNU_BUILD_ID
++#define NT_GNU_BUILD_ID 3
++#endif
++
+ // Returns a pointer to the header of the ELF binary mapped into memory, or a
+ // null pointer if the header is invalid. Here and below |elf_mapped_base| is a
+ // pointer to the start of the ELF image.
diff --git a/electron34/patches/patch-base_debug_proc__maps__linux.cc b/electron34/patches/patch-base_debug_proc__maps__linux.cc
new file mode 100644
index 0000000000..8bd66d9990
--- /dev/null
+++ b/electron34/patches/patch-base_debug_proc__maps__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/debug/proc_maps_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/debug/proc_maps_linux.cc
+@@ -20,7 +20,7 @@
+ #include "base/strings/string_split.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include <inttypes.h>
+ #endif
+
diff --git a/electron34/patches/patch-base_debug_stack__trace.cc b/electron34/patches/patch-base_debug_stack__trace.cc
new file mode 100644
index 0000000000..65a6583fcf
--- /dev/null
+++ b/electron34/patches/patch-base_debug_stack__trace.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/debug/stack_trace.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/debug/stack_trace.cc
+@@ -258,7 +258,7 @@ bool StackTrace::WillSymbolizeToStreamFo
+ // Symbols are not expected to be reliable when gn args specifies
+ // symbol_level=0.
+ return false;
+-#elif defined(__UCLIBC__) || defined(_AIX)
++#elif defined(__UCLIBC__) || defined(_AIX) || BUILDFLAG(IS_BSD)
+ // StackTrace::OutputToStream() is not implemented under uclibc, nor AIX.
+ // See https://crbug.com/706728
+ return false;
+@@ -320,7 +320,7 @@ std::string StackTrace::ToString() const
+
+ std::string StackTrace::ToStringWithPrefix(cstring_view prefix_string) const {
+ std::stringstream stream;
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
+ OutputToStreamWithPrefix(&stream, prefix_string);
+ #endif
+ return stream.str();
+@@ -344,7 +344,7 @@ bool StackTrace::ShouldSuppressOutput()
+ }
+
+ std::ostream& operator<<(std::ostream& os, const StackTrace& s) {
+-#if !defined(__UCLIBC__) && !defined(_AIX)
++#if !defined(__UCLIBC__) && !defined(_AIX) && !BUILDFLAG(IS_BSD)
+ s.OutputToStream(&os);
+ #else
+ os << "StackTrace::OutputToStream not implemented.";
diff --git a/electron34/patches/patch-base_debug_stack__trace__posix.cc b/electron34/patches/patch-base_debug_stack__trace__posix.cc
new file mode 100644
index 0000000000..9c4601d252
--- /dev/null
+++ b/electron34/patches/patch-base_debug_stack__trace__posix.cc
@@ -0,0 +1,109 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/debug/stack_trace_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/debug/stack_trace_posix.cc
+@@ -45,8 +45,8 @@
+ // Surprisingly, uClibc defines __GLIBC__ in some build configs, but
+ // execinfo.h and backtrace(3) are really only present in glibc and in macOS
+ // libc.
+-#if BUILDFLAG(IS_APPLE) || \
+- (defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__AIX))
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_NETBSD) || \
++ (defined(__GLIBC__) && !defined(__UCLIBC__) && !defined(__AIX) && !BUILDFLAG(IS_BSD))
+ #define HAVE_BACKTRACE
+ #include <execinfo.h>
+ #endif
+@@ -64,8 +64,10 @@
+ #include <AvailabilityMacros.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/prctl.h>
++#endif
+
+ #include "base/debug/proc_maps_linux.h"
+ #endif
+@@ -322,7 +324,7 @@ void PrintToStderr(const char* output) {
+ std::ignore = HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void AlarmSignalHandler(int signal, siginfo_t* info, void* void_context) {
+ // We have seen rare cases on AMD linux where the default signal handler
+ // either does not run or a thread (Probably an AMD driver thread) prevents
+@@ -339,7 +341,11 @@ void AlarmSignalHandler(int signal, sigi
+ "Warning: Default signal handler failed to terminate process.\n");
+ PrintToStderr("Calling exit_group() directly to prevent timeout.\n");
+ // See: https://man7.org/linux/man-pages/man2/exit_group.2.html
++#if BUILDFLAG(IS_BSD)
++ _exit(EXIT_FAILURE);
++#else
+ syscall(SYS_exit_group, EXIT_FAILURE);
++#endif
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -537,7 +543,7 @@ void StackDumpSignalHandler(int signal,
+ _exit(EXIT_FAILURE);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Set an alarm to trigger in case the default handler does not terminate
+ // the process. See 'AlarmSignalHandler' for more details.
+ struct sigaction action;
+@@ -562,6 +568,7 @@ void StackDumpSignalHandler(int signal,
+ // signals that do not re-raise autonomously), such as signals delivered via
+ // kill() and asynchronous hardware faults such as SEGV_MTEAERR, which would
+ // otherwise be lost when re-raising the signal via raise().
++#if !BUILDFLAG(IS_BSD)
+ long retval = syscall(SYS_rt_tgsigqueueinfo, getpid(), syscall(SYS_gettid),
+ info->si_signo, info);
+ if (retval == 0) {
+@@ -576,6 +583,7 @@ void StackDumpSignalHandler(int signal,
+ if (errno != EPERM) {
+ _exit(EXIT_FAILURE);
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+@@ -772,6 +780,7 @@ class SandboxSymbolizeHelper {
+ return -1;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // This class is copied from
+ // third_party/crashpad/crashpad/util/linux/scoped_pr_set_dumpable.h.
+ // It aims at ensuring the process is dumpable before opening /proc/self/mem.
+@@ -864,11 +873,15 @@ class SandboxSymbolizeHelper {
+ r.base = cur_base;
+ }
+ }
++#endif
+
+ // Parses /proc/self/maps in order to compile a list of all object file names
+ // for the modules that are loaded in the current process.
+ // Returns true on success.
+ bool CacheMemoryRegions() {
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ // Reads /proc/self/maps.
+ std::string contents;
+ if (!ReadProcMaps(&contents)) {
+@@ -886,6 +899,7 @@ class SandboxSymbolizeHelper {
+
+ is_initialized_ = true;
+ return true;
++#endif
+ }
+
+ // Opens all object files and caches their file descriptors.
diff --git a/electron34/patches/patch-base_enterprise__util__mac.mm b/electron34/patches/patch-base_enterprise__util__mac.mm
new file mode 100644
index 0000000000..08d2bd083c
--- /dev/null
+++ b/electron34/patches/patch-base_enterprise__util__mac.mm
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/enterprise_util_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/enterprise_util_mac.mm
+@@ -16,6 +16,7 @@
+ #include "base/strings/string_split.h"
+ #include "base/strings/string_util.h"
+ #include "base/strings/sys_string_conversions.h"
++#include "electron/mas.h"
+
+ namespace base {
+
+@@ -116,6 +117,14 @@ DeviceUserDomainJoinState AreDeviceAndUs
+ DeviceUserDomainJoinState state{.device_joined = false,
+ .user_joined = false};
+
++#if IS_MAS_BUILD()
++ return state;
++ }();
++
++ return state;
++}
++#else
++
+ @autoreleasepool {
+ ODSession* session = [ODSession defaultSession];
+ if (session == nil) {
+@@ -219,5 +228,6 @@ DeviceUserDomainJoinState AreDeviceAndUs
+
+ return state;
+ }
++#endif
+
+ } // namespace base
diff --git a/electron34/patches/patch-base_files_dir__reader__linux.h b/electron34/patches/patch-base_files_dir__reader__linux.h
new file mode 100644
index 0000000000..7f9e2700e8
--- /dev/null
+++ b/electron34/patches/patch-base_files_dir__reader__linux.h
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/dir_reader_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/dir_reader_linux.h
+@@ -21,10 +21,16 @@
+ #include "base/logging.h"
+ #include "base/posix/eintr_wrapper.h"
+
++#include "build/build_config.h"
++
+ // See the comments in dir_reader_posix.h about this.
+
+ namespace base {
+
++#if BUILDFLAG(IS_BSD)
++#include <dirent.h>
++typedef struct dirent linux_dirent;
++#else
+ struct linux_dirent {
+ uint64_t d_ino;
+ int64_t d_off;
+@@ -32,6 +38,7 @@ struct linux_dirent {
+ unsigned char d_type;
+ char d_name[0];
+ };
++#endif
+
+ class DirReaderLinux {
+ public:
+@@ -66,7 +73,11 @@ class DirReaderLinux {
+ if (offset_ != size_)
+ return true;
+
++#if BUILDFLAG(IS_BSD)
++ const int r = getdents(fd_, reinterpret_cast<char *>(buf_), sizeof(buf_));
++#else
+ const long r = syscall(__NR_getdents64, fd_, buf_, sizeof(buf_));
++#endif
+ if (r == 0)
+ return false;
+ if (r < 0) {
diff --git a/electron34/patches/patch-base_files_dir__reader__posix.h b/electron34/patches/patch-base_files_dir__reader__posix.h
new file mode 100644
index 0000000000..b423a6ee6c
--- /dev/null
+++ b/electron34/patches/patch-base_files_dir__reader__posix.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/dir_reader_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/dir_reader_posix.h
+@@ -17,7 +17,7 @@
+ // seems worse than falling back to enumerating all file descriptors so we will
+ // probably never implement this on the Mac.
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "base/files/dir_reader_linux.h"
+ #else
+ #include "base/files/dir_reader_fallback.h"
+@@ -25,7 +25,7 @@
+
+ namespace base {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ typedef DirReaderLinux DirReaderPosix;
+ #else
+ typedef DirReaderFallback DirReaderPosix;
diff --git a/electron34/patches/patch-base_files_drive__info.h b/electron34/patches/patch-base_files_drive__info.h
new file mode 100644
index 0000000000..fa963d581e
--- /dev/null
+++ b/electron34/patches/patch-base_files_drive__info.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/drive_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/drive_info.h
+@@ -40,7 +40,7 @@ class BASE_EXPORT DriveInfo {
+ std::optional<bool> has_seek_penalty;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Whether the drive is a removable drive.
+ //
+ // Note on macOS: that SSDs that are connected over USB that you can eject
diff --git a/electron34/patches/patch-base_files_drive__info__posix.cc b/electron34/patches/patch-base_files_drive__info__posix.cc
new file mode 100644
index 0000000000..6e87fcb011
--- /dev/null
+++ b/electron34/patches/patch-base_files_drive__info__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/drive_info_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/drive_info_posix.cc
+@@ -28,7 +28,7 @@ DriveInfo& DriveInfo::operator=(DriveInf
+
+ std::optional<DriveInfo> GetFileDriveInfo(const FilePath& file_path) {
+ DriveInfo drive_info;
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ drive_info.has_seek_penalty = false;
+ return drive_info;
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-base_files_file__path__watcher.h b/electron34/patches/patch-base_files_file__path__watcher.h
new file mode 100644
index 0000000000..f8caa0c0cd
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__path__watcher.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_path_watcher.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_path_watcher.h
+@@ -105,7 +105,7 @@ class BASE_EXPORT FilePathWatcher {
+ Type type = Type::kNonRecursive;
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // The callback will return the full path to a changed file instead of
+ // the watched path supplied as |path| when Watch is called.
+ // So the full path can be different from the watched path when a folder is
diff --git a/electron34/patches/patch-base_files_file__path__watcher__bsd.cc b/electron34/patches/patch-base_files_file__path__watcher__bsd.cc
new file mode 100644
index 0000000000..41945e16b6
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__path__watcher__bsd.cc
@@ -0,0 +1,63 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_path_watcher_bsd.cc.orig 2025-05-24 17:57:53.347893731 +0000
++++ base/files/file_path_watcher_bsd.cc
+@@ -0,0 +1,54 @@
++// Copyright 2021 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include <memory>
++
++#include "base/files/file_path_watcher.h"
++#include "base/files/file_path_watcher_kqueue.h"
++#include "base/memory/ptr_util.h"
++#include "build/build_config.h"
++
++namespace base {
++
++namespace {
++
++class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
++ public:
++ FilePathWatcherImpl() = default;
++ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
++ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
++ ~FilePathWatcherImpl() override = default;
++
++ bool Watch(const FilePath& path,
++ Type type,
++ const FilePathWatcher::Callback& callback) override {
++ DCHECK(!impl_.get());
++ if (type == Type::kRecursive) {
++ if (!FilePathWatcher::RecursiveWatchAvailable())
++ return false;
++ } else {
++ impl_ = std::make_unique<FilePathWatcherKQueue>();
++ }
++ DCHECK(impl_.get());
++ return impl_->Watch(path, type, callback);
++ }
++
++ void Cancel() override {
++ if (impl_.get())
++ impl_->Cancel();
++ set_cancelled();
++ }
++
++ private:
++ std::unique_ptr<PlatformDelegate> impl_;
++};
++
++} // namespace
++
++FilePathWatcher::FilePathWatcher() {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++ impl_ = std::make_unique<FilePathWatcherImpl>();
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_files_file__path__watcher__kqueue.cc b/electron34/patches/patch-base_files_file__path__watcher__kqueue.cc
new file mode 100644
index 0000000000..94948b8fe9
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__path__watcher__kqueue.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_path_watcher_kqueue.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_path_watcher_kqueue.cc
+@@ -81,9 +81,15 @@ size_t FilePathWatcherKQueue::EventsForP
+ FilePath::StringType subdir = (i != (components.end() - 1)) ? *(i + 1) : "";
+ EventData* data = new EventData(built_path, subdir);
+ struct kevent event;
++#if defined(__NetBSD__) && __NetBSD_Version__ < 999000000
++ EV_SET(&event, fd, EVFILT_VNODE, (EV_ADD | EV_CLEAR | EV_RECEIPT),
++ (NOTE_DELETE | NOTE_WRITE | NOTE_ATTRIB |
++ NOTE_RENAME | NOTE_REVOKE | NOTE_EXTEND), 0, reinterpret_cast<intptr_t>(data));
++#else
+ EV_SET(&event, fd, EVFILT_VNODE, (EV_ADD | EV_CLEAR | EV_RECEIPT),
+ (NOTE_DELETE | NOTE_WRITE | NOTE_ATTRIB |
+ NOTE_RENAME | NOTE_REVOKE | NOTE_EXTEND), 0, data);
++#endif
+ events->push_back(event);
+ }
+ return last_existing_entry;
diff --git a/electron34/patches/patch-base_files_file__path__watcher__kqueue.h b/electron34/patches/patch-base_files_file__path__watcher__kqueue.h
new file mode 100644
index 0000000000..1d803717e0
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__path__watcher__kqueue.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_path_watcher_kqueue.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_path_watcher_kqueue.h
+@@ -5,6 +5,7 @@
+ #ifndef BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
+ #define BASE_FILES_FILE_PATH_WATCHER_KQUEUE_H_
+
++#include <sys/time.h>
+ #include <sys/event.h>
+
+ #include <memory>
diff --git a/electron34/patches/patch-base_files_file__path__watcher__unittest.cc b/electron34/patches/patch-base_files_file__path__watcher__unittest.cc
new file mode 100644
index 0000000000..78a034b0ca
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__path__watcher__unittest.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_path_watcher_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_path_watcher_unittest.cc
+@@ -902,7 +902,7 @@ TEST_F(FilePathWatcherTest, WatchDirecto
+ }
+ delegate.RunUntilEventsMatch(event_expecter);
+
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(WriteFile(file1, "content v2"));
+ // Mac implementation does not detect files modified in a directory.
+ // TODO(crbug.com/40263777): Expect that no events are fired on Mac.
+@@ -1848,7 +1848,7 @@ namespace {
+
+ enum Permission { Read, Write, Execute };
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ bool ChangeFilePermissions(const FilePath& path, Permission perm, bool allow) {
+ struct stat stat_buf;
+
+@@ -1882,7 +1882,7 @@ bool ChangeFilePermissions(const FilePat
+
+ } // namespace
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) && BUILDFLAG(IS_BSD)
+ // Linux implementation of FilePathWatcher doesn't catch attribute changes.
+ // http://crbug.com/78043
+ // Windows implementation of FilePathWatcher catches attribute changes that
diff --git a/electron34/patches/patch-base_files_file__util__posix.cc b/electron34/patches/patch-base_files_file__util__posix.cc
new file mode 100644
index 0000000000..3510eee35a
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__util__posix.cc
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_util_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_util_posix.cc
+@@ -897,36 +897,33 @@ bool CreateNewTempDirectory(const FilePa
+ bool CreateDirectoryAndGetError(const FilePath& full_path, File::Error* error) {
+ ScopedBlockingCall scoped_blocking_call(
+ FROM_HERE, BlockingType::MAY_BLOCK); // For call to mkdir().
++ const FilePath kFileSystemRoot("/");
+ std::vector<FilePath> subpaths;
+
+ // Collect a list of all parent directories.
+ FilePath last_path = full_path;
+- subpaths.push_back(full_path);
+- for (FilePath path = full_path.DirName(); path.value() != last_path.value();
+- path = path.DirName()) {
++ if (full_path != kFileSystemRoot)
++ subpaths.push_back(full_path);
++ for (FilePath path = full_path.DirName(); (path.value() != last_path.value() &&
++ (path != kFileSystemRoot)); path = path.DirName()) {
+ subpaths.push_back(path);
+ last_path = path;
+ }
+
+ // Iterate through the parents and create the missing ones.
+ for (const FilePath& subpath : base::Reversed(subpaths)) {
+- if (DirectoryExists(subpath)) {
+- continue;
+- }
+- if (mkdir(subpath.value().c_str(), 0700) == 0) {
+- continue;
+- }
+- // Mkdir failed, but it might have failed with EEXIST, or some other error
+- // due to the directory appearing out of thin air. This can occur if
+- // two processes are trying to create the same file system tree at the same
+- // time. Check to see if it exists and make sure it is a directory.
+- int saved_errno = errno;
+- if (!DirectoryExists(subpath)) {
+- if (error) {
+- *error = File::OSErrorToFileError(saved_errno);
++ if (!PathExists(subpath)) {
++ if ((mkdir(subpath.value().c_str(), 0700) == -1) &&
++ ((full_path != subpath) ? (errno != ENOENT) : (-1))) {
++ int saved_errno = errno;
++ if (error)
++ *error = File::OSErrorToFileError(saved_errno);
++ return false;
+ }
+- errno = saved_errno;
+- return false;
++ } else if (!DirectoryExists(subpath)) {
++ if (error)
++ *error = File::OSErrorToFileError(ENOTDIR);
++ return false;
+ }
+ }
+ return true;
diff --git a/electron34/patches/patch-base_files_file__util__unittest.cc b/electron34/patches/patch-base_files_file__util__unittest.cc
new file mode 100644
index 0000000000..a74c8d1085
--- /dev/null
+++ b/electron34/patches/patch-base_files_file__util__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/file_util_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/file_util_unittest.cc
+@@ -3908,7 +3908,7 @@ TEST_F(FileUtilTest, ReadFileToStringWit
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ TEST_F(FileUtilTest, ReadFileToStringWithProcFileSystem) {
+ FilePath file_path("/proc/cpuinfo");
+ std::string data = "temp";
+@@ -4645,7 +4645,7 @@ TEST(FileUtilMultiThreadedTest, MultiThr
+ NULL);
+ #else
+ size_t bytes_written =
+- ::write(::fileno(output_file.get()), content.c_str(), content.length());
++ ::write(fileno(output_file.get()), content.c_str(), content.length());
+ #endif
+ EXPECT_EQ(content.length(), bytes_written);
+ ::fflush(output_file.get());
diff --git a/electron34/patches/patch-base_files_important__file__writer__cleaner.cc b/electron34/patches/patch-base_files_important__file__writer__cleaner.cc
new file mode 100644
index 0000000000..e2054d3cf2
--- /dev/null
+++ b/electron34/patches/patch-base_files_important__file__writer__cleaner.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/important_file_writer_cleaner.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/important_file_writer_cleaner.cc
+@@ -25,7 +25,8 @@ namespace base {
+ namespace {
+
+ base::Time GetUpperBoundTime() {
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++// needed because of .CreationTime() pledge
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // If process creation time is not available then use instance creation
+ // time as the upper-bound for old files. Modification times may be
+ // rounded-down to coarse-grained increments, e.g. FAT has 2s granularity,
diff --git a/electron34/patches/patch-base_files_scoped__file.cc b/electron34/patches/patch-base_files_scoped__file.cc
new file mode 100644
index 0000000000..2e32348882
--- /dev/null
+++ b/electron34/patches/patch-base_files_scoped__file.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/files/scoped_file.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/files/scoped_file.cc
+@@ -32,7 +32,7 @@ void ScopedFDCloseTraits::Free(int fd) {
+ int ret = IGNORE_EINTR(close(fd));
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // NB: Some file descriptors can return errors from close() e.g. network
+ // filesystems such as NFS and Linux input devices. On Linux, macOS, and
+ // Fuchsia's POSIX layer, errors from close other than EBADF do not indicate
diff --git a/electron34/patches/patch-base_functional_callback__helpers.h b/electron34/patches/patch-base_functional_callback__helpers.h
new file mode 100644
index 0000000000..c51263cfee
--- /dev/null
+++ b/electron34/patches/patch-base_functional_callback__helpers.h
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/functional/callback_helpers.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/functional/callback_helpers.h
+@@ -100,6 +100,22 @@ RepeatingCallback<void(Args...)> Forward
+ std::move(v));
+ }
+
++// Wraps the given OnceCallback into a RepeatingCallback that relays its
++// invocation to the original OnceCallback on the first invocation. The
++// following invocations are just ignored.
++//
++// Note that this deliberately subverts the Once/Repeating paradigm of Callbacks
++// but helps ease the migration from old-style Callbacks. Avoid if possible; use
++// if necessary for migration. TODO(tzik): Remove it. https://crbug.com/730593
++template <typename... Args>
++RepeatingCallback<void(Args...)> AdaptCallbackForRepeating(
++ OnceCallback<void(Args...)> callback) {
++ using Helper = internal::OnceCallbackHolder<Args...>;
++ return base::BindRepeating(
++ &Helper::Run, std::make_unique<Helper>(std::move(callback),
++ /*ignore_extra_runs=*/true));
++}
++
+ // Wraps the given OnceCallback and returns two OnceCallbacks with an identical
+ // signature. On first invokation of either returned callbacks, the original
+ // callback is invoked. Invoking the remaining callback results in a crash.
diff --git a/electron34/patches/patch-base_functional_unretained__traits.h b/electron34/patches/patch-base_functional_unretained__traits.h
new file mode 100644
index 0000000000..9bc2803e87
--- /dev/null
+++ b/electron34/patches/patch-base_functional_unretained__traits.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/functional/unretained_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/functional/unretained_traits.h
+@@ -93,7 +93,7 @@ struct SupportsUnretainedImpl {
+ // official builds, and then in non-test code as well.
+ #if defined(FORCE_UNRETAINED_COMPLETENESS_CHECKS_FOR_TESTS) || \
+ (!defined(UNIT_TEST) && !defined(OFFICIAL_BUILD) && \
+- (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)))
++ (BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)))
+ static_assert(v,
+ "Argument requires unretained storage, but type is not "
+ "fully defined. This prevents determining whether "
diff --git a/electron34/patches/patch-base_i18n_icu__util.cc b/electron34/patches/patch-base_i18n_icu__util.cc
new file mode 100644
index 0000000000..0dee05d951
--- /dev/null
+++ b/electron34/patches/patch-base_i18n_icu__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/i18n/icu_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/i18n/icu_util.cc
+@@ -52,7 +52,7 @@
+ #include "third_party/icu/source/common/unicode/unistr.h"
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
+ #include "third_party/icu/source/i18n/unicode/timezone.h"
+ #endif
+@@ -328,7 +328,7 @@ void InitializeIcuTimeZone() {
+ FuchsiaIntlProfileWatcher::GetPrimaryTimeZoneIdForIcuInitialization();
+ icu::TimeZone::adoptDefault(
+ icu::TimeZone::createTimeZone(icu::UnicodeString::fromUTF8(zone_id)));
+-#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#elif BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ // To respond to the time zone change properly, the default time zone
+ // cache in ICU has to be populated on starting up.
+ // See TimeZoneMonitorLinux::NotifyClientsFromImpl().
diff --git a/electron34/patches/patch-base_linux__util.cc b/electron34/patches/patch-base_linux__util.cc
new file mode 100644
index 0000000000..5d55fe442b
--- /dev/null
+++ b/electron34/patches/patch-base_linux__util.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/linux_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/linux_util.cc
+@@ -154,10 +154,14 @@ void SetLinuxDistro(const std::string& d
+ }
+
+ bool GetThreadsForProcess(pid_t pid, std::vector<pid_t>* tids) {
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ // 25 > strlen("/proc//task") + strlen(base::NumberToString(INT_MAX)) + 1 = 22
+ char buf[25];
+ strings::SafeSPrintf(buf, "/proc/%d/task", pid);
+ return GetThreadsFromProcessDir(buf, tids);
++#endif
+ }
+
+ bool GetThreadsForCurrentProcess(std::vector<pid_t>* tids) {
diff --git a/electron34/patches/patch-base_logging__unittest.cc b/electron34/patches/patch-base_logging__unittest.cc
new file mode 100644
index 0000000000..3ef040fde4
--- /dev/null
+++ b/electron34/patches/patch-base_logging__unittest.cc
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/logging_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/logging_unittest.cc
+@@ -41,7 +41,7 @@
+ #include "base/posix/eintr_wrapper.h"
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD)
+ #include <ucontext.h>
+ #endif
+
+@@ -585,14 +585,18 @@ void CheckCrashTestSighandler(int, sigin
+ // need the arch-specific boilerplate below, which is inspired by breakpad.
+ // At the same time, on OSX, ucontext.h is deprecated but si_addr works fine.
+ uintptr_t crash_addr = 0;
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ crash_addr = reinterpret_cast<uintptr_t>(info->si_addr);
+ #else // OS_*
+ ucontext_t* context = reinterpret_cast<ucontext_t*>(context_ptr);
+ #if defined(ARCH_CPU_X86)
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.gregs[REG_EIP]);
+ #elif defined(ARCH_CPU_X86_64)
++#if BUILDFLAG(IS_OPENBSD)
++ crash_addr = static_cast<uintptr_t>(context->sc_rip);
++#else
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.gregs[REG_RIP]);
++#endif
+ #elif defined(ARCH_CPU_ARMEL)
+ crash_addr = static_cast<uintptr_t>(context->uc_mcontext.arm_pc);
+ #elif defined(ARCH_CPU_ARM64)
diff --git a/electron34/patches/patch-base_memory_discardable__memory.cc b/electron34/patches/patch-base_memory_discardable__memory.cc
new file mode 100644
index 0000000000..6f2de0f9e9
--- /dev/null
+++ b/electron34/patches/patch-base_memory_discardable__memory.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/discardable_memory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/discardable_memory.cc
+@@ -26,7 +26,7 @@ BASE_FEATURE(kMadvFreeDiscardableMemory,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kDiscardableMemoryBackingTrial,
+ "DiscardableMemoryBackingTrial",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -39,7 +39,7 @@ BASE_FEATURE(kDiscardableMemoryBackingTr
+
+ namespace {
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ DiscardableMemoryBacking GetBackingForFieldTrial() {
+ DiscardableMemoryTrialGroup trial_group =
+@@ -58,7 +58,7 @@ DiscardableMemoryBacking GetBackingForFi
+
+ } // namespace
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ // Probe capabilities of this device to determine whether we should participate
+ // in the discardable memory backing trial.
+@@ -88,7 +88,7 @@ DiscardableMemory::DiscardableMemory() =
+ DiscardableMemory::~DiscardableMemory() = default;
+
+ DiscardableMemoryBacking GetDiscardableMemoryBacking() {
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (DiscardableMemoryBackingFieldTrialIsEnabled()) {
+ return GetBackingForFieldTrial();
+ }
diff --git a/electron34/patches/patch-base_memory_discardable__memory__internal.h b/electron34/patches/patch-base_memory_discardable__memory__internal.h
new file mode 100644
index 0000000000..e7c467bb44
--- /dev/null
+++ b/electron34/patches/patch-base_memory_discardable__memory__internal.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/discardable_memory_internal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/discardable_memory_internal.h
+@@ -12,7 +12,7 @@
+ #include "base/metrics/field_trial_params.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace base {
+
diff --git a/electron34/patches/patch-base_memory_madv__free__discardable__memory__posix.cc b/electron34/patches/patch-base_memory_madv__free__discardable__memory__posix.cc
new file mode 100644
index 0000000000..f15e1dfe71
--- /dev/null
+++ b/electron34/patches/patch-base_memory_madv__free__discardable__memory__posix.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/madv_free_discardable_memory_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/madv_free_discardable_memory_posix.cc
+@@ -310,6 +310,10 @@ void MadvFreeDiscardableMemoryPosix::Set
+
+ bool MadvFreeDiscardableMemoryPosix::IsResident() const {
+ DFAKE_SCOPED_RECURSIVE_LOCK(thread_collision_warner_);
++// XXX mincore
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ #if BUILDFLAG(IS_APPLE)
+ std::vector<char> vec(allocated_pages_);
+ #else
+@@ -325,6 +329,7 @@ bool MadvFreeDiscardableMemoryPosix::IsR
+ return false;
+ }
+ return true;
++#endif
+ }
+
+ bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const {
diff --git a/electron34/patches/patch-base_memory_platform__shared__memory__region.h b/electron34/patches/patch-base_memory_platform__shared__memory__region.h
new file mode 100644
index 0000000000..f26951338e
--- /dev/null
+++ b/electron34/patches/patch-base_memory_platform__shared__memory__region.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/platform_shared_memory_region.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/platform_shared_memory_region.h
+@@ -18,7 +18,7 @@
+ #include "base/unguessable_token.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ namespace content {
+ class SandboxIPCHandler;
+ }
+@@ -85,7 +85,7 @@ class BASE_EXPORT PlatformSharedMemoryRe
+ kMaxValue = GET_SHMEM_TEMP_DIR_FAILURE
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Structure to limit access to executable region creation.
+ struct ExecutableRegion {
+ private:
+@@ -217,7 +217,7 @@ class BASE_EXPORT PlatformSharedMemoryRe
+ CheckPlatformHandlePermissionsCorrespondToMode);
+ static PlatformSharedMemoryRegion Create(Mode mode,
+ size_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ bool executable = false
+ #endif
diff --git a/electron34/patches/patch-base_memory_platform__shared__memory__region__posix.cc b/electron34/patches/patch-base_memory_platform__shared__memory__region__posix.cc
new file mode 100644
index 0000000000..1008257c78
--- /dev/null
+++ b/electron34/patches/patch-base_memory_platform__shared__memory__region__posix.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/platform_shared_memory_region_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/platform_shared_memory_region_posix.cc
+@@ -55,7 +55,7 @@ bool CheckFDAccessMode(int fd, int expec
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ ScopedFD PlatformSharedMemoryRegion::ExecutableRegion::CreateFD(size_t size) {
+ PlatformSharedMemoryRegion region =
+@@ -168,7 +168,7 @@ bool PlatformSharedMemoryRegion::Convert
+ // static
+ PlatformSharedMemoryRegion PlatformSharedMemoryRegion::Create(Mode mode,
+ size_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ bool executable
+ #endif
+@@ -197,7 +197,7 @@ PlatformSharedMemoryRegion PlatformShare
+ // flag.
+ FilePath directory;
+ if (!GetShmemTempDir(
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ executable,
+ #else
+ false /* executable */,
diff --git a/electron34/patches/patch-base_memory_protected__memory.h b/electron34/patches/patch-base_memory_protected__memory.h
new file mode 100644
index 0000000000..632a07d567
--- /dev/null
+++ b/electron34/patches/patch-base_memory_protected__memory.h
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/protected_memory.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/protected_memory.h
+@@ -120,12 +120,12 @@ __declspec(selectany) char __stop_protec
+
+ #define DECLARE_PROTECTED_DATA constinit
+ #define DEFINE_PROTECTED_DATA constinit __declspec(allocate("prot$mem"))
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // This value is used to align the writers variable. That variable needs to be
+ // aligned to ensure that the protected memory section starts on a page
+ // boundary.
+ #if (PA_BUILDFLAG(IS_ANDROID) && PA_BUILDFLAG(PA_ARCH_CPU_64_BITS)) || \
+- (PA_BUILDFLAG(IS_LINUX) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64))
++ ((PA_BUILDFLAG(IS_LINUX) || PA_BUILDFLAG(IS_BSD)) && PA_BUILDFLAG(PA_ARCH_CPU_ARM64))
+ // arm64 supports 4kb, 16kb, and 64kb pages. Set to the largest of 64kb as that
+ // will guarantee the section is page aligned regardless of the choice.
+ inline constexpr int kProtectedMemoryAlignment = 65536;
+@@ -340,7 +340,7 @@ class BASE_EXPORT AutoWritableMemoryBase
+ // where an attacker could overwrite it with a large value and invoke code
+ // that constructs and destructs an AutoWritableMemory. After such a call
+ // protected memory would still be set writable because writers > 0.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // On Linux, the protected memory section is not automatically page aligned.
+ // This means that attempts to reset the protected memory region to readonly
+ // will set some of the preceding section that is on the same page readonly
+@@ -354,7 +354,7 @@ class BASE_EXPORT AutoWritableMemoryBase
+ #endif
+ static inline size_t writers GUARDED_BY(writers_lock()) = 0;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // On Linux, there is no guarantee the section following the protected
+ // memory section is page aligned. This can result in attempts to change
+ // the access permissions of the end of the protected memory section
+@@ -412,7 +412,7 @@ class BASE_EXPORT AutoWritableMemoryInit
+ // the variable to something large before the section was read-only.
+ WriterData::writers = 0;
+ CHECK(SetProtectedSectionReadOnly());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Set the protected_memory_section_buffer to true to ensure the buffer
+ // section is created. If a variable is declared but not used the memory
+ // section won't be created.
diff --git a/electron34/patches/patch-base_memory_protected__memory__posix.cc b/electron34/patches/patch-base_memory_protected__memory__posix.cc
new file mode 100644
index 0000000000..ddc745c1cc
--- /dev/null
+++ b/electron34/patches/patch-base_memory_protected__memory__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/memory/protected_memory_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/memory/protected_memory_posix.cc
+@@ -6,7 +6,7 @@
+
+ #include <sys/mman.h>
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include <sys/resource.h>
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -34,7 +34,7 @@ bool SetMemory(void* start, void* end, i
+ } // namespace
+
+ namespace internal {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ void CheckMemoryReadOnly(const void* ptr) {
+ const uintptr_t page_start =
+ bits::AlignDown(reinterpret_cast<uintptr_t>(ptr), GetPageSize());
diff --git a/electron34/patches/patch-base_message__loop_message__pump__epoll.cc b/electron34/patches/patch-base_message__loop_message__pump__epoll.cc
new file mode 100644
index 0000000000..65de5af117
--- /dev/null
+++ b/electron34/patches/patch-base_message__loop_message__pump__epoll.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/message_loop/message_pump_epoll.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/message_loop/message_pump_epoll.cc
+@@ -42,7 +42,7 @@ std::atomic_bool g_use_batched_version =
+ std::atomic_bool g_use_poll = false;
+
+ constexpr std::pair<uint32_t, short int> kEpollToPollEvents[] = {
+- {EPOLLIN, POLLIN}, {EPOLLOUT, POLLOUT}, {EPOLLRDHUP, POLLRDHUP},
++ {EPOLLIN, POLLIN}, {EPOLLOUT, POLLOUT},
+ {EPOLLPRI, POLLPRI}, {EPOLLERR, POLLERR}, {EPOLLHUP, POLLHUP}};
+
+ void SetEventsForPoll(const uint32_t epoll_events, struct pollfd* poll_entry) {
diff --git a/electron34/patches/patch-base_message__loop_message__pump__epoll.h b/electron34/patches/patch-base_message__loop_message__pump__epoll.h
new file mode 100644
index 0000000000..a4f4ef07a9
--- /dev/null
+++ b/electron34/patches/patch-base_message__loop_message__pump__epoll.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/message_loop/message_pump_epoll.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/message_loop/message_pump_epoll.h
+@@ -51,7 +51,11 @@ namespace base {
+ // every call, don't do it when we have too many FDs.
+ BASE_FEATURE(kUsePollForMessagePumpEpoll,
+ "UsePollForMessagePumpEpoll",
++#if BUILDFLAG(IS_BSD)
++ base::FEATURE_ENABLED_BY_DEFAULT);
++#else
+ base::FEATURE_DISABLED_BY_DEFAULT);
++#endif
+
+ // A MessagePump implementation suitable for I/O message loops on Linux-based
+ // systems with epoll API support.
diff --git a/electron34/patches/patch-base_message__loop_message__pump__glib.cc b/electron34/patches/patch-base_message__loop_message__pump__glib.cc
new file mode 100644
index 0000000000..0b87cbf0ac
--- /dev/null
+++ b/electron34/patches/patch-base_message__loop_message__pump__glib.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/message_loop/message_pump_glib.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/message_loop/message_pump_glib.cc
+@@ -8,6 +8,15 @@
+ #include <glib.h>
+ #include <math.h>
+
++#if BUILDFLAG(IS_BSD)
++#if BUILDFLAG(IS_NETBSD)
++#include <lwp.h>
++#else
++#include <pthread.h>
++#include <pthread_np.h>
++#endif
++#endif
++
+ #include "base/logging.h"
+ #include "base/memory/raw_ptr.h"
+ #include "base/notreached.h"
+@@ -51,9 +60,19 @@ int GetTimeIntervalMilliseconds(TimeTick
+ }
+
+ bool RunningOnMainThread() {
++#if BUILDFLAG(IS_BSD)
++#if BUILDFLAG(IS_NETBSD)
++ auto pid = getpid();
++ auto tid = _lwp_self();
++ return pid > 0 && tid > 0 && pid == tid;
++#else
++ return pthread_main_np();
++#endif
++#else
+ auto pid = getpid();
+ auto tid = PlatformThread::CurrentId();
+ return pid > 0 && tid > 0 && pid == tid;
++#endif
+ }
+
+ // A brief refresher on GLib:
diff --git a/electron34/patches/patch-base_native__library__posix.cc b/electron34/patches/patch-base_native__library__posix.cc
new file mode 100644
index 0000000000..c912b82228
--- /dev/null
+++ b/electron34/patches/patch-base_native__library__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/native_library_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/native_library_posix.cc
+@@ -34,7 +34,7 @@ NativeLibrary LoadNativeLibraryWithOptio
+ // http://crbug.com/17943, http://crbug.com/17557, http://crbug.com/36892,
+ // and http://crbug.com/40794.
+ int flags = RTLD_LAZY;
+-#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND)
++#if BUILDFLAG(IS_ANDROID) || !defined(RTLD_DEEPBIND) || BUILDFLAG(IS_BSD)
+ // Certain platforms don't define RTLD_DEEPBIND. Android dlopen() requires
+ // further investigation, as it might vary across versions. Crash here to
+ // warn developers that they're trying to rely on uncertain behavior.
diff --git a/electron34/patches/patch-base_native__library__unittest.cc b/electron34/patches/patch-base_native__library__unittest.cc
new file mode 100644
index 0000000000..84183589c2
--- /dev/null
+++ b/electron34/patches/patch-base_native__library__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/native_library_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/native_library_unittest.cc
+@@ -135,7 +135,7 @@ TEST(NativeLibraryTest, LoadLibrary) {
+ // versions with respect to symbol resolution scope.
+ // TSan and MSan error out on RTLD_DEEPBIND, https://crbug.com/705255
+ #if !BUILDFLAG(IS_ANDROID) && !defined(THREAD_SANITIZER) && \
+- !defined(MEMORY_SANITIZER)
++ !defined(MEMORY_SANITIZER) && !BUILDFLAG(IS_BSD)
+
+ // Verifies that the |prefer_own_symbols| option satisfies its guarantee that
+ // a loaded library will always prefer local symbol resolution before
diff --git a/electron34/patches/patch-base_posix_can__lower__nice__to.cc b/electron34/patches/patch-base_posix_can__lower__nice__to.cc
new file mode 100644
index 0000000000..bf2d0754ea
--- /dev/null
+++ b/electron34/patches/patch-base_posix_can__lower__nice__to.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/posix/can_lower_nice_to.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/posix/can_lower_nice_to.cc
+@@ -11,8 +11,12 @@
+
+ #include "build/build_config.h"
+
++#if BUILDFLAG(IS_FREEBSD)
++#include <sys/param.h>
++#endif
++
+ // Not defined on AIX by default.
+-#if BUILDFLAG(IS_AIX)
++#if BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ #if defined(RLIMIT_NICE)
+ #error Assumption about OS_AIX is incorrect
+ #endif
diff --git a/electron34/patches/patch-base_posix_file__descriptor__shuffle.h b/electron34/patches/patch-base_posix_file__descriptor__shuffle.h
new file mode 100644
index 0000000000..d9cd229668
--- /dev/null
+++ b/electron34/patches/patch-base_posix_file__descriptor__shuffle.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/posix/file_descriptor_shuffle.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/posix/file_descriptor_shuffle.h
+@@ -26,6 +26,8 @@
+ #include "base/base_export.h"
+ #include "base/compiler_specific.h"
+
++#undef close
++
+ namespace base {
+
+ // A Delegate which performs the actions required to perform an injective
diff --git a/electron34/patches/patch-base_posix_sysctl.cc b/electron34/patches/patch-base_posix_sysctl.cc
new file mode 100644
index 0000000000..036c9bf663
--- /dev/null
+++ b/electron34/patches/patch-base_posix_sysctl.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/posix/sysctl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/posix/sysctl.cc
+@@ -4,6 +4,7 @@
+
+ #include "base/posix/sysctl.h"
+
++#include <sys/types.h>
+ #include <sys/sysctl.h>
+
+ #include <initializer_list>
+@@ -16,17 +17,17 @@
+ #include "build/build_config.h"
+
+ namespace {
+-
++// NetBSD has sysctl_func macro in sys/sysctl.h, workaround: sysctl_func -> sysctl_func2
+ std::optional<std::string> StringSysctlImpl(
+- base::FunctionRef<int(char* /*out*/, size_t* /*out_len*/)> sysctl_func) {
++ base::FunctionRef<int(char* /*out*/, size_t* /*out_len*/)> sysctl_func2) {
+ size_t buf_len;
+- int result = sysctl_func(nullptr, &buf_len);
++ int result = sysctl_func2(nullptr, &buf_len);
+ if (result < 0 || buf_len < 1) {
+ return std::nullopt;
+ }
+
+ std::string value(buf_len - 1, '\0');
+- result = sysctl_func(&value[0], &buf_len);
++ result = sysctl_func2(&value[0], &buf_len);
+ if (result < 0) {
+ return std::nullopt;
+ }
diff --git a/electron34/patches/patch-base_posix_unix__domain__socket.cc b/electron34/patches/patch-base_posix_unix__domain__socket.cc
new file mode 100644
index 0000000000..f029a1737b
--- /dev/null
+++ b/electron34/patches/patch-base_posix_unix__domain__socket.cc
@@ -0,0 +1,63 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/posix/unix_domain_socket.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/posix/unix_domain_socket.cc
+@@ -56,7 +56,7 @@ bool CreateSocketPair(ScopedFD* one, Sco
+
+ // static
+ bool UnixDomainSocket::EnableReceiveProcessId(int fd) {
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ const int enable = 1;
+ return setsockopt(fd, SOL_SOCKET, SO_PASSCRED, &enable, sizeof(enable)) == 0;
+ #else
+@@ -82,7 +82,7 @@ bool UnixDomainSocket::SendMsg(int fd,
+
+ struct cmsghdr* cmsg;
+ msg.msg_control = control_buffer;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ msg.msg_controllen = checked_cast<socklen_t>(control_len);
+ #else
+ msg.msg_controllen = control_len;
+@@ -90,7 +90,7 @@ bool UnixDomainSocket::SendMsg(int fd,
+ cmsg = CMSG_FIRSTHDR(&msg);
+ cmsg->cmsg_level = SOL_SOCKET;
+ cmsg->cmsg_type = SCM_RIGHTS;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ cmsg->cmsg_len = checked_cast<u_int>(CMSG_LEN(sizeof(int) * fds.size()));
+ #else
+ cmsg->cmsg_len = CMSG_LEN(sizeof(int) * fds.size());
+@@ -154,7 +154,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
+
+ const size_t kControlBufferSize =
+ CMSG_SPACE(sizeof(int) * kMaxFileDescriptors)
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ // macOS does not support ucred.
+ // macOS supports xucred, but this structure is insufficient.
+ + CMSG_SPACE(sizeof(struct ucred))
+@@ -182,7 +182,7 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
+ wire_fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
+ wire_fds_len = payload_len / sizeof(int);
+ }
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ // macOS does not support SCM_CREDENTIALS.
+ if (cmsg->cmsg_level == SOL_SOCKET &&
+ cmsg->cmsg_type == SCM_CREDENTIALS) {
+@@ -216,6 +216,9 @@ ssize_t UnixDomainSocket::RecvMsgWithFla
+ socklen_t pid_size = sizeof(pid);
+ if (getsockopt(fd, SOL_LOCAL, LOCAL_PEERPID, &pid, &pid_size) != 0)
+ pid = -1;
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ pid = -1;
+ #else
+ // |pid| will legitimately be -1 if we read EOF, so only DCHECK if we
+ // actually received a message. Unfortunately, Linux allows sending zero
diff --git a/electron34/patches/patch-base_posix_unix__domain__socket__unittest.cc b/electron34/patches/patch-base_posix_unix__domain__socket__unittest.cc
new file mode 100644
index 0000000000..80e3038250
--- /dev/null
+++ b/electron34/patches/patch-base_posix_unix__domain__socket__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/posix/unix_domain_socket_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/posix/unix_domain_socket_unittest.cc
+@@ -15,6 +15,8 @@
+ #include <sys/types.h>
+ #include <unistd.h>
+
++#include <signal.h>
++
+ #include "base/files/file_util.h"
+ #include "base/files/scoped_file.h"
+ #include "base/functional/bind.h"
diff --git a/electron34/patches/patch-base_process_internal__linux.h b/electron34/patches/patch-base_process_internal__linux.h
new file mode 100644
index 0000000000..496243f290
--- /dev/null
+++ b/electron34/patches/patch-base_process_internal__linux.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/internal_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/internal_linux.h
+@@ -140,6 +140,9 @@ TimeDelta ClockTicksToTimeDelta(int64_t
+ // arguments to the lambda.
+ template <typename Lambda>
+ void ForEachProcessTask(base::ProcessHandle process, Lambda&& lambda) {
++#if BUILDFLAG(IS_BSD)
++ return;
++#else
+ // Iterate through the different threads tracked in /proc/<pid>/task.
+ FilePath fd_path = GetProcPidDir(process).Append("task");
+
+@@ -159,6 +162,7 @@ void ForEachProcessTask(base::ProcessHan
+ FilePath task_path = fd_path.Append(tid_str);
+ lambda(tid, task_path);
+ }
++#endif
+ }
+
+ } // namespace internal
diff --git a/electron34/patches/patch-base_process_kill.h b/electron34/patches/patch-base_process_kill.h
new file mode 100644
index 0000000000..ea0e8a5677
--- /dev/null
+++ b/electron34/patches/patch-base_process_kill.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/kill.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/kill.h
+@@ -123,7 +123,7 @@ BASE_EXPORT TerminationStatus GetTermina
+ BASE_EXPORT TerminationStatus GetKnownDeadTerminationStatus(
+ ProcessHandle handle, int* exit_code);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Spawns a thread to wait asynchronously for the child |process| to exit
+ // and then reaps it.
+ BASE_EXPORT void EnsureProcessGetsReaped(Process process);
diff --git a/electron34/patches/patch-base_process_kill__posix.cc b/electron34/patches/patch-base_process_kill__posix.cc
new file mode 100644
index 0000000000..b1912bc24c
--- /dev/null
+++ b/electron34/patches/patch-base_process_kill__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/kill_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/kill_posix.cc
+@@ -157,7 +157,7 @@ void EnsureProcessTerminated(Process pro
+ 0, new BackgroundReaper(std::move(process), Seconds(2)));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void EnsureProcessGetsReaped(Process process) {
+ DCHECK(!process.is_current());
+
diff --git a/electron34/patches/patch-base_process_launch.h b/electron34/patches/patch-base_process_launch.h
new file mode 100644
index 0000000000..42074bf877
--- /dev/null
+++ b/electron34/patches/patch-base_process_launch.h
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/launch.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/launch.h
+@@ -7,6 +7,13 @@
+ #ifndef BASE_PROCESS_LAUNCH_H_
+ #define BASE_PROCESS_LAUNCH_H_
+
++#if defined(__NetBSD__)
++#define _NETBSD_SOURCE 1
++#ifndef PTHREAD_STACK_MIN
++#define PTHREAD_STACK_MIN 4096
++#endif
++#endif
++
+ #include <limits.h>
+ #include <stddef.h>
+
+@@ -241,7 +248,7 @@ struct BASE_EXPORT LaunchOptions {
+ bool clear_environment = false;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // If non-zero, start the process using clone(), using flags as provided.
+ // Unlike in clone, clone_flags may not contain a custom termination signal
+ // that is sent to the parent when the child dies. The termination signal will
diff --git a/electron34/patches/patch-base_process_launch__mac.cc b/electron34/patches/patch-base_process_launch__mac.cc
new file mode 100644
index 0000000000..fd301c6c15
--- /dev/null
+++ b/electron34/patches/patch-base_process_launch__mac.cc
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/launch_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/launch_mac.cc
+@@ -21,13 +21,19 @@
+ #include "base/threading/scoped_blocking_call.h"
+ #include "base/threading/thread_restrictions.h"
+ #include "base/trace_event/base_tracing.h"
++#include "electron/mas.h"
++#if IS_MAS_BUILD()
++#include <sys/syscall.h>
++#endif
+
+ extern "C" {
+ // Changes the current thread's directory to a path or directory file
+ // descriptor.
++#if !IS_MAS_BUILD()
+ int pthread_chdir_np(const char* dir);
+
+ int pthread_fchdir_np(int fd);
++#endif
+
+ int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs,
+ int disclaim);
+@@ -104,13 +110,27 @@ class PosixSpawnFileActions {
+
+ #if !BUILDFLAG(IS_MAC)
+ int ChangeCurrentThreadDirectory(const char* path) {
++#if IS_MAS_BUILD()
++ #pragma clang diagnostic push
++ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
++ return syscall(SYS___pthread_chdir, path);
++ #pragma clang diagnostic pop
++#else
+ return pthread_chdir_np(path);
++#endif
+ }
+
+ // The recommended way to unset a per-thread cwd is to set a new value to an
+ // invalid file descriptor, per libpthread-218.1.3/private/private.h.
+ int ResetCurrentThreadDirectory() {
++#if IS_MAS_BUILD()
++ #pragma clang diagnostic push
++ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
++ return syscall(SYS___pthread_fchdir, -1);
++ #pragma clang diagnostic pop
++#else
+ return pthread_fchdir_np(-1);
++#endif
+ }
+ #endif
+
+@@ -234,7 +254,7 @@ Process LaunchProcess(const std::vector<
+ file_actions.Inherit(STDERR_FILENO);
+ }
+
+-#if BUILDFLAG(IS_MAC)
++#if 0
+ if (options.disclaim_responsibility) {
+ DPSXCHECK(responsibility_spawnattrs_setdisclaim(attr.get(), 1));
+ }
diff --git a/electron34/patches/patch-base_process_launch__posix.cc b/electron34/patches/patch-base_process_launch__posix.cc
new file mode 100644
index 0000000000..407ad14dcd
--- /dev/null
+++ b/electron34/patches/patch-base_process_launch__posix.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/launch_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/launch_posix.cc
+@@ -67,6 +67,9 @@
+ #error "macOS should use launch_mac.cc"
+ #endif
+
++#if defined(OS_FREEBSD)
++#pragma weak environ
++#endif
+ extern char** environ;
+
+ namespace base {
+@@ -223,6 +226,8 @@ static const char kFDDir[] = "/dev/fd";
+ static const char kFDDir[] = "/dev/fd";
+ #elif BUILDFLAG(IS_OPENBSD)
+ static const char kFDDir[] = "/dev/fd";
++#elif BUILDFLAG(IS_NETBSD)
++static const char kFDDir[] = "/dev/fd";
+ #elif BUILDFLAG(IS_ANDROID)
+ static const char kFDDir[] = "/proc/self/fd";
+ #endif
diff --git a/electron34/patches/patch-base_process_memory__linux.cc b/electron34/patches/patch-base_process_memory__linux.cc
new file mode 100644
index 0000000000..8aba0354e3
--- /dev/null
+++ b/electron34/patches/patch-base_process_memory__linux.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/memory_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/memory_linux.cc
+@@ -28,6 +28,7 @@ void __libc_free(void*);
+
+ namespace base {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ void ReleaseReservationOrTerminate() {
+@@ -37,12 +38,14 @@ void ReleaseReservationOrTerminate() {
+ }
+
+ } // namespace
++#endif
+
+ void EnableTerminationOnHeapCorruption() {
+ // On Linux, there nothing to do AFAIK.
+ }
+
+ void EnableTerminationOnOutOfMemory() {
++#if !BUILDFLAG(IS_BSD)
+ // Set the new-out of memory handler.
+ std::set_new_handler(&ReleaseReservationOrTerminate);
+ // If we're using glibc's allocator, the above functions will override
+@@ -51,8 +54,10 @@ void EnableTerminationOnOutOfMemory() {
+ #if PA_BUILDFLAG(USE_ALLOCATOR_SHIM)
+ allocator_shim::SetCallNewHandlerOnMallocFailure(true);
+ #endif
++#endif
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // ScopedAllowBlocking() has private constructor and it can only be used in
+ // friend classes/functions. Declaring a class is easier in this situation to
+ // avoid adding more dependency to thread_restrictions.h because of the
+@@ -110,6 +115,7 @@ bool AdjustOOMScoreHelper::AdjustOOMScor
+ bool AdjustOOMScore(ProcessId process, int score) {
+ return AdjustOOMScoreHelper::AdjustOOMScore(process, score);
+ }
++#endif
+
+ bool UncheckedMalloc(size_t size, void** result) {
+ #if PA_BUILDFLAG(USE_ALLOCATOR_SHIM)
diff --git a/electron34/patches/patch-base_process_process__handle.cc b/electron34/patches/patch-base_process_process__handle.cc
new file mode 100644
index 0000000000..29f57acd6c
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__handle.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_handle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_handle.cc
+@@ -30,7 +30,7 @@ UniqueProcId GetUniqueIdForProcess() {
+ : UniqueProcId(GetCurrentProcId());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+
+ void InitUniqueIdForProcessInPidNamespace(ProcessId pid_outside_of_namespace) {
+ DCHECK(pid_outside_of_namespace != kNullProcessId);
diff --git a/electron34/patches/patch-base_process_process__handle.h b/electron34/patches/patch-base_process_process__handle.h
new file mode 100644
index 0000000000..be55039d13
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__handle.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_handle.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_handle.h
+@@ -86,7 +86,7 @@ BASE_EXPORT ProcessId GetCurrentProcId()
+ // processes may be reused.
+ BASE_EXPORT UniqueProcId GetUniqueIdForProcess();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // When a process is started in a different PID namespace from the browser
+ // process, this function must be called with the process's PID in the browser's
+ // PID namespace in order to initialize its unique ID. Not thread safe.
diff --git a/electron34/patches/patch-base_process_process__handle__freebsd.cc b/electron34/patches/patch-base_process_process__handle__freebsd.cc
new file mode 100644
index 0000000000..f87b43803b
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__handle__freebsd.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_handle_freebsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_handle_freebsd.cc
+@@ -3,6 +3,7 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_handle.h"
++#include "base/files/file_util.h"
+
+ #include <limits.h>
+ #include <stddef.h>
+@@ -20,12 +21,15 @@ namespace base {
+
+ ProcessId GetParentProcessId(ProcessHandle process) {
+ struct kinfo_proc info;
+- size_t length;
++ size_t length = sizeof(struct kinfo_proc);
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process };
+
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+ return -1;
+
++ if (length < sizeof(struct kinfo_proc))
++ return -1;
++
+ return info.ki_ppid;
+ }
+
diff --git a/electron34/patches/patch-base_process_process__handle__netbsd.cc b/electron34/patches/patch-base_process_process__handle__netbsd.cc
new file mode 100644
index 0000000000..459eba7aec
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__handle__netbsd.cc
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_handle_netbsd.cc.orig 2025-05-24 17:57:53.353682363 +0000
++++ base/process/process_handle_netbsd.cc
+@@ -0,0 +1,55 @@
++// Copyright 2011 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/process/process_handle.h"
++#include "base/files/file_util.h"
++
++#include <stddef.h>
++#include <sys/param.h>
++#include <sys/proc.h>
++#include <sys/sysctl.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include <optional>
++
++#include "base/files/file_path.h"
++#include "base/posix/sysctl.h"
++
++namespace base {
++
++ProcessId GetParentProcessId(ProcessHandle process) {
++ struct kinfo_proc2 *info;
++ size_t length;
++ pid_t ppid;
++ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, process,
++ sizeof(struct kinfo_proc2), 1 };
++
++ if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
++ return -1;
++
++ info = (struct kinfo_proc2 *)malloc(length);
++
++ mib[5] = static_cast<int>((length / sizeof(struct kinfo_proc2)));
++
++ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) {
++ ppid = -1;
++ goto out;
++ }
++
++ ppid = info->p_ppid;
++
++out:
++ free(info);
++ return ppid;
++}
++
++FilePath GetProcessExecutablePath(ProcessHandle process) {
++ std::optional<std::string> pathname =
++ base::StringSysctl({CTL_KERN, KERN_PROC_ARGS, process, KERN_PROC_PATHNAME});
++
++ return FilePath(pathname.value_or(std::string{}));
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_process_process__handle__openbsd.cc b/electron34/patches/patch-base_process_process__handle__openbsd.cc
new file mode 100644
index 0000000000..d214139775
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__handle__openbsd.cc
@@ -0,0 +1,140 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_handle_openbsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_handle_openbsd.cc
+@@ -3,48 +3,112 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_handle.h"
++#include "base/files/file_util.h"
+
+ #include <stddef.h>
++#include <stdlib.h>
++#include <sys/param.h>
++#include <sys/proc.h>
++#include <sys/stat.h>
+ #include <sys/sysctl.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+
++#include <kvm.h>
++
+ namespace base {
+
+ ProcessId GetParentProcessId(ProcessHandle process) {
+- struct kinfo_proc info;
++ struct kinfo_proc *info;
+ size_t length;
++ pid_t ppid;
+ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
+ sizeof(struct kinfo_proc), 0 };
+
+ if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0)
+ return -1;
+
+- mib[5] = (length / sizeof(struct kinfo_proc));
++ info = (struct kinfo_proc *)malloc(length);
+
+- if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+- return -1;
++ mib[5] = static_cast<int>((length / sizeof(struct kinfo_proc)));
++
++ if (sysctl(mib, std::size(mib), info, &length, NULL, 0) < 0) {
++ ppid = -1;
++ goto out;
++ }
++
++ ppid = info->p_ppid;
+
+- return info.p_ppid;
++out:
++ free(info);
++ return ppid;
+ }
+
+ FilePath GetProcessExecutablePath(ProcessHandle process) {
+- struct kinfo_proc kp;
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ char errbuf[_POSIX2_LINE_MAX];
++ char **retvalargs, *cpath, retval[PATH_MAX];
++ int cnt;
+ size_t len;
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process,
+- sizeof(struct kinfo_proc), 0 };
+-
+- if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) == -1)
+- return FilePath();
+- mib[5] = (len / sizeof(struct kinfo_proc));
+- if (sysctl(mib, std::size(mib), &kp, &len, NULL, 0) < 0)
+- return FilePath();
+- if ((kp.p_flag & P_SYSTEM) != 0)
+- return FilePath();
+- if (strcmp(kp.p_comm, "chrome") == 0)
+- return FilePath(kp.p_comm);
++ char *tokens[2];
++ struct stat sb;
++ FilePath result;
++
++ int mib[] = { CTL_KERN, KERN_PROC_ARGS, process, KERN_PROC_ARGV };
++
++ if ((cpath = getenv("CHROME_EXE_PATH")) != NULL)
++ result = FilePath(cpath);
++ else
++ result = FilePath("@PREFIX@/lib/@PKGBASE@/electron");
++
++ if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) != -1) {
++ retvalargs = static_cast<char**>(malloc(len));
++ if (!retvalargs)
++ return result;
++
++ if (sysctl(mib, std::size(mib), retvalargs, &len, NULL, 0) < 0) {
++ free(retvalargs);
++ return result;
++ }
++
++ if ((*tokens = strtok(retvalargs[0], ":")) == NULL) {
++ free(retvalargs);
++ return result;
++ }
++
++ free(retvalargs);
++
++ if (tokens[0] == NULL)
++ return result;
++
++ if (realpath(tokens[0], retval) == NULL)
++ return result;
++
++ if (stat(retval, &sb) < 0)
++ return result;
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, (int)KVM_NO_FILES,
++ errbuf)) == NULL)
++ return result;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process,
++ sizeof(struct kinfo_file), &cnt)) == NULL) {
++ kvm_close(kd);
++ return result;
++ }
++
++ for (int i = 0; i < cnt; i++) {
++ if (files[i].fd_fd == KERN_FILE_TEXT &&
++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
++ files[i].va_fileid == sb.st_ino) {
++ kvm_close(kd);
++ result = FilePath(retval);
++ }
++ }
++ }
+
+- return FilePath();
++ return result;
+ }
+
+ } // namespace base
diff --git a/electron34/patches/patch-base_process_process__info__mac.cc b/electron34/patches/patch-base_process_process__info__mac.cc
new file mode 100644
index 0000000000..c91bfa77a1
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__info__mac.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_info_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_info_mac.cc
+@@ -4,19 +4,27 @@
+
+ #include "base/process/process_info.h"
+
++#include "electron/mas.h"
++
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ pid_t responsibility_get_pid_responsible_for_pid(pid_t);
+ }
++#endif
+
+ namespace base {
+
+ bool IsProcessSelfResponsible() {
++#if !IS_MAS_BUILD()
+ const pid_t pid = getpid();
+ return responsibility_get_pid_responsible_for_pid(pid) == pid;
++#else
++ return true;
++#endif
+ }
+
+ } // namespace base
diff --git a/electron34/patches/patch-base_process_process__iterator.h b/electron34/patches/patch-base_process_process__iterator.h
new file mode 100644
index 0000000000..20a7505aca
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__iterator.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_iterator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_iterator.h
+@@ -25,7 +25,7 @@
+ #include <windows.h>
+
+ #include <tlhelp32.h>
+-#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
+ #include <sys/sysctl.h>
+ #elif BUILDFLAG(IS_FREEBSD)
+ #include <sys/user.h>
+@@ -117,7 +117,11 @@ class BASE_EXPORT ProcessIterator {
+ HANDLE snapshot_;
+ bool started_iteration_ = false;
+ #elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
++# if BUILDFLAG(IS_NETBSD)
++ std::vector<kinfo_proc2> kinfo_procs_;
++# else
+ std::vector<kinfo_proc> kinfo_procs_;
++# endif
+ size_t index_of_kinfo_proc_ = 0;
+ #elif BUILDFLAG(IS_POSIX)
+ struct DIRClose {
diff --git a/electron34/patches/patch-base_process_process__iterator__freebsd.cc b/electron34/patches/patch-base_process_process__iterator__freebsd.cc
new file mode 100644
index 0000000000..f90ab9404a
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__iterator__freebsd.cc
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_iterator_freebsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_iterator_freebsd.cc
+@@ -18,7 +18,7 @@ namespace base {
+
+ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
+ : filter_(filter) {
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid() };
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, (int) getuid() };
+
+ bool done = false;
+ int try_num = 1;
+@@ -37,7 +37,7 @@ ProcessIterator::ProcessIterator(const P
+ num_of_kinfo_proc += 16;
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ len = num_of_kinfo_proc * sizeof(struct kinfo_proc);
+- if (sysctl(mib, std::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
++ if (sysctl(mib, std::size(mib), kinfo_procs_.data(), &len, NULL, 0) < 0) {
+ // If we get a mem error, it just means we need a bigger buffer, so
+ // loop around again. Anything else is a real error and give up.
+ if (errno != ENOMEM) {
+@@ -47,7 +47,7 @@ ProcessIterator::ProcessIterator(const P
+ }
+ } else {
+ // Got the list, just make sure we're sized exactly right
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ done = true;
+ }
+@@ -68,18 +68,13 @@ bool ProcessIterator::CheckForNextProces
+ for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
+ size_t length;
+ struct kinfo_proc kinfo = kinfo_procs_[index_of_kinfo_proc_];
+- int mib[] = { CTL_KERN, KERN_PROC_ARGS, kinfo.ki_pid };
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_ARGS, kinfo.ki_pid };
+
+ if ((kinfo.ki_pid > 0) && (kinfo.ki_stat == SZOMB))
+ continue;
+
+- length = 0;
+- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) {
+- LOG(ERROR) << "failed to figure out the buffer size for a command line";
+- continue;
+- }
+-
+- data.resize(length);
++ data.resize(ARG_MAX);
++ length = ARG_MAX;
+
+ if (sysctl(mib, std::size(mib), &data[0], &length, NULL, 0) < 0) {
+ LOG(ERROR) << "failed to fetch a commandline";
diff --git a/electron34/patches/patch-base_process_process__iterator__netbsd.cc b/electron34/patches/patch-base_process_process__iterator__netbsd.cc
new file mode 100644
index 0000000000..7392c4db28
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__iterator__netbsd.cc
@@ -0,0 +1,141 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_iterator_netbsd.cc.orig 2025-05-24 17:57:53.354290524 +0000
++++ base/process/process_iterator_netbsd.cc
+@@ -0,0 +1,132 @@
++// Copyright 2013 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/process/process_iterator.h"
++
++#include <errno.h>
++#include <stddef.h>
++#include <unistd.h>
++#include <sys/param.h>
++#include <sys/proc.h>
++#include <sys/sysctl.h>
++
++#include "base/logging.h"
++#include "base/strings/string_split.h"
++#include "base/strings/string_util.h"
++
++namespace base {
++
++ProcessIterator::ProcessIterator(const ProcessFilter* filter)
++ : filter_(filter) {
++ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_UID, static_cast<int>(getuid()),
++ sizeof(struct kinfo_proc2), 1 };
++
++ bool done = false;
++ int try_num = 1;
++ const int max_tries = 10;
++ size_t num_of_kinfo_proc;
++
++ do {
++ size_t len = 0;
++ if (sysctl(mib, std::size(mib), NULL, &len, NULL, 0) < 0) {
++ DLOG(ERROR) << "failed to get the size needed for the process list";
++ kinfo_procs_.resize(0);
++ done = true;
++ } else {
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc2);
++ // Leave some spare room for process table growth (more could show up
++ // between when we check and now)
++ num_of_kinfo_proc += 16;
++ kinfo_procs_.resize(num_of_kinfo_proc);
++ len = num_of_kinfo_proc * sizeof(struct kinfo_proc2);
++ if (sysctl(mib, std::size(mib), &kinfo_procs_[0], &len, NULL, 0) < 0) {
++ // If we get a mem error, it just means we need a bigger buffer, so
++ // loop around again. Anything else is a real error and give up.
++ if (errno != ENOMEM) {
++ DLOG(ERROR) << "failed to get the process list";
++ kinfo_procs_.resize(0);
++ done = true;
++ }
++ } else {
++ // Got the list, just make sure we're sized exactly right
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc2);
++ kinfo_procs_.resize(num_of_kinfo_proc);
++ done = true;
++ }
++ }
++ } while (!done && (try_num++ < max_tries));
++
++ if (!done) {
++ DLOG(ERROR) << "failed to collect the process list in a few tries";
++ kinfo_procs_.resize(0);
++ }
++}
++
++ProcessIterator::~ProcessIterator() = default;
++
++bool ProcessIterator::CheckForNextProcess() {
++ std::string data;
++ for (; index_of_kinfo_proc_ < kinfo_procs_.size(); ++index_of_kinfo_proc_) {
++ kinfo_proc2& kinfo = kinfo_procs_[index_of_kinfo_proc_];
++
++ // Skip processes just awaiting collection
++ if ((kinfo.p_pid > 0) && (kinfo.p_stat == SZOMB))
++ continue;
++
++ int mib[] = { CTL_KERN, KERN_PROC_ARGS, kinfo.p_pid };
++
++ // Find out what size buffer we need.
++ size_t data_len = 0;
++ if (sysctl(mib, std::size(mib), NULL, &data_len, NULL, 0) < 0) {
++ DVPLOG(1) << "failed to figure out the buffer size for a commandline";
++ continue;
++ }
++
++ data.resize(data_len);
++ if (sysctl(mib, std::size(mib), &data[0], &data_len, NULL, 0) < 0) {
++ DVPLOG(1) << "failed to fetch a commandline";
++ continue;
++ }
++
++ // |data| contains all the command line parameters of the process, separated
++ // by blocks of one or more null characters. We tokenize |data| into a
++ // vector of strings using '\0' as a delimiter and populate
++ // |entry_.cmd_line_args_|.
++ std::string delimiters;
++ delimiters.push_back('\0');
++ entry_.cmd_line_args_ = SplitString(data, delimiters, KEEP_WHITESPACE,
++ SPLIT_WANT_NONEMPTY);
++
++ // |data| starts with the full executable path followed by a null character.
++ // We search for the first instance of '\0' and extract everything before it
++ // to populate |entry_.exe_file_|.
++ size_t exec_name_end = data.find('\0');
++ if (exec_name_end == std::string::npos) {
++ DLOG(ERROR) << "command line data didn't match expected format";
++ continue;
++ }
++
++ entry_.pid_ = kinfo.p_pid;
++ entry_.ppid_ = kinfo.p_ppid;
++ entry_.gid_ = kinfo.p__pgid;
++ size_t last_slash = data.rfind('/', exec_name_end);
++ if (last_slash == std::string::npos)
++ entry_.exe_file_.assign(data, 0, exec_name_end);
++ else
++ entry_.exe_file_.assign(data, last_slash + 1,
++ exec_name_end - last_slash - 1);
++ // Start w/ the next entry next time through
++ ++index_of_kinfo_proc_;
++ // Done
++ return true;
++ }
++ return false;
++}
++
++bool NamedProcessIterator::IncludeEntry() {
++ return (executable_name_ == entry().exe_file() &&
++ ProcessIterator::IncludeEntry());
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_process_process__iterator__openbsd.cc b/electron34/patches/patch-base_process_process__iterator__openbsd.cc
new file mode 100644
index 0000000000..77e4b11fed
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__iterator__openbsd.cc
@@ -0,0 +1,51 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_iterator_openbsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_iterator_openbsd.cc
+@@ -6,6 +6,9 @@
+
+ #include <errno.h>
+ #include <stddef.h>
++#include <unistd.h>
++#include <sys/param.h>
++#include <sys/proc.h>
+ #include <sys/sysctl.h>
+
+ #include "base/logging.h"
+@@ -16,12 +19,13 @@ namespace base {
+
+ ProcessIterator::ProcessIterator(const ProcessFilter* filter)
+ : filter_(filter) {
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, getuid(),
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_UID, static_cast<int>(getuid()),
+ sizeof(struct kinfo_proc), 0 };
+
+ bool done = false;
+ int try_num = 1;
+ const int max_tries = 10;
++ size_t num_of_kinfo_proc;
+
+ do {
+ size_t len = 0;
+@@ -30,7 +34,7 @@ ProcessIterator::ProcessIterator(const P
+ kinfo_procs_.resize(0);
+ done = true;
+ } else {
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ // Leave some spare room for process table growth (more could show up
+ // between when we check and now)
+ num_of_kinfo_proc += 16;
+@@ -46,7 +50,7 @@ ProcessIterator::ProcessIterator(const P
+ }
+ } else {
+ // Got the list, just make sure we're sized exactly right
+- size_t num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
++ num_of_kinfo_proc = len / sizeof(struct kinfo_proc);
+ kinfo_procs_.resize(num_of_kinfo_proc);
+ done = true;
+ }
diff --git a/electron34/patches/patch-base_process_process__metrics.cc b/electron34/patches/patch-base_process_process__metrics.cc
new file mode 100644
index 0000000000..39fd4d4b30
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics.cc
@@ -0,0 +1,55 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics.cc
+@@ -17,7 +17,7 @@ namespace base {
+ namespace {
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int CalculateEventsPerSecond(uint64_t event_count,
+ uint64_t* last_event_count,
+ base::TimeTicks* last_calculated) {
+@@ -54,7 +54,7 @@ SystemMetrics SystemMetrics::Sample() {
+ SystemMetrics system_metrics;
+
+ system_metrics.committed_memory_ = GetSystemCommitCharge();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ GetSystemMemoryInfo(&system_metrics.memory_info_);
+ GetVmStatInfo(&system_metrics.vmstat_info_);
+ GetSystemDiskInfo(&system_metrics.disk_info_);
+@@ -73,7 +73,7 @@ Value::Dict SystemMetrics::ToDict() cons
+ Value::Dict res;
+
+ res.Set("committed_memory", static_cast<int>(committed_memory_));
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ Value::Dict meminfo = memory_info_.ToDict();
+ meminfo.Merge(vmstat_info_.ToDict());
+ res.Set("meminfo", std::move(meminfo));
+@@ -100,7 +100,6 @@ std::unique_ptr<ProcessMetrics> ProcessM
+ #endif // !BUILDFLAG(IS_MAC)
+ }
+
+-#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX)
+ double ProcessMetrics::GetPlatformIndependentCPUUsage(
+ TimeDelta cumulative_cpu) {
+ TimeTicks time = TimeTicks::Now();
+@@ -129,10 +128,9 @@ ProcessMetrics::GetPlatformIndependentCP
+ return GetPlatformIndependentCPUUsage(cpu_usage);
+ });
+ }
+-#endif
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int ProcessMetrics::CalculateIdleWakeupsPerSecond(
+ uint64_t absolute_idle_wakeups) {
+ return CalculateEventsPerSecond(absolute_idle_wakeups,
diff --git a/electron34/patches/patch-base_process_process__metrics.h b/electron34/patches/patch-base_process_process__metrics.h
new file mode 100644
index 0000000000..84656c27b2
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics.h
@@ -0,0 +1,121 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics.h
+@@ -38,7 +38,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ #include <string>
+ #include <utility>
+ #include <vector>
+@@ -48,7 +48,7 @@
+
+ namespace base {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Minor and major page fault counts since the process creation.
+ // Both counts are process-wide, and exclude child processes.
+ //
+@@ -113,7 +113,7 @@ class BASE_EXPORT ProcessMetrics {
+ // convenience wrapper for CreateProcessMetrics().
+ static std::unique_ptr<ProcessMetrics> CreateCurrentProcessMetrics();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Resident Set Size is a Linux/Android specific memory concept. Do not
+ // attempt to extend this to other platforms.
+ BASE_EXPORT size_t GetResidentSetSize() const;
+@@ -147,7 +147,7 @@ class BASE_EXPORT ProcessMetrics {
+ base::expected<TimeDelta, ProcessCPUUsageError> GetCumulativeCPUUsage();
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Emits the cumulative CPU usage for all currently active threads since they
+ // were started into the output parameter (replacing its current contents).
+ // Threads that have already terminated will not be reported. Thus, the sum of
+@@ -192,7 +192,7 @@ class BASE_EXPORT ProcessMetrics {
+ int GetOpenFdSoftLimit() const;
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Bytes of swap as reported by /proc/[pid]/status.
+ uint64_t GetVmSwapBytes() const;
+
+@@ -213,7 +213,7 @@ class BASE_EXPORT ProcessMetrics {
+ #endif // !BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ int CalculateIdleWakeupsPerSecond(uint64_t absolute_idle_wakeups);
+ #endif
+ #if BUILDFLAG(IS_APPLE)
+@@ -235,12 +235,10 @@ class BASE_EXPORT ProcessMetrics {
+ // Used to store the previous times and CPU usage counts so we can
+ // compute the CPU usage between calls.
+ TimeTicks last_cpu_time_;
+-#if !BUILDFLAG(IS_FREEBSD) || !BUILDFLAG(IS_POSIX)
+ TimeDelta last_cumulative_cpu_;
+-#endif
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Same thing for idle wakeups.
+ TimeTicks last_idle_wakeups_time_;
+ uint64_t last_absolute_idle_wakeups_;
+@@ -281,7 +279,7 @@ BASE_EXPORT void IncreaseFdLimitTo(unsig
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_AIX) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Data about system-wide memory consumption. Values are in KB. Available on
+ // Windows, Mac, Linux, Android and Chrome OS.
+ //
+@@ -316,7 +314,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // This provides an estimate of available memory as described here:
+ // https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773
+ // NOTE: this is ONLY valid in kernels 3.14 and up. Its value will always
+@@ -331,7 +329,7 @@ struct BASE_EXPORT SystemMemoryInfoKB {
+ #endif
+
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ int buffers = 0;
+ int cached = 0;
+ int active_anon = 0;
+@@ -368,7 +366,7 @@ BASE_EXPORT bool GetSystemMemoryInfo(Sys
+ // BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Parse the data found in /proc/<pid>/stat and return the sum of the
+ // CPU-related ticks. Returns -1 on parse error.
+ // Exposed for testing.
+@@ -563,7 +561,7 @@ class BASE_EXPORT SystemMetrics {
+ FRIEND_TEST_ALL_PREFIXES(SystemMetricsTest, SystemMetrics);
+
+ size_t committed_memory_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ SystemMemoryInfoKB memory_info_;
+ VmStatInfo vmstat_info_;
+ SystemDiskInfo disk_info_;
diff --git a/electron34/patches/patch-base_process_process__metrics__freebsd.cc b/electron34/patches/patch-base_process_process__metrics__freebsd.cc
new file mode 100644
index 0000000000..9d0018a4f4
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics__freebsd.cc
@@ -0,0 +1,308 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics_freebsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics_freebsd.cc
+@@ -3,19 +3,37 @@
+ // found in the LICENSE file.
+
+ #include "base/process/process_metrics.h"
++#include "base/notreached.h"
+
+ #include <stddef.h>
++#include <sys/types.h>
+ #include <sys/sysctl.h>
+ #include <sys/user.h>
+ #include <unistd.h>
+
++#include <fcntl.h> /* O_RDONLY */
++#include <kvm.h>
++#include <libutil.h>
++
+ #include "base/memory/ptr_util.h"
++#include "base/values.h"
+
+ namespace base {
++namespace {
++int GetPageShift() {
++ int pagesize = getpagesize();
++ int pageshift = 0;
++
++ while (pagesize > 1) {
++ pageshift++;
++ pagesize >>= 1;
++ }
++
++ return pageshift;
++}
++}
+
+-ProcessMetrics::ProcessMetrics(ProcessHandle process)
+- : process_(process),
+- last_cpu_(0) {}
++ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
+
+ // static
+ std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
+@@ -23,21 +41,18 @@ std::unique_ptr<ProcessMetrics> ProcessM
+ return WrapUnique(new ProcessMetrics(process));
+ }
+
+-base::expected<double, ProcessCPUUsageError>
+-ProcessMetrics::GetPlatformIndependentCPUUsage() {
++base::expected<TimeDelta, ProcessCPUUsageError>
++ProcessMetrics::GetCumulativeCPUUsage() {
+ struct kinfo_proc info;
+- int mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, process_};
+- size_t length = sizeof(info);
++ size_t length = sizeof(struct kinfo_proc);
++ struct timeval tv;
++
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_ };
+
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
+- return base::unexpected(ProcessCPUUsageError::kSystemError);
++ return base::ok(TimeDelta());
+
+- return base::ok(double{info.ki_pctcpu} / FSCALE * 100.0);
+-}
+-
+-base::expected<TimeDelta, ProcessCPUUsageError>
+-ProcessMetrics::GetCumulativeCPUUsage() {
+- NOTREACHED();
++ return base::ok(Microseconds(info.ki_runtime));
+ }
+
+ size_t GetSystemCommitCharge() {
+@@ -63,4 +78,228 @@ size_t GetSystemCommitCharge() {
+ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
+ }
+
++int64_t GetNumberOfThreads(ProcessHandle process) {
++ // Taken from FreeBSD top (usr.bin/top/machine.c)
++
++ kvm_t* kd = kvm_open(NULL, "/dev/null", NULL, O_RDONLY, "kvm_open");
++ if (kd == NULL)
++ return 0;
++
++ struct kinfo_proc* pbase;
++ int nproc;
++ pbase = kvm_getprocs(kd, KERN_PROC_PID, process, &nproc);
++ if (pbase == NULL)
++ return 0;
++
++ if (kvm_close(kd) == -1)
++ return 0;
++
++ return nproc;
++}
++
++bool GetSystemMemoryInfo(SystemMemoryInfoKB *meminfo) {
++ unsigned int mem_total, mem_free, swap_total, swap_used;
++ size_t length;
++ int pagesizeKB;
++
++ pagesizeKB = getpagesize() / 1024;
++
++ length = sizeof(mem_total);
++ if (sysctlbyname("vm.stats.vm.v_page_count", &mem_total,
++ &length, NULL, 0) != 0 || length != sizeof(mem_total))
++ return false;
++
++ length = sizeof(mem_free);
++ if (sysctlbyname("vm.stats.vm.v_free_count", &mem_free, &length, NULL, 0)
++ != 0 || length != sizeof(mem_free))
++ return false;
++
++ length = sizeof(swap_total);
++ if (sysctlbyname("vm.swap_size", &swap_total, &length, NULL, 0)
++ != 0 || length != sizeof(swap_total))
++ return false;
++
++ length = sizeof(swap_used);
++ if (sysctlbyname("vm.swap_anon_use", &swap_used, &length, NULL, 0)
++ != 0 || length != sizeof(swap_used))
++ return false;
++
++ meminfo->total = mem_total * pagesizeKB;
++ meminfo->free = mem_free * pagesizeKB;
++ meminfo->swap_total = swap_total * pagesizeKB;
++ meminfo->swap_free = (swap_total - swap_used) * pagesizeKB;
++
++ return true;
++}
++
++int ProcessMetrics::GetOpenFdCount() const {
++ struct kinfo_file * kif;
++ int cnt;
++
++ if ((kif = kinfo_getfile(process_, &cnt)) == NULL)
++ return -1;
++
++ free(kif);
++
++ return cnt;
++}
++
++int ProcessMetrics::GetOpenFdSoftLimit() const {
++ size_t length;
++ int total_count = 0;
++ int mib[] = { CTL_KERN, KERN_MAXFILESPERPROC };
++
++ length = sizeof(total_count);
++
++ if (sysctl(mib, std::size(mib), &total_count, &length, NULL, 0) < 0) {
++ total_count = -1;
++ }
++
++ return total_count;
++}
++
++size_t ProcessMetrics::GetResidentSetSize() const {
++ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
++
++ if (kd == nullptr)
++ return 0;
++
++ struct kinfo_proc *pp;
++ int nproc;
++
++ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
++ kvm_close(kd);
++ return 0;
++ }
++
++ size_t rss;
++
++ if (nproc > 0) {
++ rss = pp->ki_rssize << GetPageShift();
++ } else {
++ rss = 0;
++ }
++
++ kvm_close(kd);
++ return rss;
++}
++
++uint64_t ProcessMetrics::GetVmSwapBytes() const {
++ kvm_t *kd = kvm_open(nullptr, "/dev/null", nullptr, O_RDONLY, "kvm_open");
++
++ if (kd == nullptr)
++ return 0;
++
++ struct kinfo_proc *pp;
++ int nproc;
++
++ if ((pp = kvm_getprocs(kd, KERN_PROC_PID, process_, &nproc)) == nullptr) {
++ kvm_close(kd);
++ return 0;
++ }
++
++ size_t swrss;
++
++ if (nproc > 0) {
++ swrss = pp->ki_swrss > pp->ki_rssize
++ ? (pp->ki_swrss - pp->ki_rssize) << GetPageShift()
++ : 0;
++ } else {
++ swrss = 0;
++ }
++
++ kvm_close(kd);
++ return swrss;
++}
++
++int ProcessMetrics::GetIdleWakeupsPerSecond() {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++bool GetVmStatInfo(VmStatInfo* vmstat) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++SystemDiskInfo::SystemDiskInfo() {
++ reads = 0;
++ reads_merged = 0;
++ sectors_read = 0;
++ read_time = 0;
++ writes = 0;
++ writes_merged = 0;
++ sectors_written = 0;
++ write_time = 0;
++ io = 0;
++ io_time = 0;
++ weighted_io_time = 0;
++}
++
++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo& other) = default;
++
++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
++
++Value::Dict SystemDiskInfo::ToDict() const {
++ Value::Dict res;
++
++ // Write out uint64_t variables as doubles.
++ // Note: this may discard some precision, but for JS there's no other option.
++ res.Set("reads", static_cast<double>(reads));
++ res.Set("reads_merged", static_cast<double>(reads_merged));
++ res.Set("sectors_read", static_cast<double>(sectors_read));
++ res.Set("read_time", static_cast<double>(read_time));
++ res.Set("writes", static_cast<double>(writes));
++ res.Set("writes_merged", static_cast<double>(writes_merged));
++ res.Set("sectors_written", static_cast<double>(sectors_written));
++ res.Set("write_time", static_cast<double>(write_time));
++ res.Set("io", static_cast<double>(io));
++ res.Set("io_time", static_cast<double>(io_time));
++ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict SystemMemoryInfoKB::ToDict() const {
++ Value::Dict res;
++ res.Set("total", total);
++ res.Set("free", free);
++ res.Set("available", available);
++ res.Set("buffers", buffers);
++ res.Set("cached", cached);
++ res.Set("active_anon", active_anon);
++ res.Set("inactive_anon", inactive_anon);
++ res.Set("active_file", active_file);
++ res.Set("inactive_file", inactive_file);
++ res.Set("swap_total", swap_total);
++ res.Set("swap_free", swap_free);
++ res.Set("swap_used", swap_total - swap_free);
++ res.Set("dirty", dirty);
++ res.Set("reclaimable", reclaimable);
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict VmStatInfo::ToDict() const {
++ Value::Dict res;
++ // TODO(crbug.com/1334256): Make base::Value able to hold uint64_t and remove
++ // casts below.
++ res.Set("pswpin", static_cast<int>(pswpin));
++ res.Set("pswpout", static_cast<int>(pswpout));
++ res.Set("pgmajfault", static_cast<int>(pgmajfault));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
+ } // namespace base
diff --git a/electron34/patches/patch-base_process_process__metrics__netbsd.cc b/electron34/patches/patch-base_process_process__metrics__netbsd.cc
new file mode 100644
index 0000000000..47e27ce68f
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics__netbsd.cc
@@ -0,0 +1,184 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics_netbsd.cc.orig 2025-05-24 17:57:53.355088211 +0000
++++ base/process/process_metrics_netbsd.cc
+@@ -0,0 +1,175 @@
++// Copyright 2013 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/process/process_metrics.h"
++
++#include <stddef.h>
++#include <stdint.h>
++#include <fcntl.h>
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <sys/vmmeter.h>
++
++#include "base/memory/ptr_util.h"
++#include "base/types/expected.h"
++#include "base/values.h"
++#include "base/notreached.h"
++
++namespace base {
++
++ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
++
++base::expected<TimeDelta, ProcessCPUUsageError>
++ProcessMetrics::GetCumulativeCPUUsage() {
++ struct kinfo_proc2 info;
++ size_t length = sizeof(struct kinfo_proc2);
++ struct timeval tv;
++
++ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, process_,
++ sizeof(struct kinfo_proc2), 1 };
++
++ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) {
++ return base::unexpected(ProcessCPUUsageError::kSystemError);
++ }
++
++ tv.tv_sec = info.p_rtime_sec;
++ tv.tv_usec = info.p_rtime_usec;
++
++ return base::ok(Microseconds(TimeValToMicroseconds(tv)));
++}
++
++// static
++std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
++ ProcessHandle process) {
++ return WrapUnique(new ProcessMetrics(process));
++}
++
++size_t GetSystemCommitCharge() {
++ int mib[] = { CTL_VM, VM_METER };
++ size_t pagesize;
++ struct vmtotal vmtotal;
++ unsigned long mem_total, mem_free, mem_inactive;
++ size_t len = sizeof(vmtotal);
++
++ if (sysctl(mib, std::size(mib), &vmtotal, &len, NULL, 0) < 0) {
++ return 0;
++ }
++
++ mem_total = vmtotal.t_vm;
++ mem_free = vmtotal.t_free;
++ mem_inactive = vmtotal.t_vm - vmtotal.t_avm;
++
++ pagesize = checked_cast<size_t>(getpagesize());
++
++ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
++}
++
++int ProcessMetrics::GetOpenFdCount() const {
++ return -1;
++}
++
++int ProcessMetrics::GetOpenFdSoftLimit() const {
++ return getdtablesize();
++// return GetMaxFds();
++}
++
++uint64_t ProcessMetrics::GetVmSwapBytes() const {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
++ NOTIMPLEMENTED_LOG_ONCE();
++ return false;
++}
++
++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++bool GetVmStatInfo(VmStatInfo* vmstat) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++int ProcessMetrics::GetIdleWakeupsPerSecond() {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++Value::Dict SystemMemoryInfoKB::ToDict() const {
++ Value::Dict res;
++ res.Set("total", total);
++ res.Set("free", free);
++ res.Set("available", available);
++ res.Set("buffers", buffers);
++ res.Set("cached", cached);
++ res.Set("active_anon", active_anon);
++ res.Set("inactive_anon", inactive_anon);
++ res.Set("active_file", active_file);
++ res.Set("inactive_file", inactive_file);
++ res.Set("swap_total", swap_total);
++ res.Set("swap_free", swap_free);
++ res.Set("swap_used", swap_total - swap_free);
++ res.Set("dirty", dirty);
++ res.Set("reclaimable", reclaimable);
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict VmStatInfo::ToDict() const {
++ Value::Dict res;
++ res.Set("pswpin", static_cast<int>(pswpin));
++ res.Set("pswpout", static_cast<int>(pswpout));
++ res.Set("pgmajfault", static_cast<int>(pgmajfault));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++SystemDiskInfo::SystemDiskInfo() {
++ reads = 0;
++ reads_merged = 0;
++ sectors_read = 0;
++ read_time = 0;
++ writes = 0;
++ writes_merged = 0;
++ sectors_written = 0;
++ write_time = 0;
++ io = 0;
++ io_time = 0;
++ weighted_io_time = 0;
++}
++
++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo&) = default;
++
++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
++
++Value::Dict SystemDiskInfo::ToDict() const {
++ Value::Dict res;
++
++ // Write out uint64_t variables as doubles.
++ // Note: this may discard some precision, but for JS there's no other option.
++ res.Set("reads", static_cast<double>(reads));
++ res.Set("reads_merged", static_cast<double>(reads_merged));
++ res.Set("sectors_read", static_cast<double>(sectors_read));
++ res.Set("read_time", static_cast<double>(read_time));
++ res.Set("writes", static_cast<double>(writes));
++ res.Set("writes_merged", static_cast<double>(writes_merged));
++ res.Set("sectors_written", static_cast<double>(sectors_written));
++ res.Set("write_time", static_cast<double>(write_time));
++ res.Set("io", static_cast<double>(io));
++ res.Set("io_time", static_cast<double>(io_time));
++ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_process_process__metrics__openbsd.cc b/electron34/patches/patch-base_process_process__metrics__openbsd.cc
new file mode 100644
index 0000000000..c5e8154faf
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics__openbsd.cc
@@ -0,0 +1,239 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics_openbsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics_openbsd.cc
+@@ -6,36 +6,40 @@
+
+ #include <stddef.h>
+ #include <stdint.h>
++#include <fcntl.h>
+ #include <sys/param.h>
+ #include <sys/sysctl.h>
++#include <sys/vmmeter.h>
++
++#include <kvm.h>
+
+ #include "base/memory/ptr_util.h"
+ #include "base/types/expected.h"
++#include "base/values.h"
++#include "base/notreached.h"
+
+ namespace base {
+
+-namespace {
++ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process) {}
+
+-base::expected<int, ProcessCPUUsageError> GetProcessCPU(pid_t pid) {
++base::expected<TimeDelta, ProcessCPUUsageError>
++ProcessMetrics::GetCumulativeCPUUsage() {
+ struct kinfo_proc info;
+- size_t length;
+- int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, pid,
+- sizeof(struct kinfo_proc), 0 };
+-
+- if (sysctl(mib, std::size(mib), NULL, &length, NULL, 0) < 0) {
+- return base::unexpected(ProcessCPUUsageError::kSystemError);
+- }
++ size_t length = sizeof(struct kinfo_proc);
++ struct timeval tv;
+
+- mib[5] = (length / sizeof(struct kinfo_proc));
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process_,
++ sizeof(struct kinfo_proc), 1 };
+
+ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0) {
+ return base::unexpected(ProcessCPUUsageError::kSystemError);
+ }
+
+- return base::ok(info.p_pctcpu);
+-}
++ tv.tv_sec = info.p_rtime_sec;
++ tv.tv_usec = info.p_rtime_usec;
+
+-} // namespace
++ return base::ok(Microseconds(TimeValToMicroseconds(tv)));
++}
+
+ // static
+ std::unique_ptr<ProcessMetrics> ProcessMetrics::CreateProcessMetrics(
+@@ -43,37 +47,9 @@ std::unique_ptr<ProcessMetrics> ProcessM
+ return WrapUnique(new ProcessMetrics(process));
+ }
+
+-base::expected<double, ProcessCPUUsageError>
+-ProcessMetrics::GetPlatformIndependentCPUUsage() {
+- TimeTicks time = TimeTicks::Now();
+-
+- if (last_cpu_time_.is_zero()) {
+- // First call, just set the last values.
+- last_cpu_time_ = time;
+- return base::ok(0.0);
+- }
+-
+- const base::expected<int, ProcessCPUUsageError> cpu = GetProcessCPU(process_);
+- if (!cpu.has_value()) {
+- return base::unexpected(cpu.error());
+- }
+-
+- last_cpu_time_ = time;
+- return base::ok(double{cpu.value()} / FSCALE * 100.0);
+-}
+-
+-base::expected<TimeDelta, ProcessCPUUsageError>
+-ProcessMetrics::GetCumulativeCPUUsage() {
+- NOTREACHED();
+-}
+-
+-ProcessMetrics::ProcessMetrics(ProcessHandle process)
+- : process_(process),
+- last_cpu_(0) {}
+-
+ size_t GetSystemCommitCharge() {
+ int mib[] = { CTL_VM, VM_METER };
+- int pagesize;
++ size_t pagesize;
+ struct vmtotal vmtotal;
+ unsigned long mem_total, mem_free, mem_inactive;
+ size_t len = sizeof(vmtotal);
+@@ -85,9 +61,136 @@ size_t GetSystemCommitCharge() {
+ mem_free = vmtotal.t_free;
+ mem_inactive = vmtotal.t_vm - vmtotal.t_avm;
+
+- pagesize = getpagesize();
++ pagesize = checked_cast<size_t>(getpagesize());
+
+ return mem_total - (mem_free*pagesize) - (mem_inactive*pagesize);
+ }
+
++int ProcessMetrics::GetOpenFdCount() const {
++#if 0
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ int total_count = 0;
++ char errbuf[_POSIX2_LINE_MAX];
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
++ goto out;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, process_,
++ sizeof(struct kinfo_file), &total_count)) == NULL) {
++ total_count = 0;
++ goto out;
++ }
++
++ kvm_close(kd);
++
++out:
++ return total_count;
++#endif
++ return getdtablecount();
++}
++
++int ProcessMetrics::GetOpenFdSoftLimit() const {
++ return getdtablesize();
++// return GetMaxFds();
++}
++
++uint64_t ProcessMetrics::GetVmSwapBytes() const {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++bool GetSystemMemoryInfo(SystemMemoryInfoKB* meminfo) {
++ NOTIMPLEMENTED_LOG_ONCE();
++ return false;
++}
++
++bool GetSystemDiskInfo(SystemDiskInfo* diskinfo) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++bool GetVmStatInfo(VmStatInfo* vmstat) {
++ NOTIMPLEMENTED();
++ return false;
++}
++
++int ProcessMetrics::GetIdleWakeupsPerSecond() {
++ NOTIMPLEMENTED();
++ return 0;
++}
++
++Value::Dict SystemMemoryInfoKB::ToDict() const {
++ Value::Dict res;
++ res.Set("total", total);
++ res.Set("free", free);
++ res.Set("available", available);
++ res.Set("buffers", buffers);
++ res.Set("cached", cached);
++ res.Set("active_anon", active_anon);
++ res.Set("inactive_anon", inactive_anon);
++ res.Set("active_file", active_file);
++ res.Set("inactive_file", inactive_file);
++ res.Set("swap_total", swap_total);
++ res.Set("swap_free", swap_free);
++ res.Set("swap_used", swap_total - swap_free);
++ res.Set("dirty", dirty);
++ res.Set("reclaimable", reclaimable);
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++Value::Dict VmStatInfo::ToDict() const {
++ Value::Dict res;
++ res.Set("pswpin", static_cast<int>(pswpin));
++ res.Set("pswpout", static_cast<int>(pswpout));
++ res.Set("pgmajfault", static_cast<int>(pgmajfault));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
++SystemDiskInfo::SystemDiskInfo() {
++ reads = 0;
++ reads_merged = 0;
++ sectors_read = 0;
++ read_time = 0;
++ writes = 0;
++ writes_merged = 0;
++ sectors_written = 0;
++ write_time = 0;
++ io = 0;
++ io_time = 0;
++ weighted_io_time = 0;
++}
++
++SystemDiskInfo::SystemDiskInfo(const SystemDiskInfo&) = default;
++
++SystemDiskInfo& SystemDiskInfo::operator=(const SystemDiskInfo&) = default;
++
++Value::Dict SystemDiskInfo::ToDict() const {
++ Value::Dict res;
++
++ // Write out uint64_t variables as doubles.
++ // Note: this may discard some precision, but for JS there's no other option.
++ res.Set("reads", static_cast<double>(reads));
++ res.Set("reads_merged", static_cast<double>(reads_merged));
++ res.Set("sectors_read", static_cast<double>(sectors_read));
++ res.Set("read_time", static_cast<double>(read_time));
++ res.Set("writes", static_cast<double>(writes));
++ res.Set("writes_merged", static_cast<double>(writes_merged));
++ res.Set("sectors_written", static_cast<double>(sectors_written));
++ res.Set("write_time", static_cast<double>(write_time));
++ res.Set("io", static_cast<double>(io));
++ res.Set("io_time", static_cast<double>(io_time));
++ res.Set("weighted_io_time", static_cast<double>(weighted_io_time));
++
++ NOTIMPLEMENTED();
++
++ return res;
++}
++
+ } // namespace base
diff --git a/electron34/patches/patch-base_process_process__metrics__posix.cc b/electron34/patches/patch-base_process_process__metrics__posix.cc
new file mode 100644
index 0000000000..68933b659a
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics_posix.cc
+@@ -21,6 +21,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -134,7 +136,7 @@ size_t ProcessMetrics::GetMallocUsage()
+ return stats.size_in_use;
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+ return GetMallocUsageMallinfo();
+-#elif BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(fuchsia): Not currently exposed. https://crbug.com/735087.
+ return 0;
+ #endif
diff --git a/electron34/patches/patch-base_process_process__metrics__unittest.cc b/electron34/patches/patch-base_process_process__metrics__unittest.cc
new file mode 100644
index 0000000000..29a49a502c
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__metrics__unittest.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_metrics_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_metrics_unittest.cc
+@@ -62,7 +62,8 @@
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE) || \
++ BUILDFLAG(IS_BSD)
+ #define ENABLE_CPU_TESTS 1
+ #else
+ #define ENABLE_CPU_TESTS 0
diff --git a/electron34/patches/patch-base_process_process__posix.cc b/electron34/patches/patch-base_process_process__posix.cc
new file mode 100644
index 0000000000..607be5bfda
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__posix.cc
@@ -0,0 +1,100 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_posix.cc
+@@ -23,10 +23,15 @@
+ #include "base/trace_event/base_tracing.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include <sys/event.h>
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#include <sys/sysctl.h>
++#endif
++
+ #if BUILDFLAG(CLANG_PROFILING)
+ #include "base/test/clang_profiling.h"
+ #endif
+@@ -99,7 +104,7 @@ bool WaitpidWithTimeout(base::ProcessHan
+ }
+ #endif
+
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Using kqueue on Mac so that we can wait on non-child processes.
+ // We can't use kqueues on child processes because we need to reap
+ // our own children using wait.
+@@ -376,7 +381,7 @@ bool Process::WaitForExitWithTimeoutImpl
+ const bool exited = (parent_pid < 0);
+
+ if (!exited && parent_pid != our_pid) {
+-#if BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // On Mac we can wait on non child processes.
+ return WaitForSingleNonChildProcess(handle, timeout);
+ #else
+@@ -413,7 +418,56 @@ void Process::Exited(int exit_code) cons
+
+ int Process::GetOSPriority() const {
+ DCHECK(IsValid());
++// avoid pledge(2) violation
++#if BUILDFLAG(IS_BSD)
++ return 0;
++#else
+ return getpriority(PRIO_PROCESS, static_cast<id_t>(process_));
++#endif
++}
++
++Time Process::CreationTime() const {
++// avoid ps pledge in the network process
++#if !BUILDFLAG(IS_BSD)
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, getpid(),
++ sizeof(struct kinfo_proc), 0 };
++ struct kinfo_proc *info = nullptr;
++ size_t info_size;
++#endif
++ Time ct = Time();
++
++#if !BUILDFLAG(IS_BSD)
++ if (sysctl(mib, std::size(mib), NULL, &info_size, NULL, 0) < 0)
++ goto out;
++
++ mib[5] = (info_size / sizeof(struct kinfo_proc));
++ if ((info = reinterpret_cast<kinfo_proc*>(malloc(info_size))) == NULL)
++ goto out;
++
++ if (sysctl(mib, std::size(mib), info, &info_size, NULL, 0) < 0)
++ goto out;
++
++ ct = Time::FromTimeT(info->p_ustart_sec);
++
++out:
++ if (info)
++ free(info);
++#endif
++ return ct;
++}
++
++#if BUILDFLAG(IS_BSD)
++Process::Priority Process::GetPriority() const {
++ return Priority::kUserBlocking;
+ }
+
++bool Process::SetPriority(Priority priority) {
++ return false;
++}
++
++bool Process::CanSetPriority() {
++ return false;
++}
++#endif
++
+ } // namespace base
diff --git a/electron34/patches/patch-base_process_process__unittest.cc b/electron34/patches/patch-base_process_process__unittest.cc
new file mode 100644
index 0000000000..a1b995dcae
--- /dev/null
+++ b/electron34/patches/patch-base_process_process__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/process/process_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/process/process_unittest.cc
+@@ -203,7 +203,7 @@ TEST_F(ProcessTest, CreationTimeOtherPro
+ // was spawned and a time recorded after it was spawned. However, since the
+ // base::Time and process creation clocks don't match, tolerate some error.
+ constexpr base::TimeDelta kTolerance =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, process creation time is relative to boot time which has a
+ // 1-second resolution. Tolerate 1 second for the imprecise boot time and
+ // 100 ms for the imprecise clock.
diff --git a/electron34/patches/patch-base_profiler_module__cache.cc b/electron34/patches/patch-base_profiler_module__cache.cc
new file mode 100644
index 0000000000..16565ad5b1
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_module__cache.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/module_cache.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/module_cache.cc
+@@ -38,7 +38,7 @@ std::string TransformModuleIDToSymbolSer
+ // Android and Linux Chrome builds use the "breakpad" format to index their
+ // build id, so we transform the build id for these platforms. All other
+ // platforms keep their symbols indexed by the original build ID.
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux ELF module IDs are 160bit integers, which we need to mangle
+ // down to 128bit integers to match the id that Breakpad outputs.
+ // Example on version '66.0.3359.170' x64:
diff --git a/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.cc b/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.cc
new file mode 100644
index 0000000000..7024d68c05
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/sampling_profiler_thread_token.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/sampling_profiler_thread_token.cc
+@@ -6,7 +6,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+
+ #include "base/profiler/stack_base_address_posix.h"
+@@ -18,7 +18,7 @@ SamplingProfilerThreadToken GetSamplingP
+ PlatformThreadId id = PlatformThread::CurrentId();
+ #if BUILDFLAG(IS_ANDROID)
+ return {id, pthread_self()};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::optional<uintptr_t> maybe_stack_base =
+ GetThreadStackBaseAddress(id, pthread_self());
+ return {id, maybe_stack_base};
diff --git a/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.h b/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.h
new file mode 100644
index 0000000000..54341cdaeb
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_sampling__profiler__thread__token.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/sampling_profiler_thread_token.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/sampling_profiler_thread_token.h
+@@ -13,7 +13,7 @@
+
+ #if BUILDFLAG(IS_ANDROID)
+ #include <pthread.h>
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <stdint.h>
+ #endif
+
+@@ -27,7 +27,7 @@ struct SamplingProfilerThreadToken {
+ PlatformThreadId id;
+ #if BUILDFLAG(IS_ANDROID)
+ pthread_t pthread_id;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Due to the sandbox, we can only retrieve the stack base address for the
+ // current thread. We must grab it during
+ // GetSamplingProfilerCurrentThreadToken() and not try to get it later.
diff --git a/electron34/patches/patch-base_profiler_stack__base__address__posix.cc b/electron34/patches/patch-base_profiler_stack__base__address__posix.cc
new file mode 100644
index 0000000000..6a129216ae
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_stack__base__address__posix.cc
@@ -0,0 +1,69 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/stack_base_address_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/stack_base_address_posix.cc
+@@ -17,6 +17,14 @@
+ #include "base/files/scoped_file.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#if BUILDFLAG(IS_NETBSD)
++#include <pthread.h>
++#else
++#include <pthread_np.h>
++#endif
++#endif
++
+ #if BUILDFLAG(IS_CHROMEOS)
+ extern "C" void* __libc_stack_end;
+ #endif
+@@ -45,7 +53,21 @@ std::optional<uintptr_t> GetAndroidMainT
+
+ #if !BUILDFLAG(IS_LINUX)
+ uintptr_t GetThreadStackBaseAddressImpl(pthread_t pthread_id) {
++#if BUILDFLAG(IS_OPENBSD)
++ stack_t ss;
++ void *address;
++ size_t size;
++ if (pthread_stackseg_np(pthread_id, &ss) != 0)
++ return 0;
++ size = ss.ss_size;
++ address = (void*)((size_t) ss.ss_sp - ss.ss_size);
++#else
+ pthread_attr_t attr;
++#if BUILDFLAG(IS_FREEBSD)
++ int result;
++ pthread_attr_init(&attr);
++ pthread_attr_get_np(pthread_id, &attr);
++#else
+ // pthread_getattr_np will crash on ChromeOS & Linux if we are in the sandbox
+ // and pthread_id refers to a different thread, due to the use of
+ // sched_getaffinity().
+@@ -58,12 +80,14 @@ uintptr_t GetThreadStackBaseAddressImpl(
+ << logging::SystemErrorCodeToString(result);
+ // See crbug.com/617730 for limitations of this approach on Linux-like
+ // systems.
++#endif
+ void* address;
+ size_t size;
+ result = pthread_attr_getstack(&attr, &address, &size);
+ CHECK_EQ(result, 0) << "pthread_attr_getstack returned "
+ << logging::SystemErrorCodeToString(result);
+ pthread_attr_destroy(&attr);
++#endif
+ const uintptr_t base_address = reinterpret_cast<uintptr_t>(address) + size;
+ return base_address;
+ }
+@@ -80,7 +104,7 @@ std::optional<uintptr_t> GetThreadStackB
+ // trying to work around the problem.
+ return std::nullopt;
+ #else
+- const bool is_main_thread = id == GetCurrentProcId();
++ const bool is_main_thread = id == checked_cast<PlatformThreadId>(GetCurrentProcId());
+ if (is_main_thread) {
+ #if BUILDFLAG(IS_ANDROID)
+ // The implementation of pthread_getattr_np() in Bionic reads proc/self/maps
diff --git a/electron34/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc b/electron34/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc
new file mode 100644
index 0000000000..d35d488dd2
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/stack_sampling_profiler_test_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/stack_sampling_profiler_test_util.cc
+@@ -42,7 +42,7 @@
+ // Fortunately, it provides _alloca, which functions identically.
+ #include <malloc.h>
+ #define alloca _alloca
+-#else
++#elif !BUILDFLAG(IS_BSD)
+ #include <alloca.h>
+ #endif
+
diff --git a/electron34/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc b/electron34/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc
new file mode 100644
index 0000000000..06f2c946fc
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/stack_sampling_profiler_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/stack_sampling_profiler_unittest.cc
+@@ -45,7 +45,7 @@
+
+ #include <intrin.h>
+ #include <malloc.h>
+-#else
++#elif !BUILDFLAG(IS_BSD)
+ #include <alloca.h>
+ #endif
+
diff --git a/electron34/patches/patch-base_profiler_thread__delegate__posix.cc b/electron34/patches/patch-base_profiler_thread__delegate__posix.cc
new file mode 100644
index 0000000000..1db3ab6ace
--- /dev/null
+++ b/electron34/patches/patch-base_profiler_thread__delegate__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/profiler/thread_delegate_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/profiler/thread_delegate_posix.cc
+@@ -19,7 +19,7 @@
+ #include "base/process/process_handle.h"
+ #include "build/build_config.h"
+
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #include "base/profiler/stack_base_address_posix.h"
+ #endif
+
+@@ -28,7 +28,7 @@ namespace base {
+ std::unique_ptr<ThreadDelegatePosix> ThreadDelegatePosix::Create(
+ SamplingProfilerThreadToken thread_token) {
+ std::optional<uintptr_t> base_address;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base_address = thread_token.stack_base_address;
+ #else
+ base_address =
diff --git a/electron34/patches/patch-base_rand__util.h b/electron34/patches/patch-base_rand__util.h
new file mode 100644
index 0000000000..a557ec83bc
--- /dev/null
+++ b/electron34/patches/patch-base_rand__util.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/rand_util.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/rand_util.h
+@@ -141,7 +141,7 @@ void RandomShuffle(Itr first, Itr last)
+ std::shuffle(first, last, RandomBitGenerator());
+ }
+
+-#if BUILDFLAG(IS_POSIX)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_BSD)
+ BASE_EXPORT int GetUrandomFD();
+ #endif
+
diff --git a/electron34/patches/patch-base_rand__util__posix.cc b/electron34/patches/patch-base_rand__util__posix.cc
new file mode 100644
index 0000000000..88b1e9cb03
--- /dev/null
+++ b/electron34/patches/patch-base_rand__util__posix.cc
@@ -0,0 +1,68 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/rand_util_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/rand_util_posix.cc
+@@ -28,7 +28,7 @@
+ #include "base/time/time.h"
+ #include "build/build_config.h"
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ #include "third_party/lss/linux_syscall_support.h"
+ #elif BUILDFLAG(IS_MAC)
+ // TODO(crbug.com/40641285): Waiting for this header to appear in the iOS SDK.
+@@ -44,6 +44,7 @@ namespace base {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_AIX)
+ // AIX has no 64-bit support for O_CLOEXEC.
+ static constexpr int kOpenFlags = O_RDONLY;
+@@ -68,10 +69,11 @@ class URandomFd {
+ private:
+ const int fd_;
+ };
++#endif
+
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+ BUILDFLAG(IS_ANDROID)) && \
+- !BUILDFLAG(IS_NACL)
++ !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ // TODO(pasko): Unify reading kernel version numbers in:
+ // mojo/core/channel_linux.cc
+ // chrome/browser/android/seccomp_support_detector.cc
+@@ -152,6 +154,7 @@ bool UseBoringSSLForRandBytes() {
+ namespace {
+
+ void RandBytesInternal(span<uint8_t> output, bool avoid_allocation) {
++#if !BUILDFLAG(IS_BSD)
+ #if !BUILDFLAG(IS_NACL)
+ // The BoringSSL experiment takes priority over everything else.
+ if (!avoid_allocation && internal::UseBoringSSLForRandBytes()) {
+@@ -186,6 +189,9 @@ void RandBytesInternal(span<uint8_t> out
+ const int urandom_fd = GetUrandomFD();
+ const bool success = ReadFromFD(urandom_fd, as_writable_chars(output));
+ CHECK(success);
++#else
++ arc4random_buf(output.data(), output.size());
++#endif
+ }
+
+ } // namespace
+@@ -205,9 +211,11 @@ void RandBytes(span<uint8_t> output) {
+ RandBytesInternal(output, /*avoid_allocation=*/false);
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ int GetUrandomFD() {
+ static NoDestructor<URandomFd> urandom_fd;
+ return urandom_fd->fd();
+ }
++#endif
+
+ } // namespace base
diff --git a/electron34/patches/patch-base_strings_safe__sprintf__unittest.cc b/electron34/patches/patch-base_strings_safe__sprintf__unittest.cc
new file mode 100644
index 0000000000..e104501210
--- /dev/null
+++ b/electron34/patches/patch-base_strings_safe__sprintf__unittest.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/strings/safe_sprintf_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/strings/safe_sprintf_unittest.cc
+@@ -740,6 +740,7 @@ TEST(SafeSPrintfTest, EmbeddedNul) {
+ #endif
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ TEST(SafeSPrintfTest, EmitNULL) {
+ char buf[40];
+ #if defined(__GNUC__)
+@@ -756,6 +757,7 @@ TEST(SafeSPrintfTest, EmitNULL) {
+ #pragma GCC diagnostic pop
+ #endif
+ }
++#endif
+
+ TEST(SafeSPrintfTest, PointerSize) {
+ // The internal data representation is a 64bit value, independent of the
diff --git a/electron34/patches/patch-base_synchronization_lock__impl.h b/electron34/patches/patch-base_synchronization_lock__impl.h
new file mode 100644
index 0000000000..5ac4356e03
--- /dev/null
+++ b/electron34/patches/patch-base_synchronization_lock__impl.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/synchronization/lock_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/synchronization/lock_impl.h
+@@ -109,6 +109,10 @@ void LockImpl::Unlock() {
+ }
+
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FREEBSD)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wthread-safety-analysis"
++#endif
+
+ #if DCHECK_IS_ON()
+ BASE_EXPORT void dcheck_trylock_result(int rv);
+@@ -129,6 +133,9 @@ void LockImpl::Unlock() {
+ dcheck_unlock_result(rv);
+ #endif
+ }
++#if BUILDFLAG(IS_FREEBSD)
++#pragma GCC diagnostic pop
++#endif
+ #endif
+
+ // This is an implementation used for AutoLock templated on the lock type.
diff --git a/electron34/patches/patch-base_syslog__logging.cc b/electron34/patches/patch-base_syslog__logging.cc
new file mode 100644
index 0000000000..c6de4215af
--- /dev/null
+++ b/electron34/patches/patch-base_syslog__logging.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/syslog_logging.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/syslog_logging.cc
+@@ -17,7 +17,7 @@
+ #include "base/strings/string_util.h"
+ #include "base/win/scoped_handle.h"
+ #include "base/win/win_util.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // <syslog.h> defines LOG_INFO, LOG_WARNING macros that could conflict with
+ // base::LOG_INFO, base::LOG_WARNING.
+ #include <syslog.h>
+@@ -149,7 +149,7 @@ EventLogMessage::~EventLogMessage() {
+
+ if (user_sid != nullptr)
+ ::LocalFree(user_sid);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kEventSource[] = "chrome";
+ openlog(kEventSource, LOG_NOWAIT | LOG_PID, LOG_USER);
+ // We can't use the defined names for the logging severity from syslog.h
diff --git a/electron34/patches/patch-base_system_sys__info.cc b/electron34/patches/patch-base_system_sys__info.cc
new file mode 100644
index 0000000000..561d497eb2
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info.cc
+@@ -229,7 +229,7 @@ std::string SysInfo::SocManufacturer() {
+ #endif
+
+ void SysInfo::GetHardwareInfo(base::OnceCallback<void(HardwareInfo)> callback) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ constexpr base::TaskTraits kTraits = {base::MayBlock()};
+ #else
+ constexpr base::TaskTraits kTraits = {};
diff --git a/electron34/patches/patch-base_system_sys__info.h b/electron34/patches/patch-base_system_sys__info.h
new file mode 100644
index 0000000000..c9ece6c529
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info.h
+@@ -331,6 +331,8 @@ class BASE_EXPORT SysInfo {
+ static void ResetCpuSecurityMitigationsEnabledForTesting();
+ #endif
+
++ static uint64_t MaxSharedMemorySize();
++
+ private:
+ friend class test::ScopedAmountOfPhysicalMemoryOverride;
+ FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
+@@ -343,7 +345,7 @@ class BASE_EXPORT SysInfo {
+ static HardwareInfo GetHardwareInfoSync();
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ static uint64_t AmountOfAvailablePhysicalMemory(
+ const SystemMemoryInfoKB& meminfo);
+ #endif
diff --git a/electron34/patches/patch-base_system_sys__info__freebsd.cc b/electron34/patches/patch-base_system_sys__info__freebsd.cc
new file mode 100644
index 0000000000..6348d5f62a
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info__freebsd.cc
@@ -0,0 +1,118 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info_freebsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info_freebsd.cc
+@@ -9,28 +9,103 @@
+ #include <sys/sysctl.h>
+
+ #include "base/notreached.h"
++#include "base/process/process_metrics.h"
++#include "base/strings/string_util.h"
+
+ namespace base {
+
+-int64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+- int pages, page_size;
++int SysInfo::NumberOfProcessors() {
++ int mib[] = {CTL_HW, HW_NCPU};
++ int ncpu;
++ size_t size = sizeof(ncpu);
++ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
++ NOTREACHED();
++ return 1;
++ }
++ return ncpu;
++}
++
++uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
++ int pages, page_size, r = 0;
+ size_t size = sizeof(pages);
+- sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
+- sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
+- if (pages == -1 || page_size == -1) {
++
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_count", &pages, &size, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
++
++ if (r == -1) {
++ NOTREACHED();
++ }
++
++ return static_cast<uint64_t>(pages) * page_size;
++}
++
++uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
++ int page_size, r = 0;
++ unsigned int pgfree, pginact, pgcache;
++ size_t size = sizeof(page_size);
++ size_t szpg = sizeof(pgfree);
++
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_page_size", &page_size, &size, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_free_count", &pgfree, &szpg, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_inactive_count", &pginact, &szpg, NULL, 0);
++ if (r == 0)
++ r = sysctlbyname("vm.stats.vm.v_cache_count", &pgcache, &szpg, NULL, 0);
++
++ if (r == -1) {
+ NOTREACHED();
++ return 0;
+ }
+- return static_cast<int64_t>(pages) * page_size;
++
++ return static_cast<uint64_t>((pgfree + pginact + pgcache) * page_size);
++}
++
++// static
++uint64_t SysInfo::AmountOfAvailablePhysicalMemory(const SystemMemoryInfoKB& info) {
++ uint64_t res_kb = info.available != 0
++ ? info.available - info.active_file
++ : info.free + info.reclaimable + info.inactive_file;
++ return res_kb * 1024;
++}
++
++// static
++std::string SysInfo::CPUModelName() {
++ int mib[] = { CTL_HW, HW_MODEL };
++ char name[256];
++ size_t size = std::size(name);
++
++ if (sysctl(mib, std::size(mib), &name, &size, NULL, 0) == 0) {
++ return name;
++ }
++
++ return std::string();
+ }
+
+ // static
+ uint64_t SysInfo::MaxSharedMemorySize() {
+ size_t limit;
+ size_t size = sizeof(limit);
++
+ if (sysctlbyname("kern.ipc.shmmax", &limit, &size, NULL, 0) < 0) {
+ NOTREACHED();
+ }
+ return static_cast<uint64_t>(limit);
+ }
+
++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
++ HardwareInfo info;
++
++ info.manufacturer = "FreeBSD";
++ info.model = HardwareModelName();
++
++ DCHECK(IsStringUTF8(info.manufacturer));
++ DCHECK(IsStringUTF8(info.model));
++
++ return info;
++}
++
+ } // namespace base
diff --git a/electron34/patches/patch-base_system_sys__info__netbsd.cc b/electron34/patches/patch-base_system_sys__info__netbsd.cc
new file mode 100644
index 0000000000..6c2df4ed17
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info__netbsd.cc
@@ -0,0 +1,97 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info_netbsd.cc.orig 2025-05-24 17:57:53.360145504 +0000
++++ base/system/sys_info_netbsd.cc
+@@ -0,0 +1,88 @@
++// Copyright 2011 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/system/sys_info.h"
++
++#include <stddef.h>
++#include <stdint.h>
++#include <sys/param.h>
++#include <sys/shm.h>
++#include <sys/sysctl.h>
++
++#include "base/notreached.h"
++#include "base/posix/sysctl.h"
++#include "base/strings/string_util.h"
++
++namespace {
++
++uint64_t AmountOfMemory(int pages_name) {
++ long pages = sysconf(pages_name);
++ long page_size = sysconf(_SC_PAGESIZE);
++ if (pages < 0 || page_size < 0)
++ return 0;
++ return static_cast<uint64_t>(pages) * static_cast<uint64_t>(page_size);
++}
++
++} // namespace
++
++namespace base {
++
++// static
++int SysInfo::NumberOfProcessors() {
++ int mib[] = {CTL_HW, HW_NCPU};
++ int ncpu;
++ size_t size = sizeof(ncpu);
++ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
++ NOTREACHED();
++ }
++ return ncpu;
++}
++
++// static
++uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
++ return AmountOfMemory(_SC_PHYS_PAGES);
++}
++
++// static
++uint64_t SysInfo::AmountOfAvailablePhysicalMemoryImpl() {
++ return AmountOfMemory(_SC_PHYS_PAGES);
++}
++
++// static
++uint64_t SysInfo::MaxSharedMemorySize() {
++ int mib[] = {CTL_KERN, KERN_SYSVIPC, KERN_SYSVIPC_SHMMAX};
++ size_t limit;
++ size_t size = sizeof(limit);
++ if (sysctl(mib, std::size(mib), &limit, &size, NULL, 0) < 0) {
++ NOTREACHED();
++ }
++ return static_cast<uint64_t>(limit);
++}
++
++// static
++std::string SysInfo::CPUModelName() {
++ int mib[] = { CTL_HW, HW_MODEL };
++ char name[256];
++ size_t size = std::size(name);
++
++ if (sysctl(mib, std::size(mib), &name, &size, NULL, 0) == 0) {
++ return name;
++ }
++
++ return std::string();
++}
++
++// static
++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
++ HardwareInfo info;
++ // Set the manufacturer to "NetBSD" and the model to
++ // an empty string.
++ info.manufacturer = "NetBSD";
++ info.model = HardwareModelName();
++ DCHECK(IsStringUTF8(info.manufacturer));
++ DCHECK(IsStringUTF8(info.model));
++ return info;
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_system_sys__info__openbsd.cc b/electron34/patches/patch-base_system_sys__info__openbsd.cc
new file mode 100644
index 0000000000..53ed183978
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info__openbsd.cc
@@ -0,0 +1,88 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info_openbsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info_openbsd.cc
+@@ -12,6 +12,7 @@
+
+ #include "base/notreached.h"
+ #include "base/posix/sysctl.h"
++#include "base/strings/string_util.h"
+
+ namespace {
+
+@@ -27,9 +28,14 @@ uint64_t AmountOfMemory(int pages_name)
+
+ namespace base {
+
++// pledge(2)
++uint64_t aofpmem = 0;
++uint64_t shmmax = 0;
++char cpumodel[256];
++
+ // static
+ int SysInfo::NumberOfProcessors() {
+- int mib[] = {CTL_HW, HW_NCPU};
++ int mib[] = {CTL_HW, HW_NCPUONLINE};
+ int ncpu;
+ size_t size = sizeof(ncpu);
+ if (sysctl(mib, std::size(mib), &ncpu, &size, NULL, 0) < 0) {
+@@ -40,7 +46,23 @@ int SysInfo::NumberOfProcessors() {
+
+ // static
+ uint64_t SysInfo::AmountOfPhysicalMemoryImpl() {
+- return AmountOfMemory(_SC_PHYS_PAGES);
++ // pledge(2)
++ if (!aofpmem)
++ aofpmem = AmountOfMemory(_SC_PHYS_PAGES);
++ return aofpmem;
++}
++
++// static
++std::string SysInfo::CPUModelName() {
++ int mib[] = {CTL_HW, HW_MODEL};
++ size_t len = std::size(cpumodel);
++
++ if (cpumodel[0] == '\0') {
++ if (sysctl(mib, std::size(mib), cpumodel, &len, NULL, 0) < 0)
++ return std::string();
++ }
++
++ return std::string(cpumodel, len - 1);
+ }
+
+ // static
+@@ -55,15 +77,27 @@ uint64_t SysInfo::MaxSharedMemorySize()
+ int mib[] = {CTL_KERN, KERN_SHMINFO, KERN_SHMINFO_SHMMAX};
+ size_t limit;
+ size_t size = sizeof(limit);
++ // pledge(2)
++ if (shmmax)
++ goto out;
+ if (sysctl(mib, std::size(mib), &limit, &size, NULL, 0) < 0) {
+ NOTREACHED();
+ }
+- return static_cast<uint64_t>(limit);
++ shmmax = static_cast<uint64_t>(limit);
++out:
++ return shmmax;
+ }
+
+ // static
+-std::string SysInfo::CPUModelName() {
+- return StringSysctl({CTL_HW, HW_MODEL}).value();
++SysInfo::HardwareInfo SysInfo::GetHardwareInfoSync() {
++ HardwareInfo info;
++ // Set the manufacturer to "OpenBSD" and the model to
++ // an empty string.
++ info.manufacturer = "OpenBSD";
++ info.model = HardwareModelName();
++ DCHECK(IsStringUTF8(info.manufacturer));
++ DCHECK(IsStringUTF8(info.model));
++ return info;
+ }
+
+ } // namespace base
diff --git a/electron34/patches/patch-base_system_sys__info__posix.cc b/electron34/patches/patch-base_system_sys__info__posix.cc
new file mode 100644
index 0000000000..2dd63af41f
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info__posix.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info_posix.cc
+@@ -117,7 +117,7 @@ bool GetDiskSpaceInfo(const base::FilePa
+
+ namespace base {
+
+-#if !BUILDFLAG(IS_OPENBSD)
++#if !BUILDFLAG(IS_BSD)
+ // static
+ int SysInfo::NumberOfProcessors() {
+ #if BUILDFLAG(IS_MAC)
+@@ -173,7 +173,7 @@ int SysInfo::NumberOfProcessors() {
+
+ return cached_num_cpus;
+ }
+-#endif // !BUILDFLAG(IS_OPENBSD)
++#endif // !BUILDFLAG(IS_BSD)
+
+ // static
+ uint64_t SysInfo::AmountOfVirtualMemory() {
+@@ -256,6 +256,8 @@ std::string SysInfo::OperatingSystemArch
+ arch = "x86";
+ } else if (arch == "amd64") {
+ arch = "x86_64";
++ } else if (arch == "arm64") {
++ arch = "aarch64";
+ } else if (std::string(info.sysname) == "AIX") {
+ arch = "ppc64";
+ }
diff --git a/electron34/patches/patch-base_system_sys__info__unittest.cc b/electron34/patches/patch-base_system_sys__info__unittest.cc
new file mode 100644
index 0000000000..8ceed29e60
--- /dev/null
+++ b/electron34/patches/patch-base_system_sys__info__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/system/sys_info_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/system/sys_info_unittest.cc
+@@ -265,12 +265,16 @@ TEST_F(SysInfoTest, GetHardwareInfo) {
+ EXPECT_TRUE(IsStringUTF8(hardware_info->model));
+ bool empty_result_expected =
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ false;
+ #else
+ true;
+ #endif
+ EXPECT_EQ(hardware_info->manufacturer.empty(), empty_result_expected);
++#if BUILDFLAG(IS_BSD)
++ empty_result_expected = true;
++#endif
+ EXPECT_EQ(hardware_info->model.empty(), empty_result_expected);
+ }
+
diff --git a/electron34/patches/patch-base_task_thread__pool_environment__config__unittest.cc b/electron34/patches/patch-base_task_thread__pool_environment__config__unittest.cc
new file mode 100644
index 0000000000..250a2c2498
--- /dev/null
+++ b/electron34/patches/patch-base_task_thread__pool_environment__config__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/task/thread_pool/environment_config_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/task/thread_pool/environment_config_unittest.cc
+@@ -15,7 +15,7 @@ TEST(ThreadPoolEnvironmentConfig, CanUse
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)
+ EXPECT_TRUE(CanUseBackgroundThreadTypeForWorkerThread());
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ EXPECT_FALSE(CanUseBackgroundThreadTypeForWorkerThread());
+ #else
+ #error Platform doesn't match any block
+@@ -24,7 +24,7 @@ TEST(ThreadPoolEnvironmentConfig, CanUse
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_ANDROID)
+ EXPECT_TRUE(CanUseUtilityThreadTypeForWorkerThread());
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ EXPECT_FALSE(CanUseUtilityThreadTypeForWorkerThread());
+ #else
+ #error Platform doesn't match any block
diff --git a/electron34/patches/patch-base_test_launcher_test__launcher.cc b/electron34/patches/patch-base_test_launcher_test__launcher.cc
new file mode 100644
index 0000000000..1ef63899ed
--- /dev/null
+++ b/electron34/patches/patch-base_test_launcher_test__launcher.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/test/launcher/test_launcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/test/launcher/test_launcher.cc
+@@ -75,6 +75,7 @@
+ #include "testing/gtest/include/gtest/gtest.h"
+
+ #if BUILDFLAG(IS_POSIX)
++#include <signal.h>
+ #include <fcntl.h>
+
+ #include "base/files/file_descriptor_watcher_posix.h"
+@@ -1810,6 +1811,10 @@ bool TestLauncher::Init(CommandLine* com
+ results_tracker_.AddGlobalTag("OS_OPENBSD");
+ #endif
+
++#if BUILDFLAG(IS_NETBSD)
++ results_tracker_.AddGlobalTag("OS_NETBSD");
++#endif
++
+ #if BUILDFLAG(IS_POSIX)
+ results_tracker_.AddGlobalTag("OS_POSIX");
+ #endif
diff --git a/electron34/patches/patch-base_test_test__file__util__linux.cc b/electron34/patches/patch-base_test_test__file__util__linux.cc
new file mode 100644
index 0000000000..b59d845f1e
--- /dev/null
+++ b/electron34/patches/patch-base_test_test__file__util__linux.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/test/test_file_util_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/test/test_file_util_linux.cc
+@@ -54,8 +54,10 @@ bool EvictFileFromSystemCache(const File
+ return false;
+ if (fdatasync(fd.get()) != 0)
+ return false;
++#if !BUILDFLAG(IS_BSD)
+ if (posix_fadvise(fd.get(), 0, 0, POSIX_FADV_DONTNEED) != 0)
+ return false;
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-base_test_test__file__util__posix.cc b/electron34/patches/patch-base_test_test__file__util__posix.cc
new file mode 100644
index 0000000000..02b0d0a5e5
--- /dev/null
+++ b/electron34/patches/patch-base_test_test__file__util__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/test/test_file_util_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/test/test_file_util_posix.cc
+@@ -91,7 +91,7 @@ void SyncPageCacheToDisk() {
+ }
+
+ #if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
+- !BUILDFLAG(IS_ANDROID)
++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ bool EvictFileFromSystemCache(const FilePath& file) {
+ // There doesn't seem to be a POSIX way to cool the disk cache.
+ NOTIMPLEMENTED();
diff --git a/electron34/patches/patch-base_threading_platform__thread.h b/electron34/patches/patch-base_threading_platform__thread.h
new file mode 100644
index 0000000000..4d22d61c98
--- /dev/null
+++ b/electron34/patches/patch-base_threading_platform__thread.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/platform_thread.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/threading/platform_thread.h
+@@ -49,6 +49,8 @@ typedef DWORD PlatformThreadId;
+ typedef zx_koid_t PlatformThreadId;
+ #elif BUILDFLAG(IS_APPLE)
+ typedef mach_port_t PlatformThreadId;
++#elif BUILDFLAG(IS_BSD)
++typedef uint64_t PlatformThreadId;
+ #elif BUILDFLAG(IS_POSIX)
+ typedef pid_t PlatformThreadId;
+ #endif
diff --git a/electron34/patches/patch-base_threading_platform__thread__bsd.cc b/electron34/patches/patch-base_threading_platform__thread__bsd.cc
new file mode 100644
index 0000000000..9dcc2c7320
--- /dev/null
+++ b/electron34/patches/patch-base_threading_platform__thread__bsd.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/platform_thread_bsd.cc.orig 2025-05-24 17:57:53.361495585 +0000
++++ base/threading/platform_thread_bsd.cc
+@@ -0,0 +1,31 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++// Description: These are stubs for *BSD.
++
++#include "base/threading/platform_thread.h"
++
++namespace base {
++namespace internal {
++
++bool CanSetThreadTypeToRealtimeAudio() {
++ return false;
++}
++
++bool SetCurrentThreadTypeForPlatform(ThreadType thread_type,
++ MessagePumpType pump_type_hint) {
++ return false;
++}
++
++std::optional<ThreadPriorityForTest>
++GetCurrentThreadPriorityForPlatformForTest() {
++ return std::nullopt;
++}
++} // namespace internal
++
++// static
++void PlatformThreadBase::SetName(const std::string& name) {
++ SetNameCommon(name);
++}
++
++} // namespace base
diff --git a/electron34/patches/patch-base_threading_platform__thread__internal__posix.cc b/electron34/patches/patch-base_threading_platform__thread__internal__posix.cc
new file mode 100644
index 0000000000..4b28e15a38
--- /dev/null
+++ b/electron34/patches/patch-base_threading_platform__thread__internal__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/platform_thread_internal_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/threading/platform_thread_internal_posix.cc
+@@ -41,7 +41,7 @@ ThreadPriorityForTest NiceValueToThreadP
+ }
+
+ int GetCurrentThreadNiceValue() {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ NOTIMPLEMENTED();
+ return 0;
+ #else
diff --git a/electron34/patches/patch-base_threading_platform__thread__posix.cc b/electron34/patches/patch-base_threading_platform__thread__posix.cc
new file mode 100644
index 0000000000..b263ff3433
--- /dev/null
+++ b/electron34/patches/patch-base_threading_platform__thread__posix.cc
@@ -0,0 +1,59 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/platform_thread_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/threading/platform_thread_posix.cc
+@@ -77,11 +77,11 @@ void* ThreadFunc(void* params) {
+ if (!thread_params->joinable)
+ base::DisallowSingleton();
+
+-#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
++#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_BSD)
+ partition_alloc::internal::StackTopRegistry::Get().NotifyThreadCreated();
+ #endif
+
+-#if !BUILDFLAG(IS_NACL)
++#if !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_APPLE)
+ PlatformThread::SetCurrentThreadRealtimePeriodValue(
+ delegate->GetRealtimePeriod());
+@@ -265,6 +265,8 @@ PlatformThreadId PlatformThreadBase::Cur
+ return reinterpret_cast<int32_t>(pthread_self());
+ #elif BUILDFLAG(IS_POSIX) && BUILDFLAG(IS_AIX)
+ return pthread_self();
++#elif BUILDFLAG(IS_BSD)
++ return reinterpret_cast<uint64_t>(pthread_self());
+ #elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_AIX)
+ return reinterpret_cast<int64_t>(pthread_self());
+ #endif
+@@ -355,7 +357,7 @@ void PlatformThreadBase::Detach(Platform
+
+ // static
+ bool PlatformThreadBase::CanChangeThreadType(ThreadType from, ThreadType to) {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ if (from >= to) {
+@@ -376,6 +378,9 @@ void SetCurrentThreadTypeImpl(ThreadType
+ MessagePumpType pump_type_hint) {
+ #if BUILDFLAG(IS_NACL)
+ NOTIMPLEMENTED();
++// avoid pledge(2) violation
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
+ #else
+ if (internal::SetCurrentThreadTypeForPlatform(thread_type, pump_type_hint))
+ return;
+@@ -398,7 +403,7 @@ void SetCurrentThreadTypeImpl(ThreadType
+
+ // static
+ ThreadPriorityForTest PlatformThreadBase::GetCurrentThreadPriorityForTest() {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ NOTIMPLEMENTED();
+ return ThreadPriorityForTest::kNormal;
+ #else
diff --git a/electron34/patches/patch-base_threading_platform__thread__unittest.cc b/electron34/patches/patch-base_threading_platform__thread__unittest.cc
new file mode 100644
index 0000000000..334c0fb613
--- /dev/null
+++ b/electron34/patches/patch-base_threading_platform__thread__unittest.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/platform_thread_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/threading/platform_thread_unittest.cc
+@@ -38,7 +38,7 @@
+ #include "base/time/time.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <pthread.h>
+ #include <sys/syscall.h>
+ #include <sys/types.h>
+@@ -362,7 +362,7 @@ TEST(PlatformThreadTest,
+ // and hardcodes what we know. Please inform scheduler-dev%chromium.org@localhost if this
+ // proprerty changes for a given platform.
+ TEST(PlatformThreadTest, CanChangeThreadType) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Ubuntu, RLIMIT_NICE and RLIMIT_RTPRIO are 0 by default, so we won't be
+ // able to increase priority to any level unless we are root (euid == 0).
+ bool kCanIncreasePriority = false;
+@@ -616,12 +616,16 @@ INSTANTIATE_TEST_SUITE_P(
+
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace {
+
+ bool IsTidCacheCorrect() {
++#if BUILDFLAG(IS_BSD)
++ return PlatformThread::CurrentId() == reinterpret_cast<int64_t>(pthread_self());
++#else
+ return PlatformThread::CurrentId() == syscall(__NR_gettid);
++#endif
+ }
+
+ void* CheckTidCacheCorrectWrapper(void*) {
diff --git a/electron34/patches/patch-base_threading_thread__restrictions.h b/electron34/patches/patch-base_threading_thread__restrictions.h
new file mode 100644
index 0000000000..c0c209c7dd
--- /dev/null
+++ b/electron34/patches/patch-base_threading_thread__restrictions.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/threading/thread_restrictions.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/threading/thread_restrictions.h
+@@ -132,6 +132,7 @@ class KeyStorageLinux;
+ class NativeBackendKWallet;
+ class NativeDesktopMediaList;
+ class PartnerBookmarksReader;
++class ProcessSingleton;
+ class Profile;
+ class ProfileImpl;
+ class ScopedAllowBlockingForProfile;
+@@ -282,6 +283,9 @@ class BackendImpl;
+ class InFlightIO;
+ bool CleanupDirectorySync(const base::FilePath&);
+ } // namespace disk_cache
++namespace electron {
++class ScopedAllowBlockingForElectron;
++} // namespace electron
+ namespace enterprise_connectors {
+ class LinuxKeyRotationCommand;
+ } // namespace enterprise_connectors
+@@ -576,6 +580,7 @@ class BASE_EXPORT ScopedAllowBlocking {
+ friend class ::DesktopNotificationBalloon;
+ friend class ::FirefoxProfileLock;
+ friend class ::GaiaConfig;
++ friend class ::ProcessSingleton;
+ friend class ::ProfileImpl;
+ friend class ::ScopedAllowBlockingForProfile;
+ friend class ::StartupTabProviderImpl;
+@@ -616,6 +621,7 @@ class BASE_EXPORT ScopedAllowBlocking {
+ friend class crosapi::LacrosThreadTypeDelegate;
+ friend class crypto::ScopedAllowBlockingForNSS; // http://crbug.com/59847
+ friend class drive::FakeDriveService;
++ friend class electron::ScopedAllowBlockingForElectron;
+ friend class extensions::InstalledLoader;
+ friend class extensions::UnpackedInstaller;
+ friend class font_service::internal::MappedFontFile;
diff --git a/electron34/patches/patch-base_time_time__now__posix.cc b/electron34/patches/patch-base_time_time__now__posix.cc
new file mode 100644
index 0000000000..010d953ac4
--- /dev/null
+++ b/electron34/patches/patch-base_time_time__now__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/time/time_now_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/time/time_now_posix.cc
+@@ -27,7 +27,7 @@
+ #endif
+
+ // NaCl doesn't support CLOCK_MONOTONIC_COARSE.
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ #define TIMETICKS_LOW_RESOLUTION_CLOCK CLOCK_MONOTONIC
+ #else
+ #define TIMETICKS_LOW_RESOLUTION_CLOCK CLOCK_MONOTONIC_COARSE
diff --git a/electron34/patches/patch-base_trace__event_builtin__categories.h b/electron34/patches/patch-base_trace__event_builtin__categories.h
new file mode 100644
index 0000000000..cc219e84f7
--- /dev/null
+++ b/electron34/patches/patch-base_trace__event_builtin__categories.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/trace_event/builtin_categories.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/trace_event/builtin_categories.h
+@@ -88,6 +88,7 @@
+ X("drm") \
+ X("drmcursor") \
+ X("dwrite") \
++ X("electron") \
+ X("evdev") \
+ X("event") \
+ X("exo") \
diff --git a/electron34/patches/patch-base_trace__event_malloc__dump__provider.cc b/electron34/patches/patch-base_trace__event_malloc__dump__provider.cc
new file mode 100644
index 0000000000..6df00fbb47
--- /dev/null
+++ b/electron34/patches/patch-base_trace__event_malloc__dump__provider.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/trace_event/malloc_dump_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/trace_event/malloc_dump_provider.cc
+@@ -28,6 +28,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_BSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -178,7 +180,7 @@ void ReportAppleAllocStats(size_t* total
+
+ #if (PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && BUILDFLAG(IS_ANDROID)) || \
+ (!PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) && !BUILDFLAG(IS_WIN) && \
+- !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA))
++ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_BSD))
+ void ReportMallinfoStats(ProcessMemoryDump* pmd,
+ size_t* total_virtual_size,
+ size_t* resident_size,
+@@ -368,6 +370,9 @@ bool MallocDumpProvider::OnMemoryDump(co
+ &allocated_objects_count);
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(fuchsia): Port, see https://crbug.com/706592.
++#elif BUILDFLAG(IS_BSD)
++ total_virtual_size = 0;
++ allocated_objects_size = 0;
+ #else
+ ReportMallinfoStats(/*pmd=*/nullptr, &total_virtual_size, &resident_size,
+ &allocated_objects_size, &allocated_objects_count);
diff --git a/electron34/patches/patch-base_trace__event_memory__dump__manager.cc b/electron34/patches/patch-base_trace__event_memory__dump__manager.cc
new file mode 100644
index 0000000000..963a0d97c5
--- /dev/null
+++ b/electron34/patches/patch-base_trace__event_memory__dump__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/trace_event/memory_dump_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/trace_event/memory_dump_manager.cc
+@@ -83,7 +83,7 @@ const char* const MemoryDumpManager::kSy
+ #if defined(MALLOC_MEMORY_TRACING_SUPPORTED)
+ MallocDumpProvider::kAllocatedObjects;
+ #else
+- nullptr;
++ "";
+ #endif
+
+ // static
diff --git a/electron34/patches/patch-base_trace__event_process__memory__dump.cc b/electron34/patches/patch-base_trace__event_process__memory__dump.cc
new file mode 100644
index 0000000000..ee4fc83c32
--- /dev/null
+++ b/electron34/patches/patch-base_trace__event_process__memory__dump.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/trace_event/process_memory_dump.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/trace_event/process_memory_dump.cc
+@@ -120,7 +120,7 @@ std::optional<size_t> ProcessMemoryDump:
+ #if BUILDFLAG(IS_WIN)
+ auto vec =
+ base::HeapArray<PSAPI_WORKING_SET_EX_INFORMATION>::WithSize(max_vec_size);
+-#elif BUILDFLAG(IS_APPLE)
++#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ auto vec = base::HeapArray<char>::WithSize(max_vec_size);
+ #elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+ auto vec = base::HeapArray<unsigned char>::WithSize(max_vec_size);
+@@ -143,7 +143,7 @@ std::optional<size_t> ProcessMemoryDump:
+
+ for (size_t i = 0; i < page_count; i++)
+ resident_page_count += vec[i].VirtualAttributes.Valid;
+-#elif BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050620): Implement counting resident bytes.
+ // For now, log and avoid unused variable warnings.
+ NOTIMPLEMENTED_LOG_ONCE();
diff --git a/electron34/patches/patch-base_tracing_trace__time.cc b/electron34/patches/patch-base_tracing_trace__time.cc
new file mode 100644
index 0000000000..74012e48e2
--- /dev/null
+++ b/electron34/patches/patch-base_tracing_trace__time.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/tracing/trace_time.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/tracing/trace_time.cc
+@@ -8,13 +8,19 @@
+ #include "build/build_config.h"
+ #include "third_party/perfetto/include/perfetto/base/time.h"
+
++#if BUILDFLAG(IS_FREEBSD)
++#define CLOCK_BOOTTIME CLOCK_UPTIME
++#elif BUILDFLAG(IS_NETBSD)
++#define CLOCK_BOOTTIME CLOCK_MONOTONIC
++#endif
++
+ namespace base {
+ namespace tracing {
+
+ int64_t TraceBootTicksNow() {
+ // On Windows and Mac, TRACE_TIME_TICKS_NOW() behaves like boottime already.
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ struct timespec ts;
+ int res = clock_gettime(CLOCK_BOOTTIME, &ts);
+ if (res != -1)
+@@ -24,4 +30,4 @@ int64_t TraceBootTicksNow() {
+ }
+
+ } // namespace tracing
+-} // namespace base
+\ No newline at end of file
++} // namespace base
diff --git a/electron34/patches/patch-base_tracing_trace__time.h b/electron34/patches/patch-base_tracing_trace__time.h
new file mode 100644
index 0000000000..09dab0fe51
--- /dev/null
+++ b/electron34/patches/patch-base_tracing_trace__time.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/tracing/trace_time.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/tracing/trace_time.h
+@@ -12,7 +12,7 @@ namespace base {
+ namespace tracing {
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Linux, Android, and Fuchsia all use CLOCK_MONOTONIC. See crbug.com/166153
+ // about efforts to unify base::TimeTicks across all platforms.
+ constexpr perfetto::protos::pbzero::BuiltinClock kTraceClockId =
diff --git a/electron34/patches/patch-base_version__info_version__info.h b/electron34/patches/patch-base_version__info_version__info.h
new file mode 100644
index 0000000000..fb2bb0e64a
--- /dev/null
+++ b/electron34/patches/patch-base_version__info_version__info.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/version_info/version_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/version_info/version_info.h
+@@ -74,6 +74,8 @@ constexpr std::string_view GetOSType() {
+ return "FreeBSD";
+ #elif BUILDFLAG(IS_OPENBSD)
+ return "OpenBSD";
++#elif BUILDFLAG(IS_NETBSD)
++ return "NetBSD";
+ #elif BUILDFLAG(IS_SOLARIS)
+ return "Solaris";
+ #elif BUILDFLAG(IS_FUCHSIA)
diff --git a/electron34/patches/patch-base_win_shortcut.cc b/electron34/patches/patch-base_win_shortcut.cc
new file mode 100644
index 0000000000..937ba157be
--- /dev/null
+++ b/electron34/patches/patch-base_win_shortcut.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/win/shortcut.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/win/shortcut.cc
+@@ -289,14 +289,22 @@ bool ResolveShortcutProperties(const Fil
+ return false;
+ }
+ switch (pv_app_id.get().vt) {
+- case VT_EMPTY:
++ case VT_EMPTY: {
+ properties->set_app_id(std::wstring());
+ break;
+- case VT_LPWSTR:
++ }
++ case VT_LPWSTR: {
+ properties->set_app_id(pv_app_id.get().pwszVal);
+ break;
+- default:
++ }
++ case VT_BSTR: {
++ BSTR bs = pv_app_id.get().bstrVal;
++ properties->set_app_id(std::wstring(bs, ::SysStringLen(bs)));
++ break;
++ }
++ default: {
+ NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
++ }
+ }
+ }
+
+@@ -334,8 +342,9 @@ bool ResolveShortcutProperties(const Fil
+ *(pv_toast_activator_clsid.get().puuid));
+ break;
+ default:
+- NOTREACHED() << "Unexpected variant type: "
+- << pv_toast_activator_clsid.get().vt;
++ // Shortcuts may use strings to represent the CLSID. This case is
++ // ignored.
++ break;
+ }
+ }
+ }
diff --git a/electron34/patches/patch-base_win_win__util.h b/electron34/patches/patch-base_win_win__util.h
new file mode 100644
index 0000000000..bfbc25f882
--- /dev/null
+++ b/electron34/patches/patch-base_win_win__util.h
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/win/win_util.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/win/win_util.h
+@@ -46,6 +46,25 @@ struct NativeLibraryLoadError;
+
+ namespace win {
+
++inline bool IsPseudoHandle(HANDLE h) {
++ // Note that there appears to be no official documentation covering the
++ // existence of specific pseudo handle values. In practice it's clear that
++ // e.g. -1 is the current process, -2 is the current thread, etc. The largest
++ // negative value known to be an issue with DuplicateHandle in fuzzers is
++ // -12.
++ //
++ // Note that there is virtually no risk of a real handle value falling within
++ // this range and being misclassified as a pseudo handle.
++ //
++ // Cast through uintptr_t and then unsigned int to make the truncation to
++ // 32 bits explicit. Handles are size of-pointer but are always 32-bit values.
++ // https://msdn.microsoft.com/en-us/library/aa384203(VS.85).aspx says:
++ // 64-bit versions of Windows use 32-bit handles for interoperability.
++ constexpr int kMinimumKnownPseudoHandleValue = -12;
++ const auto value = static_cast<int32_t>(reinterpret_cast<uintptr_t>(h));
++ return value < 0 && value >= kMinimumKnownPseudoHandleValue;
++}
++
+ inline uint32_t HandleToUint32(HANDLE h) {
+ // Cast through uintptr_t and then unsigned int to make the truncation to
+ // 32 bits explicit. Handles are size of-pointer but are always 32-bit values.
diff --git a/electron34/patches/patch-base_win_win__util__unittest.cc b/electron34/patches/patch-base_win_win__util__unittest.cc
new file mode 100644
index 0000000000..53cf35c58e
--- /dev/null
+++ b/electron34/patches/patch-base_win_win__util__unittest.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/win/win_util_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ base/win/win_util_unittest.cc
+@@ -84,6 +84,12 @@ TEST(BaseWinUtilTest, TestUint32ToInvali
+ EXPECT_EQ(INVALID_HANDLE_VALUE, Uint32ToHandle(invalid_handle));
+ }
+
++TEST(BaseWinUtilTest, PseudoHandles) {
++ EXPECT_TRUE(IsPseudoHandle(::GetCurrentProcess()));
++ EXPECT_TRUE(IsPseudoHandle(::GetCurrentThread()));
++ EXPECT_FALSE(IsPseudoHandle(nullptr));
++}
++
+ TEST(BaseWinUtilTest, WStringFromGUID) {
+ const GUID kGuid = {0x7698f759,
+ 0xf5b0,
diff --git a/electron34/patches/patch-build_config_BUILD.gn b/electron34/patches/patch-build_config_BUILD.gn
new file mode 100644
index 0000000000..e738be88dc
--- /dev/null
+++ b/electron34/patches/patch-build_config_BUILD.gn
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/BUILD.gn
+@@ -215,6 +215,10 @@ config("default_libs") {
+ # Targets should choose to explicitly link frameworks they require. Since
+ # linking can have run-time side effects, nothing should be listed here.
+ libs = []
++ } else if (is_bsd) {
++ libs = [
++ "pthread",
++ ]
+ } else if (is_linux || is_chromeos) {
+ libs = [
+ "dl",
diff --git a/electron34/patches/patch-build_config_BUILDCONFIG.gn b/electron34/patches/patch-build_config_BUILDCONFIG.gn
new file mode 100644
index 0000000000..249952e4ac
--- /dev/null
+++ b/electron34/patches/patch-build_config_BUILDCONFIG.gn
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/BUILDCONFIG.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/BUILDCONFIG.gn
+@@ -123,6 +123,9 @@ if (current_os == "") {
+ # even if the value is overridden, which is wasteful. See first bullet.
+
+ declare_args() {
++ is_electron_build = false
++ is_mas_build = false
++
+ # Set to enable the official build level of optimization. This has nothing
+ # to do with branding, but enables an additional level of optimization above
+ # release (!is_debug). This might be better expressed as a tri-state
+@@ -136,7 +139,8 @@ declare_args() {
+ is_official_build = false
+
+ # Set to true when compiling with the Clang compiler.
+- is_clang = current_os != "linux" ||
++ is_clang = current_os != "linux" || current_os == "openbsd" ||
++ current_os == "freebsd" || current_os == "netbsd" ||
+ (current_cpu != "s390x" && current_cpu != "s390" &&
+ current_cpu != "ppc64" && current_cpu != "ppc" &&
+ current_cpu != "mips" && current_cpu != "mips64" &&
+@@ -234,6 +238,12 @@ if (host_toolchain == "") {
+ host_toolchain = "//build/toolchain/aix:$host_cpu"
+ } else if (host_os == "zos") {
+ host_toolchain = "//build/toolchain/zos:$host_cpu"
++ } else if (host_os == "openbsd") {
++ host_toolchain = "//build/toolchain/openbsd:clang_$host_cpu"
++ } else if (host_os == "freebsd") {
++ host_toolchain = "//build/toolchain/freebsd:clang_$host_cpu"
++ } else if (host_os == "netbsd") {
++ host_toolchain = "//build/toolchain/netbsd:clang_$host_cpu"
+ } else {
+ assert(false, "Unsupported host_os: $host_os")
+ }
+@@ -278,6 +288,8 @@ if (target_os == "android") {
+ _default_toolchain = "//build/toolchain/aix:$target_cpu"
+ } else if (target_os == "zos") {
+ _default_toolchain = "//build/toolchain/zos:$target_cpu"
++} else if (target_os == "openbsd" || target_os == "freebsd" || target_os == "netbsd") {
++ _default_toolchain = host_toolchain
+ } else {
+ assert(false, "Unsupported target_os: $target_os")
+ }
+@@ -312,7 +324,12 @@ is_android = current_os == "android"
+ is_chromeos = current_os == "chromeos"
+ is_fuchsia = current_os == "fuchsia"
+ is_ios = current_os == "ios"
+-is_linux = current_os == "linux"
++is_linux = current_os == "linux" || current_os == "openbsd" ||
++ current_os == "freebsd" || current_os == "netbsd"
++is_openbsd = current_os == "openbsd"
++is_freebsd = current_os == "freebsd"
++is_netbsd = current_os == "netbsd"
++is_bsd = current_os == "openbsd" || current_os == "freebsd" || current_os == "netbsd"
+ is_mac = current_os == "mac"
+ is_nacl = current_os == "nacl"
+ is_watchos = current_os == "watchos"
diff --git a/electron34/patches/patch-build_config_clang_BUILD.gn b/electron34/patches/patch-build_config_clang_BUILD.gn
new file mode 100644
index 0000000000..4bb9acd93e
--- /dev/null
+++ b/electron34/patches/patch-build_config_clang_BUILD.gn
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/clang/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/clang/BUILD.gn
+@@ -213,7 +213,12 @@ template("clang_lib") {
+
+ # Adds a dependency on the Clang runtime library clang_rt.builtins.
+ clang_lib("compiler_builtins") {
+- if (is_mac) {
++ if (is_bsd) {
++ # Since there's no Rust in the toolchain, there's no concern that we'll use
++ # the Rust stdlib's intrinsics here.
++ #
++ # Don't define libname which makes this target do nothing.
++ } else if (is_mac) {
+ libname = "osx"
+ } else if (is_ios) {
+ if (target_environment == "simulator") {
diff --git a/electron34/patches/patch-build_config_compiler_BUILD.gn b/electron34/patches/patch-build_config_compiler_BUILD.gn
new file mode 100644
index 0000000000..8c8d80e40c
--- /dev/null
+++ b/electron34/patches/patch-build_config_compiler_BUILD.gn
@@ -0,0 +1,137 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/compiler/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/compiler/BUILD.gn
+@@ -199,7 +199,7 @@ declare_args() {
+ # This greatly reduces the size of debug builds, at the cost of
+ # debugging information which is required by some specialized
+ # debugging tools.
+- simple_template_names = is_clang && !is_nacl && !is_win && !is_apple
++ simple_template_names = is_clang && !is_nacl && !is_win && !is_apple && !is_bsd
+ }
+
+ declare_args() {
+@@ -256,13 +256,16 @@ config("default_include_dirs") {
+ # Compiler instrumentation can introduce dependencies in DSOs to symbols in
+ # the executable they are loaded into, so they are unresolved at link-time.
+ config("no_unresolved_symbols") {
+- if (!using_sanitizer &&
++ if (!using_sanitizer && !is_bsd &&
+ (is_linux || is_chromeos || is_android || is_fuchsia)) {
+ ldflags = [
+ "-Wl,-z,defs",
+ "-Wl,--as-needed",
+ ]
+ }
++ if (current_cpu == "x86" && is_openbsd) {
++ ldflags = [ "-Wl,-z,notext", "-Wl,--strip-all" ]
++ }
+ }
+
+ # compiler ---------------------------------------------------------------------
+@@ -509,6 +512,10 @@ config("compiler") {
+ }
+ }
+
++ if (is_openbsd) {
++ ldflags += [ "-Wl,-z,wxneeded" ]
++ }
++
+ # Linux-specific compiler flags setup.
+ # ------------------------------------
+ if (use_icf && (!is_apple || use_lld)) {
+@@ -568,7 +575,7 @@ config("compiler") {
+ ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
+ }
+
+- if (is_clang && !is_nacl) {
++ if (is_clang && !is_nacl && !is_bsd) {
+ cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
+ if (save_reproducers_on_lld_crash && use_lld) {
+ ldflags += [
+@@ -1241,7 +1248,7 @@ config("compiler_cpu_abi") {
+ ]
+ }
+ } else if (current_cpu == "arm") {
+- if (is_clang && !is_android && !is_nacl && !is_chromeos_device) {
++ if (is_clang && !is_android && !is_nacl && !is_chromeos_device && !is_bsd) {
+ cflags += [ "--target=arm-linux-gnueabihf" ]
+ ldflags += [ "--target=arm-linux-gnueabihf" ]
+ }
+@@ -1256,7 +1263,7 @@ config("compiler_cpu_abi") {
+ }
+ } else if (current_cpu == "arm64") {
+ if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
+- !is_chromeos_device) {
++ !is_chromeos_device && !is_bsd) {
+ cflags += [ "--target=aarch64-linux-gnu" ]
+ ldflags += [ "--target=aarch64-linux-gnu" ]
+ }
+@@ -1590,7 +1597,7 @@ config("compiler_deterministic") {
+ # different build directory like "out/feature_a" and "out/feature_b" if
+ # we build same files with same compile flag.
+ # Other paths are already given in relative, no need to normalize them.
+- if (is_nacl) {
++ if (is_nacl || is_bsd) {
+ # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
+ cflags += [
+ "-Xclang",
+@@ -1648,7 +1655,7 @@ config("compiler_deterministic") {
+ }
+
+ config("clang_revision") {
+- if (is_clang && clang_base_path == default_clang_base_path &&
++ if (is_clang && !is_bsd && clang_base_path == default_clang_base_path &&
+ current_os != "zos") {
+ update_args = [
+ "--print-revision",
+@@ -1972,9 +1979,6 @@ config("default_warnings") {
+ cflags += [
+ # TODO(crbug.com/330524456): -Wcast-function-type is under -Wextra now.
+ "-Wno-cast-function-type",
+-
+- # TODO(crbug.com/40284799): Fix and re-enable.
+- "-Wno-thread-safety-reference-return",
+ ]
+
+ cflags_cc += [
+@@ -2306,7 +2310,7 @@ config("export_dynamic") {
+ # 2. Remove the thin_archive config, so that the .a file actually contains all
+ # .o files, instead of just references to .o files in the build directoy
+ config("thin_archive") {
+- if ((is_apple && use_lld) || (is_linux && !is_clang)) {
++ if ((is_apple && use_lld) || (is_linux && !is_clang) || (is_netbsd)) {
+ # The macOS and iOS linker ld64.ldd doesn't support thin archive without
+ # symbol table, gcc on linux also throws the error `archive has no index`.
+ arflags = [
+@@ -2761,7 +2765,7 @@ config("afdo_optimize_size") {
+ # There are some targeted places that AFDO regresses, so we provide a separate
+ # config to allow AFDO to be disabled per-target.
+ config("afdo") {
+- if (is_clang) {
++ if (is_clang && !is_bsd) {
+ cflags = []
+ if (clang_emit_debug_info_for_profiling) {
+ # Add the following flags to generate debug info for profiling.
+@@ -2788,7 +2792,7 @@ config("afdo") {
+ cflags += [ "-Wno-backend-plugin" ]
+ inputs = [ _clang_sample_profile ]
+ }
+- } else if (auto_profile_path != "" && is_a_target_toolchain) {
++ } else if (auto_profile_path != "" && is_a_target_toolchain && !is_bsd) {
+ cflags = [ "-fauto-profile=${auto_profile_path}" ]
+ inputs = [ auto_profile_path ]
+ }
+@@ -2965,7 +2969,7 @@ config("symbols") {
+ cflags += [ "-gomit-unreferenced-methods" ]
+ }
+
+- if (is_clang && (!is_nacl || is_nacl_saigo)) {
++ if (is_clang && (!is_nacl || is_nacl_saigo) && !is_bsd) {
+ if (is_apple) {
+ # TODO(crbug.com/40117949): Investigate missing debug info on mac.
+ # Make sure we don't use constructor homing on mac.
diff --git a/electron34/patches/patch-build_config_gcc_BUILD.gn b/electron34/patches/patch-build_config_gcc_BUILD.gn
new file mode 100644
index 0000000000..d1f1efca36
--- /dev/null
+++ b/electron34/patches/patch-build_config_gcc_BUILD.gn
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/gcc/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/gcc/BUILD.gn
+@@ -32,7 +32,9 @@ declare_args() {
+ # See http://gcc.gnu.org/wiki/Visibility
+ config("symbol_visibility_hidden") {
+ cflags = [ "-fvisibility=hidden" ]
+- rustflags = [ "-Zdefault-visibility=hidden" ]
++ if (!is_bsd) {
++ rustflags = [ "-Zdefault-visibility=hidden" ]
++ }
+
+ # Visibility attribute is not supported on AIX.
+ if (current_os != "aix") {
diff --git a/electron34/patches/patch-build_config_linux_BUILD.gn b/electron34/patches/patch-build_config_linux_BUILD.gn
new file mode 100644
index 0000000000..7c27a7d0ae
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/BUILD.gn
+@@ -41,7 +41,7 @@ config("runtime_library") {
+ }
+
+ if ((!is_chromeos || default_toolchain != "//build/toolchain/cros:target") &&
+- (!use_custom_libcxx || current_cpu == "mipsel")) {
++ (!use_custom_libcxx || current_cpu == "mipsel") && !is_bsd) {
+ libs = [ "atomic" ]
+ }
+ }
diff --git a/electron34/patches/patch-build_config_linux_atk_BUILD.gn b/electron34/patches/patch-build_config_linux_atk_BUILD.gn
new file mode 100644
index 0000000000..da9ed63956
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_atk_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/atk/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/atk/BUILD.gn
+@@ -11,7 +11,7 @@ import("//build/config/ui.gni")
+ assert(!is_chromeos)
+
+ # These packages should _only_ be expected when building for a target.
+-assert(current_toolchain == default_toolchain)
++#assert(current_toolchain == default_toolchain)
+
+ if (use_atk) {
+ assert(use_glib, "use_atk=true requires that use_glib=true")
diff --git a/electron34/patches/patch-build_config_linux_atspi2_BUILD.gn b/electron34/patches/patch-build_config_linux_atspi2_BUILD.gn
new file mode 100644
index 0000000000..f416c4c78c
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_atspi2_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/atspi2/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/atspi2/BUILD.gn
+@@ -6,7 +6,6 @@ import("//build/config/linux/pkg_config.
+ import("//build/config/ui.gni")
+
+ # These packages should _only_ be expected when building for a target.
+-assert(current_toolchain == default_toolchain)
+
+ if (use_atk) {
+ pkg_config("atspi2") {
diff --git a/electron34/patches/patch-build_config_linux_gtk_BUILD.gn b/electron34/patches/patch-build_config_linux_gtk_BUILD.gn
new file mode 100644
index 0000000000..7788dc4d92
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_gtk_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/gtk/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/gtk/BUILD.gn
+@@ -27,6 +27,7 @@ pkg_config("gtk_internal_config") {
+
+ group("gtk") {
+ visibility = [
++ "//electron:*",
+ # These are allow-listed for WebRTC builds. Nothing in else should depend
+ # on GTK.
+ "//examples:peerconnection_client",
diff --git a/electron34/patches/patch-build_config_linux_libdrm_BUILD.gn b/electron34/patches/patch-build_config_linux_libdrm_BUILD.gn
new file mode 100644
index 0000000000..be3adb6dfa
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_libdrm_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/libdrm/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/libdrm/BUILD.gn
+@@ -15,7 +15,7 @@ declare_args() {
+ }
+
+ if (use_system_libdrm) {
+- assert(!is_linux, "System libdrm is not supported in linux")
++# assert(!is_linux, "System libdrm is not supported in linux")
+ pkg_config("libdrm_config") {
+ packages = [ "libdrm" ]
+ }
diff --git a/electron34/patches/patch-build_config_linux_pkg-config.py b/electron34/patches/patch-build_config_linux_pkg-config.py
new file mode 100644
index 0000000000..015acaaf85
--- /dev/null
+++ b/electron34/patches/patch-build_config_linux_pkg-config.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/linux/pkg-config.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/linux/pkg-config.py
+@@ -108,7 +108,7 @@ def main():
+ # If this is run on non-Linux platforms, just return nothing and indicate
+ # success. This allows us to "kind of emulate" a Linux build from other
+ # platforms.
+- if "linux" not in sys.platform:
++ if not sys.platform.startswith(tuple(['linux', 'openbsd', 'freebsd', 'netbsd'])):
+ print("[[],[],[],[],[]]")
+ return 0
+
diff --git a/electron34/patches/patch-build_config_ozone.gni b/electron34/patches/patch-build_config_ozone.gni
new file mode 100644
index 0000000000..315ce1957e
--- /dev/null
+++ b/electron34/patches/patch-build_config_ozone.gni
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/ozone.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/ozone.gni
+@@ -84,7 +84,23 @@ declare_args() {
+ } else if (is_chromeos_lacros) {
+ ozone_platform = "wayland"
+ ozone_platform_wayland = true
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = true
++ ozone_platform_x11 = true
++ } else if (is_openbsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = false
++ ozone_platform_x11 = true
++ } else if (is_netbsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = false
++ ozone_platform_x11 = true
++ } else if (is_netbsd) {
++ ozone_platform = "x11"
++ ozone_platform_wayland = false
++ ozone_platform_x11 = true
++ } else if (is_freebsd) {
+ ozone_platform = "x11"
+ ozone_platform_wayland = true
+ ozone_platform_x11 = true
diff --git a/electron34/patches/patch-build_config_rust.gni b/electron34/patches/patch-build_config_rust.gni
new file mode 100644
index 0000000000..2acd7f4c38
--- /dev/null
+++ b/electron34/patches/patch-build_config_rust.gni
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/rust.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/rust.gni
+@@ -178,7 +178,7 @@ if (is_linux || is_chromeos) {
+ rust_abi_target = "aarch64-unknown-linux-gnu"
+ cargo_target_abi = ""
+ } else if (current_cpu == "x86") {
+- rust_abi_target = "i686-unknown-linux-gnu"
++ rust_abi_target = "i586-unknown-linux-gnu"
+ cargo_target_abi = ""
+ } else if (current_cpu == "x64") {
+ rust_abi_target = "x86_64-unknown-linux-gnu"
+@@ -298,6 +298,10 @@ if (is_linux || is_chromeos) {
+ }
+ }
+
++if (is_bsd) {
++ rust_abi_target = string_replace(rust_abi_target, "linux-gnu", current_os)
++}
++
+ assert(!toolchain_has_rust || rust_abi_target != "")
+
+ # This variable is passed to the Rust libstd build.
diff --git a/electron34/patches/patch-build_config_v8__target__cpu.gni b/electron34/patches/patch-build_config_v8__target__cpu.gni
new file mode 100644
index 0000000000..86837ae9b2
--- /dev/null
+++ b/electron34/patches/patch-build_config_v8__target__cpu.gni
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/config/v8_target_cpu.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/config/v8_target_cpu.gni
+@@ -36,6 +36,10 @@ declare_args() {
+ if (v8_target_cpu == "") {
+ if (current_toolchain == "//build/toolchain/linux:clang_x64_v8_arm64") {
+ v8_target_cpu = "arm64"
++ } else if (current_toolchain == "//build/toolchain/openbsd:clang_arm64") {
++ v8_target_cpu = "arm64"
++ } else if (current_toolchain == "//build/toolchain/freebsd:clang_arm64") {
++ v8_target_cpu = "arm64"
+ } else if (current_toolchain == "//build/toolchain/linux:clang_x86_v8_arm") {
+ v8_target_cpu = "arm"
+ } else if (current_toolchain ==
diff --git a/electron34/patches/patch-build_detect__host__arch.py b/electron34/patches/patch-build_detect__host__arch.py
new file mode 100644
index 0000000000..f4fa1b7a43
--- /dev/null
+++ b/electron34/patches/patch-build_detect__host__arch.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/detect_host_arch.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/detect_host_arch.py
+@@ -20,6 +20,8 @@ def HostArch():
+ host_arch = 'ia32'
+ elif host_arch in ['x86_64', 'amd64']:
+ host_arch = 'x64'
++ elif host_arch.startswith('arm64'):
++ host_arch = 'arm64'
+ elif host_arch.startswith('arm'):
+ host_arch = 'arm'
+ elif host_arch.startswith('aarch64'):
diff --git a/electron34/patches/patch-build_gn__run__binary.py b/electron34/patches/patch-build_gn__run__binary.py
new file mode 100644
index 0000000000..f7ab76b269
--- /dev/null
+++ b/electron34/patches/patch-build_gn__run__binary.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/gn_run_binary.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/gn_run_binary.py
+@@ -23,7 +23,7 @@ if not os.path.isabs(path):
+ # The rest of the arguments are passed directly to the executable.
+ args = [path] + sys.argv[2:]
+
+-ret = subprocess.call(args)
++ret = subprocess.call(args, env={"CHROME_EXE_PATH":"@WRKSRC@/out/Release/chrome","LD_LIBRARY_PATH":"@WRKSRC@/out/Release"})
+ if ret != 0:
+ if ret <= -100:
+ # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to
diff --git a/electron34/patches/patch-build_linux_chrome.map b/electron34/patches/patch-build_linux_chrome.map
new file mode 100644
index 0000000000..0cab8654b3
--- /dev/null
+++ b/electron34/patches/patch-build_linux_chrome.map
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/linux/chrome.map.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/linux/chrome.map
+@@ -20,6 +20,10 @@ global:
+ # Program entry point.
+ _start;
+
++ # FreeBSD specific variables.
++ __progname;
++ environ;
++
+ # Memory allocation symbols. We want chrome and any libraries to
+ # share the same heap, so it is correct to export these symbols.
+ aligned_alloc;
diff --git a/electron34/patches/patch-build_linux_strip__binary.py b/electron34/patches/patch-build_linux_strip__binary.py
new file mode 100644
index 0000000000..55ada72d7f
--- /dev/null
+++ b/electron34/patches/patch-build_linux_strip__binary.py
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/linux/strip_binary.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/linux/strip_binary.py
+@@ -10,6 +10,7 @@ import sys
+
+
+ def main():
++ return 0
+ argparser = argparse.ArgumentParser(description='eu-strip binary.')
+
+ argparser.add_argument('--eu-strip-binary-path', help='eu-strip path.')
diff --git a/electron34/patches/patch-build_linux_unbundle_icu.gn b/electron34/patches/patch-build_linux_unbundle_icu.gn
new file mode 100644
index 0000000000..51c54a9a52
--- /dev/null
+++ b/electron34/patches/patch-build_linux_unbundle_icu.gn
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/linux/unbundle/icu.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/linux/unbundle/icu.gn
+@@ -17,6 +17,15 @@ config("icu_config") {
+ "USING_SYSTEM_ICU=1",
+ "ICU_UTIL_DATA_IMPL=ICU_UTIL_DATA_STATIC",
+
++ # As of icu 73 C++ nullptr, char16_t, override, final and noexcept are used
++ # instead of defines. These definitions can be removed when the bundled icu
++ # gets updated to 73. For more details, see:
++ # https://unicode-org.atlassian.net/browse/ICU-21833 and
++ # https://github.com/unicode-org/icu/commit/28643799377ecf654564f6f31854b02788cebe33
++ "U_FINAL=final",
++ "U_NOEXCEPT=noexcept",
++ "U_OVERRIDE=override",
++
+ # U_EXPORT (defined in unicode/platform.h) is used to set public visibility
+ # on classes through the U_COMMON_API and U_I18N_API macros (among others).
+ # When linking against the system ICU library, we want its symbols to have
+@@ -34,6 +43,9 @@ config("icu_config") {
+ # to define U_IMPORT to have the same value as U_EXPORT. For more details,
+ # please see: https://crbug.com/822820
+ "U_IMPORT=U_EXPORT",
++
++ # Unbreak with icu 76 where private symbols are picked up
++ "U_HIDE_DRAFT_API",
+ ]
+ }
+
+@@ -53,6 +65,14 @@ source_set("icui18n") {
+ ]
+ }
+
++source_set("icui18n_hidden_visibility") {
++ deps = [ ":icui18n_shim" ]
++ public_configs = [
++ ":icu_config",
++ ":system_icui18n",
++ ]
++}
++
+ source_set("icuuc") {
+ deps = [ ":icuuc_shim" ]
+ public_configs = [
diff --git a/electron34/patches/patch-build_linux_unbundle_libevent.gn b/electron34/patches/patch-build_linux_unbundle_libevent.gn
new file mode 100644
index 0000000000..1fc166d1ad
--- /dev/null
+++ b/electron34/patches/patch-build_linux_unbundle_libevent.gn
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/linux/unbundle/libevent.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/linux/unbundle/libevent.gn
+@@ -9,7 +9,12 @@ shim_headers("libevent_shim") {
+ headers = [ "event.h" ]
+ }
+
++config("system_libevent") {
++ defines = [ "USE_SYSTEM_LIBEVENT=1" ]
++}
++
+ source_set("libevent") {
+ deps = [ ":libevent_shim" ]
+ libs = [ "event" ]
++ public_configs = [ ":system_libevent" ]
+ }
diff --git a/electron34/patches/patch-build_linux_unbundle_libusb.gn b/electron34/patches/patch-build_linux_unbundle_libusb.gn
new file mode 100644
index 0000000000..752b225cfa
--- /dev/null
+++ b/electron34/patches/patch-build_linux_unbundle_libusb.gn
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/linux/unbundle/libusb.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/linux/unbundle/libusb.gn
+@@ -1,3 +1,27 @@
++# Copyright 2016 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/linux/pkg_config.gni")
++import("//build/shim_headers.gni")
++
++pkg_config("system_libusb") {
++ packages = [ "libusb-1.0" ]
++}
++
++shim_headers("libusb_shim") {
++ root_path = "src/libusb"
++ headers = [
++ "libusb.h",
++ ]
++}
++
++source_set("libusb") {
++ deps = [
++ ":libusb_shim",
++ ]
++ public_configs = [ ":system_libusb" ]
++}
+ import("//build/config/linux/pkg_config.gni")
+ import("//build/shim_headers.gni")
+
diff --git a/electron34/patches/patch-build_rust_allocator_BUILD.gn b/electron34/patches/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 0000000000..1d265b3a3a
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,115 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/BUILD.gn.orig 2025-05-24 17:57:53.367304596 +0000
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,106 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++
++ # TODO(https://crbug.com/410596442): Stop using unstable features here.
++ configs -= [ "//build/config/compiler:disallow_unstable_features" ]
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/electron34/patches/patch-build_rust_allocator_DEPS b/electron34/patches/patch-build_rust_allocator_DEPS
new file mode 100644
index 0000000000..ee54a3f19e
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_DEPS
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/DEPS.orig 2025-05-24 17:57:53.367438514 +0000
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/electron34/patches/patch-build_rust_allocator_alias.cc b/electron34/patches/patch-build_rust_allocator_alias.cc
new file mode 100644
index 0000000000..129dbd9c15
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/alias.cc.orig 2025-05-24 17:57:53.367560759 +0000
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/electron34/patches/patch-build_rust_allocator_alias.h b/electron34/patches/patch-build_rust_allocator_alias.h
new file mode 100644
index 0000000000..98fce59ddc
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_alias.h
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/alias.h.orig 2025-05-24 17:57:53.367680390 +0000
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.cc b/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 0000000000..9531b5171a
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-24 17:57:53.367801744 +0000
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.h b/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 0000000000..bbb0d8091a
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-24 17:57:53.367920703 +0000
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/electron34/patches/patch-build_rust_allocator_allocator__impls.cc b/electron34/patches/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 0000000000..0abbb435f5
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,114 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-24 17:57:53.368040764 +0000
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/electron34/patches/patch-build_rust_allocator_allocator__impls.h b/electron34/patches/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 0000000000..cd8fd30ca0
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-24 17:57:53.368171065 +0000
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/electron34/patches/patch-build_rust_allocator_allocator__impls__ffi.rs b/electron34/patches/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 0000000000..03bff8b677
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-24 17:57:53.368292349 +0000
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/electron34/patches/patch-build_rust_allocator_compiler__specific.h b/electron34/patches/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 0000000000..ae6a0809d4
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-24 17:57:53.368427048 +0000
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/electron34/patches/patch-build_rust_allocator_immediate__crash.h b/electron34/patches/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 0000000000..0b6c2133da
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,180 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-24 17:57:53.368560986 +0000
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/electron34/patches/patch-build_rust_allocator_lib.rs b/electron34/patches/patch-build_rust_allocator_lib.rs
new file mode 100644
index 0000000000..6b1512f6f9
--- /dev/null
+++ b/electron34/patches/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,128 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/allocator/lib.rs.orig 2025-05-24 17:57:53.368701347 +0000
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/electron34/patches/patch-build_rust_cargo__crate.gni b/electron34/patches/patch-build_rust_cargo__crate.gni
new file mode 100644
index 0000000000..25bf37b3fb
--- /dev/null
+++ b/electron34/patches/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/cargo_crate.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/cargo_crate.gni
+@@ -267,6 +267,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -505,6 +511,9 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
++
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
+ # be $root_out_dir for all EXEs. In component build, C++ links to the
diff --git a/electron34/patches/patch-build_rust_rust__bindgen.gni b/electron34/patches/patch-build_rust_rust__bindgen.gni
new file mode 100644
index 0000000000..c45c39330e
--- /dev/null
+++ b/electron34/patches/patch-build_rust_rust__bindgen.gni
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/rust_bindgen.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/rust_bindgen.gni
+@@ -12,14 +12,14 @@ if (is_win) {
+ import("//build/toolchain/win/win_toolchain_data.gni")
+ }
+
+-_bindgen_path = "${rust_bindgen_root}/bin/bindgen"
++_bindgen_path = "@PREFIX@/bin/bindgen"
+ if (host_os == "win") {
+ _bindgen_path = "${_bindgen_path}.exe"
+ }
+
+ # On Windows, the libclang.dll is beside the bindgen.exe, otherwise it is in
+ # ../lib.
+-_libclang_path = rust_bindgen_root
++_libclang_path = "@PREFIX@"
+ if (host_os == "win") {
+ _libclang_path += "/bin"
+ } else {
diff --git a/electron34/patches/patch-build_rust_rust__bindgen__generator.gni b/electron34/patches/patch-build_rust_rust__bindgen__generator.gni
new file mode 100644
index 0000000000..046d2290ac
--- /dev/null
+++ b/electron34/patches/patch-build_rust_rust__bindgen__generator.gni
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/rust_bindgen_generator.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/rust_bindgen_generator.gni
+@@ -11,14 +11,14 @@ if (is_win) {
+ import("//build/toolchain/win/win_toolchain_data.gni")
+ }
+
+-_bindgen_path = "${rust_bindgen_root}/bin/bindgen"
++_bindgen_path = "@PREFIX@/bin/bindgen"
+ if (host_os == "win") {
+ _bindgen_path = "${_bindgen_path}.exe"
+ }
+
+ # On Windows, the libclang.dll is beside the bindgen.exe, otherwise it is in
+ # ../lib.
+-_libclang_path = rust_bindgen_root
++_libclang_path = "@PREFIX@"
+ if (host_os == "win") {
+ _libclang_path += "/bin"
+ } else {
diff --git a/electron34/patches/patch-build_rust_rust__macro.gni b/electron34/patches/patch-build_rust_rust__macro.gni
new file mode 100644
index 0000000000..384d43d1ee
--- /dev/null
+++ b/electron34/patches/patch-build_rust_rust__macro.gni
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/rust_macro.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/electron34/patches/patch-build_rust_rust__target.gni b/electron34/patches/patch-build_rust_rust__target.gni
new file mode 100644
index 0000000000..b0032d0ae1
--- /dev/null
+++ b/electron34/patches/patch-build_rust_rust__target.gni
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/rust_target.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/rust_target.gni
+@@ -339,6 +339,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/electron34/patches/patch-build_rust_std_BUILD.gn b/electron34/patches/patch-build_rust_std_BUILD.gn
new file mode 100644
index 0000000000..435b04f403
--- /dev/null
+++ b/electron34/patches/patch-build_rust_std_BUILD.gn
@@ -0,0 +1,90 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/rust/std/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/rust/std/BUILD.gn
+@@ -22,29 +22,6 @@ import("//build/config/rust.gni")
+ import("//build/config/sanitizers/sanitizers.gni")
+
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = [ "//base/allocator/partition_allocator:buildflags" ]
+- if (use_partition_alloc_as_malloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -74,13 +51,20 @@ if (toolchain_has_rust) {
+ # These are no longer present in the Windows toolchain.
+ stdlib_files += [
+ "addr2line",
+- "adler",
+ "gimli",
+ "libc",
+ "memchr",
+ "miniz_oxide",
+ "object",
+ ]
++
++ rust_revision_pieces = string_split(rustc_revision, " ")
++ rust_version_pieces = string_split(rust_revision_pieces[1], ".")
++ if (rust_version_pieces[1] == "85") {
++ stdlib_files += [ "adler" ]
++ } else {
++ stdlib_files += [ "adler2" ]
++ }
+ }
+
+ if (toolchain_for_rust_host_build_tools) {
+@@ -100,7 +84,6 @@ if (toolchain_has_rust) {
+ # don't need to pass to the C++ linker because they're used for specialized
+ # purposes.
+ skip_stdlib_files = [
+- "profiler_builtins",
+ "rustc_std_workspace_alloc",
+ "rustc_std_workspace_core",
+ "rustc_std_workspace_std",
+@@ -254,8 +237,6 @@ if (toolchain_has_rust) {
+ foreach(libname, stdlib_files + skip_stdlib_files) {
+ deps += [ "rules:$libname" ]
+ }
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -381,12 +362,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/electron34/patches/patch-build_toolchain_freebsd_BUILD.gn b/electron34/patches/patch-build_toolchain_freebsd_BUILD.gn
new file mode 100644
index 0000000000..7f60159002
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_freebsd_BUILD.gn
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/freebsd/BUILD.gn.orig 2025-05-24 17:57:53.369769074 +0000
++++ build/toolchain/freebsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "freebsd"
++ }
++}
++
++gcc_toolchain("x86") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "freebsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_x64") {
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "freebsd"
++ }
++}
++
++gcc_toolchain("x64") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "freebsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_arm") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "freebsd"
++ }
++}
++
++clang_toolchain("clang_arm64") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "freebsd"
++ }
++}
diff --git a/electron34/patches/patch-build_toolchain_gcc__solink__wrapper.py b/electron34/patches/patch-build_toolchain_gcc__solink__wrapper.py
new file mode 100644
index 0000000000..99f0c66a88
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_gcc__solink__wrapper.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/gcc_solink_wrapper.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/toolchain/gcc_solink_wrapper.py
+@@ -39,7 +39,7 @@ def CollectDynSym(args):
+ """Replaces: nm --format=posix -g -D -p $sofile | cut -f1-2 -d' '"""
+ toc = ''
+ nm = subprocess.Popen(wrapper_utils.CommandToRun(
+- [args.nm, '--format=posix', '-g', '-D', '-p', args.sofile]),
++ [args.nm, '-g', '-D', '-p', args.sofile]),
+ stdout=subprocess.PIPE,
+ bufsize=-1,
+ universal_newlines=True)
diff --git a/electron34/patches/patch-build_toolchain_gcc__toolchain.gni b/electron34/patches/patch-build_toolchain_gcc__toolchain.gni
new file mode 100644
index 0000000000..063ab52a9f
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_gcc__toolchain.gni
@@ -0,0 +1,59 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/gcc_toolchain.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/toolchain/gcc_toolchain.gni
+@@ -56,6 +56,13 @@ if (enable_resource_allowlist_generation
+ "enable_resource_allowlist_generation=true does not work for target_os=$target_os")
+ }
+
++declare_args() {
++ extra_cflags = ""
++ extra_cppflags = ""
++ extra_cxxflags = ""
++ extra_ldflags = ""
++}
++
+ # This template defines a toolchain for something that works like gcc
+ # (including clang).
+ #
+@@ -617,7 +624,7 @@ template("single_gcc_toolchain") {
+ # We need to specify link groups, at least, for single pass linkers. I.e.
+ # Rust libraries are alpha-sorted instead of by dependencies so they fail
+ # to link if not properly ordered or grouped.
+- link_command = "$ld {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" $start_group_flag @\"$rspfile\" $end_group_flag {{solibs}} {{libs}} $start_group_flag {{rlibs}} $end_group_flag"
++ link_command = "$ld $start_group_flag {{ldflags}}${extra_ldflags} -o \"$unstripped_outfile\" @\"$rspfile\" {{solibs}} {{libs}} {{rlibs}} $end_group_flag"
+
+ # Generate a map file to be used for binary size analysis.
+ # Map file adds ~10% to the link time on a z620.
+@@ -904,22 +911,12 @@ template("gcc_toolchain") {
+ # actually just be doing a native compile.
+ template("clang_toolchain") {
+ gcc_toolchain(target_name) {
+- _path = "$clang_base_path/bin"
+- _is_path_absolute = get_path_info(_path, "abspath") == _path
+-
+- # Preserve absolute paths for tools like distcc.
+- if (_is_path_absolute && filter_include([ _path ], [ "//*" ]) == []) {
+- prefix = _path
+- } else {
+- prefix = rebase_path(_path, root_build_dir)
+- }
+-
+- cc = "${prefix}/clang"
+- cxx = "${prefix}/clang++"
++ cc = "cc"
++ cxx = "c++"
+ ld = cxx
+- readelf = "${prefix}/llvm-readelf"
+- ar = "${prefix}/llvm-ar"
+- nm = "${prefix}/llvm-nm"
++ readelf = "readelf"
++ ar = "ar"
++ nm = "nm"
+
+ forward_variables_from(invoker, "*", [ "toolchain_args" ])
+
diff --git a/electron34/patches/patch-build_toolchain_netbsd_BUILD.gn b/electron34/patches/patch-build_toolchain_netbsd_BUILD.gn
new file mode 100644
index 0000000000..e479986be6
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_netbsd_BUILD.gn
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/netbsd/BUILD.gn.orig 2025-05-24 17:57:53.370261933 +0000
++++ build/toolchain/netbsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "netbsd"
++ }
++}
++
++gcc_toolchain("x86") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "netbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_x64") {
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "netbsd"
++ }
++}
++
++gcc_toolchain("x64") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "netbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_arm") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "netbsd"
++ }
++}
++
++clang_toolchain("clang_arm64") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "netbsd"
++ }
++}
diff --git a/electron34/patches/patch-build_toolchain_openbsd_BUILD.gn b/electron34/patches/patch-build_toolchain_openbsd_BUILD.gn
new file mode 100644
index 0000000000..cdee01546e
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_openbsd_BUILD.gn
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/openbsd/BUILD.gn.orig 2025-05-24 17:57:53.370441519 +0000
++++ build/toolchain/openbsd/BUILD.gn
+@@ -0,0 +1,66 @@
++# Copyright 2013 The Chromium Authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/config/sysroot.gni")
++import("//build/toolchain/gcc_toolchain.gni")
++
++clang_toolchain("clang_x86") {
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "openbsd"
++ }
++}
++
++gcc_toolchain("x86") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x86"
++ current_os = "openbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_x64") {
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "openbsd"
++ }
++}
++
++gcc_toolchain("x64") {
++ cc = "gcc"
++ cxx = "g++"
++
++ readelf = "readelf"
++ nm = "nm"
++ ar = "ar"
++ ld = cxx
++
++ toolchain_args = {
++ current_cpu = "x64"
++ current_os = "openbsd"
++ is_clang = false
++ }
++}
++
++clang_toolchain("clang_arm") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "openbsd"
++ }
++}
++
++clang_toolchain("clang_arm64") {
++ toolchain_args = {
++ current_cpu = "arm64"
++ current_os = "openbsd"
++ }
++}
diff --git a/electron34/patches/patch-build_toolchain_toolchain.gni b/electron34/patches/patch-build_toolchain_toolchain.gni
new file mode 100644
index 0000000000..246498c5b3
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_toolchain.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/toolchain.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/toolchain/toolchain.gni
+@@ -72,7 +72,7 @@ if (host_os == "mac") {
+ host_shlib_extension = ".dylib"
+ } else if (host_os == "win") {
+ host_shlib_extension = ".dll"
+-} else if (host_os == "linux" || host_os == "aix" || host_os == "zos") {
++} else if (is_posix) {
+ host_shlib_extension = ".so"
+ } else {
+ assert(false, "Host platform not supported")
diff --git a/electron34/patches/patch-build_toolchain_win_rc_rc.py b/electron34/patches/patch-build_toolchain_win_rc_rc.py
new file mode 100644
index 0000000000..4954fc3865
--- /dev/null
+++ b/electron34/patches/patch-build_toolchain_win_rc_rc.py
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- build/toolchain/win/rc/rc.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ build/toolchain/win/rc/rc.py
+@@ -244,7 +244,10 @@ def CompareToMsRcOutput(preprocessed_out
+ # Assert Microsoft rc.exe and rc.py produced identical .res files.
+ if rc_exe_exit_code == 0:
+ import filecmp
+- assert filecmp.cmp(msrc_out, flags.output)
++ # Temporarily ignore compares
++ # Nightly builds use very large version numbers that fail this check
++ # FIXME(zacwalk): Enable the assert.
++ # assert filecmp.cmp(msrc_out, flags.output)
+ return rc_exe_exit_code
+
+
diff --git a/electron34/patches/patch-buildtools_reclient__cfgs_.gitignore b/electron34/patches/patch-buildtools_reclient__cfgs_.gitignore
new file mode 100644
index 0000000000..c5dc0c1451
--- /dev/null
+++ b/electron34/patches/patch-buildtools_reclient__cfgs_.gitignore
@@ -0,0 +1,14 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/reclient_cfgs/.gitignore.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/reclient_cfgs/.gitignore
+@@ -1,4 +1,5 @@
+ /chromium-browser-clang/
+ /python/
++/naclXXX/
+ /win-cross/
+ reproxy.cfg
diff --git a/electron34/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py b/electron34/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py
new file mode 100644
index 0000000000..229e6ec217
--- /dev/null
+++ b/electron34/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/reclient_cfgs/configure_reclient_cfgs.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/reclient_cfgs/configure_reclient_cfgs.py
+@@ -344,4 +344,13 @@ def main():
+
+
+ if __name__ == "__main__":
+- sys.exit(main())
++ r = main()
++ if r != 0:
++ sys.exit(r)
++
++ electron_script = os.path.join(CHROMIUM_SRC, 'third_party', 'engflow-reclient-configs', 'configure_reclient.py')
++ r = subprocess.call([sys.executable, electron_script, '--src_dir=src', '--force'])
++ if r != 0:
++ sys.exit(r)
++
++ print('done')
diff --git a/electron34/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg b/electron34/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg
new file mode 100644
index 0000000000..3d97f38f52
--- /dev/null
+++ b/electron34/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/reclient_cfgs/nacl/rewrapper_linux.cfg
+@@ -1,10 +0,0 @@
+-# use the same platform container image as build/config/siso/main.star
+-platform=container-image=docker://gcr.io/chops-public-images-prod/rbe/siso-chromium/linux@sha256:912808c295e578ccde53b0685bcd0d56c15d7a03e819dcce70694bfe3fdab35e,label:action_default=1
+-server_address=unix:///tmp/reproxy.sock
+-labels=type=compile,compiler=nacl,lang=cpp
+-exec_strategy=racing
+-inputs=native_client/toolchain/linux_x86/saigo_newlib/lib
+-dial_timeout=10m
+-canonicalize_working_dir=true
+-exec_timeout=2m
+-reclient_timeout=4m
diff --git a/electron34/patches/patch-buildtools_third__party_libc++_BUILD.gn b/electron34/patches/patch-buildtools_third__party_libc++_BUILD.gn
new file mode 100644
index 0000000000..4b85fba303
--- /dev/null
+++ b/electron34/patches/patch-buildtools_third__party_libc++_BUILD.gn
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/third_party/libc++/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/third_party/libc++/BUILD.gn
+@@ -45,7 +45,11 @@ config("winver") {
+ if (libcxx_is_shared) {
+ _libcxx_target_type = "shared_library"
+ } else {
+- _libcxx_target_type = "source_set"
++ if (is_win) {
++ _libcxx_target_type = "source_set"
++ } else {
++ _libcxx_target_type = "static_library"
++ }
+ }
+ target(_libcxx_target_type, "libc++") {
+ # Most things that need to depend on libc++ should do so via the implicit
+@@ -53,6 +57,7 @@ target(_libcxx_target_type, "libc++") {
+ # need to explicitly depend on libc++.
+ visibility = [
+ "//build/config:common_deps",
++ "//electron:libcxx_objects_zip",
+ "//third_party/catapult/devil:devil",
+ ]
+ if (is_linux) {
diff --git a/electron34/patches/patch-buildtools_third__party_libc++_____config__site b/electron34/patches/patch-buildtools_third__party_libc++_____config__site
new file mode 100644
index 0000000000..af789e4458
--- /dev/null
+++ b/electron34/patches/patch-buildtools_third__party_libc++_____config__site
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/third_party/libc++/__config_site.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/third_party/libc++/__config_site
+@@ -18,7 +18,9 @@
+ // _LIBCPP_ABI_NAMESPACE to a shorter value.
+ #define _LIBCPP_ABI_NAMESPACE __Cr
+
++#if 0
+ #define _LIBCPP_ABI_VERSION 2
++#endif
+
+ /* #undef _LIBCPP_ABI_FORCE_ITANIUM */
+ /* #undef _LIBCPP_ABI_FORCE_MICROSOFT */
diff --git a/electron34/patches/patch-buildtools_third__party_libc++abi_BUILD.gn b/electron34/patches/patch-buildtools_third__party_libc++abi_BUILD.gn
new file mode 100644
index 0000000000..b69886ece5
--- /dev/null
+++ b/electron34/patches/patch-buildtools_third__party_libc++abi_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- buildtools/third_party/libc++abi/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ buildtools/third_party/libc++abi/BUILD.gn
+@@ -6,7 +6,7 @@ import("//build/config/android/config.gn
+ import("//build/config/c++/c++.gni")
+ import("//build/config/unwind.gni")
+
+-source_set("libc++abi") {
++static_library("libc++abi") {
+ if (export_libcxxabi_from_executables) {
+ visibility = [ "//build/config:executable_deps" ]
+ } else {
diff --git a/electron34/patches/patch-cc_base_features.cc b/electron34/patches/patch-cc_base_features.cc
new file mode 100644
index 0000000000..1064105900
--- /dev/null
+++ b/electron34/patches/patch-cc_base_features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- cc/base/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ cc/base/features.cc
+@@ -65,7 +65,7 @@ const base::FeatureParam<int> kDeferImpl
+ // be using a separate flag to control the launch on GL.
+ BASE_FEATURE(kUseDMSAAForTiles,
+ "UseDMSAAForTiles",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-chrome_BUILD.gn b/electron34/patches/patch-chrome_BUILD.gn
new file mode 100644
index 0000000000..3a954363a4
--- /dev/null
+++ b/electron34/patches/patch-chrome_BUILD.gn
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/BUILD.gn
+@@ -200,11 +200,16 @@ if (!is_android && !is_mac) {
+ "common/crash_keys.h",
+ ]
+
++ if (!is_electron_build) {
++ deps = [
++ ":packed_resources_integrity_header",
++ ]
++ }
++
+ deps += [
+ ":chrome_dll",
+ ":chrome_exe_version",
+ ":copy_first_run",
+- ":packed_resources_integrity_header",
+ ":visual_elements_resources",
+ "//base",
+ "//build:branding_buildflags",
+@@ -1557,7 +1562,7 @@ if (is_chrome_branded && !is_android) {
+ }
+ }
+
+-if (!is_android) {
++if (!is_android && !is_electron_build) {
+ chrome_paks("packed_resources") {
+ if (is_mac) {
+ output_dir = "$root_gen_dir/repack"
+@@ -1596,6 +1601,12 @@ if (!is_android) {
+ }
+ }
+
++if (is_electron_build) {
++ group("packed_resources") {
++ public_deps = [ "//electron:packed_resources" ]
++ }
++}
++
+ if (!is_android) {
+ repack("browser_tests_pak") {
+ testonly = true
diff --git a/electron34/patches/patch-chrome_app_chrome__command__ids.h b/electron34/patches/patch-chrome_app_chrome__command__ids.h
new file mode 100644
index 0000000000..c36f3787fa
--- /dev/null
+++ b/electron34/patches/patch-chrome_app_chrome__command__ids.h
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/app/chrome_command_ids.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/app/chrome_command_ids.h
+@@ -68,12 +68,12 @@
+ #define IDC_TOGGLE_MULTITASK_MENU 34050
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define IDC_USE_SYSTEM_TITLE_BAR 34051
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #define IDC_RESTORE_WINDOW 34052
+ #endif
+
diff --git a/electron34/patches/patch-chrome_app_chrome__main.cc b/electron34/patches/patch-chrome_app_chrome__main.cc
new file mode 100644
index 0000000000..6a8fd211c3
--- /dev/null
+++ b/electron34/patches/patch-chrome_app_chrome__main.cc
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/app/chrome_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/app/chrome_main.cc
+@@ -28,11 +28,11 @@
+ #include "chrome/app/chrome_main_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/base_switches.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/app/chrome_main_linux.h"
+ #endif
+
+@@ -57,7 +57,7 @@
+ // sometime after old headless code is removed from Chrome.
+ // See https://crbug.com/373672160.
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #define ENABLE_OLD_HEADLESS_INFO
+ #endif
+
+@@ -115,7 +115,7 @@ int ChromeMain(int argc, const char** ar
+ #error Unknown platform.
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ PossiblyDetermineFallbackChromeChannel(argv[0]);
+ #endif
+
+@@ -181,7 +181,7 @@ int ChromeMain(int argc, const char** ar
+ SetUpBundleOverrides();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ AppendExtraArgumentsToCommandLine(command_line);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_app_chrome__main__delegate.cc b/electron34/patches/patch-chrome_app_chrome__main__delegate.cc
new file mode 100644
index 0000000000..6e1f9dfc16
--- /dev/null
+++ b/electron34/patches/patch-chrome_app_chrome__main__delegate.cc
@@ -0,0 +1,153 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/app/chrome_main_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/app/chrome_main_delegate.cc
+@@ -145,7 +145,7 @@
+ #include "components/about_ui/credit_utils.h"
+ #endif
+
+-#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ #include "components/nacl/common/nacl_paths.h"
+ #include "components/nacl/zygote/nacl_fork_delegate_linux.h"
+ #endif
+@@ -189,17 +189,17 @@
+ #include "v8/include/v8.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/scoped_xdg_activation_token_injector.h"
+ #include "ui/linux/display_server_utils.h"
+ #endif
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/policy_path_parser.h"
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+@@ -341,7 +341,7 @@ void AdjustLinuxOOMScore(const std::stri
+ // and resources loaded.
+ bool SubprocessNeedsResourceBundle(const std::string& process_type) {
+ return
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The zygote process opens the resources for the renderers.
+ process_type == switches::kZygoteProcess ||
+ #endif
+@@ -426,7 +426,7 @@ bool HandleVersionSwitches(const base::C
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Show the man page if --help or -h is on the command line.
+ void HandleHelpSwitches(const base::CommandLine& command_line) {
+ if (command_line.HasSwitch(switches::kHelp) ||
+@@ -438,7 +438,7 @@ void HandleHelpSwitches(const base::Comm
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ void SIGTERMProfilingShutdown(int signal) {
+ content::Profiling::Stop();
+ struct sigaction sigact;
+@@ -520,7 +520,7 @@ std::optional<int> AcquireProcessSinglet
+ // process can be exited.
+ ChromeProcessSingleton::CreateInstance(user_data_dir);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Read the xdg-activation token and set it in the command line for the
+ // duration of the notification in order to ensure this is propagated to an
+ // already running browser process if it exists.
+@@ -604,7 +604,7 @@ void InitializeUserDataDir(base::Command
+ std::string process_type =
+ command_line->GetSwitchValueASCII(switches::kProcessType);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, Chrome does not support running multiple copies under different
+ // DISPLAYs, so the profile directory can be specified in the environment to
+ // support the virtual desktop use-case.
+@@ -700,7 +700,7 @@ void RecordMainStartupMetrics(const Star
+ #endif
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Record the startup process creation time on supported platforms. On Android
+ // this is recorded in ChromeMainDelegateAndroid.
+ startup_metric_utils::GetCommon().RecordStartupProcessCreationTime(
+@@ -889,7 +889,7 @@ std::optional<int> ChromeMainDelegate::P
+ #if BUILDFLAG(IS_OZONE)
+ // Initialize Ozone platform and add required feature flags as per platform's
+ // properties.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::SetOzonePlatformForLinuxIfNeeded(*base::CommandLine::ForCurrentProcess());
+ #endif
+ ui::OzonePlatform::PreEarlyInitialization();
+@@ -1085,7 +1085,7 @@ void ChromeMainDelegate::CommonEarlyInit
+ const bool is_canary_dev = IsCanaryDev();
+ const bool emit_crashes =
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ is_canary_dev;
+ #else
+ false;
+@@ -1234,7 +1234,7 @@ std::optional<int> ChromeMainDelegate::B
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag
+ // switch of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // This will directly exit if the user asked for help.
+ HandleHelpSwitches(command_line);
+ #endif
+@@ -1264,7 +1264,7 @@ std::optional<int> ChromeMainDelegate::B
+ #if BUILDFLAG(IS_CHROMEOS)
+ chromeos::dbus_paths::RegisterPathProvider();
+ #endif
+-#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(ENABLE_NACL) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ nacl::RegisterPathProvider();
+ #endif
+
+@@ -1559,7 +1559,7 @@ void ChromeMainDelegate::PreSandboxStart
+ CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Zygote needs to call InitCrashReporter() in RunZygote().
+ if (process_type != switches::kZygoteProcess &&
+ !command_line.HasSwitch(switches::kDisableCrashpadForTesting)) {
+@@ -1647,13 +1647,13 @@ absl::variant<int, content::MainFunction
+ #else
+
+ #if BUILDFLAG(IS_MAC) || (BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && \
+- !BUILDFLAG(IS_CHROMEOS))
++ !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD))
+ static const MainFunction kMainFunctions[] = {
+ #if BUILDFLAG(IS_MAC)
+ {switches::kRelauncherProcess, mac_relauncher::internal::RelauncherMain},
+ {switches::kCodeSignCloneCleanupProcess,
+ code_sign_clone_manager::internal::ChromeCodeSignCloneCleanupMain},
+-#elif BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(ENABLE_NACL) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // This entry is not needed on Linux, where the NaCl loader
+ // process is launched via nacl_helper instead.
+ {switches::kNaClLoaderProcess, NaClMain},
diff --git a/electron34/patches/patch-chrome_browser_BUILD.gn b/electron34/patches/patch-chrome_browser_BUILD.gn
new file mode 100644
index 0000000000..282c6dd229
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_BUILD.gn
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/BUILD.gn
+@@ -4524,7 +4524,7 @@ static_library("browser") {
+ ]
+ }
+
+- if (!is_win) {
++ if (!is_win && !is_electron_build) {
+ # On Windows, the hashes are embedded in //chrome:chrome_initial rather
+ # than here in :chrome_dll.
+ deps += [ "//chrome:packed_resources_integrity_header" ]
+@@ -6958,6 +6958,13 @@ static_library("browser") {
+ }
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "metrics/bluetooth_metrics_provider.cc",
++ "metrics/bluetooth_metrics_provider.h",
++ ]
++ }
++
+ if (is_linux && use_dbus) {
+ sources += [
+ "dbus_memory_pressure_evaluator_linux.cc",
diff --git a/electron34/patches/patch-chrome_browser_about__flags.cc b/electron34/patches/patch-chrome_browser_about__flags.cc
new file mode 100644
index 0000000000..c00060ec72
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_about__flags.cc
@@ -0,0 +1,340 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/about_flags.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/about_flags.cc
+@@ -249,7 +249,7 @@
+ #include "ui/ui_features.h"
+ #include "url/url_features.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/allocator/buildflags.h"
+ #endif
+
+@@ -344,7 +344,7 @@
+ #include "device/vr/public/cpp/features.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/public/ozone_switches.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+
+@@ -353,7 +353,7 @@
+ #include "chrome/browser/win/mica_titlebar.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/contextual_cueing/contextual_cueing_features.h"
+ #include "chrome/browser/enterprise/profile_management/profile_management_features.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+@@ -364,7 +364,7 @@
+ #include "components/user_education/common/user_education_features.h" // nogncheck
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/ui_features.h"
+ #include "ui/base/ui_base_features.h"
+ #endif
+@@ -510,7 +510,7 @@ const FeatureEntry::FeatureVariation kDX
+ {"Max 3 Frames", &kDXGIWaitableSwapChain3Frames, 1, nullptr}};
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::Choice kOzonePlatformHintRuntimeChoices[] = {
+ {flag_descriptions::kOzonePlatformHintChoiceDefault, "", ""},
+ {flag_descriptions::kOzonePlatformHintChoiceAuto,
+@@ -780,6 +780,31 @@ const FeatureEntry::FeatureVariation
+ std::size(kWebIdentityDigitalIdentityCredentialHighRiskDialogParam),
+ nullptr}};
+
++#if BUILDFLAG(IS_BSD)
++const FeatureEntry::FeatureParam kAudioBackendPulseAudio[] = {
++ { "audio-backend", "pulseaudio" }};
++const FeatureEntry::FeatureParam kAudioBackendSndio[] = {
++ { "audio-backend", "sndio" }};
++const FeatureEntry::FeatureParam kAudioBackendAudioIO[] = {
++ { "audio-backend", "audioio" }};
++const FeatureEntry::FeatureParam kAudioBackendAlsa[] = {
++ { "audio-backend", "alsa" }};
++const FeatureEntry::FeatureVariation
++ kAudioBackendVariations[] = {
++ {"using PulseAudio by default if available", kAudioBackendPulseAudio,
++ std::size(kAudioBackendPulseAudio),
++ nullptr},
++ {"using sndio by default if available", kAudioBackendSndio,
++ std::size(kAudioBackendSndio),
++ nullptr},
++ {"using audioio by default if available", kAudioBackendAudioIO,
++ std::size(kAudioBackendAudioIO),
++ nullptr},
++ {"using ALSA by default if available", kAudioBackendAlsa,
++ std::size(kAudioBackendAlsa),
++ nullptr}};
++#endif
++
+ const FeatureEntry::FeatureParam kClipboardMaximumAge60Seconds[] = {
+ {"UIClipboardMaximumAge", "60"}};
+ const FeatureEntry::FeatureParam kClipboardMaximumAge90Seconds[] = {
+@@ -1216,7 +1241,7 @@ const FeatureEntry::FeatureVariation kPa
+ };
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kHistoryEmbeddingsAtKeywordAcceleration[]{
+ {"AtKeywordAcceleration", "true"},
+ };
+@@ -1254,7 +1279,7 @@ const FeatureEntry::FeatureVariation kRe
+ };
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kShortcutBoostSingleUrl[] = {
+ {"ShortcutBoostSearchScore", "0"},
+ {"ShortcutBoostNonTopHitThreshold", "0"},
+@@ -1872,7 +1897,7 @@ const FeatureEntry::FeatureVariation kTa
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kTabstripDeclutterQuickModeParams[] = {
+ {"stale_threshold_duration", "10s"},
+ {"declutter_timer_interval", "10s"},
+@@ -3589,7 +3614,7 @@ const FeatureEntry::FeatureVariation
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const flags_ui::FeatureEntry::FeatureParam kPwaNavigationCapturingDefaultOn[] =
+ {{"link_capturing_state", "on_by_default"}};
+ const flags_ui::FeatureEntry::FeatureParam kPwaNavigationCapturingDefaultOff[] =
+@@ -4135,7 +4160,7 @@ const FeatureEntry::FeatureVariation
+ std::size(kSecurePaymentConfirmationNetworkAndIssuerIcons_Rows),
+ nullptr}};
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const FeatureEntry::FeatureParam kTranslationAPI_SkipLanguagePackLimit[] = {
+ {"TranslationAPIAcceptLanguagesCheck", "false"},
+ {"TranslationAPILimitLanguagePackCount", "false"}};
+@@ -4968,7 +4993,7 @@ const FeatureEntry kFeatureEntries[] = {
+ },
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {
+ "fluent-overlay-scrollbars",
+ flag_descriptions::kFluentOverlayScrollbarsName,
+@@ -5373,7 +5398,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kDesktopPWAsSyncChangesDescription, kOsDesktop,
+ FEATURE_VALUE_TYPE(features::kWebAppDontAddExistingAppsToSync)},
+ #endif // !BUILDFLAG(IS_ANDROID)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"shortcuts-not-apps", flag_descriptions::kShortcutsNotAppsName,
+ flag_descriptions::kShortcutsNotAppsDescription,
+ kOsMac | kOsWin | kOsLinux,
+@@ -5532,7 +5557,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(features::kWebShare)},
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"pulseaudio-loopback-for-cast",
+ flag_descriptions::kPulseaudioLoopbackForCastName,
+ flag_descriptions::kPulseaudioLoopbackForCastDescription, kOsLinux,
+@@ -5568,9 +5593,19 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kWaylandLinuxDrmSyncobjName,
+ flag_descriptions::kWaylandLinuxDrmSyncobjDescription, kOsLinux,
+ FEATURE_VALUE_TYPE(features::kWaylandLinuxDrmSyncobj)},
++
++#if BUILDFLAG(IS_BSD)
++ {"audio-backend",
++ flag_descriptions::kAudioBackendName,
++ flag_descriptions::kAudioBackendDescription, kOsLinux,
++ FEATURE_WITH_PARAMS_VALUE_TYPE(
++ media::kAudioBackend,
++ kAudioBackendVariations,
++ "AudioBackend")},
++#endif
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {"skip-undecryptable-passwords",
+ flag_descriptions::kSkipUndecryptablePasswordsName,
+ flag_descriptions::kSkipUndecryptablePasswordsDescription,
+@@ -6466,7 +6501,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "MlUrlScoring")},
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"omnibox-domain-suggestions",
+ flag_descriptions::kOmniboxDomainSuggestionsName,
+ flag_descriptions::kOmniboxDomainSuggestionsDescription, kOsDesktop,
+@@ -6675,7 +6710,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "OrganicRepeatableQueries")},
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"history-embeddings", flag_descriptions::kHistoryEmbeddingsName,
+ flag_descriptions::kHistoryEmbeddingsDescription, kOsDesktop,
+ FEATURE_WITH_PARAMS_VALUE_TYPE(history_embeddings::kHistoryEmbeddings,
+@@ -7278,7 +7313,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(printing::features::kAddPrinterViaPrintscanmgr)},
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {"cups-ipp-printing-backend",
+ flag_descriptions::kCupsIppPrintingBackendName,
+ flag_descriptions::kCupsIppPrintingBackendDescription, kOsDesktop,
+@@ -8228,7 +8263,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kCooperativeSchedulingDescription, kOsAll,
+ FEATURE_VALUE_TYPE(features::kCooperativeScheduling)},
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"enable-network-service-sandbox",
+ flag_descriptions::kEnableNetworkServiceSandboxName,
+ flag_descriptions::kEnableNetworkServiceSandboxDescription,
+@@ -8973,7 +9008,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(ash::features::kWallpaperGooglePhotosSharedAlbums)},
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"enable-get-all-screens-media", flag_descriptions::kGetAllScreensMediaName,
+ flag_descriptions::kGetAllScreensMediaDescription,
+ kOsCrOS | kOsLacros | kOsLinux,
+@@ -9002,7 +9037,7 @@ const FeatureEntry kFeatureEntries[] = {
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {
+ "ui-debug-tools",
+ flag_descriptions::kUIDebugToolsName,
+@@ -9472,7 +9507,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(features::kRenderPassDrawnRect)},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"media-session-enter-picture-in-picture",
+ flag_descriptions::kMediaSessionEnterPictureInPictureName,
+ flag_descriptions::kMediaSessionEnterPictureInPictureDescription,
+@@ -10270,7 +10305,7 @@ const FeatureEntry kFeatureEntries[] = {
+ kOsDesktop | kOsAndroid,
+ FEATURE_VALUE_TYPE(features::kProcessPerSiteUpToMainFrameThreshold)},
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"camera-mic-effects", flag_descriptions::kCameraMicEffectsName,
+ flag_descriptions::kCameraMicEffectsDescription,
+ static_cast<unsigned short>(kOsMac | kOsWin | kOsLinux),
+@@ -10296,7 +10331,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "RenderDocument")},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"enable-search-aggregator-policy",
+ flag_descriptions::kEnableSearchAggregatorPolicyName,
+ flag_descriptions::kEnableSearchAggregatorPolicyDescription,
+@@ -10412,7 +10447,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(chrome::android::kReadAloudTapToSeek)},
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"third-party-profile-management",
+ flag_descriptions::kThirdPartyProfileManagementName,
+ flag_descriptions::kThirdPartyProfileManagementDescription,
+@@ -10454,7 +10489,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"enable-user-navigation-capturing-pwa",
+ flag_descriptions::kPwaNavigationCapturingName,
+ flag_descriptions::kPwaNavigationCapturingDescription,
+@@ -11311,7 +11346,7 @@ const FeatureEntry kFeatureEntries[] = {
+ performance_manager::features::kPerformanceInterventionDemoMode)},
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"sync-enable-bookmarks-in-transport-mode",
+ flag_descriptions::kSyncEnableBookmarksInTransportModeName,
+ flag_descriptions::kSyncEnableBookmarksInTransportModeDescription,
+@@ -11400,7 +11435,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"classify-url-on-process-response-event",
+ flag_descriptions::kClassifyUrlOnProcessResponseEventName,
+ flag_descriptions::kClassifyUrlOnProcessResponseEventDescription,
+@@ -11409,7 +11444,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"tab-organization", flag_descriptions::kTabOrganizationName,
+ flag_descriptions::kTabOrganizationDescription, kOsDesktop,
+ FEATURE_VALUE_TYPE(features::kTabOrganization)},
+@@ -11454,7 +11489,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kLanguageDetectionAPIDescription, kOsAll,
+ FEATURE_VALUE_TYPE(blink::features::kLanguageDetectionAPI)},
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"supervised-profile-hide-guest",
+ flag_descriptions::kSupervisedProfileHideGuestName,
+ flag_descriptions::kSupervisedProfileHideGuestDescription,
+@@ -11724,7 +11759,7 @@ const FeatureEntry kFeatureEntries[] = {
+ segmentation_platform::features::kSegmentationSurveyPage)},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"autofill-enable-buy-now-pay-later-for-affirm",
+ flag_descriptions::kAutofillEnableBuyNowPayLaterForAffirmName,
+ flag_descriptions::kAutofillEnableBuyNowPayLaterForAffirmDescription,
+@@ -11853,7 +11888,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(
+ autofill::features::kAutofillEnableCardInfoRuntimeRetrieval)},
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"translation-api", flag_descriptions::kTranslationAPIName,
+ flag_descriptions::kTranslationAPIDescription, kOsMac | kOsWin | kOsLinux,
+ FEATURE_WITH_PARAMS_VALUE_TYPE(blink::features::kEnableTranslationAPI,
+@@ -11879,7 +11914,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(
+ password_manager::features::kPasswordFormClientsideClassifier)},
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"contextual-cueing", flag_descriptions::kContextualCueingName,
+ flag_descriptions::kContextualCueingDescription,
+ kOsLinux | kOsMac | kOsWin,
diff --git a/electron34/patches/patch-chrome_browser_accessibility_page__colors.cc b/electron34/patches/patch-chrome_browser_accessibility_page__colors.cc
new file mode 100644
index 0000000000..de259e158a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_accessibility_page__colors.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/accessibility/page_colors.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/accessibility/page_colors.cc
+@@ -12,7 +12,7 @@
+ #include "components/sync_preferences/pref_service_syncable.h"
+ #include "ui/native_theme/native_theme.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #include "ui/linux/linux_ui_factory.h"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -55,7 +55,7 @@ void PageColors::Init() {
+
+ void PageColors::OnPageColorsChanged() {
+ auto* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Allow the Linux native theme to update its state for page colors.
+ if (auto* linux_ui_theme = ui::GetDefaultLinuxUiTheme()) {
+ if (auto* linux_native_theme = linux_ui_theme->GetNativeTheme()) {
diff --git a/electron34/patches/patch-chrome_browser_after__startup__task__utils.cc b/electron34/patches/patch-chrome_browser_after__startup__task__utils.cc
new file mode 100644
index 0000000000..ba247bbfe7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_after__startup__task__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/after_startup_task_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/after_startup_task_utils.cc
+@@ -117,7 +117,7 @@ void SetBrowserStartupIsComplete() {
+ TRACE_EVENT_SCOPE_GLOBAL, "BrowserCount", browser_count);
+ GetStartupCompleteFlag().Set();
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Process::Current().CreationTime() is not available on all platforms.
+ const base::Time process_creation_time =
+ base::Process::Current().CreationTime();
diff --git a/electron34/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc b/electron34/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
new file mode 100644
index 0000000000..34dcb1d7cb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/apps/app_service/publishers/extension_apps.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/apps/app_service/publishers/extension_apps.cc
+@@ -23,7 +23,7 @@ ExtensionApps::ExtensionApps(AppServiceP
+ ExtensionApps::~ExtensionApps() = default;
+
+ bool ExtensionApps::Accepts(const extensions::Extension* extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (extensions::IsExtensionUnsupportedDeprecatedApp(profile(),
+ extension->id())) {
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc b/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
new file mode 100644
index 0000000000..ee14e67b3e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/apps/platform_apps/platform_app_launch.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/apps/platform_apps/platform_app_launch.cc
+@@ -19,7 +19,7 @@
+ #include "extensions/common/constants.h"
+ #include "extensions/common/extension.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser.h"
+ #include "chrome/browser/ui/browser_navigator.h"
+ #include "chrome/browser/ui/browser_window.h"
+@@ -86,7 +86,7 @@ bool OpenExtensionApplicationWindow(Prof
+ if (launch_container == LaunchContainer::kLaunchContainerTab)
+ return false;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return false;
+ }
+@@ -118,7 +118,7 @@ content::WebContents* OpenExtensionAppli
+ if (launch_container != apps::LaunchContainer::kLaunchContainerTab)
+ return nullptr;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return nullptr;
+ }
+@@ -134,7 +134,7 @@ content::WebContents* OpenExtensionAppli
+ return app_tab;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OpenDeprecatedApplicationPrompt(Profile* profile,
+ const std::string& app_id) {
+ if (!extensions::IsExtensionUnsupportedDeprecatedApp(profile, app_id))
+@@ -170,7 +170,7 @@ bool OpenExtensionApplicationWithReenabl
+ if (!GetPlatformApp(profile, app_id))
+ return false;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app_id)) {
+ return false;
+ }
+@@ -192,7 +192,7 @@ content::WebContents* OpenExtensionAppSh
+ ->enabled_extensions()
+ .GetAppByURL(url);
+ if (app) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, app->id())) {
+ return nullptr;
+ }
+@@ -215,7 +215,7 @@ void RecordExtensionAppLaunchOnTabRestor
+ if (!extension)
+ return;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (OpenDeprecatedApplicationPrompt(profile, extension->id())) {
+ return;
+ }
diff --git a/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h b/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
new file mode 100644
index 0000000000..abe15141b3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/apps/platform_apps/platform_app_launch.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/apps/platform_apps/platform_app_launch.h
+@@ -38,7 +38,7 @@ bool OpenExtensionApplicationWindow(Prof
+ content::WebContents* OpenExtensionApplicationTab(Profile* profile,
+ const std::string& app_id);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Opens the deprecated Chrome Apps flow if |app_id| refers to a Chrome App and
+ // Chrome Apps are deprecated on the |profile|. Returns true if that was the
+ // case, or false otherwise.
diff --git a/electron34/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc b/electron34/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
new file mode 100644
index 0000000000..83c9fa5c19
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc
+@@ -88,7 +88,7 @@ ChromeAutocompleteSchemeClassifier::GetI
+ return metrics::OmniboxInputType::QUERY;
+
+ case ExternalProtocolHandler::UNKNOWN: {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux impl of GetApplicationNameForScheme doesn't distinguish
+ // between URL schemes with handers and those without. This will
+ // make the default behaviour be search on Linux.
diff --git a/electron34/patches/patch-chrome_browser_background_background__mode__manager.cc b/electron34/patches/patch-chrome_browser_background_background__mode__manager.cc
new file mode 100644
index 0000000000..e5a762e359
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_background_background__mode__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/background/background_mode_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/background/background_mode_manager.cc
+@@ -872,7 +872,7 @@ gfx::ImageSkia GetStatusTrayIcon() {
+ return gfx::ImageSkia();
+
+ return family->CreateExact(size).AsImageSkia();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return *ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_PRODUCT_LOGO_128);
+ #elif BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-chrome_browser_background_background__mode__optimizer.cc b/electron34/patches/patch-chrome_browser_background_background__mode__optimizer.cc
new file mode 100644
index 0000000000..510aa241a0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_background_background__mode__optimizer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/background/background_mode_optimizer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/background/background_mode_optimizer.cc
+@@ -31,7 +31,7 @@ std::unique_ptr<BackgroundModeOptimizer>
+ return nullptr;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kBackgroundModeAllowRestart)) {
+ // Private ctor.
+ return base::WrapUnique(new BackgroundModeOptimizer());
diff --git a/electron34/patches/patch-chrome_browser_browser__features.cc b/electron34/patches/patch-chrome_browser_browser__features.cc
new file mode 100644
index 0000000000..af7dd1c4e7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_browser__features.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/browser_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/browser_features.cc
+@@ -65,7 +65,7 @@ BASE_FEATURE(kCertVerificationNetworkTim
+ "CertVerificationNetworkTime",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables usage of os_crypt_async::SecretPortalKeyProvider. Once
+ // `kSecretPortalKeyProviderUseForEncryption` is enabled, this flag cannot be
+ // disabled without losing data.
+@@ -81,7 +81,7 @@ BASE_FEATURE(kDbusSecretPortal,
+ BASE_FEATURE(kDestroyProfileOnBrowserClose,
+ "DestroyProfileOnBrowserClose",
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -248,7 +248,7 @@ BASE_FEATURE(kSandboxExternalProtocolBlo
+ "SandboxExternalProtocolBlockedWarning",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If true, encrypt new data with the key provided by SecretPortalKeyProvider.
+ // Otherwise, it will only decrypt existing data.
+ BASE_FEATURE(kSecretPortalKeyProviderUseForEncryption,
diff --git a/electron34/patches/patch-chrome_browser_browser__features.h b/electron34/patches/patch-chrome_browser_browser__features.h
new file mode 100644
index 0000000000..e18c6eff15
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_browser__features.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/browser_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/browser_features.h
+@@ -37,7 +37,7 @@ BASE_DECLARE_FEATURE(kBookmarkTriggerFor
+ BASE_DECLARE_FEATURE(kCertificateTransparencyAskBeforeEnabling);
+ BASE_DECLARE_FEATURE(kCertVerificationNetworkTime);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kDbusSecretPortal);
+ #endif
+
+@@ -111,7 +111,7 @@ BASE_DECLARE_FEATURE(kRestartNetworkServ
+ BASE_DECLARE_FEATURE(kSandboxExternalProtocolBlocked);
+ BASE_DECLARE_FEATURE(kSandboxExternalProtocolBlockedWarning);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kSecretPortalKeyProviderUseForEncryption);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_browser__process__impl.cc b/electron34/patches/patch-chrome_browser_browser__process__impl.cc
new file mode 100644
index 0000000000..2e557cdc4e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_browser__process__impl.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/browser_process_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/browser_process_impl.cc
+@@ -236,7 +236,7 @@
+ #include "chrome/browser/ui/profiles/profile_picker.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/error_reporting/chrome_js_error_report_processor.h" // nogncheck
+ #endif
+
+@@ -257,7 +257,7 @@
+ #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_features.h"
+ #include "components/os_crypt/async/browser/secret_portal_key_provider.h"
+ #endif
+@@ -1124,7 +1124,7 @@ void BrowserProcessImpl::RegisterPrefs(P
+ GoogleUpdateSettings::GetCollectStatsConsent());
+ registry->RegisterBooleanPref(prefs::kDevToolsRemoteDebuggingAllowed, true);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ os_crypt_async::SecretPortalKeyProvider::RegisterLocalPrefs(registry);
+ #endif
+ }
+@@ -1303,7 +1303,7 @@ void BrowserProcessImpl::PreMainMessageL
+
+ ApplyMetricsReportingPolicy();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ChromeJsErrorReportProcessor::Create();
+ #endif
+
+@@ -1393,7 +1393,7 @@ void BrowserProcessImpl::PreMainMessageL
+ features::kUseAppBoundEncryptionProviderForEncryption))));
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kDbusSecretPortal)) {
+ providers.emplace_back(
+ /*precedence=*/10u,
+@@ -1643,7 +1643,7 @@ void BrowserProcessImpl::Unpin() {
+ // Mac is currently not supported.
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+
+ bool BrowserProcessImpl::IsRunningInBackground() const {
+ // Check if browser is in the background.
diff --git a/electron34/patches/patch-chrome_browser_browser__process__impl.h b/electron34/patches/patch-chrome_browser_browser__process__impl.h
new file mode 100644
index 0000000000..4bd3fc870b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_browser__process__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/browser_process_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/browser_process_impl.h
+@@ -405,7 +405,7 @@ class BrowserProcessImpl : public Browse
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ base::RepeatingTimer autoupdate_timer_;
+
+ // Gets called by autoupdate timer to see if browser needs restart and can be
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.cc b/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.cc
new file mode 100644
index 0000000000..5d6589b895
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_field_trials.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_field_trials.cc
+@@ -49,7 +49,7 @@
+ #include "chrome/browser/ui/startup/default_browser_prompt/default_browser_prompt_trial.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #include "ui/base/ui_base_features.h"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -135,7 +135,7 @@ void ChromeBrowserFieldTrials::RegisterS
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux/Desktop platform variants, such as ozone/wayland, some features
+ // might need to be disabled as per OzonePlatform's runtime properties.
+ // OzonePlatform selection and initialization, in turn, depend on Chrome flags
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.h b/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.h
new file mode 100644
index 0000000000..10c716bbd5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__field__trials.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_field_trials.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_field_trials.h
+@@ -33,7 +33,7 @@ class ChromeBrowserFieldTrials : public
+ const variations::EntropyProviders& entropy_providers,
+ base::FeatureList* feature_list) override;
+ void RegisterSyntheticTrials() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void RegisterFeatureOverrides(base::FeatureList* feature_list) override;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__interface__binders.cc b/electron34/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
new file mode 100644
index 0000000000..d50af763fe
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
@@ -0,0 +1,103 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_interface_binders.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_interface_binders.cc
+@@ -126,12 +126,12 @@
+ #endif // BUILDFLAG(FULL_SAFE_BROWSING)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals.mojom.h"
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/app_settings/web_app_settings_ui.h"
+ #include "chrome/browser/ui/webui/on_device_translation_internals/on_device_translation_internals_ui.h"
+ #include "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
+@@ -221,7 +221,7 @@
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/screen_ai/screen_ai_service_router.h"
+ #include "chrome/browser/screen_ai/screen_ai_service_router_factory.h"
+ #include "chrome/browser/ui/web_applications/sub_apps_service_impl.h"
+@@ -231,7 +231,7 @@
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+@@ -735,7 +735,7 @@ void BindMediaFoundationPreferences(
+ #endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ void BindScreenAIAnnotator(
+ content::RenderFrameHost* frame_host,
+ mojo::PendingReceiver<screen_ai::mojom::ScreenAIAnnotator> receiver) {
+@@ -873,7 +873,7 @@ void PopulateChromeFrameBinders(
+ #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(blink::features::kDesktopPWAsSubApps) &&
+ !render_frame_host->GetParentOrOuterDocument()) {
+ // The service binder will reject non-primary main frames, but we still need
+@@ -961,7 +961,7 @@ void PopulateChromeWebUIFrameBinders(
+ DataSharingInternalsUI>(map);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<
+ connectors_internals::mojom::PageHandler,
+ enterprise_connectors::ConnectorsInternalsUI>(map);
+@@ -972,7 +972,7 @@ void PopulateChromeWebUIFrameBinders(
+ policy::DlpInternalsUI>(map);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<
+ app_management::mojom::PageHandlerFactory, WebAppSettingsUI>(map);
+
+@@ -1065,14 +1065,14 @@ void PopulateChromeWebUIFrameBinders(
+ page_image_service::mojom::PageImageServiceHandler, HistoryUI,
+ HistoryClustersSidePanelUI, NewTabPageUI, BookmarksSidePanelUI>(map);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<whats_new::mojom::PageHandlerFactory,
+ WhatsNewUI>(map);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ RegisterWebUIControllerInterfaceBinder<
+ browser_command::mojom::CommandHandlerFactory,
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WhatsNewUI,
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ NewTabPageUI>(map);
+@@ -1589,7 +1589,7 @@ void PopulateChromeWebUIFrameBinders(
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ RegisterWebUIControllerInterfaceBinder<discards::mojom::DetailsProvider,
+ DiscardsUI>(map);
+
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main.cc b/electron34/patches/patch-chrome_browser_chrome__browser__main.cc
new file mode 100644
index 0000000000..cc9aac9aee
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main.cc
@@ -0,0 +1,124 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main.cc
+@@ -250,15 +250,15 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/first_run/upgrade_util_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -291,14 +291,14 @@
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h"
+ #include "chrome/browser/metrics/desktop_session_duration/touch_mode_stats_tracker.h"
+ #include "chrome/browser/profiles/profile_activity_metrics_recorder.h"
+ #include "ui/base/pointer/touch_ui_controller.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_metrics.h" // nogncheck
+ #include "chrome/browser/headless/headless_mode_util.h" // nogncheck
+ #include "components/headless/select_file_dialog/headless_select_file_dialog.h"
+@@ -366,14 +366,14 @@
+ #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(USE_BROWSER_SPELLCHECKER)
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "sql/database.h"
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+ // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
+
+ namespace {
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ constexpr base::FilePath::CharType kMediaHistoryDatabaseName[] =
+ FILE_PATH_LITERAL("Media History");
+
+@@ -538,7 +538,7 @@ void ProcessSingletonNotificationCallbac
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the global activation token sent as a command line switch by another
+ // browser process. This also removes the switch after use to prevent any side
+ // effects of leaving it in the command line after this point.
+@@ -1121,7 +1121,7 @@ int ChromeBrowserMainParts::PreCreateThr
+ browser_creator_->AddFirstRunTabs(master_prefs_->new_tabs);
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Create directory for user-level Native Messaging manifest files. This
+ // makes it less likely that the directory will be created by third-party
+ // software with incorrect owner or permission. See crbug.com/725513 .
+@@ -1169,7 +1169,7 @@ int ChromeBrowserMainParts::PreCreateThr
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ metrics::DesktopSessionDurationTracker::Initialize();
+ ProfileActivityMetricsRecorder::Initialize();
+ TouchModeStatsTracker::Initialize(
+@@ -1365,7 +1365,7 @@ void ChromeBrowserMainParts::PostProfile
+ #endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Delete the media history database if it still exists.
+ // TODO(crbug.com/40177301): Remove this.
+ base::ThreadPool::PostTask(
+@@ -1414,7 +1414,7 @@ void ChromeBrowserMainParts::PostProfile
+ *UrlLanguageHistogramFactory::GetForBrowserContext(profile));
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode()) {
+ headless::ReportHeadlessActionMetrics();
+ }
+@@ -1523,7 +1523,7 @@ int ChromeBrowserMainParts::PreMainMessa
+ // In headless mode provide alternate SelectFileDialog factory overriding
+ // any platform specific SelectFileDialog implementation that may have been
+ // set.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode()) {
+ headless::HeadlessSelectFileDialogFactory::SetUp();
+ }
+@@ -2080,7 +2080,7 @@ bool ChromeBrowserMainParts::ProcessSing
+
+ // Drop the request if headless mode is in effect or the request is from
+ // a headless Chrome process.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode() ||
+ command_line.HasSwitch(switches::kHeadless)) {
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc b/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
new file mode 100644
index 0000000000..82839602ba
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main_extra_parts_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main_extra_parts_linux.cc
+@@ -58,7 +58,7 @@ void ChromeBrowserMainExtraPartsLinux::P
+
+ // static
+ void ChromeBrowserMainExtraPartsLinux::InitOzonePlatformHint() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* const command_line = base::CommandLine::ForCurrentProcess();
+ auto env = base::Environment::Create();
+ std::string desktop_startup_id;
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc b/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
new file mode 100644
index 0000000000..c1cc3458da
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main_extra_parts_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main_extra_parts_ozone.cc
+@@ -27,7 +27,7 @@ void ChromeBrowserMainExtraPartsOzone::P
+ }
+
+ void ChromeBrowserMainExtraPartsOzone::PostMainMessageLoopRun() {
+-#if !BUILDFLAG(IS_CHROMEOS_LACROS) && !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_CHROMEOS_LACROS) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // Lacros's `PostMainMessageLoopRun` must be called at the very end of
+ // `PostMainMessageLoopRun` in
+ // `ChromeBrowserMainPartsLacros::PostMainMessageLoopRun`.
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.cc b/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.cc
new file mode 100644
index 0000000000..25f55cf86d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main_linux.cc
+@@ -25,7 +25,7 @@
+ #include "device/bluetooth/dbus/bluez_dbus_thread_manager.h"
+ #include "ui/base/l10n/l10n_util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+
+@@ -72,7 +72,9 @@ void ChromeBrowserMainPartsLinux::PostCr
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ #if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_BSD)
+ bluez::BluezDBusManager::Initialize(nullptr /* system_bus */);
++#endif
+
+ // Set up crypt config. This needs to be done before anything starts the
+ // network service, as the raw encryption key needs to be shared with the
+@@ -98,7 +100,7 @@ void ChromeBrowserMainPartsLinux::PostCr
+ ChromeBrowserMainPartsPosix::PostCreateMainMessageLoop();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ChromeBrowserMainPartsLinux::PostMainMessageLoopRun() {
+ ChromeBrowserMainPartsPosix::PostMainMessageLoopRun();
+ ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun();
+@@ -136,7 +138,7 @@ void ChromeBrowserMainPartsLinux::PostBr
+ #endif // (defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS))
+
+ void ChromeBrowserMainPartsLinux::PostDestroyThreads() {
+-#if BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // No-op; per PostBrowserStart() comment, this is done elsewhere.
+ #else
+ bluez::BluezDBusManager::Shutdown();
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.h b/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.h
new file mode 100644
index 0000000000..a6a61fab99
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main__linux.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main_linux.h
+@@ -30,7 +30,7 @@ class ChromeBrowserMainPartsLinux : publ
+
+ // ChromeBrowserMainPartsPosix overrides.
+ void PostCreateMainMessageLoop() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void PostMainMessageLoopRun() override;
+ #endif
+ void PreProfileInit() override;
diff --git a/electron34/patches/patch-chrome_browser_chrome__browser__main__posix.cc b/electron34/patches/patch-chrome_browser_chrome__browser__main__posix.cc
new file mode 100644
index 0000000000..1356bc59e5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__browser__main__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_browser_main_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_browser_main_posix.cc
+@@ -79,7 +79,7 @@ void ExitHandler::ExitWhenPossibleOnUITh
+ } else {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ switch (signal) {
+ case SIGINT:
+ case SIGHUP:
diff --git a/electron34/patches/patch-chrome_browser_chrome__content__browser__client.cc b/electron34/patches/patch-chrome_browser_chrome__content__browser__client.cc
new file mode 100644
index 0000000000..a8252b1042
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__content__browser__client.cc
@@ -0,0 +1,177 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_content_browser_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_content_browser_client.cc
+@@ -496,7 +496,7 @@
+ #include "storage/browser/file_system/external_mount_points.h"
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/chrome_browser_main_linux.h"
+ #include "chrome/browser/ui/views/chrome_browser_main_extra_parts_views_linux.h"
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -613,12 +613,12 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "chrome/browser/browser_switcher/browser_switcher_navigation_throttle.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crash_switches.h"
+ #include "components/crash/core/app/crashpad.h"
+ #endif
+@@ -629,7 +629,7 @@
+ #include "chrome/browser/apps/link_capturing/web_app_link_capturing_delegate.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/chrome_browser_main_extra_parts_enterprise.h"
+ #include "chrome/browser/enterprise/profile_management/oidc_auth_response_capture_navigation_throttle.h"
+ #include "chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.h"
+@@ -638,7 +638,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/navigation_throttle.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -651,7 +651,7 @@
+ #include "chrome/browser/ui/views/lens/lens_side_panel_navigation_helper.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/chrome_browser_main_extra_parts_linux.h"
+ #elif BUILDFLAG(IS_OZONE)
+ #include "chrome/browser/chrome_browser_main_extra_parts_ozone.h"
+@@ -1570,7 +1570,7 @@ void ChromeContentBrowserClient::Registe
+ registry->RegisterBooleanPref(prefs::kDeviceNativeClientForceAllowedCache,
+ false);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kOutOfProcessSystemDnsResolutionEnabled,
+ true);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
+@@ -1778,7 +1778,7 @@ ChromeContentBrowserClient::CreateBrowse
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ main_parts = std::make_unique<ChromeBrowserMainPartsLacros>(
+ is_integration_test, &startup_data_);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ main_parts = std::make_unique<ChromeBrowserMainPartsLinux>(
+ is_integration_test, &startup_data_);
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -1812,7 +1812,7 @@ ChromeContentBrowserClient::CreateBrowse
+ std::make_unique<ChromeBrowserMainExtraPartsViewsLacros>());
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(
+ std::make_unique<ChromeBrowserMainExtraPartsViewsLinux>());
+ #else
+@@ -1833,7 +1833,7 @@ ChromeContentBrowserClient::CreateBrowse
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLacros>());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsLinux>());
+ #elif BUILDFLAG(IS_OZONE)
+ main_parts->AddParts(std::make_unique<ChromeBrowserMainExtraPartsOzone>());
+@@ -1852,7 +1852,7 @@ ChromeContentBrowserClient::CreateBrowse
+
+ chrome::AddMetricsExtraParts(main_parts.get());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ main_parts->AddParts(
+ std::make_unique<
+ enterprise_util::ChromeBrowserMainExtraPartsEnterprise>());
+@@ -2729,7 +2729,9 @@ void MaybeAppendBlinkSettingsSwitchForFi
+ void ChromeContentBrowserClient::AppendExtraCommandLineSwitches(
+ base::CommandLine* command_line,
+ int child_process_id) {
++#ifdef notyet
+ crash_keys::AppendStringAnnotationsCommandLineSwitch(command_line);
++#endif
+ #if BUILDFLAG(IS_MAC)
+ std::unique_ptr<metrics::ClientInfo> client_info =
+ GoogleUpdateSettings::LoadMetricsClientInfo();
+@@ -2738,7 +2740,7 @@ void ChromeContentBrowserClient::AppendE
+ client_info->client_id);
+ }
+ #elif BUILDFLAG(IS_POSIX)
+-#if !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ pid_t pid;
+ if (crash_reporter::GetHandlerSocket(nullptr, &pid)) {
+ command_line->AppendSwitchASCII(
+@@ -3099,7 +3101,7 @@ void ChromeContentBrowserClient::AppendE
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && !BUILDFLAG(IS_BSD)
+ // Opt into a hardened stack canary mitigation if it hasn't already been
+ // force-disabled.
+ if (!browser_command_line.HasSwitch(switches::kChangeStackGuardOnFork)) {
+@@ -4974,7 +4976,7 @@ void ChromeContentBrowserClient::GetAddi
+ }
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
+@@ -5536,7 +5538,7 @@ ChromeContentBrowserClient::CreateThrott
+ &throttles);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(
+ WebAppSettingsNavigationThrottle::MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -5553,7 +5555,7 @@ ChromeContentBrowserClient::CreateThrott
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(enterprise_connectors::DeviceTrustNavigationThrottle::
+ MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -5592,7 +5594,7 @@ ChromeContentBrowserClient::CreateThrott
+ handle));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle::
+ MaybeCreateThrottleFor(handle),
+ &throttles);
+@@ -7548,7 +7550,7 @@ bool ChromeContentBrowserClient::ShouldS
+ bool ChromeContentBrowserClient::ShouldRunOutOfProcessSystemDnsResolution() {
+ // This enterprise policy is supported on Android, but the feature will not be
+ // launched there.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // This is possibly called before `g_browser_process` is initialized.
+ PrefService* local_state;
+ if (g_browser_process) {
diff --git a/electron34/patches/patch-chrome_browser_chrome__content__browser__client.h b/electron34/patches/patch-chrome_browser_chrome__content__browser__client.h
new file mode 100644
index 0000000000..b3897250e1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_chrome__content__browser__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/chrome_content_browser_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/chrome_content_browser_client.h
+@@ -538,7 +538,7 @@ class ChromeContentBrowserClient : publi
+ bool IsPluginAllowedToUseDevChannelAPIs(
+ content::BrowserContext* browser_context,
+ const GURL& url) override;
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
diff --git a/electron34/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc b/electron34/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
new file mode 100644
index 0000000000..ded8327da0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/component_updater/widevine_cdm_component_installer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/component_updater/widevine_cdm_component_installer.cc
+@@ -41,7 +41,7 @@
+ #include "third_party/widevine/cdm/buildflags.h"
+ #include "third_party/widevine/cdm/widevine_cdm_common.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/path_service.h"
+ #include "chrome/common/chrome_paths.h"
+ #include "chrome/common/media/component_widevine_cdm_hint_file_linux.h"
+@@ -74,7 +74,7 @@ static_assert(std::size(kWidevineSha2Has
+ const char ImageLoaderComponentName[] = "WidevineCdm";
+ #endif
+
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // On Linux and ChromeOS the Widevine CDM is loaded at startup before the
+ // zygote is locked down. As a result there is no need to register the CDM
+ // with Chrome as it can't be used until Chrome is restarted.
+@@ -102,7 +102,7 @@ void RegisterWidevineCdmWithChrome(const
+ }
+ #endif // !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux and ChromeOS the Widevine CDM is loaded at startup before the
+ // zygote is locked down. To locate the Widevine CDM at startup, a hint file
+ // is used. Update the hint file with the new Widevine CDM path.
+@@ -398,7 +398,7 @@ void WidevineCdmComponentInstallerPolicy
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ VLOG(1) << "Updating hint file with Widevine CDM " << cdm_version;
+
+ // This is running on a thread that allows IO, so simply update the hint file.
diff --git a/electron34/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc b/electron34/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
new file mode 100644
index 0000000000..8de94fb636
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/custom_handlers/chrome_protocol_handler_registry_delegate.cc
+@@ -68,7 +68,7 @@ void ChromeProtocolHandlerRegistryDelega
+ // If true default protocol handlers will be removed if the OS level
+ // registration for a protocol is no longer Chrome.
+ bool ChromeProtocolHandlerRegistryDelegate::ShouldRemoveHandlersNotInOS() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // We don't do this on Linux as the OS registration there is not reliable,
+ // and Chrome OS doesn't have any notion of OS registration.
+ // TODO(benwells): When Linux support is more reliable remove this
diff --git a/electron34/patches/patch-chrome_browser_defaults.cc b/electron34/patches/patch-chrome_browser_defaults.cc
new file mode 100644
index 0000000000..7275e8d7f1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_defaults.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/defaults.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/defaults.cc
+@@ -44,7 +44,7 @@ const bool kShowHelpMenuItemIcon = true;
+ const bool kShowHelpMenuItemIcon = false;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool kScrollEventChangesTab = true;
+ #else
+ const bool kScrollEventChangesTab = false;
diff --git a/electron34/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc b/electron34/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
new file mode 100644
index 0000000000..fda3f580eb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/device_identity/device_oauth2_token_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/device_identity/device_oauth2_token_service_factory.cc
+@@ -28,7 +28,7 @@ std::unique_ptr<DeviceOAuth2TokenStore>
+ return std::make_unique<chromeos::DeviceOAuth2TokenStoreChromeOS>(
+ local_state);
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ return std::make_unique<DeviceOAuth2TokenStoreDesktop>(local_state);
+ #else
+ NOTREACHED();
diff --git a/electron34/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h b/electron34/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h
new file mode 100644
index 0000000000..4fe32ffa5c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/diagnostics/diagnostics_writer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/diagnostics/diagnostics_writer.h
+@@ -14,6 +14,8 @@ namespace diagnostics {
+ // Console base class used internally.
+ class SimpleConsole;
+
++#undef MACHINE
++
+ class DiagnosticsWriter : public DiagnosticsModel::Observer {
+ public:
+ // The type of formatting done by this writer.
diff --git a/electron34/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc b/electron34/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc
new file mode 100644
index 0000000000..1a9c521887
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/chrome_download_manager_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/chrome_download_manager_delegate.cc
+@@ -1844,7 +1844,7 @@ void ChromeDownloadManagerDelegate::OnDo
+ bool ChromeDownloadManagerDelegate::IsOpenInBrowserPreferredForFile(
+ const base::FilePath& path) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (path.MatchesExtension(FILE_PATH_LITERAL(".pdf"))) {
+ return !download_prefs_->ShouldOpenPdfInSystemReader();
+ }
+@@ -1987,7 +1987,7 @@ void ChromeDownloadManagerDelegate::Chec
+ content::CheckDownloadAllowedCallback check_download_allowed_cb) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Don't download pdf if it is a file URL, as that might cause an infinite
+ // download loop if Chrome is not the system pdf viewer.
+ if (url.SchemeIsFile() && download_prefs_->ShouldOpenPdfInSystemReader()) {
+@@ -2069,7 +2069,7 @@ void ChromeDownloadManagerDelegate::Chec
+ DCHECK(download_item->IsSavePackageDownload());
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::optional<enterprise_connectors::AnalysisSettings> settings =
+ safe_browsing::DeepScanningRequest::ShouldUploadBinary(download_item);
+
diff --git a/electron34/patches/patch-chrome_browser_download_download__commands.cc b/electron34/patches/patch-chrome_browser_download_download__commands.cc
new file mode 100644
index 0000000000..d464b74361
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__commands.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_commands.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_commands.cc
+@@ -26,7 +26,7 @@
+ #include "ui/base/clipboard/scoped_clipboard_writer.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser.h"
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
+@@ -165,7 +165,7 @@ void DownloadCommands::ExecuteCommand(Co
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ Browser* DownloadCommands::GetBrowser() const {
+ if (!model_)
diff --git a/electron34/patches/patch-chrome_browser_download_download__commands.h b/electron34/patches/patch-chrome_browser_download_download__commands.h
new file mode 100644
index 0000000000..9d0e8078f2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__commands.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_commands.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_commands.h
+@@ -66,7 +66,7 @@ class DownloadCommands {
+ void ExecuteCommand(Command command);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool IsDownloadPdf() const;
+ bool CanOpenPdfInSystemViewer() const;
+ Browser* GetBrowser() const;
diff --git a/electron34/patches/patch-chrome_browser_download_download__file__picker.cc b/electron34/patches/patch-chrome_browser_download_download__file__picker.cc
new file mode 100644
index 0000000000..35297fa652
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__file__picker.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_file_picker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_file_picker.cc
+@@ -18,7 +18,7 @@
+ #include "content/public/browser/web_contents.h"
+ #include "ui/shell_dialogs/selected_file_info.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser_list.h"
+ #include "chrome/browser/ui/browser_window.h"
+ #include "ui/aura/window.h"
+@@ -83,7 +83,7 @@ DownloadFilePicker::DownloadFilePicker(d
+ // dialog in Linux (See SelectFileImpl() in select_file_dialog_linux_gtk.cc).
+ // and windows.Here we make owning_window host to browser current active
+ // window if it is null. https://crbug.com/1301898
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (!owning_window || !owning_window->GetHost()) {
+ owning_window = BrowserList::GetInstance()
+ ->GetLastActive()
diff --git a/electron34/patches/patch-chrome_browser_download_download__item__model.cc b/electron34/patches/patch-chrome_browser_download_download__item__model.cc
new file mode 100644
index 0000000000..5c53c45ab1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__item__model.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_item_model.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_item_model.cc
+@@ -756,7 +756,7 @@ bool DownloadItemModel::IsCommandChecked
+ download_crx_util::IsExtensionDownload(*download_);
+ case DownloadCommands::ALWAYS_OPEN_TYPE:
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (download_commands->CanOpenPdfInSystemViewer()) {
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile());
+ return prefs->ShouldOpenPdfInSystemReader();
+@@ -804,7 +804,7 @@ void DownloadItemModel::ExecuteCommand(D
+ DownloadCommands::ALWAYS_OPEN_TYPE);
+ DownloadPrefs* prefs = DownloadPrefs::FromBrowserContext(profile());
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (download_commands->CanOpenPdfInSystemViewer()) {
+ prefs->SetShouldOpenPdfInSystemReader(!is_checked);
+ SetShouldPreferOpeningInBrowser(is_checked);
+@@ -1190,7 +1190,7 @@ void DownloadItemModel::DetermineAndSetS
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (download_->GetOriginalMimeType() == "application/x-x509-user-cert") {
+ SetShouldPreferOpeningInBrowser(true);
+ return;
diff --git a/electron34/patches/patch-chrome_browser_download_download__prefs.cc b/electron34/patches/patch-chrome_browser_download_download__prefs.cc
new file mode 100644
index 0000000000..aae21d6796
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__prefs.cc
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_prefs.cc
+@@ -11,6 +11,7 @@
+ #include <vector>
+
+ #include "base/check.h"
++#include "base/command_line.h"
+ #include "base/feature_list.h"
+ #include "base/files/file_util.h"
+ #include "base/functional/bind.h"
+@@ -60,6 +61,10 @@
+ #include "chrome/browser/flags/android/chrome_feature_list.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ using content::BrowserContext;
+ using content::BrowserThread;
+ using content::DownloadManager;
+@@ -70,7 +75,7 @@ namespace {
+ // Consider downloads 'dangerous' if they go to the home directory on Linux and
+ // to the desktop on any platform.
+ bool DownloadPathIsDangerous(const base::FilePath& download_path) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath home_dir = base::GetHomeDir();
+ if (download_path == home_dir) {
+ return true;
+@@ -176,7 +181,7 @@ DownloadPrefs::DownloadPrefs(Profile* pr
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ should_open_pdf_in_system_reader_ =
+ prefs->GetBoolean(prefs::kOpenPdfDownloadInSystemReader);
+ #endif
+@@ -301,7 +306,7 @@ void DownloadPrefs::RegisterProfilePrefs
+ registry->RegisterFilePathPref(prefs::kSaveFileDefaultDirectory,
+ default_download_path);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kOpenPdfDownloadInSystemReader, false);
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
+@@ -468,7 +473,7 @@ void DownloadPrefs::DisableAutoOpenByUse
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void DownloadPrefs::SetShouldOpenPdfInSystemReader(bool should_open) {
+ if (should_open_pdf_in_system_reader_ == should_open)
+ return;
+@@ -494,7 +499,7 @@ bool DownloadPrefs::ShouldOpenPdfInSyste
+
+ void DownloadPrefs::ResetAutoOpenByUser() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ SetShouldOpenPdfInSystemReader(false);
+ #endif
+ auto_open_by_user_.clear();
+@@ -531,7 +536,7 @@ void DownloadPrefs::SaveAutoOpenState()
+ bool DownloadPrefs::CanPlatformEnableAutoOpenForPdf() const {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return false; // There is no UI for auto-open on ChromeOS.
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return ShouldOpenPdfInSystemReader();
+ #else
+ return false;
+@@ -683,7 +688,14 @@ base::FilePath DownloadPrefs::SanitizeDo
+ #else
+ // If the stored download directory is an absolute path, we presume it's
+ // correct; there's not really much more validation we can do here.
++#if BUILDFLAG(IS_OPENBSD)
++ // If unveil(2) is used, force the file dialog directory to something we
++ // know is available.
++ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++ if (!sandbox->unveil_initialized() && path.IsAbsolute())
++#else
+ if (path.IsAbsolute())
++#endif
+ return path;
+
+ // When the default download directory is *not* an absolute path, we use the
diff --git a/electron34/patches/patch-chrome_browser_download_download__prefs.h b/electron34/patches/patch-chrome_browser_download_download__prefs.h
new file mode 100644
index 0000000000..5e11736b72
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_download_download__prefs.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/download/download_prefs.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/download/download_prefs.h
+@@ -107,7 +107,7 @@ class DownloadPrefs {
+ void DisableAutoOpenByUserBasedOnExtension(const base::FilePath& file_name);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Store the user preference to disk. If |should_open| is true, also disable
+ // the built-in PDF plugin. If |should_open| is false, enable the PDF plugin.
+ void SetShouldOpenPdfInSystemReader(bool should_open);
+@@ -171,7 +171,7 @@ class DownloadPrefs {
+ std::unique_ptr<policy::URLBlocklist> auto_open_allowed_by_urls_;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool should_open_pdf_in_system_reader_;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
new file mode 100644
index 0000000000..7a954574f0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
+@@ -150,7 +150,7 @@ AnalysisServiceSettings::AnalysisService
+ const char* verification_key = kKeyWindowsVerification;
+ #elif BUILDFLAG(IS_MAC)
+ const char* verification_key = kKeyMacVerification;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char* verification_key = kKeyLinuxVerification;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_common.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_common.cc
new file mode 100644
index 0000000000..b8353b1649
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_common.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/common.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/common.cc
+@@ -23,7 +23,7 @@
+ #include "components/policy/core/common/policy_loader_lacros.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #include "components/prefs/pref_service.h"
+ #endif
+@@ -266,7 +266,7 @@ std::string GetProfileEmail(Profile* pro
+ std::string email =
+ GetProfileEmail(IdentityManagerFactory::GetForProfile(profile));
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (email.empty()) {
+ email = profile->GetPrefs()->GetString(
+ enterprise_signin::prefs::kProfileUserEmail);
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc
new file mode 100644
index 0000000000..a9498946a9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/connectors_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/connectors_service.cc
+@@ -509,7 +509,7 @@ bool ConnectorsService::ConnectorsEnable
+
+ Profile* profile = Profile::FromBrowserContext(context_);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, the guest profile is actually the primary OTR profile of
+ // the "regular" guest profile. The regular guest profile is never used
+ // directly by users. Also, user are not able to create child OTR profiles
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
new file mode 100644
index 0000000000..595fce3b82
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.cc
+@@ -10,7 +10,7 @@
+ #include "chrome/browser/profiles/profile.h"
+ #include "components/keyed_service/core/keyed_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/browser/signing_key_policy_observer.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+@@ -40,7 +40,7 @@ DeviceTrustConnectorService* DeviceTrust
+
+ bool DeviceTrustConnectorServiceFactory::ServiceIsCreatedWithBrowserContext()
+ const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
+@@ -84,7 +84,7 @@ DeviceTrustConnectorServiceFactory::Buil
+ std::unique_ptr<DeviceTrustConnectorService> service =
+ std::make_unique<DeviceTrustConnectorService>(profile->GetPrefs());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* key_manager = g_browser_process->browser_policy_connector()
+ ->chrome_browser_cloud_management_controller()
+ ->GetDeviceTrustKeyManager();
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
new file mode 100644
index 0000000000..e5ff8b4688
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.cc
+@@ -23,7 +23,7 @@
+ #include "components/policy/core/common/management/management_service.h"
+ #include "content/public/browser/browser_context.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/browser_attestation_service.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/attestation/browser/device_attester.h"
+@@ -54,7 +54,7 @@ bool IsProfileManaged(Profile* profile)
+ return management_service && management_service->IsManaged();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ policy::CloudPolicyStore* GetUserCloudPolicyStore(Profile* profile) {
+ policy::CloudPolicyManager* user_policy_manager =
+ profile->GetCloudPolicyManager();
+@@ -106,7 +106,7 @@ DeviceTrustServiceFactory::DeviceTrustSe
+ DependsOn(DeviceTrustConnectorServiceFactory::GetInstance());
+ DependsOn(policy::ManagementServiceFactory::GetInstance());
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Depends on this service via the SignalsService having a dependency on it.
+ DependsOn(enterprise_signals::SignalsAggregatorFactory::GetInstance());
+ // Depends on this service via the ProfileAttester having a dependency on it
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
new file mode 100644
index 0000000000..221cbad9f2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc
+@@ -19,7 +19,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/win_key_rotation_command.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/linux_key_rotation_command.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/mac_key_rotation_command.h"
+@@ -53,7 +53,7 @@ std::unique_ptr<KeyRotationCommand> KeyR
+ policy::DeviceManagementService* device_management_service) {
+ #if BUILDFLAG(IS_WIN)
+ return std::make_unique<WinKeyRotationCommand>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<LinuxKeyRotationCommand>(url_loader_factory);
+ #elif BUILDFLAG(IS_MAC)
+ if (IsDTCKeyRotationUploadedBySharedAPI()) {
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
new file mode 100644
index 0000000000..0ae2aa8b87
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/key_persistence_delegate_factory.cc
+@@ -13,7 +13,7 @@
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/win_key_persistence_delegate.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/mac_key_persistence_delegate.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/core/persistence/linux_key_persistence_delegate.h"
+ #endif
+
+@@ -45,7 +45,7 @@ KeyPersistenceDelegateFactory::CreateKey
+ return std::make_unique<WinKeyPersistenceDelegate>();
+ #elif BUILDFLAG(IS_MAC)
+ return std::make_unique<MacKeyPersistenceDelegate>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<LinuxKeyPersistenceDelegate>();
+ #else
+ NOTREACHED();
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
new file mode 100644
index 0000000000..083d1c265e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/device_trust/signals/signals_service_factory.cc
+@@ -21,7 +21,7 @@
+ #include "chrome/browser/profiles/profile.h"
+ #include "components/policy/core/common/management/management_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/check.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/signals/decorators/browser/browser_signals_decorator.h"
+ #include "chrome/browser/enterprise/core/dependency_factory_impl.h"
+@@ -58,7 +58,7 @@ std::unique_ptr<SignalsService> CreateSi
+ enterprise_signals::ContextInfoFetcher::CreateInstance(
+ profile, ConnectorsServiceFactory::GetForBrowserContext(profile))));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ policy::CloudPolicyManager* browser_policy_manager = nullptr;
+ if (management_service->HasManagementAuthority(
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
new file mode 100644
index 0000000000..5bf2b2f17f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/reporting/browser_crash_event_router.cc
+@@ -13,7 +13,7 @@ namespace enterprise_connectors {
+
+ BrowserCrashEventRouter::BrowserCrashEventRouter(
+ content::BrowserContext* context) {
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ CrashReportingContext* crash_reporting_context =
+ CrashReportingContext::GetInstance();
+ Profile* profile = Profile::FromBrowserContext(context);
+@@ -23,7 +23,7 @@ BrowserCrashEventRouter::BrowserCrashEve
+ }
+
+ BrowserCrashEventRouter::~BrowserCrashEventRouter() {
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ CrashReportingContext* crash_reporting_context =
+ CrashReportingContext::GetInstance();
+ crash_reporting_context->RemoveProfile(this);
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
new file mode 100644
index 0000000000..710b456b1a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc
+@@ -20,7 +20,7 @@
+
+ namespace enterprise_connectors {
+
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+
+ namespace {
+
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
new file mode 100644
index 0000000000..a3512ccd7d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc
+@@ -58,7 +58,7 @@
+ #include "base/strings/utf_string_conversions.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/signals_aggregator_factory.h"
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #include "components/device_signals/core/browser/signals_aggregator.h"
+@@ -181,7 +181,7 @@ void RealtimeReportingClient::ReportPast
+ /*include_profile_user_name=*/false);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ void AddCrowdstrikeSignalsToEvent(
+ base::Value::Dict& event,
+@@ -217,7 +217,7 @@ std::string RealtimeReportingClient::Get
+ username_ =
+ identity_manager_ ? GetProfileEmail(identity_manager_) : std::string();
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (username_.empty()) {
+ username_ = Profile::FromBrowserContext(context_)->GetPrefs()->GetString(
+ enterprise_signin::prefs::kProfileUserEmail);
+@@ -275,7 +275,7 @@ std::string RealtimeReportingClient::Get
+ return client_id;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(notyet)
+ void RealtimeReportingClient::MaybeCollectDeviceSignalsAndReportEvent(
+ base::Value::Dict event,
+ policy::CloudPolicyClient* client,
diff --git a/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
new file mode 100644
index 0000000000..955445dbd6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h
+@@ -18,7 +18,7 @@
+ #include "components/keyed_service/core/keyed_service.h"
+ #include "components/policy/core/common/cloud/cloud_policy_client.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/device_signals/core/browser/signals_types.h"
+ #endif
+
+@@ -112,7 +112,7 @@ class RealtimeReportingClient : public R
+ const std::string& dm_token) override;
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(notyet)
+ void MaybeCollectDeviceSignalsAndReportEvent(
+ base::Value::Dict event,
+ policy::CloudPolicyClient* client,
+@@ -151,7 +151,7 @@ class RealtimeReportingClient : public R
+ base::WeakPtrFactory<RealtimeReportingClient> weak_ptr_factory_{this};
+ };
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Populate event dict with CrowdStrike signal values. If those signals are
+ // available in `response`, this function returns a Dict with the following
+ // fields added:
diff --git a/electron34/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc b/electron34/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
new file mode 100644
index 0000000000..c53d5aba3b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/identifiers/profile_id_delegate_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/identifiers/profile_id_delegate_impl.cc
+@@ -13,7 +13,7 @@
+ #include "components/enterprise/browser/identifiers/identifiers_prefs.h"
+ #include "components/prefs/pref_service.h"
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "components/enterprise/browser/controller/browser_dm_token_storage.h"
+ #if BUILDFLAG(IS_WIN)
+ #include "base/strings/utf_string_conversions.h"
+@@ -94,7 +94,7 @@ std::string ProfileIdDelegateImpl::GetDe
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Gets the device ID from the BrowserDMTokenStorage.
+ std::string ProfileIdDelegateImpl::GetId() {
+ std::string device_id =
diff --git a/electron34/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc b/electron34/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
new file mode 100644
index 0000000000..a588bd2236
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc
+@@ -67,8 +67,8 @@ base::flat_map<std::string, SAMLProfileA
+ // TODO(crbug.com/40267996): Add actual domains with attribute names.
+ profile_attributes->insert(std::make_pair(
+ "supported.test",
+- SAMLProfileAttributes("placeholderName", "placeholderDomain",
+- "placeholderToken")));
++ SAMLProfileAttributes(SAMLProfileAttributes{"placeholderName", "placeholderDomain",
++ "placeholderToken"})));
+
+ // Extract domains and attributes from the command line switch.
+ const base::CommandLine& command_line =
diff --git a/electron34/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc b/electron34/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
new file mode 100644
index 0000000000..387df8ca11
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/remote_commands/cbcm_remote_commands_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/remote_commands/cbcm_remote_commands_factory.cc
+@@ -11,7 +11,7 @@
+ #include "chrome/browser/profiles/profile_manager.h"
+ #include "components/policy/core/common/remote_commands/remote_command_job.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/remote_commands/rotate_attestation_credential_job.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+ #include "components/enterprise/browser/controller/chrome_browser_cloud_management_controller.h"
+@@ -30,7 +30,7 @@ CBCMRemoteCommandsFactory::BuildJobForTy
+ g_browser_process->profile_manager());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (type == enterprise_management::
+ RemoteCommand_Type_BROWSER_ROTATE_ATTESTATION_CREDENTIAL) {
+ return std::make_unique<RotateAttestationCredentialJob>(
diff --git a/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc b/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
new file mode 100644
index 0000000000..78d0fa812f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/signals/device_info_fetcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/signals/device_info_fetcher.cc
+@@ -10,7 +10,7 @@
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_mac.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_linux.h"
+ #endif
+
+@@ -67,7 +67,7 @@ std::unique_ptr<DeviceInfoFetcher> Devic
+ return CreateInstanceInternal();
+ }
+
+-#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && \
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD) && \
+ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+ // static
+ std::unique_ptr<DeviceInfoFetcher> DeviceInfoFetcher::CreateInstanceInternal() {
diff --git a/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc b/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
new file mode 100644
index 0000000000..09f9e49440
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
@@ -0,0 +1,83 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/signals/device_info_fetcher_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/signals/device_info_fetcher_linux.cc
+@@ -4,11 +4,22 @@
+
+ #include "chrome/browser/enterprise/signals/device_info_fetcher_linux.h"
+
++#include "build/build_config.h"
++
+ #if defined(USE_GIO)
+ #include <gio/gio.h>
+ #endif // defined(USE_GIO)
+ #include <sys/stat.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/sysmacros.h>
++#endif
++
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#include <sys/socket.h>
++#include <ifaddrs.h>
++#include <net/if_dl.h>
++#endif
+
+ #include <string>
+
+@@ -117,6 +128,7 @@ SettingValue GetScreenlockSecured() {
+ // Implements the logic from the native host installation script. First find the
+ // root device identifier, then locate its parent and get its type.
+ SettingValue GetDiskEncrypted() {
++#if !BUILDFLAG(IS_BSD)
+ struct stat info;
+ // First figure out the device identifier. Fail fast if this fails.
+ if (stat("/", &info) != 0)
+@@ -138,11 +150,35 @@ SettingValue GetDiskEncrypted() {
+ }
+ return SettingValue::UNKNOWN;
+ }
++#endif
+ return SettingValue::DISABLED;
+ }
+
+ std::vector<std::string> GetMacAddresses() {
+ std::vector<std::string> result;
++#if BUILDFLAG(IS_BSD)
++ struct ifaddrs* ifa = nullptr;
++
++ if (getifaddrs(&ifa) != 0)
++ return result;
++
++ struct ifaddrs* interface = ifa;
++ for (; interface != nullptr; interface = interface->ifa_next) {
++ if (interface->ifa_addr == nullptr ||
++ interface->ifa_addr->sa_family != AF_LINK) {
++ continue;
++ }
++ struct sockaddr_dl* sdl =
++ reinterpret_cast<struct sockaddr_dl*>(interface->ifa_addr);
++ if (!sdl || sdl->sdl_alen != 6)
++ continue;
++ char* link_address = static_cast<char*>(LLADDR(sdl));
++ result.push_back(base::StringPrintf(
++ "%02x:%02x:%02x:%02x:%02x:%02x", link_address[0] & 0xff,
++ link_address[1] & 0xff, link_address[2] & 0xff, link_address[3] & 0xff,
++ link_address[4] & 0xff, link_address[5] & 0xff));
++ }
++#else
+ base::DirReaderPosix reader("/sys/class/net");
+ if (!reader.IsValid())
+ return result;
+@@ -165,6 +201,7 @@ std::vector<std::string> GetMacAddresses
+ &address);
+ result.push_back(address);
+ }
++#endif
+ return result;
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h b/electron34/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h
new file mode 100644
index 0000000000..a6614e8efc
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/signin/enterprise_signin_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/signin/enterprise_signin_service.h
+@@ -9,7 +9,7 @@
+
+ #include "build/build_config.h"
+
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD))
+ #error EnterpriseSigninService should only be built on desktop platforms.
+ #endif // !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN))
+
diff --git a/electron34/patches/patch-chrome_browser_enterprise_signin_interstitials_managed__profile__required__page.cc b/electron34/patches/patch-chrome_browser_enterprise_signin_interstitials_managed__profile__required__page.cc
new file mode 100644
index 0000000000..50adb2b84e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_enterprise_signin_interstitials_managed__profile__required__page.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/enterprise/signin/interstitials/managed_profile_required_page.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/enterprise/signin/interstitials/managed_profile_required_page.cc
+@@ -89,7 +89,7 @@ void ManagedProfileRequiredPage::Command
+
+ switch (cmd) {
+ case security_interstitials::CMD_DONT_PROCEED:
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (ManagedProfileRequiredNavigationThrottle::IsBlockingNavigations(
+ web_contents()->GetBrowserContext())) {
+ ManagedProfileRequiredNavigationThrottle::ShowBlockedWindow(
diff --git a/electron34/patches/patch-chrome_browser_extensions_BUILD.gn b/electron34/patches/patch-chrome_browser_extensions_BUILD.gn
new file mode 100644
index 0000000000..7ad86e1332
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_BUILD.gn
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/BUILD.gn
+@@ -1426,6 +1426,10 @@ source_set("extensions") {
+ deps += [ "//chrome/services/printing/public/mojom" ]
+ }
+
++ if (is_bsd) {
++ sources -= [ "api/image_writer_private/removable_storage_provider_linux.cc" ]
++ }
++
+ if (enable_pdf) {
+ deps += [
+ "//chrome/browser/pdf",
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc b/electron34/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 0000000000..2b5c1734ee
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc
+@@ -45,7 +45,7 @@
+ #include "pdf/buildflags.h"
+ #include "printing/buildflags/buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/extensions/api/system_indicator/system_indicator_manager_factory.h"
+ #endif
+
+@@ -114,7 +114,7 @@ void EnsureApiBrowserContextKeyedService
+ extensions::SettingsPrivateEventRouterFactory::GetInstance();
+ extensions::SettingsOverridesAPI::GetFactoryInstance();
+ extensions::SidePanelService::GetFactoryInstance();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extensions::SystemIndicatorManagerFactory::GetInstance();
+ #endif
+ extensions::TabGroupsEventRouterFactory::GetInstance();
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
new file mode 100644
index 0000000000..b3f09114f5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/chrome_desktop_report_request_helper.cc
+@@ -24,7 +24,7 @@
+ #include "base/win/registry.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #endif
+@@ -255,7 +255,7 @@ base::FilePath GetEndpointVerificationDi
+ bool got_path = false;
+ #if BUILDFLAG(IS_WIN)
+ got_path = base::PathService::Get(base::DIR_LOCAL_APP_DATA, &path);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ path = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgConfigHomeEnvVar,
+ base::nix::kDotConfigDir);
+@@ -266,7 +266,7 @@ base::FilePath GetEndpointVerificationDi
+ if (!got_path)
+ return path;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ path = path.AppendASCII("google");
+ #else
+ path = path.AppendASCII("Google");
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
new file mode 100644
index 0000000000..3eb70466c5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.cc
+@@ -8,7 +8,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ #include <memory>
+ #include <utility>
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
new file mode 100644
index 0000000000..1cf3b0736c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/conversion_utils.h
+@@ -7,7 +7,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ #include <optional>
+ #include <vector>
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
new file mode 100644
index 0000000000..2f127989f1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
+@@ -42,7 +42,7 @@
+ #include "components/reporting/util/statusor.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <optional>
+
+ #include "base/strings/string_util.h"
+@@ -159,7 +159,7 @@ api::enterprise_reporting_private::Conte
+ }
+
+ bool AllowClientCertificateReportingForUsers() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(
+ enterprise_signals::features::kAllowClientCertificateReportingForUsers);
+ #else
+@@ -172,7 +172,7 @@ bool IsProfilePrefManaged(Profile* profi
+ return pref && pref->IsManaged();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ device_signals::SignalsAggregationRequest CreateAggregationRequest(
+ device_signals::SignalName signal_name) {
+@@ -234,7 +234,7 @@ EnterpriseReportingPrivateGetDeviceIdFun
+
+ // getPersistentSecret
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+
+ EnterpriseReportingPrivateGetPersistentSecretFunction::
+ EnterpriseReportingPrivateGetPersistentSecretFunction() = default;
+@@ -672,7 +672,7 @@ void EnterpriseReportingPrivateEnqueueRe
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // getFileSystemInfo
+
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
new file mode 100644
index 0000000000..1dff7d5c13
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.h
+@@ -20,7 +20,7 @@
+ #include "components/reporting/proto/synced/record.pb.h"
+ #include "components/reporting/proto/synced/record_constants.pb.h"
+ #include "components/reporting/util/statusor.h"
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/time/time.h"
+ #include "components/device_signals/core/browser/signals_types.h"
+ #endif // BUILDFLAG(IS_CHROMEOS)
+@@ -56,7 +56,7 @@ class EnterpriseReportingPrivateGetDevic
+ ~EnterpriseReportingPrivateGetDeviceIdFunction() override;
+ };
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+
+ class EnterpriseReportingPrivateGetPersistentSecretFunction
+ : public ExtensionFunction {
+@@ -266,7 +266,7 @@ class EnterpriseReportingPrivateEnqueueR
+
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ class EnterpriseReportingPrivateGetFileSystemInfoFunction
+ : public ExtensionFunction {
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc b/electron34/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
new file mode 100644
index 0000000000..330203bed9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/image_writer_private/removable_storage_provider.cc
+@@ -20,6 +20,7 @@ static base::LazyInstance<scoped_refptr<
+
+ void RemovableStorageProvider::GetAllDevices(DeviceListReadyCallback callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
++#if !BUILDFLAG(IS_BSD)
+ if (g_test_device_list.Get().get() != nullptr) {
+ base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
+ FROM_HERE,
+@@ -33,6 +34,9 @@ void RemovableStorageProvider::GetAllDev
+ base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN},
+ base::BindOnce(&RemovableStorageProvider::PopulateDeviceList),
+ std::move(callback));
++#else
++ NOTIMPLEMENTED();
++#endif
+ }
+
+ // static
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc b/electron34/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
new file mode 100644
index 0000000000..475f2e7d84
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/management/chrome_management_api_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+@@ -407,7 +407,7 @@ bool ChromeManagementAPIDelegate::Launch
+ apps::LaunchContainer launch_container =
+ GetLaunchContainer(extensions::ExtensionPrefs::Get(context), extension);
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (extensions::IsExtensionUnsupportedDeprecatedApp(profile,
+ extension->id())) {
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc b/electron34/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc
new file mode 100644
index 0000000000..fc91a119d4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/messaging/launch_context_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/messaging/launch_context_posix.cc
+@@ -84,7 +84,7 @@ std::optional<LaunchContext::ProcessStat
+
+ options.current_directory = command_line.GetProgram().DirName();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Don't use no_new_privs mode, e.g. in case the host needs to use sudo.
+ options.allow_new_privs = true;
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc b/electron34/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
new file mode 100644
index 0000000000..4cf53035cf
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+@@ -645,7 +645,7 @@ void PasswordsPrivateDelegateImpl::OnFet
+ }
+
+ void PasswordsPrivateDelegateImpl::OsReauthTimeoutCall() {
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ PasswordsPrivateEventRouter* router =
+ PasswordsPrivateEventRouterFactory::GetForProfile(profile_);
+ if (router) {
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc b/electron34/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
new file mode 100644
index 0000000000..ff6b252dfe
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
+@@ -288,7 +288,11 @@ bool ChromeRuntimeAPIDelegate::GetPlatfo
+ } else if (strcmp(os, "linux") == 0) {
+ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else if (strcmp(os, "openbsd") == 0) {
+- info->os = extensions::api::runtime::PlatformOs::kOpenbsd;
++ info->os = extensions::api::runtime::PlatformOs::kLinux;
++ } else if (strcmp(os, "freebsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kLinux;
++ } else if (strcmp(os, "netbsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else {
+ NOTREACHED() << "Platform not supported: " << os;
+ }
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc b/electron34/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
new file mode 100644
index 0000000000..26f28251a1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/settings_private/prefs_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/settings_private/prefs_util.cc
+@@ -189,7 +189,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
+ (*s_allowlist)[autofill::prefs::kAutofillPaymentCardBenefits] =
+ settings_api::PrefType::kBoolean;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ (*s_allowlist)[autofill::prefs::kAutofillPredictionImprovementsEnabled] =
+ settings_api::PrefType::kBoolean;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+@@ -207,7 +207,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
+ (*s_allowlist)[tab_groups::prefs::kAutoPinNewTabGroups] =
+ settings_api::PrefType::kBoolean;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ (*s_allowlist)[::prefs::kUseCustomChromeFrame] =
+ settings_api::PrefType::kBoolean;
+ #endif
+@@ -219,7 +219,7 @@ const PrefsUtil::TypedPrefMap& PrefsUtil
+ (*s_allowlist)[::prefs::kCurrentThemeID] = settings_api::PrefType::kString;
+ (*s_allowlist)[::prefs::kPinnedActions] = settings_api::PrefType::kList;
+ (*s_allowlist)[::prefs::kPolicyThemeColor] = settings_api::PrefType::kNumber;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ (*s_allowlist)[::prefs::kSystemTheme] = settings_api::PrefType::kNumber;
+ #endif
+ (*s_allowlist)[::prefs::kHomePage] = settings_api::PrefType::kUrl;
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc b/electron34/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
new file mode 100644
index 0000000000..4fb55d48d3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/tabs/tabs_api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/tabs/tabs_api.cc
+@@ -916,7 +916,7 @@ ExtensionFunction::ResponseAction Window
+ // created as minimized.
+ // TODO(crbug.com/40254339): Remove this workaround when linux is fixed.
+ // TODO(crbug.com/40254339): Find a fix for wayland as well.
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ if (new_window->initial_show_state() ==
+ ui::mojom::WindowShowState::kMinimized) {
+ new_window->window()->Minimize();
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc b/electron34/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
new file mode 100644
index 0000000000..b3294f8261
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+@@ -28,7 +28,7 @@
+ #include "extensions/browser/process_manager.h"
+ #include "extensions/common/error_utils.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "extensions/common/permissions/permissions_data.h"
+ #endif
+
+@@ -37,7 +37,7 @@ namespace {
+ bool CanEnableAudioDebugRecordingsFromExtension(
+ const extensions::Extension* extension) {
+ bool enabled_by_permissions = false;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (extension) {
+ enabled_by_permissions =
+ extension->permissions_data()->active_permissions().HasAPIPermission(
+@@ -575,7 +575,7 @@ void WebrtcLoggingPrivateStartEventLoggi
+
+ ExtensionFunction::ResponseAction
+ WebrtcLoggingPrivateGetLogsDirectoryFunction::Run() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Unlike other WebrtcLoggingPrivate functions that take a RequestInfo object,
+ // this function shouldn't be called by a component extension on behalf of
+ // some web code. It returns a DirectoryEntry for use directly in the calling
diff --git a/electron34/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc b/electron34/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
new file mode 100644
index 0000000000..db9804eb3d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/api/webstore_private/webstore_private_api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+@@ -913,7 +913,7 @@ void WebstorePrivateBeginInstallWithMani
+ #if BUILDFLAG(IS_CHROMEOS)
+ RequestExtensionApproval(contents);
+ return;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Shows a parental permission dialog directly bypassing the extension
+ // install dialog view. The parental permission dialog contains a superset
+ // of data from the extension install dialog: requested extension
diff --git a/electron34/patches/patch-chrome_browser_extensions_external__provider__impl.cc b/electron34/patches/patch-chrome_browser_extensions_external__provider__impl.cc
new file mode 100644
index 0000000000..b4862ebf65
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_external__provider__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/external_provider_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/external_provider_impl.cc
+@@ -790,7 +790,7 @@ void ExternalProviderImpl::CreateExterna
+
+ #endif // BUILDFLAG(IS_CHROMEOS)
+ if (!profile->GetPrefs()->GetBoolean(pref_names::kBlockExternalExtensions)) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ provider_list->push_back(std::make_unique<ExternalProviderImpl>(
+ service,
+ base::MakeRefCounted<ExternalPrefLoader>(
+@@ -818,7 +818,7 @@ void ExternalProviderImpl::CreateExterna
+ bundled_extension_creation_flags));
+
+ // Define a per-user source of external extensions.
+-#if BUILDFLAG(IS_MAC) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if BUILDFLAG(IS_MAC) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(CHROMIUM_BRANDING))
+ provider_list->push_back(std::make_unique<ExternalProviderImpl>(
+ service,
diff --git a/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc
new file mode 100644
index 0000000000..1ff44b9f06
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/global_shortcut_listener.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/global_shortcut_listener.cc
+@@ -8,6 +8,7 @@
+ #include "base/not_fatal_until.h"
+ #include "base/notreached.h"
+ #include "content/public/browser/browser_thread.h"
++#include "content/public/browser/media_keys_listener_manager.h"
+ #include "ui/base/accelerators/accelerator.h"
+
+ using content::BrowserThread;
+@@ -67,6 +68,22 @@ void GlobalShortcutListener::UnregisterA
+ StopListening();
+ }
+
++// static
++void GlobalShortcutListener::SetShouldUseInternalMediaKeyHandling(bool should_use) {
++ if (content::MediaKeysListenerManager::
++ IsMediaKeysListenerManagerEnabled()) {
++ content::MediaKeysListenerManager* media_keys_listener_manager =
++ content::MediaKeysListenerManager::GetInstance();
++ DCHECK(media_keys_listener_manager);
++
++ if (should_use) {
++ media_keys_listener_manager->EnableInternalMediaKeyHandling();
++ } else {
++ media_keys_listener_manager->DisableInternalMediaKeyHandling();
++ }
++ }
++}
++
+ void GlobalShortcutListener::UnregisterAccelerators(Observer* observer) {
+ CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ if (IsShortcutHandlingSuspended())
diff --git a/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.h b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.h
new file mode 100644
index 0000000000..055c021d2f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/global_shortcut_listener.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/global_shortcut_listener.h
+@@ -34,6 +34,8 @@ class GlobalShortcutListener {
+
+ static GlobalShortcutListener* GetInstance();
+
++ static void SetShouldUseInternalMediaKeyHandling(bool should_use);
++
+ // Register an observer for when a certain |accelerator| is struck. Returns
+ // true if register successfully, or false if 1) the specificied |accelerator|
+ // has been registered by another caller or other native applications, or
diff --git a/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc
new file mode 100644
index 0000000000..c7f0213e8b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/global_shortcut_listener_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/global_shortcut_listener_ozone.cc
+@@ -58,7 +58,8 @@ bool GlobalShortcutListenerOzone::Regist
+ const bool registered =
+ platform_global_shortcut_listener_->RegisterAccelerator(
+ accelerator.key_code(), accelerator.IsAltDown(),
+- accelerator.IsCtrlDown(), accelerator.IsShiftDown());
++ accelerator.IsCtrlDown(), accelerator.IsShiftDown(),
++ accelerator.IsCmdDown());
+ if (registered)
+ registered_hot_keys_.insert(accelerator);
+ return registered;
+@@ -72,14 +73,15 @@ void GlobalShortcutListenerOzone::Unregi
+
+ platform_global_shortcut_listener_->UnregisterAccelerator(
+ accelerator.key_code(), accelerator.IsAltDown(), accelerator.IsCtrlDown(),
+- accelerator.IsShiftDown());
++ accelerator.IsShiftDown(), accelerator.IsCmdDown());
+ registered_hot_keys_.erase(accelerator);
+ }
+
+ void GlobalShortcutListenerOzone::OnKeyPressed(ui::KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
++ bool is_shift_down,
++ bool is_cmd_down) {
+ int modifiers = 0;
+ if (is_alt_down)
+ modifiers |= ui::EF_ALT_DOWN;
+@@ -87,6 +89,8 @@ void GlobalShortcutListenerOzone::OnKeyP
+ modifiers |= ui::EF_CONTROL_DOWN;
+ if (is_shift_down)
+ modifiers |= ui::EF_SHIFT_DOWN;
++ if (is_cmd_down)
++ modifiers |= ui::EF_COMMAND_DOWN;
+
+ NotifyKeyPressed(ui::Accelerator(key_code, modifiers));
+ }
diff --git a/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h
new file mode 100644
index 0000000000..409d01ff54
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/global_shortcut_listener_ozone.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/global_shortcut_listener_ozone.h
+@@ -46,7 +46,8 @@ class GlobalShortcutListenerOzone
+ void OnKeyPressed(ui::KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) override;
++ bool is_shift_down,
++ bool is_cmd_down) override;
+ void OnPlatformListenerDestroyed() override;
+
+ bool is_listening_ = false;
diff --git a/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc
new file mode 100644
index 0000000000..dacd9e0304
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/extensions/global_shortcut_listener_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/extensions/global_shortcut_listener_win.cc
+@@ -64,6 +64,8 @@ void GlobalShortcutListenerWin::OnWndPro
+ modifiers |= (LOWORD(lparam) & MOD_SHIFT) ? ui::EF_SHIFT_DOWN : 0;
+ modifiers |= (LOWORD(lparam) & MOD_ALT) ? ui::EF_ALT_DOWN : 0;
+ modifiers |= (LOWORD(lparam) & MOD_CONTROL) ? ui::EF_CONTROL_DOWN : 0;
++ modifiers |= (LOWORD(lparam) & MOD_WIN) ? ui::EF_COMMAND_DOWN : 0;
++
+ ui::Accelerator accelerator(
+ ui::KeyboardCodeForWindowsKeyCode(key_code), modifiers);
+
+@@ -94,6 +96,7 @@ bool GlobalShortcutListenerWin::Register
+ modifiers |= accelerator.IsShiftDown() ? MOD_SHIFT : 0;
+ modifiers |= accelerator.IsCtrlDown() ? MOD_CONTROL : 0;
+ modifiers |= accelerator.IsAltDown() ? MOD_ALT : 0;
++ modifiers |= accelerator.IsCmdDown() ? MOD_WIN : 0;
+
+ // Create an observer that registers a hot key for |accelerator|.
+ std::unique_ptr<gfx::SingletonHwndHotKeyObserver> observer =
diff --git a/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc b/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc
new file mode 100644
index 0000000000..77970ac799
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc
@@ -0,0 +1,149 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+@@ -47,7 +47,6 @@
+ #include "chrome/browser/ui/file_system_access/file_system_access_dangerous_file_dialog.h"
+ #include "chrome/browser/ui/file_system_access/file_system_access_dialogs.h"
+ #include "chrome/browser/ui/file_system_access/file_system_access_restricted_directory_dialog.h"
+-#include "chrome/common/chrome_paths.h"
+ #include "chrome/grit/generated_resources.h"
+ #include "components/content_settings/core/browser/host_content_settings_map.h"
+ #include "components/content_settings/core/common/content_settings.h"
+@@ -252,128 +251,10 @@ bool MaybeIsLocalUNCPath(const base::Fil
+ }
+ #endif
+
+-// Sentinel used to indicate that no PathService key is specified for a path in
+-// the struct below.
+-constexpr const int kNoBasePathKey = -1;
+-
+-enum BlockType {
+- kBlockAllChildren,
+- kBlockNestedDirectories,
+- kDontBlockChildren
+-};
+-
+-const struct {
+- // base::BasePathKey value (or one of the platform specific extensions to it)
+- // for a path that should be blocked. Specify kNoBasePathKey if |path| should
+- // be used instead.
+- int base_path_key;
+-
+- // Explicit path to block instead of using |base_path_key|. Set to nullptr to
+- // use |base_path_key| on its own. If both |base_path_key| and |path| are set,
+- // |path| is treated relative to the path |base_path_key| resolves to.
+- const base::FilePath::CharType* path;
+-
+- // If this is set to kDontBlockChildren, only the given path and its parents
+- // are blocked. If this is set to kBlockAllChildren, all children of the given
+- // path are blocked as well. Finally if this is set to kBlockNestedDirectories
+- // access is allowed to individual files in the directory, but nested
+- // directories are still blocked.
+- // The BlockType of the nearest ancestor of a path to check is what ultimately
+- // determines if a path is blocked or not. If a blocked path is a descendent
+- // of another blocked path, then it may override the child-blocking policy of
+- // its ancestor. For example, if /home blocks all children, but
+- // /home/downloads does not, then /home/downloads/file.ext will *not* be
+- // blocked.
+- BlockType type;
+-} kBlockedPaths[] = {
+- // Don't allow users to share their entire home directory, entire desktop or
+- // entire documents folder, but do allow sharing anything inside those
+- // directories not otherwise blocked.
+- {base::DIR_HOME, nullptr, kDontBlockChildren},
+- {base::DIR_USER_DESKTOP, nullptr, kDontBlockChildren},
+- {chrome::DIR_USER_DOCUMENTS, nullptr, kDontBlockChildren},
+- // Similar restrictions for the downloads directory.
+- {chrome::DIR_DEFAULT_DOWNLOADS, nullptr, kDontBlockChildren},
+- {chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr, kDontBlockChildren},
+- // The Chrome installation itself should not be modified by the web.
+- {base::DIR_EXE, nullptr, kBlockAllChildren},
+- {base::DIR_MODULE, nullptr, kBlockAllChildren},
+- {base::DIR_ASSETS, nullptr, kBlockAllChildren},
+- // And neither should the configuration of at least the currently running
+- // Chrome instance (note that this does not take --user-data-dir command
+- // line overrides into account).
+- {chrome::DIR_USER_DATA, nullptr, kBlockAllChildren},
+- // ~/.ssh is pretty sensitive on all platforms, so block access to that.
+- {base::DIR_HOME, FILE_PATH_LITERAL(".ssh"), kBlockAllChildren},
+- // And limit access to ~/.gnupg as well.
+- {base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"), kBlockAllChildren},
+-#if BUILDFLAG(IS_WIN)
+- // Some Windows specific directories to block, basically all apps, the
+- // operating system itself, as well as configuration data for apps.
+- {base::DIR_PROGRAM_FILES, nullptr, kBlockAllChildren},
+- {base::DIR_PROGRAM_FILESX86, nullptr, kBlockAllChildren},
+- {base::DIR_PROGRAM_FILES6432, nullptr, kBlockAllChildren},
+- {base::DIR_WINDOWS, nullptr, kBlockAllChildren},
+- {base::DIR_ROAMING_APP_DATA, nullptr, kBlockAllChildren},
+- {base::DIR_LOCAL_APP_DATA, nullptr, kBlockAllChildren},
+- {base::DIR_COMMON_APP_DATA, nullptr, kBlockAllChildren},
+- // Opening a file from an MTP device, such as a smartphone or a camera, is
+- // implemented by Windows as opening a file in the temporary internet files
+- // directory. To support that, allow opening files in that directory, but
+- // not whole directories.
+- {base::DIR_IE_INTERNET_CACHE, nullptr, kBlockNestedDirectories},
+-#endif
+-#if BUILDFLAG(IS_MAC)
+- // Similar Mac specific blocks.
+- {base::DIR_APP_DATA, nullptr, kBlockAllChildren},
+- // Block access to the current bundle directory.
+- {chrome::DIR_OUTER_BUNDLE, nullptr, kBlockAllChildren},
+- // Block access to the user's Applications directory.
+- {base::DIR_HOME, FILE_PATH_LITERAL("Applications"), kBlockAllChildren},
+- // Block access to the root Applications directory.
+- {kNoBasePathKey, FILE_PATH_LITERAL("/Applications"), kBlockAllChildren},
+- {base::DIR_HOME, FILE_PATH_LITERAL("Library"), kBlockAllChildren},
+- // Allow access to other cloud files, such as Google Drive.
+- {base::DIR_HOME, FILE_PATH_LITERAL("Library/CloudStorage"),
+- kDontBlockChildren},
+- // Allow the site to interact with data from its corresponding natively
+- // installed (sandboxed) application. It would be nice to limit a site to
+- // access only _its_ corresponding natively installed application,
+- // but unfortunately there's no straightforward way to do that. See
+- // https://crbug.com/984641#c22.
+- {base::DIR_HOME, FILE_PATH_LITERAL("Library/Containers"),
+- kDontBlockChildren},
+- // Allow access to iCloud files...
+- {base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"),
+- kDontBlockChildren},
+- // ... which may also appear at this directory.
+- {base::DIR_HOME,
+- FILE_PATH_LITERAL("Library/Mobile Documents/com~apple~CloudDocs"),
+- kDontBlockChildren},
+-#endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+- // On Linux also block access to devices via /dev.
+- {kNoBasePathKey, FILE_PATH_LITERAL("/dev"), kBlockAllChildren},
+- // And security sensitive data in /proc and /sys.
+- {kNoBasePathKey, FILE_PATH_LITERAL("/proc"), kBlockAllChildren},
+- {kNoBasePathKey, FILE_PATH_LITERAL("/sys"), kBlockAllChildren},
+- // And system files in /boot and /etc.
+- {kNoBasePathKey, FILE_PATH_LITERAL("/boot"), kBlockAllChildren},
+- {kNoBasePathKey, FILE_PATH_LITERAL("/etc"), kBlockAllChildren},
+- // And block all of ~/.config, matching the similar restrictions on mac
+- // and windows.
+- {base::DIR_HOME, FILE_PATH_LITERAL(".config"), kBlockAllChildren},
+- // Block ~/.dbus as well, just in case, although there probably isn't much a
+- // website can do with access to that directory and its contents.
+- {base::DIR_HOME, FILE_PATH_LITERAL(".dbus"), kBlockAllChildren},
+-#endif
+-#if BUILDFLAG(IS_ANDROID)
+- {base::DIR_ANDROID_APP_DATA, nullptr, kBlockAllChildren},
+- {base::DIR_CACHE, nullptr, kBlockAllChildren},
+-#endif
+- // TODO(crbug.com/40095723): Refine this list, for example add
+- // XDG_CONFIG_HOME when it is not set ~/.config?
+-};
++// This patch moves the deleted content from this file over to
++// chrome/browser/file_system_access/chrome_file_system_access_permission_context.h.
++// NOTE IF THERE IS A CONFLICT ABOVE, you will need to copy the changes in the
++// removed block over to chrome_file_system_access_permission_context.h.
+
+ // Describes a rule for blocking a directory, which can be constructed
+ // dynamically (based on state) or statically (from kBlockedPaths).
diff --git a/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h b/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
new file mode 100644
index 0000000000..6404365e81
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
@@ -0,0 +1,165 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/file_system_access/chrome_file_system_access_permission_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
+@@ -21,7 +21,7 @@
+ #include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h"
+ #include "chrome/browser/permissions/one_time_permissions_tracker.h"
+ #include "chrome/browser/permissions/one_time_permissions_tracker_observer.h"
+-#include "components/enterprise/buildflags/buildflags.h"
++#include "chrome/common/chrome_paths.h"
+ #include "components/permissions/features.h"
+ #include "components/permissions/object_permission_context_base.h"
+ #include "content/public/browser/file_system_access_permission_context.h"
+@@ -31,7 +31,7 @@
+ #include "chrome/browser/web_applications/web_app_install_manager_observer.h"
+ #endif
+
+-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS)
++#if 0
+ #include "components/enterprise/common/files_scan_data.h"
+ #endif
+
+@@ -340,6 +340,129 @@ class ChromeFileSystemAccessPermissionCo
+ // KeyedService:
+ void Shutdown() override;
+
++ // Sentinel used to indicate that no PathService key is specified for a path in
++ // the struct below.
++ static constexpr const int kNoBasePathKey = -1;
++
++ enum BlockType {
++ kBlockAllChildren,
++ kBlockNestedDirectories,
++ kDontBlockChildren
++ };
++
++ static constexpr struct {
++ // base::BasePathKey value (or one of the platform specific extensions to it)
++ // for a path that should be blocked. Specify kNoBasePathKey if |path| should
++ // be used instead.
++ int base_path_key;
++
++ // Explicit path to block instead of using |base_path_key|. Set to nullptr to
++ // use |base_path_key| on its own. If both |base_path_key| and |path| are set,
++ // |path| is treated relative to the path |base_path_key| resolves to.
++ const base::FilePath::CharType* path;
++
++ // If this is set to kDontBlockChildren, only the given path and its parents
++ // are blocked. If this is set to kBlockAllChildren, all children of the given
++ // path are blocked as well. Finally if this is set to kBlockNestedDirectories
++ // access is allowed to individual files in the directory, but nested
++ // directories are still blocked.
++ // The BlockType of the nearest ancestor of a path to check is what ultimately
++ // determines if a path is blocked or not. If a blocked path is a descendent
++ // of another blocked path, then it may override the child-blocking policy of
++ // its ancestor. For example, if /home blocks all children, but
++ // /home/downloads does not, then /home/downloads/file.ext will *not* be
++ // blocked.
++ BlockType type;
++ } kBlockedPaths[] = {
++ // Don't allow users to share their entire home directory, entire desktop or
++ // entire documents folder, but do allow sharing anything inside those
++ // directories not otherwise blocked.
++ {base::DIR_HOME, nullptr, kDontBlockChildren},
++ {base::DIR_USER_DESKTOP, nullptr, kDontBlockChildren},
++ {chrome::DIR_USER_DOCUMENTS, nullptr, kDontBlockChildren},
++ // Similar restrictions for the downloads directory.
++ {chrome::DIR_DEFAULT_DOWNLOADS, nullptr, kDontBlockChildren},
++ {chrome::DIR_DEFAULT_DOWNLOADS_SAFE, nullptr, kDontBlockChildren},
++ // The Chrome installation itself should not be modified by the web.
++ {base::DIR_EXE, nullptr, kBlockAllChildren},
++ {base::DIR_MODULE, nullptr, kBlockAllChildren},
++ {base::DIR_ASSETS, nullptr, kBlockAllChildren},
++ // And neither should the configuration of at least the currently running
++ // Chrome instance (note that this does not take --user-data-dir command
++ // line overrides into account).
++ {chrome::DIR_USER_DATA, nullptr, kBlockAllChildren},
++ // ~/.ssh is pretty sensitive on all platforms, so block access to that.
++ {base::DIR_HOME, FILE_PATH_LITERAL(".ssh"), kBlockAllChildren},
++ // And limit access to ~/.gnupg as well.
++ {base::DIR_HOME, FILE_PATH_LITERAL(".gnupg"), kBlockAllChildren},
++ #if BUILDFLAG(IS_WIN)
++ // Some Windows specific directories to block, basically all apps, the
++ // operating system itself, as well as configuration data for apps.
++ {base::DIR_PROGRAM_FILES, nullptr, kBlockAllChildren},
++ {base::DIR_PROGRAM_FILESX86, nullptr, kBlockAllChildren},
++ {base::DIR_PROGRAM_FILES6432, nullptr, kBlockAllChildren},
++ {base::DIR_WINDOWS, nullptr, kBlockAllChildren},
++ {base::DIR_ROAMING_APP_DATA, nullptr, kBlockAllChildren},
++ {base::DIR_LOCAL_APP_DATA, nullptr, kBlockAllChildren},
++ {base::DIR_COMMON_APP_DATA, nullptr, kBlockAllChildren},
++ // Opening a file from an MTP device, such as a smartphone or a camera, is
++ // implemented by Windows as opening a file in the temporary internet files
++ // directory. To support that, allow opening files in that directory, but
++ // not whole directories.
++ {base::DIR_IE_INTERNET_CACHE, nullptr, kBlockNestedDirectories},
++ #endif
++ #if BUILDFLAG(IS_MAC)
++ // Similar Mac specific blocks.
++ {base::DIR_APP_DATA, nullptr, kBlockAllChildren},
++ // Block access to the current bundle directory.
++ {chrome::DIR_OUTER_BUNDLE, nullptr, kBlockAllChildren},
++ // Block access to the user's Applications directory.
++ {base::DIR_HOME, FILE_PATH_LITERAL("Applications"), kBlockAllChildren},
++ // Block access to the root Applications directory.
++ {kNoBasePathKey, FILE_PATH_LITERAL("/Applications"), kBlockAllChildren},
++ {base::DIR_HOME, FILE_PATH_LITERAL("Library"), kBlockAllChildren},
++ // Allow access to other cloud files, such as Google Drive.
++ {base::DIR_HOME, FILE_PATH_LITERAL("Library/CloudStorage"),
++ kDontBlockChildren},
++ // Allow the site to interact with data from its corresponding natively
++ // installed (sandboxed) application. It would be nice to limit a site to
++ // access only _its_ corresponding natively installed application,
++ // but unfortunately there's no straightforward way to do that. See
++ // https://crbug.com/984641#c22.
++ {base::DIR_HOME, FILE_PATH_LITERAL("Library/Containers"),
++ kDontBlockChildren},
++ // Allow access to iCloud files...
++ {base::DIR_HOME, FILE_PATH_LITERAL("Library/Mobile Documents"),
++ kDontBlockChildren},
++ // ... which may also appear at this directory.
++ {base::DIR_HOME,
++ FILE_PATH_LITERAL("Library/Mobile Documents/com~apple~CloudDocs"),
++ kDontBlockChildren},
++ #endif
++ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
++ // On Linux also block access to devices via /dev.
++ {kNoBasePathKey, FILE_PATH_LITERAL("/dev"), kBlockAllChildren},
++ // And security sensitive data in /proc and /sys.
++ {kNoBasePathKey, FILE_PATH_LITERAL("/proc"), kBlockAllChildren},
++ {kNoBasePathKey, FILE_PATH_LITERAL("/sys"), kBlockAllChildren},
++ // And system files in /boot and /etc.
++ {kNoBasePathKey, FILE_PATH_LITERAL("/boot"), kBlockAllChildren},
++ {kNoBasePathKey, FILE_PATH_LITERAL("@PKG_SYSCONFBASE@"), kBlockAllChildren},
++ // And block all of ~/.config, matching the similar restrictions on mac
++ // and windows.
++ {base::DIR_HOME, FILE_PATH_LITERAL(".config"), kBlockAllChildren},
++ // Block ~/.dbus as well, just in case, although there probably isn't much a
++ // website can do with access to that directory and its contents.
++ {base::DIR_HOME, FILE_PATH_LITERAL(".dbus"), kBlockAllChildren},
++ #endif
++ #if BUILDFLAG(IS_ANDROID)
++ {base::DIR_ANDROID_APP_DATA, nullptr, kBlockAllChildren},
++ {base::DIR_CACHE, nullptr, kBlockAllChildren},
++ #endif
++ // TODO(crbug.com/40095723): Refine this list, for example add
++ // XDG_CONFIG_HOME when it is not set ~/.config?
++ };
++
+ protected:
+ SEQUENCE_CHECKER(sequence_checker_);
+
+@@ -359,7 +482,7 @@ class ChromeFileSystemAccessPermissionCo
+
+ void PermissionGrantDestroyed(PermissionGrantImpl* grant);
+
+-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS)
++#if 0
+ void OnContentAnalysisComplete(
+ std::vector<content::PathInfo> entries,
+ EntriesAllowedByEnterprisePolicyCallback callback,
diff --git a/electron34/patches/patch-chrome_browser_first__run_first__run__dialog.h b/electron34/patches/patch-chrome_browser_first__run_first__run__dialog.h
new file mode 100644
index 0000000000..80821bd180
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_first__run_first__run__dialog.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/first_run/first_run_dialog.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/first_run/first_run_dialog.h
+@@ -12,7 +12,7 @@
+ // Hide this function on platforms where the dialog does not exist.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+
+ namespace first_run {
+
diff --git a/electron34/patches/patch-chrome_browser_first__run_first__run__internal.h b/electron34/patches/patch-chrome_browser_first__run_first__run__internal.h
new file mode 100644
index 0000000000..76414ad3eb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_first__run_first__run__internal.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/first_run/first_run_internal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/first_run/first_run_internal.h
+@@ -54,7 +54,7 @@ FirstRunState DetermineFirstRunState(boo
+ bool force_first_run,
+ bool no_first_run);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // For testing, forces the first run dialog to either be shown or not. If not
+ // called, the decision to show the dialog or not will be made by Chrome based
+ // on a number of factors (such as install type, whether it's a Chrome-branded
diff --git a/electron34/patches/patch-chrome_browser_flag__descriptions.cc b/electron34/patches/patch-chrome_browser_flag__descriptions.cc
new file mode 100644
index 0000000000..6a4101728d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_flag__descriptions.cc
@@ -0,0 +1,164 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/flag_descriptions.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/flag_descriptions.cc
+@@ -470,7 +470,7 @@ const char kAutofillDisableLocalCardMigr
+ "from checkout flows and from the payment methods settings page.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kAutofillEnableAmountExtractionDesktopName[] =
+ "Enable checkout amount extraction on Chrome desktop";
+ const char kAutofillEnableAmountExtractionDesktopDescription[] =
+@@ -479,7 +479,7 @@ const char kAutofillEnableAmountExtracti
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kAutofillEnableBuyNowPayLaterForAffirmName[] =
+ "Enable buy now pay later on Autofill for Affirm";
+ const char kAutofillEnableBuyNowPayLaterForAffirmDescription[] =
+@@ -976,7 +976,7 @@ const char kDevicePostureDescription[] =
+ "Enables Device Posture API (foldable devices)";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kDocumentPictureInPictureAnimateResizeName[] =
+ "Document Picture-in-Picture Animate Resize";
+ const char kDocumentPictureInPictureAnimateResizeDescription[] =
+@@ -1060,7 +1060,7 @@ const char kCompressionDictionaryTranspo
+ "when the connection is using a well known root cert or when the server is "
+ "a localhost.";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kContextualCueingName[] = "Contextual cueing";
+ const char kContextualCueingDescription[] =
+ "Enables the contextual cueing system to support showing actions";
+@@ -2203,7 +2203,7 @@ const char kContextualPageActionsShareMo
+ "Enables share model data collection.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kEnableSearchAggregatorPolicyName[] =
+ "Enable EnterpriseSearchAggregatorSettings policy";
+ const char kEnableSearchAggregatorPolicyDescription[] =
+@@ -3516,7 +3516,7 @@ const char kSiteInstanceGroupsForDataUrl
+ "but in the same SiteInstanceGroup, and thus the same process.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kPwaNavigationCapturingName[] = "Desktop PWA Link Capturing";
+ const char kPwaNavigationCapturingDescription[] =
+ "Enables opening links from Chrome in an installed PWA. Currently under "
+@@ -3736,7 +3736,7 @@ const char kTranslateForceTriggerOnEngli
+ "Force the Translate Triggering on English pages experiment to be enabled "
+ "with the selected language model active.";
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kTranslationAPIName[] = "Experimental translation API";
+ const char kTranslationAPIDescription[] =
+ "Enables the on-device language translation API. "
+@@ -7663,7 +7663,7 @@ const char kBlinkExtensionDiagnosticsDes
+ "Enable the experimental Diagnostics Blink Extension.";
+ #endif // #if BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kGetAllScreensMediaName[] = "GetAllScreensMedia API";
+ const char kGetAllScreensMediaDescription[] =
+ "When enabled, the getAllScreensMedia API for capturing multiple screens "
+@@ -7883,7 +7883,7 @@ const char kEnableArmHwdrmDescription[]
+
+ // Linux -----------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kOzonePlatformHintChoiceDefault[] = "Default";
+ const char kOzonePlatformHintChoiceAuto[] = "Auto";
+ const char kOzonePlatformHintChoiceX11[] = "X11";
+@@ -7929,6 +7929,20 @@ const char kWaylandUiScalingDescription[
+ "Enable experimental support for text scaling in the Wayland backend "
+ "backed by full UI scaling. Requires #wayland-per-window-scaling to be "
+ "enabled too.";
++
++#if BUILDFLAG(IS_BSD)
++const char kAudioBackendName[] =
++ "Audio Backend";
++const char kAudioBackendDescription[] =
++#if BUILDFLAG(IS_OPENBSD)
++ "Select the desired audio backend to use. The default is sndio.";
++#elif BUILDFLAG(IS_NETBSD)
++ "Select the desired audio backend to use. The default is audioio.";
++#elif BUILDFLAG(IS_FREEBSD)
++ "Select the desired audio backend to use. The default will automatically "
++ "enumerate through the supported backends.";
++#endif
++#endif
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // Random platform combinations -----------------------------------------------
+@@ -7941,7 +7955,7 @@ const char kZeroCopyVideoCaptureDescript
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kFollowingFeedSidepanelName[] = "Following feed in the sidepanel";
+ const char kFollowingFeedSidepanelDescription[] =
+ "Enables the following feed in the sidepanel.";
+@@ -7963,7 +7977,7 @@ const char kTaskManagerDesktopRefreshDes
+ "Enables a refreshed design for the Task Manager on Desktop platforms.";
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kEnableNetworkServiceSandboxName[] =
+ "Enable the network service sandbox.";
+ const char kEnableNetworkServiceSandboxDescription[] =
+@@ -7995,7 +8009,7 @@ const char kWebBluetoothConfirmPairingSu
+ "Bluetooth";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const char kSkipUndecryptablePasswordsName[] =
+ "Skip undecryptable passwords to use the available decryptable "
+ "passwords.";
+@@ -8150,7 +8164,7 @@ const char kElementCaptureDescription[]
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const char kUIDebugToolsName[] = "Debugging tools for UI";
+ const char kUIDebugToolsDescription[] =
+ "Enables additional keyboard shortcuts to help debugging.";
+@@ -8206,7 +8220,7 @@ const char kComposeUpfrontInputModesDesc
+ "Enables upfront input modes in the Compose dialog";
+ #endif // BUILDFLAG(ENABLE_COMPOSE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kThirdPartyProfileManagementName[] =
+ "Third party profile management";
+ const char kThirdPartyProfileManagementDescription[] =
+@@ -8323,7 +8337,7 @@ const char kOverlayScrollbarsOSSettingsD
+ "Enable the os settings for overlay scrollbars on ChromeOS.";
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kSupervisedProfileHideGuestName[] = "Supervised Profile Hide Guest";
+ const char kSupervisedProfileHideGuestDescription[] =
+ "Hides Guest Profile entry points for supervised users";
diff --git a/electron34/patches/patch-chrome_browser_flag__descriptions.h b/electron34/patches/patch-chrome_browser_flag__descriptions.h
new file mode 100644
index 0000000000..2a84320cc9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_flag__descriptions.h
@@ -0,0 +1,151 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/flag_descriptions.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/flag_descriptions.h
+@@ -291,13 +291,13 @@ extern const char kAutofillDisableLocalC
+ extern const char kAutofillDisableLocalCardMigrationDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kAutofillEnableAmountExtractionDesktopName[];
+ extern const char kAutofillEnableAmountExtractionDesktopDescription[];
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kAutofillEnableBuyNowPayLaterForAffirmName[];
+ extern const char kAutofillEnableBuyNowPayLaterForAffirmDescription[];
+
+@@ -556,7 +556,7 @@ extern const char kCapturedSurfaceContro
+ extern const char kCommerceHintAndroidName[];
+ extern const char kCommerceHintAndroidDescription[];
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kContextualCueingName[];
+ extern const char kContextualCueingDescription[];
+ #endif // #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+@@ -737,7 +737,7 @@ extern const char kDevicePostureName[];
+ extern const char kDevicePostureDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kDocumentPictureInPictureAnimateResizeName[];
+ extern const char kDocumentPictureInPictureAnimateResizeDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
+@@ -1227,7 +1227,7 @@ extern const char kContextualPageActions
+ extern const char kContextualPageActionsShareModelDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kEnableSearchAggregatorPolicyName[];
+ extern const char kEnableSearchAggregatorPolicyDescription[];
+ #endif
+@@ -2004,7 +2004,7 @@ extern const char kSiteInstanceGroupsFor
+ extern const char kSiteInstanceGroupsForDataUrlsDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kPwaNavigationCapturingName[];
+ extern const char kPwaNavigationCapturingDescription[];
+ #endif
+@@ -2163,7 +2163,7 @@ extern const char kTouchTextEditingRedes
+ extern const char kTranslateForceTriggerOnEnglishName[];
+ extern const char kTranslateForceTriggerOnEnglishDescription[];
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kTranslationAPIName[];
+ extern const char kTranslationAPIDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -4429,7 +4429,7 @@ extern const char kBlinkExtensionDiagnos
+ extern const char kBlinkExtensionDiagnosticsDescription[];
+ #endif // #if BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kGetAllScreensMediaName[];
+ extern const char kGetAllScreensMediaDescription[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -4558,7 +4558,7 @@ extern const char kEnableArmHwdrmDescrip
+
+ // Linux ---------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kOzonePlatformHintChoiceDefault[];
+ extern const char kOzonePlatformHintChoiceAuto[];
+ extern const char kOzonePlatformHintChoiceX11[];
+@@ -4586,6 +4586,9 @@ extern const char kWaylandTextInputV3Des
+
+ extern const char kWaylandUiScalingName[];
+ extern const char kWaylandUiScalingDescription[];
++
++extern const char kAudioBackendName[];
++extern const char kAudioBackendDescription[];
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // Random platform combinations -----------------------------------------------
+@@ -4605,7 +4608,7 @@ extern const char kWebBluetoothConfirmPa
+ extern const char kWebBluetoothConfirmPairingSupportDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kSkipUndecryptablePasswordsName[];
+ extern const char kSkipUndecryptablePasswordsDescription[];
+
+@@ -4627,7 +4630,7 @@ extern const char kScreenlockReauthPromo
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kFollowingFeedSidepanelName[];
+ extern const char kFollowingFeedSidepanelDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+@@ -4641,7 +4644,7 @@ extern const char kTaskManagerDesktopRef
+ extern const char kTaskManagerDesktopRefreshDescription[];
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kEnableNetworkServiceSandboxName[];
+ extern const char kEnableNetworkServiceSandboxDescription[];
+
+@@ -4738,7 +4741,7 @@ extern const char kElementCaptureDescrip
+
+ #if BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kUIDebugToolsName[];
+ extern const char kUIDebugToolsDescription[];
+ #endif
+@@ -4780,7 +4783,7 @@ extern const char kComposeUpfrontInputMo
+ extern const char kComposeUpfrontInputModesDescription[];
+ #endif // BUILDFLAG(ENABLE_COMPOSE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kThirdPartyProfileManagementName[];
+ extern const char kThirdPartyProfileManagementDescription[];
+
+@@ -4850,7 +4853,7 @@ extern const char kOverlayScrollbarsOSSe
+ extern const char kOverlayScrollbarsOSSettingsDescription[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kSupervisedProfileHideGuestName[];
+ extern const char kSupervisedProfileHideGuestDescription[];
+
diff --git a/electron34/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc b/electron34/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
new file mode 100644
index 0000000000..6f7f8d0106
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/gcm/gcm_profile_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/gcm/gcm_profile_service_factory.cc
+@@ -89,7 +89,7 @@ GCMProfileServiceFactory::ScopedTestingF
+ // static
+ GCMProfileService* GCMProfileServiceFactory::GetForProfile(
+ content::BrowserContext* profile) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, incognito profiles are checked with IsIncognitoProfile().
+ // It's possible for non-incognito profiles to also be off-the-record.
+ bool is_profile_supported =
+@@ -132,7 +132,7 @@ GCMProfileServiceFactory::~GCMProfileSer
+ KeyedService* GCMProfileServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DCHECK(!profile->IsIncognitoProfile());
+ #else
+ DCHECK(!profile->IsOffTheRecord());
diff --git a/electron34/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc b/electron34/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
new file mode 100644
index 0000000000..ec26c8a88e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/gcm/instance_id/instance_id_profile_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/gcm/instance_id/instance_id_profile_service_factory.cc
+@@ -16,7 +16,7 @@ namespace instance_id {
+ // static
+ InstanceIDProfileService* InstanceIDProfileServiceFactory::GetForProfile(
+ content::BrowserContext* profile) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, the guest profile is actually the primary OTR profile of
+ // the "regular" guest profile. The regular guest profile is never used
+ // directly by users. Also, user are not able to create child OTR profiles
+@@ -64,7 +64,7 @@ InstanceIDProfileServiceFactory::~Instan
+ KeyedService* InstanceIDProfileServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = Profile::FromBrowserContext(context);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On desktop, incognito profiles are checked with IsIncognitoProfile().
+ // It's possible for non-incognito profiles to also be off-the-record.
+ bool is_incognito = profile->IsIncognitoProfile();
diff --git a/electron34/patches/patch-chrome_browser_global__features.cc b/electron34/patches/patch-chrome_browser_global__features.cc
new file mode 100644
index 0000000000..fc6bbd0bfe
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_global__features.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/global_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/global_features.cc
+@@ -10,7 +10,7 @@
+ #include "build/build_config.h"
+ #include "chrome/browser/permissions/system/platform_handle.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This causes a gn error on Android builds, because gn does not understand
+ // buildflags, so we include it only on platforms where it is used.
+ #include "components/user_education/common/user_education_features.h" // nogncheck
+@@ -49,7 +49,7 @@ void GlobalFeatures::ReplaceGlobalFeatur
+
+ void GlobalFeatures::Init() {
+ system_permissions_platform_handle_ = CreateSystemPermissionsPlatformHandle();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (user_education::features::IsWhatsNewV2()) {
+ whats_new_registry_ = CreateWhatsNewRegistry();
+ }
+@@ -61,7 +61,7 @@ GlobalFeatures::CreateSystemPermissionsP
+ return system_permission_settings::PlatformHandle::Create();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<whats_new::WhatsNewRegistry>
+ GlobalFeatures::CreateWhatsNewRegistry() {
+ return whats_new::CreateWhatsNewRegistry();
diff --git a/electron34/patches/patch-chrome_browser_global__features.h b/electron34/patches/patch-chrome_browser_global__features.h
new file mode 100644
index 0000000000..fa408ee1bf
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_global__features.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/global_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/global_features.h
+@@ -14,7 +14,7 @@ namespace system_permission_settings {
+ class PlatformHandle;
+ } // namespace system_permission_settings
+ namespace whats_new {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class WhatsNewRegistry;
+ #endif
+ } // namespace whats_new
+@@ -45,7 +45,7 @@ class GlobalFeatures {
+ system_permissions_platform_handle() {
+ return system_permissions_platform_handle_.get();
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ whats_new::WhatsNewRegistry* whats_new_registry() {
+ return whats_new_registry_.get();
+ }
+@@ -60,7 +60,7 @@ class GlobalFeatures {
+
+ virtual std::unique_ptr<system_permission_settings::PlatformHandle>
+ CreateSystemPermissionsPlatformHandle();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual std::unique_ptr<whats_new::WhatsNewRegistry> CreateWhatsNewRegistry();
+ #endif
+
+@@ -70,7 +70,7 @@ class GlobalFeatures {
+
+ std::unique_ptr<system_permission_settings::PlatformHandle>
+ system_permissions_platform_handle_;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<whats_new::WhatsNewRegistry> whats_new_registry_;
+ #endif
+ };
diff --git a/electron34/patches/patch-chrome_browser_headless_headless__mode__util.cc b/electron34/patches/patch-chrome_browser_headless_headless__mode__util.cc
new file mode 100644
index 0000000000..c2b1ec90ff
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_headless_headless__mode__util.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/headless/headless_mode_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/headless/headless_mode_util.cc
+@@ -10,7 +10,7 @@
+ // New headless mode is available on Linux, Windows and Mac platforms.
+ // More platforms will be added later, so avoid function level clutter
+ // by providing stub implementations at the end of the file.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ #include "base/base_switches.h"
+ #include "base/files/file_path.h"
+@@ -19,7 +19,7 @@
+ #include "chrome/common/chrome_switches.h"
+ #include "content/public/common/content_switches.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/gl/gl_switches.h" // nogncheck
+ #include "ui/ozone/public/ozone_switches.h" // nogncheck
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -94,7 +94,7 @@ class HeadlessModeHandleImpl : public He
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Headless mode on Linux relies on ozone/headless platform.
+ command_line->AppendSwitchASCII(::switches::kOzonePlatform,
+ switches::kHeadless);
diff --git a/electron34/patches/patch-chrome_browser_intranet__redirect__detector.h b/electron34/patches/patch-chrome_browser_intranet__redirect__detector.h
new file mode 100644
index 0000000000..9532aa5f89
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_intranet__redirect__detector.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/intranet_redirect_detector.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/intranet_redirect_detector.h
+@@ -25,7 +25,7 @@ class SimpleURLLoader;
+ class PrefRegistrySimple;
+
+ #if !(BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS))
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #error "IntranetRedirectDetector should only be built on Desktop platforms."
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc b/electron34/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
new file mode 100644
index 0000000000..6b7680ba48
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media_galleries/fileapi/mtp_device_map_service.cc
+@@ -40,10 +40,12 @@ void MTPDeviceMapService::RegisterMTPFil
+ // Note that this initializes the delegate asynchronously, but since
+ // the delegate will only be used from the IO thread, it is guaranteed
+ // to be created before use of it expects it to be there.
++#if !BUILDFLAG(IS_BSD)
+ CreateMTPDeviceAsyncDelegate(
+ device_location, read_only,
+ base::BindOnce(&MTPDeviceMapService::AddAsyncDelegate,
+ base::Unretained(this), device_location, read_only));
++#endif
+ mtp_device_usage_map_[key] = 0;
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc b/electron34/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc
new file mode 100644
index 0000000000..25ff1815fc
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media_galleries/media_file_system_registry.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media_galleries/media_file_system_registry.cc
+@@ -584,7 +584,12 @@ class MediaFileSystemRegistry::MediaFile
+ // Constructor in 'private' section because depends on private class definition.
+ MediaFileSystemRegistry::MediaFileSystemRegistry()
+ : file_system_context_(new MediaFileSystemContextImpl) {
+- StorageMonitor::GetInstance()->AddObserver(this);
++ /*
++ * This conditional is needed for shutdown. Destructors
++ * try to get the media file system registry.
++ */
++ if (StorageMonitor::GetInstance())
++ StorageMonitor::GetInstance()->AddObserver(this);
+ }
+
+ MediaFileSystemRegistry::~MediaFileSystemRegistry() {
diff --git a/electron34/patches/patch-chrome_browser_media_audio__service__util.cc b/electron34/patches/patch-chrome_browser_media_audio__service__util.cc
new file mode 100644
index 0000000000..b022184531
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_audio__service__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/audio_service_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/audio_service_util.cc
+@@ -21,7 +21,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
+ const base::Value* GetPolicy(const char* policy_name) {
+ const policy::PolicyMap& policies =
+@@ -43,7 +43,7 @@ bool GetPolicyOrFeature(const char* poli
+ bool IsAudioServiceSandboxEnabled() {
+ // TODO(crbug.com/40118868): Remove !IS_CHROMEOS_LACROS once lacros starts being
+ // built with OS_CHROMEOS instead of OS_LINUX.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
+ return GetPolicyOrFeature(policy::key::kAudioSandboxEnabled,
+ features::kAudioServiceSandbox);
diff --git a/electron34/patches/patch-chrome_browser_media_offscreen__tab.cc b/electron34/patches/patch-chrome_browser_media_offscreen__tab.cc
new file mode 100644
index 0000000000..44f177686d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_offscreen__tab.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/offscreen_tab.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/offscreen_tab.cc
+@@ -286,8 +286,7 @@ bool OffscreenTab::IsWebContentsCreation
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ // Disallow creating separate WebContentses. The WebContents implementation
+ // uses this to spawn new windows/tabs, which is also not allowed for
+ // offscreen tabs.
diff --git a/electron34/patches/patch-chrome_browser_media_offscreen__tab.h b/electron34/patches/patch-chrome_browser_media_offscreen__tab.h
new file mode 100644
index 0000000000..4fa140253c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_offscreen__tab.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/offscreen_tab.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/offscreen_tab.h
+@@ -107,8 +107,7 @@ class OffscreenTab final : public Profil
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) final;
++ const content::mojom::CreateNewWindowParams& params) override;
+ void EnterFullscreenModeForTab(
+ content::RenderFrameHost* requesting_frame,
+ const blink::mojom::FullscreenOptions& options) final;
diff --git a/electron34/patches/patch-chrome_browser_media_router_discovery_BUILD.gn b/electron34/patches/patch-chrome_browser_media_router_discovery_BUILD.gn
new file mode 100644
index 0000000000..4ebc90bb38
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_router_discovery_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/router/discovery/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/router/discovery/BUILD.gn
+@@ -82,7 +82,7 @@ static_library("discovery") {
+ ]
+ configs += [ "//build/config/compiler:wexit_time_destructors" ]
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "discovery_network_list_wifi_linux.cc" ]
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc b/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
new file mode 100644
index 0000000000..4acc83fea7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
@@ -0,0 +1,54 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/router/discovery/discovery_network_list_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/router/discovery/discovery_network_list_posix.cc
+@@ -10,11 +10,12 @@
+ #include "chrome/browser/media/router/discovery/discovery_network_list.h"
+
+ #include <ifaddrs.h>
++#include <sys/socket.h>
++#include <sys/types.h>
++#include <sys/time.h>
+ #include <net/if.h>
+ #include <net/if_arp.h>
+ #include <netinet/in.h>
+-#include <sys/socket.h>
+-#include <sys/types.h>
+
+ #include <algorithm>
+
+@@ -23,7 +24,7 @@
+ #include "chrome/browser/media/router/discovery/discovery_network_list_wifi.h"
+ #include "net/base/net_errors.h"
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ #include <netpacket/packet.h>
+ #else
+ #include <net/if_dl.h>
+@@ -32,7 +33,7 @@
+ namespace media_router {
+ namespace {
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ using sll = struct sockaddr_ll;
+ #define SOCKET_ARP_TYPE(s) ((s)->sll_hatype)
+ #define SOCKET_ADDRESS_LEN(s) ((s)->sll_halen)
+@@ -45,6 +46,12 @@ using sll = struct sockaddr_dl;
+ #define SOCKET_ADDRESS(s) (LLADDR(s))
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) {
++ return false;
++}
++#endif
++
+ void GetDiscoveryNetworkInfoListImpl(
+ const struct ifaddrs* if_list,
+ std::vector<DiscoveryNetworkInfo>* network_info_list) {
diff --git a/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc b/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
new file mode 100644
index 0000000000..4aafae0d7a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/router/discovery/discovery_network_list_wifi_linux.cc
+@@ -9,7 +9,11 @@
+ #include <sys/socket.h>
+ #include <sys/types.h>
+
++#include "build/build_config.h"
++
++#if !BUILDFLAG(IS_BSD)
+ #include <linux/wireless.h>
++#endif
+
+ #include "base/check.h"
+ #include "base/files/scoped_file.h"
+@@ -20,6 +24,7 @@ namespace media_router {
+ bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) {
+ DCHECK(ssid_out);
+
++#if !BUILDFLAG(IS_BSD)
+ base::ScopedFD ioctl_socket(socket(AF_INET, SOCK_DGRAM, 0));
+ if (!ioctl_socket.is_valid()) {
+ // AF_INET is for IPv4, so it may fail for IPv6-only hosts even when there
+@@ -41,6 +46,7 @@ bool MaybeGetWifiSSID(const std::string&
+ ssid_out->assign(ssid);
+ return true;
+ }
++#endif
+ return false;
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc b/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
new file mode 100644
index 0000000000..dc5b906dba
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/chrome_screen_enumerator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/chrome_screen_enumerator.cc
+@@ -21,7 +21,7 @@
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "ash/shell.h"
+ #include "ui/aura/window.h"
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/functional/callback.h"
+ #include "content/public/browser/desktop_capture.h"
+ #endif
+@@ -32,7 +32,7 @@ base::LazyInstance<std::vector<raw_ptr<a
+ DestructorAtExit root_windows_for_testing_ = LAZY_INSTANCE_INITIALIZER;
+ } // namespace
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace {
+ base::LazyInstance<std::unique_ptr<webrtc::DesktopCapturer>>::DestructorAtExit
+ g_desktop_capturer_for_testing = LAZY_INSTANCE_INITIALIZER;
+@@ -79,7 +79,7 @@ blink::mojom::StreamDevicesSetPtr Enumer
+ return stream_devices_set;
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ blink::mojom::StreamDevicesSetPtr EnumerateScreens(
+ blink::mojom::MediaStreamType stream_type) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+@@ -130,7 +130,7 @@ void ChromeScreenEnumerator::SetRootWind
+ root_windows_for_testing_.Get() = std::move(root_windows);
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ChromeScreenEnumerator::SetDesktopCapturerForTesting(
+ std::unique_ptr<webrtc::DesktopCapturer> capturer) {
+ g_desktop_capturer_for_testing.Get() = std::move(capturer);
+@@ -143,7 +143,7 @@ void ChromeScreenEnumerator::EnumerateSc
+ ScreensCallback screens_callback) const {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ content::GetUIThreadTaskRunner({})->PostTaskAndReplyWithResult(
+ FROM_HERE, base::BindOnce(::EnumerateScreens, stream_type),
+ base::BindOnce(
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h b/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
new file mode 100644
index 0000000000..dcc2dc02ae
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/chrome_screen_enumerator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/chrome_screen_enumerator.h
+@@ -20,7 +20,7 @@ namespace aura {
+ class Window;
+ }
+
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace webrtc {
+ class DesktopCapturer;
+ }
+@@ -42,7 +42,7 @@ class ChromeScreenEnumerator : public me
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ static void SetRootWindowsForTesting(
+ std::vector<raw_ptr<aura::Window, VectorExperimental>> root_windows);
+-#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static void SetDesktopCapturerForTesting(
+ std::unique_ptr<webrtc::DesktopCapturer> capturer);
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h
new file mode 100644
index 0000000000..19a9d3b7d9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/desktop_media_list.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/desktop_media_list.h
+@@ -107,7 +107,8 @@ class DesktopMediaList {
+ // once per DesktopMediaList instance. It should not be called after
+ // StartUpdating(), and StartUpdating() should not be called until |callback|
+ // has been called.
+- virtual void Update(UpdateCallback callback) = 0;
++ virtual void Update(UpdateCallback callback,
++ bool refresh_thumbnails = false) = 0;
+
+ virtual int GetSourceCount() const = 0;
+ virtual const Source& GetSource(int index) const = 0;
+@@ -147,6 +148,8 @@ class DesktopMediaList {
+ // source lists that need to be displayed independently from when the
+ // DesktopMediaList gains focus.
+ virtual void ShowDelegatedList() = 0;
++
++ int skip_next_refresh_ = 0;
+ };
+
+ #endif // CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_H_
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc
new file mode 100644
index 0000000000..9ae514e197
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/desktop_media_list_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/desktop_media_list_base.cc
+@@ -74,12 +74,12 @@ void DesktopMediaListBase::StartUpdating
+ Refresh(true);
+ }
+
+-void DesktopMediaListBase::Update(UpdateCallback callback) {
++void DesktopMediaListBase::Update(UpdateCallback callback, bool refresh_thumbnails) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(sources_.empty());
+ DCHECK(!refresh_callback_);
+ refresh_callback_ = std::move(callback);
+- Refresh(false);
++ Refresh(refresh_thumbnails);
+ }
+
+ int DesktopMediaListBase::GetSourceCount() const {
+@@ -236,7 +236,11 @@ uint32_t DesktopMediaListBase::GetImageH
+ void DesktopMediaListBase::OnRefreshComplete() {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ DCHECK(refresh_callback_);
+- std::move(refresh_callback_).Run();
++ if (skip_next_refresh_ > 0) {
++ skip_next_refresh_--;
++ } else {
++ std::move(refresh_callback_).Run();
++ }
+ }
+
+ void DesktopMediaListBase::ScheduleNextRefresh() {
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h
new file mode 100644
index 0000000000..408c87f351
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/desktop_media_list_base.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/desktop_media_list_base.h
+@@ -39,7 +39,7 @@ class DesktopMediaListBase : public Desk
+ void SetThumbnailSize(const gfx::Size& thumbnail_size) override;
+ void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override;
+ void StartUpdating(DesktopMediaListObserver* observer) override;
+- void Update(UpdateCallback callback) override;
++ void Update(UpdateCallback callback, bool refresh_thumbnails) override;
+ int GetSourceCount() const override;
+ const Source& GetSource(int index) const override;
+ DesktopMediaList::Type GetMediaListType() const override;
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
new file mode 100644
index 0000000000..b5da1b1077
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/desktop_media_picker_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/desktop_media_picker_controller.cc
+@@ -89,7 +89,7 @@ bool DesktopMediaPickerController::IsSys
+ #if BUILDFLAG(IS_MAC)
+ return request_source == Params::RequestSource::kCast ||
+ base::FeatureList::IsEnabled(media::kMacLoopbackAudioForScreenShare);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (request_source == Params::RequestSource::kCast) {
+ return base::FeatureList::IsEnabled(media::kPulseaudioLoopbackForCast);
+ } else {
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc b/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc
new file mode 100644
index 0000000000..8bdf1c479b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/fake_desktop_media_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/fake_desktop_media_list.cc
+@@ -79,7 +79,8 @@ void FakeDesktopMediaList::StartUpdating
+ thumbnail_ = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
+ }
+
+-void FakeDesktopMediaList::Update(UpdateCallback callback) {
++void FakeDesktopMediaList::Update(UpdateCallback callback,
++ bool refresh_thumbnails) {
+ std::move(callback).Run();
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h b/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h
new file mode 100644
index 0000000000..75640fcd19
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/fake_desktop_media_list.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/fake_desktop_media_list.h
+@@ -40,7 +40,8 @@ class FakeDesktopMediaList : public Desk
+ void SetThumbnailSize(const gfx::Size& thumbnail_size) override;
+ void SetViewDialogWindowId(content::DesktopMediaID dialog_id) override;
+ void StartUpdating(DesktopMediaListObserver* observer) override;
+- void Update(UpdateCallback callback) override;
++ void Update(UpdateCallback callback,
++ bool refresh_thumbnails = false) override;
+ int GetSourceCount() const override;
+ const Source& GetSource(int index) const override;
+ DesktopMediaList::Type GetMediaListType() const override;
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc b/electron34/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc
new file mode 100644
index 0000000000..b0bd00a566
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc
@@ -0,0 +1,51 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/native_desktop_media_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/native_desktop_media_list.cc
+@@ -176,7 +176,7 @@ BOOL CALLBACK AllHwndCollector(HWND hwnd
+ #if BUILDFLAG(IS_MAC)
+ BASE_FEATURE(kWindowCaptureMacV2,
+ "WindowCaptureMacV2",
+- base::FEATURE_ENABLED_BY_DEFAULT);
++ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+ content::DesktopMediaID::Type ConvertToDesktopMediaIDType(
+@@ -363,7 +363,7 @@ class NativeDesktopMediaList::Worker
+ base::WeakPtr<NativeDesktopMediaList> media_list_;
+
+ DesktopMediaID::Type source_type_;
+- const std::unique_ptr<ThumbnailCapturer> capturer_;
++ std::unique_ptr<ThumbnailCapturer> capturer_;
+ const ThumbnailCapturer::FrameDeliveryMethod frame_delivery_method_;
+ const bool add_current_process_windows_;
+ const bool auto_show_delegated_source_list_;
+@@ -654,6 +654,12 @@ void NativeDesktopMediaList::Worker::Ref
+ FROM_HERE,
+ base::BindOnce(&NativeDesktopMediaList::UpdateNativeThumbnailsFinished,
+ media_list_));
++
++ // This call is necessary to release underlying OS screen capture mechanisms.
++ // Skip if the source list is delegated, as the source list window will be active.
++ if (!capturer_->GetDelegatedSourceListController()) {
++ capturer_.reset();
++ }
+ }
+
+ void NativeDesktopMediaList::Worker::OnCaptureResult(
+@@ -1058,6 +1064,11 @@ void NativeDesktopMediaList::RefreshForV
+ FROM_HERE, base::BindOnce(&Worker::RefreshThumbnails,
+ base::Unretained(worker_.get()),
+ std::move(native_ids), thumbnail_size_));
++ } else {
++#if defined(USE_AURA)
++ pending_native_thumbnail_capture_ = true;
++#endif
++ UpdateNativeThumbnailsFinished();
+ }
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
new file mode 100644
index 0000000000..b27752d962
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/webrtc_log_uploader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/webrtc_log_uploader.cc
+@@ -106,7 +106,7 @@ std::string GetLogUploadProduct() {
+ const char product[] = "Chrome_Mac";
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #if !defined(ADDRESS_SANITIZER)
+ const char product[] = "Chrome_Linux";
+ #else
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
new file mode 100644
index 0000000000..69e5ccf513
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/webrtc_logging_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/webrtc_logging_controller.cc
+@@ -25,10 +25,10 @@
+ #include "components/webrtc_logging/browser/text_log_list.h"
+ #include "content/public/browser/render_process_host.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/public/browser/child_process_security_policy.h"
+ #include "storage/browser/file_system/isolated_context.h"
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ using webrtc_event_logging::WebRtcEventLogManager;
+
+@@ -288,7 +288,7 @@ void WebRtcLoggingController::StartEvent
+ web_app_id, callback);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void WebRtcLoggingController::GetLogsDirectory(
+ LogsDirectoryCallback callback,
+ LogsDirectoryErrorCallback error_callback) {
+@@ -334,7 +334,7 @@ void WebRtcLoggingController::GrantLogsD
+ FROM_HERE,
+ base::BindOnce(std::move(callback), file_system.id(), registered_name));
+ }
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ void WebRtcLoggingController::OnRtpPacket(
+ base::HeapArray<uint8_t> packet_header,
diff --git a/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
new file mode 100644
index 0000000000..878f97bd0d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/media/webrtc/webrtc_logging_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/media/webrtc/webrtc_logging_controller.h
+@@ -133,7 +133,7 @@ class WebRtcLoggingController
+ size_t web_app_id,
+ const StartEventLoggingCallback& callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Ensures that the WebRTC Logs directory exists and then grants render
+ // process access to the 'WebRTC Logs' directory, and invokes |callback| with
+ // the ids necessary to create a DirectoryEntry object.
+@@ -197,7 +197,7 @@ class WebRtcLoggingController
+
+ content::BrowserContext* GetBrowserContext() const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Grants the render process access to the 'WebRTC Logs' directory, and
+ // invokes |callback| with the ids necessary to create a DirectoryEntry
+ // object. If the |logs_path| couldn't be created or found, |error_callback|
diff --git a/electron34/patches/patch-chrome_browser_memory__details.cc b/electron34/patches/patch-chrome_browser_memory__details.cc
new file mode 100644
index 0000000000..f486326ed1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_memory__details.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/memory_details.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/memory_details.cc
+@@ -335,7 +335,7 @@ void MemoryDetails::CollectChildInfoOnUI
+ });
+ }
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ if (content::ZygoteHost::GetInstance()->IsZygotePid(process.pid)) {
+ process.process_type = content::PROCESS_TYPE_ZYGOTE;
+ }
diff --git a/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc b/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
new file mode 100644
index 0000000000..a105eeebe2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -116,7 +116,7 @@
+ #include "chromeos/crosapi/cpp/crosapi_constants.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/pressure/pressure_metrics_reporter.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -125,7 +125,7 @@
+ #include "components/user_manager/user_manager.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/power_metrics/system_power_monitor.h"
+ #endif
+
+@@ -873,7 +873,7 @@ void RecordStartupMetrics() {
+
+ // Record whether Chrome is the default browser or not.
+ // Disabled on Linux due to hanging browser tests, see crbug.com/1216328.
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ shell_integration::DefaultWebClientState default_state =
+ shell_integration::GetDefaultBrowser();
+ base::UmaHistogramEnumeration("DefaultBrowser.State", default_state,
+@@ -1188,11 +1188,11 @@ void ChromeBrowserMainExtraPartsMetrics:
+ std::make_unique<web_app::SamplingMetricsProvider>();
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ pressure_metrics_reporter_ = std::make_unique<PressureMetricsReporter>();
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(
+ power_metrics::SystemPowerMonitor::GetInstance());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h b/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
new file mode 100644
index 0000000000..48a46e7449
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.h
+@@ -29,7 +29,7 @@ class PowerMetricsReporter;
+ class ProcessMonitor;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class PressureMetricsReporter;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -126,7 +126,7 @@ class ChromeBrowserMainExtraPartsMetrics
+ std::unique_ptr<web_app::SamplingMetricsProvider> web_app_metrics_provider_;
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Reports pressure metrics.
+ std::unique_ptr<PressureMetricsReporter> pressure_metrics_reporter_;
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc b/electron34/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
new file mode 100644
index 0000000000..571a259cf5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
@@ -0,0 +1,94 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/chrome_metrics_service_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/chrome_metrics_service_client.cc
+@@ -196,11 +196,11 @@
+ #include "chrome/notification_helper/notification_helper_constants.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/metrics/motherboard_metrics_provider.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/metrics/chrome_metrics_service_crash_reporter.h"
+ #endif
+
+@@ -214,7 +214,7 @@
+ #include "chrome/browser/metrics/power/power_metrics_provider_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/metrics/bluetooth_metrics_provider.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -536,7 +536,7 @@ void ChromeMetricsServiceClient::Registe
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ metrics::structured::StructuredMetricsService::RegisterPrefs(registry);
+
+ #if !BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -708,7 +708,7 @@ void ChromeMetricsServiceClient::Initial
+ RegisterUKMProviders();
+ }
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ metrics::structured::Recorder::GetInstance()->SetUiTaskRunner(
+ base::SequencedTaskRunner::GetCurrentDefault());
+ #endif
+@@ -759,7 +759,7 @@ void ChromeMetricsServiceClient::Registe
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<metrics::CPUMetricsProvider>());
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<metrics::MotherboardMetricsProvider>());
+ #endif
+@@ -846,7 +846,7 @@ void ChromeMetricsServiceClient::Registe
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ std::make_unique<DesktopPlatformFeaturesMetricsProvider>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) ||
+@@ -951,7 +951,7 @@ void ChromeMetricsServiceClient::Registe
+ std::make_unique<PowerMetricsProvider>());
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics_service_->RegisterMetricsProvider(
+ metrics::CreateDesktopSessionMetricsProvider());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX)
+@@ -1138,7 +1138,7 @@ bool ChromeMetricsServiceClient::Registe
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_BSD)
+ // This creates the DesktopProfileSessionDurationsServices if it didn't exist
+ // already.
+ metrics::DesktopProfileSessionDurationsServiceFactory::GetForBrowserContext(
+@@ -1472,7 +1472,7 @@ void ChromeMetricsServiceClient::CreateS
+ recorder =
+ base::MakeRefCounted<metrics::structured::AshStructuredMetricsRecorder>(
+ cros_system_profile_provider_.get());
+-#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ // Make sure that Structured Metrics recording delegates have been created
+ // before the service is created. This is handled in other places for ChromeOS
diff --git a/electron34/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc b/electron34/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc
new file mode 100644
index 0000000000..acaaac199f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/perf/cpu_identity.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/perf/cpu_identity.cc
+@@ -147,7 +147,7 @@ CPUIdentity GetCPUIdentity() {
+ result.release =
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ base::SysInfo::KernelVersion();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::SysInfo::OperatingSystemVersion();
+ #else
+ #error "Unsupported configuration"
diff --git a/electron34/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc b/electron34/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
new file mode 100644
index 0000000000..b433b1d511
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/power/process_metrics_recorder_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/power/process_metrics_recorder_util.cc
+@@ -65,7 +65,7 @@ void RecordProcessHistograms(const char*
+ const ProcessMonitor::Metrics& metrics) {
+ RecordAverageCPUUsage(histogram_suffix, metrics.cpu_usage);
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ base::UmaHistogramCounts10000(
+ base::StrCat({"PerformanceMonitor.IdleWakeups2.", histogram_suffix}),
+ metrics.idle_wakeups);
diff --git a/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.cc b/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.cc
new file mode 100644
index 0000000000..13c6e8ad67
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/power/process_monitor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/power/process_monitor.cc
+@@ -65,7 +65,7 @@ ProcessMonitor::Metrics SampleMetrics(ba
+ process_metrics.GetPlatformIndependentCPUUsage());
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ metrics.idle_wakeups = process_metrics.GetIdleWakeupsPerSecond();
+ #endif
+ #if BUILDFLAG(IS_MAC)
+@@ -83,7 +83,7 @@ void ScaleMetrics(ProcessMonitor::Metric
+ }
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ metrics->idle_wakeups *= factor;
+ #endif
+
+@@ -157,7 +157,7 @@ ProcessMonitor::Metrics& operator+=(Proc
+ }
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ lhs.idle_wakeups += rhs.idle_wakeups;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.h b/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.h
new file mode 100644
index 0000000000..58e0d5ac83
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_metrics_power_process__monitor.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/metrics/power/process_monitor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/metrics/power/process_monitor.h
+@@ -76,7 +76,7 @@ class ProcessMonitor : public content::B
+ std::optional<double> cpu_usage;
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_AIX)
++ BUILDFLAG(IS_AIX) || BUILDFLAG(IS_BSD)
+ // Returns the number of average idle cpu wakeups per second since the last
+ // time the metric was sampled.
+ int idle_wakeups = 0;
diff --git a/electron34/patches/patch-chrome_browser_net_profile__network__context__service.cc b/electron34/patches/patch-chrome_browser_net_profile__network__context__service.cc
new file mode 100644
index 0000000000..e21e744b53
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_net_profile__network__context__service.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/net/profile_network_context_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/net/profile_network_context_service.cc
+@@ -143,7 +143,7 @@
+ #include "chromeos/startup/browser_params_proxy.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.h"
+ #include "components/enterprise/client_certificates/core/certificate_provisioning_service.h"
+ #include "components/enterprise/client_certificates/core/client_certificates_service.h"
+@@ -268,7 +268,7 @@ void UpdateCookieSettings(Profile* profi
+ });
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<net::ClientCertStore> GetWrappedCertStore(
+ Profile* profile,
+ std::unique_ptr<net::ClientCertStore> platform_store) {
+@@ -1159,7 +1159,7 @@ ProfileNetworkContextService::CreateClie
+ store = std::make_unique<ClientCertStoreLacros>(
+ std::move(certificate_provider), cert_db_initializer, std::move(store));
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return GetWrappedCertStore(profile_, std::move(store));
+ #else
+ return store;
diff --git a/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.cc b/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.cc
new file mode 100644
index 0000000000..54c76c1a1b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/net/proxy_config_monitor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/net/proxy_config_monitor.cc
+@@ -11,7 +11,9 @@
+ #include "build/chromeos_buildflags.h"
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/net/proxy_service_factory.h"
++#if 0
+ #include "chrome/browser/profiles/profile.h"
++#endif
+ #include "components/proxy_config/pref_proxy_config_tracker_impl.h"
+ #include "content/public/browser/browser_thread.h"
+ #include "mojo/public/cpp/bindings/pending_remote.h"
+@@ -21,12 +23,13 @@
+ #include "chrome/browser/ash/profiles/profile_helper.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(ENABLE_EXTENSIONS)
++#if 0
+ #include "chrome/browser/extensions/api/proxy/proxy_api.h"
+ #endif
+
+ using content::BrowserThread;
+
++#if 0
+ ProxyConfigMonitor::ProxyConfigMonitor(Profile* profile) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ DCHECK(profile);
+@@ -57,6 +60,7 @@ ProxyConfigMonitor::ProxyConfigMonitor(P
+
+ proxy_config_service_->AddObserver(this);
+ }
++#endif
+
+ ProxyConfigMonitor::ProxyConfigMonitor(PrefService* local_state) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
+@@ -135,8 +139,10 @@ void ProxyConfigMonitor::OnLazyProxyConf
+ void ProxyConfigMonitor::OnPACScriptError(int32_t line_number,
+ const std::string& details) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
++#if 0
+ extensions::ProxyEventRouter::GetInstance()->OnPACScriptError(
+ profile_, line_number, base::UTF8ToUTF16(details));
++#endif
+ }
+
+ void ProxyConfigMonitor::OnRequestMaybeFailedDueToProxySettings(
+@@ -151,7 +157,9 @@ void ProxyConfigMonitor::OnRequestMaybeF
+ return;
+ }
+
++#if 0
+ extensions::ProxyEventRouter::GetInstance()->OnProxyError(profile_,
+ net_error);
++#endif
+ }
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.h b/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.h
new file mode 100644
index 0000000000..de539a7e17
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_net_proxy__config__monitor.h
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/net/proxy_config_monitor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/net/proxy_config_monitor.h
+@@ -40,11 +40,12 @@ class ProxyConfigMonitor : public net::P
+
+ {
+ public:
++#if 0
+ // Creates a ProxyConfigMonitor that gets proxy settings from |profile| and
+ // watches for changes. The created ProxyConfigMonitor must be destroyed
+ // before |profile|.
+ explicit ProxyConfigMonitor(Profile* profile);
+-
++#endif
+ // Creates a ProxyConfigMonitor that gets proxy settings from the
+ // |local_state|, for use with NetworkContexts not
+ // associated with a profile. Must be destroyed before |local_state|.
+@@ -94,7 +95,7 @@ class ProxyConfigMonitor : public net::P
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+ mojo::ReceiverSet<network::mojom::ProxyErrorClient> error_receiver_set_;
+- raw_ptr<Profile> profile_ = nullptr;
++ // raw_ptr<Profile> profile_ = nullptr;
+ #endif
+ };
+
diff --git a/electron34/patches/patch-chrome_browser_net_system__network__context__manager.cc b/electron34/patches/patch-chrome_browser_net_system__network__context__manager.cc
new file mode 100644
index 0000000000..aae3978bcf
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_net_system__network__context__manager.cc
@@ -0,0 +1,153 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/net/system_network_context_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/net/system_network_context_manager.cc
+@@ -102,7 +102,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/common/chrome_paths_internal.h"
+ #include "chrome/grit/branded_strings.h"
+ #include "ui/base/l10n/l10n_util.h"
+@@ -146,7 +146,7 @@ SystemNetworkContextManager* g_system_ne
+ // received a failed launch for a sandboxed network service.
+ bool g_previously_failed_to_launch_sandboxed_service = false;
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Whether kerberos library loading will work in the network service due to the
+ // sandbox.
+ bool g_network_service_will_allow_gssapi_library_load = false;
+@@ -154,7 +154,7 @@ bool g_network_service_will_allow_gssapi
+ const char* kGssapiDesiredPref =
+ #if BUILDFLAG(IS_CHROMEOS)
+ prefs::kKerberosEnabled;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ prefs::kReceivedHttpAuthNegotiateHeader;
+ #endif
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -200,7 +200,7 @@ network::mojom::HttpAuthDynamicParamsPtr
+ auth_dynamic_params->basic_over_http_enabled =
+ local_state->GetBoolean(prefs::kBasicAuthOverHttpEnabled);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auth_dynamic_params->delegate_by_kdc_policy =
+ local_state->GetBoolean(prefs::kAuthNegotiateDelegateByKdcPolicy);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -215,7 +215,7 @@ network::mojom::HttpAuthDynamicParamsPtr
+ local_state->GetString(prefs::kAuthAndroidNegotiateAccountType);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auth_dynamic_params->allow_gssapi_library_load =
+ local_state->GetBoolean(kGssapiDesiredPref);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+@@ -225,7 +225,7 @@ network::mojom::HttpAuthDynamicParamsPtr
+
+ void OnNewHttpAuthDynamicParams(
+ network::mojom::HttpAuthDynamicParamsPtr& params) {
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The kerberos library is incompatible with the network service sandbox, so
+ // if library loading is now enabled, the network service needs to be
+ // restarted. It will be restarted unsandboxed because is
+@@ -267,11 +267,11 @@ NetworkSandboxState IsNetworkSandboxEnab
+ if (g_previously_failed_to_launch_sandboxed_service) {
+ return NetworkSandboxState::kDisabledBecauseOfFailedLaunch;
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* local_state = g_browser_process->local_state();
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The network service sandbox and the kerberos library are incompatible.
+ // If kerberos is enabled by policy, disable the network service sandbox.
+ if (g_network_service_will_allow_gssapi_library_load ||
+@@ -287,7 +287,7 @@ NetworkSandboxState IsNetworkSandboxEnab
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (local_state &&
+ local_state->HasPrefPath(prefs::kNetworkServiceSandboxEnabled)) {
+ return local_state->GetBoolean(prefs::kNetworkServiceSandboxEnabled)
+@@ -518,7 +518,7 @@ void SystemNetworkContextManager::Delete
+ g_system_network_context_manager = nullptr;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SystemNetworkContextManager::GssapiLibraryLoadObserver::
+ GssapiLibraryLoadObserver(SystemNetworkContextManager* owner)
+ : owner_(owner) {}
+@@ -576,7 +576,7 @@ SystemNetworkContextManager::SystemNetwo
+ pref_change_registrar_.Add(prefs::kAllHttpAuthSchemesAllowedForOrigins,
+ auth_pref_callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ pref_change_registrar_.Add(prefs::kAuthNegotiateDelegateByKdcPolicy,
+ auth_pref_callback);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -590,7 +590,7 @@ SystemNetworkContextManager::SystemNetwo
+ auth_pref_callback);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ pref_change_registrar_.Add(kGssapiDesiredPref, auth_pref_callback);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+@@ -661,7 +661,7 @@ void SystemNetworkContextManager::Regist
+ registry->RegisterBooleanPref(prefs::kKerberosEnabled, false);
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kAuthNegotiateDelegateByKdcPolicy,
+ false);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+@@ -686,11 +686,11 @@ void SystemNetworkContextManager::Regist
+
+ registry->RegisterListPref(prefs::kExplicitlyAllowedNetworkPorts);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kNetworkServiceSandboxEnabled, true);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kReceivedHttpAuthNegotiateHeader, false);
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -743,7 +743,7 @@ void SystemNetworkContextManager::OnNetw
+ OnNewHttpAuthDynamicParams(http_auth_dynamic_params);
+ network_service->ConfigureHttpAuthPrefs(std::move(http_auth_dynamic_params));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gssapi_library_loader_observer_.Install(network_service);
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -966,7 +966,7 @@ bool SystemNetworkContextManager::IsNetw
+ break;
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!enabled) {
+ g_network_service_will_allow_gssapi_library_load = true;
+ }
diff --git a/electron34/patches/patch-chrome_browser_net_system__network__context__manager.h b/electron34/patches/patch-chrome_browser_net_system__network__context__manager.h
new file mode 100644
index 0000000000..066fdd95b2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_net_system__network__context__manager.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/net/system_network_context_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/net/system_network_context_manager.h
+@@ -198,7 +198,7 @@ class SystemNetworkContextManager {
+ class URLLoaderFactoryForSystem;
+ class NetworkProcessLaunchWatcher;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class GssapiLibraryLoadObserver
+ : public network::mojom::GssapiLibraryLoadObserver {
+ public:
+@@ -279,7 +279,7 @@ class SystemNetworkContextManager {
+ std::unique_ptr<NetworkAnnotationMonitor> network_annotation_monitor_;
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ GssapiLibraryLoadObserver gssapi_library_loader_observer_{this};
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc b/electron34/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
new file mode 100644
index 0000000000..3fb1b5b2b2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/new_tab_page/modules/file_suggestion/drive_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/new_tab_page/modules/file_suggestion/drive_service.cc
+@@ -34,7 +34,7 @@
+ #include "services/network/public/cpp/resource_request.h"
+
+ namespace {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kPlatform[] = "LINUX";
+ #elif BUILDFLAG(IS_WIN)
+ constexpr char kPlatform[] = "WINDOWS";
diff --git a/electron34/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc b/electron34/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
new file mode 100644
index 0000000000..774af1c9e8
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/new_tab_page/new_tab_page_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/new_tab_page/new_tab_page_util.cc
+@@ -25,7 +25,7 @@ bool IsOsSupportedForCart() {
+ }
+
+ bool IsOsSupportedForDrive() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc b/electron34/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc
new file mode 100644
index 0000000000..901d975ee3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/notifications/notification_display_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/notifications/notification_display_service_impl.cc
+@@ -32,7 +32,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
+ #include "chrome/browser/sharing/sharing_notification_handler.h"
+ #endif
+@@ -57,7 +57,7 @@ NotificationDisplayServiceImpl* Notifica
+ // static
+ void NotificationDisplayServiceImpl::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kAllowSystemNotifications, true);
+ #endif
+ }
+@@ -73,7 +73,7 @@ NotificationDisplayServiceImpl::Notifica
+ std::make_unique<PersistentNotificationHandler>());
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ AddNotificationHandler(
+ NotificationHandler::Type::SEND_TAB_TO_SELF,
+ std::make_unique<send_tab_to_self::DesktopNotificationHandler>(
+@@ -81,7 +81,7 @@ NotificationDisplayServiceImpl::Notifica
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ AddNotificationHandler(
+ NotificationHandler::Type::TAILORED_SECURITY,
+ std::make_unique<safe_browsing::TailoredSecurityNotificationHandler>());
diff --git a/electron34/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc b/electron34/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
new file mode 100644
index 0000000000..67bfb5a4dc
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/notifications/notification_platform_bridge_delegator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/notifications/notification_platform_bridge_delegator.cc
+@@ -56,7 +56,7 @@ bool SystemNotificationsEnabled(Profile*
+ #elif BUILDFLAG(IS_WIN)
+ return NotificationPlatformBridgeWin::SystemNotificationEnabled();
+ #else
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (profile) {
+ // Prefs take precedence over flags.
+ PrefService* prefs = profile->GetPrefs();
diff --git a/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc b/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc
new file mode 100644
index 0000000000..a4a43e133e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/notifications/platform_notification_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/notifications/platform_notification_service_impl.cc
+@@ -220,6 +220,7 @@ bool PlatformNotificationServiceImpl::Wa
+
+ // TODO(awdf): Rename to DisplayNonPersistentNotification (Similar for Close)
+ void PlatformNotificationServiceImpl::DisplayNotification(
++ content::RenderFrameHost* render_frame_host,
+ const std::string& notification_id,
+ const GURL& origin,
+ const GURL& document_url,
diff --git a/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h b/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h
new file mode 100644
index 0000000000..ec164a6c9e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/notifications/platform_notification_service_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/notifications/platform_notification_service_impl.h
+@@ -57,6 +57,7 @@ class PlatformNotificationServiceImpl
+
+ // content::PlatformNotificationService implementation.
+ void DisplayNotification(
++ content::RenderFrameHost* render_frame_host,
+ const std::string& notification_id,
+ const GURL& origin,
+ const GURL& document_url,
diff --git a/electron34/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc b/electron34/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
new file mode 100644
index 0000000000..705642446f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/password_manager/chrome_password_manager_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/password_manager/chrome_password_manager_client.cc
+@@ -620,7 +620,7 @@ void ChromePasswordManagerClient::
+ bool ChromePasswordManagerClient::IsReauthBeforeFillingRequired(
+ device_reauth::DeviceAuthenticator* authenticator) {
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!GetLocalStatePrefs() || !GetPrefs() || !authenticator) {
+ return false;
+ }
+@@ -876,7 +876,7 @@ void ChromePasswordManagerClient::Notify
+ }
+
+ void ChromePasswordManagerClient::NotifyKeychainError() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ PasswordsClientUIDelegate* manage_passwords_ui_controller =
+ PasswordsClientUIDelegateFromWebContents(web_contents());
+ if (manage_passwords_ui_controller) {
diff --git a/electron34/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc b/electron34/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
new file mode 100644
index 0000000000..ca4cb85345
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/password_manager/password_reuse_manager_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/password_manager/password_reuse_manager_factory.cc
+@@ -141,7 +141,7 @@ PasswordReuseManagerFactory::BuildServic
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<password_manager::PasswordReuseManagerSigninNotifier>
+ notifier = std::make_unique<
+ password_manager::PasswordReuseManagerSigninNotifierImpl>(
diff --git a/electron34/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc b/electron34/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc
new file mode 100644
index 0000000000..01426f9f51
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/pdf/chrome_pdf_stream_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/pdf/chrome_pdf_stream_delegate.cc
+@@ -45,6 +45,7 @@ namespace {
+ // hierarchy is: enterprise policy > user choice > finch experiment.
+ bool ShouldEnableSkiaRenderer(content::WebContents* contents) {
+ CHECK(contents);
++#if 0
+ const PrefService* prefs =
+ Profile::FromBrowserContext(contents->GetBrowserContext())->GetPrefs();
+
+@@ -52,6 +53,7 @@ bool ShouldEnableSkiaRenderer(content::W
+ if (prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) {
+ return prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled);
+ }
++#endif
+
+ // When the enterprise policy is not set, use finch/feature flag choice.
+ return base::FeatureList::IsEnabled(
diff --git a/electron34/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc b/electron34/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc
new file mode 100644
index 0000000000..cb65d72ab1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc
@@ -0,0 +1,70 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/picture_in_picture/picture_in_picture_window_manager.cc
+@@ -6,6 +6,7 @@
+
+ #include "base/memory/raw_ptr.h"
+ #include "base/numerics/safe_conversions.h"
++#include "build/branding_buildflags.h"
+ #include "chrome/browser/picture_in_picture/picture_in_picture_bounds_cache.h"
+ #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h"
+ #include "chrome/browser/ui/browser_navigator_params.h"
+@@ -25,7 +26,9 @@
+ #include "base/metrics/histogram_functions.h"
+ #include "base/numerics/checked_math.h"
+ #include "base/task/sequenced_task_runner.h"
++#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ #include "chrome/browser/picture_in_picture/auto_picture_in_picture_tab_helper.h"
++#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ #include "media/base/media_switches.h"
+ #include "net/base/url_util.h"
+ #include "third_party/blink/public/common/features.h"
+@@ -49,7 +52,7 @@ constexpr gfx::Size kMinWindowSize(240,
+ // not apply to video Picture-in-Picture windows.
+ constexpr double kMaxWindowSizeRatio = 0.8;
+
+-#if !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // Returns true if a document picture-in-picture window should be focused upon
+ // opening it.
+ bool ShouldFocusPictureInPictureWindow(const NavigateParams& params) {
+@@ -190,7 +193,7 @@ bool PictureInPictureWindowManager::Exit
+ return false;
+ }
+
+-#if !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // The user manually closed the pip window, so let the tab helper know in case
+ // the auto-pip permission dialog was visible.
+ if (auto* tab_helper = AutoPictureInPictureTabHelper::FromWebContents(
+@@ -386,7 +389,7 @@ gfx::Size PictureInPictureWindowManager:
+
+ // static
+ void PictureInPictureWindowManager::SetWindowParams(NavigateParams& params) {
+-#if !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // Always show document picture-in-picture in a new window. When this is
+ // not opened via the AutoPictureInPictureTabHelper, focus the window.
+ params.window_action = ShouldFocusPictureInPictureWindow(params)
+@@ -474,6 +477,7 @@ PictureInPictureWindowManager::GetOverla
+ return nullptr;
+ }
+
++#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // It would be nice to create this in `EnterPictureInPicture*`, but detecting
+ // auto-pip while pip is in the process of opening doesn't work.
+ //
+@@ -512,6 +516,8 @@ PictureInPictureWindowManager::GetOverla
+ }
+
+ return overlay_view;
++#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
++ return nullptr;
+ }
+
+ PictureInPictureOcclusionTracker*
diff --git a/electron34/patches/patch-chrome_browser_platform__util__linux.cc b/electron34/patches/patch-chrome_browser_platform__util__linux.cc
new file mode 100644
index 0000000000..9744467deb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_platform__util__linux.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/platform_util_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/platform_util_linux.cc
+@@ -222,7 +222,9 @@ void OnLaunchOptionsCreated(const std::s
+ argv.push_back(command);
+ argv.push_back(arg);
+ options.current_directory = working_directory;
++#if !BUILDFLAG(IS_BSD)
+ options.allow_new_privs = true;
++#endif
+ // xdg-open can fall back on mailcap which eventually might plumb through
+ // to a command that needs a terminal. Set the environment variable telling
+ // it that we definitely don't have a terminal available and that it should
diff --git a/electron34/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc b/electron34/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc
new file mode 100644
index 0000000000..c69a36bd9a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/plugins/plugin_response_interceptor_url_loader_throttle.cc
+@@ -12,8 +12,8 @@
+ #include "base/numerics/safe_conversions.h"
+ #include "base/unguessable_token.h"
+ #include "base/uuid.h"
+-#include "chrome/browser/extensions/api/streams_private/streams_private_api.h"
+-#include "chrome/browser/plugins/plugin_utils.h"
++#include "electron/shell/browser/extensions/api/streams_private/streams_private_api.h"
++#include "electron/shell/browser/plugins/plugin_utils.h"
+ #include "content/public/browser/browser_task_traits.h"
+ #include "content/public/browser/browser_thread.h"
+ #include "content/public/browser/download_utils.h"
diff --git a/electron34/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc b/electron34/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc
new file mode 100644
index 0000000000..40f956dd6a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/policy/browser_signin_policy_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/policy/browser_signin_policy_handler.cc
+@@ -45,7 +45,7 @@ void BrowserSigninPolicyHandler::ApplyPo
+ policies.GetValue(policy_name(), base::Value::Type::INTEGER);
+ switch (static_cast<BrowserSigninMode>(value->GetInt())) {
+ case BrowserSigninMode::kForced:
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ prefs->SetValue(prefs::kForceBrowserSignin, base::Value(true));
+ #endif
+ [[fallthrough]];
diff --git a/electron34/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc b/electron34/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
new file mode 100644
index 0000000000..1d52b79f43
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc
+@@ -57,7 +57,7 @@
+ #include "chrome/browser/policy/browser_dm_token_storage_mac.h"
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/browser_dm_token_storage_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -66,7 +66,7 @@
+ #include "chrome/install_static/install_util.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/device_trust_key_manager_impl.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/key_management/browser/key_rotation_launcher.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+@@ -106,7 +106,7 @@ void ChromeBrowserCloudManagementControl
+
+ #if BUILDFLAG(IS_MAC)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageMac>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageLinux>();
+ #elif BUILDFLAG(IS_WIN)
+ storage_delegate = std::make_unique<BrowserDMTokenStorageWin>();
+@@ -277,7 +277,7 @@ ChromeBrowserCloudManagementControllerDe
+
+ std::unique_ptr<enterprise_connectors::DeviceTrustKeyManager>
+ ChromeBrowserCloudManagementControllerDesktop::CreateDeviceTrustKeyManager() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* browser_dm_token_storage = BrowserDMTokenStorage::Get();
+ auto* device_management_service = GetDeviceManagementService();
+ auto shared_url_loader_factory = GetSharedURLLoaderFactory();
diff --git a/electron34/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc b/electron34/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
new file mode 100644
index 0000000000..52f0666653
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
@@ -0,0 +1,269 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/policy/configuration_policy_handler_list_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/policy/configuration_policy_handler_list_factory.cc
+@@ -252,19 +252,19 @@
+ #include "components/spellcheck/browser/pref_names.h"
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/idle/action.h"
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #include "components/device_signals/core/browser/pref_names.h" // nogncheck due to crbug.com/1125897
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "components/enterprise/idle/idle_timeout_policy_handler.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/privacy_sandbox/privacy_sandbox_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+@@ -278,13 +278,13 @@
+ #endif // BUILDFLAG(ENTERPRISE_CLIENT_CERTIFICATES)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/battery_saver_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/search_engines/enterprise/search_aggregator_policy_handler.h"
+ #include "components/search_engines/enterprise/site_search_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+@@ -576,7 +576,7 @@ const PolicyToPreferenceMapEntry kSimple
+ { key::kDefaultDirectSocketsSetting,
+ prefs::kManagedDefaultDirectSocketsSetting,
+ base::Value::Type::INTEGER },
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kDeletingUndecryptablePasswordsEnabled,
+ password_manager::prefs::kDeletingUndecryptablePasswordsEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -927,7 +927,7 @@ const PolicyToPreferenceMapEntry kSimple
+ prefs::kManagedDefaultGeolocationSetting,
+ base::Value::Type::INTEGER },
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) \
+- || BUILDFLAG(IS_MAC)
++ || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ { key::kRequireOnlineRevocationChecksForLocalAnchors,
+ prefs::kCertRevocationCheckingRequiredLocalAnchors,
+ base::Value::Type::BOOLEAN },
+@@ -936,7 +936,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::BOOLEAN },
+ #endif // #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ // || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ { key::kFullscreenAllowed,
+ prefs::kFullscreenAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -1773,7 +1773,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kGSSAPILibraryName,
+ prefs::kGSSAPILibraryName,
+ base::Value::Type::STRING },
+@@ -1832,7 +1832,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kNetworkServiceSandboxEnabled,
+ prefs::kNetworkServiceSandboxEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1858,12 +1858,12 @@ const PolicyToPreferenceMapEntry kSimple
+ prefs::kTotalMemoryLimitMb,
+ base::Value::Type::INTEGER },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kBackgroundModeEnabled,
+ prefs::kBackgroundModeEnabled,
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kUnmanagedDeviceSignalsConsentFlowEnabled,
+ device_signals::prefs::kUnmanagedDeviceSignalsConsentFlowEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1871,7 +1871,7 @@ const PolicyToPreferenceMapEntry kSimple
+ prefs::kProfileSeparationDomainExceptionList,
+ base::Value::Type::LIST },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kDefaultBrowserSettingEnabled,
+ prefs::kDefaultBrowserSettingEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -1883,7 +1883,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) \
+- || BUILDFLAG(IS_CHROMEOS)
++ || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ { key::kAutoplayAllowed,
+ prefs::kAutoplayAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -1984,7 +1984,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::BOOLEAN },
+ #endif // !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ { key::kAlternativeBrowserPath,
+ browser_switcher::prefs::kAlternativeBrowserPath,
+ base::Value::Type::STRING },
+@@ -2089,7 +2089,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::LIST },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ { key::kAuthNegotiateDelegateByKdcPolicy,
+ prefs::kAuthNegotiateDelegateByKdcPolicy,
+ base::Value::Type::BOOLEAN },
+@@ -2168,7 +2168,7 @@ const PolicyToPreferenceMapEntry kSimple
+ ash::prefs::kUrlParameterToAutofillSAMLUsername,
+ base::Value::Type::STRING },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ { key::kTabDiscardingExceptions,
+ performance_manager::user_tuning::prefs::kManagedTabDiscardingExceptions,
+ base::Value::Type::LIST },
+@@ -2197,7 +2197,7 @@ const PolicyToPreferenceMapEntry kSimple
+ prefs::kUiAutomationProviderEnabled,
+ base::Value::Type::BOOLEAN },
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kOutOfProcessSystemDnsResolutionEnabled,
+ prefs::kOutOfProcessSystemDnsResolutionEnabled,
+ base::Value::Type::BOOLEAN },
+@@ -2240,7 +2240,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::INTEGER },
+ #endif
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kExtensionInstallTypeBlocklist,
+ extensions::pref_names::kExtensionInstallTypeBlocklist,
+ base::Value::Type::LIST},
+@@ -2266,7 +2266,7 @@ const PolicyToPreferenceMapEntry kSimple
+ { key::kTabCompareSettings,
+ optimization_guide::prefs::kProductSpecificationsEnterprisePolicyAllowed,
+ base::Value::Type::INTEGER},
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ { key::kChromeForTestingAllowed,
+ prefs::kChromeForTestingAllowed,
+ base::Value::Type::BOOLEAN },
+@@ -2422,7 +2422,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ // Policies for all platforms - End
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<IntRangePolicyHandler>(
+ key::kMemorySaverModeSavings,
+ performance_manager::user_tuning::prefs::kMemorySaverModeAggressiveness,
+@@ -2438,7 +2438,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(
+ std::make_unique<SiteSearchPolicyHandler>(chrome_schema));
+ handlers->AddHandler(
+@@ -2647,7 +2647,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(
+ std::make_unique<enterprise_idle::IdleTimeoutPolicyHandler>());
+ handlers->AddHandler(
+@@ -2700,7 +2700,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ key::kBrowsingDataLifetime, browsing_data::prefs::kBrowsingDataLifetime,
+ chrome_schema));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<LocalSyncPolicyHandler>());
+ handlers->AddHandler(std::make_unique<ThemeColorPolicyHandler>());
+ handlers->AddHandler(
+@@ -2791,7 +2791,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ std::vector<std::unique_ptr<ConfigurationPolicyHandler>>
+ signin_legacy_policies;
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ signin_legacy_policies.push_back(std::make_unique<SimplePolicyHandler>(
+ key::kForceBrowserSignin, prefs::kForceBrowserSignin,
+ base::Value::Type::BOOLEAN));
+@@ -3160,7 +3160,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ #endif
+
+ #if BUILDFLAG(ENABLE_SPELLCHECK)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<SpellcheckLanguagePolicyHandler>());
+ handlers->AddHandler(
+ std::make_unique<SpellcheckLanguageBlocklistPolicyHandler>(
+@@ -3168,7 +3168,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<SimplePolicyHandler>(
+ key::kAllowSystemNotifications, prefs::kAllowSystemNotifications,
+ base::Value::Type::BOOLEAN));
+@@ -3186,7 +3186,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ first_party_sets::FirstPartySetsOverridesPolicyHandler>(
+ key::kRelatedWebsiteSetsOverrides, chrome_schema)));
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<PrivacySandboxPolicyHandler>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+@@ -3209,7 +3209,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ base::Value::Type::BOOLEAN)));
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ handlers->AddHandler(std::make_unique<BatterySaverPolicyHandler>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -3233,7 +3233,7 @@ std::unique_ptr<ConfigurationPolicyHandl
+ std::vector<GenAiDefaultSettingsPolicyHandler::GenAiPolicyDetails>
+ gen_ai_default_policies;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ gen_ai_default_policies.emplace_back(
+ key::kAutofillPredictionSettings,
+ optimization_guide::prefs::
diff --git a/electron34/patches/patch-chrome_browser_policy_device__management__service__configuration.cc b/electron34/patches/patch-chrome_browser_policy_device__management__service__configuration.cc
new file mode 100644
index 0000000000..565b549412
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_policy_device__management__service__configuration.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/policy/device_management_service_configuration.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/policy/device_management_service_configuration.cc
+@@ -23,7 +23,7 @@
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
+- !BUILDFLAG(IS_ANDROID))
++ !BUILDFLAG(IS_ANDROID)) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/common.h"
+ #include "chrome/browser/enterprise/connectors/connectors_service.h"
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc b/electron34/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
new file mode 100644
index 0000000000..c21335f0f3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/policy/policy_value_and_status_aggregator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/policy/policy_value_and_status_aggregator.cc
+@@ -53,7 +53,7 @@
+ #include "chrome/browser/policy/value_provider/extension_policies_value_provider.h"
+ #endif // BUILDFLAG(ENABLE_EXTENSIONS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/policy/core/common/cloud/profile_cloud_policy_manager.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.cc b/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.cc
new file mode 100644
index 0000000000..83adafed5b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.cc
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/predictors/preconnect_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/predictors/preconnect_manager.cc
+@@ -14,9 +14,11 @@
+ #include "base/trace_event/trace_event.h"
+ #include "chrome/browser/predictors/predictors_features.h"
+ #include "chrome/browser/predictors/predictors_traffic_annotations.h"
++#if 0
+ #include "chrome/browser/predictors/resource_prefetch_predictor.h"
+ #include "chrome/browser/preloading/preloading_prefs.h"
+ #include "chrome/browser/profiles/profile.h"
++#endif
+ #include "content/public/browser/browser_context.h"
+ #include "content/public/browser/browser_task_traits.h"
+ #include "content/public/browser/browser_thread.h"
+@@ -27,6 +29,20 @@ namespace predictors {
+
+ const bool kAllowCredentialsOnPreconnectByDefault = true;
+
++// NOTE(nornagon): this is copied from
++// //chrome/browser/predictors/resource_prefetch_predictor.cc we don't need
++// anything in that file other than this constructor.
++PreconnectRequest::PreconnectRequest(
++ const url::Origin& origin,
++ int num_sockets,
++ const net::NetworkAnonymizationKey& network_anonymization_key)
++ : origin(origin),
++ num_sockets(num_sockets),
++ network_anonymization_key(network_anonymization_key) {
++ DCHECK_GE(num_sockets, 0);
++ DCHECK(!network_anonymization_key.IsEmpty());
++}
++
+ PreconnectedRequestStats::PreconnectedRequestStats(const url::Origin& origin,
+ bool was_preconnected)
+ : origin(origin), was_preconnected(was_preconnected) {}
+@@ -90,12 +106,15 @@ PreconnectManager::PreconnectManager(bas
+ PreconnectManager::~PreconnectManager() = default;
+
+ bool PreconnectManager::IsEnabled() {
++#if 0
+ Profile* profile = Profile::FromBrowserContext(browser_context_);
+ if (!profile) {
+ return false;
+ }
+ return prefetch::IsSomePreloadingEnabled(*profile->GetPrefs()) ==
+ content::PreloadingEligibility::kEligible;
++#endif
++ return true;
+ }
+
+ void PreconnectManager::Start(const GURL& url,
diff --git a/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.h b/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.h
new file mode 100644
index 0000000000..d8ffa97057
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_predictors_preconnect__manager.h
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/predictors/preconnect_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/predictors/preconnect_manager.h
+@@ -17,7 +17,9 @@
+ #include "base/time/time.h"
+ #include "chrome/browser/predictors/proxy_lookup_client_impl.h"
+ #include "chrome/browser/predictors/resolve_host_client_impl.h"
++#if 0
+ #include "chrome/browser/predictors/resource_prefetch_predictor.h"
++#endif
+ #include "net/base/network_anonymization_key.h"
+ #include "url/gurl.h"
+
+@@ -33,7 +35,28 @@ class NetworkContext;
+
+ namespace predictors {
+
+-struct PreconnectRequest;
++// Stores all values needed to trigger a preconnect/preresolve job to a single
++// origin.
++struct PreconnectRequest {
++ // |network_anonymization_key| specifies the key that network requests for the
++ // preconnected URL are expected to use. If a request is issued with a
++ // different key, it may not use the preconnected socket. It has no effect
++ // when |num_sockets| == 0.
++ PreconnectRequest(
++ const url::Origin& origin,
++ int num_sockets,
++ const net::NetworkAnonymizationKey& network_anonymization_key);
++ PreconnectRequest(const PreconnectRequest&) = default;
++ PreconnectRequest(PreconnectRequest&&) = default;
++ PreconnectRequest& operator=(const PreconnectRequest&) = default;
++ PreconnectRequest& operator=(PreconnectRequest&&) = default;
++
++ url::Origin origin;
++ // A zero-value means that we need to preresolve a host only.
++ int num_sockets = 0;
++ bool allow_credentials = true;
++ net::NetworkAnonymizationKey network_anonymization_key;
++};
+
+ struct PreconnectedRequestStats {
+ PreconnectedRequestStats(const url::Origin& origin, bool was_preconnected);
diff --git a/electron34/patches/patch-chrome_browser_prefs_browser__prefs.cc b/electron34/patches/patch-chrome_browser_prefs_browser__prefs.cc
new file mode 100644
index 0000000000..9e3d43a66f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_prefs_browser__prefs.cc
@@ -0,0 +1,81 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/prefs/browser_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/prefs/browser_prefs.cc
+@@ -314,7 +314,7 @@
+ #include "components/user_notes/user_notes_prefs.h"
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h"
+ #endif
+
+@@ -485,18 +485,18 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "components/device_signals/core/browser/pref_names.h" // nogncheck due to crbug.com/1125897
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "chrome/browser/browser_switcher/browser_switcher_prefs.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #endif
+
+@@ -531,7 +531,7 @@
+ #include "chrome/browser/sessions/session_service_log.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/color/system_theme.h"
+ #endif
+
+@@ -1719,7 +1719,7 @@ void RegisterLocalState(PrefRegistrySimp
+ on_device_translation::RegisterLocalStatePrefs(registry);
+ #endif // BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WhatsNewUI::RegisterLocalStatePrefs(registry);
+ #endif
+
+@@ -1892,7 +1892,7 @@ void RegisterLocalState(PrefRegistrySimp
+ #endif // BUILDFLAG(ENABLE_PDF)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kChromeForTestingAllowed, true);
+ #endif
+
+@@ -2248,12 +2248,12 @@ void RegisterProfilePrefs(user_prefs::Pr
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ device_signals::RegisterProfilePrefs(registry);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ browser_switcher::BrowserSwitcherPrefs::RegisterProfilePrefs(registry);
+ enterprise_signin::RegisterProfilePrefs(registry);
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc b/electron34/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
new file mode 100644
index 0000000000..58896ec252
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/prefs/pref_service_incognito_allowlist.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/prefs/pref_service_incognito_allowlist.cc
+@@ -205,7 +205,7 @@ const char* const kPersistentPrefNames[]
+ prefs::kShowFullscreenToolbar,
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Toggleing custom frames affects all open windows in the profile, hence
+ // should be written to the regular profile when changed in incognito mode.
+ prefs::kUseCustomChromeFrame,
diff --git a/electron34/patches/patch-chrome_browser_printing_print__backend__service__manager.cc b/electron34/patches/patch-chrome_browser_printing_print__backend__service__manager.cc
new file mode 100644
index 0000000000..daa799f467
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_printing_print__backend__service__manager.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/printing/print_backend_service_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/printing/print_backend_service_manager.cc
+@@ -36,7 +36,7 @@
+ #include "printing/printing_context.h"
+ #include "printing/printing_features.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/public/common/content_switches.h"
+ #endif
+
+@@ -883,7 +883,7 @@ PrintBackendServiceManager::GetServiceFr
+ host.BindNewPipeAndPassReceiver(),
+ content::ServiceProcessHost::Options()
+ .WithDisplayName(IDS_UTILITY_PROCESS_PRINT_BACKEND_SERVICE_NAME)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .WithExtraCommandLineSwitches({switches::kMessageLoopTypeUi})
+ #endif
+ .Pass());
+@@ -1060,7 +1060,7 @@ PrintBackendServiceManager::DetermineIdl
+ return kNoClientsRegisteredResetOnIdleTimeout;
+
+ case ClientType::kQueryWithUi:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // No need to update if there were other query with UI clients.
+ if (HasQueryWithUiClientForRemoteId(remote_id)) {
+ return std::nullopt;
diff --git a/electron34/patches/patch-chrome_browser_printing_print__job.cc b/electron34/patches/patch-chrome_browser_printing_print__job.cc
new file mode 100644
index 0000000000..38d30631f0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_printing_print__job.cc
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/printing/print_job.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/printing/print_job.cc
+@@ -97,6 +97,7 @@ bool PrintWithReducedRasterization(PrefS
+ return base::FeatureList::IsEnabled(features::kPrintWithReducedRasterization);
+ }
+
++#if 0
+ PrefService* GetPrefsForWebContents(content::WebContents* web_contents) {
+ // TODO(thestig): Figure out why crbug.com/1083911 occurred, which is likely
+ // because `web_contents` was null. As a result, this section has many more
+@@ -111,6 +112,7 @@ content::WebContents* GetWebContents(con
+ auto* rfh = content::RenderFrameHost::FromID(rfh_id);
+ return rfh ? content::WebContents::FromRenderFrameHost(rfh) : nullptr;
+ }
++#endif
+
+ #endif // BUILDFLAG(IS_WIN)
+
+@@ -151,10 +153,8 @@ void PrintJob::Initialize(std::unique_pt
+
+ #if BUILDFLAG(IS_WIN)
+ pdf_page_mapping_ = PageNumber::GetPages(settings->ranges(), page_count);
+- PrefService* prefs = GetPrefsForWebContents(GetWebContents(rfh_id_));
+- if (prefs && prefs->IsManagedPreference(prefs::kPdfUseSkiaRendererEnabled)) {
+- use_skia_ = prefs->GetBoolean(prefs::kPdfUseSkiaRendererEnabled);
+- }
++ // TODO(codebytere): should we enable this later?
++ use_skia_ = false;
+ #endif
+
+ auto new_doc = base::MakeRefCounted<PrintedDocument>(std::move(settings),
+@@ -404,8 +404,10 @@ void PrintJob::StartPdfToEmfConversion(
+
+ const PrintSettings& settings = document()->settings();
+
++#if 0
+ PrefService* prefs = GetPrefsForWebContents(GetWebContents(rfh_id_));
+- bool print_with_reduced_rasterization = PrintWithReducedRasterization(prefs);
++#endif
++ bool print_with_reduced_rasterization = PrintWithReducedRasterization(nullptr);
+
+ using RenderMode = PdfRenderSettings::Mode;
+ RenderMode mode = print_with_reduced_rasterization
+@@ -497,8 +499,10 @@ void PrintJob::StartPdfToPostScriptConve
+ if (ps_level2) {
+ mode = PdfRenderSettings::Mode::POSTSCRIPT_LEVEL2;
+ } else {
++#if 0
+ PrefService* prefs = GetPrefsForWebContents(GetWebContents(rfh_id_));
+- mode = PrintWithPostScriptType42Fonts(prefs)
++#endif
++ mode = PrintWithPostScriptType42Fonts(nullptr)
+ ? PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3_WITH_TYPE42_FONTS
+ : PdfRenderSettings::Mode::POSTSCRIPT_LEVEL3;
+ }
diff --git a/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.cc b/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.cc
new file mode 100644
index 0000000000..94e75ebba4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.cc
@@ -0,0 +1,433 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/printing/print_view_manager_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/printing/print_view_manager_base.cc
+@@ -83,6 +83,20 @@ namespace printing {
+
+ namespace {
+
++std::string PrintReasonFromPrintStatus(PrintViewManager::PrintStatus status) {
++ if (status == PrintViewManager::PrintStatus::kInvalid) {
++ return "Invalid printer settings";
++ } else if (status == PrintViewManager::PrintStatus::kCanceled) {
++ return "Print job canceled";
++ } else if (status == PrintViewManager::PrintStatus::kFailed) {
++ return "Print job failed";
++ }
++ return "";
++}
++
++using PrintSettingsCallback =
++ base::OnceCallback<void(std::unique_ptr<PrinterQuery>)>;
++
+ void OnDidGetDefaultPrintSettings(
+ scoped_refptr<PrintQueriesQueue> queue,
+ bool want_pdf_settings,
+@@ -91,9 +105,9 @@ void OnDidGetDefaultPrintSettings(
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ if (printer_query->last_status() != mojom::ResultCode::kSuccess) {
+- if (!want_pdf_settings) {
++#if 0 // Electron does not use Chromium error dialogs
+ ShowPrintErrorDialogForInvalidPrinterError();
+- }
++#endif
+ std::move(callback).Run(nullptr);
+ return;
+ }
+@@ -103,9 +117,9 @@ void OnDidGetDefaultPrintSettings(
+ params->document_cookie = printer_query->cookie();
+
+ if (!PrintMsgPrintParamsIsValid(*params)) {
+- if (!want_pdf_settings) {
++#if 0 // Electron does not use Chromium error dialogs
+ ShowPrintErrorDialogForInvalidPrinterError();
+- }
++#endif
+ std::move(callback).Run(nullptr);
+ return;
+ }
+@@ -117,14 +131,14 @@ void OnDidGetDefaultPrintSettings(
+ void OnDidScriptedPrint(
+ scoped_refptr<PrintQueriesQueue> queue,
+ std::unique_ptr<PrinterQuery> printer_query,
+- mojom::PrintManagerHost::ScriptedPrintCallback callback) {
++ mojom::PrintManagerHost::ScriptedPrintCallback callback,
++ base::OnceCallback<void()> cancel_job) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+ if (printer_query->last_status() != mojom::ResultCode::kSuccess ||
+ !printer_query->settings().dpi()) {
+- // Notify user of the error, unless it was explicitly canceled.
+- if (printer_query->last_status() != mojom::ResultCode::kCanceled) {
+- ShowPrintErrorDialogForGenericError();
++ if (printer_query->last_status() == mojom::ResultCode::kCanceled) {
++ std::move(cancel_job).Run();
+ }
+ std::move(callback).Run(nullptr);
+ return;
+@@ -182,9 +196,11 @@ PrintViewManagerBase::PrintViewManagerBa
+ : PrintManager(web_contents),
+ queue_(g_browser_process->print_job_manager()->queue()) {
+ DCHECK(queue_);
++#if 0
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents->GetBrowserContext());
+ printing_enabled_.Init(prefs::kPrintingEnabled, profile->GetPrefs());
++#endif
+ }
+
+ PrintViewManagerBase::~PrintViewManagerBase() {
+@@ -208,12 +224,16 @@ void PrintViewManagerBase::DisableThirdP
+ }
+ #endif // BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
+
+-bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh) {
++bool PrintViewManagerBase::PrintNow(content::RenderFrameHost* rfh,
++ base::Value::Dict settings,
++ CompletionCallback callback) {
+ if (!StartPrintCommon(rfh)) {
+ return false;
+ }
+
+- GetPrintRenderFrame(rfh)->PrintRequestedPages();
++ callback_ = std::move(callback);
++
++ GetPrintRenderFrame(rfh)->PrintRequestedPages(std::move(settings));
+
+ for (auto& observer : GetTestObservers()) {
+ observer.OnPrintNow(rfh);
+@@ -295,7 +315,7 @@ void PrintViewManagerBase::PrintDocument
+ const gfx::Size& page_size,
+ const gfx::Rect& content_area,
+ const gfx::Point& offsets) {
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ if (content_analysis_before_printing_document_) {
+ std::move(content_analysis_before_printing_document_)
+ .Run(print_data, page_size, content_area, offsets);
+@@ -342,12 +362,13 @@ void PrintViewManagerBase::OnDidUpdatePr
+ }
+ PRINTER_LOG(EVENT) << "Paper printable area updated for vendor id "
+ << print_settings->requested_media().vendor_id;
+- CompleteUpdatePrintSettings(std::move(job_settings),
++ CompleteUpdatePrintSettings(nullptr /* printer_query */, std::move(job_settings),
+ std::move(print_settings), std::move(callback));
+ }
+ #endif
+
+ void PrintViewManagerBase::CompleteUpdatePrintSettings(
++ std::unique_ptr<PrinterQuery> printer_query,
+ base::Value::Dict job_settings,
+ std::unique_ptr<PrintSettings> print_settings,
+ UpdatePrintSettingsCallback callback) {
+@@ -355,7 +376,8 @@ void PrintViewManagerBase::CompleteUpdat
+ settings->pages = GetPageRangesFromJobSettings(job_settings);
+ settings->params = mojom::PrintParams::New();
+ RenderParamsFromPrintSettings(*print_settings, settings->params.get());
+- settings->params->document_cookie = PrintSettings::NewCookie();
++ settings->params->document_cookie = printer_query ? printer_query->cookie()
++ : PrintSettings::NewCookie();
+ if (!PrintMsgPrintParamsIsValid(*settings->params)) {
+ mojom::PrinterType printer_type = static_cast<mojom::PrinterType>(
+ *job_settings.FindInt(kSettingPrinterType));
+@@ -367,6 +389,10 @@ void PrintViewManagerBase::CompleteUpdat
+ return;
+ }
+
++ if (printer_query && printer_query->cookie() && printer_query->settings().dpi()) {
++ queue_->QueuePrinterQuery(std::move(printer_query));
++ }
++
+ set_cookie(settings->params->document_cookie);
+ std::move(callback).Run(std::move(settings));
+ }
+@@ -408,7 +434,9 @@ void PrintViewManagerBase::OnPrintSettin
+ UnregisterSystemPrintClient();
+ }
+ #endif
++#if 0 // Electron does not use Chromium error dialogs
+ ShowPrintErrorDialogForGenericError();
++#endif
+ std::move(callback).Run(base::Value("Update settings failed"));
+ return;
+ }
+@@ -437,7 +465,7 @@ void PrintViewManagerBase::StartLocalPri
+ PrinterHandler::PrintCallback callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ // Populating `content_analysis_before_printing_document_` if needed should be
+ // done first in this function's workflow, this way other code can check if
+ // content analysis is going to happen and delay starting `print_job_` to
+@@ -664,7 +692,7 @@ void PrintViewManagerBase::GetDefaultPri
+
+ #if BUILDFLAG(ENABLE_OOP_PRINTING)
+ if (ShouldPrintJobOop() &&
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ !analyzing_content_ &&
+ #endif
+ !query_with_ui_client_id().has_value()) {
+@@ -692,7 +720,7 @@ void PrintViewManagerBase::GetDefaultPri
+
+ // Sometimes it is desired to get the PDF settings as opposed to the settings
+ // of the default system print driver.
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ bool want_pdf_settings = analyzing_content_;
+ #else
+ bool want_pdf_settings = false;
+@@ -736,10 +764,7 @@ void PrintViewManagerBase::UpdatePrintSe
+ // `job_settings` does not yet contain the rasterized PDF dpi, so if the user
+ // has the print preference set, fetch it for use in
+ // `PrintSettingsFromJobSettings()`.
+- content::BrowserContext* context =
+- web_contents() ? web_contents()->GetBrowserContext() : nullptr;
+- PrefService* prefs =
+- context ? Profile::FromBrowserContext(context)->GetPrefs() : nullptr;
++ PrefService* prefs = nullptr;
+ if (prefs && prefs->HasPrefPath(prefs::kPrintRasterizePdfDpi)) {
+ int value = prefs->GetInteger(prefs::kPrintRasterizePdfDpi);
+ if (value > 0)
+@@ -764,8 +789,22 @@ void PrintViewManagerBase::UpdatePrintSe
+ }
+ }
+
+-#if BUILDFLAG(IS_WIN)
+- // TODO(crbug.com/40260379): Remove this if the printable areas can be made
++ std::unique_ptr<PrinterQuery> query =
++ queue_->CreatePrinterQuery(GetCurrentTargetFrame()->GetGlobalId());
++ auto* query_ptr = query.get();
++ // We need to clone this before calling SetSettings because some environments
++ // evaluate job_settings.Clone() first, and some std::move(job_settings) first,
++ // for the former things work correctly but for the latter the cloned value is null.
++ auto job_settings_copy = job_settings.Clone();
++ query_ptr->SetSettings(
++ std::move(job_settings_copy),
++ base::BindOnce(&PrintViewManagerBase::CompleteUpdatePrintSettings,
++ weak_ptr_factory_.GetWeakPtr(), std::move(query),
++ std::move(job_settings), std::move(print_settings),
++ std::move(callback)));
++
++#if 0 // See https://chromium-review.googlesource.com/412367
++ // TODO(crbug.com/1424368): Remove this if the printable areas can be made
+ // fully available from `PrintBackend::GetPrinterSemanticCapsAndDefaults()`
+ // for in-browser queries.
+ if (printer_type == mojom::PrinterType::kLocal) {
+@@ -786,8 +825,6 @@ void PrintViewManagerBase::UpdatePrintSe
+ }
+ #endif
+
+- CompleteUpdatePrintSettings(std::move(job_settings),
+- std::move(print_settings), std::move(callback));
+ }
+
+ void PrintViewManagerBase::SetAccessibilityTree(
+@@ -803,7 +840,7 @@ void PrintViewManagerBase::SetAccessibil
+ void PrintViewManagerBase::IsPrintingEnabled(
+ IsPrintingEnabledCallback callback) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+- std::move(callback).Run(GetPrintingEnabledBooleanPref());
++ std::move(callback).Run(true);
+ }
+
+ void PrintViewManagerBase::ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
+@@ -829,7 +866,7 @@ void PrintViewManagerBase::ScriptedPrint
+ return;
+ }
+ #endif
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ std::optional<enterprise_connectors::ContentAnalysisDelegate::Data>
+ scanning_data = enterprise_data_protection::GetPrintAnalysisData(
+ web_contents(), enterprise_data_protection::PrintScanningContext::
+@@ -859,11 +896,9 @@ void PrintViewManagerBase::PrintingFaile
+ // destroyed. In such cases the error notification to the user will
+ // have already been displayed, and a second message should not be
+ // shown.
+- if (print_job_ && print_job_->document() &&
+- print_job_->document()->cookie() == cookie) {
++#if 0 // Electron does not use Chromium error dialogs
+ ShowPrintErrorDialogForGenericError();
+- }
+-
++#endif
+ ReleasePrinterQuery();
+ }
+
+@@ -875,15 +910,24 @@ void PrintViewManagerBase::RemoveTestObs
+ test_observers_.RemoveObserver(&observer);
+ }
+
++void PrintViewManagerBase::ShowInvalidPrinterSettingsError() {
++ if (!callback_.is_null()) {
++ printing_status_ = PrintStatus::kInvalid;
++ TerminatePrintJob(true);
++ }
++}
++
+ void PrintViewManagerBase::RenderFrameHostStateChanged(
+ content::RenderFrameHost* render_frame_host,
+ content::RenderFrameHost::LifecycleState /*old_state*/,
+ content::RenderFrameHost::LifecycleState new_state) {
++#if 0
+ if (new_state == content::RenderFrameHost::LifecycleState::kActive &&
+ render_frame_host->GetProcess()->IsPdf() &&
+ !render_frame_host->GetMainFrame()->GetParentOrOuterDocument()) {
+ GetPrintRenderFrame(render_frame_host)->ConnectToPdfRenderer();
+ }
++#endif
+ }
+
+ void PrintViewManagerBase::RenderFrameDeleted(
+@@ -925,13 +969,14 @@ void PrintViewManagerBase::SystemDialogC
+ // System dialog was cancelled. Clean up the print job and notify the
+ // BackgroundPrintingManager.
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
++ printing_status_ = PrintStatus::kCanceled;
+ ReleasePrinterQuery();
+ TerminatePrintJob(true);
+ }
+ #endif
+
+ bool PrintViewManagerBase::GetPrintingEnabledBooleanPref() const {
+- return printing_enabled_.GetValue();
++ return true;
+ }
+
+ void PrintViewManagerBase::OnDocDone(int job_id, PrintedDocument* document) {
+@@ -945,18 +990,26 @@ void PrintViewManagerBase::OnJobDone() {
+ // Printing is done, we don't need it anymore.
+ // print_job_->is_job_pending() may still be true, depending on the order
+ // of object registration.
+- printing_succeeded_ = true;
++ printing_status_ = PrintStatus::kSucceeded;
++ ReleasePrintJob();
++}
++
++void PrintViewManagerBase::UserInitCanceled() {
++ printing_status_ = PrintStatus::kCanceled;
+ ReleasePrintJob();
+ }
+
+ void PrintViewManagerBase::OnCanceling() {
++ printing_status_ = PrintStatus::kCanceled;
+ canceling_job_ = true;
+ }
+
+ void PrintViewManagerBase::OnFailed() {
+ if (!canceling_job_)
++ printing_status_ = PrintStatus::kFailed;
++#if 0 // Electron does not use Chromium error dialogs
+ ShowPrintErrorDialogForGenericError();
+-
++#endif
+ TerminatePrintJob(true);
+ }
+
+@@ -966,7 +1019,7 @@ bool PrintViewManagerBase::RenderAllMiss
+
+ // Is the document already complete?
+ if (print_job_->document() && print_job_->document()->IsComplete()) {
+- printing_succeeded_ = true;
++ printing_status_ = PrintStatus::kSucceeded;
+ return true;
+ }
+
+@@ -1019,7 +1072,10 @@ bool PrintViewManagerBase::SetupNewPrint
+
+ // Disconnect the current `print_job_`.
+ auto weak_this = weak_ptr_factory_.GetWeakPtr();
+- DisconnectFromCurrentPrintJob();
++ if (callback_.is_null()) {
++ // Disconnect the current |print_job_| only when calling window.print()
++ DisconnectFromCurrentPrintJob();
++ }
+ if (!weak_this)
+ return false;
+
+@@ -1039,7 +1095,7 @@ bool PrintViewManagerBase::SetupNewPrint
+ #endif
+ print_job_->AddObserver(*this);
+
+- printing_succeeded_ = false;
++ printing_status_ = PrintStatus::kUnknown;
+ return true;
+ }
+
+@@ -1097,7 +1153,7 @@ void PrintViewManagerBase::ReleasePrintJ
+ // Ensure that any residual registration of printing client is released.
+ // This might be necessary in some abnormal cases, such as the associated
+ // render process having terminated.
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ if (!analyzing_content_) {
+ UnregisterSystemPrintClient();
+ }
+@@ -1107,6 +1163,11 @@ void PrintViewManagerBase::ReleasePrintJ
+ }
+ #endif
+
++ if (!callback_.is_null()) {
++ bool success = printing_status_ == PrintStatus::kSucceeded;
++ std::move(callback_).Run(success, PrintReasonFromPrintStatus(printing_status_));
++ }
++
+ if (!print_job_)
+ return;
+
+@@ -1114,7 +1175,7 @@ void PrintViewManagerBase::ReleasePrintJ
+ // printing_rfh_ should only ever point to a RenderFrameHost with a live
+ // RenderFrame.
+ DCHECK(rfh->IsRenderFrameLive());
+- GetPrintRenderFrame(rfh)->PrintingDone(printing_succeeded_);
++ GetPrintRenderFrame(rfh)->PrintingDone(printing_status_ == PrintStatus::kSucceeded);
+ }
+
+ print_job_->RemoveObserver(*this);
+@@ -1156,7 +1217,7 @@ bool PrintViewManagerBase::RunInnerMessa
+ }
+
+ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
+- if (print_job_)
++ if (print_job_ && print_job_->document())
+ return true;
+
+ if (!cookie) {
+@@ -1179,7 +1240,7 @@ bool PrintViewManagerBase::Opportunistic
+ return false;
+ }
+
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ // Don't start printing if enterprise checks are being performed to check if
+ // printing is allowed, or if content analysis is going to take place right
+ // before starting `print_job_`.
+@@ -1310,6 +1371,8 @@ void PrintViewManagerBase::CompleteScrip
+ auto callback_wrapper = base::BindOnce(
+ &PrintViewManagerBase::ScriptedPrintReply, weak_ptr_factory_.GetWeakPtr(),
+ std::move(callback), render_process_host->GetID());
++ auto cancel_job_wrapper = base::BindOnce(
++ &PrintViewManagerBase::UserInitCanceled, weak_ptr_factory_.GetWeakPtr());
+ #if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ DisableThirdPartyBlocking();
+ #endif
+@@ -1324,10 +1387,10 @@ void PrintViewManagerBase::CompleteScrip
+ params->expected_pages_count, params->has_selection, params->margin_type,
+ params->is_scripted, !render_process_host->IsPdf(),
+ base::BindOnce(&OnDidScriptedPrint, queue_, std::move(printer_query),
+- std::move(callback_wrapper)));
++ std::move(callback_wrapper), std::move(cancel_job_wrapper)));
+ }
+
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ void PrintViewManagerBase::CompletePrintDocumentAfterContentAnalysis(
+ scoped_refptr<base::RefCountedMemory> print_data,
+ const gfx::Size& page_size,
diff --git a/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.h b/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.h
new file mode 100644
index 0000000000..737a85d542
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_printing_print__view__manager__base.h
@@ -0,0 +1,84 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/printing/print_view_manager_base.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/printing/print_view_manager_base.h
+@@ -52,6 +52,8 @@ class PrinterQuery;
+ // rollout.
+ BASE_DECLARE_FEATURE(kCheckPrintRfhIsActive);
+
++using CompletionCallback = base::OnceCallback<void(bool, const std::string&)>;
++
+ // Base class for managing the print commands for a WebContents.
+ class PrintViewManagerBase : public PrintManager, public PrintJob::Observer {
+ public:
+@@ -87,7 +89,9 @@ class PrintViewManagerBase : public Prin
+ // Prints the current document immediately. Since the rendering is
+ // asynchronous, the actual printing will not be completed on the return of
+ // this function. Returns false if printing is impossible at the moment.
+- virtual bool PrintNow(content::RenderFrameHost* rfh);
++ virtual bool PrintNow(content::RenderFrameHost* rfh,
++ base::Value::Dict settings = {},
++ CompletionCallback callback = {});
+
+ // Like PrintNow(), but for the node under the context menu, instead of the
+ // entire frame.
+@@ -141,8 +145,10 @@ class PrintViewManagerBase : public Prin
+ void IsPrintingEnabled(IsPrintingEnabledCallback callback) override;
+ void ScriptedPrint(mojom::ScriptedPrintParamsPtr params,
+ ScriptedPrintCallback callback) override;
++ void ShowInvalidPrinterSettingsError() override;
+ void PrintingFailed(int32_t cookie,
+ mojom::PrintFailureReason reason) override;
++ void UserInitCanceled();
+
+ // Adds and removes observers for `PrintViewManagerBase` events. The order in
+ // which notifications are sent to observers is undefined. Observers must be
+@@ -150,6 +156,14 @@ class PrintViewManagerBase : public Prin
+ void AddTestObserver(TestObserver& observer);
+ void RemoveTestObserver(TestObserver& observer);
+
++ enum class PrintStatus {
++ kSucceeded,
++ kCanceled,
++ kFailed,
++ kInvalid,
++ kUnknown
++ };
++
+ protected:
+ #if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
+ using PrintDocumentCallback =
+@@ -229,7 +243,7 @@ class PrintViewManagerBase : public Prin
+ mojom::ScriptedPrintParamsPtr params,
+ ScriptedPrintCallback callback);
+
+-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS)
++#if 0
+ // Helper method bound to `content_analysis_before_printing_document_` when
+ // content analysis should happen right before the document is to be printed.
+ // This method is virtual for testing purposes.
+@@ -293,6 +307,7 @@ class PrintViewManagerBase : public Prin
+ bool success);
+ #endif
+ void CompleteUpdatePrintSettings(
++ std::unique_ptr<PrinterQuery> printer_query,
+ base::Value::Dict job_settings,
+ std::unique_ptr<PrintSettings> print_settings,
+ UpdatePrintSettingsCallback callback);
+@@ -387,8 +402,11 @@ class PrintViewManagerBase : public Prin
+ // The current RFH that is printing with a system printing dialog.
+ raw_ptr<content::RenderFrameHost> printing_rfh_ = nullptr;
+
++ // Respond with success of the print job.
++ CompletionCallback callback_;
++
+ // Indication of success of the print job.
+- bool printing_succeeded_ = false;
++ PrintStatus printing_status_ = PrintStatus::kUnknown;
+
+ // Indication that the job is getting canceled.
+ bool canceling_job_ = false;
diff --git a/electron34/patches/patch-chrome_browser_printing_printer__query.cc b/electron34/patches/patch-chrome_browser_printing_printer__query.cc
new file mode 100644
index 0000000000..6dd250ed45
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_printing_printer__query.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/printing/printer_query.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/printing/printer_query.cc
+@@ -341,7 +341,7 @@ void PrinterQuery::UpdatePrintSettings(b
+ crash_key = std::make_unique<crash_keys::ScopedPrinterInfo>(
+ printer_name, print_backend->GetPrinterDriverInfo(printer_name));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS)
++#if (BUILDFLAG(IS_BSD) || BUILDFLAG(IS_LINUX)) && BUILDFLAG(USE_CUPS)
+ PrinterBasicInfo basic_info;
+ if (print_backend->GetPrinterBasicInfo(printer_name, &basic_info) ==
+ mojom::ResultCode::kSuccess) {
+@@ -355,17 +355,19 @@ void PrinterQuery::UpdatePrintSettings(b
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS)
+ }
+
+- mojom::ResultCode result;
+ {
+ #if BUILDFLAG(IS_WIN)
+ // Blocking is needed here because Windows printer drivers are oftentimes
+ // not thread-safe and have to be accessed on the UI thread.
+ base::ScopedAllowBlocking allow_blocking;
+ #endif
+- result = printing_context_->UpdatePrintSettings(std::move(new_settings));
++ // Reset settings from previous print job
++ printing_context_->ResetSettings();
++ mojom::ResultCode result_code = printing_context_->UseDefaultSettings();
++ if (result_code == mojom::ResultCode::kSuccess)
++ result_code = printing_context_->UpdatePrintSettings(std::move(new_settings));
++ InvokeSettingsCallback(std::move(callback), result_code);
+ }
+-
+- InvokeSettingsCallback(std::move(callback), result);
+ }
+
+ #if BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-chrome_browser_process__singleton.h b/electron34/patches/patch-chrome_browser_process__singleton.h
new file mode 100644
index 0000000000..aa75bd03a1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_process__singleton.h
@@ -0,0 +1,56 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/process_singleton.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/process_singleton.h
+@@ -18,6 +18,8 @@
+ #include "base/functional/callback.h"
+ #include "base/memory/ref_counted.h"
+ #include "base/process/process.h"
++#include "base/containers/span.h"
++#include "base/memory/raw_span.h"
+ #include "ui/gfx/native_widget_types.h"
+
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+@@ -100,10 +102,20 @@ class ProcessSingleton {
+ // should handle it (i.e., because the current process is shutting down).
+ using NotificationCallback =
+ base::RepeatingCallback<bool(base::CommandLine command_line,
+- const base::FilePath& current_directory)>;
++ const base::FilePath& current_directory,
++ const std::vector<uint8_t> additional_data)>;
+
++#if BUILDFLAG(IS_WIN)
++ ProcessSingleton(const std::string& program_name,
++ const base::FilePath& user_data_dir,
++ const base::raw_span<const uint8_t> additional_data,
++ bool is_sandboxed,
++ const NotificationCallback& notification_callback);
++#else
+ ProcessSingleton(const base::FilePath& user_data_dir,
++ const base::raw_span<const uint8_t> additional_data,
+ const NotificationCallback& notification_callback);
++#endif
+
+ ProcessSingleton(const ProcessSingleton&) = delete;
+ ProcessSingleton& operator=(const ProcessSingleton&) = delete;
+@@ -171,11 +183,16 @@ class ProcessSingleton {
+ #endif
+
+ private:
++ // A callback to run when the first instance receives data from the second.
+ NotificationCallback notification_callback_; // Handler for notifications.
++ // Custom data to pass to the other instance during notify.
++ base::raw_span<const uint8_t> additional_data_;
+
+ #if BUILDFLAG(IS_WIN)
+ bool EscapeVirtualization(const base::FilePath& user_data_dir);
+
++ std::string program_name_; // Used for mutexName.
++ bool is_app_sandboxed_; // Whether the Electron app is sandboxed.
+ HWND remote_window_; // The HWND_MESSAGE of another browser.
+ base::win::MessageWindow window_; // The message-only window.
+ bool is_virtualized_; // Stuck inside Microsoft Softricity VM environment.
diff --git a/electron34/patches/patch-chrome_browser_process__singleton__posix.cc b/electron34/patches/patch-chrome_browser_process__singleton__posix.cc
new file mode 100644
index 0000000000..9ce7e636c1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_process__singleton__posix.cc
@@ -0,0 +1,239 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/process_singleton_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/process_singleton_posix.cc
+@@ -59,6 +59,7 @@
+ #include <memory>
+ #include <set>
+ #include <string>
++#include <tuple>
+ #include <type_traits>
+
+ #include "base/base_paths.h"
+@@ -86,6 +87,7 @@
+ #include "base/strings/utf_string_conversions.h"
+ #include "base/task/sequenced_task_runner_helpers.h"
+ #include "base/task/single_thread_task_runner.h"
++#include "base/threading/thread_restrictions.h"
+ #include "base/threading/platform_thread.h"
+ #include "base/time/time.h"
+ #include "base/timer/timer.h"
+@@ -102,7 +104,7 @@
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/resource/scoped_startup_resource_bundle.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if 0
+ #include "chrome/browser/ui/process_singleton_dialog_linux.h"
+ #endif
+
+@@ -348,6 +350,8 @@ bool SymlinkPath(const base::FilePath& t
+ bool DisplayProfileInUseError(const base::FilePath& lock_path,
+ const std::string& hostname,
+ int pid) {
++ return true;
++#if 0
+ // Ensure there is an instance of ResourceBundle that is initialized for
+ // localized string resource accesses.
+ ui::ScopedStartupResourceBundle ensure_startup_resource_bundle;
+@@ -360,7 +364,7 @@ bool DisplayProfileInUseError(const base
+ if (g_disable_prompt)
+ return g_user_opted_unlock_in_use_profile;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::u16string relaunch_button_text =
+ l10n_util::GetStringUTF16(IDS_PROFILE_IN_USE_LINUX_RELAUNCH);
+ return ShowProcessSingletonDialog(error, relaunch_button_text);
+@@ -370,6 +374,8 @@ bool DisplayProfileInUseError(const base
+ #endif
+
+ NOTREACHED();
++ return false;
++#endif
+ }
+
+ bool IsChromeProcess(pid_t pid) {
+@@ -382,6 +388,21 @@ bool IsChromeProcess(pid_t pid) {
+ base::FilePath(chrome::kBrowserProcessExecutableName));
+ }
+
++bool IsAppSandboxed() {
++#if BUILDFLAG(IS_MAC)
++ // NB: There is no sane API for this, we have to just guess by
++ // reading tea leaves
++ base::FilePath home_dir;
++ if (!base::PathService::Get(base::DIR_HOME, &home_dir)) {
++ return false;
++ }
++
++ return home_dir.value().find("Library/Containers") != std::string::npos;
++#else
++ return false;
++#endif // BUILDFLAG(IS_MAC)
++}
++
+ // A helper class to hold onto a socket.
+ class ScopedSocket {
+ public:
+@@ -594,6 +615,7 @@ class ProcessSingleton::LinuxWatcher
+ // |reader| is for sending back ACK message.
+ void HandleMessage(const std::string& current_dir,
+ const std::vector<std::string>& argv,
++ const std::vector<uint8_t> additional_data,
+ SocketReader* reader);
+
+ // Called when the ProcessSingleton that owns this class is about to be
+@@ -653,13 +675,17 @@ void ProcessSingleton::LinuxWatcher::Sta
+ }
+
+ void ProcessSingleton::LinuxWatcher::HandleMessage(
+- const std::string& current_dir, const std::vector<std::string>& argv,
++ const std::string& current_dir,
++ const std::vector<std::string>& argv,
++ const std::vector<uint8_t> additional_data,
+ SocketReader* reader) {
+ DCHECK(ui_task_runner_->BelongsToCurrentThread());
+ DCHECK(reader);
+
+ if (parent_ && parent_->notification_callback_.Run(
+- base::CommandLine(argv), base::FilePath(current_dir))) {
++ base::CommandLine(argv),
++ base::FilePath(current_dir),
++ std::move(additional_data))) {
+ // Send back "ACK" message to prevent the client process from starting up.
+ reader->FinishWithACK(kACKToken, std::size(kACKToken) - 1);
+ } else {
+@@ -707,7 +733,8 @@ void ProcessSingleton::LinuxWatcher::Soc
+ }
+ }
+
+- // Validate the message. The shortest message is kStartToken\0x\0x
++ // Validate the message. The shortest message kStartToken\0\00
++ // The shortest message with additional data is kStartToken\0\00\00\0.
+ const size_t kMinMessageLength = std::size(kStartToken) + 4;
+ if (bytes_read_ < kMinMessageLength) {
+ buf_[bytes_read_] = 0;
+@@ -737,10 +764,28 @@ void ProcessSingleton::LinuxWatcher::Soc
+ tokens.erase(tokens.begin());
+ tokens.erase(tokens.begin());
+
++ size_t num_args;
++ base::StringToSizeT(tokens[0], &num_args);
++ std::vector<std::string> command_line(tokens.begin() + 1, tokens.begin() + 1 + num_args);
++
++ std::vector<uint8_t> additional_data;
++ if (tokens.size() >= 3 + num_args) {
++ size_t additional_data_size;
++ base::StringToSizeT(tokens[1 + num_args], &additional_data_size);
++ std::string remaining_args = base::JoinString(
++ base::make_span(tokens.begin() + 2 + num_args, tokens.end()),
++ std::string(1, kTokenDelimiter));
++ const uint8_t* additional_data_bits =
++ reinterpret_cast<const uint8_t*>(remaining_args.c_str());
++ additional_data = std::vector<uint8_t>(
++ additional_data_bits, additional_data_bits + additional_data_size);
++ }
++
+ // Return to the UI thread to handle opening a new browser tab.
+ ui_task_runner_->PostTask(
+ FROM_HERE, base::BindOnce(&ProcessSingleton::LinuxWatcher::HandleMessage,
+- parent_, current_dir, tokens, this));
++ parent_, current_dir, command_line,
++ std::move(additional_data), this));
+ fd_watch_controller_.reset();
+
+ // LinuxWatcher::HandleMessage() is in charge of destroying this SocketReader
+@@ -769,8 +814,10 @@ void ProcessSingleton::LinuxWatcher::Soc
+ //
+ ProcessSingleton::ProcessSingleton(
+ const base::FilePath& user_data_dir,
++ const base::raw_span<const uint8_t> additional_data,
+ const NotificationCallback& notification_callback)
+ : notification_callback_(notification_callback),
++ additional_data_(additional_data),
+ current_pid_(base::GetCurrentProcId()) {
+ socket_path_ = user_data_dir.Append(chrome::kSingletonSocketFilename);
+ lock_path_ = user_data_dir.Append(chrome::kSingletonLockFilename);
+@@ -785,6 +832,10 @@ ProcessSingleton::~ProcessSingleton() {
+ if (watcher_) {
+ watcher_->OnEminentProcessSingletonDestruction();
+ }
++ // Manually free resources with IO explicitly allowed.
++ base::ScopedAllowBlocking allow_blocking;
++ watcher_ = nullptr;
++ std::ignore = socket_dir_.Delete();
+ }
+
+ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() {
+@@ -887,7 +938,8 @@ ProcessSingleton::NotifyResult ProcessSi
+ sizeof(socket_timeout));
+
+ // Found another process, prepare our command line
+- // format is "START\0<current dir>\0<argv[0]>\0...\0<argv[n]>".
++ // format is "START\0<current-dir>\0<n-args>\0<argv[0]>\0...\0<argv[n]>
++ // \0<additional-data-length>\0<additional-data>".
+ std::string to_send(kStartToken);
+ to_send.push_back(kTokenDelimiter);
+
+@@ -897,11 +949,21 @@ ProcessSingleton::NotifyResult ProcessSi
+ to_send.append(current_dir.value());
+
+ const std::vector<std::string>& argv = cmd_line.argv();
++ to_send.push_back(kTokenDelimiter);
++ to_send.append(base::NumberToString(argv.size()));
+ for (auto it = argv.begin(); it != argv.end(); ++it) {
+ to_send.push_back(kTokenDelimiter);
+ to_send.append(*it);
+ }
+
++ size_t data_to_send_size = additional_data_.size_bytes();
++ if (data_to_send_size) {
++ to_send.push_back(kTokenDelimiter);
++ to_send.append(base::NumberToString(data_to_send_size));
++ to_send.push_back(kTokenDelimiter);
++ to_send.append(reinterpret_cast<const char*>(additional_data_.data()), data_to_send_size);
++ }
++
+ // Send the message
+ if (!WriteToSocket(socket.fd(), to_send.data(), to_send.length())) {
+ // Try to kill the other process, because it might have been dead.
+@@ -1055,11 +1117,32 @@ bool ProcessSingleton::Create() {
+ // Create the socket file somewhere in /tmp which is usually mounted as a
+ // normal filesystem. Some network filesystems (notably AFS) are screwy and
+ // do not support Unix domain sockets.
+- if (!socket_dir_.CreateUniqueTempDir()) {
+- LOG(ERROR) << "Failed to create socket directory.";
++ base::FilePath tmp_dir;
++ if (!base::GetTempDir(&tmp_dir)) {
++ LOG(ERROR) << "Failed to get temporary directory.";
+ return false;
+ }
+
++ if (IsAppSandboxed()) {
++ // For sandboxed applications, the tmp dir could be too long to fit
++ // addr->sun_path, so we need to make it as short as possible.
++ if (!socket_dir_.Set(tmp_dir.Append("S"))) {
++ LOG(ERROR) << "Failed to set socket directory.";
++ return false;
++ }
++ } else {
++ // Create the socket file somewhere in /tmp which is usually mounted as a
++ // normal filesystem. Some network filesystems (notably AFS) are screwy and
++ // do not support Unix domain sockets.
++ // Prefer CreateUniqueTempDirUnderPath rather than CreateUniqueTempDir as
++ // the latter will calculate unique paths based on bundle ids which can
++ // increase the socket path length than what is allowed.
++ if (!socket_dir_.CreateUniqueTempDirUnderPath(tmp_dir)) {
++ LOG(ERROR) << "Failed to create socket directory.";
++ return false;
++ }
++ }
++
+ // Check that the directory was created with the correct permissions.
+ int dir_mode = 0;
+ CHECK(base::GetPosixFilePermissions(socket_dir_.GetPath(), &dir_mode) &&
diff --git a/electron34/patches/patch-chrome_browser_process__singleton__win.cc b/electron34/patches/patch-chrome_browser_process__singleton__win.cc
new file mode 100644
index 0000000000..1f7641be10
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_process__singleton__win.cc
@@ -0,0 +1,166 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/process_singleton_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/process_singleton_win.cc
+@@ -29,7 +29,9 @@
+ #include "base/win/wmi.h"
+ #include "chrome/browser/process_singleton_internal.h"
+ #include "chrome/browser/shell_integration.h"
++#if 0
+ #include "chrome/browser/ui/simple_message_box.h"
++#endif
+ #include "chrome/browser/win/chrome_process_finder.h"
+ #include "chrome/common/chrome_constants.h"
+ #include "chrome/common/chrome_paths.h"
+@@ -79,10 +81,12 @@ BOOL CALLBACK BrowserWindowEnumeration(H
+
+ bool ParseCommandLine(const COPYDATASTRUCT* cds,
+ base::CommandLine* parsed_command_line,
+- base::FilePath* current_directory) {
++ base::FilePath* current_directory,
++ std::vector<uint8_t>* parsed_additional_data) {
+ // We should have enough room for the shortest command (min_message_size)
+ // and also be a multiple of wchar_t bytes. The shortest command
+- // possible is L"START\0\0" (empty current directory and command line).
++ // possible is L"START\0\0" (empty command line, current directory,
++ // and additional data).
+ static const int min_message_size = 7;
+ if (cds->cbData < min_message_size * sizeof(wchar_t) ||
+ cds->cbData % sizeof(wchar_t) != 0) {
+@@ -132,6 +136,37 @@ bool ParseCommandLine(const COPYDATASTRU
+ const std::wstring cmd_line =
+ msg.substr(second_null + 1, third_null - second_null);
+ *parsed_command_line = base::CommandLine::FromString(cmd_line);
++
++ const std::wstring::size_type fourth_null =
++ msg.find_first_of(L'\0', third_null + 1);
++ if (fourth_null == std::wstring::npos ||
++ fourth_null == msg.length()) {
++ // No additional data was provided.
++ return true;
++ }
++
++ // Get length of the additional data.
++ const std::wstring additional_data_length_string =
++ msg.substr(third_null + 1, fourth_null - third_null);
++ size_t additional_data_length;
++ base::StringToSizeT(additional_data_length_string, &additional_data_length);
++
++ const std::wstring::size_type fifth_null =
++ msg.find_first_of(L'\0', fourth_null + 1);
++ if (fifth_null == std::wstring::npos ||
++ fifth_null == msg.length()) {
++ LOG(WARNING) << "Invalid format for start command, we need a string in 6 "
++ "parts separated by NULLs";
++ }
++
++ // Get the actual additional data.
++ const std::wstring additional_data =
++ msg.substr(fourth_null + 1, fifth_null - fourth_null);
++ const uint8_t* additional_data_bytes =
++ reinterpret_cast<const uint8_t*>(additional_data.c_str());
++ *parsed_additional_data = std::vector<uint8_t>(additional_data_bytes,
++ additional_data_bytes + additional_data_length);
++
+ return true;
+ }
+ return false;
+@@ -153,17 +188,19 @@ bool ProcessLaunchNotification(
+
+ base::CommandLine parsed_command_line(base::CommandLine::NO_PROGRAM);
+ base::FilePath current_directory;
+- if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory)) {
++ std::vector<uint8_t> additional_data;
++ if (!ParseCommandLine(cds, &parsed_command_line, ¤t_directory, &additional_data)) {
+ *result = TRUE;
+ return true;
+ }
+
+- *result = notification_callback.Run(parsed_command_line, current_directory) ?
+- TRUE : FALSE;
++ *result = notification_callback.Run(parsed_command_line,
++ current_directory, std::move(additional_data)) ? TRUE : FALSE;
+ return true;
+ }
+
+ bool DisplayShouldKillMessageBox() {
++#if 0
+ TRACE_EVENT0("startup", "ProcessSingleton:DisplayShouldKillMessageBox");
+
+ // Ensure there is an instance of ResourceBundle that is initialized for
+@@ -174,6 +211,10 @@ bool DisplayShouldKillMessageBox() {
+ NULL, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
+ l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE)) !=
+ chrome::MESSAGE_BOX_RESULT_NO;
++#endif
++ // This is called when the secondary process can't ping the primary
++ // process.
++ return false;
+ }
+
+ // Function was copied from Process::Terminate.
+@@ -256,9 +297,15 @@ bool ProcessSingleton::EscapeVirtualizat
+ }
+
+ ProcessSingleton::ProcessSingleton(
++ const std::string& program_name,
+ const base::FilePath& user_data_dir,
++ const base::raw_span<const uint8_t> additional_data,
++ bool is_app_sandboxed,
+ const NotificationCallback& notification_callback)
+ : notification_callback_(notification_callback),
++ additional_data_(additional_data),
++ program_name_(program_name),
++ is_app_sandboxed_(is_app_sandboxed),
+ is_virtualized_(false),
+ lock_file_(INVALID_HANDLE_VALUE),
+ user_data_dir_(user_data_dir),
+@@ -283,7 +330,7 @@ ProcessSingleton::NotifyResult ProcessSi
+ return PROCESS_NONE;
+ }
+
+- switch (AttemptToNotifyRunningChrome(remote_window_)) {
++ switch (AttemptToNotifyRunningChrome(remote_window_, additional_data_)) {
+ case NotifyChromeResult::NOTIFY_SUCCESS:
+ return PROCESS_NOTIFIED;
+ case NotifyChromeResult::NOTIFY_FAILED:
+@@ -381,7 +428,7 @@ ProcessSingleton::NotifyOtherProcessOrCr
+ bool ProcessSingleton::Create() {
+ TRACE_EVENT0("startup", "ProcessSingleton::Create");
+
+- static const wchar_t kMutexName[] = L"Local\\ChromeProcessSingletonStartup!";
++ std::wstring mutexName = base::UTF8ToWide("Local\\" + program_name_ + "ProcessSingletonStartup");
+
+ remote_window_ = FindRunningChromeWindow(user_data_dir_);
+ if (!remote_window_ && !EscapeVirtualization(user_data_dir_)) {
+@@ -390,7 +437,7 @@ bool ProcessSingleton::Create() {
+ // access. As documented, it's clearer to NOT request ownership on creation
+ // since it isn't guaranteed we will get it. It is better to create it
+ // without ownership and explicitly get the ownership afterward.
+- base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, kMutexName));
++ base::win::ScopedHandle only_me(::CreateMutex(NULL, FALSE, mutexName.c_str()));
+ if (!only_me.IsValid()) {
+ DPLOG(FATAL) << "CreateMutex failed";
+ return false;
+@@ -429,6 +476,17 @@ bool ProcessSingleton::Create() {
+ window_.CreateNamed(base::BindRepeating(&ProcessLaunchNotification,
+ notification_callback_),
+ user_data_dir_.value());
++
++ // When the app is sandboxed, firstly, the app should not be in
++ // admin mode, and even if it somehow is, messages from an unelevated
++ // instance should not be able to be sent to it.
++ if (!is_app_sandboxed_) {
++ // NB: Ensure that if the primary app gets started as elevated
++ // admin inadvertently, secondary windows running not as elevated
++ // will still be able to send messages.
++ ::ChangeWindowMessageFilterEx(window_.hwnd(), WM_COPYDATA, MSGFLT_ALLOW,
++ NULL);
++ }
+ CHECK(result && window_.hwnd());
+ }
+ }
diff --git a/electron34/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc b/electron34/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
new file mode 100644
index 0000000000..30eb3960c9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
@@ -0,0 +1,124 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+@@ -352,7 +352,7 @@
+ #include "chrome/browser/profiles/gaia_info_update_service_factory.h"
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/policy/messaging_layer/util/manual_test_heartbeat_event_factory.h"
+ #endif
+
+@@ -433,18 +433,18 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/device_trust/device_trust_connector_service_factory.h"
+ #include "chrome/browser/enterprise/connectors/device_trust/device_trust_service_factory.h"
+ #include "chrome/browser/enterprise/signals/user_permission_service_factory.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/idle/idle_service_factory.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/browser_switcher/browser_switcher_service_factory.h"
+ #include "chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.h"
+ #include "chrome/browser/enterprise/client_certificates/certificate_store_factory.h"
+@@ -719,7 +719,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ DiceBoundSessionCookieServiceFactory::GetInstance();
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+ #endif // BUILDFLAG(ENABLE_BOUND_SESSION_CREDENTIALS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ browser_switcher::BrowserSwitcherServiceFactory::GetInstance();
+ #endif
+ browser_sync::UserEventServiceFactory::GetInstance();
+@@ -829,7 +829,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ enterprise_connectors::ConnectorsServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ enterprise_connectors::DeviceTrustConnectorServiceFactory::GetInstance();
+ enterprise_connectors::DeviceTrustServiceFactory::GetInstance();
+ #endif
+@@ -837,25 +837,25 @@ void ChromeBrowserMainExtraPartsProfiles
+ enterprise_connectors::ExtensionInstallEventRouterFactory::GetInstance();
+ enterprise_connectors::ExtensionTelemetryEventRouterFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_connectors::LocalBinaryUploadServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ enterprise_idle::IdleServiceFactory::GetInstance();
+ #endif
+ #if !BUILDFLAG(IS_CHROMEOS)
+ enterprise_reporting::CloudProfileReportingServiceFactory::GetInstance();
+ #endif
+ enterprise_reporting::LegacyTechServiceFactory::GetInstance();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_signals::SignalsAggregatorFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ enterprise_signals::UserPermissionServiceFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ enterprise_signin::EnterpriseSigninServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(ENABLE_SESSION_SERVICE)
+@@ -975,7 +975,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #if BUILDFLAG(IS_ANDROID)
+ MerchantViewerDataManagerFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics::DesktopProfileSessionDurationsServiceFactory::GetInstance();
+ #endif
+ NavigationPredictorKeyedServiceFactory::GetInstance();
+@@ -1080,7 +1080,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #if BUILDFLAG(IS_CHROMEOS)
+ policy::PolicyCertServiceFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ policy::ProfileTokenPolicyWebSigninServiceFactory::GetInstance();
+ policy::UserPolicyOidcSigninServiceFactory::GetInstance();
+ #endif
+@@ -1127,7 +1127,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
+ ProfileStatisticsFactory::GetInstance();
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ProfileTokenWebSigninInterceptorFactory::GetInstance();
+ OidcAuthenticationSigninInterceptorFactory::GetInstance();
+ #endif
+@@ -1146,7 +1146,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #endif
+ ReduceAcceptLanguageFactory::GetInstance();
+ RendererUpdaterFactory::GetInstance();
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ reporting::ManualTestHeartbeatEventFactory::GetInstance();
+ #endif
+ #if !BUILDFLAG(IS_ANDROID)
diff --git a/electron34/patches/patch-chrome_browser_profiles_profile__impl.cc b/electron34/patches/patch-chrome_browser_profiles_profile__impl.cc
new file mode 100644
index 0000000000..c4b99b8ad7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_profiles_profile__impl.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/profiles/profile_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/profiles/profile_impl.cc
+@@ -267,6 +267,10 @@
+ #include "chrome/browser/spellchecker/spellcheck_service.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ using bookmarks::BookmarkModel;
+ using content::BrowserThread;
+ using content::DownloadManagerDelegate;
+@@ -591,7 +595,7 @@ void ProfileImpl::LoadPrefsForNormalStar
+ policy_provider = GetUserCloudPolicyManagerAsh();
+ #else // !BUILDFLAG(IS_CHROMEOS)
+ {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+ ProfileAttributesEntry* entry =
+ profile_manager->GetProfileAttributesStorage()
+@@ -901,7 +905,17 @@ void ProfileImpl::DoFinalInit(CreateMode
+ }
+
+ base::FilePath ProfileImpl::last_selected_directory() {
++#if BUILDFLAG(IS_OPENBSD)
++ // If unveil(2) is used, force the file dialog directory to something we
++ // know is available.
++ auto* sandbox = sandbox::policy::SandboxLinux::GetInstance();
++ if (sandbox->unveil_initialized())
++ return GetPrefs()->GetFilePath(prefs::kDownloadDefaultDirectory);
++ else
++ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#else
+ return GetPrefs()->GetFilePath(prefs::kSelectFileLastDirectory);
++#endif
+ }
+
+ void ProfileImpl::set_last_selected_directory(const base::FilePath& path) {
diff --git a/electron34/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc b/electron34/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc
new file mode 100644
index 0000000000..c4a1b91b7e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/profiles/profile_keyed_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/profiles/profile_keyed_service_factory.cc
+@@ -22,6 +22,9 @@ ProfileKeyedServiceFactory::~ProfileKeye
+
+ content::BrowserContext* ProfileKeyedServiceFactory::GetBrowserContextToUse(
+ content::BrowserContext* context) const {
++ return context;
++#if 0
+ Profile* profile = Profile::FromBrowserContext(context);
+ return profile_selections_.ApplyProfileSelection(profile);
++#endif
+ }
diff --git a/electron34/patches/patch-chrome_browser_profiles_profile__selections.cc b/electron34/patches/patch-chrome_browser_profiles_profile__selections.cc
new file mode 100644
index 0000000000..bd16613635
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_profiles_profile__selections.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/profiles/profile_selections.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/profiles/profile_selections.cc
+@@ -13,6 +13,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ bool AreKeyedServicesDisabledForProfileByDefault(const Profile* profile) {
++#if 0
+ // By default disable all services for System Profile.
+ // Even though having no services is also the default value for Guest Profile,
+ // this is not really the case in practice because a lot of Service Factories
+@@ -20,7 +21,7 @@ bool AreKeyedServicesDisabledForProfileB
+ if (profile && profile->IsSystemProfile()) {
+ return true;
+ }
+-
++#endif
+ return false;
+ }
+
+@@ -132,6 +133,7 @@ ProfileSelection ProfileSelections::GetP
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
++#if 0
+ // Treat other off the record profiles as Incognito (primary otr) Profiles.
+ if (profile->IsRegularProfile() || profile->IsIncognitoProfile() ||
+ profile_metrics::GetBrowserProfileType(profile) ==
+@@ -148,6 +150,8 @@ ProfileSelection ProfileSelections::GetP
+ }
+
+ NOTREACHED();
++#endif
++ return ProfileSelection::kNone;
+ }
+
+ void ProfileSelections::SetProfileSelectionForRegular(
diff --git a/electron34/patches/patch-chrome_browser_profiles_profiles__state.cc b/electron34/patches/patch-chrome_browser_profiles_profiles__state.cc
new file mode 100644
index 0000000000..adfa1c3377
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_profiles_profiles__state.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/profiles/profiles_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/profiles/profiles_state.cc
+@@ -190,7 +190,7 @@ bool IsGuestModeRequested(const base::Co
+ PrefService* local_state,
+ bool show_warning) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ DCHECK(local_state);
+
+ // Check if guest mode enforcement commandline switch or policy are provided.
+@@ -226,7 +226,7 @@ bool IsGuestModeEnabled() {
+ return false;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // If there are any supervised profiles, disable guest mode.
+ if (base::FeatureList::IsEnabled(
+ supervised_user::kHideGuestModeForSupervisedUsers) &&
+@@ -245,7 +245,7 @@ bool IsGuestModeEnabled() {
+ }
+
+ bool IsGuestModeEnabled(const Profile& profile) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(
+ supervised_user::kHideGuestModeForSupervisedUsers)) {
+ ProfileAttributesEntry* profile_attributes =
diff --git a/electron34/patches/patch-chrome_browser_renderer__preferences__util.cc b/electron34/patches/patch-chrome_browser_renderer__preferences__util.cc
new file mode 100644
index 0000000000..ce6db803fe
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_renderer__preferences__util.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/renderer_preferences_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/renderer_preferences_util.cc
+@@ -38,7 +38,7 @@
+ #include "ui/views/controls/textfield/textfield.h"
+ #endif
+
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ #include "chrome/browser/themes/theme_service.h"
+ #include "chrome/browser/themes/theme_service_factory.h"
+ #include "ui/linux/linux_ui.h"
+@@ -150,7 +150,7 @@ void UpdateFromSystemSettings(blink::Ren
+ prefs->caret_blink_interval = views::Textfield::GetCaretBlinkInterval();
+ #endif
+
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ if (linux_ui_theme) {
+ if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) {
+@@ -173,7 +173,7 @@ void UpdateFromSystemSettings(blink::Ren
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ content::UpdateFontRendererPreferencesFromSystemSettings(prefs);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts b/electron34/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
new file mode 100644
index 0000000000..32fcd16549
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
@@ -0,0 +1,130 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/resources/pdf/pdf_viewer.ts.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/resources/pdf/pdf_viewer.ts
+@@ -1086,28 +1086,27 @@ export class PdfViewerElement extends Pd
+ dataArray = [result.dataToSave];
+ }
+
+- const blob = new Blob(dataArray);
+ const fileName = this.attachments_[index].name;
+- chrome.fileSystem.chooseEntry(
+- {type: 'saveFile', suggestedName: fileName},
+- (entry?: FileSystemFileEntry) => {
+- if (chrome.runtime.lastError) {
+- if (chrome.runtime.lastError.message !== 'User cancelled') {
+- console.error(
+- 'chrome.fileSystem.chooseEntry failed: ' +
+- chrome.runtime.lastError.message);
+- }
+- return;
+- }
+- entry!.createWriter((writer: FileWriter) => {
+- writer.write(blob);
+- // <if expr="enable_ink">
+- // Unblock closing the window now that the user has saved
+- // successfully.
+- this.setShowBeforeUnloadDialog_(false);
+- // </if>
+- });
+- });
++ const blob = new Blob(dataArray);
++
++ try {
++ const fileHandle = await window.showSaveFilePicker({
++ suggestedName: fileName,
++ });
++
++ const writable = await fileHandle.createWritable();
++ await writable.write(blob);
++ await writable.close();
++ // <if expr="enable_ink">
++ // Unblock closing the window now that the user has saved
++ // successfully.
++ this.setShowBeforeUnloadDialog_(false);
++ // </if>
++ } catch (error: any) {
++ if (error.name !== 'AbortError') {
++ console.error('window.showSaveFilePicker failed: ' + error);
++ }
++ }
+ }
+
+ /**
+@@ -1298,36 +1297,33 @@ export class PdfViewerElement extends Pd
+ fileName = fileName + '.pdf';
+ }
+
+- // Create blob before callback to avoid race condition.
+ const blob = new Blob([result.dataToSave], {type: 'application/pdf'});
+- chrome.fileSystem.chooseEntry(
+- {
+- type: 'saveFile',
+- accepts: [{description: '*.pdf', extensions: ['pdf']}],
+- suggestedName: fileName,
+- },
+- (entry?: FileSystemFileEntry) => {
+- if (chrome.runtime.lastError) {
+- if (chrome.runtime.lastError.message !== 'User cancelled') {
+- console.error(
+- 'chrome.fileSystem.chooseEntry failed: ' +
+- chrome.runtime.lastError.message);
+- }
+- return;
+- }
+- entry!.createWriter((writer: FileWriter) => {
+- writer.write(blob);
+- // <if expr="enable_ink or enable_pdf_ink2">
+- // Unblock closing the window now that the user has saved
+- // successfully.
+- this.setShowBeforeUnloadDialog_(false);
+- // </if>
+- // <if expr="enable_pdf_ink2">
+- this.hasSavedEdits_ =
+- this.hasSavedEdits_ || requestType === SaveRequestType.EDITED;
+- // </if>
+- });
+- });
++ try {
++ const fileHandle = await window.showSaveFilePicker({
++ suggestedName: fileName,
++ types: [{
++ description: 'PDF Files',
++ accept: { 'application/pdf': ['.pdf'] },
++ }],
++ });
++
++ const writable = await fileHandle.createWritable();
++ await writable.write(blob);
++ await writable.close();
++ // <if expr="enable_ink or enable_pdf_ink2">
++ // Unblock closing the window now that the user has saved
++ // successfully.
++ this.setShowBeforeUnloadDialog_(false);
++ // </if>
++ // <if expr="enable_pdf_ink2">
++ this.hasSavedEdits_ =
++ this.hasSavedEdits_ || requestType === SaveRequestType.EDITED;
++ // </if>
++ } catch (error: any) {
++ if (error.name !== 'AbortError') {
++ console.error('window.showSaveFilePicker failed: ' + error);
++ }
++ }
+
+ // <if expr="enable_pdf_ink2">
+ // Ink2 doesn't need to exit annotation mode after save.
+@@ -1474,6 +1470,9 @@ declare global {
+ interface HTMLElementTagNameMap {
+ 'pdf-viewer': PdfViewerElement;
+ }
++ interface Window {
++ showSaveFilePicker(opts: unknown): Promise<FileSystemFileHandle>;
++ }
+ }
+
+ customElements.define(PdfViewerElement.is, PdfViewerElement);
diff --git a/electron34/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css b/electron34/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
new file mode 100644
index 0000000000..da794ea319
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/resources/settings/autofill_page/passwords_shared.css.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/resources/settings/autofill_page/passwords_shared.css
+@@ -100,7 +100,7 @@ cr-input.password-input::part(input),
+ * necessary to prevent Chrome from using the operating system's font
+ * instead of the Material Design font.
+ * TODO(dbeam): why not font: inherit? */
+-<if expr="is_linux or is_chromeos">
++<if expr="is_posix or is_chromeos">
+ font-family: 'DejaVu Sans Mono', monospace;
+ </if>
+ <if expr="is_win">
diff --git a/electron34/patches/patch-chrome_browser_resources_signin_signin__shared.css b/electron34/patches/patch-chrome_browser_resources_signin_signin__shared.css
new file mode 100644
index 0000000000..412da3caff
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_resources_signin_signin__shared.css
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/resources/signin/signin_shared.css.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/resources/signin/signin_shared.css
+@@ -54,7 +54,7 @@ a {
+ border-radius: var(--scrollbar-width);
+ }
+
+-<if expr="is_macosx or is_linux or is_chromeos">
++<if expr="is_macosx or is_posix or is_chromeos">
+ .action-container {
+ flex-flow: row-reverse;
+ justify-content: flex-start;
diff --git a/electron34/patches/patch-chrome_browser_safe__browsing_chrome__password__protection__service.cc b/electron34/patches/patch-chrome_browser_safe__browsing_chrome__password__protection__service.cc
new file mode 100644
index 0000000000..ada603f727
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_safe__browsing_chrome__password__protection__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/safe_browsing/chrome_password_protection_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/safe_browsing/chrome_password_protection_service.cc
+@@ -1248,7 +1248,7 @@ std::string ChromePasswordProtectionServ
+ ReusedPasswordAccountType password_type) const {
+ if (base::FeatureList::IsEnabled(
+ safe_browsing::kEnterprisePasswordReuseUiRefresh)) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return GetPrefs()->GetString(prefs::kEnterpriseCustomLabel);
+ #else
+ return std::string();
diff --git a/electron34/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc b/electron34/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
new file mode 100644
index 0000000000..e84ebc3954
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.cc
+@@ -18,7 +18,7 @@
+ #include "net/base/url_util.h"
+ #include "third_party/abseil-cpp/absl/types/variant.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/connectors/analysis/local_binary_upload_service_factory.h"
+ #endif
+
+@@ -437,7 +437,7 @@ BinaryUploadService* BinaryUploadService
+ Profile* profile,
+ const enterprise_connectors::AnalysisSettings& settings) {
+ // Local content analysis is supported only on desktop platforms.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (settings.cloud_or_local_settings.is_cloud_analysis()) {
+ return CloudBinaryUploadServiceFactory::GetForProfile(profile);
+ } else {
diff --git a/electron34/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc b/electron34/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
new file mode 100644
index 0000000000..16b1abb376
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+@@ -696,7 +696,7 @@ void IncidentReportingService::OnEnviron
+
+ // Process::Current().CreationTime() is missing on some platforms.
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::TimeDelta uptime =
+ first_incident_time_ - base::Process::Current().CreationTime();
+ environment_data->mutable_process()->set_uptime_msec(uptime.InMilliseconds());
diff --git a/electron34/patches/patch-chrome_browser_safe__browsing_safe__browsing__service.cc b/electron34/patches/patch-chrome_browser_safe__browsing_safe__browsing__service.cc
new file mode 100644
index 0000000000..7cb3dfb9bb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_safe__browsing_safe__browsing__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/safe_browsing/safe_browsing_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/safe_browsing/safe_browsing_service.cc
+@@ -83,7 +83,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/browser_window/public/browser_window_features.h"
+ #include "chrome/browser/ui/toasts/api/toast_id.h"
+@@ -554,7 +554,7 @@ base::CallbackListSubscription SafeBrows
+ void SafeBrowsingServiceImpl::EnhancedProtectionPrefChange(Profile* profile) {
+ RefreshState();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (!base::FeatureList::IsEnabled(safe_browsing::kEsbAsASyncedSetting) ||
+ !profile) {
+ return;
diff --git a/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc b/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
new file mode 100644
index 0000000000..0ca017e9c3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/screen_ai/screen_ai_install_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/screen_ai/screen_ai_install_state.cc
+@@ -16,7 +16,7 @@
+ #include "services/screen_ai/public/cpp/utilities.h"
+ #include "ui/accessibility/accessibility_features.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/cpu.h"
+ #include "base/files/file_util.h"
+ #endif
+@@ -26,7 +26,7 @@ const int kScreenAICleanUpDelayInDays =
+ const char kMinExpectedVersion[] = "124.2";
+
+ bool IsDeviceCompatible() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // Check if the CPU has the required instruction set to run the Screen AI
+ // library.
diff --git a/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc b/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
new file mode 100644
index 0000000000..387c635549
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/screen_ai/screen_ai_service_router.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/screen_ai/screen_ai_service_router.cc
+@@ -318,7 +318,7 @@ void ScreenAIServiceRouter::LaunchIfNotR
+ base::FilePath binary_path = state_instance->get_component_binary_path();
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries = {binary_path};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::vector<std::string> extra_switches = {
+ base::StringPrintf("--%s=%s", screen_ai::GetBinaryPathSwitch(),
+ binary_path.MaybeAsASCII().c_str())};
+@@ -332,7 +332,7 @@ void ScreenAIServiceRouter::LaunchIfNotR
+ .WithPreloadedLibraries(
+ preload_libraries,
+ content::ServiceProcessHostPreloadLibraries::GetPassKey())
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ .WithExtraCommandLineSwitches(extra_switches)
+ #endif // BUILDFLAG(IS_WIN)
+ .Pass());
diff --git a/electron34/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc b/electron34/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
new file mode 100644
index 0000000000..36b059a87c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/send_tab_to_self/receiving_ui_handler_registry.cc
+@@ -15,7 +15,7 @@
+ #include "components/send_tab_to_self/features.h"
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/send_tab_to_self/desktop_notification_handler.h"
+ #include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_icon_controller.h"
+ #endif
+@@ -47,7 +47,7 @@ SendTabToSelfToolbarIconController*
+ ReceivingUiHandlerRegistry::GetToolbarButtonControllerForProfile(
+ Profile* profile) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ for (const std::unique_ptr<ReceivingUiHandler>& handler :
+ applicable_handlers_) {
+ auto* button_controller =
diff --git a/electron34/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc b/electron34/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
new file mode 100644
index 0000000000..f49a12bf04
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/send_tab_to_self/send_tab_to_self_client_service.cc
+@@ -16,7 +16,7 @@
+ #include "components/send_tab_to_self/send_tab_to_self_model.h"
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/send_tab_to_self/send_tab_to_self_toolbar_icon_controller.h"
+ #endif
+
+@@ -50,7 +50,7 @@ void SendTabToSelfClientService::Entries
+ const std::vector<const SendTabToSelfEntry*>& new_entries) {
+ for (const std::unique_ptr<ReceivingUiHandler>& handler : GetHandlers()) {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Only respond to notifications corresponding to this service's profile
+ // for these OSes; mobile does not have a Profile.
+ // Cast note: on desktop, handlers are guaranteed to be the derived class
diff --git a/electron34/patches/patch-chrome_browser_sessions_session__restore.cc b/electron34/patches/patch-chrome_browser_sessions_session__restore.cc
new file mode 100644
index 0000000000..0241f3a878
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_sessions_session__restore.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/sessions/session_restore.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/sessions/session_restore.cc
+@@ -102,7 +102,7 @@
+ #include "chrome/browser/web_applications/web_app_registrar.h"
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/whats_new/whats_new_fetcher.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+@@ -1138,7 +1138,7 @@ class SessionRestoreImpl : public Browse
+ bool is_first_tab = true;
+ for (const auto& startup_tab : startup_tabs) {
+ const GURL& url = startup_tab.url;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (url == whats_new::GetWebUIStartupURL()) {
+ whats_new::StartWhatsNewFetch(browser);
+ continue;
diff --git a/electron34/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc b/electron34/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
new file mode 100644
index 0000000000..e1dfddc6ce
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/sharing/sharing_handler_registry_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/sharing/sharing_handler_registry_impl.cc
+@@ -22,7 +22,7 @@
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/sharing/shared_clipboard/remote_copy_message_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || (BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_LACROS)) BUILDFLAG(IS_CHROMEOS)
+@@ -74,7 +74,7 @@ SharingHandlerRegistryImpl::SharingHandl
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (sharing_device_registration->IsRemoteCopySupported()) {
+ AddSharingHandler(
+ std::make_unique<RemoteCopyMessageHandler>(profile),
diff --git a/electron34/patches/patch-chrome_browser_shortcuts_icon__badging.cc b/electron34/patches/patch-chrome_browser_shortcuts_icon__badging.cc
new file mode 100644
index 0000000000..402b86c4b9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_shortcuts_icon__badging.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/shortcuts/icon_badging.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/shortcuts/icon_badging.cc
+@@ -59,7 +59,7 @@ enum class BadgeSize {
+ constexpr ShortcutSize kSizesNeededForShortcutCreation[] = {
+ ShortcutSize::k16, ShortcutSize::k32, ShortcutSize::k128,
+ ShortcutSize::k256, ShortcutSize::k512};
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr ShortcutSize kSizesNeededForShortcutCreation[] = {ShortcutSize::k32,
+ ShortcutSize::k128};
+ #elif BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.cc b/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.cc
new file mode 100644
index 0000000000..8c0d3ccb58
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/signin/accounts_policy_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/signin/accounts_policy_manager.cc
+@@ -39,7 +39,7 @@
+ #include "chrome/browser/ui/webui/profile_helper.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/policy/core/common/features.h"
+ #include "components/signin/public/identity_manager/accounts_mutator.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -207,7 +207,7 @@ void AccountsPolicyManager::Initialize()
+ &AccountsPolicyManager::OnGoogleServicesUsernamePatternChanged,
+ weak_pointer_factory_.GetWeakPtr()));
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* identity_manager = IdentityManagerFactory::GetForProfile(profile_);
+ identity_manager_observation_.Observe(identity_manager);
+ profile_pref_change_registrar_.Init(profile_->GetPrefs());
+@@ -222,7 +222,7 @@ void AccountsPolicyManager::Initialize()
+ }
+
+ void AccountsPolicyManager::Shutdown() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ profile_pref_change_registrar_.RemoveAll();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ local_state_pref_registrar_.RemoveAll();
+@@ -339,7 +339,7 @@ void AccountsPolicyManager::OnUserConfir
+ }
+ #endif // defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void AccountsPolicyManager::OnRefreshTokensLoaded() {
+ RemoveUnallowedAccounts();
+ identity_manager_observation_.Reset();
diff --git a/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.h b/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.h
new file mode 100644
index 0000000000..f38f712809
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_signin_accounts__policy__manager.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/signin/accounts_policy_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/signin/accounts_policy_manager.h
+@@ -13,7 +13,7 @@
+ #include "components/signin/public/base/signin_metrics.h"
+ #include "components/signin/public/identity_manager/identity_manager.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/scoped_observation.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+@@ -64,7 +64,7 @@ class AccountsPolicyManager : public Key
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void RemoveUnallowedAccounts();
+
+ // IdentityManager::Observer implementation.
+@@ -85,7 +85,7 @@ class AccountsPolicyManager : public Key
+ bool hide_ui_for_testing_ = false;
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<signin::IdentityManager,
+ signin::IdentityManager::Observer>
+ identity_manager_observation_{this};
diff --git a/electron34/patches/patch-chrome_browser_signin_signin__util.cc b/electron34/patches/patch-chrome_browser_signin_signin__util.cc
new file mode 100644
index 0000000000..5f9127b3c5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_signin_signin__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/signin/signin_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/signin/signin_util.cc
+@@ -81,7 +81,7 @@ CookiesMover::CookiesMover(base::WeakPtr
+ CookiesMover::~CookiesMover() = default;
+
+ void CookiesMover::StartMovingCookies() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ bool allow_cookies_to_be_moved = base::FeatureList::IsEnabled(
+ profile_management::features::kThirdPartyProfileManagement);
+ #else
diff --git a/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc
new file mode 100644
index 0000000000..b16b51c0c3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc
+@@ -14,6 +14,7 @@
+ #include "base/functional/bind.h"
+ #include "base/lazy_instance.h"
+ #include "base/location.h"
++#include "base/no_destructor.h"
+ #include "base/notreached.h"
+ #include "base/observer_list.h"
+ #include "base/path_service.h"
+@@ -50,6 +51,8 @@ namespace {
+ base::LazyInstance<GURL>::Leaky g_download_url_for_testing =
+ LAZY_INSTANCE_INITIALIZER;
+
++base::NoDestructor<GURL> g_base_download_url_override;
++
+ // Close the file.
+ void CloseDictionary(base::File file) {
+ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
+@@ -265,6 +268,10 @@ void SpellcheckHunspellDictionary::SetDo
+ g_download_url_for_testing.Get() = url;
+ }
+
++void SpellcheckHunspellDictionary::SetBaseDownloadURL(const GURL url) {
++ *g_base_download_url_override = url;
++}
++
+ GURL SpellcheckHunspellDictionary::GetDictionaryURL() {
+ if (g_download_url_for_testing.Get() != GURL())
+ return g_download_url_for_testing.Get();
+@@ -272,6 +279,9 @@ GURL SpellcheckHunspellDictionary::GetDi
+ std::string bdict_file = dictionary_file_.path.BaseName().MaybeAsASCII();
+ DCHECK(!bdict_file.empty());
+
++ if (*g_base_download_url_override != GURL())
++ return GURL(g_base_download_url_override->spec() + base::ToLowerASCII(bdict_file));
++
+ static const char kDownloadServerUrl[] =
+ "https://redirector.gvt1.com/edgedl/chrome/dict/";
+
diff --git a/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h
new file mode 100644
index 0000000000..a9e483c7a1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h
+@@ -96,6 +96,8 @@ class SpellcheckHunspellDictionary : pub
+ // Tests use this method to set a custom URL for downloading dictionaries.
+ static void SetDownloadURLForTesting(const GURL url);
+
++ static void SetBaseDownloadURL(const GURL url);
++
+ private:
+ // Dictionary download status.
+ enum DownloadStatus {
diff --git a/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc
new file mode 100644
index 0000000000..3f96cca430
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/spellchecker/spellcheck_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/spellchecker/spellcheck_service.cc
+@@ -21,8 +21,10 @@
+ #include "base/values.h"
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
++#if 0
+ #include "chrome/browser/profiles/profile.h"
+ #include "chrome/browser/profiles/profiles_state.h"
++#endif
+ #include "chrome/browser/spellchecker/spellcheck_factory.h"
+ #include "chrome/browser/spellchecker/spellcheck_hunspell_dictionary.h"
+ #include "components/language/core/browser/pref_names.h"
+@@ -67,7 +69,10 @@ SpellcheckService::SpellCheckerBinder& G
+ // Only record spelling-configuration metrics for profiles in which the user
+ // can configure spelling.
+ bool RecordSpellingConfigurationMetrics(content::BrowserContext* context) {
++#if 0
+ return profiles::IsRegularUserProfile(Profile::FromBrowserContext(context));
++#endif
++ return true;
+ }
+
+ } // namespace
+@@ -478,6 +483,8 @@ void SpellcheckService::LoadDictionaries
+ std::make_unique<SpellcheckHunspellDictionary>(
+ dictionary, platform_spellcheck_language, context_, this));
+ hunspell_dictionaries_.back()->AddObserver(this);
++ if (hunspell_observer_)
++ hunspell_dictionaries_.back()->AddObserver(hunspell_observer_);
+ hunspell_dictionaries_.back()->Load();
+ }
+
+@@ -532,6 +539,20 @@ bool SpellcheckService::IsSpellcheckEnab
+ (!hunspell_dictionaries_.empty() || enable_if_uninitialized);
+ }
+
++void SpellcheckService::SetHunspellObserver(SpellcheckHunspellDictionary::Observer* observer) {
++ if (hunspell_observer_) {
++ for (auto& dict : hunspell_dictionaries_) {
++ dict->RemoveObserver(hunspell_observer_);
++ }
++ }
++ if (observer) {
++ for (auto& dict : hunspell_dictionaries_) {
++ dict->AddObserver(observer);
++ }
++ }
++ hunspell_observer_ = observer;
++}
++
+ void SpellcheckService::OnRenderProcessHostCreated(
+ content::RenderProcessHost* host) {
+ InitForRenderer(host);
diff --git a/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.h b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.h
new file mode 100644
index 0000000000..fa68420622
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_spellchecker_spellcheck__service.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/spellchecker/spellcheck_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/spellchecker/spellcheck_service.h
+@@ -135,6 +135,8 @@ class SpellcheckService : public KeyedSe
+ // dictionaries available.
+ bool IsSpellcheckEnabled() const;
+
++ void SetHunspellObserver(SpellcheckHunspellDictionary::Observer* observer);
++
+ // content::RenderProcessHostCreationObserver implementation.
+ void OnRenderProcessHostCreated(content::RenderProcessHost* host) override;
+
+@@ -299,6 +301,8 @@ class SpellcheckService : public KeyedSe
+ // A pointer to the BrowserContext which this service refers to.
+ raw_ptr<content::BrowserContext> context_;
+
++ raw_ptr<SpellcheckHunspellDictionary::Observer> hunspell_observer_ = nullptr;
++
+ std::unique_ptr<SpellCheckHostMetrics> metrics_;
+
+ std::unique_ptr<SpellcheckCustomDictionary> custom_dictionary_;
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_classify__url__navigation__throttle.cc b/electron34/patches/patch-chrome_browser_supervised__user_classify__url__navigation__throttle.cc
new file mode 100644
index 0000000000..fd09027767
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_classify__url__navigation__throttle.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/classify_url_navigation_throttle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/classify_url_navigation_throttle.cc
+@@ -220,7 +220,7 @@ void ClassifyUrlNavigationThrottle::OnIn
+ case SupervisedUserNavigationThrottle::kCancelWithInterstitial: {
+ CHECK(navigation_handle());
+ // LINT.IfChange(cancel_with_interstitial)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (ShouldShowReAuthInterstitial(*navigation_handle(), is_main_frame)) {
+ // Show the re-authentication interstitial if the user signed out of
+ // the content area, as parent's approval requires authentication.
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.cc
new file mode 100644
index 0000000000..02e82e2e7d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_browser_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_browser_utils.cc
+@@ -40,7 +40,7 @@
+ #include "chrome/browser/ash/profiles/profile_helper.h"
+ #include "components/user_manager/user.h"
+ #include "components/user_manager/user_type.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/supervised_user_verification_controller_client.h"
+ #include "chrome/browser/supervised_user/supervised_user_verification_page_blocked_sites.h"
+ #include "chrome/browser/supervised_user/supervised_user_verification_page_youtube.h"
+@@ -158,7 +158,7 @@ void AssertChildStatusOfTheUser(Profile*
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ std::string CreateReauthenticationInterstitialForYouTube(
+ content::NavigationHandle& navigation_handle) {
+ content::WebContents* web_contents = navigation_handle.GetWebContents();
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.h b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.h
new file mode 100644
index 0000000000..5dd03c4297
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__browser__utils.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_browser_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_browser_utils.h
+@@ -52,7 +52,7 @@ std::string GetAccountGivenName(Profile&
+ // of the user.
+ void AssertChildStatusOfTheUser(Profile* profile, bool is_child);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Returns the html content of the reauthentication interstitial for blocked
+ // sites. This interstitial is associated with the given NavigationHandle.
+ std::string CreateReauthenticationInterstitialForBlockedSites(
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
new file mode 100644
index 0000000000..730cdda623
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.cc
+@@ -194,7 +194,7 @@ void SupervisedUserExtensionsDelegateImp
+ return;
+ }
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ CHECK(contents.value());
+ content::WebContents* web_contents = contents.value().get();
+ if (CanInstallExtensions()) {
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
new file mode 100644
index 0000000000..64b8c73adc
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_extensions_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.cc
+@@ -353,7 +353,7 @@ void SupervisedUserExtensionsManager::
+ ActivateManagementPolicyAndUpdateRegistration() {
+ SetActiveForSupervisedUsers();
+ UpdateManagementPolicyRegistration();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MaybeMarkExtensionsLocallyParentApproved();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+ }
+@@ -471,7 +471,7 @@ bool SupervisedUserExtensionsManager::Sh
+ return false;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SupervisedUserExtensionsManager::
+ MaybeMarkExtensionsLocallyParentApproved() {
+ supervised_user::LocallyParentApprovedExtensionsMigrationState
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
new file mode 100644
index 0000000000..06116ff69c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_extensions_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.h
+@@ -153,7 +153,7 @@ class SupervisedUserExtensionsManager :
+ // launched.
+ bool ShouldBlockExtension(const std::string& extension_id) const;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Triggers an one-time migration of the present extensions as parent-approved
+ // when the feature
+ // `kEnableSupervisedUserSkipParentApprovalToInstallExtensions` becomes
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc
new file mode 100644
index 0000000000..3bae20d3e9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc
+@@ -34,7 +34,7 @@
+ #include "chrome/browser/supervised_user/child_accounts/child_account_service_android.h"
+ #include "components/signin/public/identity_manager/identity_manager.h"
+ #include "ui/android/view_android.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/supervised_user_verification_controller_client.h"
+ #include "chrome/browser/supervised_user/supervised_user_verification_page.h"
+ #endif
+@@ -150,7 +150,7 @@ SupervisedUserGoogleAuthNavigationThrott
+ return content::NavigationThrottle::DEFER;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // When an unauthenticated supervised user tries to access YouTube, we force
+ // re-authentication with an interstitial so that YouTube can be subject to
+ // content restrictions. This interstitial is only available on Desktop
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc
new file mode 100644
index 0000000000..9ed1f5dc2d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_metrics_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_metrics_service_factory.cc
+@@ -14,7 +14,7 @@
+ #include "components/supervised_user/core/browser/supervised_user_service.h"
+ #include "content/public/browser/browser_context.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/linux_mac_windows/supervised_user_extensions_metrics_delegate_impl.h"
+ #endif
+
+@@ -62,7 +62,7 @@ SupervisedUserMetricsServiceFactory::Bui
+ std::unique_ptr<supervised_user::SupervisedUserMetricsService ::
+ SupervisedUserMetricsServiceExtensionDelegate>
+ extensions_metrics_delegate = nullptr;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extensions_metrics_delegate =
+ std::make_unique<SupervisedUserExtensionsMetricsDelegateImpl>(
+ extensions::ExtensionRegistry::Get(profile), profile);
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
new file mode 100644
index 0000000000..e3afd4f523
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_navigation_observer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_navigation_observer.cc
+@@ -47,7 +47,7 @@
+ #include "chrome/browser/supervised_user/android/supervised_user_web_content_handler_impl.h"
+ #elif BUILDFLAG(IS_CHROMEOS)
+ #include "chrome/browser/supervised_user/chromeos/supervised_user_web_content_handler_impl.h"
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/linux_mac_windows/supervised_user_web_content_handler_impl.h"
+ #endif
+
+@@ -67,7 +67,7 @@ std::unique_ptr<supervised_user::WebCont
+ #elif BUILDFLAG(IS_ANDROID)
+ return std::make_unique<SupervisedUserWebContentHandlerImpl>(
+ web_contents, frame_id, navigation_id);
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return std::make_unique<SupervisedUserWebContentHandlerImpl>(
+ web_contents, frame_id, navigation_id);
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.cc b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.cc
new file mode 100644
index 0000000000..76057eff6a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_navigation_throttle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_navigation_throttle.cc
+@@ -215,7 +215,7 @@ void SupervisedUserNavigationThrottle::O
+ case kCancelWithInterstitial: {
+ CHECK(navigation_handle());
+ // LINT.IfChange(cancel_with_interstitial)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (supervised_user::ShouldShowReAuthInterstitial(*navigation_handle(),
+ is_main_frame)) {
+ // Show the re-authentication interstitial if the user signed out of
+@@ -246,7 +246,7 @@ void SupervisedUserNavigationThrottle::O
+ }
+
+ namespace supervised_user {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+
+ bool ShouldShowReAuthInterstitial(content::NavigationHandle& navigation_handle,
+ bool is_main_frame) {
diff --git a/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.h b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.h
new file mode 100644
index 0000000000..78f6fd6947
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__throttle.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/supervised_user/supervised_user_navigation_throttle.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/supervised_user/supervised_user_navigation_throttle.h
+@@ -22,7 +22,7 @@
+ class Profile;
+
+ namespace supervised_user {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ bool ShouldShowReAuthInterstitial(content::NavigationHandle& navigation_handle,
+ bool is_main_frame);
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_sync_chrome__sync__controller__builder.cc b/electron34/patches/patch-chrome_browser_sync_chrome__sync__controller__builder.cc
new file mode 100644
index 0000000000..2f18ae5168
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_sync_chrome__sync__controller__builder.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/sync/chrome_sync_controller_builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/sync/chrome_sync_controller_builder.cc
+@@ -275,7 +275,7 @@ ChromeSyncControllerBuilder::Build(synce
+ #if BUILDFLAG(ENABLE_SPELLCHECK)
+ // Chrome prefers OS provided spell checkers where they exist. So only sync
+ // the custom dictionary on platforms that typically don't provide one.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Dictionary sync is enabled by default.
+ if (spellcheck_service_.value()) {
+ controllers.push_back(
diff --git a/electron34/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc b/electron34/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc
new file mode 100644
index 0000000000..3951e83e4d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/sync/device_info_sync_client_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/sync/device_info_sync_client_impl.cc
+@@ -41,7 +41,7 @@ std::string DeviceInfoSyncClientImpl::Ge
+ // included in lacros-chrome once build flag switch of lacros-chrome is
+ // complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ syncer::SyncPrefs prefs(profile_->GetPrefs());
+ if (prefs.IsLocalSyncEnabled()) {
+ return "local_device";
diff --git a/electron34/patches/patch-chrome_browser_sync_sync__service__factory.cc b/electron34/patches/patch-chrome_browser_sync_sync__service__factory.cc
new file mode 100644
index 0000000000..fbbaeff92d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_sync_sync__service__factory.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/sync/sync_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/sync/sync_service_factory.cc
+@@ -110,7 +110,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_keyed_service.h"
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_service_factory.h"
+ #include "chrome/browser/ui/tabs/saved_tab_groups/saved_tab_group_utils.h"
+@@ -137,7 +137,7 @@ namespace {
+ tab_groups::TabGroupSyncService* GetTabGroupSyncService(Profile* profile) {
+ CHECK(profile);
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ tab_groups::TabGroupSyncService* service =
+ tab_groups::SavedTabGroupUtils::GetServiceForProfile(profile);
+ CHECK(service);
+@@ -379,7 +379,7 @@ std::unique_ptr<KeyedService> BuildSyncS
+ bool local_sync_backend_enabled = false;
+ // Only check the local sync backend pref on the supported platforms of
+ // Windows, Mac and Linux.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ syncer::SyncPrefs prefs(profile->GetPrefs());
+ local_sync_backend_enabled = prefs.IsLocalSyncEnabled();
+ base::UmaHistogramBoolean("Sync.Local.Enabled2", local_sync_backend_enabled);
+@@ -514,7 +514,7 @@ SyncServiceFactory::SyncServiceFactory()
+ DependsOn(ProfilePasswordStoreFactory::GetInstance());
+ DependsOn(PowerBookmarkServiceFactory::GetInstance());
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ DependsOn(tab_groups::SavedTabGroupServiceFactory::GetInstance());
+ #elif BUILDFLAG(IS_ANDROID)
+ DependsOn(tab_groups::TabGroupSyncServiceFactory::GetInstance());
diff --git a/electron34/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc b/electron34/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc
new file mode 100644
index 0000000000..4e32ba582f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/tab_group_sync/tab_group_sync_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/tab_group_sync/tab_group_sync_service_factory.cc
+@@ -31,7 +31,7 @@
+ #include "components/sync_device_info/device_info_sync_service.h"
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/tabs/saved_tab_groups/tab_group_sync_delegate_desktop.h"
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
+ // BUILDFLAG(IS_WIN)
+@@ -89,7 +89,7 @@ TabGroupSyncServiceFactory::BuildService
+
+ std::unique_ptr<TabGroupSyncDelegate> delegate;
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (tab_groups::IsTabGroupSyncServiceDesktopMigrationEnabled()) {
+ delegate =
+ std::make_unique<TabGroupSyncDelegateDesktop>(service.get(), profile);
diff --git a/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.cc b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.cc
new file mode 100644
index 0000000000..e2bca807c9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/sampling/task_group.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/sampling/task_group.cc
+@@ -41,7 +41,7 @@ const int kBackgroundRefreshTypesMask =
+ #if BUILDFLAG(IS_WIN)
+ REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME |
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ REFRESH_TYPE_FD_COUNT |
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ #if BUILDFLAG(ENABLE_NACL)
+@@ -126,7 +126,7 @@ TaskGroup::TaskGroup(
+ #if BUILDFLAG(ENABLE_NACL)
+ nacl_debug_stub_port_(nacl::kGdbDebugStubPortUnknown),
+ #endif // BUILDFLAG(ENABLE_NACL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ open_fd_count_(-1),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ idle_wakeups_per_second_(-1),
+@@ -145,7 +145,7 @@ TaskGroup::TaskGroup(
+ weak_ptr_factory_.GetWeakPtr()),
+ base::BindRepeating(&TaskGroup::OnIdleWakeupsRefreshDone,
+ weak_ptr_factory_.GetWeakPtr()),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ base::BindRepeating(&TaskGroup::OnOpenFdCountRefreshDone,
+ weak_ptr_factory_.GetWeakPtr()),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+@@ -324,7 +324,7 @@ void TaskGroup::OnRefreshNaClDebugStubPo
+ }
+ #endif // BUILDFLAG(ENABLE_NACL)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void TaskGroup::OnOpenFdCountRefreshDone(int open_fd_count) {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+
diff --git a/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.h b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.h
new file mode 100644
index 0000000000..d8eaf8b158
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/sampling/task_group.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/sampling/task_group.h
+@@ -44,7 +44,7 @@ constexpr int kUnsupportedVMRefreshFlags
+ REFRESH_TYPE_WEBCACHE_STATS | REFRESH_TYPE_NETWORK_USAGE |
+ REFRESH_TYPE_NACL | REFRESH_TYPE_IDLE_WAKEUPS | REFRESH_TYPE_HANDLES |
+ REFRESH_TYPE_START_TIME | REFRESH_TYPE_CPU_TIME | REFRESH_TYPE_PRIORITY |
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ REFRESH_TYPE_FD_COUNT |
+ #endif
+ REFRESH_TYPE_HARD_FAULTS;
+@@ -152,7 +152,7 @@ class TaskGroup {
+ }
+ #endif // BUILDFLAG(ENABLE_NACL)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int open_fd_count() const { return open_fd_count_; }
+ void set_open_fd_count(int open_fd_count) { open_fd_count_ = open_fd_count; }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+@@ -172,7 +172,7 @@ class TaskGroup {
+ void RefreshNaClDebugStubPort(int child_process_unique_id);
+ void OnRefreshNaClDebugStubPortDone(int port);
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ void OnOpenFdCountRefreshDone(int open_fd_count);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+
+@@ -244,7 +244,7 @@ class TaskGroup {
+ #if BUILDFLAG(ENABLE_NACL)
+ int nacl_debug_stub_port_;
+ #endif // BUILDFLAG(ENABLE_NACL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // The number of file descriptors currently open by the process.
+ int open_fd_count_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
new file mode 100644
index 0000000000..33b2b6ef46
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/sampling/task_group_sampler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/sampling/task_group_sampler.cc
+@@ -46,7 +46,7 @@ TaskGroupSampler::TaskGroupSampler(
+ const OnCpuRefreshCallback& on_cpu_refresh,
+ const OnSwappedMemRefreshCallback& on_swapped_mem_refresh,
+ const OnIdleWakeupsCallback& on_idle_wakeups,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback& on_open_fd_count,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback& on_process_priority)
+@@ -56,7 +56,7 @@ TaskGroupSampler::TaskGroupSampler(
+ on_cpu_refresh_callback_(on_cpu_refresh),
+ on_swapped_mem_refresh_callback_(on_swapped_mem_refresh),
+ on_idle_wakeups_callback_(on_idle_wakeups),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ on_open_fd_count_callback_(on_open_fd_count),
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ on_process_priority_callback_(on_process_priority) {
+@@ -86,7 +86,7 @@ void TaskGroupSampler::Refresh(int64_t r
+ base::BindOnce(on_swapped_mem_refresh_callback_));
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_IDLE_WAKEUPS,
+ refresh_flags)) {
+ blocking_pool_runner_->PostTaskAndReplyWithResult(
+@@ -96,7 +96,7 @@ void TaskGroupSampler::Refresh(int64_t r
+ }
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (TaskManagerObserver::IsResourceRefreshEnabled(REFRESH_TYPE_FD_COUNT,
+ refresh_flags)) {
+ blocking_pool_runner_->PostTaskAndReplyWithResult(
+@@ -150,7 +150,7 @@ int TaskGroupSampler::RefreshIdleWakeups
+ return process_metrics_->GetIdleWakeupsPerSecond();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int TaskGroupSampler::RefreshOpenFdCount() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(worker_pool_sequenced_checker_);
+
diff --git a/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
new file mode 100644
index 0000000000..70010a2f8a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/sampling/task_group_sampler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/sampling/task_group_sampler.h
+@@ -31,7 +31,7 @@ class TaskGroupSampler : public base::Re
+ using OnCpuRefreshCallback = base::RepeatingCallback<void(double)>;
+ using OnSwappedMemRefreshCallback = base::RepeatingCallback<void(int64_t)>;
+ using OnIdleWakeupsCallback = base::RepeatingCallback<void(int)>;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ using OnOpenFdCountCallback = base::RepeatingCallback<void(int)>;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ using OnProcessPriorityCallback =
+@@ -43,7 +43,7 @@ class TaskGroupSampler : public base::Re
+ const OnCpuRefreshCallback& on_cpu_refresh,
+ const OnSwappedMemRefreshCallback& on_memory_refresh,
+ const OnIdleWakeupsCallback& on_idle_wakeups,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback& on_open_fd_count,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback& on_process_priority);
+@@ -63,7 +63,7 @@ class TaskGroupSampler : public base::Re
+ double RefreshCpuUsage();
+ int64_t RefreshSwappedMem();
+ int RefreshIdleWakeupsPerSecond();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ int RefreshOpenFdCount();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ base::Process::Priority RefreshProcessPriority();
+@@ -87,7 +87,7 @@ class TaskGroupSampler : public base::Re
+ const OnCpuRefreshCallback on_cpu_refresh_callback_;
+ const OnSwappedMemRefreshCallback on_swapped_mem_refresh_callback_;
+ const OnIdleWakeupsCallback on_idle_wakeups_callback_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const OnOpenFdCountCallback on_open_fd_count_callback_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
+ const OnProcessPriorityCallback on_process_priority_callback_;
diff --git a/electron34/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
new file mode 100644
index 0000000000..61a796af36
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/sampling/task_manager_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/sampling/task_manager_impl.cc
+@@ -219,7 +219,7 @@ void TaskManagerImpl::GetUSERHandles(Tas
+ }
+
+ int TaskManagerImpl::GetOpenFdCount(TaskId task_id) const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return GetTaskGroupByTaskId(task_id)->open_fd_count();
+ #else
+ return -1;
diff --git a/electron34/patches/patch-chrome_browser_task__manager_task__manager__observer.h b/electron34/patches/patch-chrome_browser_task__manager_task__manager__observer.h
new file mode 100644
index 0000000000..a4d6981012
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_task__manager_task__manager__observer.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/task_manager/task_manager_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/task_manager/task_manager_observer.h
+@@ -47,7 +47,7 @@ enum RefreshType {
+ // or backgrounded.
+ REFRESH_TYPE_PRIORITY = 1 << 13,
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // For observers interested in getting the number of open file descriptors of
+ // processes.
+ REFRESH_TYPE_FD_COUNT = 1 << 14,
diff --git a/electron34/patches/patch-chrome_browser_themes_theme__helper.cc b/electron34/patches/patch-chrome_browser_themes_theme__helper.cc
new file mode 100644
index 0000000000..eadb894f06
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_themes_theme__helper.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/themes/theme_helper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/themes/theme_helper.cc
+@@ -18,7 +18,7 @@
+ #include "ui/gfx/image/image.h"
+ #include "ui/native_theme/native_theme.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_themes_theme__service.cc b/electron34/patches/patch-chrome_browser_themes_theme__service.cc
new file mode 100644
index 0000000000..3ff92735eb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_themes_theme__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/themes/theme_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/themes/theme_service.cc
+@@ -70,7 +70,7 @@
+ #include "extensions/browser/extension_registry_observer.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #include "ui/ozone/public/ozone_platform.h" // nogncheck
+ #endif
+@@ -328,7 +328,7 @@ CustomThemeSupplier* ThemeService::GetTh
+ }
+
+ bool ThemeService::ShouldUseCustomFrame() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_server_side_window_decorations) {
diff --git a/electron34/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc b/electron34/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc
new file mode 100644
index 0000000000..9fd3a7b70b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/themes/theme_service_aura_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/themes/theme_service_aura_linux.cc
+@@ -23,7 +23,7 @@ namespace {
+ ui::SystemTheme ValidateSystemTheme(ui::SystemTheme system_theme) {
+ switch (system_theme) {
+ case ui::SystemTheme::kDefault:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case ui::SystemTheme::kGtk:
+ case ui::SystemTheme::kQt:
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_themes_theme__service__factory.cc b/electron34/patches/patch-chrome_browser_themes_theme__service__factory.cc
new file mode 100644
index 0000000000..1f1e90d0df
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_themes_theme__service__factory.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/themes/theme_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/themes/theme_service_factory.cc
+@@ -27,11 +27,11 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/themes/theme_service_aura_linux.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui_factory.h"
+ #endif
+
+@@ -108,7 +108,7 @@ ThemeServiceFactory::~ThemeServiceFactor
+ std::unique_ptr<KeyedService>
+ ThemeServiceFactory::BuildServiceInstanceForBrowserContext(
+ content::BrowserContext* profile) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ using ThemeService = ThemeServiceAuraLinux;
+ #endif
+
+@@ -122,9 +122,9 @@ void ThemeServiceFactory::RegisterProfil
+ user_prefs::PrefRegistrySyncable* registry) {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ ui::SystemTheme default_system_theme = ui::SystemTheme::kDefault;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ default_system_theme = ui::GetDefaultSystemTheme();
+ #endif
+ registry->RegisterIntegerPref(prefs::kSystemTheme,
diff --git a/electron34/patches/patch-chrome_browser_ui_actions_chrome__action__id.h b/electron34/patches/patch-chrome_browser_ui_actions_chrome__action__id.h
new file mode 100644
index 0000000000..5d8b99a378
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_actions_chrome__action__id.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/actions/chrome_action_id.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/actions/chrome_action_id.h
+@@ -515,7 +515,7 @@
+ IDC_CONTENT_CONTEXT_QUICK_ANSWERS_INLINE_ANSWER) \
+ E(kActionContentContextQuickAnswersInlineQuery, \
+ IDC_CONTENT_CONTEXT_QUICK_ANSWERS_INLINE_QUERY)
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define CHROME_PLATFORM_SPECIFIC_ACTION_IDS \
+ E(kUseSystemTitleBar, IDC_USE_SYSTEM_TITLE_BAR) \
+ E(kRestoreWindow, IDC_RESTORE_WINDOW)
diff --git a/electron34/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc b/electron34/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc
new file mode 100644
index 0000000000..ba0d3d99a0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/ash/keyboard/chrome_keyboard_web_contents.cc
+@@ -79,8 +79,7 @@ class ChromeKeyboardContentsDelegate : p
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override {
++ const content::mojom::CreateNewWindowParams& params) override {
+ return true;
+ }
+
diff --git a/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.cc b/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.cc
new file mode 100644
index 0000000000..c99faaed5a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/ash/web_view/ash_web_view_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/ash/web_view/ash_web_view_impl.cc
+@@ -118,10 +118,9 @@ bool AshWebViewImpl::IsWebContentsCreati
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ if (params_.suppress_navigation) {
+- NotifyDidSuppressNavigation(target_url,
++ NotifyDidSuppressNavigation(params.target_url,
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+ /*from_user_gesture=*/true);
+ return true;
diff --git a/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.h b/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.h
new file mode 100644
index 0000000000..7554550df7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_ash_web__view_ash__web__view__impl.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/ash/web_view/ash_web_view_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/ash/web_view/ash_web_view_impl.h
+@@ -59,8 +59,7 @@ class AshWebViewImpl : public ash::AshWe
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ content::WebContents* OpenURLFromTab(
+ content::WebContents* source,
+ const content::OpenURLParams& params,
diff --git a/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc b/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
new file mode 100644
index 0000000000..a72d70deb4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/autofill/payments/desktop_payments_window_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/autofill/payments/desktop_payments_window_manager.cc
+@@ -49,7 +49,7 @@ gfx::Rect GetPopupSizeForVcn3ds() {
+ DesktopPaymentsWindowManager::DesktopPaymentsWindowManager(
+ ContentAutofillClient* client)
+ : client_(CHECK_DEREF(client)) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ scoped_observation_.Observe(BrowserList::GetInstance());
+ #endif // BUILDFLAG(IS_LINUX)
+ }
+@@ -109,7 +109,7 @@ void DesktopPaymentsWindowManager::WebCo
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void DesktopPaymentsWindowManager::OnBrowserSetLastActive(Browser* browser) {
+ // If there is an ongoing payments window manager pop-up flow, and the
+ // original tab's WebContents become active, activate the pop-up's
diff --git a/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h b/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
new file mode 100644
index 0000000000..112d7ac628
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/autofill/payments/desktop_payments_window_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/autofill/payments/desktop_payments_window_manager.h
+@@ -14,7 +14,7 @@
+ #include "components/autofill/core/browser/payments/payments_window_manager.h"
+ #include "content/public/browser/web_contents_observer.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/scoped_observation.h"
+ #include "chrome/browser/ui/browser_list.h"
+ #include "chrome/browser/ui/browser_list_observer.h"
+@@ -39,7 +39,7 @@ class PaymentsWindowUserConsentDialogCon
+ // WebContents of the original tab that the pop-up is created in. If there is a
+ // pop-up currently present, `this` will observe the WebContents of that pop-up.
+ class DesktopPaymentsWindowManager : public PaymentsWindowManager,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ public BrowserListObserver,
+ #endif // BUILDFLAG(IS_LINUX)
+ public content::WebContentsObserver {
+@@ -58,7 +58,7 @@ class DesktopPaymentsWindowManager : pub
+ content::NavigationHandle* navigation_handle) override;
+ void WebContentsDestroyed() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // BrowserListObserver:
+ void OnBrowserSetLastActive(Browser* browser) override;
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -136,7 +136,7 @@ class DesktopPaymentsWindowManager : pub
+ std::unique_ptr<PaymentsWindowUserConsentDialogControllerImpl>
+ payments_window_user_consent_dialog_controller_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<BrowserList, BrowserListObserver> scoped_observation_{
+ this};
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_browser_ui_browser.cc b/electron34/patches/patch-chrome_browser_ui_browser.cc
new file mode 100644
index 0000000000..27cfeb13f5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser.cc
+@@ -2145,12 +2145,11 @@ bool Browser::IsWebContentsCreationOverr
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ return window_container_type ==
+ content::mojom::WindowContainerType::BACKGROUND &&
+ ShouldCreateBackgroundContents(source_site_instance, opener_url,
+- frame_name);
++ params.frame_name);
+ }
+
+ WebContents* Browser::CreateCustomWebContents(
diff --git a/electron34/patches/patch-chrome_browser_ui_browser.h b/electron34/patches/patch-chrome_browser_ui_browser.h
new file mode 100644
index 0000000000..db4fb1394c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser.h
+@@ -301,7 +301,7 @@ class Browser : public TabStripModelObse
+ std::optional<int64_t> display_id;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // When the browser window is shown, the desktop environment is notified
+ // using this ID. In response, the desktop will stop playing the "waiting
+ // for startup" animation (if any).
+@@ -975,8 +975,7 @@ class Browser : public TabStripModelObse
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ content::WebContents* CreateCustomWebContents(
+ content::RenderFrameHost* opener,
+ content::SiteInstance* source_site_instance,
diff --git a/electron34/patches/patch-chrome_browser_ui_browser__command__controller.cc b/electron34/patches/patch-chrome_browser_ui_browser__command__controller.cc
new file mode 100644
index 0000000000..f34ab6cd6e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser__command__controller.cc
@@ -0,0 +1,86 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser_command_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser_command_controller.cc
+@@ -127,7 +127,7 @@
+ #include "components/user_manager/user_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ime/text_input_flags.h"
+ #include "ui/linux/linux_ui.h"
+ #endif
+@@ -136,7 +136,7 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/shortcuts/desktop_shortcuts_utils.h"
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
+
+@@ -317,7 +317,7 @@ bool BrowserCommandController::IsReserve
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this key was registered by the user as a content editing hotkey, then
+ // it is not reserved.
+ auto* linux_ui = ui::LinuxUi::instance();
+@@ -572,7 +572,7 @@ bool BrowserCommandController::ExecuteCo
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ case IDC_MINIMIZE_WINDOW:
+ browser_->window()->Minimize();
+ break;
+@@ -584,7 +584,7 @@ bool BrowserCommandController::ExecuteCo
+ break;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case IDC_USE_SYSTEM_TITLE_BAR: {
+ PrefService* prefs = profile()->GetPrefs();
+ prefs->SetBoolean(prefs::kUseCustomChromeFrame,
+@@ -788,7 +788,7 @@ bool BrowserCommandController::ExecuteCo
+ break;
+ case IDC_CREATE_SHORTCUT:
+ base::RecordAction(base::UserMetricsAction("CreateShortcut"));
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kShortcutsNotApps)) {
+ chrome::CreateDesktopShortcutForActiveWebContents(browser_);
+ } else {
+@@ -1263,12 +1263,12 @@ void BrowserCommandController::InitComma
+ #endif
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ command_updater_.UpdateCommandEnabled(IDC_MINIMIZE_WINDOW, true);
+ command_updater_.UpdateCommandEnabled(IDC_MAXIMIZE_WINDOW, true);
+ command_updater_.UpdateCommandEnabled(IDC_RESTORE_WINDOW, true);
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool use_system_title_bar = true;
+ #if BUILDFLAG(IS_OZONE)
+ use_system_title_bar = ui::OzonePlatform::GetInstance()
+@@ -1606,7 +1606,7 @@ void BrowserCommandController::UpdateCom
+ bool can_create_web_app = web_app::CanCreateWebApp(browser_);
+ command_updater_.UpdateCommandEnabled(IDC_INSTALL_PWA, can_create_web_app);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kShortcutsNotApps)) {
+ command_updater_.UpdateCommandEnabled(
+ IDC_CREATE_SHORTCUT, shortcuts::CanCreateDesktopShortcut(browser_));
diff --git a/electron34/patches/patch-chrome_browser_ui_browser__commands.cc b/electron34/patches/patch-chrome_browser_ui_browser__commands.cc
new file mode 100644
index 0000000000..f1048dfc24
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser__commands.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser_commands.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser_commands.cc
+@@ -2032,7 +2032,7 @@ void OpenUpdateChromeDialog(Browser* bro
+ } else if (UpgradeDetector::GetInstance()->is_outdated_install_no_au()) {
+ UpgradeDetector::GetInstance()->NotifyOutdatedInstallNoAutoUpdate();
+ } else {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(features::kFewerUpdateConfirmations)) {
+ chrome::AttemptRelaunch();
+ return;
diff --git a/electron34/patches/patch-chrome_browser_ui_browser__ui__prefs.cc b/electron34/patches/patch-chrome_browser_ui_browser__ui__prefs.cc
new file mode 100644
index 0000000000..5440ef2f84
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser__ui__prefs.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser_ui_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser_ui_prefs.cc
+@@ -72,7 +72,7 @@ void RegisterBrowserPrefs(PrefRegistrySi
+ registry->RegisterIntegerPref(prefs::kDefaultBrowserDeclinedCount, 0);
+ registry->RegisterTimePref(prefs::kDefaultBrowserFirstShownTime,
+ base::Time());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ registry->RegisterStringPref(prefs::kEnterpriseCustomLabel, std::string());
+ registry->RegisterStringPref(prefs::kEnterpriseLogoUrl, std::string());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+@@ -182,7 +182,7 @@ void RegisterBrowserUserPrefs(user_prefs
+ registry->RegisterDictionaryPref(prefs::kHttpsUpgradeFallbacks);
+ registry->RegisterDictionaryPref(prefs::kHttpsUpgradeNavigations);
+ registry->RegisterBooleanPref(prefs::kHttpsOnlyModeAutoEnabled, false);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ registry->RegisterStringPref(prefs::kEnterpriseLogoUrl, std::string());
+ registry->RegisterStringPref(prefs::kEnterpriseCustomLabel, std::string());
+ registry->RegisterStringPref(prefs::kEnterpriseLogoUrlForProfile,
diff --git a/electron34/patches/patch-chrome_browser_ui_browser__view__prefs.cc b/electron34/patches/patch-chrome_browser_ui_browser__view__prefs.cc
new file mode 100644
index 0000000000..d0446383e2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_browser__view__prefs.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/browser_view_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/browser_view_prefs.cc
+@@ -15,7 +15,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GetCustomFramePrefDefault() {
+ #if BUILDFLAG(IS_OZONE)
+ return ui::OzonePlatform::GetInstance()
+@@ -31,7 +31,7 @@ bool GetCustomFramePrefDefault() {
+
+ void RegisterBrowserViewProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kUseCustomChromeFrame,
+ GetCustomFramePrefDefault());
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_chrome__pages.cc b/electron34/patches/patch-chrome_browser_ui_chrome__pages.cc
new file mode 100644
index 0000000000..144fa395a0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_chrome__pages.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/chrome_pages.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/chrome_pages.cc
+@@ -87,7 +87,7 @@
+ #include "components/signin/public/identity_manager/identity_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/web_applications/web_app_utils.h"
+ #endif
+
+@@ -380,7 +380,7 @@ void ShowChromeTips(Browser* browser) {
+ ShowSingletonTab(browser, GURL(kChromeTipsURL));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ShowChromeWhatsNew(Browser* browser) {
+ ShowSingletonTab(browser, GURL(kChromeUIWhatsNewURL));
+ }
+@@ -728,7 +728,7 @@ void ShowShortcutCustomizationApp(Profil
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ShowWebAppSettingsImpl(Browser* browser,
+ Profile* profile,
+ const std::string& app_id,
diff --git a/electron34/patches/patch-chrome_browser_ui_chrome__pages.h b/electron34/patches/patch-chrome_browser_ui_chrome__pages.h
new file mode 100644
index 0000000000..e2a8b518dd
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_chrome__pages.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/chrome_pages.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/chrome_pages.h
+@@ -39,7 +39,7 @@ namespace signin {
+ enum class ConsentLevel;
+ } // namespace signin
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace web_app {
+ enum class AppSettingsPageEntryPoint;
+ } // namespace web_app
+@@ -175,7 +175,7 @@ void ShowShortcutCustomizationApp(Profil
+ const std::string& category);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Show chrome://app-settings/<app-id> page.
+ void ShowWebAppSettings(Browser* browser,
+ const std::string& app_id,
diff --git a/electron34/patches/patch-chrome_browser_ui_color_BUILD.gn b/electron34/patches/patch-chrome_browser_ui_color_BUILD.gn
new file mode 100644
index 0000000000..557371c1c1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_color_BUILD.gn
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/color/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/color/BUILD.gn
+@@ -85,9 +85,6 @@ source_set("mixers") {
+ ]
+ }
+
+- if (is_chromeos || is_linux || is_mac || is_win) {
+- deps += [ "//chrome/browser/themes" ]
+- }
+ }
+
+ if (!is_ios && !is_android) {
diff --git a/electron34/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc b/electron34/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
new file mode 100644
index 0000000000..d71273dd58
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/color/native_chrome_color_mixer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/color/native_chrome_color_mixer.cc
+@@ -7,7 +7,7 @@
+ #include "build/build_config.h"
+
+ #if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC) && \
+- !BUILDFLAG(IS_WIN)
++ !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD)
+ void AddNativeChromeColorMixer(ui::ColorProvider* provider,
+ const ui::ColorProviderKey& key) {}
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc b/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc
new file mode 100644
index 0000000000..e184fc9138
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc
@@ -0,0 +1,139 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/exclusive_access/fullscreen_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+@@ -20,12 +20,16 @@
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/history/history_service_factory.h"
+ #include "chrome/browser/profiles/profile.h"
++#if 0
+ #include "chrome/browser/ui/blocked_content/popunder_preventer.h"
++#endif
+ #include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
+ #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
+ #include "chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h"
++#if 0
+ #include "chrome/browser/ui/status_bubble.h"
+ #include "chrome/browser/ui/tabs/tab_strip_model.h"
++#endif
+ #include "chrome/common/chrome_switches.h"
+ #include "components/history/core/browser/history_service.h"
+ #include "components/history/core/browser/history_types.h"
+@@ -260,10 +264,12 @@ void FullscreenController::EnterFullscre
+ return;
+ }
+
++#if 0
+ if (!popunder_preventer_)
+ popunder_preventer_ = std::make_unique<PopunderPreventer>(web_contents);
+ else
+ popunder_preventer_->WillActivateWebContents(web_contents);
++#endif
+
+ // Keep the current state. |SetTabWithExclusiveAccess| may change the return
+ // value of |IsWindowFullscreenForTabOrPending|.
+@@ -375,12 +381,14 @@ void FullscreenController::ExitFullscree
+ void FullscreenController::FullscreenTabOpeningPopup(
+ content::WebContents* opener,
+ content::WebContents* popup) {
++#if 0
+ if (!popunder_preventer_) {
+ return;
+ }
+
+ DCHECK_EQ(exclusive_access_tab(), opener);
+ popunder_preventer_->AddPotentialPopunder(popup);
++#endif
+ }
+
+ void FullscreenController::OnTabDeactivated(
+@@ -466,10 +474,12 @@ void FullscreenController::FullscreenTra
+ #endif // DCHECK_IS_ON()
+ tab_fullscreen_target_display_id_ = display::kInvalidDisplayId;
+ started_fullscreen_transition_ = false;
++#if 0
+ if (!IsTabFullscreen()) {
+ // Activate any popup windows created while content fullscreen, after exit.
+ popunder_preventer_.reset();
+ }
++#endif
+ }
+
+ void FullscreenController::RunOrDeferUntilTransitionIsComplete(
+@@ -577,18 +587,17 @@ void FullscreenController::EnterFullscre
+ // Do not enter fullscreen mode if disallowed by pref. This prevents the user
+ // from manually entering fullscreen mode and also disables kiosk mode on
+ // desktop platforms.
+- if (!exclusive_access_manager()
+- ->context()
+- ->GetProfile()
+- ->GetPrefs()
+- ->GetBoolean(prefs::kFullscreenAllowed)) {
++ auto* profile = exclusive_access_manager()->context()->GetProfile();
++ if (!profile || !profile->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed))
+ return;
+- }
+ #endif
+ started_fullscreen_transition_ = true;
+ toggled_into_fullscreen_ = true;
++#if 0
+ bool entering_tab_fullscreen = option == TAB && !tab_fullscreen_;
++#endif
+ GURL url;
++#if 0
+ if (option == TAB) {
+ url = GetRequestingOrigin();
+ tab_fullscreen_ = true;
+@@ -621,6 +630,7 @@ void FullscreenController::EnterFullscre
+ if (!extension_caused_fullscreen_.is_empty())
+ url = extension_caused_fullscreen_;
+ }
++#endif
+
+ fullscreen_start_time_ = base::TimeTicks::Now();
+ if (option == BROWSER)
+@@ -641,6 +651,7 @@ void FullscreenController::ExitFullscree
+ return;
+ }
+
++#if 0
+ // `fullscreen_start_time_` is null if a fullscreen tab moves to a new window.
+ if (fullscreen_start_time_ && exclusive_access_tab()) {
+ ukm::SourceId source_id =
+@@ -652,15 +663,16 @@ void FullscreenController::ExitFullscree
+ .Record(ukm::UkmRecorder::Get());
+ fullscreen_start_time_.reset();
+ }
++#endif
+
+ toggled_into_fullscreen_ = false;
+ started_fullscreen_transition_ = true;
+-#if BUILDFLAG(IS_MAC)
+- // Mac windows report a state change instantly, and so we must also clear
++
++ // Electron native windows report a state change instantly, and so we must also clear
+ // state_prior_to_tab_fullscreen_ to match them else other logic using
+ // state_prior_to_tab_fullscreen_ will be incorrect.
+ NotifyTabExclusiveAccessLost();
+-#endif
++
+ exclusive_access_manager()->context()->ExitFullscreen();
+ extension_caused_fullscreen_ = GURL();
+ exclusive_access_manager()->UpdateBubble(base::NullCallback());
+@@ -722,8 +734,12 @@ GURL FullscreenController::GetEmbeddingO
+ void FullscreenController::RecordMetricsOnFullscreenApiRequested(
+ content::RenderFrameHost* requesting_frame) {
+ history::HistoryService* service =
++ #if 0
+ HistoryServiceFactory::GetForProfileWithoutCreating(
+ exclusive_access_manager()->context()->GetProfile());
++ #else
++ nullptr;
++ #endif
+ if (service) {
+ // Check if the origin has been visited more than a day ago and whether it's
+ // on an allowlist, then record those bits of information in a metric.
diff --git a/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h b/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h
new file mode 100644
index 0000000000..6c693b8c67
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/exclusive_access/fullscreen_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/exclusive_access/fullscreen_controller.h
+@@ -250,10 +250,12 @@ class FullscreenController : public Excl
+ // Used in testing to set the state to tab fullscreen.
+ bool is_tab_fullscreen_for_testing_ = false;
+
++#if 0
+ // Tracks related popups that lost activation or were shown without activation
+ // during content fullscreen sessions. This also activates the popups when
+ // fullscreen exits, to prevent sites from creating persistent popunders.
+ std::unique_ptr<PopunderPreventer> popunder_preventer_;
++#endif
+
+ base::ObserverList<FullscreenObserver> observer_list_;
+
diff --git a/electron34/patches/patch-chrome_browser_ui_managed__ui.cc b/electron34/patches/patch-chrome_browser_ui_managed__ui.cc
new file mode 100644
index 0000000000..24c8da52ca
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_managed__ui.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/managed_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/managed_ui.cc
+@@ -439,7 +439,7 @@ std::optional<std::string> GetDeviceMana
+ g_browser_process->platform_part()->browser_policy_connector_ash();
+ return connector->GetEnterpriseDomainManager();
+ #else
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(
+ features::kEnterpriseManagementDisclaimerUsesCustomLabel)) {
+ std::string custom_management_label =
+@@ -476,7 +476,7 @@ std::optional<std::string> GetAccountMan
+ policy::EnterpriseManagementAuthority::CLOUD))
+ return std::nullopt;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(
+ features::kEnterpriseManagementDisclaimerUsesCustomLabel)) {
+ std::string custom_management_label =
diff --git a/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc b/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc
new file mode 100644
index 0000000000..f78fa0cfb4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/media_router/presentation_receiver_window_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/media_router/presentation_receiver_window_controller.cc
+@@ -203,8 +203,7 @@ bool PresentationReceiverWindowControlle
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ // Disallow creating separate WebContentses. The WebContents implementation
+ // uses this to spawn new windows/tabs, which is also not allowed for
+ // local presentations.
diff --git a/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h b/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h
new file mode 100644
index 0000000000..7c6cf4245c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/media_router/presentation_receiver_window_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/media_router/presentation_receiver_window_controller.h
+@@ -105,8 +105,7 @@ class PresentationReceiverWindowControll
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+
+ // The profile used for the presentation.
+ raw_ptr<Profile, DanglingUntriaged> otr_profile_;
diff --git a/electron34/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc b/electron34/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
new file mode 100644
index 0000000000..0d8ab16d45
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/omnibox/omnibox_pedal_implementations.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/omnibox/omnibox_pedal_implementations.cc
+@@ -1976,7 +1976,7 @@ const gfx::VectorIcon& GetSharingHubVect
+ return omnibox::kShareMacChromeRefreshIcon;
+ #elif BUILDFLAG(IS_WIN)
+ return omnibox::kShareWinChromeRefreshIcon;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return omnibox::kShareLinuxChromeRefreshIcon;
+ #else
+ return omnibox::kShareChromeRefreshIcon;
diff --git a/electron34/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc b/electron34/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
new file mode 100644
index 0000000000..d12cdf9300
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/passwords/bubble_controllers/relaunch_chrome_bubble_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/passwords/bubble_controllers/relaunch_chrome_bubble_controller.cc
+@@ -44,7 +44,7 @@ std::u16string RelaunchChromeBubbleContr
+ #if BUILDFLAG(IS_MAC)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_NON_BRANDED
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_LINUX_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_TITLE_LINUX_NON_BRANDED
+ #endif
+@@ -57,7 +57,7 @@ std::u16string RelaunchChromeBubbleContr
+ #if BUILDFLAG(IS_MAC)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_NON_BRANDED
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ? IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_LINUX_BRANDED
+ : IDS_PASSWORD_MANAGER_RELAUNCH_CHROME_BUBBLE_DESCRIPTION_LINUX_NON_BRANDED
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc b/electron34/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
new file mode 100644
index 0000000000..f69bc28e36
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/passwords/manage_passwords_ui_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+@@ -97,7 +97,7 @@ namespace {
+
+ using Logger = autofill::SavePasswordProgressLogger;
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Should be kept in sync with constant declared in
+ // bubble_controllers/relaunch_chrome_bubble_controller.cc.
+ constexpr int kMaxNumberOfTimesKeychainErrorBubbleIsShown = 3;
+@@ -517,7 +517,7 @@ void ManagePasswordsUIController::OnBiom
+ }
+
+ void ManagePasswordsUIController::OnKeychainError() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CHECK(!dialog_controller_);
+ PrefService* prefs =
+ Profile::FromBrowserContext(web_contents()->GetBrowserContext())
diff --git a/electron34/patches/patch-chrome_browser_ui_sad__tab.cc b/electron34/patches/patch-chrome_browser_ui_sad__tab.cc
new file mode 100644
index 0000000000..3f6044fd6e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_sad__tab.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/sad_tab.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/sad_tab.cc
+@@ -173,7 +173,7 @@ std::vector<int> SadTab::GetSubMessages(
+ // Only show Incognito suggestion if not already in Incognito mode.
+ if (!web_contents_->GetBrowserContext()->IsOffTheRecord())
+ message_ids.insert(message_ids.begin(), IDS_SAD_TAB_RELOAD_INCOGNITO);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Note: on macOS, Linux and ChromeOS, the first bullet is either one of
+ // IDS_SAD_TAB_RELOAD_CLOSE_TABS or IDS_SAD_TAB_RELOAD_CLOSE_NOTABS
+ // followed by one of the above suggestions.
diff --git a/electron34/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h b/electron34/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
new file mode 100644
index 0000000000..27dcf0aae1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/sharing_hub/sharing_hub_bubble_controller.h
+@@ -36,7 +36,7 @@ class SharingHubBubbleController {
+ // Returns true if the omnibox icon should be shown.
+ virtual bool ShouldOfferOmniboxIcon() = 0;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This method returns the set of first-party actions, which are actions
+ // internal to Chrome. Third-party actions (those outside Chrome) are
+ // currently not supported.
diff --git a/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc b/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc
new file mode 100644
index 0000000000..216f89c25a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/signin/signin_view_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/signin/signin_view_controller.cc
+@@ -487,7 +487,7 @@ void SigninViewController::ShowModalMana
+ std::unique_ptr<signin::EnterpriseProfileCreationDialogParams>
+ create_param) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ CloseModalSignin();
+ dialog_ = std::make_unique<SigninModalDialogImpl>(
+ SigninViewControllerDelegate::CreateManagedUserNoticeDelegate(
diff --git a/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h b/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
new file mode 100644
index 0000000000..e74948f1a9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/signin/signin_view_controller_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/signin/signin_view_controller_delegate.h
+@@ -85,7 +85,7 @@ class SigninViewControllerDelegate {
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT) || BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Returns a platform-specific SigninViewContolllerDelegate instance that
+ // displays the managed user notice modal dialog. The returned object
+ // should delete itself when the window it's managing is closed.
diff --git a/electron34/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc b/electron34/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
new file mode 100644
index 0000000000..297813b558
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/startup/bad_flags_prompt.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/startup/bad_flags_prompt.cc
+@@ -101,7 +101,7 @@ const char* const kBadFlags[] = {
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Speech dispatcher is buggy, it can crash and it can make Chrome freeze.
+ // http://crbug.com/327295
+ switches::kEnableSpeechDispatcher,
diff --git a/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc b/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc
new file mode 100644
index 0000000000..39c5ffac67
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/startup/startup_browser_creator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/startup/startup_browser_creator.cc
+@@ -139,7 +139,7 @@
+ #include "chrome/credential_provider/common/gcp_strings.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_util.h"
+ #include "chrome/browser/ui/startup/web_app_info_recorder_utils.h"
+ #include "components/headless/policy/headless_mode_policy.h"
+@@ -968,7 +968,7 @@ bool StartupBrowserCreator::ProcessCmdLi
+ TRACE_EVENT0("startup", "StartupBrowserCreator::ProcessCmdLineImpl");
+ ComputeAndRecordLaunchMode(command_line);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (headless::IsHeadlessMode() &&
+ headless::HeadlessModePolicy::IsHeadlessModeDisabled(
+ g_browser_process->local_state())) {
+@@ -1069,7 +1069,7 @@ bool StartupBrowserCreator::ProcessCmdLi
+ silent_launch = true;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Writes open and installed web apps to the specified file without
+ // launching a new browser window or tab.
+ if (base::FeatureList::IsEnabled(features::kListWebAppsSwitch) &&
+@@ -1282,7 +1282,7 @@ bool StartupBrowserCreator::ProcessCmdLi
+ CHECK_EQ(profile_info.mode, StartupProfileMode::kBrowserWindow)
+ << "Failed launch with app: couldn't pick a profile";
+ std::string app_id = command_line.GetSwitchValueASCII(switches::kAppId);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If Chrome Apps are deprecated and |app_id| is a Chrome App, display the
+ // deprecation UI instead of launching the app.
+ if (apps::OpenDeprecatedApplicationPrompt(privacy_safe_profile, app_id))
diff --git a/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc b/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
new file mode 100644
index 0000000000..330c64954a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/startup/startup_browser_creator_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/startup/startup_browser_creator_impl.cc
+@@ -85,7 +85,7 @@
+ #include "chromeos/startup/browser_params_proxy.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/whats_new/whats_new_fetcher.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+@@ -225,7 +225,7 @@ Browser* StartupBrowserCreatorImpl::Open
+ // at the state of the MessageLoop.
+ Browser::CreateParams params = Browser::CreateParams(profile_, false);
+ params.creation_source = Browser::CreationSource::kStartupCreator;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ params.startup_id =
+ command_line_->GetSwitchValueASCII("desktop-startup-id");
+ #endif
+@@ -255,7 +255,7 @@ Browser* StartupBrowserCreatorImpl::Open
+ continue;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Start the What's New fetch but don't add the tab at this point. The tab
+ // will open as the foreground tab only if the remote content can be
+ // retrieved successfully. This prevents needing to automatically close the
diff --git a/electron34/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc b/electron34/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc
new file mode 100644
index 0000000000..4c4b7e27a3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/startup/startup_tab_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/startup/startup_tab_provider.cc
+@@ -61,7 +61,7 @@
+ #include "extensions/browser/extension_registry.h"
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/headless/headless_mode_util.h"
+ #endif
+
+@@ -105,7 +105,7 @@ bool ValidateUrl(const GURL& url) {
+ #if BUILDFLAG(IS_CHROMEOS_LACROS)
+ // In ChromeOS, allow any URL pattern that matches chrome:// scheme.
+ url_scheme_is_chrome = url.SchemeIs(content::kChromeUIScheme);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // In Headless mode, allow any URL pattern that matches chrome:// scheme if
+ // the user explicitly allowed it.
+ if (headless::IsHeadlessMode() && url.SchemeIs(content::kChromeUIScheme)) {
diff --git a/electron34/patches/patch-chrome_browser_ui_tab__helpers.cc b/electron34/patches/patch-chrome_browser_ui_tab__helpers.cc
new file mode 100644
index 0000000000..48cf5249cb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_tab__helpers.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/tab_helpers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/tab_helpers.cc
+@@ -234,7 +234,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/blocked_content/framebust_block_tab_helper.h"
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/hats/hats_helper.h"
+@@ -699,12 +699,12 @@ void TabHelpers::AttachTabHelpers(WebCon
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ metrics::DesktopSessionDurationObserver::CreateForWebContents(web_contents);
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(
+ features::kHappinessTrackingSurveysForDesktopDemo) ||
+ base::FeatureList::IsEnabled(features::kTrustSafetySentimentSurvey) ||
diff --git a/electron34/patches/patch-chrome_browser_ui_tabs_features.cc b/electron34/patches/patch-chrome_browser_ui_tabs_features.cc
new file mode 100644
index 0000000000..c08a23b042
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_tabs_features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/tabs/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/tabs/features.cc
+@@ -48,7 +48,7 @@ BASE_FEATURE(kTabStripCollectionStorage,
+ bool CanShowTabSearchPositionSetting() {
+ // Mac and other platforms will always have the tab search position in the
+ // correct location, cros/linux/win git the user the option to change.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(kTabSearchPositionSetting);
+ #else
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc b/electron34/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc
new file mode 100644
index 0000000000..e5b1467d20
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/tabs/tab_strip_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/tabs/tab_strip_prefs.cc
+@@ -20,7 +20,7 @@ namespace tabs {
+
+ bool GetDefaultTabSearchRightAligned() {
+ // These platforms are all left aligned, the others should be right.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
diff --git a/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.h b/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.h
new file mode 100644
index 0000000000..bb6786803a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/task_manager/task_manager_columns.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/task_manager/task_manager_columns.h
+@@ -278,7 +278,7 @@ inline constexpr std::array kColumns = {
+ .default_visibility = false},
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ TableColumnData{.id = IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN,
+ .align = ui::TableColumn::RIGHT,
+ .width = -1,
diff --git a/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc b/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
new file mode 100644
index 0000000000..e340238fb2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/task_manager/task_manager_table_model.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/task_manager/task_manager_table_model.cc
+@@ -459,7 +459,7 @@ std::u16string TaskManagerTableModel::Ge
+ ? stringifier_->backgrounded_string()
+ : stringifier_->foregrounded_string();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN: {
+ const int fd_count = observed_task_manager()->GetOpenFdCount(tasks_[row]);
+ return fd_count >= 0 ? base::FormatNumber(fd_count)
+@@ -624,7 +624,7 @@ int TaskManagerTableModel::CompareValues
+ return BooleanCompare(is_proc1_bg, is_proc2_bg);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN: {
+ const int proc1_fd_count =
+ observed_task_manager()->GetOpenFdCount(tasks_[row1]);
+@@ -808,7 +808,7 @@ void TaskManagerTableModel::UpdateRefres
+ type = REFRESH_TYPE_KEEPALIVE_COUNT;
+ break;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN:
+ type = REFRESH_TYPE_FD_COUNT;
+ break;
diff --git a/electron34/patches/patch-chrome_browser_ui_test_popup__browsertest.cc b/electron34/patches/patch-chrome_browser_ui_test_popup__browsertest.cc
new file mode 100644
index 0000000000..2f06f5ba18
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_test_popup__browsertest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/test/popup_browsertest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/test/popup_browsertest.cc
+@@ -75,7 +75,7 @@ IN_PROC_BROWSER_TEST_F(PopupTest, OpenLe
+ const display::Display display = GetDisplayNearestBrowser(popup);
+ gfx::Rect expected(popup->window()->GetBounds().size());
+ expected.AdjustToFit(display.work_area());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40815883) Desktop Linux window bounds are inaccurate.
+ expected.Outset(50);
+ EXPECT_TRUE(expected.Contains(popup->window()->GetBounds()))
+@@ -107,7 +107,7 @@ IN_PROC_BROWSER_TEST_F(PopupTest, OpenCl
+ // The popup should be constrained to the opener's available display space.
+ EXPECT_EQ(display, GetDisplayNearestBrowser(popup));
+ gfx::Rect work_area(display.work_area());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40815883) Desktop Linux bounds flakily extend outside the
+ // work area on trybots, when opening with excessive width and height, e.g.:
+ // width=${screen.availWidth+300},height=${screen.availHeight+300} yields:
diff --git a/electron34/patches/patch-chrome_browser_ui_test_test__browser__ui.cc b/electron34/patches/patch-chrome_browser_ui_test_test__browser__ui.cc
new file mode 100644
index 0000000000..a55aeff0b5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_test_test__browser__ui.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/test/test_browser_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/test/test_browser_ui.cc
+@@ -22,7 +22,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ #include "content/public/common/content_switches.h"
+ #include "ui/base/test/skia_gold_matching_algorithm.h"
+@@ -39,7 +39,7 @@
+ // TODO(crbug.com/40625383) support Mac for pixel tests.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ #define SUPPORTS_PIXEL_TEST
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_ui_ui__features.cc b/electron34/patches/patch-chrome_browser_ui_ui__features.cc
new file mode 100644
index 0000000000..d774c3b90a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_ui__features.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/ui_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/ui_features.cc
+@@ -90,7 +90,7 @@ bool IsExtensionMenuInRootAppMenu() {
+ return base::FeatureList::IsEnabled(kExtensionsMenuInAppMenu);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables the feature to remove the last confirmation dialog when relaunching
+ // to update Chrome.
+ BASE_FEATURE(kFewerUpdateConfirmations,
+@@ -300,7 +300,7 @@ BASE_FEATURE(kTabOrganizationAppMenuItem
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kMultiTabOrganization,
+ "MultiTabOrganization",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -463,7 +463,7 @@ BASE_FEATURE(kStopLoadingAnimationForHid
+ "StopLoadingAnimationForHiddenWindow",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kUsePortalAccentColor,
+ "UsePortalAccentColor",
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-chrome_browser_ui_ui__features.h b/electron34/patches/patch-chrome_browser_ui_ui__features.h
new file mode 100644
index 0000000000..e39ae88259
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_ui__features.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/ui_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/ui_features.h
+@@ -68,7 +68,7 @@ extern const base::FeatureParam<bool> kA
+ BASE_DECLARE_FEATURE(kExtensionsMenuInAppMenu);
+ bool IsExtensionMenuInRootAppMenu();
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kFewerUpdateConfirmations);
+ #endif
+
+@@ -277,7 +277,7 @@ BASE_DECLARE_FEATURE(kViewsJSAppModalDia
+
+ BASE_DECLARE_FEATURE(kStopLoadingAnimationForHiddenWindow);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kUsePortalAccentColor);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_ui_views_accelerator__table.cc b/electron34/patches/patch-chrome_browser_ui_views_accelerator__table.cc
new file mode 100644
index 0000000000..935d780590
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_accelerator__table.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/accelerator_table.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/accelerator_table.cc
+@@ -68,11 +68,11 @@ const AcceleratorMapping kAcceleratorMap
+ {ui::VKEY_S, ui::EF_PLATFORM_ACCELERATOR, IDC_SAVE_PAGE},
+ {ui::VKEY_9, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_LAST_TAB},
+ {ui::VKEY_NUMPAD9, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_LAST_TAB},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_9, ui::EF_ALT_DOWN, IDC_SELECT_LAST_TAB},
+ {ui::VKEY_NUMPAD9, ui::EF_ALT_DOWN, IDC_SELECT_LAST_TAB},
+ #endif // BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_NEXT, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN, IDC_MOVE_TAB_NEXT},
+ {ui::VKEY_PRIOR, ui::EF_CONTROL_DOWN | ui::EF_SHIFT_DOWN,
+ IDC_MOVE_TAB_PREVIOUS},
+@@ -100,7 +100,7 @@ const AcceleratorMapping kAcceleratorMap
+ {ui::VKEY_NUMPAD7, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_6},
+ {ui::VKEY_8, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_7},
+ {ui::VKEY_NUMPAD8, ui::EF_PLATFORM_ACCELERATOR, IDC_SELECT_TAB_7},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_1, ui::EF_ALT_DOWN, IDC_SELECT_TAB_0},
+ {ui::VKEY_NUMPAD1, ui::EF_ALT_DOWN, IDC_SELECT_TAB_0},
+ {ui::VKEY_2, ui::EF_ALT_DOWN, IDC_SELECT_TAB_1},
+@@ -152,7 +152,7 @@ const AcceleratorMapping kAcceleratorMap
+ IDC_SHOW_AVATAR_MENU},
+
+ // Platform-specific key maps.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {ui::VKEY_BROWSER_BACK, ui::EF_NONE, IDC_BACK},
+ {ui::VKEY_BROWSER_FORWARD, ui::EF_NONE, IDC_FORWARD},
+ {ui::VKEY_BROWSER_HOME, ui::EF_NONE, IDC_HOME},
diff --git a/electron34/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc b/electron34/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
new file mode 100644
index 0000000000..d6a4dc1bdd
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
+@@ -19,7 +19,7 @@
+ #include "ui/menus/simple_menu_model.h"
+ #include "ui/views/widget/widget.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/shell_integration_linux.h"
+ #endif
+
+@@ -49,7 +49,7 @@ void ChromeNativeAppWindowViewsAura::OnB
+ const AppWindow::CreateParams& create_params,
+ views::Widget::InitParams* init_params,
+ views::Widget* widget) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string app_name =
+ web_app::GenerateApplicationNameFromAppId(app_window()->extension_id());
+ // Set up a custom WM_CLASS for app windows. This allows task switchers in
diff --git a/electron34/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc b/electron34/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
new file mode 100644
index 0000000000..62505797ce
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+@@ -39,7 +39,7 @@
+ #include "ui/wm/core/wm_state.h"
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -132,7 +132,7 @@ void ChromeBrowserMainExtraPartsViews::P
+ return controller;
+ }));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On the Linux desktop, we want to prevent the user from logging in as root,
+ // so that we don't destroy the profile. Now that we have some minimal ui
+ // initialized, check to see if we're running as root and bail if we are.
diff --git a/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h b/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h
new file mode 100644
index 0000000000..f778bd4571
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/chrome_views_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/chrome_views_delegate.h
+@@ -52,7 +52,7 @@ class ChromeViewsDelegate : public views
+ base::OnceClosure callback) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool WindowManagerProvidesTitleBar(bool maximized) override;
+ gfx::ImageSkia* GetDefaultWindowIcon() const override;
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc b/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
new file mode 100644
index 0000000000..e0ab6298e2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/chrome_views_delegate_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/chrome_views_delegate_linux.cc
+@@ -26,7 +26,7 @@ bool IsDesktopEnvironmentUnity() {
+ return desktop_env == base::nix::DESKTOP_ENVIRONMENT_UNITY;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ int GetWindowIconResourceId() {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ switch (chrome::GetChannel()) {
+@@ -80,7 +80,7 @@ views::NativeWidget* ChromeViewsDelegate
+ delegate);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* ChromeViewsDelegate::GetDefaultWindowIcon() const {
+ ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
+ return rb.GetImageSkiaNamed(GetWindowIconResourceId());
diff --git a/electron34/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc b/electron34/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
new file mode 100644
index 0000000000..266a01cc95
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/compose/compose_dialog_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/compose/compose_dialog_view.cc
+@@ -160,7 +160,7 @@ void ComposeDialogView::OnBeforeBubbleWi
+ views::Widget::InitParams* params,
+ views::Widget* widget) const {
+ WebUIBubbleDialogView::OnBeforeBubbleWidgetInit(params, widget);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // In linux, windows may be clipped to their anchors' bounds,
+ // resulting in visual errors, unless they use accelerated rendering. See
+ // crbug.com/1445770 for details.
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc
new file mode 100644
index 0000000000..d997c1bd94
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_frame.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_frame.cc
+@@ -52,7 +52,7 @@
+ #include "ui/aura/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/display/screen.h"
+ #include "ui/linux/linux_ui.h"
+ #endif
+@@ -87,7 +87,7 @@ class ThemeChangedObserver : public view
+ };
+
+ bool IsUsingLinuxSystemTheme(Profile* profile) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme();
+ #else
+ return false;
+@@ -182,7 +182,7 @@ void BrowserFrame::InitBrowserFrame() {
+
+ Init(std::move(params));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SelectNativeTheme();
+ #else
+ SetNativeTheme(ui::NativeTheme::GetInstanceForNativeUi());
+@@ -369,7 +369,7 @@ void BrowserFrame::OnNativeWidgetWorkspa
+ chrome::SaveWindowWorkspace(browser_view_->browser(), GetWorkspace());
+ chrome::SaveWindowVisibleOnAllWorkspaces(browser_view_->browser(),
+ IsVisibleOnAllWorkspaces());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If the window was sent to a different workspace, prioritize it if
+ // it was sent to the current workspace and deprioritize it
+ // otherwise. This is done by MoveBrowsersInWorkspaceToFront()
+@@ -563,7 +563,7 @@ void BrowserFrame::OnMenuClosed() {
+ }
+
+ void BrowserFrame::SelectNativeTheme() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use the regular NativeTheme instance if running incognito mode, regardless
+ // of system theme (gtk, qt etc).
+ ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
+@@ -604,7 +604,7 @@ void BrowserFrame::OnTouchUiChanged() {
+ bool BrowserFrame::RegenerateFrameOnThemeChange(
+ BrowserThemeChangeType theme_change_type) {
+ bool need_regenerate = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // System and user theme changes can both change frame buttons, so the frame
+ // always needs to be regenerated on Linux.
+ need_regenerate = true;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.h b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.h
new file mode 100644
index 0000000000..e8a296c624
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_frame.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_frame.h
+@@ -66,7 +66,7 @@ class BrowserFrame : public views::Widge
+
+ ~BrowserFrame() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether the frame is in a tiled state.
+ bool tiled() const { return tiled_; }
+ void set_tiled(bool tiled) { tiled_ = tiled; }
+@@ -227,7 +227,7 @@ class BrowserFrame : public views::Widge
+ // contents for smoother dragging.
+ TabDragKind tab_drag_kind_ = TabDragKind::kNone;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool tiled_ = false;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
new file mode 100644
index 0000000000..aefb25b439
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
+@@ -54,7 +54,7 @@ gfx::Insets BrowserFrameViewLayoutLinux:
+ OpaqueBrowserFrameViewLayout::RestoredFrameBorderInsets());
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = delegate_->IsTiled();
+ #else
+ const bool tiled = false;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
new file mode 100644
index 0000000000..ab00001395
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.cc
+@@ -18,7 +18,7 @@ BrowserFrameViewLayoutLinuxNative::~Brow
+
+ ui::WindowFrameProvider* BrowserFrameViewLayoutLinuxNative::GetFrameProvider()
+ const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = delegate_->IsTiled();
+ #else
+ const bool tiled = false;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
new file mode 100644
index 0000000000..ef57a347bf
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_frame_view_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_frame_view_linux.cc
+@@ -70,7 +70,7 @@ gfx::ShadowValues BrowserFrameViewLinux:
+
+ void BrowserFrameViewLinux::PaintRestoredFrameBorder(
+ gfx::Canvas* canvas) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = frame()->tiled();
+ #else
+ const bool tiled = false;
+@@ -125,7 +125,7 @@ int BrowserFrameViewLinux::NonClientHitT
+ }
+
+ float BrowserFrameViewLinux::GetRestoredCornerRadiusDip() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool tiled = frame()->tiled();
+ #else
+ const bool tiled = false;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
new file mode 100644
index 0000000000..d771666376
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
+@@ -15,7 +15,7 @@
+ #include "chrome/browser/ui/views/frame/browser_frame_view_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_layout_linux_native.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_linux_native.h"
+@@ -32,7 +32,7 @@ namespace {
+ std::unique_ptr<OpaqueBrowserFrameView> CreateOpaqueBrowserFrameView(
+ BrowserFrame* frame,
+ BrowserView* browser_view) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* profile = browser_view->browser()->profile();
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ auto* theme_service_factory = ThemeServiceFactory::GetForProfile(profile);
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_browser__view.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__view.cc
new file mode 100644
index 0000000000..be7ad9af4b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_browser__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/browser_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/browser_view.cc
+@@ -2356,7 +2356,7 @@ void BrowserView::ToolbarSizeChanged(boo
+ }
+
+ void BrowserView::TabDraggingStatusChanged(bool is_dragging) {
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ contents_web_view_->SetFastResize(is_dragging);
+ if (!is_dragging) {
+ // When tab dragging is ended, we need to make sure the web contents get
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
new file mode 100644
index 0000000000..dfbccc5c3a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+@@ -54,7 +54,7 @@
+ #include "ui/views/window/vector_icons/vector_icons.h"
+ #include "ui/views/window/window_shape.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/views/controls/menu/menu_runner.h"
+ #endif
+
+@@ -557,7 +557,7 @@ bool OpaqueBrowserFrameView::EverHasVisi
+
+ OpaqueBrowserFrameView::FrameButtonStyle
+ OpaqueBrowserFrameView::GetFrameButtonStyle() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return FrameButtonStyle::kMdButton;
+ #else
+ return FrameButtonStyle::kImageButton;
+@@ -576,7 +576,7 @@ bool OpaqueBrowserFrameView::ShouldDrawR
+ return false;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OpaqueBrowserFrameView::IsTiled() const {
+ return frame()->tiled();
+ }
+@@ -775,7 +775,7 @@ gfx::Rect OpaqueBrowserFrameView::GetIco
+ }
+
+ void OpaqueBrowserFrameView::WindowIconPressed() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Chrome OS doesn't show the window icon, and Windows handles this on its own
+ // due to the hit test being HTSYSMENU.
+ menu_runner_ = std::make_unique<views::MenuRunner>(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
new file mode 100644
index 0000000000..0ce1422433
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view.h
+@@ -110,7 +110,7 @@ class OpaqueBrowserFrameView : public Br
+ FrameButtonStyle GetFrameButtonStyle() const override;
+ void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) override;
+ bool ShouldDrawRestoredFrameShadow() const override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsTiled() const override;
+ #endif
+ int WebAppButtonHeight() const override;
+@@ -227,7 +227,7 @@ class OpaqueBrowserFrameView : public Br
+ // Background painter for the window frame.
+ std::unique_ptr<views::FrameBackground> frame_background_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<views::MenuRunner> menu_runner_;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
new file mode 100644
index 0000000000..0635127bda
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h
+@@ -9,7 +9,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ui_base_types.h"
+ #endif
+
+@@ -92,7 +92,7 @@ class OpaqueBrowserFrameViewLayoutDelega
+ // Returns true if a client-side shadow should be drawn for restored windows.
+ virtual bool ShouldDrawRestoredFrameShadow() const = 0;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether the window is in a tiled state.
+ virtual bool IsTiled() const = 0;
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
new file mode 100644
index 0000000000..f4dbd8a22d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
@@ -0,0 +1,98 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
+@@ -62,7 +62,7 @@
+ #include "ui/aura/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/themes/theme_service.h"
+ #include "chrome/browser/themes/theme_service_factory.h"
+ #include "chrome/browser/ui/views/frame/browser_frame_view_paint_utils_linux.h"
+@@ -83,7 +83,7 @@ constexpr int kContentSettingIconSize =
+ // The height of the controls bar at the top of the window.
+ constexpr int kTopControlsHeight = 34;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Frame border when window shadow is not drawn.
+ constexpr int kFrameBorderThickness = 4;
+ #endif
+@@ -178,7 +178,7 @@ class WindowEventObserver : public ui::E
+
+ gfx::Rect input_bounds = pip_browser_frame_view_->GetLocalBounds();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Calculate input bounds for Linux. This is needed because the input bounds
+ // is not necessary the same as the local bounds on Linux.
+ if (pip_browser_frame_view_->ShouldDrawFrameShadow()) {
+@@ -583,7 +583,7 @@ PictureInPictureBrowserFrameView::Pictur
+ AddChildView(std::move(auto_pip_setting_overlay));
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* profile = browser_view->browser()->profile();
+ auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile);
+ auto* theme_service_factory = ThemeServiceFactory::GetForProfile(profile);
+@@ -796,7 +796,7 @@ void PictureInPictureBrowserFrameView::O
+ for (ContentSettingImageView* view : content_setting_views_)
+ view->SetIconColor(color_provider->GetColor(kColorPipWindowForeground));
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // On Linux the top bar background will be drawn in OnPaint().
+ top_bar_container_view_->SetBackground(views::CreateSolidBackground(
+ color_provider->GetColor(kColorPipWindowTopBarBackground)));
+@@ -876,7 +876,7 @@ void PictureInPictureBrowserFrameView::R
+ BrowserNonClientFrameView::RemovedFromWidget();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Insets
+ PictureInPictureBrowserFrameView::RestoredMirroredFrameBorderInsets() const {
+ auto border = FrameBorderInsets();
+@@ -1166,7 +1166,7 @@ void PictureInPictureBrowserFrameView::A
+ // views::View implementations:
+
+ void PictureInPictureBrowserFrameView::OnPaint(gfx::Canvas* canvas) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Draw the PiP window frame borders and shadows, including the top bar
+ // background.
+ if (window_frame_provider_) {
+@@ -1321,7 +1321,7 @@ void PictureInPictureBrowserFrameView::U
+ }
+
+ gfx::Insets PictureInPictureBrowserFrameView::FrameBorderInsets() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (window_frame_provider_) {
+ const auto insets = window_frame_provider_->GetFrameThicknessDip();
+ const bool tiled = frame()->tiled();
+@@ -1339,7 +1339,7 @@ gfx::Insets PictureInPictureBrowserFrame
+ }
+
+ gfx::Insets PictureInPictureBrowserFrameView::ResizeBorderInsets() const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return FrameBorderInsets();
+ #elif !BUILDFLAG(IS_CHROMEOS)
+ return gfx::Insets(kResizeBorder);
+@@ -1360,7 +1360,7 @@ gfx::Size PictureInPictureBrowserFrameVi
+ top_height + border_thickness.bottom());
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool PictureInPictureBrowserFrameView::ShouldDrawFrameShadow() const {
+ return static_cast<DesktopBrowserFrameAuraLinux*>(
+ frame()->native_browser_frame())
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h b/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
new file mode 100644
index 0000000000..f415e307a3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h
+@@ -28,7 +28,7 @@
+ #include "ui/views/layout/flex_layout_view.h"
+ #include "ui/views/widget/widget_observer.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/window_frame_provider.h"
+ #endif
+
+@@ -88,7 +88,7 @@ class PictureInPictureBrowserFrameView
+ void Layout(PassKey) override;
+ void AddedToWidget() override;
+ void RemovedFromWidget() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Insets RestoredMirroredFrameBorderInsets() const override;
+ gfx::Insets GetInputInsets() const override;
+ SkRRect GetRestoredClipRegion() const override;
+@@ -180,7 +180,7 @@ class PictureInPictureBrowserFrameView
+ // Returns true if there's an overlay view that's currently shown.
+ bool IsOverlayViewVisible() const;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns whether a client-side shadow should be drawn for the window.
+ bool ShouldDrawFrameShadow() const;
+
+@@ -351,7 +351,7 @@ class PictureInPictureBrowserFrameView
+ // `top_bar_color_animation_`.
+ std::optional<SkColor> current_foreground_color_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Used to draw window frame borders and shadow on Linux when GTK theme is
+ // enabled.
+ raw_ptr<ui::WindowFrameProvider> window_frame_provider_ = nullptr;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
new file mode 100644
index 0000000000..577ec8e0e2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/system_menu_model_builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/system_menu_model_builder.cc
+@@ -71,7 +71,7 @@ void SystemMenuModelBuilder::BuildMenu(u
+
+ void SystemMenuModelBuilder::BuildSystemMenuForBrowserWindow(
+ ui::SimpleMenuModel* model) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ model->AddItemWithStringId(IDC_MINIMIZE_WINDOW, IDS_MINIMIZE_WINDOW_MENU);
+ model->AddItemWithStringId(IDC_MAXIMIZE_WINDOW, IDS_MAXIMIZE_WINDOW_MENU);
+ model->AddItemWithStringId(IDC_RESTORE_WINDOW, IDS_RESTORE_WINDOW_MENU);
+@@ -89,7 +89,7 @@ void SystemMenuModelBuilder::BuildSystem
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ model->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ bool supports_server_side_decorations = true;
+ #if BUILDFLAG(IS_OZONE) && !BUILDFLAG(IS_CHROMEOS)
+@@ -163,7 +163,7 @@ void SystemMenuModelBuilder::BuildSystem
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ model->AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER);
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ model->AddItemWithStringId(IDC_CLOSE_WINDOW, IDS_CLOSE);
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
new file mode 100644
index 0000000000..c6b95e46c3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/system_menu_model_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/system_menu_model_delegate.cc
+@@ -20,7 +20,7 @@
+ #include "chromeos/ui/frame/desks/move_to_desks_menu_model.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/common/pref_names.h"
+ #include "components/prefs/pref_service.h"
+ #endif
+@@ -35,7 +35,7 @@ SystemMenuModelDelegate::SystemMenuModel
+ SystemMenuModelDelegate::~SystemMenuModelDelegate() {}
+
+ bool SystemMenuModelDelegate::IsCommandIdChecked(int command_id) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (command_id == IDC_USE_SYSTEM_TITLE_BAR) {
+ PrefService* prefs = browser_->profile()->GetPrefs();
+ return !prefs->GetBoolean(prefs::kUseCustomChromeFrame);
+@@ -55,7 +55,7 @@ bool SystemMenuModelDelegate::IsCommandI
+ }
+
+ bool SystemMenuModelDelegate::IsCommandIdVisible(int command_id) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool is_maximized = browser_->window()->IsMaximized();
+ switch (command_id) {
+ case IDC_MAXIMIZE_WINDOW:
diff --git a/electron34/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc b/electron34/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
new file mode 100644
index 0000000000..037806d9f5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/frame/tab_strip_region_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/frame/tab_strip_region_view.cc
+@@ -219,7 +219,7 @@ TabStripRegionView::TabStripRegionView(s
+ new_tab_button_->GetViewAccessibility().SetName(
+ l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The New Tab Button can be middle-clicked on Linux.
+ new_tab_button_->SetTriggerableEventFlags(
+ new_tab_button_->GetTriggerableEventFlags() |
diff --git a/electron34/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc b/electron34/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc
new file mode 100644
index 0000000000..97b0e42959
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/hats/hats_next_web_dialog.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/hats/hats_next_web_dialog.cc
+@@ -97,8 +97,7 @@ class HatsNextWebDialog::HatsWebView : p
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override {
++ const content::mojom::CreateNewWindowParams& params) override {
+ return true;
+ }
+ content::WebContents* CreateCustomWebContents(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc b/electron34/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc
new file mode 100644
index 0000000000..5278f3bf0c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/hung_renderer_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/hung_renderer_view.cc
+@@ -408,7 +408,7 @@ void HungRendererDialogView::ForceCrashH
+ content::RenderProcessHost* rph =
+ hung_pages_table_model_->GetRenderWidgetHost()->GetProcess();
+ if (rph) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
+ // Instead we send an explicit IPC to crash on the renderer's IO thread.
+ rph->ForceCrash();
diff --git a/electron34/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc b/electron34/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
new file mode 100644
index 0000000000..29082c7c32
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/omnibox/omnibox_view_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+@@ -2005,7 +2005,7 @@ void OmniboxViewViews::MaybeAddSendTabTo
+ }
+
+ void OmniboxViewViews::OnPopupOpened() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // It's not great for promos to overlap the omnibox if the user opens the
+ // drop-down after showing the promo. This especially causes issues on Mac and
+ // Linux due to z-order/rendering issues, see crbug.com/1225046 and
diff --git a/electron34/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc b/electron34/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc
new file mode 100644
index 0000000000..608db698ae
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/overlay/close_image_button.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/overlay/close_image_button.cc
+@@ -4,9 +4,12 @@
+
+ #include "chrome/browser/ui/views/overlay/close_image_button.h"
+
++#include "build/branding_buildflags.h"
+ #include "chrome/browser/ui/color/chrome_color_id.h"
+ #include "chrome/grit/generated_resources.h"
++#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ #include "components/vector_icons/vector_icons.h"
++#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/metadata/metadata_impl_macros.h"
+ #include "ui/base/models/image_model.h"
+@@ -26,7 +29,10 @@ CloseImageButton::CloseImageButton(Press
+ : OverlayWindowImageButton(std::move(callback)) {
+ SetSize(gfx::Size(kCloseButtonSize, kCloseButtonSize));
+
+- auto* icon = &vector_icons::kCloseChromeRefreshIcon;
++ auto* icon = &views::kIcCloseIcon;
++#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
++ icon = &vector_icons::kCloseChromeRefreshIcon;
++#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ SetImageModel(views::Button::STATE_NORMAL,
+ ui::ImageModel::FromVectorIcon(*icon, kColorPipWindowForeground,
+ kCloseButtonIconSize));
diff --git a/electron34/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc b/electron34/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc
new file mode 100644
index 0000000000..fc873dc3df
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc
@@ -0,0 +1,52 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/overlay/video_overlay_window_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/overlay/video_overlay_window_views.cc
+@@ -17,9 +17,11 @@
+ #include "build/build_config.h"
+ #include "chrome/browser/picture_in_picture/picture_in_picture_occlusion_tracker.h"
+ #include "chrome/browser/picture_in_picture/picture_in_picture_window_manager.h"
++#if 0
+ #include "chrome/browser/profiles/profile.h"
+ #include "chrome/browser/ui/browser.h"
+ #include "chrome/browser/ui/browser_finder.h"
++#endif
+ #include "chrome/browser/ui/color/chrome_color_id.h"
+ #include "chrome/browser/ui/views/overlay/back_to_tab_button.h"
+ #include "chrome/browser/ui/views/overlay/back_to_tab_label_button.h"
+@@ -63,7 +65,7 @@
+ #include "ui/aura/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN)
++#if 0
+ #include "chrome/browser/shell_integration_win.h"
+ #include "content/public/browser/render_widget_host_view.h"
+ #include "ui/aura/window.h"
+@@ -323,7 +325,7 @@ std::unique_ptr<VideoOverlayWindowViews>
+ overlay_window->Init(std::move(params));
+ overlay_window->OnRootViewReady();
+
+-#if BUILDFLAG(IS_WIN)
++#if 0
+ std::wstring app_user_model_id;
+ Browser* browser = chrome::FindBrowserWithTab(controller->GetWebContents());
+ if (browser) {
+@@ -356,11 +358,13 @@ std::unique_ptr<VideoOverlayWindowViews>
+
+ #endif // BUILDFLAG(IS_WIN)
+
++#if 0
+ PictureInPictureOcclusionTracker* tracker =
+ PictureInPictureWindowManager::GetInstance()->GetOcclusionTracker();
+ if (tracker) {
+ tracker->OnPictureInPictureWidgetOpened(overlay_window.get());
+ }
++#endif
+
+ return overlay_window;
+ }
diff --git a/electron34/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc b/electron34/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
new file mode 100644
index 0000000000..3227f76720
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/passwords/password_bubble_view_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/passwords/password_bubble_view_base.cc
+@@ -40,7 +40,7 @@
+ #include "ui/base/metadata/metadata_impl_macros.h"
+ #include "ui/views/controls/button/button.h"
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/views/passwords/password_relaunch_chrome_view.h"
+ #endif
+
+@@ -156,7 +156,7 @@ PasswordBubbleViewBase* PasswordBubbleVi
+ } else if (model_state ==
+ password_manager::ui::NOTIFY_RECEIVED_SHARED_CREDENTIALS) {
+ view = new SharedPasswordsNotificationView(web_contents, anchor_view);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ } else if (model_state == password_manager::ui::KEYCHAIN_ERROR_STATE) {
+ view = new RelaunchChromeView(
+ web_contents, anchor_view,
diff --git a/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
new file mode 100644
index 0000000000..6349af41f5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/profiles/profile_menu_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/profiles/profile_menu_view.cc
+@@ -89,7 +89,7 @@
+ #include "ui/strings/grit/ui_strings.h"
+ #include "ui/views/accessibility/view_accessibility.h"
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #endif
+
+@@ -580,7 +580,7 @@ void ProfileMenuView::BuildIdentity() {
+ badge_image_model, menu_title_, menu_subtitle_, management_label);
+ } else {
+ std::string profile_user_display_name, profile_user_email;
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ profile_user_display_name = profile->GetPrefs()->GetString(
+ enterprise_signin::prefs::kProfileUserDisplayName);
+ profile_user_email = profile->GetPrefs()->GetString(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
new file mode 100644
index 0000000000..27bb90c517
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/profiles/profile_menu_view_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc
+@@ -698,7 +698,7 @@ void ProfileMenuViewBase::SetProfileIden
+ image_model, management_badge, this,
+ ProfileMenuViewBase::kIdentityImageSize, kIdentityImageBorder);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // crbug.com/1161166: Orca does not read the accessible window title of the
+ // bubble, so we duplicate it in the top-level menu item. To be revisited
+ // after considering other options, including fixes on the AT side.
diff --git a/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc
new file mode 100644
index 0000000000..38eb6d9406
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/profiles/profile_picker_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/profiles/profile_picker_view.cc
+@@ -85,7 +85,7 @@
+ #include "chrome/browser/global_keyboard_shortcuts_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/shell_integration_linux.h"
+ #endif
+
+@@ -115,7 +115,7 @@ class ProfilePickerWidget : public views
+ views::Widget::InitParams params(
+ views::Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET);
+ params.delegate = profile_picker_view_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ params.wm_class_name = shell_integration_linux::GetProgramClassName();
+ params.wm_class_class = shell_integration_linux::GetProgramClassClass();
+ params.wayland_app_id = params.wm_class_class;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc b/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
new file mode 100644
index 0000000000..526348c497
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
+@@ -58,7 +58,7 @@
+ namespace {
+
+ const int kModalDialogWidth = 448;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const int kManagedUserNoticeConfirmationDialogWidth = 512;
+ const int kManagedUserNoticeConfirmationDialogHeight = 576;
+ const int kManagedUserNoticeConfirmationUpdatedDialogWidth = 780;
+@@ -179,7 +179,7 @@ SigninViewControllerDelegateViews::Creat
+ }
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ std::unique_ptr<views::WebView>
+ SigninViewControllerDelegateViews::CreateManagedUserNoticeConfirmationWebView(
+@@ -338,7 +338,7 @@ SigninViewControllerDelegateViews::Signi
+
+ SetButtons(static_cast<int>(ui::mojom::DialogButton::kNone));
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On the local profile creation dialog, cancelling the dialog (for instance
+ // through the VKEY_ESCAPE accelerator) should delete the profile.
+ if (delete_profile_on_cancel) {
+@@ -426,7 +426,7 @@ void SigninViewControllerDelegateViews::
+ content_view_->RequestFocus();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SigninViewControllerDelegateViews::DeleteProfileOnCancel() {
+ ProfileAttributesEntry* entry =
+ g_browser_process->profile_manager()
+@@ -502,7 +502,7 @@ SigninViewControllerDelegate::CreateProf
+ }
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ SigninViewControllerDelegate*
+ SigninViewControllerDelegate::CreateManagedUserNoticeDelegate(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h b/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
new file mode 100644
index 0000000000..a3b26bc5f0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
+@@ -74,7 +74,7 @@ class SigninViewControllerDelegateViews
+ bool show_supervised_user_iph = false);
+ #endif // BUILDFLAG(ENABLE_DICE_SUPPORT)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static std::unique_ptr<views::WebView>
+ CreateManagedUserNoticeConfirmationWebView(
+ Browser* browser,
+@@ -138,7 +138,7 @@ class SigninViewControllerDelegateViews
+ std::optional<int> dialog_width,
+ InitializeSigninWebDialogUI initialize_signin_web_dialog_ui);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Deletes the ephemeral profile when cancelling the local profile creation
+ // dialog.
+ void DeleteProfileOnCancel();
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab.cc b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab.cc
new file mode 100644
index 0000000000..fcdf6b7224
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab.cc
+@@ -626,7 +626,7 @@ void Tab::MaybeUpdateHoverStatus(const u
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Move the hit test area for hovering up so that it is not overlapped by tab
+ // hover cards when they are shown.
+ // TODO(crbug.com/41467565): Once Linux/CrOS widget transparency is solved,
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.cc b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.cc
new file mode 100644
index 0000000000..7702421b03
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab_close_button.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab_close_button.cc
+@@ -18,7 +18,6 @@
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/metadata/metadata_impl_macros.h"
+ #include "ui/base/pointer/touch_ui_controller.h"
+-#include "ui/compositor/layer.h"
+ #include "ui/gfx/canvas.h"
+ #include "ui/gfx/color_utils.h"
+ #include "ui/gfx/geometry/insets.h"
+@@ -63,8 +62,6 @@ TabCloseButton::TabCloseButton(PressedCa
+ views::InkDrop::Get(this)->GetInkDrop()->SetHoverHighlightFadeDuration(
+ base::TimeDelta());
+
+- image_container_view()->DestroyLayer();
+-
+ // The ink drop highlight path is the same as the focus ring highlight path,
+ // but needs to be explicitly mirrored for RTL.
+ // TODO(http://crbug.com/1056490): Make ink drops in RTL work the same way as
+@@ -145,20 +142,6 @@ void TabCloseButton::OnGestureEvent(ui::
+ event->SetHandled();
+ }
+
+-void TabCloseButton::AddLayerToRegion(ui::Layer* new_layer,
+- views::LayerRegion region) {
+- image_container_view()->SetPaintToLayer();
+- image_container_view()->layer()->SetFillsBoundsOpaquely(false);
+- ink_drop_container()->SetVisible(true);
+- ink_drop_container()->AddLayerToRegion(new_layer, region);
+-}
+-
+-void TabCloseButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
+- ink_drop_container()->RemoveLayerFromRegions(old_layer);
+- ink_drop_container()->SetVisible(false);
+- image_container_view()->DestroyLayer();
+-}
+-
+ gfx::Size TabCloseButton::CalculatePreferredSize(
+ const views::SizeBounds& available_size) const {
+ return kButtonSize;
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.h b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.h
new file mode 100644
index 0000000000..4c45147430
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__close__button.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab_close_button.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab_close_button.h
+@@ -46,9 +46,6 @@ class TabCloseButton : public views::Lab
+ void OnMouseReleased(const ui::MouseEvent& event) override;
+ void OnMouseMoved(const ui::MouseEvent& event) override;
+ void OnGestureEvent(ui::GestureEvent* event) override;
+- void AddLayerToRegion(ui::Layer* new_layer,
+- views::LayerRegion region) override;
+- void RemoveLayerFromRegions(ui::Layer* old_layer) override;
+
+ protected:
+ // Set/reset the image models for the icon with new colors.
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
new file mode 100644
index 0000000000..180f390c4c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab_drag_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab_drag_controller.cc
+@@ -211,7 +211,7 @@ bool IsWindowDragUsingSystemDragDropAllo
+
+ void UpdateSystemDnDDragImage(TabDragContext* attached_context,
+ const gfx::ImageSkia& image) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ aura::Window* root_window =
+ attached_context->GetWidget()->GetNativeWindow()->GetRootWindow();
+ if (aura::client::GetDragDropClient(root_window)) {
+@@ -411,7 +411,7 @@ TabDragController::Liveness TabDragContr
+ // synchronous on desktop Linux, so use that.
+ // - ChromeOS Ash
+ // Releasing capture on Ash cancels gestures so avoid it.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ref->can_release_capture_ = false;
+ #endif
+ ref->start_point_in_screen_ =
+@@ -1015,7 +1015,7 @@ TabDragController::DragBrowserToNewTabSt
+ else
+ SetCapture(target_context);
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // EndMoveLoop is going to snap the window back to its original location.
+ // Hide it so users don't see this. Hiding a window in Linux aura causes
+ // it to lose capture so skip it.
+@@ -2078,7 +2078,7 @@ void TabDragController::CompleteDrag() {
+ }
+
+ // If source window was maximized - maximize the new window as well.
+-#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Keeping maximized state breaks snap to Grid on Windows when dragging
+ // tabs from maximized windows. TODO:(crbug.com/727051) Explore doing this
+ // for other desktop OS's. kMaximizedStateRetainedOnTabDrag in
+@@ -2526,7 +2526,7 @@ TabDragController::Liveness TabDragContr
+ exclude.insert(dragged_window);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Exclude windows which are pending deletion via Browser::TabStripEmpty().
+ // These windows can be returned in the Linux Aura port because the browser
+ // window which was used for dragging is not hidden once all of its tabs are
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
new file mode 100644
index 0000000000..751b625b08
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
+@@ -376,7 +376,7 @@ TabHoverCardBubbleView::TabHoverCardBubb
+ // not become active. Setting this to false creates the need to explicitly
+ // hide the hovercard on press, touch, and keyboard events.
+ SetCanActivate(false);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ set_accept_events(false);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
new file mode 100644
index 0000000000..72eaa4a1f6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/tabs/tab_style_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/tabs/tab_style_views.cc
+@@ -550,7 +550,7 @@ float TabStyleViewsImpl::GetCurrentActiv
+ if (!IsHoverAnimationActive()) {
+ return base_opacity;
+ }
+- return std::lerp(base_opacity, GetHoverOpacity(), GetHoverAnimationValue());
++ return std::lerp(base_opacity, GetHoverOpacity(), static_cast<float>(GetHoverAnimationValue()));
+ }
+
+ TabActive TabStyleViewsImpl::GetApparentActiveState() const {
diff --git a/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.cc b/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.cc
new file mode 100644
index 0000000000..018339a787
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/toolbar/toolbar_button.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/toolbar/toolbar_button.cc
+@@ -128,6 +128,12 @@ ToolbarButton::ToolbarButton(PressedCall
+ if (model_) {
+ GetViewAccessibility().SetHasPopup(ax::mojom::HasPopup::kMenu);
+ }
++#if BUILDFLAG(IS_WIN)
++ // Paint image(s) to a layer so that the canvas is snapped to pixel
++ // boundaries.
++ image_container_view()->SetPaintToLayer();
++ image_container_view()->layer()->SetFillsBoundsOpaquely(false);
++#endif
+ }
+
+ ToolbarButton::~ToolbarButton() = default;
+@@ -724,6 +730,24 @@ ToolbarButton::GetActionViewInterface()
+ return std::make_unique<ToolbarButtonActionViewInterface>(this);
+ }
+
++void ToolbarButton::AddLayerToRegion(ui::Layer* new_layer,
++ views::LayerRegion region) {
++#if !BUILDFLAG(IS_WIN)
++ image_container_view()->SetPaintToLayer();
++ image_container_view()->layer()->SetFillsBoundsOpaquely(false);
++#endif
++ ink_drop_container()->SetVisible(true);
++ ink_drop_container()->AddLayerToRegion(new_layer, region);
++}
++
++void ToolbarButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
++ ink_drop_container()->RemoveLayerFromRegions(old_layer);
++ ink_drop_container()->SetVisible(false);
++#if !BUILDFLAG(IS_WIN)
++ image_container_view()->DestroyLayer();
++#endif
++}
++
+ ToolbarButtonActionViewInterface::ToolbarButtonActionViewInterface(
+ ToolbarButton* action_view)
+ : views::LabelButtonActionViewInterface(action_view),
diff --git a/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.h b/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.h
new file mode 100644
index 0000000000..1c11f899c7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_toolbar_toolbar__button.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/toolbar/toolbar_button.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/toolbar/toolbar_button.h
+@@ -132,6 +132,9 @@ class ToolbarButton : public views::Labe
+ void OnGestureEvent(ui::GestureEvent* event) override;
+ std::u16string GetTooltipText(const gfx::Point& p) const override;
+ std::unique_ptr<views::ActionViewInterface> GetActionViewInterface() override;
++ void AddLayerToRegion(ui::Layer* new_layer,
++ views::LayerRegion region) override;
++ void RemoveLayerFromRegions(ui::Layer* old_layer) override;
+
+ // views::ContextMenuController:
+ void ShowContextMenuForViewImpl(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc b/electron34/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
new file mode 100644
index 0000000000..04312221e6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/user_education/browser_user_education_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/user_education/browser_user_education_service.cc
+@@ -872,7 +872,7 @@ void MaybeRegisterChromeFeaturePromos(
+ "defaulted to saved for the first time.")));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // kIPHSupervisedUserProfileSigninFeature
+ registry.RegisterFeature(std::move(
+ FeaturePromoSpecification::CreateForCustomAction(
+@@ -1112,7 +1112,7 @@ void MaybeRegisterChromeFeaturePromos(
+ "Triggered to inform users of the availability of the "
+ "new translate screen feature on the Lens Overlay.")));
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // kIPHDesktopPWAsLinkCapturingLaunch:
+ registry.RegisterFeature(std::move(
+ FeaturePromoSpecification::CreateForCustomAction(
diff --git a/electron34/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc b/electron34/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
new file mode 100644
index 0000000000..175f0faf3c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
@@ -0,0 +1,89 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
+@@ -503,7 +503,7 @@ std::string GetFileExtension(FileExtensi
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SiteConfig GetSiteConfigurationFromAppName(const std::string& app_name) {
+ SiteConfig config;
+ bool is_app_found = false;
+@@ -2031,7 +2031,7 @@ void WebAppIntegrationTestDriver::Delete
+ if (app_name.empty()) {
+ app_name = GetSiteConfiguration(site).app_name;
+ }
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(override_registration_->test_override().IsShortcutCreated(
+ profile(), app_id, app_name));
+ ASSERT_TRUE(
+@@ -3367,7 +3367,7 @@ void WebAppIntegrationTestDriver::CheckR
+ app_state->id, app_state->name);
+ ASSERT_TRUE(icon_color.has_value());
+ ASSERT_THAT(site_config.icon_color, testing::Eq(icon_color.value()));
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_TRUE(override_registration_->test_override().IsRunOnOsLoginEnabled(
+ profile(), app_state->id, app_state->name));
+ #endif
+@@ -3382,7 +3382,7 @@ void WebAppIntegrationTestDriver::CheckR
+ GetAppBySiteMode(after_state_change_action_state_.get(), profile(), site);
+ ASSERT_TRUE(app_state);
+ base::ScopedAllowBlockingForTesting allow_blocking;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ASSERT_FALSE(override_registration_->test_override().IsRunOnOsLoginEnabled(
+ profile(), app_state->id, app_state->name));
+ #endif
+@@ -3392,7 +3392,7 @@ void WebAppIntegrationTestDriver::CheckR
+ void WebAppIntegrationTestDriver::CheckSiteHandlesFile(
+ Site site,
+ FileExtension file_extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!BeforeStateCheckAction(__FUNCTION__)) {
+ return;
+ }
+@@ -3408,7 +3408,7 @@ void WebAppIntegrationTestDriver::CheckS
+ void WebAppIntegrationTestDriver::CheckSiteNotHandlesFile(
+ Site site,
+ FileExtension file_extension) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!BeforeStateCheckAction(__FUNCTION__)) {
+ return;
+ }
+@@ -4228,7 +4228,7 @@ base::FilePath WebAppIntegrationTestDriv
+ base::FilePath shortcut_dir,
+ const std::string& app_name,
+ const webapps::AppId& app_id) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return override_registration_->test_override().GetShortcutPath(
+ profile(), shortcut_dir, app_id, app_name);
+ #else
+@@ -4428,7 +4428,7 @@ bool WebAppIntegrationTestDriver::IsShor
+ const webapps::AppId& id) {
+ base::ScopedAllowBlockingForTesting allow_blocking;
+ bool is_shortcut_and_icon_correct = false;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool is_shortcut_correct =
+ override_registration_->test_override().IsShortcutCreated(profile, id,
+ name);
+@@ -4472,7 +4472,7 @@ bool WebAppIntegrationTestDriver::DoIcon
+ do_icon_colors_match =
+ (expected_icon_pixel_color == shortcut_pixel_color_apps_folder.value());
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SkColor expected_icon_pixel_color =
+ GetSiteConfigurationFromAppName(name).icon_color;
+ std::optional<SkColor> actual_color_install_icon_size =
diff --git a/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
new file mode 100644
index 0000000000..e8ad3f2a71
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/web_applications/web_app_dialogs.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/web_applications/web_app_dialogs.h
+@@ -21,7 +21,7 @@
+ #include "ui/gfx/native_widget_types.h"
+
+ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+- BUILDFLAG(IS_CHROMEOS));
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD));
+
+ class GURL;
+ class Profile;
diff --git a/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
new file mode 100644
index 0000000000..57811e3cb6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc
+@@ -522,7 +522,7 @@ void WebAppUiManagerImpl::MaybeShowIPHPr
+ Browser* browser,
+ Profile* profile,
+ const std::string& app_id) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WebAppProvider* provider = WebAppProvider::GetForWebApps(profile);
+ CHECK(provider);
+
+@@ -748,7 +748,7 @@ void WebAppUiManagerImpl::ClearWebAppSit
+ }
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ const base::Feature& GetPromoFeatureEngagementFromBrowser(
+ const Browser* browser) {
diff --git a/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
new file mode 100644
index 0000000000..f1ca639c9c
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/web_applications/web_app_ui_manager_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
+@@ -223,7 +223,7 @@ class WebAppUiManagerImpl : public Brows
+ UninstallCompleteCallback uninstall_complete_callback,
+ webapps::UninstallResultCode uninstall_code);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ShowIPHPromoForAppsLaunchedViaLinkCapturing(const Browser* browser,
+ const webapps::AppId& app_id,
+ bool is_activated);
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.cc b/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.cc
new file mode 100644
index 0000000000..7e8598fec2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/about/about_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/about/about_ui.cc
+@@ -592,7 +592,7 @@ std::string ChromeURLs(content::BrowserC
+ return html;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::string AboutLinuxProxyConfig() {
+ std::string data;
+ AppendHeader(&data,
+@@ -625,7 +625,7 @@ TermsUIConfig::TermsUIConfig()
+ : AboutUIConfigBase(chrome::kChromeUITermsHost) {}
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ LinuxProxyConfigUI::LinuxProxyConfigUI()
+ : AboutUIConfigBase(chrome::kChromeUILinuxProxyConfigHost) {}
+ #endif
+@@ -677,7 +677,7 @@ void AboutUIHTMLSource::StartDataRequest
+ response =
+ ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(idr);
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ } else if (source_name_ == chrome::kChromeUILinuxProxyConfigHost) {
+ response = AboutLinuxProxyConfig();
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.h b/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.h
new file mode 100644
index 0000000000..db0a177f22
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_about_about__ui.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/about/about_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/about/about_ui.h
+@@ -50,7 +50,7 @@ class TermsUIConfig : public AboutUIConf
+ };
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // chrome://linux-proxy-config
+ class LinuxProxyConfigUI : public AboutUIConfigBase {
+ public:
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc b/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc
new file mode 100644
index 0000000000..2daa8febf7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc
@@ -0,0 +1,122 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/accessibility/accessibility_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/accessibility/accessibility_ui.cc
+@@ -48,6 +48,7 @@
+ #include "content/public/browser/web_contents.h"
+ #include "content/public/browser/web_contents_delegate.h"
+ #include "content/public/browser/web_ui_data_source.h"
++#include "electron/shell/browser/electron_browser_context.h"
+ #include "ui/accessibility/accessibility_features.h"
+ #include "ui/accessibility/ax_updates_and_events.h"
+ #include "ui/accessibility/platform/ax_platform_node.h"
+@@ -174,7 +175,7 @@ base::Value::Dict BuildTargetDescriptor(
+ accessibility_mode);
+ }
+
+-#if !BUILDFLAG(IS_ANDROID)
++#if 0
+ base::Value::Dict BuildTargetDescriptor(Browser* browser) {
+ base::Value::Dict target_data;
+ target_data.Set(kSessionIdField, browser->session_id().id());
+@@ -208,7 +209,7 @@ void HandleAccessibilityRequestCallback(
+ DCHECK(ShouldHandleAccessibilityRequestCallback(path));
+
+ base::Value::Dict data;
+- PrefService* pref = Profile::FromBrowserContext(current_context)->GetPrefs();
++ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(current_context)->prefs();
+ ui::AXMode mode =
+ content::BrowserAccessibilityState::GetInstance()->GetAccessibilityMode();
+ bool is_native_enabled = content::BrowserAccessibilityState::GetInstance()
+@@ -241,7 +242,7 @@ void HandleAccessibilityRequestCallback(
+ data.Set(kViewsAccessibility, features::IsAccessibilityTreeForViewsEnabled());
+
+ std::string pref_api_type =
+- pref->GetString(prefs::kShownAccessibilityApiType);
++ std::string(pref->GetString(prefs::kShownAccessibilityApiType));
+ bool pref_api_type_supported = false;
+
+ std::vector<ui::AXApiType::Type> supported_api_types =
+@@ -308,11 +309,11 @@ void HandleAccessibilityRequestCallback(
+ data.Set(kPagesField, std::move(page_list));
+
+ base::Value::List browser_list;
+-#if !BUILDFLAG(IS_ANDROID)
++#if 0
+ for (Browser* browser : *BrowserList::GetInstance()) {
+ browser_list.Append(BuildTargetDescriptor(browser));
+ }
+-#endif // !BUILDFLAG(IS_ANDROID)
++#endif
+ data.Set(kBrowsersField, std::move(browser_list));
+
+ base::Value::List widgets_list;
+@@ -645,7 +646,8 @@ void AccessibilityUIMessageHandler::SetG
+ const std::string value = CheckJSValue(data.FindString(kValueField));
+
+ if (string_name == kApiTypeField) {
+- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
++ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
++ web_ui()->GetWebContents()->GetBrowserContext())->prefs();
+ pref->SetString(prefs::kShownAccessibilityApiType, value);
+ }
+ }
+@@ -698,7 +700,8 @@ void AccessibilityUIMessageHandler::Requ
+ AXPropertyFilter::ALLOW_EMPTY);
+ AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
+
+- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
++ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
++ web_contents->GetBrowserContext())->prefs();
+ ui::AXApiType::Type api_type =
+ ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
+ std::string accessibility_contents =
+@@ -725,6 +728,7 @@ void AccessibilityUIMessageHandler::Requ
+ AXPropertyFilter::ALLOW_EMPTY);
+ AddPropertyFilters(property_filters, deny, AXPropertyFilter::DENY);
+
++#if 0
+ for (Browser* browser : *BrowserList::GetInstance()) {
+ if (browser->session_id().id() == session_id) {
+ base::Value::Dict result = BuildTargetDescriptor(browser);
+@@ -737,6 +741,7 @@ void AccessibilityUIMessageHandler::Requ
+ return;
+ }
+ }
++#endif
+ #endif // !BUILDFLAG(IS_ANDROID)
+ // No browser with the specified |session_id| was found.
+ base::Value::Dict result;
+@@ -805,11 +810,13 @@ void AccessibilityUIMessageHandler::Stop
+ }
+
+ ui::AXApiType::Type AccessibilityUIMessageHandler::GetRecordingApiType() {
+- PrefService* pref = Profile::FromWebUI(web_ui())->GetPrefs();
+- const std::vector<ui::AXApiType::Type> supported_types =
+- content::AXInspectFactory::SupportedApis();
++ PrefService* pref = static_cast<electron::ElectronBrowserContext*>(
++ web_ui()->GetWebContents()->GetBrowserContext())->prefs();
+ ui::AXApiType::Type api_type =
+ ui::AXApiType::From(pref->GetString(prefs::kShownAccessibilityApiType));
++
++ const std::vector<ui::AXApiType::Type> supported_types =
++ content::AXInspectFactory::SupportedApis();
+ // Check to see if it is in the supported types list.
+ if (std::find(supported_types.begin(), supported_types.end(), api_type) ==
+ supported_types.end()) {
+@@ -879,8 +886,11 @@ void AccessibilityUIMessageHandler::Requ
+ // static
+ void AccessibilityUIMessageHandler::RegisterProfilePrefs(
+ user_prefs::PrefRegistrySyncable* registry) {
++#if 0
+ const std::string_view default_api_type =
+ std::string_view(ui::AXApiType::Type(ui::AXApiType::kBlink));
+ registry->RegisterStringPref(prefs::kShownAccessibilityApiType,
+ std::string(default_api_type));
++ registry->RegisterBooleanPref(prefs::kShowInternalAccessibilityTree, false);
++#endif
+ }
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h b/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h
new file mode 100644
index 0000000000..a8005fe61e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/accessibility/accessibility_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/accessibility/accessibility_ui.h
+@@ -30,6 +30,8 @@ class ScopedAccessibilityMode;
+ class WebContents;
+ } // namespace content
+
++class ElectronAccessibilityUIMessageHandler;
++
+ namespace user_prefs {
+ class PrefRegistrySyncable;
+ } // namespace user_prefs
+@@ -80,6 +82,8 @@ class AccessibilityUIMessageHandler : pu
+ static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
+
+ private:
++ friend class ElectronAccessibilityUIMessageHandler;
++
+ // Applies `mode` to `web_contents` for the lifetime of the accessibility
+ // UI page.
+ void SetAccessibilityModeForWebContents(content::WebContents* web_contents,
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
new file mode 100644
index 0000000000..cc4b4dbe11
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/app_home/app_home_page_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/app_home/app_home_page_handler.cc
+@@ -62,7 +62,7 @@
+ #include "ui/base/window_open_disposition_utils.h"
+ #include "url/gurl.h"
+
+-static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX));
++static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD));
+
+ using content::WebUI;
+ using extensions::Extension;
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h b/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h
new file mode 100644
index 0000000000..f1ca1d47c0
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/app_home/app_home_page_handler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/app_home/app_home_page_handler.h
+@@ -24,7 +24,7 @@
+ #include "mojo/public/cpp/bindings/receiver.h"
+ #include "mojo/public/cpp/bindings/remote.h"
+
+-static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX));
++static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD));
+
+ class ExtensionEnableFlow;
+
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_app__settings_web__app__settings__ui.h b/electron34/patches/patch-chrome_browser_ui_webui_app__settings_web__app__settings__ui.h
new file mode 100644
index 0000000000..d29a2eb7e5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_app__settings_web__app__settings__ui.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/app_settings/web_app_settings_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/app_settings/web_app_settings_ui.h
+@@ -14,13 +14,13 @@
+ #include "ui/webui/mojo_web_ui_controller.h"
+ #include "ui/webui/resources/cr_components/app_management/app_management.mojom-forward.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/common/webui_url_constants.h"
+ #include "content/public/browser/webui_config.h"
+ #include "content/public/common/url_constants.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class WebAppSettingsUI;
+
+ class WebAppSettingsUIConfig
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc
new file mode 100644
index 0000000000..2a256df9ec
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/certificate_manager/certificate_manager_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/certificate_manager/certificate_manager_handler.cc
+@@ -216,7 +216,7 @@ CertificateManagerPageHandler::GetCertSo
+ CERTIFICATE_TRUST_TYPE_DISTRUSTED,
+ profile_, &remote_client_);
+ break;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case certificate_manager_v2::mojom::CertificateSource::
+ kProvisionedClientCert:
+ source_ptr = CreateProvisionedClientCertSource(profile_);
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc
new file mode 100644
index 0000000000..f3046dcd2b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/certificate_manager/client_cert_sources.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/certificate_manager/client_cert_sources.cc
+@@ -54,7 +54,7 @@
+ #include "net/ssl/client_cert_store_mac.h"
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/client_certificates/certificate_provisioning_service_factory.h"
+ #include "components/enterprise/client_certificates/core/certificate_provisioning_service.h"
+ #include "components/enterprise/client_certificates/core/client_certificates_service.h"
+@@ -177,7 +177,7 @@ class ClientCertStoreFactoryMac : public
+ };
+ #endif
+
+-#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ std::unique_ptr<ClientCertStoreLoader> CreatePlatformClientCertLoader(
+ Profile* profile) {
+ #if BUILDFLAG(IS_WIN)
+@@ -192,7 +192,7 @@ std::unique_ptr<ClientCertStoreLoader> C
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // ClientCertStore implementation that always returns an empty list. The
+ // CertificateProvisioningService implementation expects to wrap a platform
+ // cert store, but here we only want to get results from the provisioning
+@@ -350,7 +350,7 @@ class ClientCertSource : public Certific
+ std::optional<net::CertificateList> certs_;
+ };
+
+-#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // ChromeOS currently can use either Kcer or NSS for listing client certs, and
+ // Linux uses NSS only. This interface provides an abstraction to hide that
+ // from WritableClientCertSource. Currently this class only handles reading
+@@ -1057,7 +1057,7 @@ CreatePlatformClientCertSource(
+ mojo::Remote<certificate_manager_v2::mojom::CertificateManagerPage>*
+ remote_client,
+ Profile* profile) {
+-#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<WritableClientCertSource>(remote_client, profile);
+ #else
+ return std::make_unique<ClientCertSource>(
+@@ -1065,7 +1065,7 @@ CreatePlatformClientCertSource(
+ #endif
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<CertificateManagerPageHandler::CertSource>
+ CreateProvisionedClientCertSource(Profile* profile) {
+ return std::make_unique<ClientCertSource>(
+@@ -1116,7 +1116,7 @@ bool ClientCertManagementAccessControls:
+
+ return client_cert_policy_ == ClientCertificateManagementPermission::kAll;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ClientCertManagementAccessControls::ClientCertManagementAccessControls(
+ Profile* profile) {}
+
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h
new file mode 100644
index 0000000000..849c5358b8
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/certificate_manager/client_cert_sources.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/certificate_manager/client_cert_sources.h
+@@ -19,7 +19,7 @@ CreatePlatformClientCertSource(
+ remote_client,
+ Profile* profile);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<CertificateManagerPageHandler::CertSource>
+ CreateProvisionedClientCertSource(Profile* profile);
+ #endif
+@@ -29,7 +29,7 @@ std::unique_ptr<CertificateManagerPageHa
+ CreateExtensionsClientCertSource(Profile* profile);
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class ClientCertManagementAccessControls {
+ public:
+ enum KeyStorage {
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__configs.cc b/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__configs.cc
new file mode 100644
index 0000000000..a9fa4e1059
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__configs.cc
@@ -0,0 +1,104 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/chrome_web_ui_configs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/chrome_web_ui_configs.cc
+@@ -139,30 +139,30 @@
+ #include "chrome/browser/ui/webui/conflicts/conflicts_ui.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/webui_js_error/webui_js_error_ui.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/app_settings/web_app_settings_ui.h"
+ #include "chrome/browser/ui/webui/browser_switch/browser_switch_ui.h"
+ #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+ // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/connectors_internals/connectors_internals_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/discards/discards_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -198,7 +198,7 @@
+ #include "chrome/browser/ui/webui/signin/signin_error_ui.h"
+ #endif // !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/on_device_translation_internals/on_device_translation_internals_ui.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+@@ -326,14 +326,14 @@ void RegisterChromeWebUIConfigs() {
+ map.AddWebUIConfig(std::make_unique<WebuiGalleryUIConfig>());
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(std::make_unique<WebUIJsErrorUIConfig>());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(std::make_unique<LinuxProxyConfigUI>());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+- // BUILDFLAG(IS_OPENBSD)
++ // BUILDFLAG(IS_BSD)
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+ map.AddWebUIConfig(std::make_unique<extensions::ExtensionsUIConfig>());
+@@ -355,7 +355,7 @@ void RegisterChromeWebUIConfigs() {
+ map.AddWebUIConfig(std::make_unique<ConflictsUIConfig>());
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(std::make_unique<BrowserSwitchUIConfig>());
+ map.AddWebUIConfig(std::make_unique<WebAppSettingsUIConfig>());
+ map.AddWebUIConfig(std::make_unique<WhatsNewUIConfig>());
+@@ -363,20 +363,20 @@ void RegisterChromeWebUIConfigs() {
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(std::make_unique<SandboxInternalsUIConfig>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+ // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(
+ std::make_unique<enterprise_connectors::ConnectorsInternalsUIConfig>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ map.AddWebUIConfig(std::make_unique<DiscardsUIConfig>());
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc b/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
new file mode 100644
index 0000000000..25f61ea5d6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+@@ -123,16 +123,16 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/commerce/product_specifications_ui.h"
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/sandbox/sandbox_internals_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/whats_new/whats_new_ui.h"
+ #endif
+
+@@ -412,7 +412,7 @@ base::RefCountedMemory* ChromeWebUIContr
+ if (page_url.host_piece() == chrome::kChromeUINewTabPageHost)
+ return NewTabPageUI::GetFaviconResourceBytes(scale_factor);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (page_url.host_piece() == chrome::kChromeUIWhatsNewHost)
+ return WhatsNewUI::GetFaviconResourceBytes(scale_factor);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -440,7 +440,7 @@ base::RefCountedMemory* ChromeWebUIContr
+ return ManagementUI::GetFaviconResourceBytes(scale_factor);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (page_url.host_piece() == commerce::kChromeUICompareHost) {
+ return commerce::ProductSpecificationsUI::GetFaviconResourceBytes(
+ scale_factor);
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc b/electron34/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
new file mode 100644
index 0000000000..b2f0769eb4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/connectors_internals/device_trust_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/connectors_internals/device_trust_utils.cc
+@@ -7,7 +7,7 @@
+ #include "build/build_config.h"
+ #include "components/enterprise/buildflags/buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/base64url.h"
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/policy/chrome_browser_policy_connector.h"
+@@ -38,7 +38,7 @@ namespace enterprise_connectors::utils {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+
+ connectors_internals::mojom::KeyTrustLevel ParseTrustLevel(
+ BPKUR::KeyTrustLevel trust_level) {
+@@ -173,7 +173,7 @@ connectors_internals::mojom::Certificate
+ } // namespace
+
+ connectors_internals::mojom::KeyInfoPtr GetKeyInfo() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ auto* key_manager = g_browser_process->browser_policy_connector()
+ ->chrome_browser_cloud_management_controller()
+ ->GetDeviceTrustKeyManager();
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_internals_user__education_user__education__internals__page__handler__impl.cc b/electron34/patches/patch-chrome_browser_ui_webui_internals_user__education_user__education__internals__page__handler__impl.cc
new file mode 100644
index 0000000000..3a62303d7d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_internals_user__education_user__education__internals__page__handler__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/internals/user_education/user_education_internals_page_handler_impl.cc
+@@ -44,7 +44,7 @@
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/webui/resource_path.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/browser_navigator.h"
+ #include "chrome/browser/ui/browser_navigator_params.h"
+ #include "net/base/url_util.h"
+@@ -84,7 +84,7 @@ user_education::NewBadgeRegistry* GetNew
+ }
+
+ whats_new::WhatsNewRegistry* GetWhatsNewRegistry() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return g_browser_process->GetFeatures()->whats_new_registry();
+ #else
+ return nullptr;
+@@ -773,7 +773,7 @@ void UserEducationInternalsPageHandlerIm
+ }
+
+ void UserEducationInternalsPageHandlerImpl::LaunchWhatsNewStaging() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ GURL url = net::AppendQueryParameter(GURL(chrome::kChromeUIWhatsNewURL),
+ "staging", "true");
+ NavigateParams params(profile_, url, ui::PAGE_TRANSITION_TYPED);
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc b/electron34/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc
new file mode 100644
index 0000000000..6ff5a8cb90
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/interstitials/interstitial_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+@@ -74,7 +74,7 @@
+ #include "components/security_interstitials/content/captive_portal_blocking_page.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/supervised_user/supervised_user_verification_controller_client.h"
+ #include "chrome/browser/supervised_user/supervised_user_verification_page_blocked_sites.h"
+ #include "chrome/browser/supervised_user/supervised_user_verification_page_youtube.h"
+@@ -395,7 +395,7 @@ std::unique_ptr<EnterpriseWarnPage> Crea
+ kRequestUrl));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<SupervisedUserVerificationPageForYouTube>
+ CreateSupervisedUserVerificationPageForYouTube(
+ content::WebContents* web_contents,
+@@ -612,7 +612,7 @@ void InterstitialHTMLSource::StartDataRe
+ interstitial_delegate = CreateInsecureFormPage(web_contents);
+ } else if (path_without_query == "/https_only") {
+ interstitial_delegate = CreateHttpsOnlyModePage(web_contents);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ } else if (path_without_query == "/supervised-user-verify") {
+ interstitial_delegate = CreateSupervisedUserVerificationPageForYouTube(
+ web_contents, /*is_main_frame=*/true);
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui.cc b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui.cc
new file mode 100644
index 0000000000..40686ac916
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/management/management_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/management/management_ui.cc
+@@ -185,11 +185,11 @@ void ManagementUI::GetLocalizedStrings(
+ IDS_MANAGEMENT_FILE_TRANSFER_VISIBLE_DATA},
+ {kManagementReportFileEvents, IDS_MANAGEMENT_REPORT_FILE_EVENTS},
+ #endif // BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {kManagementScreenCaptureEvent, IDS_MANAGEMENT_SCREEN_CAPTURE_EVENT},
+ {kManagementScreenCaptureData, IDS_MANAGEMENT_SCREEN_CAPTURE_DATA},
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {kManagementDeviceSignalsDisclosure,
+ IDS_MANAGEMENT_DEVICE_SIGNALS_DISCLOSURE},
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
new file mode 100644
index 0000000000..53e872872a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/management/management_ui_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/management/management_ui_constants.cc
+@@ -89,12 +89,12 @@ const char kProfileReportingExtension[]
+ const char kProfileReportingPolicy[] = "profileReportingPolicy";
+ const char kProfileReportingLearnMore[] = "profileReportingLearnMore";
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kManagementScreenCaptureEvent[] = "managementScreenCaptureEvent";
+ const char kManagementScreenCaptureData[] = "managementScreenCaptureData";
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kManagementDeviceSignalsDisclosure[] =
+ "managementDeviceSignalsDisclosure";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h
new file mode 100644
index 0000000000..d33524b8f1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/management/management_ui_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/management/management_ui_constants.h
+@@ -8,14 +8,14 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Constants defining the IDs for the localized strings sent to the page as
+ // load time data.
+ extern const char kManagementScreenCaptureEvent[];
+ extern const char kManagementScreenCaptureData[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kManagementDeviceSignalsDisclosure[];
+ #endif // #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
new file mode 100644
index 0000000000..0b56b210d2
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/management/management_ui_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/management/management_ui_handler.cc
+@@ -58,7 +58,7 @@
+ #include "ui/base/l10n/l10n_util.h"
+ #include "ui/base/webui/web_ui_util.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/enterprise/signals/user_permission_service_factory.h"
+ #include "components/device_signals/core/browser/user_permission_service.h" // nogncheck
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -349,7 +349,7 @@ void ManagementUIHandler::AddReportingIn
+ report_sources->Append(std::move(data));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto device_signal_data = GetDeviceSignalGrantedMessage();
+ if (!device_signal_data.empty()) {
+ report_sources->Append(std::move(device_signal_data));
+@@ -371,7 +371,7 @@ void ManagementUIHandler::AddReportingIn
+ report_sources->Append(std::move(data));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto device_signal_data = GetDeviceSignalGrantedMessage();
+ if (!device_signal_data.empty()) {
+ report_sources->Append(std::move(device_signal_data));
+@@ -552,7 +552,7 @@ policy::PolicyService* ManagementUIHandl
+ ->policy_service();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ device_signals::UserPermissionService*
+ ManagementUIHandler::GetUserPermissionService() {
+ return enterprise_signals::UserPermissionServiceFactory::GetForProfile(
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h
new file mode 100644
index 0000000000..e95e394165
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/management/management_ui_handler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/management/management_ui_handler.h
+@@ -31,7 +31,7 @@ namespace policy {
+ class PolicyService;
+ } // namespace policy
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace device_signals {
+ class UserPermissionService;
+ } // namespace device_signals
+@@ -72,7 +72,7 @@ class ManagementUIHandler : public conte
+ base::Value::List GetManagedWebsitesInfo(Profile* profile) const;
+ base::Value::List GetApplicationsInfo(Profile* profile) const;
+ virtual policy::PolicyService* GetPolicyService();
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual device_signals::UserPermissionService* GetUserPermissionService();
+ base::Value::Dict GetDeviceSignalGrantedMessage();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
new file mode 100644
index 0000000000..be81cad156
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/password_manager/promo_cards_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/password_manager/promo_cards_handler.cc
+@@ -28,7 +28,7 @@
+ #include "chrome/browser/ui/webui/password_manager/promo_cards/web_password_manager_promo.h"
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.h"
+ #endif
+
+@@ -71,7 +71,7 @@ std::vector<std::unique_ptr<PasswordProm
+ .get()));
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ promo_cards.push_back(
+ std::make_unique<RelaunchChromePromo>(profile->GetPrefs()));
+ #endif
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc b/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
new file mode 100644
index 0000000000..38ebe5b866
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/password_manager/promo_cards/relaunch_chrome_promo.cc
+@@ -37,7 +37,7 @@ std::u16string RelaunchChromePromo::GetT
+ return l10n_util::GetStringUTF16(
+ #if BUILDFLAG(IS_MAC)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_TITLE
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_TITLE_LINUX
+ #endif
+ );
+@@ -47,7 +47,7 @@ std::u16string RelaunchChromePromo::GetD
+ return l10n_util::GetStringUTF16(
+ #if BUILDFLAG(IS_MAC)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_DESCRIPTION
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ IDS_PASSWORD_MANAGER_UI_RELAUNCH_CHROME_PROMO_CARD_DESCRIPTION_LINUX
+ #endif
+ );
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
new file mode 100644
index 0000000000..511b0f9e90
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/searchbox/searchbox_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/searchbox/searchbox_handler.cc
+@@ -108,7 +108,7 @@ const char* kMacShareIconResourceName =
+ #elif BUILDFLAG(IS_WIN)
+ const char* kWinShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/win_share.svg";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char* kLinuxShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/share.svg";
+ #else
+@@ -168,7 +168,7 @@ static void DefineChromeRefreshRealboxIc
+ #elif BUILDFLAG(IS_WIN)
+ kWinShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/win_share_cr23.svg";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kLinuxShareIconResourceName =
+ "//resources/cr_components/searchbox/icons/share_cr23.svg";
+ #else
+@@ -612,7 +612,7 @@ std::string SearchboxHandler::ActionVect
+ icon.name == omnibox::kShareWinChromeRefreshIcon.name) {
+ return kWinShareIconResourceName;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (icon.name == omnibox::kShareIcon.name ||
+ icon.name == omnibox::kShareLinuxChromeRefreshIcon.name) {
+ return kLinuxShareIconResourceName;
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
new file mode 100644
index 0000000000..e3d68fa85e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/settings/appearance_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/settings/appearance_handler.cc
+@@ -34,7 +34,7 @@ void AppearanceHandler::RegisterMessages
+ "useDefaultTheme",
+ base::BindRepeating(&AppearanceHandler::HandleUseTheme,
+ base::Unretained(this), ui::SystemTheme::kDefault));
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ web_ui()->RegisterMessageCallback(
+ "useGtkTheme",
+ base::BindRepeating(&AppearanceHandler::HandleUseTheme,
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc b/electron34/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
new file mode 100644
index 0000000000..471c805770
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+@@ -143,7 +143,7 @@
+ #include "chrome/browser/ui/chrome_pages.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/display/screen.h"
+ #endif
+
+@@ -162,7 +162,7 @@
+ #include "chrome/browser/ui/webui/certificate_manager_localized_strings_provider.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui_factory.h"
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+@@ -283,7 +283,7 @@ void AddA11yStrings(content::WebUIDataSo
+ {"focusHighlightLabel",
+ IDS_SETTINGS_ACCESSIBILITY_FOCUS_HIGHLIGHT_DESCRIPTION},
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ {"overscrollHistoryNavigationTitle",
+ IDS_SETTINGS_OVERSCROLL_HISTORY_NAVIGATION_TITLE},
+ {"overscrollHistoryNavigationSubtitle",
+@@ -556,7 +556,7 @@ void AddAppearanceStrings(content::WebUI
+ {"uiFeatureAlignLeft", IDS_SETTINGS_UI_FEATURE_ALIGN_LEFT},
+ {"uiFeatureAlignRight", IDS_SETTINGS_UI_FEATURE_ALIGN_RIGHT},
+ {"resetToDefault", IDS_SETTINGS_RESET_TO_DEFAULT},
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"gtkTheme", IDS_SETTINGS_GTK_THEME},
+ {"useGtkTheme", IDS_SETTINGS_USE_GTK_THEME},
+ {"qtTheme", IDS_SETTINGS_QT_THEME},
+@@ -564,7 +564,7 @@ void AddAppearanceStrings(content::WebUI
+ {"classicTheme", IDS_SETTINGS_CLASSIC_THEME},
+ {"useClassicTheme", IDS_SETTINGS_USE_CLASSIC_THEME},
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS},
+ #endif
+ #if BUILDFLAG(IS_MAC)
+@@ -590,7 +590,7 @@ void AddAppearanceStrings(content::WebUI
+ html_source->AddBoolean("toolbarPinningEnabled",
+ features::IsToolbarPinningEnabled());
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool show_custom_chrome_frame = ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_server_side_window_decorations;
diff --git a/electron34/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc b/electron34/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc
new file mode 100644
index 0000000000..7ffd41479b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/webui/signin/profile_picker_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/webui/signin/profile_picker_handler.cc
+@@ -195,7 +195,7 @@ base::Value::Dict CreateProfileEntry(con
+
+ if (AccountInfo::IsManaged(entry->GetHostedDomain())) {
+ profile_entry.Set("avatarBadge", "cr:domain");
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ } else if (base::FeatureList::IsEnabled(
+ supervised_user::kShowKiteForSupervisedUsers) &&
+ entry->IsSupervised()) {
+@@ -1074,7 +1074,7 @@ void ProfilePickerHandler::BeginFirstWeb
+ }
+
+ void ProfilePickerHandler::MaybeUpdateGuestMode() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ if (!base::FeatureList::IsEnabled(
+ supervised_user::kHideGuestModeForSupervisedUsers)) {
+ return;
diff --git a/electron34/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc b/electron34/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc
new file mode 100644
index 0000000000..3dcf88ecab
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/ui/window_sizer/window_sizer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/ui/window_sizer/window_sizer.cc
+@@ -214,7 +214,7 @@ void WindowSizer::GetBrowserWindowBounds
+ browser, window_bounds, show_state);
+ }
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux has its own implementation, see WindowSizerLinux.
+ // static
+ void WindowSizer::GetBrowserWindowBoundsAndShowState(
diff --git a/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.cc b/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.cc
new file mode 100644
index 0000000000..3a1b422039
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.cc
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/usb/usb_chooser_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/usb/usb_chooser_controller.cc
+@@ -99,8 +99,8 @@ UsbChooserController::UsbChooserControll
+ CreateChooserTitle(render_frame_host, IDS_USB_DEVICE_CHOOSER_PROMPT)),
+ options_(std::move(options)),
+ callback_(std::move(callback)),
+- requesting_frame_(render_frame_host) {
+- RenderFrameHost* main_frame = requesting_frame_->GetMainFrame();
++ render_frame_host_id_(render_frame_host->GetGlobalId()) {
++ RenderFrameHost* main_frame = render_frame_host->GetMainFrame();
+ origin_ = main_frame->GetLastCommittedOrigin();
+ Profile* profile =
+ Profile::FromBrowserContext(main_frame->GetBrowserContext());
+@@ -202,7 +202,15 @@ void UsbChooserController::Cancel() {
+ void UsbChooserController::Close() {}
+
+ void UsbChooserController::OpenHelpCenterUrl() const {
+- WebContents::FromRenderFrameHost(requesting_frame_)
++ content::RenderFrameHost* render_frame_host =
++ content::RenderFrameHost::FromID(render_frame_host_id_);
++ if (!render_frame_host) {
++ // When |render_frame_host| is not valid anymore we don't want to open help
++ // center url.
++ return;
++ }
++
++ WebContents::FromRenderFrameHost(render_frame_host)
+ ->OpenURL(content::OpenURLParams(
+ GURL(chrome::kChooserUsbOverviewURL), content::Referrer(),
+ WindowOpenDisposition::NEW_FOREGROUND_TAB,
+@@ -266,6 +274,14 @@ void UsbChooserController::GotUsbDeviceL
+
+ bool UsbChooserController::DisplayDevice(
+ const device::mojom::UsbDeviceInfo& device_info) const {
++ content::RenderFrameHost* render_frame_host =
++ content::RenderFrameHost::FromID(render_frame_host_id_);
++ if (!render_frame_host) {
++ // When |render_frame_host| is not valid anymore we don't want to display
++ // any device information.
++ return false;
++ }
++
+ if (!device::UsbDeviceFilterMatchesAny(options_->filters, device_info)) {
+ return false;
+ }
+@@ -280,10 +296,9 @@ bool UsbChooserController::DisplayDevice
+ bool is_usb_unrestricted = false;
+ if (base::FeatureList::IsEnabled(blink::features::kUnrestrictedUsb)) {
+ is_usb_unrestricted =
+- requesting_frame_ &&
+- requesting_frame_->IsFeatureEnabled(
+- blink::mojom::PermissionsPolicyFeature::kUsbUnrestricted) &&
+- content::HasIsolatedContextCapability(requesting_frame_);
++ render_frame_host->IsFeatureEnabled(
++ network::mojom::PermissionsPolicyFeature::kUsbUnrestricted) &&
++ content::HasIsolatedContextCapability(render_frame_host);
+ }
+ // Isolated context with permission to access the policy-controlled feature
+ // "usb-unrestricted" can bypass the USB blocklist.
diff --git a/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.h b/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.h
new file mode 100644
index 0000000000..1f75018ca9
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_usb_usb__chooser__controller.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/usb/usb_chooser_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/usb/usb_chooser_controller.h
+@@ -15,6 +15,7 @@
+ #include "base/scoped_observation.h"
+ #include "chrome/browser/usb/usb_chooser_context.h"
+ #include "components/permissions/chooser_controller.h"
++#include "content/public/browser/global_routing_id.h"
+ #include "services/device/public/mojom/usb_device.mojom.h"
+ #include "third_party/blink/public/mojom/usb/web_usb_service.mojom.h"
+ #include "url/origin.h"
+@@ -64,8 +65,9 @@ class UsbChooserController : public perm
+ blink::mojom::WebUsbService::GetPermissionCallback callback_;
+ url::Origin origin_;
+
+- const raw_ptr<content::RenderFrameHost, AcrossTasksDanglingUntriaged>
+- requesting_frame_;
++ // Hold the GlobalRenderFrameHostId for requesting frame so we can always
++ // check whether the frame host is still valid before we access it.
++ const content::GlobalRenderFrameHostId render_frame_host_id_;
+ base::WeakPtr<UsbChooserContext> chooser_context_;
+ base::ScopedObservation<UsbChooserContext, UsbChooserContext::DeviceObserver>
+ observation_{this};
diff --git a/electron34/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc b/electron34/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
new file mode 100644
index 0000000000..c10104bfec
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/visited_url_ranking/visited_url_ranking_service_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/visited_url_ranking/visited_url_ranking_service_factory.cc
+@@ -44,7 +44,7 @@
+ #include "components/visited_url_ranking/public/visited_url_ranking_service.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/visited_url_ranking/desktop_tab_model_url_visit_data_fetcher.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/visited_url_ranking/android_tab_model_url_visit_data_fetcher.h"
+@@ -118,7 +118,7 @@ VisitedURLRankingServiceFactory::BuildSe
+
+ std::map<Fetcher, std::unique_ptr<URLVisitDataFetcher>> data_fetchers;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ data_fetchers.emplace(
+ Fetcher::kTabModel,
+ std::make_unique<visited_url_ranking::DesktopTabModelURLVisitDataFetcher>(
diff --git a/electron34/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc b/electron34/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc
new file mode 100644
index 0000000000..a07a43dcd1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/commands/launch_web_app_command.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/commands/launch_web_app_command.cc
+@@ -98,7 +98,7 @@ void LaunchWebAppCommand::StartWithLock(
+ // OsIntegrationTestOverride can use the xdg install command to detect
+ // install.
+ SynchronizeOsOptions options;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ options.add_shortcut_to_desktop = true;
+ #endif
+ lock_->os_integration_manager().Synchronize(
diff --git a/electron34/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc b/electron34/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc
new file mode 100644
index 0000000000..61e5f49af3
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/commands/set_user_display_mode_command.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/commands/set_user_display_mode_command.cc
+@@ -57,7 +57,7 @@ void SetUserDisplayModeCommand::StartWit
+ // OsIntegrationTestOverride can use the xdg install command to detect
+ // install.
+ SynchronizeOsOptions options;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ options.add_shortcut_to_desktop = true;
+ #endif
+ app_lock_->os_integration_manager().Synchronize(
diff --git a/electron34/patches/patch-chrome_browser_web__applications_extension__status__utils.h b/electron34/patches/patch-chrome_browser_web__applications_extension__status__utils.h
new file mode 100644
index 0000000000..0327804497
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_extension__status__utils.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/extension_status_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/extension_status_utils.h
+@@ -50,7 +50,7 @@ bool IsExtensionDefaultInstalled(content
+ bool IsExternalExtensionUninstalled(content::BrowserContext* context,
+ const std::string& extension_id);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this method returns true, then |extension_id| will not be launchable.
+ //
+ // The eventual goal is that this method should return true for all hosted apps,
diff --git a/electron34/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc b/electron34/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
new file mode 100644
index 0000000000..e6827990dd
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/extensions/extension_status_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/extensions/extension_status_utils.cc
+@@ -25,7 +25,7 @@ namespace {
+
+ const char* g_preinstalled_app_for_testing = nullptr;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(b/268221237): Remove this allow-list.
+ const char kDefaultAllowedExtensionIds[] =
+ "alhngdkjgnedakdlnamimgfihgkmenbh,"
+@@ -107,7 +107,7 @@ bool IsExternalExtensionUninstalled(cont
+ return prefs && prefs->IsExternalExtensionUninstalled(extension_id);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsExtensionUnsupportedDeprecatedApp(content::BrowserContext* context,
+ const std::string& extension_id) {
+ if (testing::g_enable_chrome_apps_for_testing) {
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc b/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc
new file mode 100644
index 0000000000..4759e25f85
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/os_integration_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/os_integration_manager.cc
+@@ -650,7 +650,7 @@ std::unique_ptr<ShortcutInfo> OsIntegrat
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::vector<WebAppShortcutsMenuItemInfo>& shortcuts_menu_item_infos =
+ app->shortcuts_menu_item_infos();
+ DCHECK_LE(shortcuts_menu_item_infos.size(), kMaxApplicationDockMenuItems);
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h b/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
new file mode 100644
index 0000000000..1a811b0ff4
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/os_integration_test_override.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/os_integration_test_override.h
+@@ -99,7 +99,7 @@ class OsIntegrationTestOverride
+ virtual base::FilePath chrome_apps_folder() = 0;
+ virtual void EnableOrDisablePathOnLogin(const base::FilePath& file_path,
+ bool enable_on_login) = 0;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual base::Environment* environment() = 0;
+ #endif
+
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc b/electron34/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
new file mode 100644
index 0000000000..ff704d6023
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/run_on_os_login_sub_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/run_on_os_login_sub_manager.cc
+@@ -54,7 +54,7 @@ proto::RunOnOsLoginMode ConvertWebAppRun
+ // different from other platforms, see web_app_run_on_os_login_manager.h for
+ // more info.
+ bool DoesRunOnOsLoginRequireExecution() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(features::kDesktopPWAsRunOnOsLogin);
+ #else
+ return false;
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc b/electron34/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
new file mode 100644
index 0000000000..180db9d2ff
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/shortcut_sub_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/shortcut_sub_manager.cc
+@@ -191,7 +191,7 @@ void ShortcutSubManager::Execute(
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Protocol handler update detection. Shortcuts need to be updated in this
+ // case on Linux & Mac because the shortcut itself includes the protocol
+ // handling metadata.
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
new file mode 100644
index 0000000000..94a4ebc25b
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/web_app_file_handler_registration.h
+@@ -43,7 +43,7 @@ void UnregisterFileHandlersWithOs(const
+ const base::FilePath& profile_path,
+ ResultCallback callback);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Exposed for testing purposes. Register the set of
+ // MIME-type-to-file-extensions mappings corresponding to |file_handlers|. File
+ // I/O and callouts to the Linux shell are performed asynchronously.
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
new file mode 100644
index 0000000000..5f59d06dd7
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/web_app_shortcut.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/web_app_shortcut.cc
+@@ -71,7 +71,7 @@ namespace {
+
+ #if BUILDFLAG(IS_MAC)
+ const int kDesiredIconSizesForShortcut[] = {16, 32, 128, 256, 512};
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux supports icons of any size. FreeDesktop Icon Theme Specification states
+ // that "Minimally you should install a 48x48 icon in the hicolor theme."
+ const int kDesiredIconSizesForShortcut[] = {16, 32, 48, 128, 256, 512};
+@@ -253,7 +253,7 @@ std::unique_ptr<ShortcutInfo> BuildShort
+
+ // TODO(crbug.com/40257107): Implement tests on Linux for using shortcuts_menu
+ // actions.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::vector<WebAppShortcutsMenuItemInfo>& shortcuts_menu_item_infos =
+ CreateShortcutsMenuItemInfos(state.shortcut_menus());
+ DCHECK_LE(shortcuts_menu_item_infos.size(), kMaxApplicationDockMenuItems);
diff --git a/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
new file mode 100644
index 0000000000..8b5d46589e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/os_integration/web_app_shortcut.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/os_integration/web_app_shortcut.h
+@@ -21,7 +21,7 @@
+ #include "ui/gfx/image/image_family.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/web_applications/os_integration/web_app_shortcut_linux.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -74,7 +74,7 @@ struct ShortcutInfo {
+ // the installed PWA experience and thus the icons are not designed to be
+ // displayed on an OS dock.
+ bool is_diy_app = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::set<DesktopActionInfo> actions;
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc b/electron34/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
new file mode 100644
index 0000000000..a9c5da31fc
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/policy/web_app_policy_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/policy/web_app_policy_manager.cc
+@@ -106,7 +106,7 @@ namespace web_app {
+
+ BASE_FEATURE(kDesktopPWAsForceUnregisterOSIntegration,
+ "DesktopPWAsForceUnregisterOSIntegration",
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc b/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
new file mode 100644
index 0000000000..038b895d3d
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
@@ -0,0 +1,125 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/test/os_integration_test_override_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/test/os_integration_test_override_impl.cc
+@@ -45,7 +45,7 @@
+ #include "third_party/skia/include/core/SkBitmap.h"
+ #include "third_party/skia/include/core/SkColor.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -130,7 +130,7 @@ std::vector<std::wstring> GetFileExtensi
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Performs a blocking read of app icons from the disk.
+ SkColor IconManagerReadIconTopLeftColorForSize(WebAppIconManager& icon_manager,
+ const webapps::AppId& app_id,
+@@ -265,7 +265,7 @@ bool OsIntegrationTestOverrideImpl::Simu
+ GetShortcutPath(profile, chrome_apps_folder(), app_id, app_name);
+ CHECK(base::PathExists(app_folder_shortcut_path));
+ return base::DeletePathRecursively(app_folder_shortcut_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop_shortcut_path =
+ GetShortcutPath(profile, desktop(), app_id, app_name);
+ LOG(INFO) << desktop_shortcut_path;
+@@ -312,7 +312,7 @@ bool OsIntegrationTestOverrideImpl::Dele
+ }
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OsIntegrationTestOverrideImpl::DeleteDesktopDirOnLinux() {
+ if (desktop_.IsValid()) {
+ return desktop_.Delete();
+@@ -326,7 +326,7 @@ bool OsIntegrationTestOverrideImpl::IsRu
+ Profile* profile,
+ const webapps::AppId& app_id,
+ const std::string& app_name) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string shortcut_filename =
+ "chrome-" + app_id + "-" + profile->GetBaseName().value() + ".desktop";
+ return base::PathExists(startup().Append(shortcut_filename));
+@@ -381,7 +381,7 @@ bool OsIntegrationTestOverrideImpl::IsFi
+ is_file_handled =
+ shell_integration::CanApplicationHandleURL(app_path, test_file_url);
+ base::DeleteFile(test_file_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath user_applications_dir = applications();
+ bool database_update_called = false;
+ for (const LinuxFileRegistration& command : linux_file_registration_) {
+@@ -424,7 +424,7 @@ OsIntegrationTestOverrideImpl::GetShortc
+ return std::nullopt;
+ }
+ return GetIconTopLeftColorFromShortcutFile(shortcut_path);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ WebAppProvider* provider = WebAppProvider::GetForLocalAppsUnchecked(profile);
+ if (!provider) {
+ return std::nullopt;
+@@ -473,7 +473,7 @@ base::FilePath OsIntegrationTestOverride
+ app_installed_profiles.end()) {
+ return shortcut_path;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string shortcut_filename =
+ "chrome-" + app_id + "-" + profile->GetBaseName().value() + ".desktop";
+ base::FilePath shortcut_path = shortcut_dir.Append(shortcut_filename);
+@@ -498,7 +498,7 @@ bool OsIntegrationTestOverrideImpl::IsSh
+ base::FilePath app_shortcut_path =
+ GetShortcutPath(profile, chrome_apps_folder(), app_id, app_name);
+ return base::PathExists(app_shortcut_path);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop_shortcut_path =
+ GetShortcutPath(profile, desktop(), app_id, app_name);
+ return base::PathExists(desktop_shortcut_path);
+@@ -690,7 +690,7 @@ void OsIntegrationTestOverrideImpl::Enab
+ }
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath OsIntegrationTestOverrideImpl::desktop() {
+ return desktop_.GetPath();
+ }
+@@ -741,7 +741,7 @@ OsIntegrationTestOverrideImpl::OsIntegra
+ success = chrome_apps_folder_.CreateUniqueTempDirUnderPath(
+ outer_temp_dir_.GetPath());
+ CHECK(success);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ success = desktop_.CreateUniqueTempDirUnderPath(outer_temp_dir_.GetPath());
+ CHECK(success);
+ success = startup_.CreateUniqueTempDirUnderPath(outer_temp_dir_.GetPath());
+@@ -754,7 +754,7 @@ OsIntegrationTestOverrideImpl::OsIntegra
+ CHECK(success);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto callback = base::BindRepeating([](base::FilePath filename_in,
+ std::string xdg_command,
+ std::string file_contents) {
+@@ -826,7 +826,7 @@ OsIntegrationTestOverrideImpl::~OsIntegr
+ EXPECT_TRUE(!startup_.IsValid() || startup_.Delete());
+ #elif BUILDFLAG(IS_MAC)
+ EXPECT_TRUE(!chrome_apps_folder_.IsValid() || DeleteChromeAppsDir());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_TRUE(!desktop_.IsValid() || desktop_.Delete());
+ EXPECT_TRUE(!startup_.IsValid() || startup_.Delete());
+ EXPECT_TRUE(!xdg_data_home_dir_.IsValid() || xdg_data_home_dir_.Delete());
diff --git a/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h b/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
new file mode 100644
index 0000000000..3e4c158734
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/test/os_integration_test_override_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/test/os_integration_test_override_impl.h
+@@ -40,7 +40,7 @@ class ShellLinkItem;
+
+ namespace web_app {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ struct LinuxFileRegistration {
+ base::FilePath file_name;
+ std::string xdg_command;
+@@ -122,7 +122,7 @@ class OsIntegrationTestOverrideImpl : pu
+ bool DeleteApplicationMenuDirOnWin();
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool DeleteDesktopDirOnLinux();
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -241,7 +241,7 @@ class OsIntegrationTestOverrideImpl : pu
+ base::FilePath chrome_apps_folder() override;
+ void EnableOrDisablePathOnLogin(const base::FilePath& file_path,
+ bool enable_on_login) override;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FilePath desktop();
+ base::FilePath startup();
+ base::FilePath applications();
+@@ -321,7 +321,7 @@ class OsIntegrationTestOverrideImpl : pu
+ base::ScopedTempDir chrome_apps_folder_;
+ std::map<base::FilePath, bool> startup_enabled_;
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedTempDir desktop_;
+ base::ScopedTempDir startup_;
+ base::ScopedTempDir xdg_data_home_dir_;
diff --git a/electron34/patches/patch-chrome_browser_web__applications_web__app__helpers.cc b/electron34/patches/patch-chrome_browser_web__applications_web__app__helpers.cc
new file mode 100644
index 0000000000..a6ad0646eb
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_web__app__helpers.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/web_app_helpers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/web_app_helpers.cc
+@@ -145,7 +145,7 @@ bool IsValidWebAppUrl(const GURL& app_ur
+ return false;
+
+ bool allow_extension_apps = true;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Stop allowing apps to be extension urls when the shortcuts are separated -
+ // they can be extension urls instead.
+ allow_extension_apps =
diff --git a/electron34/patches/patch-chrome_browser_web__applications_web__app__install__info.h b/electron34/patches/patch-chrome_browser_web__applications_web__app__install__info.h
new file mode 100644
index 0000000000..1e28475f1f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_web__applications_web__app__install__info.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/web_applications/web_app_install_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/web_applications/web_app_install_info.h
+@@ -39,7 +39,7 @@
+ #include "url/gurl.h"
+
+ static_assert(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+- BUILDFLAG(IS_CHROMEOS));
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD));
+
+ namespace web_app {
+
diff --git a/electron34/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc b/electron34/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
new file mode 100644
index 0000000000..f2b649601f
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/webauthn/chrome_authenticator_request_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
+@@ -1141,7 +1141,7 @@ void ChromeAuthenticatorRequestDelegate:
+ g_observer->ConfiguringCable(request_type);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // No caBLEv1 on Linux. It tends to crash bluez.
+ if (base::Contains(pairings_from_extension,
+ device::CableDiscoveryData::Version::V1,
diff --git a/electron34/patches/patch-chrome_browser_webauthn_enclave__manager.cc b/electron34/patches/patch-chrome_browser_webauthn_enclave__manager.cc
new file mode 100644
index 0000000000..41883603e5
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_webauthn_enclave__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/webauthn/enclave_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/webauthn/enclave_manager.cc
+@@ -693,7 +693,7 @@ base::flat_set<std::string> GetGaiaIDs(
+
+ std::string UserVerifyingLabelToString(crypto::UserVerifyingKeyLabel label) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ return label;
+ #else
+ return std::string("placeholder");
+@@ -703,7 +703,7 @@ std::string UserVerifyingLabelToString(c
+ std::optional<crypto::UserVerifyingKeyLabel> UserVerifyingKeyLabelFromString(
+ std::string saved_label) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ return saved_label;
+ #else
+ return std::nullopt;
diff --git a/electron34/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc b/electron34/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc
new file mode 100644
index 0000000000..5fc7f25fc6
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/webauthn/gpm_user_verification_policy.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/webauthn/gpm_user_verification_policy.cc
+@@ -17,7 +17,7 @@ bool GpmWillDoUserVerification(device::U
+ return platform_has_biometrics;
+ #elif BUILDFLAG(IS_MAC)
+ return platform_has_biometrics;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ // This default is for unit tests.
diff --git a/electron34/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc b/electron34/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc
new file mode 100644
index 0000000000..94e6110cf1
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/webauthn/unexportable_key_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/webauthn/unexportable_key_utils.cc
+@@ -33,7 +33,7 @@ GetWebAuthnUnexportableKeyProvider() {
+ // If there is a scoped UnexportableKeyProvider configured, we always use
+ // that so that tests can still override the key provider.
+ const bool use_software_provider =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ !crypto::internal::HasScopedUnexportableKeyProvider();
+ #else
+ false;
diff --git a/electron34/patches/patch-chrome_browser_win_chrome__process__finder.cc b/electron34/patches/patch-chrome_browser_win_chrome__process__finder.cc
new file mode 100644
index 0000000000..e1a80a485e
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_win_chrome__process__finder.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/win/chrome_process_finder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/win/chrome_process_finder.cc
+@@ -39,7 +39,9 @@ HWND FindRunningChromeWindow(const base:
+ return base::win::MessageWindow::FindWindow(user_data_dir.value());
+ }
+
+-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window) {
++NotifyChromeResult AttemptToNotifyRunningChrome(
++ HWND remote_window,
++ const base::raw_span<const uint8_t> additional_data) {
+ TRACE_EVENT0("startup", "AttemptToNotifyRunningChrome");
+
+ DCHECK(remote_window);
+@@ -68,12 +70,29 @@ NotifyChromeResult AttemptToNotifyRunnin
+ new_command_line.AppendSwitchNative(switches::kSourceShortcut, si.lpTitle);
+
+ // Send the command line to the remote chrome window.
+- // Format is "START\0<<<current directory>>>\0<<<commandline>>>".
++ // Format is
++ // "START\0<current-directory>\0<command-line>\0<additional-data-length>\0<additional-data>".
+ std::wstring to_send = base::StrCat(
+ {std::wstring_view{L"START\0", 6}, cur_dir.value(),
+ std::wstring_view{L"\0", 1}, new_command_line.GetCommandLineString(),
+ std::wstring_view{L"\0", 1}});
+
++ size_t additional_data_size = additional_data.size_bytes();
++ if (additional_data_size) {
++ // Send over the size, because the reinterpret cast to wchar_t could
++ // add padding.
++ to_send.append(base::UTF8ToWide(base::NumberToString(additional_data_size)));
++ to_send.append(L"\0", 1); // Null separator.
++
++ size_t padded_size = additional_data_size / sizeof(wchar_t);
++ if (additional_data_size % sizeof(wchar_t) != 0) {
++ padded_size++;
++ }
++ to_send.append(reinterpret_cast<const wchar_t*>(additional_data.data()),
++ padded_size);
++ to_send.append(L"\0", 1); // Null separator.
++ }
++
+ // Allow the current running browser window to make itself the foreground
+ // window (otherwise it will just flash in the taskbar).
+ ::AllowSetForegroundWindow(process_id);
diff --git a/electron34/patches/patch-chrome_browser_win_chrome__process__finder.h b/electron34/patches/patch-chrome_browser_win_chrome__process__finder.h
new file mode 100644
index 0000000000..5922994e4a
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_win_chrome__process__finder.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/win/chrome_process_finder.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/win/chrome_process_finder.h
+@@ -7,6 +7,7 @@
+
+ #include <windows.h>
+
++#include "base/memory/raw_span.h"
+ #include "base/time/time.h"
+
+ namespace base {
+@@ -25,7 +26,9 @@ HWND FindRunningChromeWindow(const base:
+ // Attempts to send the current command line to an already running instance of
+ // Chrome via a WM_COPYDATA message.
+ // Returns true if a running Chrome is found and successfully notified.
+-NotifyChromeResult AttemptToNotifyRunningChrome(HWND remote_window);
++NotifyChromeResult AttemptToNotifyRunningChrome(
++ HWND remote_window,
++ const base::raw_span<const uint8_t> additional_data);
+
+ // Changes the notification timeout to |new_timeout|, returns the old timeout.
+ base::TimeDelta SetNotificationTimeoutForTesting(base::TimeDelta new_timeout);
diff --git a/electron34/patches/patch-chrome_browser_win_titlebar__config.cc b/electron34/patches/patch-chrome_browser_win_titlebar__config.cc
new file mode 100644
index 0000000000..6c15bcdc53
--- /dev/null
+++ b/electron34/patches/patch-chrome_browser_win_titlebar__config.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/browser/win/titlebar_config.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/browser/win/titlebar_config.cc
+@@ -12,8 +12,10 @@
+
+ bool ShouldBrowserCustomDrawTitlebar(BrowserView* browser_view) {
+ return !ShouldDefaultThemeUseMicaTitlebar() ||
++#if 0
+ !ThemeServiceFactory::GetForProfile(browser_view->GetProfile())
+ ->UsingSystemTheme() ||
++#endif
+ (!browser_view->browser()->is_type_normal() &&
+ !browser_view->browser()->is_type_popup() &&
+ !browser_view->browser()->is_type_devtools());
diff --git a/electron34/patches/patch-chrome_common_channel__info.h b/electron34/patches/patch-chrome_common_channel__info.h
new file mode 100644
index 0000000000..358a1f71ca
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_channel__info.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/channel_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/channel_info.h
+@@ -12,7 +12,7 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ namespace base {
+ class Environment;
+ }
+@@ -100,7 +100,7 @@ void ClearChannelIdForTesting();
+ std::string GetChannelSuffixForDataDir();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetChannelSuffixForExtraFlagsEnvVarName();
+
+ // Returns the channel-specific filename of the desktop shortcut used to launch
diff --git a/electron34/patches/patch-chrome_common_channel__info__posix.cc b/electron34/patches/patch-chrome_common_channel__info__posix.cc
new file mode 100644
index 0000000000..6831bff718
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_channel__info__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/channel_info_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/channel_info_posix.cc
+@@ -95,7 +95,7 @@ std::string GetChannelSuffixForDataDir()
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetChannelSuffixForExtraFlagsEnvVarName() {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ const auto channel_state = GetChannelImpl();
+@@ -123,7 +123,7 @@ std::string GetChannelSuffixForExtraFlag
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ std::string GetDesktopName(base::Environment* env) {
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ // Google Chrome packaged as a snap is a special case: the application name
diff --git a/electron34/patches/patch-chrome_common_chrome__features.cc b/electron34/patches/patch-chrome_common_chrome__features.cc
new file mode 100644
index 0000000000..acf50ced1f
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__features.cc
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_features.cc
+@@ -83,7 +83,7 @@ BASE_FEATURE(kUseAdHocSigningForWebAppSh
+ #endif // BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Enables or disables the Autofill survey triggered by opening a prompt to
+ // save address info.
+ BASE_FEATURE(kAutofillAddressSurvey,
+@@ -101,7 +101,7 @@ BASE_FEATURE(kAutofillPasswordSurvey,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Enables the Restart background mode optimization. When all Chrome UI is
+ // closed and it goes in the background, allows to restart the browser to
+ // discard memory.
+@@ -240,7 +240,7 @@ BASE_FEATURE(kDesktopPWAsElidedExtension
+ BASE_FEATURE(kDesktopPWAsRunOnOsLogin,
+ "DesktopPWAsRunOnOsLogin",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -266,7 +266,7 @@ BASE_FEATURE(kDesktopPWAsTabStripSetting
+ "DesktopPWAsTabStripSettings",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Controls whether Chrome Apps are supported. See https://crbug.com/1221251.
+ // If the feature is disabled, Chrome Apps continue to work. If enabled, Chrome
+ // Apps will not launch and will be marked in the UI as deprecated.
+@@ -332,7 +332,7 @@ BASE_FEATURE(kForcedAppRelaunchOnPlaceho
+ // of languages.
+ BASE_FEATURE(kGeoLanguage, "GeoLanguage", base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Controls whether the Glic feature is enabled.
+ BASE_FEATURE(kGlic, "Glic", base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+@@ -823,7 +823,7 @@ BASE_FEATURE(kKAnonymityServiceStorage,
+ "KAnonymityServiceStorage",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kLinuxLowMemoryMonitor,
+ "LinuxLowMemoryMonitor",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -836,7 +836,7 @@ constexpr base::FeatureParam<int> kLinux
+ &kLinuxLowMemoryMonitor, "critical_level", 255};
+ #endif // BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kListWebAppsSwitch,
+ "ListWebAppsSwitch",
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-chrome_common_chrome__features.h b/electron34/patches/patch-chrome_common_chrome__features.h
new file mode 100644
index 0000000000..8aa0cc86f6
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__features.h
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_features.h
+@@ -60,13 +60,13 @@ BASE_DECLARE_FEATURE(kUseAdHocSigningFor
+ #endif // BUILDFLAG(IS_MAC)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillAddressSurvey);
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillCardSurvey);
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kAutofillPasswordSurvey);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kBackgroundModeAllowRestart);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -163,7 +163,7 @@ BASE_DECLARE_FEATURE(kDesktopPWAsPrevent
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kDesktopPWAsTabStripSettings);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kChromeAppsDeprecation);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kShortcutsNotApps);
+@@ -218,7 +218,7 @@ BASE_DECLARE_FEATURE(kForcedAppRelaunchO
+
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kGeoLanguage);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kGlic);
+ #endif
+
+@@ -493,7 +493,7 @@ BASE_DECLARE_FEATURE(kKAnonymityServiceO
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ BASE_DECLARE_FEATURE(kKAnonymityServiceStorage);
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kLinuxLowMemoryMonitor);
+ COMPONENT_EXPORT(CHROME_FEATURES)
+ extern const base::FeatureParam<int> kLinuxLowMemoryMonitorModerateLevel;
+@@ -501,7 +501,7 @@ COMPONENT_EXPORT(CHROME_FEATURES)
+ extern const base::FeatureParam<int> kLinuxLowMemoryMonitorCriticalLevel;
+ #endif // BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(CHROME_FEATURES) BASE_DECLARE_FEATURE(kListWebAppsSwitch);
+ #endif
+
diff --git a/electron34/patches/patch-chrome_common_chrome__paths.cc b/electron34/patches/patch-chrome_common_chrome__paths.cc
new file mode 100644
index 0000000000..8814ee31e5
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__paths.cc
@@ -0,0 +1,90 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_paths.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_paths.cc
+@@ -30,7 +30,7 @@
+ #include "base/apple/foundation_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ #include "components/policy/core/common/policy_paths.h"
+ #endif
+
+@@ -52,14 +52,14 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The path to the external extension <id>.json files.
+ // /usr/share seems like a good choice, see: http://www.pathname.com/fhs/
+ const base::FilePath::CharType kFilepathSinglePrefExtensions[] =
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+- FILE_PATH_LITERAL("/usr/share/google-chrome/extensions");
++ FILE_PATH_LITERAL("@PREFIX@/share/chromium/extensions");
+ #else
+- FILE_PATH_LITERAL("/usr/share/chromium/extensions");
++ FILE_PATH_LITERAL("@PREFIX@/share/chromium/extensions");
+ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
+
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -219,7 +219,7 @@ bool PathProvider(int key, base::FilePat
+ }
+ break;
+ case chrome::DIR_DEFAULT_DOWNLOADS_SAFE:
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!GetUserDownloadsDirectorySafe(&cur)) {
+ return false;
+ }
+@@ -525,7 +525,7 @@ bool PathProvider(int key, base::FilePat
+ break;
+ }
+ #endif
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ case chrome::DIR_POLICY_FILES: {
+ cur = base::FilePath(policy::kPolicyPath);
+ break;
+@@ -536,7 +536,7 @@ bool PathProvider(int key, base::FilePat
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
+ BUILDFLAG(CHROMIUM_BRANDING)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case chrome::DIR_USER_EXTERNAL_EXTENSIONS: {
+ if (!base::PathService::Get(chrome::DIR_USER_DATA, &cur)) {
+ return false;
+@@ -545,7 +545,7 @@ bool PathProvider(int key, base::FilePat
+ break;
+ }
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case chrome::DIR_STANDALONE_EXTERNAL_EXTENSIONS: {
+ cur = base::FilePath(kFilepathSinglePrefExtensions);
+ break;
+@@ -583,7 +583,7 @@ bool PathProvider(int key, base::FilePat
+ break;
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD))
+ case chrome::DIR_NATIVE_MESSAGING:
+ #if BUILDFLAG(IS_MAC)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+@@ -597,6 +597,9 @@ bool PathProvider(int key, base::FilePat
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ cur = base::FilePath(
+ FILE_PATH_LITERAL("/etc/opt/chrome/native-messaging-hosts"));
++#elif BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
++ cur = base::FilePath(FILE_PATH_LITERAL(
++ "@PREFIX@/etc/chromium/native-messaging-hosts"));
+ #else
+ cur = base::FilePath(
+ FILE_PATH_LITERAL("/etc/chromium/native-messaging-hosts"));
diff --git a/electron34/patches/patch-chrome_common_chrome__paths.h b/electron34/patches/patch-chrome_common_chrome__paths.h
new file mode 100644
index 0000000000..ace85ee161
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__paths.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_paths.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_paths.h
+@@ -62,7 +62,7 @@ enum {
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
+ BUILDFLAG(CHROMIUM_BRANDING)) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ DIR_USER_EXTERNAL_EXTENSIONS, // Directory for per-user external extensions
+ // on Chrome Mac and Chromium Linux.
+ // On Chrome OS, this path is used for OEM
+@@ -70,7 +70,7 @@ enum {
+ // create it.
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DIR_STANDALONE_EXTERNAL_EXTENSIONS, // Directory for 'per-extension'
+ // definition manifest files that
+ // describe extensions which are to be
+@@ -117,7 +117,7 @@ enum {
+
+ #endif
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD))
+ DIR_NATIVE_MESSAGING, // System directory where native messaging host
+ // manifest files are stored.
+ DIR_USER_NATIVE_MESSAGING, // Directory with Native Messaging Hosts
diff --git a/electron34/patches/patch-chrome_common_chrome__paths__internal.h b/electron34/patches/patch-chrome_common_chrome__paths__internal.h
new file mode 100644
index 0000000000..03da301a57
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__paths__internal.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_paths_internal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_paths_internal.h
+@@ -43,7 +43,7 @@ void GetUserCacheDirectory(const base::F
+ // Get the path to the user's documents directory.
+ bool GetUserDocumentsDirectory(base::FilePath* result);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Gets the path to a safe default download directory for a user.
+ bool GetUserDownloadsDirectorySafe(base::FilePath* result);
+ #endif
diff --git a/electron34/patches/patch-chrome_common_chrome__switches.cc b/electron34/patches/patch-chrome_common_chrome__switches.cc
new file mode 100644
index 0000000000..08bc0673f2
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__switches.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_switches.cc
+@@ -892,7 +892,7 @@ const char kAllowNaClSocketAPI[] = "allo
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ const char kEnableNewAppMenuIcon[] = "enable-new-app-menu-icon";
+
+ // Causes the browser to launch directly in guest mode.
+@@ -902,7 +902,7 @@ const char kGuest[] = "guest";
+ const char kForceNtpMobilePromo[] = "force-ntp-mobile-promo";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Writes open and installed web apps for each profile to the specified file
+ // without launching a new browser window or tab. Pass a absolute file path to
+ // specify where to output the information. Can be used together with optional
diff --git a/electron34/patches/patch-chrome_common_chrome__switches.h b/electron34/patches/patch-chrome_common_chrome__switches.h
new file mode 100644
index 0000000000..9f70e19c2a
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_chrome__switches.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/chrome_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/chrome_switches.h
+@@ -277,13 +277,13 @@ extern const char kAllowNaClSocketAPI[];
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kEnableNewAppMenuIcon[];
+ extern const char kGuest[];
+ extern const char kForceNtpMobilePromo[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ extern const char kListApps[];
+ extern const char kProfileBaseName[];
+ extern const char kProfileManagementAttributes[];
diff --git a/electron34/patches/patch-chrome_common_crash__keys.cc b/electron34/patches/patch-chrome_common_crash__keys.cc
new file mode 100644
index 0000000000..fb1cf37a8a
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_crash__keys.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/crash_keys.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/crash_keys.cc
+@@ -56,7 +56,9 @@ class CrashKeyWithName {
+ ~CrashKeyWithName() = delete;
+
+ std::string_view Name() const { return name_; }
++#if BUILDFLAG(USE_CRASHPAD_ANNOTATION)
+ std::string_view Value() const { return crash_key_.value(); }
++#endif
+ void Clear() { crash_key_.Clear(); }
+ void Set(std::string_view value) { crash_key_.Set(value); }
+
+@@ -201,6 +203,7 @@ void AllocateCrashKeyInBrowserAndChildre
+ GetCommandLineStringAnnotations().emplace_back(std::string(key)).Set(value);
+ }
+
++#if BUILDFLAG(USE_CRASHPAD_ANNOTATION)
+ void AppendStringAnnotationsCommandLineSwitch(base::CommandLine* command_line) {
+ std::string string_annotations;
+ for (const auto& crash_key : GetCommandLineStringAnnotations()) {
+@@ -212,6 +215,7 @@ void AppendStringAnnotationsCommandLineS
+ }
+ command_line->AppendSwitchASCII(kStringAnnotationsSwitch, string_annotations);
+ }
++#endif
+
+ void SetCrashKeysFromCommandLine(const base::CommandLine& command_line) {
+ SetStringAnnotations(command_line);
diff --git a/electron34/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc b/electron34/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
new file mode 100644
index 0000000000..878ce42c38
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/extensions/permissions/chrome_permission_message_rules.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/extensions/permissions/chrome_permission_message_rules.cc
+@@ -285,7 +285,7 @@ int GetEnterpriseReportingPrivatePermiss
+ }
+ #if BUILDFLAG(IS_WIN)
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE_ENABLED_WIN;
+-#elif BUILDFLAG(IS_LINUX) or BUILDFLAG(IS_MAC)
++#elif BUILDFLAG(IS_LINUX) or BUILDFLAG(IS_MAC) or BUILDFLAG(IS_BSD)
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE_ENABLED_LINUX_AND_MACOS;
+ #else
+ return IDS_EXTENSION_PROMPT_WARNING_ENTERPRISE_REPORTING_PRIVATE;
diff --git a/electron34/patches/patch-chrome_common_media_cdm__host__file__path.cc b/electron34/patches/patch-chrome_common_media_cdm__host__file__path.cc
new file mode 100644
index 0000000000..45396d8833
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_media_cdm__host__file__path.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/media/cdm_host_file_path.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/media/cdm_host_file_path.cc
+@@ -90,7 +90,7 @@ void AddCdmHostFilePaths(
+ cdm_host_file_paths->emplace_back(chrome_framework_path,
+ chrome_framework_sig_path);
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ base::FilePath chrome_exe_dir;
+ if (!base::PathService::Get(base::DIR_EXE, &chrome_exe_dir)) {
diff --git a/electron34/patches/patch-chrome_common_media_cdm__registration.cc b/electron34/patches/patch-chrome_common_media_cdm__registration.cc
new file mode 100644
index 0000000000..df219a5432
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_media_cdm__registration.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/media/cdm_registration.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/media/cdm_registration.cc
+@@ -33,7 +33,7 @@
+ #if BUILDFLAG(ENABLE_WIDEVINE)
+ #include "components/cdm/common/cdm_manifest.h"
+ #include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/native_library.h"
+ #include "chrome/common/chrome_paths.h"
+ #include "chrome/common/media/component_widevine_cdm_hint_file_linux.h"
+@@ -86,7 +86,7 @@ void ReportLacrosUMA(LacrosBundledWidevi
+
+ #if (BUILDFLAG(BUNDLE_WIDEVINE_CDM) || \
+ BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT)) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ // Create a CdmInfo for a Widevine CDM, using |version|, |cdm_library_path|, and
+ // |capability|.
+ std::unique_ptr<content::CdmInfo> CreateWidevineCdmInfo(
+@@ -131,7 +131,7 @@ std::unique_ptr<content::CdmInfo> Create
+ // BUILDFLAG(IS_CHROMEOS))
+
+ #if BUILDFLAG(BUNDLE_WIDEVINE_CDM) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ // On Linux/ChromeOS we have to preload the CDM since it uses the zygote
+ // sandbox. On Windows and Mac, CDM registration is handled by Component
+ // Update (as the CDM can be loaded only when needed).
+@@ -185,7 +185,7 @@ std::unique_ptr<content::CdmInfo> GetAsh
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #if (BUILDFLAG(ENABLE_WIDEVINE_CDM_COMPONENT) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH))) || \
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD))) || \
+ BUILDFLAG(IS_CHROMEOS_LACROS)
+ // This code checks to see if Component Updater picked a version of the Widevine
+ // CDM to be used last time it ran. (Component Updater may choose the bundled
+@@ -232,7 +232,7 @@ void AddSoftwareSecureWidevine(std::vect
+ /*supports_sub_key_systems=*/false, kWidevineCdmDisplayName,
+ kWidevineCdmType, base::Version(), base::FilePath());
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
+ base::Version glibc_version(gnu_get_libc_version());
+ DCHECK(glibc_version.IsValid());
+@@ -493,7 +493,7 @@ void RegisterCdmInfo(std::vector<content
+ }
+
+ #if BUILDFLAG(ENABLE_WIDEVINE) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD))
+ std::vector<content::CdmInfo> GetSoftwareSecureWidevine() {
+ std::vector<content::CdmInfo> cdms;
+ AddSoftwareSecureWidevine(&cdms);
diff --git a/electron34/patches/patch-chrome_common_media_cdm__registration.h b/electron34/patches/patch-chrome_common_media_cdm__registration.h
new file mode 100644
index 0000000000..e5ccc02885
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_media_cdm__registration.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/media/cdm_registration.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/media/cdm_registration.h
+@@ -16,7 +16,7 @@
+ void RegisterCdmInfo(std::vector<content::CdmInfo>* cdms);
+
+ #if BUILDFLAG(ENABLE_WIDEVINE) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD))
+ // Returns the software secure Widevine CDM, if one exists.
+ std::vector<content::CdmInfo> GetSoftwareSecureWidevine();
+ #endif
diff --git a/electron34/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h b/electron34/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
new file mode 100644
index 0000000000..1b106fd19d
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/media/component_widevine_cdm_hint_file_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/media/component_widevine_cdm_hint_file_linux.h
+@@ -17,7 +17,7 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++#if !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ #error "This file only applies to desktop Linux and ChromeOS."
+ #endif
+
diff --git a/electron34/patches/patch-chrome_common_pref__names.h b/electron34/patches/patch-chrome_common_pref__names.h
new file mode 100644
index 0000000000..4f16a1c4b9
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_pref__names.h
@@ -0,0 +1,97 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/pref_names.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/pref_names.h
+@@ -1353,7 +1353,7 @@ inline constexpr char kUseAshProxy[] = "
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Linux specific preference on whether we should match the system theme.
+ inline constexpr char kSystemTheme[] = "extensions.theme.system_theme";
+ #endif
+@@ -1530,7 +1530,7 @@ inline constexpr char kShowUpdatePromoti
+ "browser.show_update_promotion_info_bar";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Boolean that is false if we should show window manager decorations. If
+ // true, we draw a custom chrome frame (thicker title bar and blue border).
+ inline constexpr char kUseCustomChromeFrame[] = "browser.custom_chrome_frame";
+@@ -2146,7 +2146,7 @@ inline constexpr char kDownloadDefaultDi
+ inline constexpr char kDownloadDirUpgraded[] = "download.directory_upgrade";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ inline constexpr char kOpenPdfDownloadInSystemReader[] =
+ "download.open_pdf_in_system_reader";
+ #endif
+@@ -2599,14 +2599,14 @@ inline constexpr char kMediaStorageIdSal
+ inline constexpr char kMediaCdmOriginData[] = "media.cdm.origin_data";
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // A boolean pref to determine whether or not the network service is running
+ // sandboxed.
+ inline constexpr char kNetworkServiceSandboxEnabled[] =
+ "net.network_service_sandbox";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Records whether the user has seen an HTTP auth "negotiate" header.
+ inline constexpr char kReceivedHttpAuthNegotiateHeader[] =
+ "net.received_http_auth_negotiate_headers";
+@@ -2684,7 +2684,7 @@ inline constexpr char kAmbientAuthentica
+ inline constexpr char kBasicAuthOverHttpEnabled[] =
+ "auth.basic_over_http_enabled";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Boolean that specifies whether OK-AS-DELEGATE flag from KDC is respected
+ // along with kAuthNegotiateDelegateAllowlist.
+ inline constexpr char kAuthNegotiateDelegateByKdcPolicy[] =
+@@ -3225,7 +3225,7 @@ inline constexpr char kDeviceWeeklySched
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Defines administrator-set availability of Chrome for Testing.
+ inline constexpr char kChromeForTestingAllowed[] = "chrome_for_testing.allowed";
+ #endif
+@@ -3818,7 +3818,7 @@ inline constexpr char kScreenCaptureWith
+ inline constexpr char kSandboxExternalProtocolBlocked[] =
+ "profile.sandbox_external_protocol_blocked";
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Boolean that indicates if system notifications are allowed to be used in
+ // place of Chrome notifications.
+ inline constexpr char kAllowSystemNotifications[] =
+@@ -4085,7 +4085,7 @@ inline constexpr char kLensDesktopNTPSea
+ "policy.lens_desktop_ntp_search_enabled";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // A dict mapping the edition name with the major version it was shown.
+ inline constexpr char kWhatsNewEditionUsed[] = "browser.whats_new.edition_used";
+ // A list containing the features of each module in order of when they
+@@ -4179,7 +4179,7 @@ inline constexpr char kPrintingOAuth2Aut
+ "printing.oauth2_authorization_servers";
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this exists and is true, Chrome may run system DNS resolution out of the
+ // network process. If false, Chrome will run system DNS resolution in the
+ // network process. If non-existent, Chrome will decide where to run system DNS
diff --git a/electron34/patches/patch-chrome_common_url__constants.h b/electron34/patches/patch-chrome_common_url__constants.h
new file mode 100644
index 0000000000..047dc489b0
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_url__constants.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/url_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/url_constants.h
+@@ -968,7 +968,7 @@ inline constexpr char kOutdatedPluginLea
+ inline constexpr char kPhoneHubPermissionLearnMoreURL[] =
+ "https://support.google.com/chromebook?p=multidevice";
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // "Learn more" URL for the chrome apps deprecation dialog.
+ inline constexpr char kChromeAppsDeprecationLearnMoreURL[] =
+ "https://support.google.com/chrome?p=chrome_app_deprecation";
diff --git a/electron34/patches/patch-chrome_common_webui__url__constants.cc b/electron34/patches/patch-chrome_common_webui__url__constants.cc
new file mode 100644
index 0000000000..7322ca189e
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_webui__url__constants.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/webui_url_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/webui_url_constants.cc
+@@ -197,21 +197,21 @@ base::span<const base::cstring_view> Chr
+ kChromeUIAssistantOptInHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ kChromeUIConnectorsInternalsHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ kChromeUIDiscardsHost,
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kChromeUIWebAppSettingsHost,
+ #endif
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
+ kChromeUILinuxProxyConfigHost,
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ kChromeUISandboxHost,
+ #endif
+ #if BUILDFLAG(IS_WIN)
+@@ -282,7 +282,7 @@ base::span<const base::cstring_view> Chr
+ blink::kChromeUIGpuJavaCrashURL,
+ kChromeUIJavaCrashURL,
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ kChromeUIWebUIJsErrorURL,
+ #endif
+ kChromeUIQuitURL,
diff --git a/electron34/patches/patch-chrome_common_webui__url__constants.h b/electron34/patches/patch-chrome_common_webui__url__constants.h
new file mode 100644
index 0000000000..b635fe368e
--- /dev/null
+++ b/electron34/patches/patch-chrome_common_webui__url__constants.h
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/common/webui_url_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/common/webui_url_constants.h
+@@ -578,24 +578,24 @@ inline constexpr char16_t kOsUISystemURL
+ inline constexpr char kOsUIVersionURL[] = "os://version";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ inline constexpr char kChromeUIWebUIJsErrorHost[] = "webuijserror";
+ inline constexpr char kChromeUIWebUIJsErrorURL[] = "chrome://webuijserror/";
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ inline constexpr char kChromeUIConnectorsInternalsHost[] =
+ "connectors-internals";
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ inline constexpr char kChromeUIDiscardsHost[] = "discards";
+ inline constexpr char kChromeUIDiscardsURL[] = "chrome://discards/";
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ inline constexpr char kChromeUIWebAppSettingsHost[] = "app-settings";
+ inline constexpr char kChromeUIWebAppSettingsURL[] = "chrome://app-settings/";
+ inline constexpr char kChromeUIWhatsNewHost[] = "whats-new";
+@@ -607,13 +607,13 @@ inline constexpr char kChromeUILinuxProx
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ inline constexpr char kChromeUISandboxHost[] = "sandbox";
+ #endif
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ inline constexpr char kChromeUIBrowserSwitchHost[] = "browser-switch";
+ inline constexpr char kChromeUIBrowserSwitchURL[] = "chrome://browser-switch/";
+@@ -635,7 +635,7 @@ inline constexpr char kChromeUIProfilePi
+ inline constexpr char kChromeUIProfilePickerUrl[] = "chrome://profile-picker/";
+ #endif
+
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
+ inline constexpr char kChromeUITabModalConfirmDialogHost[] =
diff --git a/electron34/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc b/electron34/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc
new file mode 100644
index 0000000000..9e8469a357
--- /dev/null
+++ b/electron34/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/enterprise_companion/enterprise_companion_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/enterprise_companion/enterprise_companion_client.cc
+@@ -36,7 +36,7 @@ namespace {
+
+ #if BUILDFLAG(IS_MAC)
+ constexpr char kServerName[] = MAC_BUNDLE_IDENTIFIER_STRING ".service";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kServerName[] =
+ "/run/" COMPANY_SHORTNAME_STRING "/" PRODUCT_FULLNAME_STRING "/service.sk";
+ #elif BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-chrome_enterprise__companion_lock.cc b/electron34/patches/patch-chrome_enterprise__companion_lock.cc
new file mode 100644
index 0000000000..84b63fa240
--- /dev/null
+++ b/electron34/patches/patch-chrome_enterprise__companion_lock.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/enterprise_companion/lock.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/enterprise_companion/lock.cc
+@@ -17,7 +17,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kLockName[] = "/" PRODUCT_FULLNAME_STRING ".lock";
+ #elif BUILDFLAG(IS_MAC)
+ constexpr char kLockName[] = MAC_BUNDLE_IDENTIFIER_STRING ".lock";
+@@ -42,7 +42,7 @@ CSecurityDesc GetAdminDaclSecurityDescri
+ namespace enterprise_companion {
+
+ std::unique_ptr<ScopedLock> CreateScopedLock(base::TimeDelta timeout) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return named_system_lock::ScopedLock::Create(kLockName, timeout);
+ #elif BUILDFLAG(IS_WIN)
+ CSecurityAttributes sa =
diff --git a/electron34/patches/patch-chrome_installer_linux_BUILD.gn b/electron34/patches/patch-chrome_installer_linux_BUILD.gn
new file mode 100644
index 0000000000..abd61a6ac2
--- /dev/null
+++ b/electron34/patches/patch-chrome_installer_linux_BUILD.gn
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/installer/linux/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/installer/linux/BUILD.gn
+@@ -77,7 +77,7 @@ if (enable_swiftshader) {
+ packaging_files += [ "$root_out_dir/vk_swiftshader_icd.json" ]
+ }
+
+-if (use_qt) {
++if (use_qt5) {
+ # Even though this is a shared library, add it to `packaging_files` instead of
+ # `packaging_files_shlibs` to skip the dependency check. This is intentional
+ # to prevent a hard dependency on QT for the package.
+@@ -208,7 +208,7 @@ if (build_with_internal_optimization_gui
+ }
+ }
+
+-if (use_qt) {
++if (use_qt5) {
+ strip_binary("strip_qt5_shim") {
+ binary_input = "$root_out_dir/libqt5_shim.so"
+ deps = [ "//ui/qt:qt5_shim" ]
+@@ -406,7 +406,7 @@ group("installer_deps") {
+ "//components/optimization_guide/internal:optimization_guide_internal",
+ ]
+ }
+- if (use_qt) {
++ if (use_qt5) {
+ public_deps += [
+ ":strip_qt5_shim",
+ "//ui/qt:qt5_shim",
diff --git a/electron34/patches/patch-chrome_services_printing_print__backend__service__impl.cc b/electron34/patches/patch-chrome_services_printing_print__backend__service__impl.cc
new file mode 100644
index 0000000000..a831e79526
--- /dev/null
+++ b/electron34/patches/patch-chrome_services_printing_print__backend__service__impl.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/services/printing/print_backend_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/services/printing/print_backend_service_impl.cc
+@@ -50,7 +50,7 @@
+ #include "printing/backend/cups_connection_pool.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/no_destructor.h"
+ #include "ui/linux/linux_ui.h"
+ #include "ui/linux/linux_ui_delegate_stub.h"
+@@ -77,7 +77,7 @@ namespace printing {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void InstantiateLinuxUiDelegate() {
+ // TODO(crbug.com/40561724) Until a real UI can be used in a utility process,
+ // need to use the stub version.
+@@ -86,7 +86,7 @@ void InstantiateLinuxUiDelegate() {
+ #endif
+
+ scoped_refptr<base::SequencedTaskRunner> GetPrintingTaskRunner() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use task runner associated with equivalent of UI thread. Needed for calls
+ // made through `PrintDialogLinuxInterface` to properly execute.
+ CHECK(base::SequencedTaskRunner::HasCurrentDefault());
+@@ -469,7 +469,7 @@ void PrintBackendServiceImpl::Init(
+ // `InitCommon()`.
+ InitializeProcessForPrinting();
+ print_backend_ = PrintBackend::CreateInstance(locale);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Test framework already initializes the UI, so this should not go in
+ // `InitCommon()`. Additionally, low-level Linux UI is not needed when tests
+ // are using `TestPrintingContext`.
+@@ -690,7 +690,7 @@ void PrintBackendServiceImpl::UpdatePrin
+ crash_keys_ = std::make_unique<crash_keys::ScopedPrinterInfo>(
+ *printer_name, print_backend_->GetPrinterDriverInfo(*printer_name));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_CUPS)
+ // Try to fill in advanced settings based upon basic info options.
+ PrinterBasicInfo basic_info;
+ if (print_backend_->GetPrinterBasicInfo(*printer_name, &basic_info) ==
diff --git a/electron34/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc b/electron34/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc
new file mode 100644
index 0000000000..ee2a297c64
--- /dev/null
+++ b/electron34/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/services/speech/audio_source_fetcher_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/services/speech/audio_source_fetcher_impl.cc
+@@ -132,7 +132,7 @@ void AudioSourceFetcherImpl::Start(
+
+ // TODO(crbug.com/40753481): Check implementation / sandbox policy on Mac and
+ // Windows.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ is_started_ = true;
+ // Initialize the AudioCapturerSource with |this| as the CaptureCallback,
+ // get the parameters for the device ID, then start audio capture.
diff --git a/electron34/patches/patch-chrome_test_BUILD.gn b/electron34/patches/patch-chrome_test_BUILD.gn
new file mode 100644
index 0000000000..f23814bcd1
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_BUILD.gn
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/BUILD.gn
+@@ -6818,9 +6818,12 @@ test("unit_tests") {
+ "//chrome/notification_helper",
+ ]
+
++ if (!is_electron_build) {
++ deps += [ "//chrome:packed_resources_integrity_header" ]
++ }
++
+ deps += [
+ "//chrome:other_version",
+- "//chrome:packed_resources_integrity_header",
+ "//chrome//services/util_win:unit_tests",
+ "//chrome/app:chrome_dll_resources",
+ "//chrome/app:win_unit_tests",
+@@ -7762,6 +7765,10 @@ test("unit_tests") {
+ "../browser/performance_manager/policies/background_tab_loading_policy_unittest.cc",
+ ]
+
++ if (!is_electron_build) {
++ deps += [ "//chrome:packed_resources_integrity_header" ]
++ }
++
+ sources += [
+ # The importer code is not used on Android.
+ "../common/importer/firefox_importer_utils_unittest.cc",
+@@ -7814,7 +7821,6 @@ test("unit_tests") {
+ # Non-android deps for "unit_tests" target.
+ deps += [
+ "../browser/screen_ai:screen_ai_install_state",
+- "//chrome:packed_resources_integrity_header",
+ "//chrome/browser/apps:icon_standardizer",
+ "//chrome/browser/apps/app_service",
+ "//chrome/browser/apps/app_service:app_registry_cache_waiter",
diff --git a/electron34/patches/patch-chrome_test_base_scoped__channel__override__posix.cc b/electron34/patches/patch-chrome_test_base_scoped__channel__override__posix.cc
new file mode 100644
index 0000000000..cdf5e4a24e
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_base_scoped__channel__override__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/base/scoped_channel_override_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/base/scoped_channel_override_posix.cc
+@@ -45,7 +45,7 @@ std::string GetVersionExtra(ScopedChanne
+ return "beta";
+ case ScopedChannelOverride::Channel::kDev:
+ return "unstable";
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case ScopedChannelOverride::Channel::kCanary:
+ return "canary";
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-chrome_test_chromedriver_chrome__launcher.cc b/electron34/patches/patch-chrome_test_chromedriver_chrome__launcher.cc
new file mode 100644
index 0000000000..ee6387bcc9
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_chromedriver_chrome__launcher.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/chromedriver/chrome_launcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/chromedriver/chrome_launcher.cc
+@@ -73,6 +73,7 @@
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
++#include <sys/wait.h>
+ #include <unistd.h>
+ #elif BUILDFLAG(IS_WIN)
+ #include <windows.h>
diff --git a/electron34/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc b/electron34/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
new file mode 100644
index 0000000000..e7e146f35e
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/chromedriver/chrome/chrome_finder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/chromedriver/chrome/chrome_finder.cc
+@@ -58,7 +58,7 @@ void GetApplicationDirs(std::vector<base
+ installation_locations[i].Append(L"Chromium\\Application"));
+ }
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void GetApplicationDirs(std::vector<base::FilePath>* locations) {
+ // TODO: Respect users' PATH variables.
+ // Until then, we use an approximation of the most common defaults.
+@@ -125,7 +125,7 @@ std::vector<base::FilePath> GetChromePro
+ chrome::kGoogleChromeForTestingBrowserProcessExecutablePath),
+ base::FilePath(chrome::kGoogleChromeBrowserProcessExecutablePath),
+ base::FilePath(chrome::kChromiumBrowserProcessExecutablePath),
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath(chrome::kBrowserProcessExecutablePath),
+ base::FilePath("chrome"), // Chrome for Testing or Google Chrome
+ base::FilePath("google-chrome"), base::FilePath("chromium"),
+@@ -141,7 +141,7 @@ std::vector<base::FilePath> GetHeadlessS
+ return {
+ #if BUILDFLAG(IS_WIN)
+ base::FilePath(FILE_PATH_LITERAL("chrome-headless-shell.exe")),
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath("chrome-headless-shell"),
+ #else
+ // it will compile but won't work on other OSes
diff --git a/electron34/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc b/electron34/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc
new file mode 100644
index 0000000000..0ed7a3beae
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/chromedriver/key_converter_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/chromedriver/key_converter_unittest.cc
+@@ -251,7 +251,7 @@ TEST(KeyConverter, ToggleModifiers) {
+ CheckEventsReleaseModifiers(keys, key_events);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_AllEnglishKeyboardSymbols DISABLED_AllEnglishKeyboardSymbols
+ #else
+@@ -308,7 +308,7 @@ TEST(KeyConverter, AllEnglishKeyboardTex
+ TEST(KeyConverter, AllSpecialWebDriverKeysOnEnglishKeyboard) {
+ ui::ScopedKeyboardLayout keyboard_layout(ui::KEYBOARD_LAYOUT_ENGLISH_US);
+ const char kTextForKeys[] = {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ 0, 0, 0, 0, '\t', 0, '\r', '\r', 0, 0, 0, 0, 0,
+ #else
+ 0, 0, 0, 0, 0, 0, '\r', '\r', 0, 0, 0, 0, 0,
diff --git a/electron34/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc b/electron34/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
new file mode 100644
index 0000000000..a045a8540f
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/chromedriver/keycode_text_conversion_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/chromedriver/keycode_text_conversion_unittest.cc
+@@ -67,7 +67,7 @@ std::string ConvertKeyCodeToTextNoError(
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_KeyCodeToText DISABLED_KeyCodeToText
+ #else
+@@ -104,7 +104,7 @@ TEST(KeycodeTextConversionTest, MAYBE_Ke
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Fails on bots: crbug.com/174962
+ #define MAYBE_CharToKeyCode DISABLED_CharToKeyCode
+ #else
diff --git a/electron34/patches/patch-chrome_test_supervised__user_google__auth__state__waiter__mixin.cc b/electron34/patches/patch-chrome_test_supervised__user_google__auth__state__waiter__mixin.cc
new file mode 100644
index 0000000000..b6f75e1938
--- /dev/null
+++ b/electron34/patches/patch-chrome_test_supervised__user_google__auth__state__waiter__mixin.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/test/supervised_user/google_auth_state_waiter_mixin.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/test/supervised_user/google_auth_state_waiter_mixin.cc
+@@ -24,7 +24,7 @@ GoogleAuthStateWaiterMixin::GoogleAuthSt
+ GoogleAuthStateWaiterMixin::~GoogleAuthStateWaiterMixin() = default;
+
+ void GoogleAuthStateWaiterMixin::SetUpOnMainThread() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ ChildAccountService* child_account_service =
+ ChildAccountServiceFactory::GetForProfile(
+ test_base_->browser()->profile());
diff --git a/electron34/patches/patch-chrome_updater_app_app__uninstall.cc b/electron34/patches/patch-chrome_updater_app_app__uninstall.cc
new file mode 100644
index 0000000000..3f4be5c521
--- /dev/null
+++ b/electron34/patches/patch-chrome_updater_app_app__uninstall.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/updater/app/app_uninstall.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/updater/app/app_uninstall.cc
+@@ -157,7 +157,7 @@ void UninstallInThreadPool(UpdaterScope
+ }
+ if (int result = UninstallOtherVersions(scope);
+ result != kErrorOk) {
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/366249606): Ignores the errors when uninstalls
+ // the other versions, because currently older Linux updater on
+ // CIPD exits with error `kErrorFailedToDeleteFolder`.
diff --git a/electron34/patches/patch-chrome_updater_configurator.cc b/electron34/patches/patch-chrome_updater_configurator.cc
new file mode 100644
index 0000000000..40a0418d78
--- /dev/null
+++ b/electron34/patches/patch-chrome_updater_configurator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/updater/configurator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/updater/configurator.cc
+@@ -72,7 +72,7 @@ Configurator::Configurator(scoped_refptr
+ return std::nullopt;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ }()) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux creating the NetworkFetcherFactory requires performing blocking IO
+ // to load an external library. This should be done when the configurator is
+ // created.
diff --git a/electron34/patches/patch-chrome_updater_lock.cc b/electron34/patches/patch-chrome_updater_lock.cc
new file mode 100644
index 0000000000..3ea74d6c83
--- /dev/null
+++ b/electron34/patches/patch-chrome_updater_lock.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/updater/lock.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/updater/lock.cc
+@@ -26,7 +26,7 @@ namespace updater {
+ std::unique_ptr<ScopedLock> CreateScopedLock(const std::string& name,
+ UpdaterScope scope,
+ base::TimeDelta timeout) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return named_system_lock::ScopedLock::Create(
+ base::StrCat({"/" PRODUCT_FULLNAME_STRING, name,
+ UpdaterScopeToString(scope), ".lock"}),
diff --git a/electron34/patches/patch-chrome_updater_util_posix__util.cc b/electron34/patches/patch-chrome_updater_util_posix__util.cc
new file mode 100644
index 0000000000..77edc53412
--- /dev/null
+++ b/electron34/patches/patch-chrome_updater_util_posix__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/updater/util/posix_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/updater/util/posix_util.cc
+@@ -20,7 +20,7 @@
+ #include "chrome/updater/updater_branding.h"
+ #include "chrome/updater/util/util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/updater/util/linux_util.h"
+ #endif
+
diff --git a/electron34/patches/patch-chrome_utility_services.cc b/electron34/patches/patch-chrome_utility_services.cc
new file mode 100644
index 0000000000..b2eddedd04
--- /dev/null
+++ b/electron34/patches/patch-chrome_utility_services.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chrome/utility/services.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chrome/utility/services.cc
+@@ -49,7 +49,7 @@
+ #include "chrome/services/system_signals/mac/mac_system_signals_service.h"
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/services/system_signals/linux/linux_system_signals_service.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -207,7 +207,7 @@ auto RunMacNotificationService(
+ }
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto RunSystemSignalsService(
+ mojo::PendingReceiver<device_signals::mojom::SystemSignalsService>
+ receiver) {
+@@ -481,7 +481,7 @@ void RegisterMainThreadServices(mojo::Se
+ services.Add(RunWindowsIconReader);
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ services.Add(RunSystemSignalsService);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-chromecast_browser_cast__browser__main__parts.cc b/electron34/patches/patch-chromecast_browser_cast__browser__main__parts.cc
new file mode 100644
index 0000000000..b1b7acbac7
--- /dev/null
+++ b/electron34/patches/patch-chromecast_browser_cast__browser__main__parts.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chromecast/browser/cast_browser_main_parts.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chromecast/browser/cast_browser_main_parts.cc
+@@ -95,7 +95,7 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif // BUILDFLAG(IS_OZONE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <fontconfig/fontconfig.h>
+ #include <signal.h>
+ #include <sys/prctl.h>
+@@ -268,7 +268,7 @@ class CastViewsDelegate : public views::
+
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ base::FilePath GetApplicationFontsDir() {
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+@@ -314,7 +314,7 @@ const DefaultCommandLineSwitch kDefaultS
+ {switches::kDisableThreadedAnimation, ""},
+ #endif // BUILDFLAG(IS_ANDROID)
+ #endif // BUILDFLAG(IS_CAST_AUDIO_ONLY)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // This is needed for now to enable the x11 Ozone platform to work with
+ // current Linux/NVidia OpenGL drivers.
+@@ -491,7 +491,7 @@ void CastBrowserMainParts::ToolkitInitia
+ views_delegate_ = std::make_unique<CastViewsDelegate>();
+ #endif // defined(USE_AURA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FilePath dir_font = GetApplicationFontsDir();
+ const FcChar8* dir_font_char8 =
+ reinterpret_cast<const FcChar8*>(dir_font.value().data());
diff --git a/electron34/patches/patch-chromecast_browser_cast__content__browser__client.cc b/electron34/patches/patch-chromecast_browser_cast__content__browser__client.cc
new file mode 100644
index 0000000000..8886453996
--- /dev/null
+++ b/electron34/patches/patch-chromecast_browser_cast__content__browser__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chromecast/browser/cast_content_browser_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chromecast/browser/cast_content_browser_client.cc
+@@ -429,7 +429,7 @@ void CastContentBrowserClient::AppendExt
+ switches::kAudioOutputChannels));
+ }
+ } else if (process_type == switches::kGpuProcess) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Necessary for accelerated 2d canvas. By default on Linux, Chromium
+ // assumes GLES2 contexts can be lost to a power-save mode, which breaks GPU
+ // canvas apps.
diff --git a/electron34/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc b/electron34/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
new file mode 100644
index 0000000000..62c2ff0d25
--- /dev/null
+++ b/electron34/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chromecast/cast_core/runtime/browser/runtime_application_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chromecast/cast_core/runtime/browser/runtime_application_service_impl.cc
+@@ -347,7 +347,7 @@ CastWebView::Scoped RuntimeApplicationSe
+ params->force_720p_resolution =
+ GetFlagEntry(feature::kCastCoreForce720p, config_.extra_features(),
+ /*default_value=*/false);
+-#if BUILDFLAG(ENABLE_CAST_RECEIVER) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_CAST_RECEIVER) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ // Starboard-based (linux) cast receivers may not render their UI at 720p, so
+ // we need to scale to the proper resolution. For example, a 4k TV may render
+ // the window at 1920x1080, so a scaling factor of 1.5 is necessary for a 720p
diff --git a/electron34/patches/patch-chromecast_media_base_default__monotonic__clock.cc b/electron34/patches/patch-chromecast_media_base_default__monotonic__clock.cc
new file mode 100644
index 0000000000..9d722d7515
--- /dev/null
+++ b/electron34/patches/patch-chromecast_media_base_default__monotonic__clock.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- chromecast/media/base/default_monotonic_clock.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ chromecast/media/base/default_monotonic_clock.cc
+@@ -11,7 +11,7 @@
+ #include "base/time/time.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "chromecast/media/base/buildflags.h"
+ #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -28,7 +28,7 @@ std::unique_ptr<MonotonicClock> Monotoni
+ return std::make_unique<DefaultMonotonicClock>();
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ int64_t MonotonicClockNow() {
+ timespec now = {0, 0};
+ #if BUILDFLAG(MEDIA_CLOCK_MONOTONIC_RAW)
diff --git a/electron34/patches/patch-components_autofill_core_browser_autofill__optimization__guide.cc b/electron34/patches/patch-components_autofill_core_browser_autofill__optimization__guide.cc
new file mode 100644
index 0000000000..ffeb051843
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_browser_autofill__optimization__guide.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/browser/autofill_optimization_guide.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/browser/autofill_optimization_guide.cc
+@@ -186,7 +186,7 @@ void AutofillOptimizationGuide::OnDidPar
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (has_credit_card_field &&
+ !personal_data_manager->payments_data_manager()
+ .GetServerCreditCards()
diff --git a/electron34/patches/patch-components_autofill_core_browser_payments__data__manager.cc b/electron34/patches/patch-components_autofill_core_browser_payments__data__manager.cc
new file mode 100644
index 0000000000..ed722cd241
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_browser_payments__data__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/browser/payments_data_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/browser/payments_data_manager.cc
+@@ -1090,7 +1090,7 @@ bool PaymentsDataManager::ShouldShowCard
+ // The feature is only for Linux, Windows, Mac, and Fuchsia.
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA)
+ // This option should only be shown for users that have not enabled the Sync
+ // Feature and that have server credit cards available.
diff --git a/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.cc b/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.cc
new file mode 100644
index 0000000000..7b0792637c
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/common/autofill_payments_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/common/autofill_payments_features.cc
+@@ -13,7 +13,7 @@ BASE_FEATURE(kAutofillDisableLocalCardMi
+ "AutofillDisableLocalCardMigration",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+ // When enabled, Chrome will extract the checkout amount from the checkout page
+ // of the allowlisted merchant websites.
+@@ -319,7 +319,7 @@ BASE_FEATURE(kAutofillSyncEwalletAccount
+ bool ShouldShowImprovedUserConsentForCreditCardSave() {
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
+ // The new user consent UI is fully launched on MacOS, Windows and Linux.
+ return true;
diff --git a/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.h b/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.h
new file mode 100644
index 0000000000..6b34dc14e5
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_common_autofill__payments__features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/common/autofill_payments_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/common/autofill_payments_features.h
+@@ -17,7 +17,7 @@ COMPONENT_EXPORT(AUTOFILL)
+ BASE_DECLARE_FEATURE(kAutofillDisableLocalCardMigration);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(AUTOFILL)
+ BASE_DECLARE_FEATURE(kAutofillEnableAmountExtractionDesktop);
+ #endif
diff --git a/electron34/patches/patch-components_autofill_core_common_autofill__prefs.cc b/electron34/patches/patch-components_autofill_core_common_autofill__prefs.cc
new file mode 100644
index 0000000000..6a8967589e
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_common_autofill__prefs.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/common/autofill_prefs.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/common/autofill_prefs.cc
+@@ -118,7 +118,7 @@ void RegisterProfilePrefs(user_prefs::Pr
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kAutofillPredictionImprovementsEnabled,
+ false);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
diff --git a/electron34/patches/patch-components_autofill_core_common_autofill__prefs.h b/electron34/patches/patch-components_autofill_core_common_autofill__prefs.h
new file mode 100644
index 0000000000..2404cea7ca
--- /dev/null
+++ b/electron34/patches/patch-components_autofill_core_common_autofill__prefs.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/autofill/core/common/autofill_prefs.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/autofill/core/common/autofill_prefs.h
+@@ -73,7 +73,7 @@ inline constexpr char kAutofillPaymentCv
+ inline constexpr char kAutofillPaymentCardBenefits[] =
+ "autofill.payment_card_benefits";
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Boolean that controls improved autofill filling predictions. When enabled,
+ // the autofill functionality is enhanced with adopting user data to
+ // the form being filled in, which is triggered by the user via an extra
diff --git a/electron34/patches/patch-components_commerce_core_commerce__feature__list.cc b/electron34/patches/patch-components_commerce_core_commerce__feature__list.cc
new file mode 100644
index 0000000000..e5c20a53d5
--- /dev/null
+++ b/electron34/patches/patch-components_commerce_core_commerce__feature__list.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/commerce/core/commerce_feature_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/commerce/core/commerce_feature_list.cc
+@@ -169,7 +169,7 @@ BASE_FEATURE(kPriceInsights,
+ "PriceInsights",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kPriceInsightsRegionLaunched,
+ "PriceInsightsRegionLaunched",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -248,7 +248,7 @@ BASE_FEATURE(kEnableDiscountInfoApi,
+
+ const char kDiscountOnShoppyPageParam[] = "discount-on-shoppy-page";
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const base::FeatureParam<bool> kDiscountOnShoppyPage{
+ &kEnableDiscountInfoApi, kDiscountOnShoppyPageParam, true};
+ #else
+@@ -257,7 +257,7 @@ const base::FeatureParam<bool> kDiscount
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEnableDiscountInfoApiRegionLaunched,
+ "EnableDiscountInfoApiRegionLaunched",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -296,7 +296,7 @@ const base::FeatureParam<bool> kDeleteAl
+
+ BASE_FEATURE(kShoppingList, "ShoppingList", base::FEATURE_DISABLED_BY_DEFAULT);
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kShoppingListRegionLaunched,
+ "ShoppingListRegionLaunched",
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-components_constrained__window_constrained__window__views.cc b/electron34/patches/patch-components_constrained__window_constrained__window__views.cc
new file mode 100644
index 0000000000..7c8521a53e
--- /dev/null
+++ b/electron34/patches/patch-components_constrained__window_constrained__window__views.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/constrained_window/constrained_window_views.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/constrained_window/constrained_window_views.cc
+@@ -372,7 +372,7 @@ bool SupportsGlobalScreenCoordinates() {
+ }
+
+ bool PlatformClipsChildrenToViewport() {
+-#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-components_content__settings_core_browser_website__settings__registry.cc b/electron34/patches/patch-components_content__settings_core_browser_website__settings__registry.cc
new file mode 100644
index 0000000000..6e2edf2fe5
--- /dev/null
+++ b/electron34/patches/patch-components_content__settings_core_browser_website__settings__registry.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/content_settings/core/browser/website_settings_registry.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/content_settings/core/browser/website_settings_registry.cc
+@@ -67,7 +67,7 @@ const WebsiteSettingsInfo* WebsiteSettin
+ #if BUILDFLAG(IS_WIN)
+ if (!(platform & PLATFORM_WINDOWS))
+ return nullptr;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!(platform & PLATFORM_LINUX))
+ return nullptr;
+ #elif BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-components_cookie__config_cookie__store__util.cc b/electron34/patches/patch-components_cookie__config_cookie__store__util.cc
new file mode 100644
index 0000000000..62e36efab4
--- /dev/null
+++ b/electron34/patches/patch-components_cookie__config_cookie__store__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/cookie_config/cookie_store_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/cookie_config/cookie_store_util.cc
+@@ -12,7 +12,7 @@
+ namespace cookie_config {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ namespace {
+
+ // Use the operating system's mechanisms to encrypt cookies before writing
diff --git a/electron34/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py b/electron34/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py
new file mode 100644
index 0000000000..97e7d18b99
--- /dev/null
+++ b/electron34/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/content/tools/generate_breakpad_symbols.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/content/tools/generate_breakpad_symbols.py
+@@ -204,7 +204,7 @@ def GetSharedLibraryDependenciesMac(bina
+ 'rpaths %s' %
+ (m.group(1), exe_path, loader_path, ', '.join(rpaths))),
+ file=sys.stderr)
+- sys.exit(1)
++ # sys.exit(1)
+ return deps
+
+
diff --git a/electron34/patches/patch-components_crash_core_app_BUILD.gn b/electron34/patches/patch-components_crash_core_app_BUILD.gn
new file mode 100644
index 0000000000..3420742585
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_BUILD.gn
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/BUILD.gn
+@@ -70,6 +70,10 @@ static_library("app") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [ "crashpad.cc" ]
++ }
++
+ defines = [ "CRASH_IMPLEMENTATION" ]
+
+ public_deps = [ ":lib" ]
+@@ -83,7 +87,7 @@ static_library("app") {
+ "//third_party/crashpad/crashpad/util",
+ ]
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "crashpad_linux.cc" ]
+ data_deps = [ ":chrome_crashpad_handler" ]
+ }
+@@ -103,7 +107,7 @@ static_library("app") {
+ libs = [ "log" ]
+ }
+
+- if (is_android || is_linux || is_chromeos) {
++ if ((is_android || is_linux || is_chromeos) && !is_bsd) {
+ deps += [
+ "//base:base_static",
+ "//components/crash/core/common",
+@@ -234,11 +238,6 @@ if (is_mac || is_android || is_linux ||
+ executable("chrome_crashpad_handler") {
+ sources = [ "chrome_crashpad_handler.cc" ]
+
+- deps = [
+- ":crashpad_handler_main",
+- "//third_party/crashpad/crashpad/handler",
+- ]
+-
+ if (is_mac && (is_component_build || is_asan || is_ubsan_any)) {
+ ldflags = [
+ # The handler is in
diff --git a/electron34/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc b/electron34/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc
new file mode 100644
index 0000000000..2cf1231ee3
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/chrome_crashpad_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/chrome_crashpad_handler.cc
+@@ -6,5 +6,9 @@
+ extern "C" int CrashpadHandlerMain(int argc, char* argv[]);
+
+ int main(int argc, char* argv[]) {
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++ return -1;
++#else
+ return CrashpadHandlerMain(argc, argv);
++#endif
+ }
diff --git a/electron34/patches/patch-components_crash_core_app_crash__reporter__client.cc b/electron34/patches/patch-components_crash_core_app_crash__reporter__client.cc
new file mode 100644
index 0000000000..2223be2a3d
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crash__reporter__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crash_reporter_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crash_reporter_client.cc
+@@ -122,6 +122,17 @@ bool CrashReporterClient::ReportingIsEnf
+ return false;
+ }
+
++bool CrashReporterClient::GetShouldRateLimit() {
++ return true;
++}
++
++bool CrashReporterClient::GetShouldCompressUploads() {
++ return true;
++}
++
++void CrashReporterClient::GetProcessSimpleAnnotations(std::map<std::string, std::string>* annotations) {
++}
++
+ #if BUILDFLAG(IS_ANDROID)
+ unsigned int CrashReporterClient::GetCrashDumpPercentage() {
+ return 100;
diff --git a/electron34/patches/patch-components_crash_core_app_crash__reporter__client.h b/electron34/patches/patch-components_crash_core_app_crash__reporter__client.h
new file mode 100644
index 0000000000..657f338598
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crash__reporter__client.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crash_reporter_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crash_reporter_client.h
+@@ -7,6 +7,7 @@
+
+ #include <stdint.h>
+
++#include <map>
+ #include <string>
+
+ #include "build/build_config.h"
+@@ -129,6 +130,19 @@ class CrashReporterClient {
+ // that case, |breakpad_enabled| is set to the value enforced by policies.
+ virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled);
+
++ // Returns true if crash uploads should be rate limited. If false, no
++ // throttling will be applied for uploads.
++ virtual bool GetShouldRateLimit();
++
++ // Returns true if crash uploads should be compressed with gzip. If false,
++ // reports will be uploaded uncompressed.
++ virtual bool GetShouldCompressUploads();
++
++ // Allows the client to add or edit global annotations passed to the crashpad
++ // handler.
++ virtual void GetProcessSimpleAnnotations(
++ std::map<std::string, std::string>* annotations);
++
+ #if BUILDFLAG(IS_ANDROID)
+ // Used by WebView to sample crashes without generating the unwanted dumps. If
+ // the returned value is less than 100, crash dumping will be sampled to that
diff --git a/electron34/patches/patch-components_crash_core_app_crashpad__handler__main.cc b/electron34/patches/patch-components_crash_core_app_crashpad__handler__main.cc
new file mode 100644
index 0000000000..6c61ef55ea
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crashpad__handler__main.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crashpad_handler_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crashpad_handler_main.cc
+@@ -10,7 +10,7 @@
+ #include "third_party/crashpad/crashpad/handler/handler_main.h"
+ #include "third_party/crashpad/crashpad/handler/user_stream_data_source.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "components/stability_report/user_stream_data_source_posix.h"
+ #endif
+
+@@ -31,7 +31,7 @@ __attribute__((visibility("default"), us
+ char* argv[]) {
+ crashpad::UserStreamDataSources user_stream_data_sources;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ user_stream_data_sources.push_back(
+ std::make_unique<stability_report::UserStreamDataSourcePosix>());
+ #endif
diff --git a/electron34/patches/patch-components_crash_core_app_crashpad__linux.cc b/electron34/patches/patch-components_crash_core_app_crashpad__linux.cc
new file mode 100644
index 0000000000..a68d8c4dc4
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crashpad__linux.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crashpad_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crashpad_linux.cc
+@@ -231,6 +231,7 @@ bool PlatformCrashpadInitialization(
+ // where crash_reporter provides it's own values for lsb-release.
+ annotations["lsb-release"] = base::GetLinuxDistro();
+ #endif
++ crash_reporter_client->GetProcessSimpleAnnotations(&annotations);
+
+ std::vector<std::string> arguments;
+ if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
+@@ -252,6 +253,13 @@ bool PlatformCrashpadInitialization(
+ }
+ #endif
+
++ if (!crash_reporter_client->GetShouldRateLimit()) {
++ arguments.push_back("--no-rate-limit");
++ }
++ if (!crash_reporter_client->GetShouldCompressUploads()) {
++ arguments.push_back("--no-upload-gzip");
++ }
++
+ CHECK(client.StartHandler(handler_path, *database_path, metrics_path, url,
+ annotations, arguments, false, false));
+ } else {
diff --git a/electron34/patches/patch-components_crash_core_app_crashpad__mac.mm b/electron34/patches/patch-components_crash_core_app_crashpad__mac.mm
new file mode 100644
index 0000000000..564769058d
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crashpad__mac.mm
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crashpad_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crashpad_mac.mm
+@@ -86,6 +86,8 @@ std::map<std::string, std::string> GetPr
+ } // @autoreleasepool
+ return process_annotations;
+ }();
++ CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
++ crash_reporter_client->GetProcessSimpleAnnotations(&annotations);
+ return annotations;
+ }
+
+@@ -156,6 +158,13 @@ bool PlatformCrashpadInitialization(
+
+ std::vector<std::string> arguments;
+
++ if (!crash_reporter_client->GetShouldRateLimit()) {
++ arguments.push_back("--no-rate-limit");
++ }
++ if (!crash_reporter_client->GetShouldCompressUploads()) {
++ arguments.push_back("--no-upload-gzip");
++ }
++
+ if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
+ arguments.push_back("--monitor-self");
+ }
diff --git a/electron34/patches/patch-components_crash_core_app_crashpad__win.cc b/electron34/patches/patch-components_crash_core_app_crashpad__win.cc
new file mode 100644
index 0000000000..12b6f06217
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_app_crashpad__win.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/app/crashpad_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/app/crashpad_win.cc
+@@ -92,6 +92,7 @@ bool PlatformCrashpadInitialization(
+
+ std::map<std::string, std::string> process_annotations;
+ GetPlatformCrashpadAnnotations(&process_annotations);
++ crash_reporter_client->GetProcessSimpleAnnotations(&process_annotations);
+
+ std::string url = crash_reporter_client->GetUploadUrl();
+
+@@ -129,6 +130,13 @@ bool PlatformCrashpadInitialization(
+
+ std::vector<std::string> arguments(start_arguments);
+
++ if (!crash_reporter_client->GetShouldRateLimit()) {
++ arguments.push_back("--no-rate-limit");
++ }
++ if (!crash_reporter_client->GetShouldCompressUploads()) {
++ arguments.push_back("--no-upload-gzip");
++ }
++
+ if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
+ arguments.push_back("--monitor-self");
+ for (const std::string& start_argument : start_arguments) {
diff --git a/electron34/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc b/electron34/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
new file mode 100644
index 0000000000..eecc8e6774
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/browser/crash_upload_list_crashpad.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/browser/crash_upload_list_crashpad.cc
+@@ -38,7 +38,9 @@ CrashUploadListCrashpad::~CrashUploadLis
+ std::vector<std::unique_ptr<UploadList::UploadInfo>>
+ CrashUploadListCrashpad::LoadUploadList() {
+ std::vector<crash_reporter::Report> reports;
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::GetReports(&reports);
++#endif
+
+ std::vector<std::unique_ptr<UploadInfo>> uploads;
+ for (const crash_reporter::Report& report : reports) {
+@@ -52,9 +54,13 @@ CrashUploadListCrashpad::LoadUploadList(
+
+ void CrashUploadListCrashpad::ClearUploadList(const base::Time& begin,
+ const base::Time& end) {
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::ClearReportsBetween(begin, end);
++#endif
+ }
+
+ void CrashUploadListCrashpad::RequestSingleUpload(const std::string& local_id) {
++#if !BUILDFLAG(IS_BSD)
+ crash_reporter::RequestSingleCrashUpload(local_id);
++#endif
+ }
diff --git a/electron34/patches/patch-components_crash_core_common_BUILD.gn b/electron34/patches/patch-components_crash_core_common_BUILD.gn
new file mode 100644
index 0000000000..c4aa5cf64e
--- /dev/null
+++ b/electron34/patches/patch-components_crash_core_common_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/crash/core/common/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/crash/core/common/BUILD.gn
+@@ -9,7 +9,7 @@ import("//components/gwp_asan/buildflags
+
+ declare_args() {
+ # If set to true, this will stub out and disable the entire crash key system.
+- use_crash_key_stubs = is_fuchsia
++ use_crash_key_stubs = is_fuchsia || is_bsd
+ }
+
+ group("common") {
diff --git a/electron34/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h b/electron34/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h
new file mode 100644
index 0000000000..cc2d9abce0
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/mock_signals_aggregator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/mock_signals_aggregator.h
+@@ -17,7 +17,7 @@ class MockSignalsAggregator : public Sig
+ MockSignalsAggregator();
+ ~MockSignalsAggregator() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MOCK_METHOD(void,
+ GetSignalsForUser,
+ (const UserContext&,
diff --git a/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator.h b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator.h
new file mode 100644
index 0000000000..3663beb19d
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/signals_aggregator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/signals_aggregator.h
+@@ -22,7 +22,7 @@ class SignalsAggregator : public KeyedSe
+
+ ~SignalsAggregator() override = default;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Will asynchronously collect signals whose names are specified in the
+ // `request` object, and will also use a `user_context` to validate that the
+ // user has permissions to the device's signals. Invokes `callback` with the
diff --git a/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
new file mode 100644
index 0000000000..8d74e41f87
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/signals_aggregator_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/signals_aggregator_impl.cc
+@@ -65,7 +65,7 @@ SignalsAggregatorImpl::SignalsAggregator
+
+ SignalsAggregatorImpl::~SignalsAggregatorImpl() = default;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SignalsAggregatorImpl::GetSignalsForUser(
+ const UserContext& user_context,
+ const SignalsAggregationRequest& request,
diff --git a/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h
new file mode 100644
index 0000000000..b3d2f99822
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/signals_aggregator_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/signals_aggregator_impl.h
+@@ -29,7 +29,7 @@ class SignalsAggregatorImpl : public Sig
+ ~SignalsAggregatorImpl() override;
+
+ // SignalsAggregator:
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void GetSignalsForUser(const UserContext& user_context,
+ const SignalsAggregationRequest& request,
+ GetSignalsCallback callback) override;
diff --git a/electron34/patches/patch-components_device__signals_core_browser_user__permission__service.h b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service.h
new file mode 100644
index 0000000000..5f16f31909
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/user_permission_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/user_permission_service.h
+@@ -57,7 +57,7 @@ class UserPermissionService : public Key
+ // missing.
+ virtual bool ShouldCollectConsent() const = 0;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Will verify whether context-aware signals can be collected
+ // on behalf of the user represented by `user_context`. Returns `kGranted` if
+ // collection is allowed.
diff --git a/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc
new file mode 100644
index 0000000000..64c85c3036
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/user_permission_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/user_permission_service_impl.cc
+@@ -87,7 +87,7 @@ bool UserPermissionServiceImpl::ShouldCo
+ consent_required_by_dependent_policy;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ UserPermission UserPermissionServiceImpl::CanUserCollectSignals(
+ const UserContext& user_context) const {
+ // Return "unknown user" if no user ID was given.
diff --git a/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h
new file mode 100644
index 0000000000..238f401f56
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/browser/user_permission_service_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/browser/user_permission_service_impl.h
+@@ -38,7 +38,7 @@ class UserPermissionServiceImpl : public
+
+ // UserPermissionService:
+ bool ShouldCollectConsent() const override;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ UserPermission CanUserCollectSignals(
+ const UserContext& user_context) const override;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX
diff --git a/electron34/patches/patch-components_device__signals_core_common_signals__features.cc b/electron34/patches/patch-components_device__signals_core_common_signals__features.cc
new file mode 100644
index 0000000000..425cfe77b0
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_common_signals__features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/common/signals_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/common/signals_features.cc
+@@ -50,7 +50,7 @@ bool IsNewFunctionEnabled(NewEvFunction
+ }
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ // Enables the triggering of device signals consent dialog when conditions met
+ // This feature also requires UnmanagedDeviceSignalsConsentFlowEnabled policy to
+ // be enabled
diff --git a/electron34/patches/patch-components_device__signals_core_common_signals__features.h b/electron34/patches/patch-components_device__signals_core_common_signals__features.h
new file mode 100644
index 0000000000..9413cc6ae5
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_common_signals__features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/common/signals_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/common/signals_features.h
+@@ -31,7 +31,7 @@ enum class NewEvFunction { kFileSystemIn
+ bool IsNewFunctionEnabled(NewEvFunction new_ev_function);
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kDeviceSignalsConsentDialog);
+
+ // Returns true if device signals consent dialog has been enabled for
diff --git a/electron34/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc b/electron34/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc
new file mode 100644
index 0000000000..0671abc6d2
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/core/system_signals/platform_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/core/system_signals/platform_delegate.cc
+@@ -11,7 +11,7 @@ namespace device_signals {
+
+ bool CustomFilePathComparator::operator()(const base::FilePath& a,
+ const base::FilePath& b) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux, the file system is case sensitive.
+ return a < b;
+ #else
diff --git a/electron34/patches/patch-components_device__signals_test_signals__contract.cc b/electron34/patches/patch-components_device__signals_test_signals__contract.cc
new file mode 100644
index 0000000000..9a18db42f6
--- /dev/null
+++ b/electron34/patches/patch-components_device__signals_test_signals__contract.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/device_signals/test/signals_contract.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/device_signals/test/signals_contract.cc
+@@ -212,7 +212,7 @@ GetSignalsContract() {
+ base::BindRepeating(VerifyUnset, names::kCrowdStrike);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ contract[names::kAllowScreenLock] =
+ base::BindRepeating(VerifyUnset, names::kAllowScreenLock);
+ contract[names::kImei] = base::BindRepeating(VerifyUnset, names::kImei);
diff --git a/electron34/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc b/electron34/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
new file mode 100644
index 0000000000..27de0eef1f
--- /dev/null
+++ b/electron34/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/discardable_memory/service/discardable_shared_memory_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/discardable_memory/service/discardable_shared_memory_manager.cc
+@@ -172,7 +172,7 @@ uint64_t GetDefaultMemoryLimit() {
+ // Limits the number of FDs used to 32, assuming a 4MB allocation size.
+ uint64_t max_default_memory_limit = 128 * kMegabyte;
+ #else
+- uint64_t max_default_memory_limit = 512 * kMegabyte;
++ uint64_t max_default_memory_limit = 128 * kMegabyte;
+ #endif
+
+ // Use 1/8th of discardable memory on low-end devices.
diff --git a/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc b/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc
new file mode 100644
index 0000000000..3fa5890a95
--- /dev/null
+++ b/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/embedder_support/android/delegate/web_contents_delegate_android.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/embedder_support/android/delegate/web_contents_delegate_android.cc
+@@ -185,14 +185,13 @@ bool WebContentsDelegateAndroid::IsWebCo
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ JNIEnv* env = AttachCurrentThread();
+ ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
+ if (obj.is_null())
+ return false;
+ ScopedJavaLocalRef<jobject> java_gurl =
+- url::GURLAndroid::FromNativeGURL(env, target_url);
++ url::GURLAndroid::FromNativeGURL(env, params.target_url.spec());
+ return !Java_WebContentsDelegateAndroid_shouldCreateWebContents(env, obj,
+ java_gurl);
+ }
diff --git a/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h b/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h
new file mode 100644
index 0000000000..820bfbd3fe
--- /dev/null
+++ b/electron34/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/embedder_support/android/delegate/web_contents_delegate_android.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/embedder_support/android/delegate/web_contents_delegate_android.h
+@@ -82,8 +82,7 @@ class WebContentsDelegateAndroid : publi
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ void CloseContents(content::WebContents* source) override;
+ void SetContentsBounds(content::WebContents* source,
+ const gfx::Rect& bounds) override;
diff --git a/electron34/patches/patch-components_embedder__support_user__agent__utils.cc b/electron34/patches/patch-components_embedder__support_user__agent__utils.cc
new file mode 100644
index 0000000000..26b5825e39
--- /dev/null
+++ b/electron34/patches/patch-components_embedder__support_user__agent__utils.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/embedder_support/user_agent_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/embedder_support/user_agent_utils.cc
+@@ -500,6 +500,9 @@ std::string GetPlatformForUAMetadata() {
+ # else
+ return "Chromium OS";
+ # endif
++#elif BUILDFLAG(IS_BSD)
++ // The internet is weird...
++ return "Linux";
+ #else
+ return std::string(version_info::GetOSType());
+ #endif
diff --git a/electron34/patches/patch-components_embedder__support_user__agent__utils__unittest.cc b/electron34/patches/patch-components_embedder__support_user__agent__utils__unittest.cc
new file mode 100644
index 0000000000..5114f9a12e
--- /dev/null
+++ b/electron34/patches/patch-components_embedder__support_user__agent__utils__unittest.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/embedder_support/user_agent_utils_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/embedder_support/user_agent_utils_unittest.cc
+@@ -71,7 +71,7 @@ const char kDesktop[] =
+ "X11; CrOS x86_64 14541.0.0"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "Fuchsia"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "X11; Linux x86_64"
+ #elif BUILDFLAG(IS_MAC)
+ "Macintosh; Intel Mac OS X 10_15_7"
+@@ -171,7 +171,7 @@ void CheckUserAgentStringOrdering(bool m
+ ASSERT_EQ("CrOS", pieces[0]);
+ ASSERT_EQ("x86_64", pieces[1]);
+ ASSERT_EQ("14541.0.0", pieces[2]);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Post-UA Reduction there is a single <unifiedPlatform> value for Linux:
+ // X11; Linux x86_64
+ ASSERT_EQ(2u, pieces.size());
+@@ -727,7 +727,7 @@ TEST_F(UserAgentUtilsTest, UserAgentMeta
+ #endif
+ #elif BUILDFLAG(IS_ANDROID)
+ EXPECT_EQ(metadata.platform, "Android");
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(metadata.platform, "Linux");
+ #elif BUILDFLAG(IS_FREEBSD)
+ EXPECT_EQ(metadata.platform, "FreeBSD");
diff --git a/electron34/patches/patch-components_enterprise_watermarking_watermark.cc b/electron34/patches/patch-components_enterprise_watermarking_watermark.cc
new file mode 100644
index 0000000000..53ef47e873
--- /dev/null
+++ b/electron34/patches/patch-components_enterprise_watermarking_watermark.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/enterprise/watermarking/watermark.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/enterprise/watermarking/watermark.cc
+@@ -34,7 +34,7 @@ gfx::Font WatermarkFont() {
+ "Segoe UI",
+ #elif BUILDFLAG(IS_MAC)
+ "SF Pro Text",
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "Ubuntu",
+ #elif BUILDFLAG(IS_CHROMEOS)
+ "Google Sans",
+@@ -45,7 +45,7 @@ gfx::Font WatermarkFont() {
+ }
+
+ gfx::Font::Weight WatermarkFontWeight() {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return gfx::Font::Weight::SEMIBOLD;
+ #else
+ return gfx::Font::Weight::MEDIUM;
diff --git a/electron34/patches/patch-components_eye__dropper_eye__dropper__view.cc b/electron34/patches/patch-components_eye__dropper_eye__dropper__view.cc
new file mode 100644
index 0000000000..3feca32e10
--- /dev/null
+++ b/electron34/patches/patch-components_eye__dropper_eye__dropper__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/eye_dropper/eye_dropper_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/eye_dropper/eye_dropper_view.cc
+@@ -203,7 +203,7 @@ EyeDropperView::EyeDropperView(gfx::Nati
+ // EyeDropper/WidgetDelegate.
+ set_owned_by_client();
+ SetPreferredSize(GetSize());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Use TYPE_MENU for Linux to ensure that the eye dropper view is displayed
+ // above the color picker.
+ views::Widget::InitParams params(
diff --git a/electron34/patches/patch-components_feature__engagement_public_event__constants.cc b/electron34/patches/patch-components_feature__engagement_public_event__constants.cc
new file mode 100644
index 0000000000..28c35777b4
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_event__constants.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/event_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/event_constants.cc
+@@ -11,7 +11,7 @@ namespace feature_engagement {
+ namespace events {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ const char kNewTabOpened[] = "new_tab_opened";
+ const char kSixthTabOpened[] = "sixth_tab_opened";
+ const char kReadingListItemAdded[] = "reading_list_item_added";
diff --git a/electron34/patches/patch-components_feature__engagement_public_event__constants.h b/electron34/patches/patch-components_feature__engagement_public_event__constants.h
new file mode 100644
index 0000000000..e096a48e17
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_event__constants.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/event_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/event_constants.h
+@@ -14,7 +14,7 @@ namespace events {
+
+ // Desktop
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // The user has explicitly opened a new tab via an entry point from inside of
+ // Chrome.
+ extern const char kNewTabOpened[];
diff --git a/electron34/patches/patch-components_feature__engagement_public_feature__configurations.cc b/electron34/patches/patch-components_feature__engagement_public_feature__configurations.cc
new file mode 100644
index 0000000000..ac8bd4558e
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_feature__configurations.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/feature_configurations.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/feature_configurations.cc
+@@ -95,7 +95,7 @@ std::optional<FeatureConfig> CreateNewUs
+
+ std::optional<FeatureConfig> GetClientSideFeatureConfig(
+ const base::Feature* feature) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+
+ // The IPH bubble for link capturing has a trigger set to ANY so that it
+ // always shows up. The per app specific guardrails are independently stored
+@@ -114,7 +114,7 @@ std::optional<FeatureConfig> GetClientSi
+
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (kIPHPasswordsManagementBubbleAfterSaveFeature.name == feature->name) {
+ std::optional<FeatureConfig> config = FeatureConfig();
+ config->valid = true;
+@@ -1641,7 +1641,8 @@ std::optional<FeatureConfig> GetClientSi
+ #endif // BUILDFLAG(IS_ANDROID)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+
+ if (kIPHAutofillCreditCardBenefitFeature.name == feature->name) {
+ // Credit card benefit IPH is shown:
diff --git a/electron34/patches/patch-components_feature__engagement_public_feature__constants.cc b/electron34/patches/patch-components_feature__engagement_public_feature__constants.cc
new file mode 100644
index 0000000000..2592789236
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_feature__constants.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/feature_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/feature_constants.cc
+@@ -18,7 +18,7 @@ BASE_FEATURE(kIPHDemoMode, "IPH_DemoMode
+ BASE_FEATURE(kIPHDummyFeature, "IPH_Dummy", base::FEATURE_DISABLED_BY_DEFAULT);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ BASE_FEATURE(kEsbDownloadRowPromoFeature,
+ "EsbDownloadRowPromo",
+@@ -646,7 +646,8 @@ BASE_FEATURE(kDefaultBrowserTriggerCrite
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kIPHAutofillCreditCardBenefitFeature,
+ "IPH_AutofillCreditCardBenefit",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -789,7 +790,7 @@ BASE_FEATURE(kIPHScalableIphGamingFeatur
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This can be enabled by default, as the DesktopPWAsLinkCapturing
+ // flag is needed for the IPH linked to this feature to work, and
+ // use-cases to show the IPH are guarded by that flag.
diff --git a/electron34/patches/patch-components_feature__engagement_public_feature__constants.h b/electron34/patches/patch-components_feature__engagement_public_feature__constants.h
new file mode 100644
index 0000000000..5819ae90d7
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_feature__constants.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/feature_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/feature_constants.h
+@@ -20,7 +20,7 @@ BASE_DECLARE_FEATURE(kIPHDemoMode);
+ BASE_DECLARE_FEATURE(kIPHDummyFeature);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ BASE_DECLARE_FEATURE(kEsbDownloadRowPromoFeature);
+ #endif
+@@ -261,7 +261,8 @@ BASE_DECLARE_FEATURE(kDefaultBrowserTrig
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kIPHAutofillCreditCardBenefitFeature);
+ BASE_DECLARE_FEATURE(kIPHAutofillDisabledVirtualCardSuggestionFeature);
+ BASE_DECLARE_FEATURE(kIPHAutofillExternalAccountProfileSuggestionFeature);
+@@ -314,7 +315,7 @@ BASE_DECLARE_FEATURE(kIPHScalableIphHelp
+ BASE_DECLARE_FEATURE(kIPHScalableIphGamingFeature);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kIPHDesktopPWAsLinkCapturingLaunch);
+ BASE_DECLARE_FEATURE(kIPHDesktopPWAsLinkCapturingLaunchAppInTab);
+ BASE_DECLARE_FEATURE(kIPHToolbarManagementButtonFeature);
diff --git a/electron34/patches/patch-components_feature__engagement_public_feature__list.cc b/electron34/patches/patch-components_feature__engagement_public_feature__list.cc
new file mode 100644
index 0000000000..ff56261ef4
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_feature__list.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/feature_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/feature_list.cc
+@@ -160,7 +160,7 @@ const base::Feature* const kAllFeatures[
+ &kIPHiOSLensOverlayEntrypointTipFeature,
+ #endif // BUILDFLAG(IS_IOS)
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ &kEsbDownloadRowPromoFeature,
+ #endif
+@@ -230,7 +230,8 @@ const base::Feature* const kAllFeatures[
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ &kIPHAutofillCreditCardBenefitFeature,
+ &kIPHAutofillDisabledVirtualCardSuggestionFeature,
+ &kIPHAutofillExternalAccountProfileSuggestionFeature,
+@@ -283,7 +284,7 @@ const base::Feature* const kAllFeatures[
+ &kIPHScalableIphGamingFeature,
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ &kIPHDesktopPWAsLinkCapturingLaunch,
+ &kIPHDesktopPWAsLinkCapturingLaunchAppInTab,
+ &kIPHToolbarManagementButtonFeature,
diff --git a/electron34/patches/patch-components_feature__engagement_public_feature__list.h b/electron34/patches/patch-components_feature__engagement_public_feature__list.h
new file mode 100644
index 0000000000..17bc7a5a90
--- /dev/null
+++ b/electron34/patches/patch-components_feature__engagement_public_feature__list.h
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feature_engagement/public/feature_list.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feature_engagement/public/feature_list.h
+@@ -278,7 +278,7 @@ DEFINE_VARIATION_PARAM(kIPHHomeCustomiza
+ #endif // BUILDFLAG(IS_IOS)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
+ DEFINE_VARIATION_PARAM(kEsbDownloadRowPromoFeature, "EsbDownloadRowPromo");
+ #endif
+@@ -387,7 +387,8 @@ DEFINE_VARIATION_PARAM(kIPHTabGroupsSave
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ DEFINE_VARIATION_PARAM(kIPHAutofillCreditCardBenefitFeature,
+ "IPH_AutofillCreditCardBenefit");
+
+@@ -481,7 +482,7 @@ DEFINE_VARIATION_PARAM(kIPHScalableIphHe
+ DEFINE_VARIATION_PARAM(kIPHScalableIphGamingFeature, "IPH_ScalableIphGaming");
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DEFINE_VARIATION_PARAM(kIPHDesktopPWAsLinkCapturingLaunch,
+ "IPH_DesktopPWAsLinkCapturingLaunch");
+ DEFINE_VARIATION_PARAM(kIPHDesktopPWAsLinkCapturingLaunchAppInTab,
+@@ -643,7 +644,7 @@ constexpr flags_ui::FeatureEntry::Featur
+ VARIATION_ENTRY(kIPHHomeCustomizationMenuFeature),
+ VARIATION_ENTRY(kIPHiOSLensOverlayEntrypointTipFeature),
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHBatterySaverModeFeature),
+ VARIATION_ENTRY(kIPHCompanionSidePanelFeature),
+ VARIATION_ENTRY(kIPHCompanionSidePanelRegionSearchFeature),
+@@ -701,7 +702,8 @@ constexpr flags_ui::FeatureEntry::Featur
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHAutofillCreditCardBenefitFeature),
+ VARIATION_ENTRY(kIPHAutofillDisabledVirtualCardSuggestionFeature),
+ VARIATION_ENTRY(kIPHAutofillExternalAccountProfileSuggestionFeature),
+@@ -753,7 +755,7 @@ constexpr flags_ui::FeatureEntry::Featur
+ VARIATION_ENTRY(kIPHScalableIphGamingFeature),
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VARIATION_ENTRY(kIPHDesktopPWAsLinkCapturingLaunch),
+ VARIATION_ENTRY(kIPHDesktopPWAsLinkCapturingLaunchAppInTab),
+ VARIATION_ENTRY(kIPHToolbarManagementButtonFeature),
diff --git a/electron34/patches/patch-components_feed_core_proto_v2_wire_version.proto b/electron34/patches/patch-components_feed_core_proto_v2_wire_version.proto
new file mode 100644
index 0000000000..44025a019d
--- /dev/null
+++ b/electron34/patches/patch-components_feed_core_proto_v2_wire_version.proto
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feed/core/proto/v2/wire/version.proto.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feed/core/proto/v2/wire/version.proto
+@@ -25,8 +25,8 @@ message Version {
+ BETA = 3;
+ RELEASE = 4;
+ }
+- optional int32 major = 1;
+- optional int32 minor = 2;
++ optional int32 gmajor = 1;
++ optional int32 gminor = 2;
+ optional int32 build = 3;
+ optional int32 revision = 4;
+ optional Architecture architecture = 5;
diff --git a/electron34/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc b/electron34/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc
new file mode 100644
index 0000000000..ff2f7e79d5
--- /dev/null
+++ b/electron34/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feed/core/v2/feed_network_impl_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feed/core/v2/feed_network_impl_unittest.cc
+@@ -747,8 +747,8 @@ TEST_F(FeedNetworkTest, SendApiRequest_D
+
+ EXPECT_EQ(feedwire::ClientInfo::CHROME_ANDROID, client_info.app_type());
+ EXPECT_EQ(feedwire::Version::RELEASE, client_info.app_version().build_type());
+- EXPECT_EQ(1, client_info.app_version().major());
+- EXPECT_EQ(2, client_info.app_version().minor());
++ EXPECT_EQ(1, client_info.app_version().gmajor());
++ EXPECT_EQ(2, client_info.app_version().gminor());
+ EXPECT_EQ(3, client_info.app_version().build());
+ EXPECT_EQ(4, client_info.app_version().revision());
+ EXPECT_FALSE(client_info.chrome_client_info().start_surface());
diff --git a/electron34/patches/patch-components_feed_core_v2_proto__util.cc b/electron34/patches/patch-components_feed_core_v2_proto__util.cc
new file mode 100644
index 0000000000..8066fd6c3e
--- /dev/null
+++ b/electron34/patches/patch-components_feed_core_v2_proto__util.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feed/core/v2/proto_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feed/core/v2/proto_util.cc
+@@ -93,8 +93,8 @@ feedwire::Version GetPlatformVersionMess
+
+ int32_t major, minor, revision;
+ base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &revision);
+- result.set_major(major);
+- result.set_minor(minor);
++ result.set_gmajor(major);
++ result.set_gminor(minor);
+ result.set_revision(revision);
+ #if BUILDFLAG(IS_ANDROID)
+ result.set_api_version(base::android::BuildInfo::GetInstance()->sdk_int());
+@@ -109,8 +109,8 @@ feedwire::Version GetAppVersionMessage(c
+ // Chrome's version is in the format: MAJOR,MINOR,BUILD,PATCH.
+ const std::vector<uint32_t>& numbers = chrome_info.version.components();
+ if (numbers.size() > 3) {
+- result.set_major(static_cast<int32_t>(numbers[0]));
+- result.set_minor(static_cast<int32_t>(numbers[1]));
++ result.set_gmajor(static_cast<int32_t>(numbers[0]));
++ result.set_gminor(static_cast<int32_t>(numbers[1]));
+ result.set_build(static_cast<int32_t>(numbers[2]));
+ result.set_revision(static_cast<int32_t>(numbers[3]));
+ }
diff --git a/electron34/patches/patch-components_feed_core_v2_proto__util__unittest.cc b/electron34/patches/patch-components_feed_core_v2_proto__util__unittest.cc
new file mode 100644
index 0000000000..9c997a90b8
--- /dev/null
+++ b/electron34/patches/patch-components_feed_core_v2_proto__util__unittest.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feed/core/v2/proto_util_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feed/core/v2/proto_util_unittest.cc
+@@ -43,8 +43,8 @@ TEST(ProtoUtilTest, CreateClientInfo) {
+ feedwire::ClientInfo result = CreateClientInfo(request_metadata);
+ EXPECT_EQ(feedwire::ClientInfo::CHROME_ANDROID, result.app_type());
+ EXPECT_EQ(feedwire::Version::RELEASE, result.app_version().build_type());
+- EXPECT_EQ(1, result.app_version().major());
+- EXPECT_EQ(2, result.app_version().minor());
++ EXPECT_EQ(1, result.app_version().gmajor());
++ EXPECT_EQ(2, result.app_version().gminor());
+ EXPECT_EQ(3, result.app_version().build());
+ EXPECT_EQ(4, result.app_version().revision());
+
diff --git a/electron34/patches/patch-components_feed_core_v2_test_proto__printer.cc b/electron34/patches/patch-components_feed_core_v2_test_proto__printer.cc
new file mode 100644
index 0000000000..be6d34c51b
--- /dev/null
+++ b/electron34/patches/patch-components_feed_core_v2_test_proto__printer.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/feed/core/v2/test/proto_printer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/feed/core/v2/test/proto_printer.cc
+@@ -158,8 +158,8 @@ class TextProtoPrinter {
+ }
+ TextProtoPrinter& operator<<(const feedwire::Version& v) {
+ BeginMessage();
+- PRINT_FIELD(major);
+- PRINT_FIELD(minor);
++ PRINT_FIELD(gmajor);
++ PRINT_FIELD(gminor);
+ PRINT_FIELD(build);
+ PRINT_FIELD(revision);
+ PRINT_FIELD(architecture);
diff --git a/electron34/patches/patch-components_flags__ui_flags__state.cc b/electron34/patches/patch-components_flags__ui_flags__state.cc
new file mode 100644
index 0000000000..06ff47938f
--- /dev/null
+++ b/electron34/patches/patch-components_flags__ui_flags__state.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/flags_ui/flags_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/flags_ui/flags_state.cc
+@@ -755,7 +755,7 @@ unsigned short FlagsState::GetCurrentPla
+ return kOsCrOS;
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ return kOsLacros;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kOsLinux;
+ #elif BUILDFLAG(IS_ANDROID)
+ return kOsAndroid;
diff --git a/electron34/patches/patch-components_gwp__asan_BUILD.gn b/electron34/patches/patch-components_gwp__asan_BUILD.gn
new file mode 100644
index 0000000000..44a7d833f6
--- /dev/null
+++ b/electron34/patches/patch-components_gwp__asan_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/gwp_asan/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/gwp_asan/BUILD.gn
+@@ -15,7 +15,7 @@ test("gwp_asan_unittests") {
+ "//testing/gtest",
+ "//third_party/boringssl",
+ ]
+- if (is_win || is_mac || is_linux || is_chromeos || is_android) {
++ if ((is_win || is_mac || is_linux || is_chromeos || is_android) && !is_bsd) {
+ deps += [
+ "//components/gwp_asan/client:unit_tests",
+ "//components/gwp_asan/crash_handler:unit_tests",
diff --git a/electron34/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc b/electron34/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
new file mode 100644
index 0000000000..d933073aaa
--- /dev/null
+++ b/electron34/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/gwp_asan/client/guarded_page_allocator_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/gwp_asan/client/guarded_page_allocator_posix.cc
+@@ -35,8 +35,9 @@ void GuardedPageAllocator::MarkPageInacc
+ // mmap() a PROT_NONE page over the address to release it to the system, if
+ // we used mprotect() here the system would count pages in the quarantine
+ // against the RSS.
++ // MAP_ANONYMOUS requires the fd to be -1 on !linux
+ void* err = mmap(ptr, state_.page_size, PROT_NONE,
+- MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
++ MAP_FIXED | MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
+ PCHECK(err == ptr) << "mmap";
+ }
+
diff --git a/electron34/patches/patch-components_gwp__asan_client_gwp__asan.cc b/electron34/patches/patch-components_gwp__asan_client_gwp__asan.cc
new file mode 100644
index 0000000000..b884131820
--- /dev/null
+++ b/electron34/patches/patch-components_gwp__asan_client_gwp__asan.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/gwp_asan/client/gwp_asan.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/gwp_asan/client/gwp_asan.cc
+@@ -75,7 +75,7 @@ namespace {
+ // ProcessSamplingBoost is the multiplier to increase the
+ // ProcessSamplingProbability in scenarios where we want to perform additional
+ // testing (e.g., on canary/dev builds).
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ constexpr int kDefaultMaxAllocations = 50;
+ constexpr int kDefaultMaxMetadata = 210;
+ constexpr int kDefaultTotalPages = kCpuIs64Bit ? 2048 : kDefaultMaxMetadata * 2;
diff --git a/electron34/patches/patch-components_gwp__asan_client_gwp__asan__features.cc b/electron34/patches/patch-components_gwp__asan_client_gwp__asan__features.cc
new file mode 100644
index 0000000000..0602c9558d
--- /dev/null
+++ b/electron34/patches/patch-components_gwp__asan_client_gwp__asan__features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/gwp_asan/client/gwp_asan_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/gwp_asan/client/gwp_asan_features.cc
+@@ -9,7 +9,7 @@
+ namespace gwp_asan::internal {
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || \
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ constexpr base::FeatureState kDefaultEnabled = base::FEATURE_ENABLED_BY_DEFAULT;
+ #else
diff --git a/electron34/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc b/electron34/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
new file mode 100644
index 0000000000..613a9460b3
--- /dev/null
+++ b/electron34/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/gwp_asan/crash_handler/crash_analyzer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/gwp_asan/crash_handler/crash_analyzer.cc
+@@ -35,7 +35,7 @@
+ #include "third_party/crashpad/crashpad/snapshot/process_snapshot.h"
+ #include "third_party/crashpad/crashpad/util/process/process_memory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include <signal.h>
+ #elif BUILDFLAG(IS_APPLE)
+ #include <mach/exception_types.h>
+@@ -95,7 +95,7 @@ bool CrashAnalyzer::GetExceptionInfo(
+
+ crashpad::VMAddress CrashAnalyzer::GetAccessAddress(
+ const crashpad::ExceptionSnapshot& exception) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (exception.Exception() == SIGSEGV || exception.Exception() == SIGBUS)
+ return exception.ExceptionAddress();
+ #elif BUILDFLAG(IS_APPLE)
diff --git a/electron34/patches/patch-components_live__caption_caption__util.cc b/electron34/patches/patch-components_live__caption_caption__util.cc
new file mode 100644
index 0000000000..6435faf717
--- /dev/null
+++ b/electron34/patches/patch-components_live__caption_caption__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/live_caption/caption_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/live_caption/caption_util.cc
+@@ -139,7 +139,7 @@ std::string GetCaptionSettingsUrl() {
+ return "chrome://os-settings/audioAndCaptions";
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "chrome://settings/captions";
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-components_live__caption_caption__util.h b/electron34/patches/patch-components_live__caption_caption__util.h
new file mode 100644
index 0000000000..346f4d0007
--- /dev/null
+++ b/electron34/patches/patch-components_live__caption_caption__util.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/live_caption/caption_util.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/live_caption/caption_util.h
+@@ -15,7 +15,7 @@ class PrefService;
+ namespace captions {
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ extern const char kCaptionSettingsUrl[];
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-components_media__router_common_media__source.cc b/electron34/patches/patch-components_media__router_common_media__source.cc
new file mode 100644
index 0000000000..aff3eda806
--- /dev/null
+++ b/electron34/patches/patch-components_media__router_common_media__source.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/media_router/common/media_source.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/media_router/common/media_source.cc
+@@ -57,7 +57,7 @@ bool IsSystemAudioCaptureSupported() {
+ if (!media::IsSystemLoopbackCaptureSupported()) {
+ return false;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(media::kPulseaudioLoopbackForCast);
+ #else
+ return true;
diff --git a/electron34/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc b/electron34/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
new file mode 100644
index 0000000000..fd0a4d2f1b
--- /dev/null
+++ b/electron34/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/media_router/common/providers/cast/channel/cast_message_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/media_router/common/providers/cast/channel/cast_message_util.cc
+@@ -169,7 +169,7 @@ int GetVirtualConnectPlatformValue() {
+ return 4;
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ return 5;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return 6;
+ #else
+ return 0;
diff --git a/electron34/patches/patch-components_media__router_common_providers_cast_channel_enum__table.h b/electron34/patches/patch-components_media__router_common_providers_cast_channel_enum__table.h
new file mode 100644
index 0000000000..32da29daf2
--- /dev/null
+++ b/electron34/patches/patch-components_media__router_common_providers_cast_channel_enum__table.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/media_router/common/providers/cast/channel/enum_table.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/media_router/common/providers/cast/channel/enum_table.h
+@@ -366,7 +366,12 @@ class EnumTable {
+
+ private:
+ #ifdef ARCH_CPU_64_BITS
++#ifdef __cpp_lib_hardware_interference_size
+ alignas(std::hardware_destructive_interference_size)
++#else
++ static constexpr std::size_t hardware_destructive_interference_size = 64;
++ alignas(hardware_destructive_interference_size)
++#endif
+ #endif
+ std::initializer_list<Entry> data_;
+ bool is_sorted_;
diff --git a/electron34/patches/patch-components_metrics_drive__metrics__provider__linux.cc b/electron34/patches/patch-components_metrics_drive__metrics__provider__linux.cc
new file mode 100644
index 0000000000..36d825768a
--- /dev/null
+++ b/electron34/patches/patch-components_metrics_drive__metrics__provider__linux.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/metrics/drive_metrics_provider_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/metrics/drive_metrics_provider_linux.cc
+@@ -4,7 +4,13 @@
+
+ #include "components/metrics/drive_metrics_provider.h"
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/types.h>
++#define MAJOR(dev) major(dev)
++#define MINOR(dev) minor(dev)
++#else
+ #include <linux/kdev_t.h> // For MAJOR()/MINOR().
++#endif
+ #include <sys/stat.h>
+ #include <string>
+
diff --git a/electron34/patches/patch-components_metrics_dwa_dwa__service.cc b/electron34/patches/patch-components_metrics_dwa_dwa__service.cc
new file mode 100644
index 0000000000..4bdabf2d0f
--- /dev/null
+++ b/electron34/patches/patch-components_metrics_dwa_dwa__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/metrics/dwa/dwa_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/metrics/dwa/dwa_service.cc
+@@ -161,7 +161,7 @@ void DwaService::RecordCoarseSystemInfor
+ coarse_system_info->set_platform(::dwa::CoarseSystemInfo::PLATFORM_WINDOWS);
+ #elif BUILDFLAG(IS_MAC)
+ coarse_system_info->set_platform(::dwa::CoarseSystemInfo::PLATFORM_MACOS);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ coarse_system_info->set_platform(::dwa::CoarseSystemInfo::PLATFORM_LINUX);
+ #elif BUILDFLAG(IS_ANDROID)
+ // TODO(b/366276323): Populate set_platform using more granular
diff --git a/electron34/patches/patch-components_metrics_metrics__log.cc b/electron34/patches/patch-components_metrics_metrics__log.cc
new file mode 100644
index 0000000000..b112dff02a
--- /dev/null
+++ b/electron34/patches/patch-components_metrics_metrics__log.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/metrics/metrics_log.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/metrics/metrics_log.cc
+@@ -61,7 +61,7 @@
+ #include "base/win/current_module.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #endif
+@@ -151,7 +151,7 @@ void RecordCurrentTime(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ metrics::SystemProfileProto::OS::XdgSessionType ToProtoSessionType(
+ base::nix::SessionType session_type) {
+ switch (session_type) {
+@@ -418,7 +418,7 @@ void MetricsLog::RecordCoreSystemProfile
+ // OperatingSystemVersion refers to the ChromeOS release version.
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ os->set_kernel_version(base::SysInfo::KernelVersion());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Linux operating system version is copied over into kernel version to be
+ // consistent.
+ os->set_kernel_version(base::SysInfo::OperatingSystemVersion());
+@@ -435,7 +435,7 @@ void MetricsLog::RecordCoreSystemProfile
+ os->set_build_number(base::SysInfo::GetIOSBuildNumber());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env = base::Environment::Create();
+ os->set_xdg_session_type(ToProtoSessionType(base::nix::GetSessionType(*env)));
+ os->set_xdg_current_desktop(
diff --git a/electron34/patches/patch-components_metrics_motherboard.cc b/electron34/patches/patch-components_metrics_motherboard.cc
new file mode 100644
index 0000000000..b4edcd1607
--- /dev/null
+++ b/electron34/patches/patch-components_metrics_motherboard.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/metrics/motherboard.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/metrics/motherboard.cc
+@@ -1,6 +1,7 @@
+ // Copyright 2022 The Chromium Authors
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
++// CHECK
+
+ #include "components/metrics/motherboard.h"
+
diff --git a/electron34/patches/patch-components_named__mojo__ipc__server_connection__info.h b/electron34/patches/patch-components_named__mojo__ipc__server_connection__info.h
new file mode 100644
index 0000000000..52f8a22968
--- /dev/null
+++ b/electron34/patches/patch-components_named__mojo__ipc__server_connection__info.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/named_mojo_ipc_server/connection_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/named_mojo_ipc_server/connection_info.h
+@@ -12,8 +12,14 @@
+ #include "base/win/scoped_handle.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include <bsm/libbsm.h>
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/socket.h>
++#if defined(__NetBSD__)
++#include <sys/un.h>
++#define ucred unpcbid
++#define SO_PEERCRED LOCAL_PEEREID
++#define pid unp_pid
++#endif
+ #endif
+
+ namespace named_mojo_ipc_server {
+@@ -29,7 +35,7 @@ struct ConnectionInfo {
+ base::ProcessId pid{};
+ #if BUILDFLAG(IS_MAC)
+ audit_token_t audit_token{};
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ucred credentials{};
+ #endif
+ };
diff --git a/electron34/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc b/electron34/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
new file mode 100644
index 0000000000..66a820c354
--- /dev/null
+++ b/electron34/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/named_mojo_ipc_server/named_mojo_ipc_server_client_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/named_mojo_ipc_server/named_mojo_ipc_server_client_util.cc
+@@ -23,7 +23,7 @@ namespace named_mojo_ipc_server {
+ // static
+ mojo::PlatformChannelEndpoint ConnectToServer(
+ const mojo::NamedPlatformChannel::ServerName& server_name) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return mojo::NamedPlatformChannel::ConnectToServer(server_name);
+ #elif BUILDFLAG(IS_MAC)
+ mojo::PlatformChannelEndpoint endpoint =
diff --git a/electron34/patches/patch-components_named__system__lock_lock.h b/electron34/patches/patch-components_named__system__lock_lock.h
new file mode 100644
index 0000000000..a37e348cbc
--- /dev/null
+++ b/electron34/patches/patch-components_named__system__lock_lock.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/named_system_lock/lock.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/named_system_lock/lock.h
+@@ -38,7 +38,7 @@ class ScopedLock {
+ // may acquire that lock. The lock name has different meanings per platform:
+ // Linux: A shared memory object name starting with `/`. E.g. `/MyApp.lock`.
+ // Mac: A bootstrap service name (see `man bootstrap_check_in`).
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ static std::unique_ptr<ScopedLock> Create(const std::string& name,
+ base::TimeDelta timeout);
+ #elif BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-components_neterror_resources_neterror.js b/electron34/patches/patch-components_neterror_resources_neterror.js
new file mode 100644
index 0000000000..bf4f96a792
--- /dev/null
+++ b/electron34/patches/patch-components_neterror_resources_neterror.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/neterror/resources/neterror.js.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/neterror/resources/neterror.js
+@@ -142,7 +142,7 @@ function detailsButtonClick() {
+
+ let primaryControlOnLeft = true;
+ // clang-format off
+-// <if expr="is_macosx or is_ios or is_linux or is_chromeos or is_android">
++// <if expr="is_macosx or is_ios or is_posix or is_chromeos or is_android">
+ // clang-format on
+ primaryControlOnLeft = false;
+ // </if>
diff --git a/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc b/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc
new file mode 100644
index 0000000000..fac90efa2e
--- /dev/null
+++ b/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/offline_pages/content/background_loader/background_loader_contents.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/offline_pages/content/background_loader/background_loader_contents.cc
+@@ -89,8 +89,7 @@ bool BackgroundLoaderContents::IsWebCont
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ // Background pages should not create other webcontents/tabs.
+ return true;
+ }
diff --git a/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h b/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h
new file mode 100644
index 0000000000..5e88e0207b
--- /dev/null
+++ b/electron34/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/offline_pages/content/background_loader/background_loader_contents.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/offline_pages/content/background_loader/background_loader_contents.h
+@@ -66,8 +66,7 @@ class BackgroundLoaderContents : public
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+
+ content::WebContents* AddNewContents(
+ content::WebContents* source,
diff --git a/electron34/patches/patch-components_optimization__guide_core_optimization__guide__features.cc b/electron34/patches/patch-components_optimization__guide_core_optimization__guide__features.cc
new file mode 100644
index 0000000000..54bdaf6172
--- /dev/null
+++ b/electron34/patches/patch-components_optimization__guide_core_optimization__guide__features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/optimization_guide/core/optimization_guide_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/optimization_guide/core/optimization_guide_features.cc
+@@ -140,7 +140,7 @@ BASE_FEATURE(kOptimizationGuideModelExec
+ // Whether to use the on device model service in optimization guide.
+ BASE_FEATURE(kOptimizationGuideOnDeviceModel,
+ "OptimizationGuideOnDeviceModel",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-components_optimization__guide_core_optimization__guide__util.cc b/electron34/patches/patch-components_optimization__guide_core_optimization__guide__util.cc
new file mode 100644
index 0000000000..7bb94860b8
--- /dev/null
+++ b/electron34/patches/patch-components_optimization__guide_core_optimization__guide__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/optimization_guide/core/optimization_guide_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/optimization_guide/core/optimization_guide_util.cc
+@@ -37,7 +37,7 @@ optimization_guide::proto::Platform GetP
+ return optimization_guide::proto::PLATFORM_CHROMEOS;
+ #elif BUILDFLAG(IS_ANDROID)
+ return optimization_guide::proto::PLATFORM_ANDROID;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return optimization_guide::proto::PLATFORM_LINUX;
+ #else
+ return optimization_guide::proto::PLATFORM_UNDEFINED;
diff --git a/electron34/patches/patch-components_os__crypt_async_browser_secret__portal__key__provider.cc b/electron34/patches/patch-components_os__crypt_async_browser_secret__portal__key__provider.cc
new file mode 100644
index 0000000000..d4c5aa3a4e
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_async_browser_secret__portal__key__provider.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/async/browser/secret_portal_key_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/async/browser/secret_portal_key_provider.cc
+@@ -5,7 +5,9 @@
+ #include "components/os_crypt/async/browser/secret_portal_key_provider.h"
+
+ #include <fcntl.h>
++#if BUILDFLAG(IS_LINUX)
+ #include <linux/limits.h>
++#endif
+
+ #include <array>
+ #include <utility>
diff --git a/electron34/patches/patch-components_os__crypt_async_common_encryptor.cc b/electron34/patches/patch-components_os__crypt_async_common_encryptor.cc
new file mode 100644
index 0000000000..bc31c966bc
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_async_common_encryptor.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/async/common/encryptor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/async/common/encryptor.cc
+@@ -277,7 +277,7 @@ std::optional<std::string> Encryptor::De
+ // or not encryption worked or not, and certainly not advisable to recommend
+ // a re-encryption of this potentially invalid data.
+ // TODO(crbug.com/365712505): Remove this fallback.
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && \
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD) && \
+ !(BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || \
+ BUILDFLAG(IS_FUCHSIA)
+ if (plaintext == string_data) {
diff --git a/electron34/patches/patch-components_os__crypt_sync_BUILD.gn b/electron34/patches/patch-components_os__crypt_sync_BUILD.gn
new file mode 100644
index 0000000000..1e7672ff2f
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_sync_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/sync/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/sync/BUILD.gn
+@@ -48,6 +48,7 @@ component("os_crypt") {
+ "os_crypt_mac.mm",
+ ]
+ deps += [ "//crypto:mock_apple_keychain" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_win) {
diff --git a/electron34/patches/patch-components_os__crypt_sync_keychain__password__mac.mm b/electron34/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
new file mode 100644
index 0000000000..7b8a48bfef
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
@@ -0,0 +1,100 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/sync/keychain_password_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/sync/keychain_password_mac.mm
+@@ -13,6 +13,7 @@
+ #include "base/rand_util.h"
+ #include "build/branding_buildflags.h"
+ #include "crypto/apple_keychain.h"
++#include "electron/mas.h"
+
+ using crypto::AppleKeychain;
+
+@@ -22,6 +23,12 @@ using KeychainNameContainerType = base::
+ using KeychainNameContainerType = const base::NoDestructor<std::string>;
+ #endif
+
++#if IS_MAS_BUILD()
++const char kAccountNameSuffix[] = " App Store Key";
++#else
++const char kAccountNameSuffix[] = " Key";
++#endif
++
+ namespace {
+
+ // These two strings ARE indeed user facing. But they are used to access
+@@ -81,11 +88,18 @@ KeychainPassword::~KeychainPassword() =
+ std::string KeychainPassword::GetPassword() const {
+ UInt32 password_length = 0;
+ void* password_data = nullptr;
++ KeychainPassword::KeychainNameType service_name = GetServiceName();
++ KeychainPassword::KeychainNameType account_name = GetAccountName();
++ const std::string account_name_suffix = kAccountNameSuffix;
++ const std::string suffixed_account_name = account_name + account_name_suffix;
++
++ // We should check if the suffixed account exists first
+ OSStatus error = keychain_->FindGenericPassword(
+- GetServiceName().size(), GetServiceName().c_str(),
+- GetAccountName().size(), GetAccountName().c_str(), &password_length,
++ service_name.size(), service_name.c_str(),
++ suffixed_account_name.size(), suffixed_account_name.c_str(), &password_length,
+ &password_data, /*item=*/nullptr);
+
++ // If it exists we can return it immediately
+ if (error == noErr) {
+ std::string password =
+ std::string(static_cast<char*>(password_data), password_length);
+@@ -93,6 +107,49 @@ std::string KeychainPassword::GetPasswor
+ return password;
+ }
+
++ // If the error was anything other than "it does not exist" we should error out here
++ // This normally means the account exists but we were deniged access to it
++ if (error != errSecItemNotFound) {
++ OSSTATUS_LOG(ERROR, error) << "Keychain lookup for suffixed key failed";
++ return std::string();
++ }
++
++ // If the suffixed account didn't exist, we should check if the legacy non-suffixed account
++ // exists. If it does we can use that key and migrate it to the new account
++ base::apple::ScopedCFTypeRef<SecKeychainItemRef> item_ref;
++ error = keychain_->FindGenericPassword(
++ service_name.size(), service_name.c_str(),
++ account_name.size(), account_name.c_str(), &password_length,
++ &password_data, item_ref.InitializeInto());
++
++ if (error == noErr) {
++ std::string password =
++ std::string(static_cast<char*>(password_data), password_length);
++
++ // If we found the legacy account name we should copy it over to
++ // the new suffixed account
++ error = keychain_->AddGenericPassword(
++ service_name.size(), service_name.data(), suffixed_account_name.size(),
++ suffixed_account_name.data(), password.size(), password_data, NULL);
++
++ if (error == noErr) {
++ // If we successfully made the suffixed account we can delete the old
++ // account to ensure new apps don't try to use it and run into IAM
++ // issues
++ error = keychain_->ItemDelete(item_ref.get());
++ if (error != noErr) {
++ OSSTATUS_DLOG(ERROR, error) << "Keychain delete for legacy key failed";
++ }
++ } else {
++ OSSTATUS_DLOG(ERROR, error) << "Keychain add for suffixed key failed";
++ }
++
++ keychain_->ItemFreeContent(password_data);
++ return password;
++ }
++
++ // If the legacy account name was not found, make a new account in the
++ // with the suffixed name
+ if (error == errSecItemNotFound) {
+ std::string password = AddRandomPasswordToKeychain(
+ *keychain_, GetServiceName(), GetAccountName());
diff --git a/electron34/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc b/electron34/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc
new file mode 100644
index 0000000000..4691940ce6
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/sync/libsecret_util_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/sync/libsecret_util_linux.cc
+@@ -185,16 +185,22 @@ bool LibsecretLoader::EnsureLibsecretLoa
+
+ // static
+ bool LibsecretLoader::LoadLibsecret() {
++#if BUILDFLAG(IS_BSD)
++ const char* kSecretLib = "libsecret-1.so";
++#else
++ const char* kSecretLib = "libsecret-1.so.0";
++#endif
++
+ if (libsecret_loaded_)
+ return true;
+
+- static void* handle = dlopen("libsecret-1.so.0", RTLD_NOW | RTLD_GLOBAL);
++ static void* handle = dlopen(kSecretLib, RTLD_NOW | RTLD_GLOBAL);
+ if (!handle) {
+ // We wanted to use libsecret, but we couldn't load it. Warn, because
+ // either the user asked for this, or we autodetected it incorrectly. (Or
+ // the system has broken libraries, which is also good to warn about.)
+ // TODO(crbug.com/40467093): Channel this message to the user-facing log
+- VLOG(1) << "Could not load libsecret-1.so.0: " << dlerror();
++ VLOG(1) << "Could not load " << kSecretLib << ": " << dlerror();
+ return false;
+ }
+
diff --git a/electron34/patches/patch-components_os__crypt_sync_os__crypt.h b/electron34/patches/patch-components_os__crypt_sync_os__crypt.h
new file mode 100644
index 0000000000..8bbc40db9d
--- /dev/null
+++ b/electron34/patches/patch-components_os__crypt_sync_os__crypt.h
@@ -0,0 +1,78 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/os_crypt/sync/os_crypt.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/os_crypt/sync/os_crypt.h
+@@ -14,7 +14,7 @@
+ #include "build/build_config.h"
+ #include "build/chromecast_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class KeyStorageLinux;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -23,7 +23,7 @@ class PrefRegistrySimple;
+ class PrefService;
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ namespace crypto {
+ class SymmetricKey;
+ }
+@@ -36,7 +36,7 @@ struct Config;
+ // Temporary interface due to OSCrypt refactor. See OSCryptImpl for descriptions
+ // of what each function does.
+ namespace OSCrypt {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(OS_CRYPT)
+ void SetConfig(std::unique_ptr<os_crypt::Config> config);
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -81,7 +81,7 @@ COMPONENT_EXPORT(OS_CRYPT) void UseMockK
+ COMPONENT_EXPORT(OS_CRYPT) void SetLegacyEncryptionForTesting(bool legacy);
+ COMPONENT_EXPORT(OS_CRYPT) void ResetStateForTesting();
+ #endif // BUILDFLAG(IS_WIN)
+-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(OS_CRYPT)
+ void UseMockKeyStorageForTesting(
+ base::OnceCallback<std::unique_ptr<KeyStorageLinux>()>
+@@ -108,7 +108,7 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCrypt
+ // Returns singleton instance of OSCryptImpl.
+ static OSCryptImpl* GetInstance();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the configuration of OSCryptImpl.
+ // This method, or SetRawEncryptionKey(), must be called before using
+ // EncryptString() and DecryptString().
+@@ -200,7 +200,7 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCrypt
+ void ResetStateForTesting();
+ #endif
+
+-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS))
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)
+ // For unit testing purposes, inject methods to be used.
+ // |storage_provider_factory| provides the desired |KeyStorage|
+ // implementation. If the provider returns |nullptr|, a hardcoded password
+@@ -225,13 +225,13 @@ class COMPONENT_EXPORT(OS_CRYPT) OSCrypt
+ crypto::SymmetricKey* GetEncryptionKey();
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // This lock is used to make the GetEncryptionKey and
+ // GetRawEncryptionKey methods thread-safe.
+ static base::Lock& GetLock();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns a cached string of "peanuts". Is thread-safe.
+ crypto::SymmetricKey* GetPasswordV10();
+
diff --git a/electron34/patches/patch-components_paint__preview_browser_paint__preview__client.cc b/electron34/patches/patch-components_paint__preview_browser_paint__preview__client.cc
new file mode 100644
index 0000000000..619ae1907f
--- /dev/null
+++ b/electron34/patches/patch-components_paint__preview_browser_paint__preview__client.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/paint_preview/browser/paint_preview_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/paint_preview/browser/paint_preview_client.cc
+@@ -326,8 +326,8 @@ void PaintPreviewClient::CapturePaintPre
+ metadata->set_version(kPaintPreviewVersion);
+ auto* chromeVersion = metadata->mutable_chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+- chromeVersion->set_major(current_chrome_version.components()[0]);
+- chromeVersion->set_minor(current_chrome_version.components()[1]);
++ chromeVersion->set_gmajor(current_chrome_version.components()[0]);
++ chromeVersion->set_gminor(current_chrome_version.components()[1]);
+ chromeVersion->set_build(current_chrome_version.components()[2]);
+ chromeVersion->set_patch(current_chrome_version.components()[3]);
+ document_data.callback = std::move(callback);
diff --git a/electron34/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc b/electron34/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
new file mode 100644
index 0000000000..74cc39f4ec
--- /dev/null
+++ b/electron34/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/paint_preview/browser/paint_preview_client_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/paint_preview/browser/paint_preview_client_unittest.cc
+@@ -174,8 +174,8 @@ TEST_P(PaintPreviewClientRenderViewHostT
+ metadata->set_version(kPaintPreviewVersion);
+ auto* chromeVersion = metadata->mutable_chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+- chromeVersion->set_major(current_chrome_version.components()[0]);
+- chromeVersion->set_minor(current_chrome_version.components()[1]);
++ chromeVersion->set_gmajor(current_chrome_version.components()[0]);
++ chromeVersion->set_gminor(current_chrome_version.components()[1]);
+ chromeVersion->set_build(current_chrome_version.components()[2]);
+ chromeVersion->set_patch(current_chrome_version.components()[3]);
+ PaintPreviewFrameProto* main_frame = expected_proto.mutable_root_frame();
diff --git a/electron34/patches/patch-components_paint__preview_common_proto_paint__preview.proto b/electron34/patches/patch-components_paint__preview_common_proto_paint__preview.proto
new file mode 100644
index 0000000000..1ed03f77a3
--- /dev/null
+++ b/electron34/patches/patch-components_paint__preview_common_proto_paint__preview.proto
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/paint_preview/common/proto/paint_preview.proto.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/paint_preview/common/proto/paint_preview.proto
+@@ -82,8 +82,8 @@ message PaintPreviewFrameProto {
+ // Stores Chrome version.
+ // NEXT_TAG = 5
+ message ChromeVersionProto {
+- optional uint64 major = 1;
+- optional uint64 minor = 2;
++ optional uint64 gmajor = 1;
++ optional uint64 gminor = 2;
+ optional uint64 build = 3;
+ optional uint64 patch = 4;
+ }
diff --git a/electron34/patches/patch-components_paint__preview_player_player__compositor__delegate.cc b/electron34/patches/patch-components_paint__preview_player_player__compositor__delegate.cc
new file mode 100644
index 0000000000..4b3c41a109
--- /dev/null
+++ b/electron34/patches/patch-components_paint__preview_player_player__compositor__delegate.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/paint_preview/player/player_compositor_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/paint_preview/player/player_compositor_delegate.cc
+@@ -434,8 +434,8 @@ void PlayerCompositorDelegate::ValidateP
+ auto chrome_version = capture_result_->proto.metadata().chrome_version();
+ const auto& current_chrome_version = version_info::GetVersion();
+ if (capture_result_->proto.metadata().has_chrome_version() &&
+- chrome_version.major() == current_chrome_version.components()[0] &&
+- chrome_version.minor() == current_chrome_version.components()[1] &&
++ chrome_version.gmajor() == current_chrome_version.components()[0] &&
++ chrome_version.gminor() == current_chrome_version.components()[1] &&
+ chrome_version.build() == current_chrome_version.components()[2] &&
+ chrome_version.patch() == current_chrome_version.components()[3]) {
+ paint_preview_service_->GetFileMixin()->GetAXTreeUpdate(
diff --git a/electron34/patches/patch-components_password__manager_core_browser_features_password__features.cc b/electron34/patches/patch-components_password__manager_core_browser_features_password__features.cc
new file mode 100644
index 0000000000..e342a00233
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_features_password__features.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/features/password_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/features/password_features.cc
+@@ -35,7 +35,7 @@ BASE_FEATURE(kClearUndecryptablePassword
+ BASE_FEATURE(kClearUndecryptablePasswordsOnSync,
+ "ClearUndecryptablePasswordsInSync",
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -109,7 +109,7 @@ BASE_FEATURE(kReuseDetectionBasedOnPassw
+ "ReuseDetectionBasedOnPasswordHashes",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kRestartToGainAccessToKeychain,
+ "RestartToGainAccessToKeychain",
+ #if BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-components_password__manager_core_browser_features_password__features.h b/electron34/patches/patch-components_password__manager_core_browser_features_password__features.h
new file mode 100644
index 0000000000..93ba9a84a8
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_features_password__features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/features/password_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/features/password_features.h
+@@ -110,7 +110,7 @@ BASE_DECLARE_FEATURE(kPasswordManualFall
+ // Detects password reuse based on hashed password values.
+ BASE_DECLARE_FEATURE(kReuseDetectionBasedOnPasswordHashes);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables "Needs access to keychain, restart chrome" bubble and banner.
+ BASE_DECLARE_FEATURE(kRestartToGainAccessToKeychain);
+ #endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__form__manager.cc b/electron34/patches/patch-components_password__manager_core_browser_password__form__manager.cc
new file mode 100644
index 0000000000..d01beefd7a
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__form__manager.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_form_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_form_manager.cc
+@@ -61,7 +61,7 @@
+ #include "components/webauthn/android/webauthn_cred_man_delegate.h"
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/os_crypt.h"
+ #endif
+
+@@ -233,7 +233,7 @@ bool ShouldUploadCrowdsourcingVotes(cons
+ return false;
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldShowKeychainErrorBubble(
+ std::optional<PasswordStoreBackendError> backend_error) {
+ if (!backend_error.has_value()) {
+@@ -892,7 +892,7 @@ void PasswordFormManager::OnFetchComplet
+ error.value().type);
+ }
+
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (ShouldShowKeychainErrorBubble(
+ form_fetcher_->GetProfileStoreBackendError())) {
+ client_->NotifyKeychainError();
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manager.cc b/electron34/patches/patch-components_password__manager_core_browser_password__manager.cc
new file mode 100644
index 0000000000..599b92a1d4
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manager.cc
+@@ -418,7 +418,7 @@ void PasswordManager::RegisterProfilePre
+ prefs::kAutofillableCredentialsAccountStoreLoginDatabase, false);
+ #endif // BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_IOS)
+ registry->RegisterBooleanPref(prefs::kPasswordSharingEnabled, true);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ registry->RegisterIntegerPref(prefs::kRelaunchChromeBubbleDismissedCounter,
+ 0);
+ #endif
+@@ -431,7 +431,7 @@ void PasswordManager::RegisterProfilePre
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ registry->RegisterBooleanPref(prefs::kDeletingUndecryptablePasswordsEnabled,
+ true);
+ #endif
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manager__client.h b/electron34/patches/patch-components_password__manager_core_browser_password__manager__client.h
new file mode 100644
index 0000000000..c690d48b50
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manager__client.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manager_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manager_client.h
+@@ -30,7 +30,7 @@
+ #include "net/cert/cert_status_flags.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/i18n/rtl.h"
+ #include "components/password_manager/core/browser/password_cross_domain_confirmation_popup_controller.h"
+ #include "ui/gfx/geometry/rect_f.h"
+@@ -551,7 +551,7 @@ class PasswordManagerClient {
+ CredentialsCallback callback);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ // Shows the bubble with the details of the `form`.
+ virtual void OpenPasswordDetailsBubble(
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.cc b/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.cc
new file mode 100644
index 0000000000..347e098723
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manager_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manager_switches.cc
+@@ -6,7 +6,7 @@
+
+ namespace password_manager {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Specifies which encryption storage backend to use. Possible values are
+ // kwallet, kwallet5, kwallet6, gnome-libsecret, basic.
+ // Any other value will lead to Chrome detecting the best backend automatically.
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.h b/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.h
new file mode 100644
index 0000000000..c40b78780e
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manager__switches.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manager_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manager_switches.h
+@@ -10,7 +10,7 @@
+
+ namespace password_manager {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kPasswordStore[];
+ extern const char kEnableEncryptionSelection[];
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc b/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
new file mode 100644
index 0000000000..ada6fbd650
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manual_fallback_flow.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manual_fallback_flow.cc
+@@ -44,7 +44,7 @@ std::u16string GetUsernameFromLabel(cons
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Returns the password form corresponding to the `payload` data. In most
+ // cases there is only one such form stored, but having more than one or no
+ // forms is also possible. If there is more than one form, showing any of them
+@@ -293,7 +293,7 @@ void PasswordManualFallbackFlow::DidAcce
+ }
+ case autofill::SuggestionType::kViewPasswordDetails: {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::optional<password_manager::PasswordForm> credentials =
+ GetCorrespondingPasswordForm(
+ suggestion.GetPayload<Suggestion::PasswordSuggestionDetails>(),
+@@ -428,7 +428,7 @@ void PasswordManualFallbackFlow::EnsureC
+ const Suggestion::PasswordSuggestionDetails& payload,
+ base::OnceClosure on_allowed) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (payload.is_cross_domain) {
+ cross_domain_confirmation_popup_controller_ =
+ password_client_->ShowCrossDomainConfirmationPopup(
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h b/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
new file mode 100644
index 0000000000..9527290c33
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_manual_fallback_flow.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_manual_fallback_flow.h
+@@ -17,7 +17,7 @@
+ #include "components/password_manager/core/browser/ui/saved_passwords_presenter.h"
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/password_manager/core/browser/password_cross_domain_confirmation_popup_controller.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -178,7 +178,7 @@ class PasswordManualFallbackFlow : publi
+ std::unique_ptr<device_reauth::DeviceAuthenticator> authenticator_;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<PasswordCrossDomainConfirmationPopupController>
+ cross_domain_confirmation_popup_controller_;
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) ||
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__store__factory__util.cc b/electron34/patches/patch-components_password__manager_core_browser_password__store__factory__util.cc
new file mode 100644
index 0000000000..45d9dbf6a6
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__store__factory__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_store_factory_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_store_factory_util.cc
+@@ -29,7 +29,7 @@ namespace {
+ LoginDatabase::DeletingUndecryptablePasswordsEnabled GetPolicyFromPrefs(
+ PrefService* prefs) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ return LoginDatabase::DeletingUndecryptablePasswordsEnabled(
+ prefs->GetBoolean(prefs::kDeletingUndecryptablePasswordsEnabled));
+ #else
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database.cc b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database.cc
new file mode 100644
index 0000000000..3a079cd546
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_store/login_database.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_store/login_database.cc
+@@ -1030,7 +1030,7 @@ bool ShouldDeleteUndecryptablePasswords(
+ bool is_user_data_dir_policy_set,
+ bool is_enabled_by_policy,
+ IsAccountStore is_account_store) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string user_data_dir_string;
+ std::unique_ptr<base::Environment> environment(base::Environment::Create());
+ // On Linux user data directory ca be specified using an env variable. If it
+@@ -1049,7 +1049,7 @@ bool ShouldDeleteUndecryptablePasswords(
+ return false;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (command_line->HasSwitch(password_manager::kPasswordStore)) {
+ RecordShouldDeleteUndecryptablePasswordsMetric(
+ ShouldDeleteUndecryptablePasswordsResult::
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
new file mode 100644
index 0000000000..3f49ffa93a
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_store/login_database_async_helper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_store/login_database_async_helper.cc
+@@ -154,7 +154,7 @@ LoginsResultOrError LoginDatabaseAsyncHe
+ std::vector<PasswordForm> matched_forms;
+ if (!login_db_ ||
+ !login_db_->GetLogins(form, include_psl, &matched_forms)) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return PasswordStoreBackendError(
+ OSCrypt::IsEncryptionAvailable()
+ ? PasswordStoreBackendErrorType::kUncategorized
diff --git a/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
new file mode 100644
index 0000000000..f6862bb1ab
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/password_store/login_database_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/password_store/login_database_unittest.cc
+@@ -2253,7 +2253,7 @@ INSTANTIATE_TEST_SUITE_P(MigrationToVCur
+ testing::Bool()));
+
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ class LoginDatabaseUndecryptableLoginsTest : public testing::Test {
+ protected:
+ LoginDatabaseUndecryptableLoginsTest() = default;
diff --git a/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc b/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc
new file mode 100644
index 0000000000..ba41b727c8
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/stub_password_manager_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/stub_password_manager_client.cc
+@@ -190,7 +190,7 @@ version_info::Channel StubPasswordManage
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void StubPasswordManagerClient::OpenPasswordDetailsBubble(
+ const password_manager::PasswordForm& form) {}
+
diff --git a/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h b/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h
new file mode 100644
index 0000000000..927a91eea6
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/browser/stub_password_manager_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/browser/stub_password_manager_client.h
+@@ -75,7 +75,7 @@ class StubPasswordManagerClient : public
+ MockPasswordFeatureManager* GetPasswordFeatureManager();
+ version_info::Channel GetChannel() const override;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void OpenPasswordDetailsBubble(
+ const password_manager::PasswordForm& form) override;
+ std::unique_ptr<
diff --git a/electron34/patches/patch-components_password__manager_core_common_password__manager__pref__names.h b/electron34/patches/patch-components_password__manager_core_common_password__manager__pref__names.h
new file mode 100644
index 0000000000..186136d090
--- /dev/null
+++ b/electron34/patches/patch-components_password__manager_core_common_password__manager__pref__names.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/password_manager/core/common/password_manager_pref_names.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/password_manager/core/common/password_manager_pref_names.h
+@@ -50,7 +50,7 @@ inline constexpr char kCredentialProvide
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ // Boolean pref controlled by the DeletingUndecryptablePasswordsEnabled policy.
+ // If set to false it blocks deleting undecryptable passwords, otherwise the
+ // deletion can happen.
+@@ -343,7 +343,7 @@ inline constexpr char kAutofillableCrede
+ inline constexpr char kPasswordSharingEnabled[] =
+ "password_manager.password_sharing_enabled";
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Integer pref indicating how many times relaunch Chrome bubble was dismissed.
+ inline constexpr char kRelaunchChromeBubbleDismissedCounter[] =
+ "password_manager.relaunch_chrome_bubble_dismissed_counter";
diff --git a/electron34/patches/patch-components_performance__manager_decorators_process__metrics__decorator.cc b/electron34/patches/patch-components_performance__manager_decorators_process__metrics__decorator.cc
new file mode 100644
index 0000000000..c45618c743
--- /dev/null
+++ b/electron34/patches/patch-components_performance__manager_decorators_process__metrics__decorator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/performance_manager/decorators/process_metrics_decorator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/performance_manager/decorators/process_metrics_decorator.cc
+@@ -264,7 +264,7 @@ void ProcessMetricsDecorator::DidGetMemo
+ // RSS and PMF to each node proportionally to its V8 heap size.
+ uint64_t process_rss = process_dump_iter.os_dump().resident_set_kb;
+ process_node->set_resident_set_kb(process_rss);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ process_node->set_private_swap_kb(
+ process_dump_iter.os_dump().private_footprint_swap_kb);
+ #endif
diff --git a/electron34/patches/patch-components_performance__manager_public_features.h b/electron34/patches/patch-components_performance__manager_public_features.h
new file mode 100644
index 0000000000..85fa32ca7b
--- /dev/null
+++ b/electron34/patches/patch-components_performance__manager_public_features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/performance_manager/public/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/performance_manager/public/features.h
+@@ -21,7 +21,7 @@ BASE_DECLARE_FEATURE(kRunOnMainThreadSyn
+
+ #if !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() false
+ #else
+ #define URGENT_DISCARDING_FROM_PERFORMANCE_MANAGER() true
diff --git a/electron34/patches/patch-components_permissions_permission__util.cc b/electron34/patches/patch-components_permissions_permission__util.cc
new file mode 100644
index 0000000000..8dc7ddc7ce
--- /dev/null
+++ b/electron34/patches/patch-components_permissions_permission__util.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/permissions/permission_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/permissions/permission_util.cc
+@@ -364,6 +364,7 @@ ContentSettingsType PermissionUtil::Perm
+ return ContentSettingsType::AUTOMATIC_FULLSCREEN;
+ case PermissionType::WEB_APP_INSTALLATION:
+ return ContentSettingsType::WEB_APP_INSTALLATION;
++ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
+ case PermissionType::NUM:
+ break;
+ }
diff --git a/electron34/patches/patch-components_permissions_prediction__service_prediction__common.cc b/electron34/patches/patch-components_permissions_prediction__service_prediction__common.cc
new file mode 100644
index 0000000000..42cf21fcb8
--- /dev/null
+++ b/electron34/patches/patch-components_permissions_prediction__service_prediction__common.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/permissions/prediction_service/prediction_common.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/permissions/prediction_service/prediction_common.cc
+@@ -33,7 +33,7 @@ int BucketizeValue(int count) {
+
+ ClientFeatures_Platform GetCurrentPlatformProto() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return permissions::ClientFeatures_Platform_PLATFORM_DESKTOP;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+ return permissions::ClientFeatures_Platform_PLATFORM_MOBILE;
+@@ -44,7 +44,7 @@ ClientFeatures_Platform GetCurrentPlatfo
+
+ ClientFeatures_PlatformEnum GetCurrentPlatformEnumProto() {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return permissions::ClientFeatures_PlatformEnum_PLATFORM_DESKTOP_V2;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
+ return permissions::ClientFeatures_PlatformEnum_PLATFORM_MOBILE_V2;
diff --git a/electron34/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc b/electron34/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc
new file mode 100644
index 0000000000..fe13cb9200
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/browser/policy_pref_mapping_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/browser/policy_pref_mapping_test.cc
+@@ -411,7 +411,7 @@ class PolicyTestCase {
+ const std::string os("chromeos_lacros");
+ #elif BUILDFLAG(IS_IOS)
+ const std::string os("ios");
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const std::string os("linux");
+ #elif BUILDFLAG(IS_MAC)
+ const std::string os("mac");
diff --git a/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc
new file mode 100644
index 0000000000..4dd97f5275
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/cloud/cloud_policy_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/cloud/cloud_policy_client.cc
+@@ -738,7 +738,7 @@ void CloudPolicyClient::FetchPolicy(Poli
+ fetch_request->set_invalidation_payload(invalidation_payload_);
+ }
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Only set browser device identifier for CBCM Chrome cloud policy on
+ // desktop.
+ if (type_to_fetch.first ==
diff --git a/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__refresh__scheduler.cc b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__refresh__scheduler.cc
new file mode 100644
index 0000000000..da93e53db0
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__refresh__scheduler.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/cloud/cloud_policy_refresh_scheduler.cc
+@@ -25,7 +25,7 @@ namespace policy {
+
+ namespace {
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kRetryWithKeyReset,
+ "RetryWithKeyReset",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -220,7 +220,7 @@ void CloudPolicyRefreshScheduler::OnStor
+ // continue using the stale information. Thus, no specific response to a store
+ // error is required. NB: Changes to is_managed fire OnStoreLoaded().
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Client is registered means we have successfully get policy key once. However,
+ // a following policy fetch request is failed because we can't verified
+ // signature. Delete the policy key so that we can get it again with next
diff --git a/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc
new file mode 100644
index 0000000000..7ca5b6df08
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/cloud/cloud_policy_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/cloud/cloud_policy_util.cc
+@@ -20,7 +20,7 @@
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include <pwd.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -35,10 +35,15 @@
+ #import <SystemConfiguration/SCDynamicStoreCopySpecific.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include <limits.h> // For HOST_NAME_MAX
+ #endif
+
++#if BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
++#include <sys/param.h>
++#define HOST_NAME_MAX MAXHOSTNAMELEN
++#endif
++
+ #include <algorithm>
+ #include <utility>
+
+@@ -88,7 +93,7 @@ namespace em = enterprise_management;
+
+ std::string GetMachineName() {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ char hostname[HOST_NAME_MAX];
+ if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success.
+ return hostname;
+@@ -144,7 +149,7 @@ std::string GetMachineName() {
+
+ std::string GetOSVersion() {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return base::SysInfo::OperatingSystemVersion();
+ #elif BUILDFLAG(IS_WIN)
+ base::win::OSInfo::VersionNumber version_number =
+@@ -167,7 +172,7 @@ std::string GetOSArchitecture() {
+ }
+
+ std::string GetOSUsername() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ struct passwd* creds = getpwuid(getuid());
+ if (!creds || !creds->pw_name)
+ return std::string();
diff --git a/electron34/patches/patch-components_policy_core_common_policy__loader__common.cc b/electron34/patches/patch-components_policy_core_common_policy__loader__common.cc
new file mode 100644
index 0000000000..b237dc8ed9
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_policy__loader__common.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/policy_loader_common.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/policy_loader_common.cc
+@@ -46,7 +46,7 @@ const char* kSensitivePolicies[] = {
+ key::kDefaultSearchProviderEnabled,
+ key::kSafeBrowsingEnabled,
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ key::kAutoOpenFileTypes,
+ key::kEnterpriseSearchAggregatorSettings,
+ key::kHomepageIsNewTabPage,
+@@ -57,7 +57,7 @@ const char* kSensitivePolicies[] = {
+ key::kSafeBrowsingAllowlistDomains,
+ key::kSiteSearchSettings,
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ key::kCommandLineFlagSecurityWarningsEnabled,
+ #endif
+ #if !BUILDFLAG(IS_IOS)
diff --git a/electron34/patches/patch-components_policy_core_common_policy__paths.cc b/electron34/patches/patch-components_policy_core_common_policy__paths.cc
new file mode 100644
index 0000000000..b8d30cdb38
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_policy__paths.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/policy_paths.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/policy_paths.cc
+@@ -17,6 +17,10 @@ namespace policy {
+ const char kPolicyPath[] = "/etc/opt/chrome/policies";
+ #elif BUILDFLAG(GOOGLE_CHROME_FOR_TESTING_BRANDING)
+ const char kPolicyPath[] = "/etc/opt/chrome_for_testing/policies";
++#elif BUILDFLAG(IS_FREEBSD)
++const char kPolicyPath[] = "/usr/local/etc/chromium/policies";
++#elif BUILDFLAG(IS_NETBSD)
++const char kPolicyPath[] = "@PKG_SYSCONFBASE@/chromium/policies";
+ #else
+ const char kPolicyPath[] = "/etc/chromium/policies";
+ #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
diff --git a/electron34/patches/patch-components_policy_core_common_policy__utils.cc b/electron34/patches/patch-components_policy_core_common_policy__utils.cc
new file mode 100644
index 0000000000..23225fabac
--- /dev/null
+++ b/electron34/patches/patch-components_policy_core_common_policy__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/core/common/policy_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/core/common/policy_utils.cc
+@@ -22,7 +22,7 @@ bool IsPolicyTestingEnabled(PrefService*
+ return true;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ if (channel == version_info::Channel::DEV) {
+ return true;
+ }
diff --git a/electron34/patches/patch-components_policy_tools_generate__policy__source.py b/electron34/patches/patch-components_policy_tools_generate__policy__source.py
new file mode 100644
index 0000000000..a9579b07cc
--- /dev/null
+++ b/electron34/patches/patch-components_policy_tools_generate__policy__source.py
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/policy/tools/generate_policy_source.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/policy/tools/generate_policy_source.py
+@@ -38,9 +38,9 @@ PLATFORM_STRINGS = {
+ 'ios': ['ios'],
+ 'fuchsia': ['fuchsia'],
+ 'chrome.win': ['win'],
+- 'chrome.linux': ['linux'],
++ 'chrome.linux': ['linux', 'openbsd', 'freebsd', 'netbsd'],
+ 'chrome.mac': ['mac'],
+- 'chrome.*': ['win', 'mac', 'linux'],
++ 'chrome.*': ['win', 'mac', 'linux', 'openbsd', 'freebsd', 'netbsd'],
+ 'chrome.win7': ['win'],
+ }
+
diff --git a/electron34/patches/patch-components_power__metrics_BUILD.gn b/electron34/patches/patch-components_power__metrics_BUILD.gn
new file mode 100644
index 0000000000..6c8d4946ea
--- /dev/null
+++ b/electron34/patches/patch-components_power__metrics_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/power_metrics/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/power_metrics/BUILD.gn
+@@ -41,7 +41,7 @@ static_library("power_metrics") {
+ ldflags = [ "/DELAYLOAD:setupapi.dll" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux && !is_bsd) || is_chromeos) {
+ sources += [
+ "energy_metrics_provider_linux.cc",
+ "energy_metrics_provider_linux.h",
diff --git a/electron34/patches/patch-components_power__metrics_energy__metrics__provider.cc b/electron34/patches/patch-components_power__metrics_energy__metrics__provider.cc
new file mode 100644
index 0000000000..6a9bf631d6
--- /dev/null
+++ b/electron34/patches/patch-components_power__metrics_energy__metrics__provider.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/power_metrics/energy_metrics_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/power_metrics/energy_metrics_provider.cc
+@@ -9,6 +9,8 @@
+ #include "components/power_metrics/energy_metrics_provider_win.h"
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #include "components/power_metrics/energy_metrics_provider_linux.h"
++#elif BUILDFLAG(IS_BSD)
++#include "base/notreached.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+ namespace power_metrics {
+@@ -22,6 +24,9 @@ std::unique_ptr<EnergyMetricsProvider> E
+ return EnergyMetricsProviderWin::Create();
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ return EnergyMetricsProviderLinux::Create();
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ return nullptr;
+ #else
+ return nullptr;
+ #endif // BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-components_printing_browser_print__manager.cc b/electron34/patches/patch-components_printing_browser_print__manager.cc
new file mode 100644
index 0000000000..28148d0a3c
--- /dev/null
+++ b/electron34/patches/patch-components_printing_browser_print__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/printing/browser/print_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/printing/browser/print_manager.cc
+@@ -47,6 +47,8 @@ void PrintManager::IsPrintingEnabled(IsP
+ std::move(callback).Run(true);
+ }
+
++void PrintManager::ShowInvalidPrinterSettingsError() {}
++
+ void PrintManager::PrintingFailed(int32_t cookie,
+ mojom::PrintFailureReason reason) {
+ // Note: Not redundant with cookie checks in the same method in other parts of
diff --git a/electron34/patches/patch-components_printing_browser_print__manager.h b/electron34/patches/patch-components_printing_browser_print__manager.h
new file mode 100644
index 0000000000..197195647c
--- /dev/null
+++ b/electron34/patches/patch-components_printing_browser_print__manager.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/printing/browser/print_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/printing/browser/print_manager.h
+@@ -48,6 +48,7 @@ class PrintManager : public content::Web
+ DidPrintDocumentCallback callback) override;
+ void IsPrintingEnabled(IsPrintingEnabledCallback callback) override;
+ void DidShowPrintDialog() override;
++ void ShowInvalidPrinterSettingsError() override;
+ void PrintingFailed(int32_t cookie,
+ mojom::PrintFailureReason reason) override;
+
diff --git a/electron34/patches/patch-components_printing_common_print.mojom b/electron34/patches/patch-components_printing_common_print.mojom
new file mode 100644
index 0000000000..888a263465
--- /dev/null
+++ b/electron34/patches/patch-components_printing_common_print.mojom
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/printing/common/print.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/printing/common/print.mojom
+@@ -303,7 +303,7 @@ union PrintWithParamsResult {
+ interface PrintRenderFrame {
+ // Tells the RenderFrame to switch the CSS to print media type, render every
+ // requested page, and then switch back the CSS to display media type.
+- PrintRequestedPages();
++ PrintRequestedPages(mojo_base.mojom.DictionaryValue settings);
+
+ // Requests the frame to be printed with specified parameters. This is used
+ // to programmatically produce PDF by request from the browser (e.g. over
+@@ -392,6 +392,9 @@ interface PrintManagerHost {
+ [Sync]
+ ScriptedPrint(ScriptedPrintParams params) => (PrintPagesParams? settings);
+
++ // Tells the browser that there are invalid printer settings.
++ ShowInvalidPrinterSettingsError();
++
+ // Tells the browser printing failed.
+ PrintingFailed(int32 cookie, PrintFailureReason reason);
+
diff --git a/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.cc b/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.cc
new file mode 100644
index 0000000000..15c722d3db
--- /dev/null
+++ b/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.cc
@@ -0,0 +1,178 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/printing/renderer/print_render_frame_helper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/printing/renderer/print_render_frame_helper.cc
+@@ -52,6 +52,7 @@
+ #include "printing/mojom/print.mojom.h"
+ #include "printing/page_number.h"
+ #include "printing/print_job_constants.h"
++#include "printing/print_settings.h"
+ #include "printing/units.h"
+ #include "services/metrics/public/cpp/ukm_source_id.h"
+ #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
+@@ -1227,14 +1228,14 @@ void PrintRenderFrameHelper::ScriptedPri
+ }
+
+ print_in_progress_ = true;
+-
+ auto weak_this = weak_ptr_factory_.GetWeakPtr();
+ web_frame->DispatchBeforePrintEvent(/*print_client=*/nullptr);
+ if (!weak_this) {
+ return;
+ }
+
+- Print(web_frame, blink::WebNode(), PrintRequestType::kScripted);
++ Print(web_frame, blink::WebNode(), PrintRequestType::kScripted,
++ base::Value::Dict());
+ if (!weak_this) {
+ return;
+ }
+@@ -1265,12 +1266,14 @@ void PrintRenderFrameHelper::BindPrintRe
+ receivers_.Add(this, std::move(receiver));
+ }
+
+-void PrintRenderFrameHelper::PrintRequestedPages() {
+- PrintRequestedPagesInternal(/*already_notified_frame=*/false);
++void PrintRenderFrameHelper::PrintRequestedPages(base::Value::Dict settings) {
++ PrintRequestedPagesInternal(/*already_notified_frame=*/false,
++ std::move(settings));
+ }
+
+ void PrintRenderFrameHelper::PrintRequestedPagesInternal(
+- bool already_notified_frame) {
++ bool already_notified_frame,
++ base::Value::Dict settings) {
+ ScopedIPC scoped_ipc(weak_ptr_factory_.GetWeakPtr());
+ if (ipc_nesting_level_ > kAllowedIpcDepthForPrint) {
+ return;
+@@ -1287,9 +1290,10 @@ void PrintRenderFrameHelper::PrintReques
+
+ is_loading_ = frame->WillPrintSoon();
+ if (is_loading_) {
+- on_stop_loading_closure_ = base::BindOnce(
+- &PrintRenderFrameHelper::PrintRequestedPagesInternal,
+- weak_ptr_factory_.GetWeakPtr(), /*already_notified_frame=*/true);
++ on_stop_loading_closure_ =
++ base::BindOnce(&PrintRenderFrameHelper::PrintRequestedPagesInternal,
++ weak_ptr_factory_.GetWeakPtr(),
++ /*already_notified_frame=*/true, std::move(settings));
+ SetupOnStopLoadingTimeout();
+ return;
+ }
+@@ -1299,7 +1303,7 @@ void PrintRenderFrameHelper::PrintReques
+ // plugin node and print that instead.
+ auto plugin = delegate_->GetPdfElement(frame);
+
+- Print(frame, plugin, PrintRequestType::kRegular);
++ Print(frame, plugin, PrintRequestType::kRegular, std::move(settings));
+
+ if (render_frame_gone_) {
+ return;
+@@ -1456,6 +1460,8 @@ void PrintRenderFrameHelper::PrintPrevie
+ if (ipc_nesting_level_ > kAllowedIpcDepthForPrint)
+ return;
+
++ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
++ print_preview_context_.InitWithFrame(frame);
+ print_preview_context_.OnPrintPreview();
+
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -2063,17 +2069,19 @@ void PrintRenderFrameHelper::PrintNode(c
+
+ void PrintRenderFrameHelper::Print(blink::WebLocalFrame* frame,
+ const blink::WebNode& node,
+- PrintRequestType print_request_type) {
++ PrintRequestType print_request_type,
++ base::Value::Dict settings) {
+ // If still not finished with earlier print request simply ignore.
+ if (prep_frame_view_)
+ return;
+
++ bool silent = settings.FindBool("silent").value_or(false);
+ FrameReference frame_ref(frame);
+
+- if (!InitPrintSettings(frame, node)) {
++ if (!InitPrintSettings(frame, node, std::move(settings))) {
+ // Browser triggered this code path. It already knows about the failure.
+ notify_browser_of_print_failure_ = false;
+-
++ GetPrintManagerHost()->ShowInvalidPrinterSettingsError();
+ DidFinishPrinting(PrintingResult::kFailPrintInit);
+ return;
+ }
+@@ -2094,8 +2102,15 @@ void PrintRenderFrameHelper::Print(blink
+ print_pages_params_->params->print_scaling_option;
+
+ auto self = weak_ptr_factory_.GetWeakPtr();
+- mojom::PrintPagesParamsPtr print_settings = GetPrintSettingsFromUser(
++ mojom::PrintPagesParamsPtr print_settings;
++
++ if (silent) {
++ print_settings = mojom::PrintPagesParams::New();
++ print_settings->params = print_pages_params_->params->Clone();
++ } else {
++ print_settings = GetPrintSettingsFromUser(
+ frame_ref.GetFrame(), node, expected_page_count, print_request_type);
++ }
+ // Check if `this` is still valid.
+ if (!self)
+ return;
+@@ -2360,29 +2375,44 @@ void PrintRenderFrameHelper::IPCProcesse
+ }
+
+ bool PrintRenderFrameHelper::InitPrintSettings(blink::WebLocalFrame* frame,
+- const blink::WebNode& node) {
++ const blink::WebNode& node,
++ base::Value::Dict new_settings) {
+ // Reset to default values.
+ ignore_css_margins_ = false;
+
+- mojom::PrintPagesParams settings;
+- GetPrintManagerHost()->GetDefaultPrintSettings(&settings.params);
++ mojom::PrintPagesParamsPtr settings;
++ if (new_settings.empty()) {
++ settings = mojom::PrintPagesParams::New();
++ settings->params = mojom::PrintParams::New();
++ GetPrintManagerHost()->GetDefaultPrintSettings(&settings->params);
++ } else {
++ GetPrintManagerHost()->UpdatePrintSettings(
++ std::move(new_settings), &settings);
++ }
+
+ // Check if the printer returned any settings, if the settings are null,
+ // assume there are no printer drivers configured. So safely terminate.
+- if (!settings.params) {
++ if (!settings || !settings->params) {
+ // Caller will reset `print_pages_params_`.
+ return false;
+ }
+
+- bool center_on_paper = !IsPrintingPdfFrame(frame, node);
+- settings.params->print_scaling_option =
+- center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
+- : mojom::PrintScalingOption::kSourceSize;
+- RecordDebugEvent(settings.params->printed_doc_type ==
++ bool silent = new_settings.FindBool("silent").value_or(false);
++ if (silent) {
++ settings->params->print_scaling_option = mojom::PrintScalingOption::kFitToPrintableArea;
++ } else {
++ const auto plugin_node = delegate_->GetPdfElement(frame);
++ const bool center_on_paper = !IsPrintingPdfFrame(frame, plugin_node);
++ settings->params->print_scaling_option =
++ center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
++ : mojom::PrintScalingOption::kSourceSize;
++ }
++
++ RecordDebugEvent(settings->params->printed_doc_type ==
+ mojom::SkiaDocumentType::kMSKP
+ ? DebugEvent::kSetPrintSettings5
+ : DebugEvent::kSetPrintSettings6);
+- SetPrintPagesParams(settings);
++ SetPrintPagesParams(*settings);
+ return true;
+ }
+
diff --git a/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.h b/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.h
new file mode 100644
index 0000000000..ccbc2aebe3
--- /dev/null
+++ b/electron34/patches/patch-components_printing_renderer_print__render__frame__helper.h
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/printing/renderer/print_render_frame_helper.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/printing/renderer/print_render_frame_helper.h
+@@ -259,7 +259,7 @@ class PrintRenderFrameHelper
+ mojo::PendingAssociatedReceiver<mojom::PrintRenderFrame> receiver);
+
+ // printing::mojom::PrintRenderFrame:
+- void PrintRequestedPages() override;
++ void PrintRequestedPages(base::Value::Dict settings) override;
+ void PrintWithParams(mojom::PrintPagesParamsPtr params,
+ PrintWithParamsCallback callback) override;
+ #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
+@@ -326,7 +326,8 @@ class PrintRenderFrameHelper
+ // WARNING: |this| may be gone after this method returns.
+ void Print(blink::WebLocalFrame* frame,
+ const blink::WebNode& node,
+- PrintRequestType print_request_type);
++ PrintRequestType print_request_type,
++ base::Value::Dict settings = {});
+
+ // Notification when printing is done - signal tear-down/free resources.
+ void DidFinishPrinting(PrintingResult result);
+@@ -336,7 +337,8 @@ class PrintRenderFrameHelper
+ // Initialize print page settings with default settings.
+ // Used only for native printing workflow.
+ bool InitPrintSettings(blink::WebLocalFrame* frame,
+- const blink::WebNode& node);
++ const blink::WebNode& node,
++ base::Value::Dict new_settings);
+
+ // Calculate number of pages in source document.
+ uint32_t CalculateNumberOfPages(blink::WebLocalFrame* frame,
+@@ -634,7 +636,8 @@ class PrintRenderFrameHelper
+ };
+
+ void SetupOnStopLoadingTimeout();
+- void PrintRequestedPagesInternal(bool already_notified_frame);
++ void PrintRequestedPagesInternal(bool already_notified_frame,
++ base::Value::Dict settings);
+
+ ScriptingThrottler scripting_throttler_;
+
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_BUILD.gn b/electron34/patches/patch-components_remote__cocoa_app__shim_BUILD.gn
new file mode 100644
index 0000000000..3c57297ed9
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/BUILD.gn
+@@ -75,6 +75,7 @@ component("app_shim") {
+ "//components/crash/core/common",
+ "//components/remote_cocoa/common:mojo",
+ "//components/system_media_controls",
++ "//electron/build/config:generate_mas_config",
+ "//mojo/public/cpp/bindings",
+ "//net",
+ "//ui/accelerated_widget_mac",
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm b/electron34/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
new file mode 100644
index 0000000000..cd45e2d30b
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/application_bridge.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/application_bridge.mm
+@@ -12,6 +12,7 @@
+ #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
+ #include "components/remote_cocoa/app_shim/native_widget_ns_window_host_helper.h"
+ #include "components/system_media_controls/mac/remote_cocoa/system_media_controls_bridge.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/associated_remote.h"
+ #include "mojo/public/cpp/bindings/self_owned_receiver.h"
+ #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
+@@ -51,6 +52,7 @@ class NativeWidgetBridgeOwner : public N
+
+ // NativeWidgetNSWindowHostHelper:
+ id GetNativeViewAccessible() override {
++#if !IS_MAS_BUILD()
+ if (!remote_accessibility_element_) {
+ base::ProcessId browser_pid = base::kNullProcessId;
+ std::vector<uint8_t> element_token;
+@@ -61,6 +63,9 @@ class NativeWidgetBridgeOwner : public N
+ ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
+ }
+ return remote_accessibility_element_;
++#else
++ return nil;
++#endif
+ }
+ void DispatchKeyEvent(ui::KeyEvent* event) override {
+ bool event_handled = false;
+@@ -99,7 +104,9 @@ class NativeWidgetBridgeOwner : public N
+ mojo::AssociatedRemote<mojom::TextInputHost> text_input_host_remote_;
+
+ std::unique_ptr<NativeWidgetNSWindowBridge> bridge_;
++#if !IS_MAS_BUILD()
+ NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
++#endif
+ };
+
+ } // namespace
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm b/electron34/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm
new file mode 100644
index 0000000000..336149bcab
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm
@@ -0,0 +1,52 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
+@@ -8,7 +8,9 @@
+
+ #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
++#include "electron/mas.h"
+
++#if !IS_MAS_BUILD()
+ @interface NSWindow (PrivateBrowserNativeWidgetAPI)
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
+ @end
+@@ -95,10 +97,13 @@
+
+ @end
+
++#endif // MAS_BUILD
++
+ @implementation BrowserNativeWidgetWindow
+
+ // NSWindow (PrivateAPI) overrides.
+
++#if !IS_MAS_BUILD()
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
+ // - NSThemeFrame and its subclasses will be nil if it's missing at runtime.
+ if ([BrowserWindowFrame class])
+@@ -145,6 +150,8 @@
+ return NO;
+ }
+
++#endif // MAS_BUILD
++
+ // Handle "Move focus to the window toolbar" configured in System Preferences ->
+ // Keyboard -> Shortcuts -> Keyboard. Usually Ctrl+F5. The argument (|unknown|)
+ // tends to just be nil.
+@@ -155,8 +162,8 @@
+ }
+
+ - (void)setAlwaysShowTrafficLights:(BOOL)alwaysShow {
+- [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
+- setAlwaysShowTrafficLights:alwaysShow];
++ // [base::apple::ObjCCastStrict<BrowserWindowFrame>(self.contentView.superview)
++ // setAlwaysShowTrafficLights:alwaysShow];
+ }
+
+ @end
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
new file mode 100644
index 0000000000..c91d06649e
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
+@@ -4,6 +4,10 @@
+
+ #import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h"
+
++#include "electron/mas.h"
++
++#if !IS_MAS_BUILD()
++
+ @interface NSWindow (PrivateAPI)
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
+ @end
+@@ -18,8 +22,12 @@
+ }
+ @end
+
++#endif // MAS_BUILD
++
+ @implementation NativeWidgetMacFramelessNSWindow
+
++#if !IS_MAS_BUILD()
++
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
+ if ([NativeWidgetMacFramelessNSWindowFrame class]) {
+ return [NativeWidgetMacFramelessNSWindowFrame class];
+@@ -27,4 +35,6 @@
+ return [super frameViewClassForStyleMask:windowStyle];
+ }
+
++#endif // MAS_BUILD
++
+ @end
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h
new file mode 100644
index 0000000000..14964a44c8
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/native_widget_mac_nswindow.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
+@@ -9,6 +9,7 @@
+
+ #include "base/apple/foundation_util.h"
+ #include "components/remote_cocoa/app_shim/remote_cocoa_app_shim_export.h"
++#include "electron/mas.h"
+ #import "ui/base/cocoa/command_dispatcher.h"
+
+ namespace remote_cocoa {
+@@ -17,6 +18,7 @@ class NativeWidgetNSWindowBridge;
+
+ @protocol WindowTouchBarDelegate;
+
++#if !IS_MAS_BUILD()
+ // Weak lets Chrome launch even if a future macOS doesn't have the below classes
+ WEAK_IMPORT_ATTRIBUTE
+ @interface NSNextStepFrame : NSView
+@@ -33,6 +35,7 @@ REMOTE_COCOA_APP_SHIM_EXPORT
+ REMOTE_COCOA_APP_SHIM_EXPORT
+ @interface NativeWidgetMacNSWindowTitledFrame : NSThemeFrame
+ @end
++#endif
+
+ // The NSWindow used by BridgedNativeWidget. Provides hooks into AppKit that
+ // can only be accomplished by overriding methods.
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
new file mode 100644
index 0000000000..ae3ff94395
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
+@@ -26,6 +26,7 @@
+ #import "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
+ #import "components/remote_cocoa/app_shim/window_touch_bar_delegate.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
++#include "electron/mas.h"
+ #import "ui/base/cocoa/user_interface_item_command_handler.h"
+ #import "ui/base/cocoa/window_size_constants.h"
+
+@@ -111,14 +112,18 @@ void OrderChildWindow(NSWindow* child_wi
+
+ } // namespace
+
++#if !IS_MAS_BUILD()
+ @interface NSNextStepFrame (Private)
+ - (instancetype)initWithFrame:(NSRect)frame
+ styleMask:(NSUInteger)styleMask
+ owner:(id)owner;
+ @end
++#endif
+
+ @interface NSWindow (Private)
++#if !IS_MAS_BUILD()
+ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle;
++#endif
+ - (BOOL)hasKeyAppearance;
+ - (long long)_resizeDirectionForMouseLocation:(CGPoint)location;
+ - (BOOL)_isConsideredOpenForPersistentState;
+@@ -157,6 +162,8 @@ void OrderChildWindow(NSWindow* child_wi
+ }
+ @end
+
++#if !IS_MAS_BUILD()
++
+ @implementation NativeWidgetMacNSWindowTitledFrame
+ - (void)mouseDown:(NSEvent*)event {
+ if (self.window.isMovable)
+@@ -184,6 +191,8 @@ void OrderChildWindow(NSWindow* child_wi
+ }
+ @end
+
++#endif // MAS_BUILD
++
+ @implementation NativeWidgetMacNSWindow {
+ @private
+ CommandDispatcher* __strong _commandDispatcher;
+@@ -380,6 +389,8 @@ void OrderChildWindow(NSWindow* child_wi
+
+ // NSWindow overrides.
+
++#if !IS_MAS_BUILD()
++
+ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
+ if (windowStyle & NSWindowStyleMaskTitled) {
+ if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
+@@ -391,6 +402,8 @@ void OrderChildWindow(NSWindow* child_wi
+ return [super frameViewClassForStyleMask:windowStyle];
+ }
+
++#endif
++
+ - (BOOL)_isTitleHidden {
+ bool shouldShowWindowTitle = YES;
+ if (_bridge)
diff --git a/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
new file mode 100644
index 0000000000..fd6eb74310
--- /dev/null
+++ b/electron34/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+@@ -41,6 +41,7 @@
+ #import "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
+ #import "components/remote_cocoa/app_shim/window_move_loop.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/self_owned_receiver.h"
+ #include "net/cert/x509_util_apple.h"
+ #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
+@@ -654,10 +655,12 @@ void NativeWidgetNSWindowBridge::CreateC
+ // this should be treated as an error and caught early.
+ CHECK(bridged_view_);
+
++#if !IS_MAS_BUILD()
+ // Send the accessibility tokens for the NSView now that it exists.
+ host_->SetRemoteAccessibilityTokens(
+ ui::RemoteAccessibility::GetTokenForLocalElement(window_),
+ ui::RemoteAccessibility::GetTokenForLocalElement(bridged_view_));
++#endif
+
+ // Beware: This view was briefly removed (in favor of a bare CALayer) in
+ // https://crrev.com/c/1236675. The ordering of unassociated layers relative
diff --git a/electron34/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc b/electron34/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
new file mode 100644
index 0000000000..9a07909033
--- /dev/null
+++ b/electron34/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/safe_browsing/content/common/file_type_policies_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/safe_browsing/content/common/file_type_policies_unittest.cc
+@@ -148,7 +148,7 @@ TEST_F(FileTypePoliciesTest, UnpackResou
+ EXPECT_EQ(DownloadFileType::FULL_PING, file_type.ping_setting());
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(DownloadFileType::ALLOW_ON_USER_GESTURE,
+ file_type.platform_settings(0).danger_level());
+ EXPECT_EQ(DownloadFileType::DISALLOW_AUTO_OPEN,
diff --git a/electron34/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py b/electron34/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
new file mode 100644
index 0000000000..a1a6e755ed
--- /dev/null
+++ b/electron34/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/safe_browsing/content/resources/gen_file_type_proto.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/safe_browsing/content/resources/gen_file_type_proto.py
+@@ -37,6 +37,9 @@ def PlatformTypes():
+ "chromeos":
+ download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_CHROME_OS,
+ "linux": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
++ "openbsd": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
++ "freebsd": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
++ "netbsd": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_LINUX,
+ "mac": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_MAC,
+ "win": download_file_types_pb2.DownloadFileType.PLATFORM_TYPE_WINDOWS,
+ # LINT.ThenChange(BUILD.gn:PlatformTypes)
+@@ -179,7 +182,7 @@ class DownloadFileTypeProtoGenerator(Bin
+ '-t',
+ '--type',
+ help='The platform type. One of android, chromeos, ' +
+- 'linux, mac, win')
++ 'linux, mac, win, openbsd, freebsd, netbsd')
+
+ def AddExtraCommandLineArgsForVirtualEnvRun(self, opts, command):
+ if opts.type is not None:
diff --git a/electron34/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc b/electron34/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
new file mode 100644
index 0000000000..5bb2f2ba5f
--- /dev/null
+++ b/electron34/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc
+@@ -119,7 +119,7 @@ std::ostream& operator<<(std::ostream& o
+ PlatformType GetCurrentPlatformType() {
+ #if BUILDFLAG(IS_WIN)
+ return WINDOWS_PLATFORM;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return LINUX_PLATFORM;
+ #elif BUILDFLAG(IS_IOS)
+ return IOS_PLATFORM;
diff --git a/electron34/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc b/electron34/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
new file mode 100644
index 0000000000..dfdba0d83f
--- /dev/null
+++ b/electron34/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc
+@@ -110,7 +110,7 @@ RTLookupRequest::OSType GetRTLookupReque
+ return RTLookupRequest::OS_TYPE_CHROME_OS;
+ #elif BUILDFLAG(IS_IOS)
+ return RTLookupRequest::OS_TYPE_IOS;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return RTLookupRequest::OS_TYPE_LINUX;
+ #elif BUILDFLAG(IS_MAC)
+ return RTLookupRequest::OS_TYPE_MAC;
diff --git a/electron34/patches/patch-components_safe__browsing_core_common_features.cc b/electron34/patches/patch-components_safe__browsing_core_common_features.cc
new file mode 100644
index 0000000000..fff60a7b4a
--- /dev/null
+++ b/electron34/patches/patch-components_safe__browsing_core_common_features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/safe_browsing/core/common/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/safe_browsing/core/common/features.cc
+@@ -256,7 +256,7 @@ constexpr base::FeatureParam<std::string
+ BASE_FEATURE(kSafeBrowsingAsyncRealTimeCheck,
+ "SafeBrowsingAsyncRealTimeCheck",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc b/electron34/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
new file mode 100644
index 0000000000..bce95d122a
--- /dev/null
+++ b/electron34/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/search_engines/search_engine_choice/search_engine_choice_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/search_engines/search_engine_choice/search_engine_choice_service.cc
+@@ -614,7 +614,7 @@ void SearchEngineChoiceService::Register
+
+ int SearchEngineChoiceService::GetCountryIdInternal() {
+ // `country_codes::kCountryIDAtInstall` may not be set yet.
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Android, ChromeOS and Linux, `country_codes::kCountryIDAtInstall` is
+ // computed asynchronously using platform-specific signals, and may not be
+ // available yet.
diff --git a/electron34/patches/patch-components_search__engines_template__url__service.cc b/electron34/patches/patch-components_search__engines_template__url__service.cc
new file mode 100644
index 0000000000..1b0e048ccd
--- /dev/null
+++ b/electron34/patches/patch-components_search__engines_template__url__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/search_engines/template_url_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/search_engines/template_url_service.cc
+@@ -3062,7 +3062,7 @@ bool TemplateURLService::MatchesDefaultS
+ std::unique_ptr<EnterpriseSearchManager>
+ TemplateURLService::GetEnterpriseSearchManager(PrefService* prefs) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<EnterpriseSearchManager>(
+ prefs,
+ base::BindRepeating(&TemplateURLService::EnterpriseSiteSearchChanged,
diff --git a/electron34/patches/patch-components_security__interstitials_content_utils.cc b/electron34/patches/patch-components_security__interstitials_content_utils.cc
new file mode 100644
index 0000000000..3521e1058c
--- /dev/null
+++ b/electron34/patches/patch-components_security__interstitials_content_utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/security_interstitials/content/utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/security_interstitials/content/utils.cc
+@@ -38,7 +38,7 @@ void LaunchDateAndTimeSettings() {
+ #if BUILDFLAG(IS_ANDROID)
+ JNIEnv* env = base::android::AttachCurrentThread();
+ Java_DateAndTimeSettingsHelper_openDateAndTimeSettings(env);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct ClockCommand {
+ const char* const pathname;
+ const char* const argument;
diff --git a/electron34/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc b/electron34/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
new file mode 100644
index 0000000000..51e17b99ba
--- /dev/null
+++ b/electron34/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/segmentation_platform/embedder/default_model/cross_device_user_segment.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/segmentation_platform/embedder/default_model/cross_device_user_segment.cc
+@@ -148,7 +148,7 @@ void CrossDeviceUserSegment::ExecuteMode
+ // Check for current device type and subtract it from the device count
+ // calculation.
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ desktop_count -= 1;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
diff --git a/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.cc b/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.cc
new file mode 100644
index 0000000000..5ff54db6ee
--- /dev/null
+++ b/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.cc
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/services/on_device_translation/sandbox_hook.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/services/on_device_translation/sandbox_hook.cc
+@@ -7,12 +7,15 @@
+ #include "components/services/on_device_translation/translate_kit_client.h"
+ #include "sandbox/linux/syscall_broker/broker_command.h"
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace on_device_translation {
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ // Gets the file permissions required by the TranslateKit
+ std::vector<BrokerFilePermission> GetOnDeviceTranslationFilePermissions() {
+ std::vector<BrokerFilePermission> permissions{
+@@ -21,6 +24,7 @@ std::vector<BrokerFilePermission> GetOnD
+ };
+ return permissions;
+ }
++#endif
+
+ } // namespace
+
+@@ -29,6 +33,7 @@ bool OnDeviceTranslationSandboxHook(
+ // Call `TranslateKitClient::Get()` to load libtranslatekit.so
+ TranslateKitClient::Get();
+
++#if !BUILDFLAG(IS_BSD)
+ auto* instance = sandbox::policy::SandboxLinux::GetInstance();
+ instance->StartBrokerProcess(MakeBrokerCommandSet({
+ sandbox::syscall_broker::COMMAND_OPEN,
+@@ -36,7 +41,7 @@ bool OnDeviceTranslationSandboxHook(
+ GetOnDeviceTranslationFilePermissions(),
+ options);
+ instance->EngageNamespaceSandboxIfPossible();
+-
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.h b/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.h
new file mode 100644
index 0000000000..6484619fc1
--- /dev/null
+++ b/electron34/patches/patch-components_services_on__device__translation_sandbox__hook.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/services/on_device_translation/sandbox_hook.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/services/on_device_translation/sandbox_hook.h
+@@ -5,7 +5,13 @@
+ #ifndef COMPONENTS_SERVICES_ON_DEVICE_TRANSLATION_SANDBOX_HOOK_H_
+ #define COMPONENTS_SERVICES_ON_DEVICE_TRANSLATION_SANDBOX_HOOK_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace on_device_translation {
+
diff --git a/electron34/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc b/electron34/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
new file mode 100644
index 0000000000..61daf5149e
--- /dev/null
+++ b/electron34/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/services/paint_preview_compositor/paint_preview_compositor_collection_impl.cc
+@@ -22,7 +22,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "content/public/child/dwrite_font_proxy_init_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/cpp/font_loader.h"
+ #endif
+
+@@ -79,7 +79,7 @@ PaintPreviewCompositorCollectionImpl::Pa
+ // Initialize font access for Skia.
+ #if BUILDFLAG(IS_WIN)
+ content::InitializeDWriteFontProxy();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ content::UtilityThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -102,7 +102,7 @@ PaintPreviewCompositorCollectionImpl::Pa
+ base::BindOnce([] { skia::DefaultFontMgr(); }));
+
+ // Sanity check that fonts are working.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // No WebSandbox is provided on Linux so the local fonts aren't accessible.
+ // This is fine since since the subsetted fonts are provided in the SkPicture.
+ // However, we still need to check that the SkFontMgr starts as it is used by
diff --git a/electron34/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc b/electron34/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc
new file mode 100644
index 0000000000..2d904ff690
--- /dev/null
+++ b/electron34/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/services/storage/dom_storage/dom_storage_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/services/storage/dom_storage/dom_storage_constants.cc
+@@ -6,7 +6,9 @@
+
+ namespace storage {
+
+-const size_t kPerStorageAreaQuota = 10 * 1024 * 1024;
++// Electron's dom_storage_limits.patch increased this value from 10MiB to 100MiB
++const size_t kPerStorageAreaQuota = 100 * 1024 * 1024;
++
+ const size_t kPerStorageAreaOverQuotaAllowance = 100 * 1024;
+
+ } // namespace storage
diff --git a/electron34/patches/patch-components_soda_soda__util.cc b/electron34/patches/patch-components_soda_soda__util.cc
new file mode 100644
index 0000000000..ab46e61886
--- /dev/null
+++ b/electron34/patches/patch-components_soda_soda__util.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/soda/soda_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/soda/soda_util.cc
+@@ -27,7 +27,7 @@
+ #include "base/win/windows_version.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && defined(ARCH_CPU_X86_FAMILY)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(ARCH_CPU_X86_FAMILY)
+ #include "base/cpu.h"
+ #endif
+
+@@ -52,7 +52,7 @@ bool IsSupportedChromeOS() {
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsSupportedLinux() {
+ #if defined(ARCH_CPU_X86_FAMILY)
+ // Check if the CPU has the required instruction set to run the Speech
+@@ -83,7 +83,7 @@ bool IsSupportedWin() {
+ bool IsOnDeviceSpeechRecognitionSupported() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return IsSupportedChromeOS();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return IsSupportedLinux();
+ #elif BUILDFLAG(IS_WIN)
+ return IsSupportedWin();
diff --git a/electron34/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc b/electron34/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc
new file mode 100644
index 0000000000..b0121359ac
--- /dev/null
+++ b/electron34/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/startup_metric_utils/common/startup_metric_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/startup_metric_utils/common/startup_metric_utils.cc
+@@ -94,7 +94,7 @@ base::TimeTicks CommonStartupMetricRecor
+ // Enabling this logic on OS X causes a significant performance regression.
+ // TODO(crbug.com/40464036): Remove IS_APPLE ifdef once utility processes
+ // set their desired main thread priority.
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ static bool statics_initialized = false;
+ if (!statics_initialized) {
+ statics_initialized = true;
diff --git a/electron34/patches/patch-components_storage__monitor_BUILD.gn b/electron34/patches/patch-components_storage__monitor_BUILD.gn
new file mode 100644
index 0000000000..b4b4c827ea
--- /dev/null
+++ b/electron34/patches/patch-components_storage__monitor_BUILD.gn
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/storage_monitor/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/storage_monitor/BUILD.gn
+@@ -75,7 +75,7 @@ static_library("storage_monitor") {
+ deps += [ "//services/device/public/mojom" ]
+ }
+ } else if (is_linux || is_chromeos_lacros) {
+- if (use_udev) {
++ if (use_udev && !is_bsd) {
+ sources += [
+ "mtab_watcher_linux.cc",
+ "mtab_watcher_linux.h",
+@@ -180,7 +180,7 @@ source_set("unit_tests") {
+ "storage_monitor_chromeos_unittest.cc",
+ ]
+ }
+- } else if (is_linux || is_chromeos_lacros) {
++ } else if ((is_linux || is_chromeos_lacros) && !is_bsd) {
+ if (use_udev) {
+ sources += [ "storage_monitor_linux_unittest.cc" ]
+ }
diff --git a/electron34/patches/patch-components_storage__monitor_removable__device__constants.cc b/electron34/patches/patch-components_storage__monitor_removable__device__constants.cc
new file mode 100644
index 0000000000..6b4a4a2667
--- /dev/null
+++ b/electron34/patches/patch-components_storage__monitor_removable__device__constants.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/storage_monitor/removable_device_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/storage_monitor/removable_device_constants.cc
+@@ -10,7 +10,7 @@ namespace storage_monitor {
+ const char kFSUniqueIdPrefix[] = "UUID:";
+ const char kVendorModelSerialPrefix[] = "VendorModelSerial:";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kVendorModelVolumeStoragePrefix[] = "VendorModelVolumeStorage:";
+ #endif
+
diff --git a/electron34/patches/patch-components_storage__monitor_removable__device__constants.h b/electron34/patches/patch-components_storage__monitor_removable__device__constants.h
new file mode 100644
index 0000000000..e7fb1e1211
--- /dev/null
+++ b/electron34/patches/patch-components_storage__monitor_removable__device__constants.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/storage_monitor/removable_device_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/storage_monitor/removable_device_constants.h
+@@ -14,7 +14,7 @@ namespace storage_monitor {
+ extern const char kFSUniqueIdPrefix[];
+ extern const char kVendorModelSerialPrefix[];
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kVendorModelVolumeStoragePrefix[];
+ #endif
+
diff --git a/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc b/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc
new file mode 100644
index 0000000000..28b22b6191
--- /dev/null
+++ b/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/supervised_user/core/browser/supervised_user_metrics_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/supervised_user/core/browser/supervised_user_metrics_service.cc
+@@ -47,7 +47,7 @@ SupervisedUserMetricsService::Supervised
+ extensions_metrics_delegate_(std::move(extensions_metrics_delegate)) {
+ DCHECK(pref_service_);
+ DCHECK(url_filter_);
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CHECK(extensions_metrics_delegate_)
+ << "Extensions metrics delegate must exist on Win/Linux/Mac";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc b/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
new file mode 100644
index 0000000000..7a28b9516a
--- /dev/null
+++ b/electron34/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/supervised_user/core/browser/supervised_user_preferences.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/supervised_user/core/browser/supervised_user_preferences.cc
+@@ -147,7 +147,7 @@ void RegisterProfilePrefs(PrefRegistrySi
+ prefs::kFamilyLinkUserState,
+ static_cast<int>(FamilyLinkUserState::kUnknown));
+ #if BUILDFLAG(ENABLE_EXTENSIONS) && \
+- (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX))
++ (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ registry->RegisterIntegerPref(
+ prefs::kLocallyParentApprovedExtensionsMigrationState,
+ static_cast<int>(
diff --git a/electron34/patches/patch-components_supervised__user_core_common_features.cc b/electron34/patches/patch-components_supervised__user_core_common_features.cc
new file mode 100644
index 0000000000..7d695736e8
--- /dev/null
+++ b/electron34/patches/patch-components_supervised__user_core_common_features.cc
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/supervised_user/core/common/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/supervised_user/core/common/features.cc
+@@ -60,7 +60,7 @@ BASE_FEATURE(kUpdatedSupervisedUserExten
+ "UpdatedSupervisedUserExtensionApprovalStrings",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop,
+ "EnableExtensionsPermissionsForSupervisedUsersOnDesktop",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+@@ -75,7 +75,7 @@ bool IsSupervisedUserSkipParentApprovalT
+ #if BUILDFLAG(IS_CHROMEOS)
+ return base::FeatureList::IsEnabled(
+ kEnableSupervisedUserSkipParentApprovalToInstallExtensions);
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ bool skipParentApprovalEnabled = base::FeatureList::IsEnabled(
+ kEnableSupervisedUserSkipParentApprovalToInstallExtensions);
+ bool permissionExtensionsForSupervisedUsersEnabled =
+@@ -96,13 +96,13 @@ BASE_FEATURE(kCustomProfileStringsForSup
+ "CustomProfileStringsForSupervisedUsers",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kShowKiteForSupervisedUsers,
+ "ShowKiteForSupervisedUsers",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kHideGuestModeForSupervisedUsers,
+ "HideGuestModeForSupervisedUsers",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -112,7 +112,7 @@ BASE_FEATURE(kForceSafeSearchForUnauthen
+ "ForceSafeSearchForUnauthenticatedSupervisedUsers",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kForceSupervisedUserReauthenticationForYouTube,
+ "ForceSupervisedUserReauthenticationForYouTube",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -162,7 +162,7 @@ BASE_FEATURE(kReplaceSupervisionSystemCa
+
+ BASE_FEATURE(kFetchListFamilyMembersWithCapability,
+ "FetchListFamilyMembersWithCapability",
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-components_supervised__user_core_common_features.h b/electron34/patches/patch-components_supervised__user_core_common_features.h
new file mode 100644
index 0000000000..4d0807fa51
--- /dev/null
+++ b/electron34/patches/patch-components_supervised__user_core_common_features.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/supervised_user/core/common/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/supervised_user/core/common/features.h
+@@ -25,7 +25,7 @@ BASE_DECLARE_FEATURE(
+ // Applies new informative strings during the parental extension approval flow.
+ BASE_DECLARE_FEATURE(kUpdatedSupervisedUserExtensionApprovalStrings);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kEnableExtensionsPermissionsForSupervisedUsersOnDesktop);
+ #endif
+
+@@ -55,11 +55,11 @@ BASE_DECLARE_FEATURE(kCustomProfileStrin
+
+ // Displays a Family Link kite badge on the supervised user avatar in various
+ // surfaces.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ BASE_DECLARE_FEATURE(kShowKiteForSupervisedUsers);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // This hides the following guest mode entry points for supervised users:
+ //
+ // * In the Profile menu for supervised profiles
+@@ -71,7 +71,7 @@ BASE_DECLARE_FEATURE(kHideGuestModeForSu
+ // unauthenticated (e.g. signed out of the content area) account.
+ BASE_DECLARE_FEATURE(kForceSafeSearchForUnauthenticatedSupervisedUsers);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Force re-authentication when an unauthenticated supervised user tries to
+ // access YouTube, so that content restrictions can be applied.
+ BASE_DECLARE_FEATURE(kForceSupervisedUserReauthenticationForYouTube);
diff --git a/electron34/patches/patch-components_supervised__user_core_common_pref__names.h b/electron34/patches/patch-components_supervised__user_core_common_pref__names.h
new file mode 100644
index 0000000000..57dcb6980b
--- /dev/null
+++ b/electron34/patches/patch-components_supervised__user_core_common_pref__names.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/supervised_user/core/common/pref_names.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/supervised_user/core/common/pref_names.h
+@@ -129,7 +129,7 @@ inline constexpr char kDefaultSupervised
+ "profile.managed.default_filtering_behavior";
+
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // An integer pref that stores the current state of the local extension
+ // parent approval migration when the feature
+ // `kEnableSupervisedUserSkipParentApprovalToInstallExtensions` becomes enabled.
diff --git a/electron34/patches/patch-components_sync__device__info_local__device__info__util.cc b/electron34/patches/patch-components_sync__device__info_local__device__info__util.cc
new file mode 100644
index 0000000000..64ee081607
--- /dev/null
+++ b/electron34/patches/patch-components_sync__device__info_local__device__info__util.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/sync_device_info/local_device_info_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/sync_device_info/local_device_info_util.cc
+@@ -85,7 +85,7 @@ void OnMachineStatisticsLoaded(LocalDevi
+ sync_pb::SyncEnums::DeviceType GetLocalDeviceType() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return sync_pb::SyncEnums_DeviceType_TYPE_CROS;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return sync_pb::SyncEnums_DeviceType_TYPE_LINUX;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ switch (ui::GetDeviceFormFactor()) {
+@@ -110,7 +110,7 @@ DeviceInfo::OsType GetLocalDeviceOSType(
+ return DeviceInfo::OsType::kChromeOsAsh;
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ return DeviceInfo::OsType::kChromeOsLacros;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return DeviceInfo::OsType::kLinux;
+ #elif BUILDFLAG(IS_ANDROID)
+ return DeviceInfo::OsType::kAndroid;
+@@ -129,7 +129,7 @@ DeviceInfo::OsType GetLocalDeviceOSType(
+
+ DeviceInfo::FormFactor GetLocalDeviceFormFactor() {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return DeviceInfo::FormFactor::kDesktop;
+ #elif BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
+ return ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET
diff --git a/electron34/patches/patch-components_sync__device__info_local__device__info__util__linux.cc b/electron34/patches/patch-components_sync__device__info_local__device__info__util__linux.cc
new file mode 100644
index 0000000000..8f600666b0
--- /dev/null
+++ b/electron34/patches/patch-components_sync__device__info_local__device__info__util__linux.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/sync_device_info/local_device_info_util_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/sync_device_info/local_device_info_util_linux.cc
+@@ -9,6 +9,11 @@
+
+ #include "base/linux_util.h"
+
++#if defined(__FreeBSD__) || defined(__NetBSD__)
++#include <sys/param.h>
++#define HOST_NAME_MAX MAXHOSTNAMELEN
++#endif
++
+ namespace syncer {
+
+ std::string GetPersonalizableDeviceNameInternal() {
diff --git a/electron34/patches/patch-components_sync_base_sync__util.cc b/electron34/patches/patch-components_sync_base_sync__util.cc
new file mode 100644
index 0000000000..451935bfa5
--- /dev/null
+++ b/electron34/patches/patch-components_sync_base_sync__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/sync/base/sync_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/sync/base/sync_util.cc
+@@ -45,6 +45,8 @@ std::string GetSystemString() {
+ system = "FREEBSD ";
+ #elif BUILDFLAG(IS_OPENBSD)
+ system = "OPENBSD ";
++#elif BUILDFLAG(IS_NETBSD)
++ system = "NETBSD ";
+ #elif BUILDFLAG(IS_MAC)
+ system = "MAC ";
+ #endif
diff --git a/electron34/patches/patch-components_system__cpu_cpu__probe.cc b/electron34/patches/patch-components_system__cpu_cpu__probe.cc
new file mode 100644
index 0000000000..deabcc2c6c
--- /dev/null
+++ b/electron34/patches/patch-components_system__cpu_cpu__probe.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/system_cpu/cpu_probe.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/system_cpu/cpu_probe.cc
+@@ -30,6 +30,9 @@ std::unique_ptr<CpuProbe> CpuProbe::Crea
+ return CpuProbeWin::Create();
+ #elif BUILDFLAG(IS_MAC)
+ return CpuProbeMac::Create();
++#elif BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++ return nullptr;
+ #else
+ return nullptr;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-components_translate_core_common_translate__util.cc b/electron34/patches/patch-components_translate_core_common_translate__util.cc
new file mode 100644
index 0000000000..696a545ccd
--- /dev/null
+++ b/electron34/patches/patch-components_translate_core_common_translate__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/translate/core/common/translate_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/translate/core/common/translate_util.cc
+@@ -21,7 +21,7 @@ const char kSecurityOrigin[] = "https://
+ BASE_FEATURE(kTFLiteLanguageDetectionEnabled,
+ "TFLiteLanguageDetectionEnabled",
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc b/electron34/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc
new file mode 100644
index 0000000000..49ef75c267
--- /dev/null
+++ b/electron34/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/trusted_vault/trusted_vault_connection_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/trusted_vault/trusted_vault_connection_impl.cc
+@@ -102,7 +102,7 @@ GetLocalPhysicalDeviceType() {
+ // currently used or even built on all platforms.
+ #if BUILDFLAG(IS_CHROMEOS)
+ return trusted_vault_pb::PhysicalDeviceMetadata::DEVICE_TYPE_CHROMEOS;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return trusted_vault_pb::PhysicalDeviceMetadata::DEVICE_TYPE_LINUX;
+ #elif BUILDFLAG(IS_ANDROID)
+ return trusted_vault_pb::PhysicalDeviceMetadata::DEVICE_TYPE_ANDROID;
diff --git a/electron34/patches/patch-components_update__client_update__query__params.cc b/electron34/patches/patch-components_update__client_update__query__params.cc
new file mode 100644
index 0000000000..19bee732b2
--- /dev/null
+++ b/electron34/patches/patch-components_update__client_update__query__params.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/update_client/update_query_params.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/update_client/update_query_params.cc
+@@ -40,6 +40,10 @@ const char kOs[] =
+ "fuchsia";
+ #elif BUILDFLAG(IS_OPENBSD)
+ "openbsd";
++#elif defined(OS_FREEBSD)
++ "freebsd";
++#elif defined(OS_NETBSD)
++ "netbsd";
+ #else
+ #error "unknown os"
+ #endif
diff --git a/electron34/patches/patch-components_upload__list_upload__list.cc b/electron34/patches/patch-components_upload__list_upload__list.cc
new file mode 100644
index 0000000000..cb9ee02f17
--- /dev/null
+++ b/electron34/patches/patch-components_upload__list_upload__list.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/upload_list/upload_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/upload_list/upload_list.cc
+@@ -65,6 +65,10 @@ void UploadList::Load(base::OnceClosure
+ base::BindOnce(&UploadList::OnLoadComplete, this));
+ }
+
++void UploadList::LoadSync() {
++ uploads_ = LoadUploadList();
++}
++
+ void UploadList::Clear(const base::Time& begin,
+ const base::Time& end,
+ base::OnceClosure callback) {
diff --git a/electron34/patches/patch-components_upload__list_upload__list.h b/electron34/patches/patch-components_upload__list_upload__list.h
new file mode 100644
index 0000000000..1e231e470a
--- /dev/null
+++ b/electron34/patches/patch-components_upload__list_upload__list.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/upload_list/upload_list.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/upload_list/upload_list.h
+@@ -82,6 +82,8 @@ class UploadList : public base::RefCount
+ // overwrite the previously supplied one, and the first will not be called.
+ void Load(base::OnceClosure callback);
+
++ void LoadSync();
++
+ // Clears any data associated with the upload list, where the upload time or
+ // capture time falls within the given range.
+ void Clear(const base::Time& begin,
diff --git a/electron34/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc b/electron34/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
new file mode 100644
index 0000000000..8d52f72d36
--- /dev/null
+++ b/electron34/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/url_formatter/spoof_checks/idn_spoof_checker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/url_formatter/spoof_checks/idn_spoof_checker.cc
+@@ -294,7 +294,7 @@ IDNSpoofChecker::IDNSpoofChecker() {
+ // The ideal fix would be to change the omnibox font used for Thai. In
+ // that case, the Linux-only list should be revisited and potentially
+ // removed.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ "[ทนบพรหเแ๐ดลปฟม]",
+ #else
+ "[บพเแ๐]",
diff --git a/electron34/patches/patch-components_user__education_views_help__bubble__view.cc b/electron34/patches/patch-components_user__education_views_help__bubble__view.cc
new file mode 100644
index 0000000000..6ac9978acb
--- /dev/null
+++ b/electron34/patches/patch-components_user__education_views_help__bubble__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/user_education/views/help_bubble_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/user_education/views/help_bubble_view.cc
+@@ -852,7 +852,7 @@ gfx::Rect HelpBubbleView::GetAnchorRect(
+ void HelpBubbleView::OnBeforeBubbleWidgetInit(views::Widget::InitParams* params,
+ views::Widget* widget) const {
+ BubbleDialogDelegateView::OnBeforeBubbleWidgetInit(params, widget);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Help bubbles anchored to menus may be clipped to their anchors' bounds,
+ // resulting in visual errors, unless they use accelerated rendering. See
+ // crbug.com/1445770 for details. This also applies to bubbles anchored to
diff --git a/electron34/patches/patch-components_variations_service_variations__service.cc b/electron34/patches/patch-components_variations_service_variations__service.cc
new file mode 100644
index 0000000000..34c774da72
--- /dev/null
+++ b/electron34/patches/patch-components_variations_service_variations__service.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/variations/service/variations_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/variations/service/variations_service.cc
+@@ -102,7 +102,7 @@ std::string GetPlatformString() {
+ return "android";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return "fuchsia";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_SOLARIS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_BSD)
+ // Default BSD and SOLARIS to Linux to not break those builds, although these
+ // platforms are not officially supported by Chrome.
+ return "linux";
diff --git a/electron34/patches/patch-components_visited__url__ranking_public_url__visit__util.cc b/electron34/patches/patch-components_visited__url__ranking_public_url__visit__util.cc
new file mode 100644
index 0000000000..4f38f26c34
--- /dev/null
+++ b/electron34/patches/patch-components_visited__url__ranking_public_url__visit__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/visited_url_ranking/public/url_visit_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/visited_url_ranking/public/url_visit_util.cc
+@@ -66,7 +66,7 @@ PlatformType GetPlatformInput() {
+ return PlatformType::kWindows;
+ #elif BUILDFLAG(IS_MAC)
+ return PlatformType::kMac;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return PlatformType::kLinux;
+ #elif BUILDFLAG(IS_IOS)
+ return PlatformType::kIos;
diff --git a/electron34/patches/patch-components_viz_host_gpu__host__impl.cc b/electron34/patches/patch-components_viz_host_gpu__host__impl.cc
new file mode 100644
index 0000000000..1bb15691ea
--- /dev/null
+++ b/electron34/patches/patch-components_viz_host_gpu__host__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/host/gpu_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/host/gpu_host_impl.cc
+@@ -139,7 +139,7 @@ GpuHostImpl::GpuHostImpl(Delegate* deleg
+ // overlays are not currently supported on Linux, elide the call here at this
+ // time.
+ // TODO(crbug.com/377886734): Fix the underlying issue and re-enable this call.
+-#if BUILDFLAG(IS_OZONE) && !BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_OZONE) && (!BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD))
+ gpu_service_params->supports_overlays = ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_overlays;
diff --git a/electron34/patches/patch-components_viz_host_host__display__client.cc b/electron34/patches/patch-components_viz_host_host__display__client.cc
new file mode 100644
index 0000000000..29a8bb95b7
--- /dev/null
+++ b/electron34/patches/patch-components_viz_host_host__display__client.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/host/host_display_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/host/host_display_client.cc
+@@ -48,9 +48,9 @@ void HostDisplayClient::OnDisplayReceive
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN)
+ void HostDisplayClient::CreateLayeredWindowUpdater(
+ mojo::PendingReceiver<mojom::LayeredWindowUpdater> receiver) {
++#if BUILDFLAG(IS_WIN)
+ if (!NeedsToUseLayerWindow(widget_)) {
+ DLOG(ERROR) << "HWND shouldn't be using a layered window";
+ return;
+@@ -58,14 +58,22 @@ void HostDisplayClient::CreateLayeredWin
+
+ layered_window_updater_ =
+ std::make_unique<LayeredWindowUpdaterImpl>(widget_, std::move(receiver));
++
++#else
++ CHECK(false) << "Chromium is calling CreateLayeredWindowUpdater for non-OSR "
++ "windows on POSIX platforms, something is wrong with "
++ "Electron's OSR implementation.";
++#endif
+ }
++
++#if BUILDFLAG(IS_WIN)
+ void HostDisplayClient::AddChildWindowToBrowser(
+ gpu::SurfaceHandle child_window) {
+ NOTREACHED_IN_MIGRATION();
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void HostDisplayClient::DidCompleteSwapWithNewSize(const gfx::Size& size) {
+ NOTIMPLEMENTED();
+ }
diff --git a/electron34/patches/patch-components_viz_host_host__display__client.h b/electron34/patches/patch-components_viz_host_host__display__client.h
new file mode 100644
index 0000000000..ecf12ab906
--- /dev/null
+++ b/electron34/patches/patch-components_viz_host_host__display__client.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/host/host_display_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/host/host_display_client.h
+@@ -39,6 +39,9 @@ class VIZ_HOST_EXPORT HostDisplayClient
+ gfx::AcceleratedWidget widget() const { return widget_; }
+ #endif
+
++ void CreateLayeredWindowUpdater(
++ mojo::PendingReceiver<mojom::LayeredWindowUpdater> receiver) override;
++
+ private:
+ // mojom::DisplayClient implementation:
+ #if BUILDFLAG(IS_APPLE)
+@@ -47,12 +50,10 @@ class VIZ_HOST_EXPORT HostDisplayClient
+ #endif
+
+ #if BUILDFLAG(IS_WIN)
+- void CreateLayeredWindowUpdater(
+- mojo::PendingReceiver<mojom::LayeredWindowUpdater> receiver) override;
+ void AddChildWindowToBrowser(gpu::SurfaceHandle child_window) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/electron34/patches/patch-components_viz_host_layered__window__updater__impl.cc b/electron34/patches/patch-components_viz_host_layered__window__updater__impl.cc
new file mode 100644
index 0000000000..401d92142e
--- /dev/null
+++ b/electron34/patches/patch-components_viz_host_layered__window__updater__impl.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/host/layered_window_updater_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/host/layered_window_updater_impl.cc
+@@ -46,7 +46,9 @@ void LayeredWindowUpdaterImpl::OnAllocat
+ // |region|'s handle will close when it goes out of scope.
+ }
+
+-void LayeredWindowUpdaterImpl::Draw(DrawCallback draw_callback) {
++void LayeredWindowUpdaterImpl::Draw(
++ const gfx::Rect& damage_rect,
++ DrawCallback draw_callback) {
+ TRACE_EVENT0("viz", "LayeredWindowUpdaterImpl::Draw");
+
+ if (!canvas_) {
diff --git a/electron34/patches/patch-components_viz_host_layered__window__updater__impl.h b/electron34/patches/patch-components_viz_host_layered__window__updater__impl.h
new file mode 100644
index 0000000000..0a265a0462
--- /dev/null
+++ b/electron34/patches/patch-components_viz_host_layered__window__updater__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/host/layered_window_updater_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/host/layered_window_updater_impl.h
+@@ -38,7 +38,7 @@ class VIZ_HOST_EXPORT LayeredWindowUpdat
+ // mojom::LayeredWindowUpdater implementation.
+ void OnAllocatedSharedMemory(const gfx::Size& pixel_size,
+ base::UnsafeSharedMemoryRegion region) override;
+- void Draw(DrawCallback draw_callback) override;
++ void Draw(const gfx::Rect& damage_rect, DrawCallback draw_callback) override;
+
+ private:
+ const HWND hwnd_;
diff --git a/electron34/patches/patch-components_viz_service_BUILD.gn b/electron34/patches/patch-components_viz_service_BUILD.gn
new file mode 100644
index 0000000000..b2160de647
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_BUILD.gn
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/BUILD.gn
+@@ -172,6 +172,8 @@ viz_component("service") {
+ "display_embedder/skia_output_surface_impl_on_gpu_debug_capture.h",
+ "display_embedder/skia_render_copy_results.cc",
+ "display_embedder/skia_render_copy_results.h",
++ "display_embedder/software_output_device_proxy.cc",
++ "display_embedder/software_output_device_proxy.h",
+ "display_embedder/software_output_surface.cc",
+ "display_embedder/software_output_surface.h",
+ "display_embedder/vsync_parameter_listener.cc",
+@@ -381,6 +383,7 @@ viz_component("service") {
+ "frame_sinks/external_begin_frame_source_mac.h",
+ ]
+ }
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_android || use_ozone) {
+@@ -663,6 +666,7 @@ viz_source_set("unit_tests") {
+ "display_embedder/software_output_device_mac_unittest.mm",
+ ]
+ frameworks = [ "IOSurface.framework" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_win) {
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider.h b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider.h
new file mode 100644
index 0000000000..0b261956ea
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/output_surface_provider.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/output_surface_provider.h
+@@ -42,7 +42,8 @@ class OutputSurfaceProvider {
+ mojom::DisplayClient* display_client,
+ DisplayCompositorMemoryAndTaskController* gpu_dependency,
+ const RendererSettings& renderer_settings,
+- const DebugRendererSettings* debug_settings) = 0;
++ const DebugRendererSettings* debug_settings,
++ bool offscreen) = 0;
+
+ virtual gpu::SharedImageManager* GetSharedImageManager() = 0;
+ virtual gpu::SyncPointManager* GetSyncPointManager() = 0;
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc
new file mode 100644
index 0000000000..e6aceaf471
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc
@@ -0,0 +1,67 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/output_surface_provider_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/output_surface_provider_impl.cc
+@@ -25,6 +25,7 @@
+ #include "components/viz/service/display_embedder/server_shared_bitmap_manager.h"
+ #include "components/viz/service/display_embedder/skia_output_surface_dependency_impl.h"
+ #include "components/viz/service/display_embedder/skia_output_surface_impl.h"
++#include "components/viz/service/display_embedder/software_output_device_proxy.h"
+ #include "components/viz/service/display_embedder/software_output_surface.h"
+ #include "components/viz/service/gl/gpu_service_impl.h"
+ #include "gpu/command_buffer/client/shared_memory_limits.h"
+@@ -32,6 +33,7 @@
+ #include "gpu/command_buffer/service/scheduler_sequence.h"
+ #include "gpu/config/gpu_finch_features.h"
+ #include "gpu/ipc/common/surface_handle.h"
++#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
+ #include "ui/base/ui_base_switches.h"
+
+ #if BUILDFLAG(IS_WIN)
+@@ -95,7 +97,8 @@ std::unique_ptr<OutputSurface> OutputSur
+ mojom::DisplayClient* display_client,
+ DisplayCompositorMemoryAndTaskController* gpu_dependency,
+ const RendererSettings& renderer_settings,
+- const DebugRendererSettings* debug_settings) {
++ const DebugRendererSettings* debug_settings,
++ bool offscreen) {
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ if (surface_handle == gpu::kNullSurfaceHandle)
+ return std::make_unique<OutputSurfaceUnified>();
+@@ -103,7 +106,7 @@ std::unique_ptr<OutputSurface> OutputSur
+
+ if (!gpu_compositing) {
+ return std::make_unique<SoftwareOutputSurface>(
+- CreateSoftwareOutputDeviceForPlatform(surface_handle, display_client));
++ CreateSoftwareOutputDeviceForPlatform(surface_handle, display_client, offscreen));
+ } else {
+ DCHECK(gpu_dependency);
+
+@@ -142,10 +145,22 @@ std::unique_ptr<OutputSurface> OutputSur
+ std::unique_ptr<SoftwareOutputDevice>
+ OutputSurfaceProviderImpl::CreateSoftwareOutputDeviceForPlatform(
+ gpu::SurfaceHandle surface_handle,
+- mojom::DisplayClient* display_client) {
++ mojom::DisplayClient* display_client,
++ bool offscreen) {
+ if (headless_)
+ return std::make_unique<SoftwareOutputDevice>();
+
++#if !BUILDFLAG(IS_APPLE)
++ if (offscreen) {
++ DCHECK(display_client);
++ mojo::PendingRemote<mojom::LayeredWindowUpdater> layered_window_updater;
++ display_client->CreateLayeredWindowUpdater(
++ layered_window_updater.InitWithNewPipeAndPassReceiver());
++ return std::make_unique<SoftwareOutputDeviceProxy>(
++ std::move(layered_window_updater));
++ }
++#endif
++
+ #if BUILDFLAG(IS_WIN)
+ return CreateSoftwareOutputDeviceWin(surface_handle, &output_device_backing_,
+ display_client);
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h
new file mode 100644
index 0000000000..b6afb79946
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/output_surface_provider_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/output_surface_provider_impl.h
+@@ -54,7 +54,8 @@ class VIZ_SERVICE_EXPORT OutputSurfacePr
+ mojom::DisplayClient* display_client,
+ DisplayCompositorMemoryAndTaskController* gpu_dependency,
+ const RendererSettings& renderer_settings,
+- const DebugRendererSettings* debug_settings) override;
++ const DebugRendererSettings* debug_settings,
++ bool offscreen) override;
+
+ gpu::SharedImageManager* GetSharedImageManager() override;
+ gpu::SyncPointManager* GetSyncPointManager() override;
+@@ -63,7 +64,8 @@ class VIZ_SERVICE_EXPORT OutputSurfacePr
+ private:
+ std::unique_ptr<SoftwareOutputDevice> CreateSoftwareOutputDeviceForPlatform(
+ gpu::SurfaceHandle surface_handle,
+- mojom::DisplayClient* display_client);
++ mojom::DisplayClient* display_client,
++ bool offscreen);
+
+ const raw_ptr<GpuServiceImpl> gpu_service_impl_;
+
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc b/electron34/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
new file mode 100644
index 0000000000..c55fe23fce
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/skia_output_surface_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/skia_output_surface_impl.cc
+@@ -1498,7 +1498,7 @@ GrBackendFormat SkiaOutputSurfaceImpl::G
+ ->GetVulkanPhysicalDevice(),
+ VK_IMAGE_TILING_OPTIMAL, vk_format,
+ si_format, yuv_color_space, ycbcr_info);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Textures that were allocated _on linux_ with ycbcr info came from
+ // VaapiVideoDecoder, which exports using DRM format modifiers.
+ return GrBackendFormats::MakeVk(gr_ycbcr_info,
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc
new file mode 100644
index 0000000000..d9974a42ec
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_device_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/software_output_device_mac.cc
+@@ -111,6 +111,8 @@ void SoftwareOutputDeviceMac::UpdateAndC
+
+ SkCanvas* SoftwareOutputDeviceMac::BeginPaint(
+ const gfx::Rect& new_damage_rect) {
++ last_damage = new_damage_rect;
++
+ // Record the previous paint buffer.
+ Buffer* previous_paint_buffer =
+ buffer_queue_.empty() ? nullptr : buffer_queue_.back().get();
+@@ -199,6 +201,7 @@ void SoftwareOutputDeviceMac::EndPaint()
+ ca_layer_params.is_empty = false;
+ ca_layer_params.scale_factor = scale_factor_;
+ ca_layer_params.pixel_size = pixel_size_;
++ ca_layer_params.damage = last_damage;
+ ca_layer_params.io_surface_mach_port.reset(
+ IOSurfaceCreateMachPort(current_paint_buffer_->io_surface.get()));
+ client_->SoftwareDeviceUpdatedCALayerParams(ca_layer_params);
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h
new file mode 100644
index 0000000000..80f2b6585e
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_device_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/software_output_device_mac.h
+@@ -62,6 +62,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputD
+ void UpdateAndCopyBufferDamage(Buffer* previous_paint_buffer,
+ const SkRegion& new_damage_rect);
+
++ gfx::Rect last_damage;
+ gfx::Size pixel_size_;
+ float scale_factor_ = 1;
+
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc
new file mode 100644
index 0000000000..2ac24569c2
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc
@@ -0,0 +1,170 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_device_proxy.cc.orig 2025-05-24 17:57:53.463259741 +0000
++++ components/viz/service/display_embedder/software_output_device_proxy.cc
+@@ -0,0 +1,161 @@
++// Copyright 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "components/viz/service/display_embedder/software_output_device_proxy.h"
++
++#include "base/memory/unsafe_shared_memory_region.h"
++#include "base/threading/thread_checker.h"
++#include "base/trace_event/trace_event.h"
++#include "build/build_config.h"
++#include "components/viz/common/resources/resource_sizes.h"
++#include "components/viz/service/display_embedder/output_device_backing.h"
++#include "mojo/public/cpp/system/platform_handle.h"
++#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
++#include "skia/ext/platform_canvas.h"
++#include "third_party/skia/include/core/SkCanvas.h"
++#include "ui/gfx/skia_util.h"
++
++#if BUILDFLAG(IS_WIN)
++#include "skia/ext/skia_utils_win.h"
++#include "ui/gfx/gdi_util.h"
++#include "ui/gfx/win/hwnd_util.h"
++#else
++#include "mojo/public/cpp/base/shared_memory_utils.h"
++#endif
++
++namespace viz {
++
++SoftwareOutputDeviceBase::~SoftwareOutputDeviceBase() {
++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
++ DCHECK(!in_paint_);
++}
++
++void SoftwareOutputDeviceBase::Resize(const gfx::Size& viewport_pixel_size,
++ float scale_factor) {
++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
++ DCHECK(!in_paint_);
++
++ if (viewport_pixel_size_ == viewport_pixel_size)
++ return;
++
++ viewport_pixel_size_ = viewport_pixel_size;
++ ResizeDelegated();
++}
++
++SkCanvas* SoftwareOutputDeviceBase::BeginPaint(const gfx::Rect& damage_rect) {
++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
++ DCHECK(!in_paint_);
++
++ damage_rect_ = damage_rect;
++ in_paint_ = true;
++ return BeginPaintDelegated();
++}
++
++void SoftwareOutputDeviceBase::EndPaint() {
++ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
++ DCHECK(in_paint_);
++
++ in_paint_ = false;
++
++ gfx::Rect intersected_damage_rect = damage_rect_;
++ intersected_damage_rect.Intersect(gfx::Rect(viewport_pixel_size_));
++ if (intersected_damage_rect.IsEmpty())
++ return;
++
++ EndPaintDelegated(intersected_damage_rect);
++}
++
++SoftwareOutputDeviceProxy::~SoftwareOutputDeviceProxy() = default;
++
++SoftwareOutputDeviceProxy::SoftwareOutputDeviceProxy(
++ mojo::PendingRemote<mojom::LayeredWindowUpdater> layered_window_updater)
++ : layered_window_updater_(std::move(layered_window_updater)) {
++ DCHECK(layered_window_updater_.is_bound());
++}
++
++void SoftwareOutputDeviceProxy::OnSwapBuffers(
++ SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback,
++ gfx::FrameData data) {
++ DCHECK(swap_ack_callback_.is_null());
++
++ // We aren't waiting on DrawAck() and can immediately run the callback.
++ if (!waiting_on_draw_ack_) {
++ task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(std::move(swap_ack_callback), viewport_pixel_size_));
++ return;
++ }
++
++ swap_ack_callback_ = std::move(swap_ack_callback);
++}
++
++void SoftwareOutputDeviceProxy::ResizeDelegated() {
++ canvas_.reset();
++
++ size_t required_bytes;
++ if (!ResourceSizes::MaybeSizeInBytes(viewport_pixel_size_,
++ SinglePlaneFormat::kRGBA_8888,
++ &required_bytes)) {
++ DLOG(ERROR) << "Invalid viewport size " << viewport_pixel_size_.ToString();
++ return;
++ }
++
++ base::UnsafeSharedMemoryRegion region =
++ base::UnsafeSharedMemoryRegion::Create(required_bytes);
++ if (!region.IsValid()) {
++ DLOG(ERROR) << "Failed to allocate " << required_bytes << " bytes";
++ return;
++ }
++
++#if defined(WIN32)
++ canvas_ = skia::CreatePlatformCanvasWithSharedSection(
++ viewport_pixel_size_.width(), viewport_pixel_size_.height(), false,
++ region.GetPlatformHandle(), skia::CRASH_ON_FAILURE);
++#else
++ shm_mapping_ = region.Map();
++ if (!shm_mapping_.IsValid()) {
++ DLOG(ERROR) << "Failed to map " << required_bytes << " bytes";
++ return;
++ }
++
++ canvas_ = skia::CreatePlatformCanvasWithPixels(
++ viewport_pixel_size_.width(), viewport_pixel_size_.height(), false,
++ static_cast<uint8_t*>(shm_mapping_.memory()), skia::CRASH_ON_FAILURE);
++#endif
++
++ // Transfer region ownership to the browser process.
++ layered_window_updater_->OnAllocatedSharedMemory(viewport_pixel_size_,
++ std::move(region));
++}
++
++SkCanvas* SoftwareOutputDeviceProxy::BeginPaintDelegated() {
++ return canvas_.get();
++}
++
++void SoftwareOutputDeviceProxy::EndPaintDelegated(
++ const gfx::Rect& damage_rect) {
++ DCHECK(!waiting_on_draw_ack_);
++
++ if (!canvas_)
++ return;
++
++ layered_window_updater_->Draw(
++ damage_rect, base::BindOnce(&SoftwareOutputDeviceProxy::DrawAck,
++ base::Unretained(this)));
++ waiting_on_draw_ack_ = true;
++
++ TRACE_EVENT_ASYNC_BEGIN0("viz", "SoftwareOutputDeviceProxy::Draw", this);
++}
++
++void SoftwareOutputDeviceProxy::DrawAck() {
++ DCHECK(waiting_on_draw_ack_);
++ DCHECK(!swap_ack_callback_.is_null());
++
++ TRACE_EVENT_ASYNC_END0("viz", "SoftwareOutputDeviceProxy::Draw", this);
++
++ waiting_on_draw_ack_ = false;
++ std::move(swap_ack_callback_).Run(viewport_pixel_size_);
++}
++
++} // namespace viz
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h
new file mode 100644
index 0000000000..5e0cce4184
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h
@@ -0,0 +1,107 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_device_proxy.h.orig 2025-05-24 17:57:53.463402716 +0000
++++ components/viz/service/display_embedder/software_output_device_proxy.h
+@@ -0,0 +1,98 @@
++// Copyright 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
++#define COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
++
++#include <memory>
++
++#include "base/memory/shared_memory_mapping.h"
++#include "base/threading/thread_checker.h"
++#include "build/build_config.h"
++#include "components/viz/host/host_display_client.h"
++#include "components/viz/service/display/software_output_device.h"
++#include "components/viz/service/viz_service_export.h"
++#include "mojo/public/cpp/bindings/pending_remote.h"
++#include "mojo/public/cpp/bindings/remote.h"
++#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
++#include "services/viz/privileged/mojom/compositing/layered_window_updater.mojom.h"
++
++#if BUILDFLAG(IS_WIN)
++#include <windows.h>
++#endif
++
++namespace viz {
++
++// Shared base class for SoftwareOutputDevice implementations.
++class SoftwareOutputDeviceBase : public SoftwareOutputDevice {
++ public:
++ SoftwareOutputDeviceBase() = default;
++ ~SoftwareOutputDeviceBase() override;
++
++ SoftwareOutputDeviceBase(const SoftwareOutputDeviceBase&) = delete;
++ SoftwareOutputDeviceBase& operator=(const SoftwareOutputDeviceBase&) = delete;
++
++ // SoftwareOutputDevice implementation.
++ void Resize(const gfx::Size& viewport_pixel_size,
++ float scale_factor) override;
++ SkCanvas* BeginPaint(const gfx::Rect& damage_rect) override;
++ void EndPaint() override;
++
++ // Called from Resize() if |viewport_pixel_size_| has changed.
++ virtual void ResizeDelegated() = 0;
++
++ // Called from BeginPaint() and should return an SkCanvas.
++ virtual SkCanvas* BeginPaintDelegated() = 0;
++
++ // Called from EndPaint() if there is damage.
++ virtual void EndPaintDelegated(const gfx::Rect& damage_rect) = 0;
++
++ private:
++ bool in_paint_ = false;
++
++ THREAD_CHECKER(thread_checker_);
++};
++
++// SoftwareOutputDevice implementation that draws indirectly. An implementation
++// of mojom::LayeredWindowUpdater in the browser process handles the actual
++// drawing. Pixel backing is in SharedMemory so no copying between processes
++// is required.
++class SoftwareOutputDeviceProxy : public SoftwareOutputDeviceBase {
++ public:
++ explicit SoftwareOutputDeviceProxy(
++ mojo::PendingRemote<mojom::LayeredWindowUpdater> layered_window_updater);
++ ~SoftwareOutputDeviceProxy() override;
++
++ SoftwareOutputDeviceProxy(const SoftwareOutputDeviceProxy&) = delete;
++ SoftwareOutputDeviceProxy& operator=(const SoftwareOutputDeviceProxy&) =
++ delete;
++
++ // SoftwareOutputDevice implementation.
++ void OnSwapBuffers(
++ SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback,
++ gfx::FrameData data) override;
++
++ // SoftwareOutputDeviceBase implementation.
++ void ResizeDelegated() override;
++ SkCanvas* BeginPaintDelegated() override;
++ void EndPaintDelegated(const gfx::Rect& rect) override;
++
++ private:
++ // Runs |swap_ack_callback_| after draw has happened.
++ void DrawAck();
++
++ mojo::Remote<mojom::LayeredWindowUpdater> layered_window_updater_;
++
++ std::unique_ptr<SkCanvas> canvas_;
++ bool waiting_on_draw_ack_ = false;
++ SoftwareOutputDevice::SwapBuffersCallback swap_ack_callback_;
++
++#if !defined(WIN32)
++ base::WritableSharedMemoryMapping shm_mapping_;
++#endif
++};
++
++} // namespace viz
++
++#endif // COMPONENTS_VIZ_SERVICE_DISPLAY_EMBEDDER_SOFTWARE_OUTPUT_DEVICE_PROXY_H_
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc
new file mode 100644
index 0000000000..f26f0b24c0
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_device_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/software_output_device_win.cc
+@@ -193,7 +193,7 @@ void SoftwareOutputDeviceWinProxy::EndPa
+ if (!canvas_)
+ return;
+
+- layered_window_updater_->Draw(base::BindOnce(
++ layered_window_updater_->Draw(damage_rect, base::BindOnce(
+ &SoftwareOutputDeviceWinProxy::DrawAck, base::Unretained(this)));
+ waiting_on_draw_ack_ = true;
+
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.cc b/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.cc
new file mode 100644
index 0000000000..476ac01d9d
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_surface.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/software_output_surface.cc
+@@ -113,7 +113,7 @@ void SoftwareOutputSurface::SwapBuffersC
+ base::TimeTicks now = base::TimeTicks::Now();
+ base::TimeDelta interval_to_next_refresh =
+ now.SnappedToNextTick(refresh_timebase_, refresh_interval_) - now;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (needs_swap_size_notifications_)
+ client_->DidSwapWithSize(pixel_size);
+ #endif
+@@ -140,7 +140,7 @@ gfx::OverlayTransform SoftwareOutputSurf
+ return gfx::OVERLAY_TRANSFORM_NONE;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SoftwareOutputSurface::SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) {
+ needs_swap_size_notifications_ = needs_swap_size_notifications;
diff --git a/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.h b/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.h
new file mode 100644
index 0000000000..b840b1a4ab
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display__embedder_software__output__surface.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display_embedder/software_output_surface.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display_embedder/software_output_surface.h
+@@ -42,7 +42,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputS
+ UpdateVSyncParametersCallback callback) override;
+ void SetDisplayTransformHint(gfx::OverlayTransform transform) override {}
+ gfx::OverlayTransform GetDisplayTransform() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) override;
+ #endif
+@@ -60,7 +60,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputS
+ base::TimeTicks refresh_timebase_;
+ base::TimeDelta refresh_interval_ = BeginFrameArgs::DefaultInterval();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool needs_swap_size_notifications_ = false;
+ #endif
+
diff --git a/electron34/patches/patch-components_viz_service_display_skia__renderer.cc b/electron34/patches/patch-components_viz_service_display_skia__renderer.cc
new file mode 100644
index 0000000000..7f117cf01f
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_display_skia__renderer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/display/skia_renderer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/display/skia_renderer.cc
+@@ -1358,7 +1358,7 @@ void SkiaRenderer::ClearFramebuffer() {
+ if (current_frame()->current_render_pass->has_transparent_background) {
+ ClearCanvas(SkColors::kTransparent);
+ } else {
+-#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX)
++#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // On DEBUG builds, opaque render passes are cleared to blue
+ // to easily see regions that were not drawn on the screen.
+ // ClearCavas() call causes slight pixel difference, so linux-ref and
diff --git a/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc b/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
new file mode 100644
index 0000000000..2a1547500c
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
+@@ -102,7 +102,8 @@ RootCompositorFrameSinkImpl::Create(
+ params->gpu_compositing, params->widget);
+ auto output_surface = output_surface_provider->CreateOutputSurface(
+ params->widget, params->gpu_compositing, display_client.get(),
+- display_controller.get(), params->renderer_settings, debug_settings);
++ display_controller.get(), params->renderer_settings, debug_settings,
++ params->offscreen);
+
+ // Creating output surface failed. The host can send a new request, possibly
+ // with a different compositing mode.
+@@ -113,7 +114,7 @@ RootCompositorFrameSinkImpl::Create(
+ output_surface->SetNeedsSwapSizeNotifications(
+ params->send_swap_size_notifications);
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ // For X11, we need notify client about swap completion after resizing, so the
+ // client can use it for synchronize with X11 WM.
+ output_surface->SetNeedsSwapSizeNotifications(true);
+@@ -794,7 +795,7 @@ void RootCompositorFrameSinkImpl::Displa
+ if (display_client_ && enable_swap_completion_callback_) {
+ display_client_->DidCompleteSwapWithSize(pixel_size);
+ }
+-#elif BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ if (display_client_ && pixel_size != last_swap_pixel_size_) {
+ last_swap_pixel_size_ = pixel_size;
+ display_client_->DidCompleteSwapWithNewSize(last_swap_pixel_size_);
diff --git a/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h b/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
new file mode 100644
index 0000000000..38bfc1ae43
--- /dev/null
+++ b/electron34/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h
+@@ -231,7 +231,7 @@ class VIZ_SERVICE_EXPORT RootCompositorF
+ // See comments on `EvictionHandler`.
+ EvictionHandler eviction_handler_;
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ gfx::Size last_swap_pixel_size_;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/electron34/patches/patch-components_viz_test_fake__display__client.cc b/electron34/patches/patch-components_viz_test_fake__display__client.cc
new file mode 100644
index 0000000000..6c5fc3f621
--- /dev/null
+++ b/electron34/patches/patch-components_viz_test_fake__display__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/test/fake_display_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/test/fake_display_client.cc
+@@ -27,7 +27,7 @@ void FakeDisplayClient::AddChildWindowTo
+ gpu::SurfaceHandle child_window) {}
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void FakeDisplayClient::DidCompleteSwapWithNewSize(const gfx::Size& size) {}
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/electron34/patches/patch-components_viz_test_fake__display__client.h b/electron34/patches/patch-components_viz_test_fake__display__client.h
new file mode 100644
index 0000000000..90d411922e
--- /dev/null
+++ b/electron34/patches/patch-components_viz_test_fake__display__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/test/fake_display_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/test/fake_display_client.h
+@@ -36,7 +36,7 @@ class FakeDisplayClient : public mojom::
+ void AddChildWindowToBrowser(gpu::SurfaceHandle child_window) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/electron34/patches/patch-components_viz_test_mock__display__client.h b/electron34/patches/patch-components_viz_test_mock__display__client.h
new file mode 100644
index 0000000000..591af3cf4a
--- /dev/null
+++ b/electron34/patches/patch-components_viz_test_mock__display__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/test/mock_display_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/test/mock_display_client.h
+@@ -45,7 +45,7 @@ class MockDisplayClient : public mojom::
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
+ MOCK_METHOD1(SetPreferredRefreshRate, void(float refresh_rate));
+ #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ MOCK_METHOD1(DidCompleteSwapWithNewSize, void(const gfx::Size&));
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
diff --git a/electron34/patches/patch-components_viz_test_test__output__surface__provider.cc b/electron34/patches/patch-components_viz_test_test__output__surface__provider.cc
new file mode 100644
index 0000000000..2c09082e83
--- /dev/null
+++ b/electron34/patches/patch-components_viz_test_test__output__surface__provider.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/test/test_output_surface_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/test/test_output_surface_provider.cc
+@@ -30,7 +30,8 @@ std::unique_ptr<OutputSurface> TestOutpu
+ mojom::DisplayClient* display_client,
+ DisplayCompositorMemoryAndTaskController* display_controller,
+ const RendererSettings& renderer_settings,
+- const DebugRendererSettings* debug_settings) {
++ const DebugRendererSettings* debug_settings,
++ bool offscreen) {
+ if (gpu_compositing) {
+ return FakeSkiaOutputSurface::Create3d();
+ } else {
diff --git a/electron34/patches/patch-components_viz_test_test__output__surface__provider.h b/electron34/patches/patch-components_viz_test_test__output__surface__provider.h
new file mode 100644
index 0000000000..edca1263fd
--- /dev/null
+++ b/electron34/patches/patch-components_viz_test_test__output__surface__provider.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/viz/test/test_output_surface_provider.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/viz/test/test_output_surface_provider.h
+@@ -32,7 +32,8 @@ class TestOutputSurfaceProvider : public
+ mojom::DisplayClient* display_client,
+ DisplayCompositorMemoryAndTaskController* display_controller,
+ const RendererSettings& renderer_settings,
+- const DebugRendererSettings* debug_settings) override;
++ const DebugRendererSettings* debug_settings,
++ bool offscreen) override;
+ gpu::SharedImageManager* GetSharedImageManager() override;
+ gpu::SyncPointManager* GetSyncPointManager() override;
+ gpu::Scheduler* GetGpuScheduler() override;
diff --git a/electron34/patches/patch-components_webrtc_media__stream__devices__controller.cc b/electron34/patches/patch-components_webrtc_media__stream__devices__controller.cc
new file mode 100644
index 0000000000..0b5750039d
--- /dev/null
+++ b/electron34/patches/patch-components_webrtc_media__stream__devices__controller.cc
@@ -0,0 +1,78 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/webrtc/media_stream_devices_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/webrtc/media_stream_devices_controller.cc
+@@ -57,7 +57,8 @@ bool PermissionIsRequested(blink::Permis
+ void MediaStreamDevicesController::RequestPermissions(
+ const content::MediaStreamRequest& request,
+ MediaStreamDeviceEnumerator* enumerator,
+- ResultCallback callback) {
++ ResultCallback callback,
++ bool previously_approved) {
+ content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(
+ request.render_process_id, request.render_frame_id);
+ // The RFH may have been destroyed by the time the request is processed.
+@@ -92,7 +93,7 @@ void MediaStreamDevicesController::Reque
+ std::move(callback)));
+
+ std::vector<blink::PermissionType> permission_types;
+-
++#if 0
+ content::PermissionController* permission_controller =
+ web_contents->GetBrowserContext()->GetPermissionController();
+
+@@ -165,19 +166,26 @@ void MediaStreamDevicesController::Reque
+ requested_audio_capture_device_ids;
+ permission_request_description.requested_video_capture_device_ids =
+ requested_video_capture_device_ids;
+-
++#endif
+ // It is OK to ignore `request.security_origin` because it will be calculated
+ // from `render_frame_host` and we always ignore `requesting_origin` for
+ // `AUDIO_CAPTURE` and `VIDEO_CAPTURE`.
+ // `render_frame_host->GetMainFrame()->GetLastCommittedOrigin()` will be used
+ // instead.
+- rfh->GetBrowserContext()
+- ->GetPermissionController()
+- ->RequestPermissionsFromCurrentDocument(
+- rfh, permission_request_description,
+- base::BindOnce(
+- &MediaStreamDevicesController::PromptAnsweredGroupedRequest,
+- std::move(controller)));
++ if (previously_approved) {
++ controller->PromptAnsweredGroupedRequest({blink::mojom::PermissionStatus::GRANTED /*audio*/,
++ blink::mojom::PermissionStatus::GRANTED /*video*/});
++ } else {
++ rfh->GetBrowserContext()
++ ->GetPermissionController()
++ ->RequestPermissionsFromCurrentDocument(
++ rfh,
++ content::PermissionRequestDescription(permission_types,
++ request.user_gesture),
++ base::BindOnce(
++ &MediaStreamDevicesController::PromptAnsweredGroupedRequest,
++ std::move(controller)));
++ }
+ }
+
+ MediaStreamDevicesController::~MediaStreamDevicesController() {
+@@ -429,6 +437,7 @@ bool MediaStreamDevicesController::Permi
+ return false;
+ }
+
++#if 0
+ // TODO(raymes): This function wouldn't be needed if
+ // PermissionManager::RequestPermissions returned a denial reason.
+ content::PermissionResult result =
+@@ -439,6 +448,7 @@ bool MediaStreamDevicesController::Permi
+ DCHECK_EQ(blink::mojom::PermissionStatus::DENIED, result.status);
+ return true;
+ }
++#endif
+ return false;
+ }
+
diff --git a/electron34/patches/patch-components_webrtc_media__stream__devices__controller.h b/electron34/patches/patch-components_webrtc_media__stream__devices__controller.h
new file mode 100644
index 0000000000..8a46a9ce85
--- /dev/null
+++ b/electron34/patches/patch-components_webrtc_media__stream__devices__controller.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- components/webrtc/media_stream_devices_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ components/webrtc/media_stream_devices_controller.h
+@@ -48,7 +48,8 @@ class MediaStreamDevicesController {
+ // synchronously or asynchronously returned via |callback|.
+ static void RequestPermissions(const content::MediaStreamRequest& request,
+ MediaStreamDeviceEnumerator* enumerator,
+- ResultCallback callback);
++ ResultCallback callback,
++ bool previously_approved = false);
+
+ ~MediaStreamDevicesController();
+
diff --git a/electron34/patches/patch-content_app_BUILD.gn b/electron34/patches/patch-content_app_BUILD.gn
new file mode 100644
index 0000000000..eab987e266
--- /dev/null
+++ b/electron34/patches/patch-content_app_BUILD.gn
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/app/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/app/BUILD.gn
+@@ -96,9 +96,9 @@ source_set("content_main_runner_app") {
+ "//chromeos/startup:constants",
+ ]
+ }
+- if (build_tflite_with_xnnpack) {
+- deps += [ "//third_party/cpuinfo" ]
+- }
++# if (build_tflite_with_xnnpack) {
++# deps += [ "//third_party/cpuinfo" ]
++# }
+ }
+
+ source_set("app") {
diff --git a/electron34/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm b/electron34/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
new file mode 100644
index 0000000000..4973aad96b
--- /dev/null
+++ b/electron34/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
@@ -0,0 +1,55 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
+@@ -15,6 +15,7 @@
+ #include "content/common/web_contents_ns_view_bridge.mojom.h"
+ #include "content/public/browser/remote_cocoa.h"
+ #include "content/public/browser/render_widget_host_view_mac_delegate.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/associated_receiver.h"
+ #include "mojo/public/cpp/bindings/associated_remote.h"
+ #include "mojo/public/cpp/bindings/pending_associated_receiver.h"
+@@ -63,7 +64,9 @@ class RenderWidgetHostNSViewBridgeOwner
+ const RenderWidgetHostNSViewBridgeOwner&) = delete;
+
+ private:
++#if !IS_MAS_BUILD()
+ NSAccessibilityRemoteUIElement* __strong remote_accessibility_element_;
++#endif
+ void OnMojoDisconnect() { delete this; }
+
+ std::unique_ptr<blink::WebCoalescedInputEvent> TranslateEvent(
+@@ -75,6 +78,7 @@ class RenderWidgetHostNSViewBridgeOwner
+ }
+
+ id GetAccessibilityElement() override {
++#if !IS_MAS_BUILD()
+ if (!remote_accessibility_element_) {
+ base::ProcessId browser_pid = base::kNullProcessId;
+ std::vector<uint8_t> element_token;
+@@ -85,6 +89,9 @@ class RenderWidgetHostNSViewBridgeOwner
+ ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
+ }
+ return remote_accessibility_element_;
++#else
++ return nil;
++#endif
+ }
+
+ // RenderWidgetHostNSViewHostHelper implementation.
+@@ -103,8 +110,10 @@ class RenderWidgetHostNSViewBridgeOwner
+ return [bridgedContentView accessibilityFocusedUIElement];
+ }
+ void SetAccessibilityWindow(NSWindow* window) override {
++#if !IS_MAS_BUILD()
+ host_->SetRemoteAccessibilityWindowToken(
+ ui::RemoteAccessibility::GetTokenForLocalElement(window));
++#endif
+ }
+
+ void ForwardKeyboardEvent(const input::NativeWebKeyboardEvent& key_event,
diff --git a/electron34/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm b/electron34/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
new file mode 100644
index 0000000000..b81d27f6ec
--- /dev/null
+++ b/electron34/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
@@ -0,0 +1,100 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+@@ -35,6 +35,7 @@
+ #include "content/public/browser/browser_accessibility_state.h"
+ #import "content/public/browser/render_widget_host_view_mac_delegate.h"
+ #include "content/public/common/content_features.h"
++#include "electron/mas.h"
+ #include "skia/ext/skia_utils_mac.h"
+ #include "third_party/blink/public/common/features.h"
+ #include "third_party/blink/public/mojom/input/input_handler.mojom.h"
+@@ -169,6 +170,15 @@ void ExtractUnderlines(NSAttributedStrin
+
+ } // namespace
+
++@interface NSWindow (AtomCustomMethods)
++- (BOOL)acceptsFirstMouse;
++- (BOOL)disableAutoHideCursor;
++@end
++
++@interface NSView (ElectronCustomMethods)
++- (BOOL)shouldIgnoreMouseEvent;
++@end
++
+ // RenderWidgetHostViewCocoa ---------------------------------------------------
+
+ // Private methods:
+@@ -767,6 +777,9 @@ void ExtractUnderlines(NSAttributedStrin
+ }
+
+ - (BOOL)acceptsFirstMouse:(NSEvent*)theEvent {
++ if ([self.window respondsToSelector:@selector(acceptsFirstMouse)] &&
++ [self.window acceptsFirstMouse])
++ return YES;
+ // Enable "click-through" if mouse clicks are accepted in inactive windows
+ return [self acceptsMouseEventsOption] > kAcceptMouseEventsInActiveWindow;
+ }
+@@ -861,6 +874,10 @@ void ExtractUnderlines(NSAttributedStrin
+ // its parent view.
+ BOOL hitSelf = NO;
+ while (view) {
++ if ([view respondsToSelector:@selector(shouldIgnoreMouseEvent)] && ![view shouldIgnoreMouseEvent]) {
++ return NO;
++ }
++
+ if (view == self)
+ hitSelf = YES;
+ if ([view isKindOfClass:[self class]] && ![view isEqual:self] &&
+@@ -1183,6 +1200,10 @@ void ExtractUnderlines(NSAttributedStrin
+ eventType == NSEventTypeKeyDown &&
+ !(modifierFlags & NSEventModifierFlagCommand);
+
++ if ([theEvent.window respondsToSelector:@selector(disableAutoHideCursor)] &&
++ [theEvent.window disableAutoHideCursor])
++ shouldAutohideCursor = NO;
++
+ // We only handle key down events and just simply forward other events.
+ if (eventType != NSEventTypeKeyDown) {
+ _hostHelper->ForwardKeyboardEvent(event, latencyInfo);
+@@ -2039,15 +2060,21 @@ void ExtractUnderlines(NSAttributedStrin
+ // Since this implementation doesn't have to wait any IPC calls, this doesn't
+ // make any key-typing jank. --hbono 7/23/09
+ //
++#if !IS_MAS_BUILD()
+ extern "C" {
+ extern NSString* NSTextInputReplacementRangeAttributeName;
+ }
++#endif
+
+ - (NSArray*)validAttributesForMarkedText {
+ // This code is just copied from WebKit except renaming variables.
+ static NSArray* const kAttributes = @[
+ NSUnderlineStyleAttributeName, NSUnderlineColorAttributeName,
++#if !IS_MAS_BUILD()
+ NSMarkedClauseSegmentAttributeName, NSTextInputReplacementRangeAttributeName
++#else
++ NSMarkedClauseSegmentAttributeName
++#endif
+ ];
+ return kAttributes;
+ }
+@@ -2310,9 +2337,10 @@ extern NSString* NSTextInputReplacementR
+ if ([self isHandlingKeyDown] && !_isReconversionTriggered) {
+ _setMarkedTextReplacementRange = gfx::Range(replacementRange);
+ } else {
+- _host->ImeSetComposition(_markedText, _imeTextSpans,
+- gfx::Range(replacementRange), newSelRange.location,
+- NSMaxRange(newSelRange));
++ _host->ImeSetComposition(
++ _markedText, _imeTextSpans,
++ gfx::Range::FromPossiblyInvalidNSRange(replacementRange),
++ newSelRange.location, NSMaxRange(newSelRange));
+ }
+
+ [[self inputContext] invalidateCharacterCoordinates];
diff --git a/electron34/patches/patch-content_app_content__main.cc b/electron34/patches/patch-content_app_content__main.cc
new file mode 100644
index 0000000000..ba5989ab68
--- /dev/null
+++ b/electron34/patches/patch-content_app_content__main.cc
@@ -0,0 +1,51 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/app/content_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/app/content_main.cc
+@@ -227,7 +227,7 @@ NO_STACK_PROTECTOR int RunContentProcess
+ base::EnableTerminationOnOutOfMemory();
+ logging::RegisterAbslAbortHook();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The various desktop environments set this environment variable that
+ // allows the dbus client library to connect directly to the bus. When this
+ // variable is not set (test environments like xvfb-run), the dbus client
+@@ -313,7 +313,7 @@ NO_STACK_PROTECTOR int RunContentProcess
+ command_line->AppendSwitch(switches::kUseMobileUserAgent);
+ #endif
+
+-#if (BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)) && !defined(COMPONENT_BUILD)
++#if (BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)) && !defined(COMPONENT_BUILD) && defined(notyet)
+ base::subtle::EnableFDOwnershipEnforcement(true);
+ #endif
+
+@@ -326,16 +326,14 @@ NO_STACK_PROTECTOR int RunContentProcess
+
+ #if BUILDFLAG(IS_WIN)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+- if (command_line->HasSwitch(switches::kHeadless)) {
+- // When running in headless mode we want stdio routed however if
+- // console does not exist we should not create one.
+- base::RouteStdioToConsole(/*create_console_if_not_found*/ false);
+- } else if (command_line->HasSwitch(switches::kEnableLogging)) {
+- // Route stdio to parent console (if any) or create one, do not create a
+- // console in children if handles are being passed.
+- bool create_console = command_line->GetSwitchValueASCII(
+- switches::kEnableLogging) != "handle";
+- base::RouteStdioToConsole(create_console);
++ // Route stdio to parent console (if any) or create one.
++ bool const log_to_stderr =
++ command_line->HasSwitch(switches::kEnableLogging) &&
++ command_line->GetSwitchValueASCII(switches::kEnableLogging) != "file" &&
++ !command_line->HasSwitch(switches::kLogFile) &&
++ command_line->GetSwitchValueASCII(switches::kEnableLogging) != "handle";
++ if (log_to_stderr) {
++ base::RouteStdioToConsole(true);
+ }
+ #endif
+
diff --git a/electron34/patches/patch-content_app_content__main__runner__impl.cc b/electron34/patches/patch-content_app_content__main__runner__impl.cc
new file mode 100644
index 0000000000..4b5b0fd6fe
--- /dev/null
+++ b/electron34/patches/patch-content_app_content__main__runner__impl.cc
@@ -0,0 +1,186 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/app/content_main_runner_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/app/content_main_runner_impl.cc
+@@ -147,18 +147,20 @@
+ #include "content/browser/posix_file_descriptor_info_impl.h"
+ #include "content/public/common/content_descriptors.h"
+
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ #include "content/public/common/zygote/zygote_fork_delegate_linux.h"
+ #endif
+
+ #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_path_watcher_inotify.h"
+ #include "base/native_library.h"
+ #include "base/rand_util.h"
+ #include "content/public/common/zygote/sandbox_support_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "third_party/boringssl/src/include/openssl/crypto.h"
+ #include "third_party/webrtc_overrides/init_webrtc.h" // nogncheck
+
+@@ -192,6 +194,10 @@
+ #include "media/base/media_switches.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "base/system/sys_info.h"
++#endif
++
+ #if BUILDFLAG(IS_ANDROID)
+ #include "base/system/sys_info.h"
+ #include "content/browser/android/battery_metrics.h"
+@@ -279,8 +285,13 @@ void AsanProcessInfoCB(const char*, bool
+ }
+ #endif // defined(ADDRESS_SANITIZER)
+
+-void LoadV8SnapshotFile(const base::CommandLine& command_line) {
++void LoadV8SnapshotFile(const raw_ptr<ContentMainDelegate> delegate, const base::CommandLine& command_line) {
+ const gin::V8SnapshotFileType snapshot_type = GetSnapshotType(command_line);
++ std::string_view browser_v8_snapshot_file_name = delegate->GetBrowserV8SnapshotFilename();
++ if (!browser_v8_snapshot_file_name.empty()) {
++ gin::V8Initializer::LoadV8SnapshotFromFileName(browser_v8_snapshot_file_name, snapshot_type);
++ return;
++ }
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ base::FileDescriptorStore& file_descriptor_store =
+ base::FileDescriptorStore::GetInstance();
+@@ -300,11 +311,8 @@ void LoadV8SnapshotFile(const base::Comm
+
+ bool ShouldLoadV8Snapshot(const base::CommandLine& command_line,
+ const std::string& process_type) {
+- // The gpu does not need v8, and the browser only needs v8 when in single
+- // process mode.
+- if (process_type == switches::kGpuProcess ||
+- (process_type.empty() &&
+- !command_line.HasSwitch(switches::kSingleProcess))) {
++ // The gpu does not need v8
++ if (process_type == switches::kGpuProcess) {
+ return false;
+ }
+ return true;
+@@ -312,11 +320,12 @@ bool ShouldLoadV8Snapshot(const base::Co
+
+ #endif // V8_USE_EXTERNAL_STARTUP_DATA
+
+-void LoadV8SnapshotIfNeeded(const base::CommandLine& command_line,
++void LoadV8SnapshotIfNeeded(const raw_ptr<ContentMainDelegate> delegate,
++ const base::CommandLine& command_line,
+ const std::string& process_type) {
+ #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+ if (ShouldLoadV8Snapshot(command_line, process_type))
+- LoadV8SnapshotFile(command_line);
++ LoadV8SnapshotFile(delegate, command_line);
+ #endif // V8_USE_EXTERNAL_STARTUP_DATA
+ }
+
+@@ -399,7 +408,7 @@ void InitializeZygoteSandboxForBrowserPr
+ }
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ #if BUILDFLAG(ENABLE_PPAPI)
+ // Loads the (native) libraries but does not initialize them (i.e., does not
+@@ -437,7 +446,10 @@ void PreloadLibraryCdms() {
+
+ void PreSandboxInit() {
+ // Ensure the /dev/urandom is opened.
++ // we use arc4random
++#if !BUILDFLAG(IS_BSD)
+ base::GetUrandomFD();
++#endif
+
+ // May use sysinfo(), sched_getaffinity(), and open various /sys/ and /proc/
+ // files.
+@@ -449,9 +461,16 @@ void PreSandboxInit() {
+ // https://boringssl.googlesource.com/boringssl/+/HEAD/SANDBOXING.md
+ CRYPTO_pre_sandbox_init();
+
++#if BUILDFLAG(IS_BSD)
++ // "cache" the amount of physical memory before pledge(2)
++ base::SysInfo::AmountOfPhysicalMemoryMB();
++#endif
++
++#if !BUILDFLAG(IS_BSD)
+ // Pre-read /proc/sys/fs/inotify/max_user_watches so it doesn't have to be
+ // allowed by the sandbox.
+ base::GetMaxNumberOfInotifyWatches();
++#endif
+
+ #if BUILDFLAG(ENABLE_PPAPI)
+ // Ensure access to the Pepper plugins before the sandbox is turned on.
+@@ -762,7 +781,7 @@ NO_STACK_PROTECTOR int RunOtherNamedProc
+ unregister_thread_closure = base::HangWatcher::RegisterThread(
+ base::HangWatcher::ThreadType::kMainThread);
+ bool start_hang_watcher_now;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux/ChromeOS, the HangWatcher can't start until after the sandbox is
+ // initialized, because the sandbox can't be started with multiple threads.
+ // TODO(mpdenton): start the HangWatcher after the sandbox is initialized.
+@@ -872,11 +891,10 @@ int ContentMainRunnerImpl::Initialize(Co
+ base::GlobalDescriptors::kBaseDescriptor);
+ #endif // !BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ g_fds->Set(kCrashDumpSignal,
+ kCrashDumpSignal + base::GlobalDescriptors::kBaseDescriptor);
+-#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+- // BUILDFLAG(IS_OPENBSD)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ #endif // !BUILDFLAG(IS_WIN)
+
+@@ -992,7 +1010,7 @@ int ContentMainRunnerImpl::Initialize(Co
+ return TerminateForFatalInitializationError();
+ #endif // BUILDFLAG(IS_ANDROID) && (ICU_UTIL_DATA_IMPL == ICU_UTIL_DATA_FILE)
+
+- LoadV8SnapshotIfNeeded(command_line, process_type);
++ LoadV8SnapshotIfNeeded(delegate_, command_line, process_type);
+
+ blink::TrialTokenValidator::SetOriginTrialPolicyGetter(
+ base::BindRepeating([]() -> blink::OriginTrialPolicy* {
+@@ -1057,6 +1075,18 @@ int ContentMainRunnerImpl::Initialize(Co
+ process_type == switches::kZygoteProcess) {
+ PreSandboxInit();
+ }
++#elif BUILDFLAG(IS_BSD)
++ PreSandboxInit();
++#endif
++
++#if BUILDFLAG(IS_BSD)
++ if (process_type.empty()) {
++ sandbox::policy::SandboxLinux::Options sandbox_options;
++ sandbox::policy::SandboxLinux::GetInstance()->InitializeSandbox(
++ sandbox::policy::SandboxTypeFromCommandLine(
++ *base::CommandLine::ForCurrentProcess()),
++ sandbox::policy::SandboxLinux::PreSandboxHook(), sandbox_options);
++ }
+ #endif
+
+ delegate_->SandboxInitialized(process_type);
+@@ -1156,6 +1186,11 @@ NO_STACK_PROTECTOR int ContentMainRunner
+
+ RegisterMainThreadFactories();
+
++#if BUILDFLAG(IS_BSD)
++ if (!process_type.empty())
++ PreSandboxInit();
++#endif
++
+ if (process_type.empty())
+ return RunBrowser(std::move(main_params), start_minimal_browser);
+
diff --git a/electron34/patches/patch-content_browser_BUILD.gn b/electron34/patches/patch-content_browser_BUILD.gn
new file mode 100644
index 0000000000..a3079e2de4
--- /dev/null
+++ b/electron34/patches/patch-content_browser_BUILD.gn
@@ -0,0 +1,59 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/BUILD.gn
+@@ -325,6 +325,7 @@ source_set("browser") {
+ "//ui/strings:ax_strings",
+ "//ui/touch_selection",
+ "//v8:v8_version",
++ "//electron/build/config:generate_mas_config",
+ ]
+
+ public_deps = [
+@@ -2454,6 +2455,14 @@ source_set("browser") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources += [
++ "file_system_access/file_path_watcher/file_path_watcher_bsd.cc",
++ "file_system_access/file_path_watcher/file_path_watcher_kqueue.cc",
++ "file_system_access/file_path_watcher/file_path_watcher_kqueue.h",
++ ]
++ }
++
+ if (is_linux || is_chromeos) {
+ sources += [
+ "child_process_launcher_helper_linux.cc",
+@@ -2499,6 +2508,15 @@ source_set("browser") {
+ deps += [ "//media/mojo/mojom/stable:stable_video_decoder" ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "file_system_access/file_path_watcher/file_path_watcher_inotify.cc",
++ "file_system_access/file_path_watcher/file_path_watcher_inotify.h",
++ "sandbox_ipc_linux.cc",
++ "sandbox_ipc_linux.h",
++ ]
++ }
++
+ if (is_chromeos) {
+ sources += [
+ "handwriting/handwriting_recognition_service_impl_cros.cc",
+@@ -3022,8 +3040,9 @@ source_set("browser") {
+ "//ppapi/shared_impl",
+ ]
+
+- assert(enable_printing)
+- deps += [ "//printing" ]
++ if (enable_printing) {
++ deps += [ "//printing" ]
++ }
+
+ if (is_chromeos) {
+ sources += [
diff --git a/electron34/patches/patch-content_browser_audio_audio__service.cc b/electron34/patches/patch-content_browser_audio_audio__service.cc
new file mode 100644
index 0000000000..ad9370e370
--- /dev/null
+++ b/electron34/patches/patch-content_browser_audio_audio__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/audio/audio_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/audio/audio_service.cc
+@@ -32,7 +32,7 @@
+ #if BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS)
+ #include "ui/display/util/edid_parser.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/display/display_util.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -200,7 +200,7 @@ audio::mojom::AudioService& GetAudioServ
+ ->PostTaskAndReplyWithResult(
+ FROM_HERE, base::BindOnce(&ScanEdidBitstreams),
+ base::BindOnce(&LaunchAudioService, std::move(receiver)));
+-#elif BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS) && BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ LaunchAudioService(
+ std::move(receiver),
+ ConvertEdidBitstreams(display::DisplayUtil::GetAudioFormats()));
diff --git a/electron34/patches/patch-content_browser_browser__child__process__host__impl.cc b/electron34/patches/patch-content_browser_browser__child__process__host__impl.cc
new file mode 100644
index 0000000000..fabc6e4ac8
--- /dev/null
+++ b/electron34/patches/patch-content_browser_browser__child__process__host__impl.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/browser_child_process_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/browser_child_process_host_impl.cc
+@@ -327,6 +327,7 @@ void BrowserChildProcessHostImpl::Launch
+ switches::kLogBestEffortTasks,
+ switches::kPerfettoDisableInterning,
+ switches::kTraceToConsole,
++ switches::kDisableUnveil,
+ };
+ cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches);
+
+@@ -656,7 +657,7 @@ void BrowserChildProcessHostImpl::OnProc
+ ->child_process());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ child_thread_type_switcher_.SetPid(process.Pid());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/electron34/patches/patch-content_browser_browser__child__process__host__impl.h b/electron34/patches/patch-content_browser_browser__child__process__host__impl.h
new file mode 100644
index 0000000000..85dd93840a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_browser__child__process__host__impl.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/browser_child_process_host_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/browser_child_process_host_impl.h
+@@ -35,7 +35,7 @@
+ #include "base/win/object_watcher.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/child_thread_type_switcher_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -269,7 +269,7 @@ class BrowserChildProcessHostImpl
+ std::unique_ptr<tracing::SystemTracingService> system_tracing_service_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ChildThreadTypeSwitcher child_thread_type_switcher_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/electron34/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc b/electron34/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
new file mode 100644
index 0000000000..6859175972
--- /dev/null
+++ b/electron34/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/browser_child_process_host_impl_receiver_bindings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/browser_child_process_host_impl_receiver_bindings.cc
+@@ -62,7 +62,7 @@ void BrowserChildProcessHostImpl::BindHo
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto r = receiver.As<mojom::ThreadTypeSwitcher>()) {
+ child_thread_type_switcher_.Bind(std::move(r));
+ return;
diff --git a/electron34/patches/patch-content_browser_browser__main__loop.cc b/electron34/patches/patch-content_browser_browser__main__loop.cc
new file mode 100644
index 0000000000..8997ff4d47
--- /dev/null
+++ b/electron34/patches/patch-content_browser_browser__main__loop.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/browser_main_loop.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/browser_main_loop.cc
+@@ -249,6 +249,12 @@
+ #include "mojo/public/cpp/bindings/lib/test_random_mojo_delays.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "content/browser/sandbox_host_linux.h"
++#include "content/public/common/zygote/sandbox_support_linux.h"
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ // One of the linux specific headers defines this as a macro.
+ #ifdef DestroyAll
+ #undef DestroyAll
+@@ -543,6 +549,12 @@ int BrowserMainLoop::EarlyInitialization
+ // by now since a thread to start the ServiceManager has been created
+ // before the browser main loop starts.
+ DCHECK(SandboxHostLinux::GetInstance()->IsInitialized());
++#elif BUILDFLAG(IS_BSD)
++ base::FileHandleMappingVector additional_remapped_fds;
++ base::LaunchOptions options;
++ SandboxHostLinux::GetInstance()->Init();
++ const int sfd = SandboxHostLinux::GetInstance()->GetChildSocket();
++ options.fds_to_remap.push_back(std::make_pair(sfd, GetSandboxFD()));
+ #endif
+
+ // GLib's spawning of new processes is buggy, so it's important that at this
+@@ -581,7 +593,7 @@ int BrowserMainLoop::EarlyInitialization
+ base::ThreadType::kDisplayCritical);
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // We use quite a few file descriptors for our IPC as well as disk the disk
+ // cache, and the default limit on Apple is low (256), so bump it up.
+
diff --git a/electron34/patches/patch-content_browser_child__process__launcher.h b/electron34/patches/patch-content_browser_child__process__launcher.h
new file mode 100644
index 0000000000..f42f4bbdeb
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__process__launcher.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_process_launcher.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_process_launcher.h
+@@ -33,6 +33,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "base/win/windows_types.h"
++#include "base/win/scoped_handle.h"
+ #endif
+
+ #if BUILDFLAG(IS_POSIX)
+@@ -189,7 +190,10 @@ struct ChildProcessLauncherFileData {
+ delete;
+ ~ChildProcessLauncherFileData();
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_WIN)
++ base::win::ScopedHandle stdout_handle;
++ base::win::ScopedHandle stderr_handle;
++#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
+ // Files opened by the browser and passed as corresponding file descriptors
+ // in the child process. If a FilePath is provided, the file will be opened
+ // and the descriptor cached for future process launches. If a ScopedFD is
+@@ -204,6 +208,15 @@ struct ChildProcessLauncherFileData {
+ std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
+ files_to_preload;
+ #endif
++
++#if BUILDFLAG(IS_POSIX)
++ // Map of file descriptors to pass. This is used instead of
++ // `files_to_preload` when the data needs to be installed at an exact FD
++ // number in the new process.
++ //
++ // Currently only supported on POSIX platforms.
++ std::map<int, base::ScopedFD> additional_remapped_fds;
++#endif
+ };
+
+ // Launches a process asynchronously and notifies the client of the process
diff --git a/electron34/patches/patch-content_browser_child__process__launcher__helper.h b/electron34/patches/patch-content_browser_child__process__launcher__helper.h
new file mode 100644
index 0000000000..e9b7ef3288
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__process__launcher__helper.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_process_launcher_helper.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_process_launcher_helper.h
+@@ -304,7 +304,7 @@ class ChildProcessLauncherHelper
+ std::optional<base::ProcessId> process_id_ = std::nullopt;
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The priority of the process. The state is stored to avoid changing the
+ // setting repeatedly.
+ std::optional<base::Process::Priority> priority_;
diff --git a/electron34/patches/patch-content_browser_child__process__launcher__helper__linux.cc b/electron34/patches/patch-content_browser_child__process__launcher__helper__linux.cc
new file mode 100644
index 0000000000..ee740acc6f
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__process__launcher__helper__linux.cc
@@ -0,0 +1,151 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_process_launcher_helper_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_process_launcher_helper_linux.cc
+@@ -22,7 +22,9 @@
+ #include "content/public/common/result_codes.h"
+ #include "content/public/common/sandboxed_process_launcher_delegate.h"
+ #include "content/public/common/zygote/sandbox_support_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "content/public/common/zygote/zygote_handle.h"
++#endif
+ #include "sandbox/policy/linux/sandbox_linux.h"
+
+ namespace content {
+@@ -47,14 +49,20 @@ ChildProcessLauncherHelper::GetFilesToMa
+ }
+
+ bool ChildProcessLauncherHelper::IsUsingLaunchOptions() {
++#if !BUILDFLAG(IS_BSD)
+ return !GetZygoteForLaunch();
++#else
++ return true;
++#endif
+ }
+
+ bool ChildProcessLauncherHelper::BeforeLaunchOnLauncherThread(
+ PosixFileDescriptorInfo& files_to_register,
+ base::LaunchOptions* options) {
+ if (options) {
++#if !BUILDFLAG(IS_BSD)
+ DCHECK(!GetZygoteForLaunch());
++#endif
+ // Convert FD mapping to FileHandleMappingVector
+ options->fds_to_remap = files_to_register.GetMappingWithIDAdjustment(
+ base::GlobalDescriptors::kBaseDescriptor);
+@@ -64,9 +72,29 @@ bool ChildProcessLauncherHelper::BeforeL
+ options->fds_to_remap.emplace_back(sandbox_fd, GetSandboxFD());
+ }
+
++ for (const auto& remapped_fd : file_data_->additional_remapped_fds) {
++ options->fds_to_remap.emplace_back(remapped_fd.second.get(),
++ remapped_fd.first);
++ }
++
++#if !BUILDFLAG(IS_BSD)
++ // (For Electron), if we're launching without zygote, that means we're
++ // launching an unsandboxed process (since all sandboxed processes are
++ // forked from the zygote). Relax the allow_new_privs option to permit
++ // launching suid processes from unsandboxed child processes.
++ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) &&
++ delegate_->GetZygote() == nullptr) {
++ options->allow_new_privs = true;
++ }
++#endif
++
++ options->current_directory = delegate_->GetCurrentDirectory();
+ options->environment = delegate_->GetEnvironment();
++ options->clear_environment = !delegate_->ShouldInheritEnvironment();
+ } else {
++#if !BUILDFLAG(IS_BSD)
+ DCHECK(GetZygoteForLaunch());
++#endif
+ // Environment variables could be supported in the future, but are not
+ // currently supported when launching with the zygote.
+ DCHECK(delegate_->GetEnvironment().empty());
+@@ -83,6 +111,7 @@ ChildProcessLauncherHelper::LaunchProces
+ int* launch_result) {
+ *is_synchronous_launch = true;
+ Process process;
++#if !BUILDFLAG(IS_BSD)
+ ZygoteCommunication* zygote_handle = GetZygoteForLaunch();
+ if (zygote_handle) {
+ // TODO(crbug.com/40448989): If chrome supported multiple zygotes they could
+@@ -93,7 +122,6 @@ ChildProcessLauncherHelper::LaunchProces
+ GetProcessType());
+ *launch_result = LAUNCH_RESULT_SUCCESS;
+
+-#if !BUILDFLAG(IS_OPENBSD)
+ if (handle) {
+ // It could be a renderer process or an utility process.
+ int oom_score = content::kMiscOomScore;
+@@ -102,15 +130,17 @@ ChildProcessLauncherHelper::LaunchProces
+ oom_score = content::kLowestRendererOomScore;
+ ZygoteHostImpl::GetInstance()->AdjustRendererOOMScore(handle, oom_score);
+ }
+-#endif
+
+ process.process = base::Process(handle);
+ process.zygote = zygote_handle;
+ } else {
++#endif
+ process.process = base::LaunchProcess(*command_line(), *options);
+ *launch_result = process.process.IsValid() ? LAUNCH_RESULT_SUCCESS
+ : LAUNCH_RESULT_FAILURE;
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS)
+ process_id_ = process.process.Pid();
+@@ -134,10 +164,14 @@ ChildProcessTerminationInfo ChildProcess
+ const ChildProcessLauncherHelper::Process& process,
+ bool known_dead) {
+ ChildProcessTerminationInfo info;
++#if !BUILDFLAG(IS_BSD)
+ if (process.zygote) {
+ info.status = process.zygote->GetTerminationStatus(
+ process.process.Handle(), known_dead, &info.exit_code);
+ } else if (known_dead) {
++#else
++ if (known_dead) {
++#endif
+ info.status = base::GetKnownDeadTerminationStatus(process.process.Handle(),
+ &info.exit_code);
+ } else {
+@@ -163,13 +197,17 @@ void ChildProcessLauncherHelper::ForceNo
+ DCHECK(CurrentlyOnProcessLauncherTaskRunner());
+ process.process.Terminate(RESULT_CODE_NORMAL_EXIT, false);
+ // On POSIX, we must additionally reap the child.
++#if !BUILDFLAG(IS_BSD)
+ if (process.zygote) {
+ // If the renderer was created via a zygote, we have to proxy the reaping
+ // through the zygote process.
+ process.zygote->EnsureProcessTerminated(process.process.Handle());
+ } else {
++#endif
+ base::EnsureProcessTerminated(std::move(process.process));
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+ }
+
+ void ChildProcessLauncherHelper::SetProcessPriorityOnLauncherThread(
+@@ -182,11 +220,13 @@ void ChildProcessLauncherHelper::SetProc
+ }
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ ZygoteCommunication* ChildProcessLauncherHelper::GetZygoteForLaunch() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote)
+ ? nullptr
+ : delegate_->GetZygote();
+ }
++#endif
+
+ base::File OpenFileToShare(const base::FilePath& path,
+ base::MemoryMappedFile::Region* region) {
diff --git a/electron34/patches/patch-content_browser_child__process__launcher__helper__mac.cc b/electron34/patches/patch-content_browser_child__process__launcher__helper__mac.cc
new file mode 100644
index 0000000000..a4237faff1
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__process__launcher__helper__mac.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_process_launcher_helper_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_process_launcher_helper_mac.cc
+@@ -110,7 +110,8 @@ bool ChildProcessLauncherHelper::BeforeL
+ 'mojo', base::MachRendezvousPort(endpoint.TakeMachReceiveRight())));
+
+ options->environment = delegate_->GetEnvironment();
+-
++ options->clear_environment = !delegate_->ShouldInheritEnvironment();
++ options->current_directory = delegate_->GetCurrentDirectory();
+ options->disclaim_responsibility = delegate_->DisclaimResponsibility();
+ options->enable_cpu_security_mitigations =
+ delegate_->EnableCpuSecurityMitigations();
+@@ -177,6 +178,11 @@ bool ChildProcessLauncherHelper::BeforeL
+ base::StringPrintf("%s%d", sandbox::switches::kSeatbeltClient, pipe));
+ }
+
++ for (const auto& remapped_fd : file_data_->additional_remapped_fds) {
++ options->fds_to_remap.emplace_back(remapped_fd.second.get(),
++ remapped_fd.first);
++ }
++
+ return true;
+ }
+
diff --git a/electron34/patches/patch-content_browser_child__process__launcher__helper__win.cc b/electron34/patches/patch-content_browser_child__process__launcher__helper__win.cc
new file mode 100644
index 0000000000..2817de65ee
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__process__launcher__helper__win.cc
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_process_launcher_helper_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_process_launcher_helper_win.cc
+@@ -24,6 +24,8 @@
+ #include "mojo/public/cpp/platform/named_platform_channel.h"
+ #include "mojo/public/cpp/platform/platform_channel.h"
+
++#include <windows.h>
++
+ namespace {
+
+ // Helper to avoid marking the log file as non-executable every time we launch a
+@@ -132,6 +134,31 @@ bool ChildProcessLauncherHelper::BeforeL
+ mojo_channel_->PrepareToPassRemoteEndpoint(&options->handles_to_inherit,
+ command_line());
+ }
++
++ if (file_data_->stdout_handle.IsValid() || file_data_->stderr_handle.IsValid()) {
++ // base::LaunchProcess requires that if any of the stdio handle is customized then
++ // the other two handles should also be set.
++ // https://source.chromium.org/chromium/chromium/src/+/main:base/process/launch_win.cc;l=341-350
++ options->stdin_handle = INVALID_HANDLE_VALUE;
++ if (file_data_->stdout_handle.IsValid()) {
++ options->stdout_handle = file_data_->stdout_handle.get();
++ } else {
++ options->stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE);
++ }
++
++ if (file_data_->stderr_handle.IsValid()) {
++ options->stderr_handle = file_data_->stderr_handle.get();
++ } else {
++ options->stderr_handle = GetStdHandle(STD_ERROR_HANDLE);
++ }
++ options->handles_to_inherit.push_back(options->stdout_handle);
++ options->handles_to_inherit.push_back(options->stderr_handle);
++ }
++
++ options->current_directory = delegate_->GetCurrentDirectory();
++ options->environment = delegate_->GetEnvironment();
++ options->clear_environment = !delegate_->ShouldInheritEnvironment();
++ options->feedback_cursor_off = !delegate_->ShouldShowFeedbackCursor();
+ return true;
+ }
+
+@@ -158,7 +185,7 @@ ChildProcessLauncherHelper::LaunchProces
+ }
+ *is_synchronous_launch = false;
+ *launch_result = StartSandboxedProcess(
+- delegate_.get(), *command_line(), options->handles_to_inherit,
++ delegate_.get(), *command_line(), options,
+ base::BindOnce(&ChildProcessLauncherHelper::
+ FinishStartSandboxedProcessOnLauncherThread,
+ this));
diff --git a/electron34/patches/patch-content_browser_child__thread__type__switcher__linux.cc b/electron34/patches/patch-content_browser_child__thread__type__switcher__linux.cc
new file mode 100644
index 0000000000..56d86048fc
--- /dev/null
+++ b/electron34/patches/patch-content_browser_child__thread__type__switcher__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/child_thread_type_switcher_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/child_thread_type_switcher_linux.cc
+@@ -20,6 +20,9 @@ void SetThreadTypeOnLauncherThread(base:
+ base::ThreadType thread_type) {
+ DCHECK(CurrentlyOnProcessLauncherTaskRunner());
+
++#if BUILDFLAG(IS_BSD)
++ NOTIMPLEMENTED();
++#else
+ bool ns_pid_supported = false;
+ pid_t peer_tid = base::FindThreadID(peer_pid, ns_tid, &ns_pid_supported);
+ if (peer_tid == -1) {
+@@ -39,6 +42,7 @@ void SetThreadTypeOnLauncherThread(base:
+
+ base::PlatformThread::SetThreadType(peer_pid, peer_tid, thread_type,
+ base::IsViaIPC(true));
++#endif
+ }
+
+ } // namespace
diff --git a/electron34/patches/patch-content_browser_code__cache_generated__code__cache.cc b/electron34/patches/patch-content_browser_code__cache_generated__code__cache.cc
new file mode 100644
index 0000000000..41f974b51c
--- /dev/null
+++ b/electron34/patches/patch-content_browser_code__cache_generated__code__cache.cc
@@ -0,0 +1,112 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/code_cache/generated_code_cache.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/code_cache/generated_code_cache.cc
+@@ -12,6 +12,7 @@
+ #include <iostream>
+ #include <string_view>
+
++#include "base/containers/contains.h"
+ #include "base/feature_list.h"
+ #include "base/functional/bind.h"
+ #include "base/functional/callback_helpers.h"
+@@ -36,6 +37,7 @@
+ #include "net/http/http_cache.h"
+ #include "third_party/blink/public/common/scheme_registry.h"
+ #include "url/gurl.h"
++#include "url/url_util.h"
+
+ using storage::BigIOBuffer;
+
+@@ -48,7 +50,7 @@ constexpr char kSeparator[] = " \n";
+
+ // We always expect to receive valid URLs that can be used as keys to the code
+ // cache. The relevant checks (for ex: resource_url is valid, origin_lock is
+-// not opque etc.,) must be done prior to requesting the code cache.
++// not opaque etc.,) must be done prior to requesting the code cache.
+ //
+ // This function doesn't enforce anything in the production code. It is here
+ // to make the assumptions explicit and to catch any errors when DCHECKs are
+@@ -58,33 +60,55 @@ void CheckValidKeys(const GURL& resource
+ GeneratedCodeCache::CodeCacheType cache_type) {
+ // If the resource url is invalid don't cache the code.
+ DCHECK(resource_url.is_valid());
+- bool resource_url_is_chrome_or_chrome_untrusted =
++
++ // There are 3 kind of URL scheme compatible for the `resource_url`.
++ // 1. http: and https: URLs.
++ // 2. chrome: and chrome-untrusted: URLs.
++ // 3. URLs whose scheme are allowed by the content/ embedder.
++ const bool resource_url_http = resource_url.SchemeIsHTTPOrHTTPS();
++ const bool resource_url_webui =
+ resource_url.SchemeIs(content::kChromeUIScheme) ||
+ resource_url.SchemeIs(content::kChromeUIUntrustedScheme);
+- DCHECK(resource_url.SchemeIsHTTPOrHTTPS() ||
+- resource_url_is_chrome_or_chrome_untrusted ||
+- blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme()));
+-
+- // |origin_lock| should be either empty or should have
+- // Http/Https/chrome/chrome-untrusted schemes and it should not be a URL with
+- // opaque origin. Empty origin_locks are allowed when the renderer is not
+- // locked to an origin.
+- bool origin_lock_is_chrome_or_chrome_untrusted =
++
++ const bool resource_url_embedder =
++ base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme());
++ DCHECK(resource_url_http || resource_url_webui || resource_url_embedder);
++
++ // |origin_lock| should be either empty or should have code cache allowed
++ // schemes (http/https/chrome/chrome-untrusted or other custom schemes added
++ // by url::AddCodeCacheScheme), and it should not be a URL with opaque
++ // origin. Empty origin_locks are allowed when the renderer is not locked to
++ // an origin.
++ const bool origin_lock_empty = origin_lock.is_empty();
++ const bool origin_lock_for_http = origin_lock.SchemeIsHTTPOrHTTPS();
++ const bool origin_lock_for_webui =
+ origin_lock.SchemeIs(content::kChromeUIScheme) ||
+ origin_lock.SchemeIs(content::kChromeUIUntrustedScheme);
+- DCHECK(
+- origin_lock.is_empty() ||
+- ((origin_lock.SchemeIsHTTPOrHTTPS() ||
+- origin_lock_is_chrome_or_chrome_untrusted ||
+- blink::CommonSchemeRegistry::IsExtensionScheme(origin_lock.scheme())) &&
+- !url::Origin::Create(origin_lock).opaque()));
+-
+- // The chrome and chrome-untrusted schemes are only used with the WebUI
+- // code cache type.
+- DCHECK_EQ(origin_lock_is_chrome_or_chrome_untrusted,
+- cache_type == GeneratedCodeCache::kWebUIJavaScript);
+- DCHECK_EQ(resource_url_is_chrome_or_chrome_untrusted,
+- cache_type == GeneratedCodeCache::kWebUIJavaScript);
++ const bool origin_lock_for_embedder =
++ base::Contains(url::GetCodeCacheSchemes(), origin_lock.scheme());
++
++ DCHECK(origin_lock_empty || ((origin_lock_for_http || origin_lock_for_webui ||
++ origin_lock_for_embedder) &&
++ !url::Origin::Create(origin_lock).opaque()));
++
++ // The webui schemes are only used with their dedicated code cache type.
++ switch (cache_type) {
++ case GeneratedCodeCache::kJavaScript:
++ case GeneratedCodeCache::kWebAssembly:
++ DCHECK(!origin_lock_for_webui);
++ DCHECK(!resource_url_webui);
++ break;
++ case GeneratedCodeCache::kWebUIJavaScript:
++ DCHECK(origin_lock_for_webui);
++ DCHECK(resource_url_webui);
++ break;
++ }
++
++ // The custom schemes share the cache type with http(s).
++ if (origin_lock_for_embedder || resource_url_embedder) {
++ DCHECK(cache_type == GeneratedCodeCache::kJavaScript ||
++ cache_type == GeneratedCodeCache::kWebAssembly);
++ }
+ }
+
+ // Generates the cache key for the given |resource_url|, |origin_lock| and
diff --git a/electron34/patches/patch-content_browser_code__cache_generated__code__cache.h b/electron34/patches/patch-content_browser_code__cache_generated__code__cache.h
new file mode 100644
index 0000000000..cf48b02c5c
--- /dev/null
+++ b/electron34/patches/patch-content_browser_code__cache_generated__code__cache.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/code_cache/generated_code_cache.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/code_cache/generated_code_cache.h
+@@ -52,12 +52,14 @@ class CONTENT_EXPORT GeneratedCodeCache
+ // Cache type. Used for collecting statistics for JS and Wasm in separate
+ // buckets.
+ enum CodeCacheType {
+- // JavaScript from http(s) pages.
++ // JavaScript from pages of http(s) schemes or custom schemes registered by
++ // url::AddCodeCacheScheme.
+ kJavaScript,
+
+- // WebAssembly from http(s) pages. This cache allows more total size and
+- // more size per item than the JavaScript cache, since some
+- // WebAssembly programs are very large.
++ // WebAssembly from pages of http(s) schemes or custom schemes registered by
++ // url::AddCodeCacheScheme. This cache allows more total size and more size
++ // per item than the JavaScript cache, since some WebAssembly programs are
++ // very large.
+ kWebAssembly,
+
+ // JavaScript from chrome and chrome-untrusted pages. The resource URLs are
diff --git a/electron34/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc b/electron34/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc
new file mode 100644
index 0000000000..7a521cb85e
--- /dev/null
+++ b/electron34/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc
@@ -0,0 +1,123 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/code_cache/generated_code_cache_browsertest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/code_cache/generated_code_cache_browsertest.cc
+@@ -11,17 +11,22 @@
+ #include "base/time/time.h"
+ #include "content/browser/code_cache/generated_code_cache_context.h"
+ #include "content/browser/renderer_host/code_cache_host_impl.h"
++#include "content/browser/storage_partition_impl.h"
+ #include "content/browser/web_contents/web_contents_impl.h"
+ #include "content/common/renderer.mojom.h"
++#include "content/common/url_schemes.h"
+ #include "content/public/browser/browser_context.h"
++#include "content/public/browser/browser_thread.h"
+ #include "content/public/browser/render_process_host.h"
+ #include "content/public/browser/storage_partition.h"
+ #include "content/public/test/browser_test.h"
+ #include "content/public/test/browser_test_utils.h"
+ #include "content/public/test/content_browser_test.h"
+ #include "content/public/test/content_browser_test_utils.h"
++#include "content/public/test/test_browser_context.h"
+ #include "content/shell/browser/shell.h"
+ #include "content/test/content_browser_test_utils_internal.h"
++#include "content/test/test_content_client.h"
+ #include "net/dns/mock_host_resolver.h"
+ #include "third_party/blink/public/common/features.h"
+ #include "third_party/blink/public/common/page/v8_compile_hints_histograms.h"
+@@ -30,6 +35,8 @@ namespace content {
+
+ namespace {
+
++const std::string kCodeCacheScheme = "test-code-cache";
++
+ bool SupportsSharedWorker() {
+ #if BUILDFLAG(IS_ANDROID)
+ // SharedWorkers are not enabled on Android. https://crbug.com/154571
+@@ -875,4 +882,82 @@ IN_PROC_BROWSER_TEST_F(LocalCompileHints
+ }
+ }
+
++class CodeCacheInCustomSchemeBrowserTest : public ContentBrowserTest,
++ public TestContentClient {
++ public:
++ CodeCacheInCustomSchemeBrowserTest() {
++ SetContentClient(this);
++ ReRegisterContentSchemesForTests();
++ }
++
++ ~CodeCacheInCustomSchemeBrowserTest() override { SetContentClient(nullptr); }
++
++ private:
++ void AddAdditionalSchemes(Schemes* schemes) override {
++ schemes->standard_schemes.push_back(kCodeCacheScheme);
++ schemes->code_cache_schemes.push_back(kCodeCacheScheme);
++ }
++
++ url::ScopedSchemeRegistryForTests scheme_registry_;
++};
++
++IN_PROC_BROWSER_TEST_F(CodeCacheInCustomSchemeBrowserTest,
++ AllowedCustomSchemeCanGenerateCodeCache) {
++ StoragePartitionImpl* partition =
++ static_cast<StoragePartitionImpl*>(shell()
++ ->web_contents()
++ ->GetBrowserContext()
++ ->GetDefaultStoragePartition());
++ scoped_refptr<GeneratedCodeCacheContext> context =
++ partition->GetGeneratedCodeCacheContext();
++ EXPECT_NE(context, nullptr);
++
++ GURL url(kCodeCacheScheme + "://host4/script.js");
++ GURL origin(kCodeCacheScheme + "://host1:1/");
++ ASSERT_TRUE(url.is_valid());
++ ASSERT_TRUE(origin.is_valid());
++ std::string data("SomeData");
++
++ // Add a code cache entry for the custom scheme.
++ base::test::TestFuture<void> add_entry_future;
++ GeneratedCodeCacheContext::RunOrPostTask(
++ context.get(), FROM_HERE,
++ base::BindOnce(
++ [](scoped_refptr<GeneratedCodeCacheContext> context, const GURL& url,
++ const GURL& origin, const std::string& data,
++ base::OnceClosure callback) {
++ context->generated_js_code_cache()->WriteEntry(
++ url, origin, net::NetworkIsolationKey(), base::Time::Now(),
++ std::vector<uint8_t>(data.begin(), data.end()));
++ GetUIThreadTaskRunner({})->PostTask(FROM_HERE, std::move(callback));
++ },
++ context, url, origin, data, add_entry_future.GetCallback()));
++ ASSERT_TRUE(add_entry_future.Wait());
++
++ // Get the code cache entry.
++ base::test::TestFuture<std::string> get_entry_future;
++ GeneratedCodeCacheContext::RunOrPostTask(
++ context.get(), FROM_HERE,
++ base::BindOnce(
++ [](scoped_refptr<GeneratedCodeCacheContext> context, const GURL& url,
++ const GURL& origin,
++ base::OnceCallback<void(std::string)> callback) {
++ context->generated_js_code_cache()->FetchEntry(
++ url, origin, net::NetworkIsolationKey(),
++ base::BindOnce(
++ [](base::OnceCallback<void(std::string)> callback,
++ const base::Time& response_time,
++ mojo_base::BigBuffer buffer) {
++ std::string data(buffer.data(),
++ buffer.data() + buffer.size());
++ GetUIThreadTaskRunner({})->PostTask(
++ FROM_HERE, base::BindOnce(std::move(callback), data));
++ },
++ std::move(callback)));
++ },
++ context, url, origin, get_entry_future.GetCallback()));
++ ASSERT_TRUE(get_entry_future.Wait());
++ ASSERT_EQ(data, get_entry_future.Get<0>());
++}
++
+ } // namespace content
diff --git a/electron34/patches/patch-content_browser_compositor_viz__process__transport__factory.cc b/electron34/patches/patch-content_browser_compositor_viz__process__transport__factory.cc
new file mode 100644
index 0000000000..bf74a8fa15
--- /dev/null
+++ b/electron34/patches/patch-content_browser_compositor_viz__process__transport__factory.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/compositor/viz_process_transport_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/compositor/viz_process_transport_factory.cc
+@@ -110,7 +110,7 @@ class HostDisplayClient : public viz::Ho
+ HostDisplayClient& operator=(const HostDisplayClient&) = delete;
+
+ // viz::HostDisplayClient:
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override {
+ compositor_->OnCompleteSwapWithNewSize(size);
+ }
+@@ -387,8 +387,14 @@ void VizProcessTransportFactory::OnEstab
+ mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private;
+ root_params->display_private =
+ display_private.BindNewEndpointAndPassReceiver();
+- compositor_data.display_client =
+- std::make_unique<HostDisplayClient>(compositor);
++ if (compositor->delegate()) {
++ compositor_data.display_client = compositor->delegate()->CreateHostDisplayClient(
++ compositor);
++ root_params->offscreen = compositor->delegate()->IsOffscreen();
++ } else {
++ compositor_data.display_client =
++ std::make_unique<HostDisplayClient>(compositor);
++ }
+ root_params->display_client =
+ compositor_data.display_client->GetBoundRemote(resize_task_runner_);
+ mojo::AssociatedRemote<viz::mojom::ExternalBeginFrameController>
diff --git a/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc b/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc
new file mode 100644
index 0000000000..2810af21f3
--- /dev/null
+++ b/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/devtools/devtools_frontend_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/devtools/devtools_frontend_host_impl.cc
+@@ -27,7 +27,7 @@
+ #include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
+ #include "ui/base/webui/resource_path.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/crash/content/browser/error_reporting/javascript_error_report.h" // nogncheck
+ #include "components/crash/content/browser/error_reporting/js_error_report_processor.h" // nogncheck
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -42,7 +42,7 @@ const char kCompatibilityScriptSourceURL
+ "\n//# "
+ "sourceURL=devtools://devtools/bundled/devtools_compatibility.js";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Remove the pieces of the URL we don't want to send back with the error
+ // reports. In particular, do not send query or fragments as those can have
+ // privacy-sensitive information in them.
+@@ -112,7 +112,7 @@ DevToolsFrontendHostImpl::DevToolsFronte
+ const HandleMessageCallback& handle_message_callback)
+ : web_contents_(WebContents::FromRenderFrameHost(frame_host)),
+ handle_message_callback_(handle_message_callback) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ Observe(web_contents_);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ mojo::AssociatedRemote<blink::mojom::DevToolsFrontend> frontend;
+@@ -137,7 +137,7 @@ void DevToolsFrontendHostImpl::DispatchE
+ handle_message_callback_.Run(std::move(message));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void DevToolsFrontendHostImpl::OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
diff --git a/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h b/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h
new file mode 100644
index 0000000000..b41fb180b9
--- /dev/null
+++ b/electron34/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/devtools/devtools_frontend_host_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/devtools/devtools_frontend_host_impl.h
+@@ -34,7 +34,7 @@ class DevToolsFrontendHostImpl : public
+
+ void BadMessageReceived() override;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
diff --git a/electron34/patches/patch-content_browser_devtools_protocol_system__info__handler.cc b/electron34/patches/patch-content_browser_devtools_protocol_system__info__handler.cc
new file mode 100644
index 0000000000..b59e09d078
--- /dev/null
+++ b/electron34/patches/patch-content_browser_devtools_protocol_system__info__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/devtools/protocol/system_info_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/devtools/protocol/system_info_handler.cc
+@@ -51,7 +51,7 @@ std::unique_ptr<SystemInfo::Size> GfxSiz
+ // 1046598, and 1153667.
+ // Windows builds need more time -- see Issue 873112 and 1004472.
+ // Mac builds need more time - see Issue angleproject:6182.
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !defined(NDEBUG)) || \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && !defined(NDEBUG)) || \
+ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OZONE)
+ static constexpr int kGPUInfoWatchdogTimeoutMultiplierOS = 3;
+ #else
diff --git a/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h
new file mode 100644
index 0000000000..ccd32afc09
--- /dev/null
+++ b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/file_system_access/file_path_watcher/file_path_watcher.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/file_system_access/file_path_watcher/file_path_watcher.h
+@@ -125,7 +125,7 @@ class CONTENT_EXPORT FilePathWatcher {
+ Type type = Type::kNonRecursive;
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // The callback will return the full path to a changed file instead of
+ // the watched path supplied as |path| when Watch is called.
+ // So the full path can be different from the watched path when a folder is
diff --git a/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc
new file mode 100644
index 0000000000..19e9eb5460
--- /dev/null
+++ b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/file_system_access/file_path_watcher/file_path_watcher_bsd.cc.orig 2025-05-24 17:57:53.469337219 +0000
++++ content/browser/file_system_access/file_path_watcher/file_path_watcher_bsd.cc
+@@ -0,0 +1,55 @@
++// Copyright 2024 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "content/browser/file_system_access/file_path_watcher/file_path_watcher.h"
++
++#include <memory>
++
++#include "base/memory/ptr_util.h"
++#include "build/build_config.h"
++#include "content/browser/file_system_access/file_path_watcher/file_path_watcher_kqueue.h"
++
++namespace content {
++
++namespace {
++
++class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate {
++ public:
++ FilePathWatcherImpl() = default;
++ FilePathWatcherImpl(const FilePathWatcherImpl&) = delete;
++ FilePathWatcherImpl& operator=(const FilePathWatcherImpl&) = delete;
++ ~FilePathWatcherImpl() override = default;
++
++ bool Watch(const base::FilePath& path,
++ Type type,
++ const FilePathWatcher::Callback& callback) override {
++ DCHECK(!impl_.get());
++ if (type == Type::kRecursive) {
++ if (!FilePathWatcher::RecursiveWatchAvailable()) {
++ return false;
++ }
++ } else {
++ impl_ = std::make_unique<FilePathWatcherKQueue>();
++ }
++ DCHECK(impl_.get());
++ return impl_->Watch(path, type, callback);
++ }
++
++ void Cancel() override {
++ if (impl_.get()) {
++ impl_->Cancel();
++ }
++ set_cancelled();
++ }
++
++ private:
++ std::unique_ptr<PlatformDelegate> impl_;
++};
++
++} // namespace
++
++FilePathWatcher::FilePathWatcher()
++ : FilePathWatcher(std::make_unique<FilePathWatcherImpl>()) {}
++
++} // namespace content
diff --git a/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h
new file mode 100644
index 0000000000..90aa184cbf
--- /dev/null
+++ b/electron34/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/file_system_access/file_path_watcher/file_path_watcher_kqueue.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/file_system_access/file_path_watcher/file_path_watcher_kqueue.h
+@@ -5,6 +5,7 @@
+ #ifndef CONTENT_BROWSER_FILE_SYSTEM_ACCESS_FILE_PATH_WATCHER_FILE_PATH_WATCHER_KQUEUE_H_
+ #define CONTENT_BROWSER_FILE_SYSTEM_ACCESS_FILE_PATH_WATCHER_FILE_PATH_WATCHER_KQUEUE_H_
+
++#include <sys/time.h>
+ #include <sys/event.h>
+
+ #include <memory>
diff --git a/electron34/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc b/electron34/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
new file mode 100644
index 0000000000..b542248e43
--- /dev/null
+++ b/electron34/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/file_system_access/file_system_access_local_path_watcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/file_system_access/file_system_access_local_path_watcher.cc
+@@ -67,7 +67,7 @@ void FileSystemAccessLocalPathWatcher::I
+ .type = scope().IsRecursive() ? FilePathWatcher::Type::kRecursive
+ : FilePathWatcher::Type::kNonRecursive,
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Note: `report_modified_path` is also present on Android
+ // and Fuchsia. Update this switch if support for watching
+ // the local file system is added on those platforms.
diff --git a/electron34/patches/patch-content_browser_font__access_font__enumeration__data__source.cc b/electron34/patches/patch-content_browser_font__access_font__enumeration__data__source.cc
new file mode 100644
index 0000000000..3645cd13b6
--- /dev/null
+++ b/electron34/patches/patch-content_browser_font__access_font__enumeration__data__source.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/font_access/font_enumeration_data_source.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/font_access/font_enumeration_data_source.cc
+@@ -16,7 +16,7 @@
+ #include "content/browser/font_access/font_enumeration_data_source_win.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "content/browser/font_access/font_enumeration_data_source_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/font_access/font_enumeration_data_source_linux.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+@@ -61,7 +61,7 @@ std::unique_ptr<FontEnumerationDataSourc
+ return std::make_unique<FontEnumerationDataSourceWin>();
+ #elif BUILDFLAG(IS_APPLE)
+ return std::make_unique<FontEnumerationDataSourceMac>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<FontEnumerationDataSourceLinux>();
+ #else
+ return std::make_unique<FontEnumerationDataSourceNull>();
+@@ -76,7 +76,7 @@ bool FontEnumerationDataSource::IsOsSupp
+ return true;
+ #elif BUILDFLAG(IS_APPLE)
+ return true;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-content_browser_gpu_compositor__util.cc b/electron34/patches/patch-content_browser_gpu_compositor__util.cc
new file mode 100644
index 0000000000..23069c3ab4
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_compositor__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/compositor_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/compositor_util.cc
+@@ -153,7 +153,7 @@ std::vector<GpuFeatureData> GetGpuFeatur
+ "video_decode",
+ SafeGetFeatureStatus(
+ gpu_feature_info, gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_DECODE,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ !base::FeatureList::IsEnabled(media::kAcceleratedVideoDecodeLinux) ||
+ #endif // BUILDFLAG(IS_LINUX)
+ command_line.HasSwitch(switches::kDisableAcceleratedVideoDecode)),
+@@ -165,7 +165,7 @@ std::vector<GpuFeatureData> GetGpuFeatur
+ "video_encode",
+ SafeGetFeatureStatus(
+ gpu_feature_info, gpu::GPU_FEATURE_TYPE_ACCELERATED_VIDEO_ENCODE,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ !base::FeatureList::IsEnabled(media::kAcceleratedVideoEncodeLinux)),
+ #else
+ command_line.HasSwitch(switches::kDisableAcceleratedVideoEncode)),
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc
new file mode 100644
index 0000000000..7101fad447
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_data_manager_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_data_manager_impl.cc
+@@ -402,7 +402,7 @@ void GpuDataManagerImpl::OnDisplayMetric
+ private_->OnDisplayMetricsChanged(display, changed_metrics);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GpuDataManagerImpl::IsGpuMemoryBufferNV12Supported() {
+ base::AutoLock auto_lock(lock_);
+ return private_->IsGpuMemoryBufferNV12Supported();
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.h b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.h
new file mode 100644
index 0000000000..d9f28b19ac
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_data_manager_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_data_manager_impl.h
+@@ -220,7 +220,7 @@ class CONTENT_EXPORT GpuDataManagerImpl
+ void OnDisplayMetricsChanged(const display::Display& display,
+ uint32_t changed_metrics) override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported();
+ void SetGpuMemoryBufferNV12Supported(bool supported);
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
new file mode 100644
index 0000000000..99cb29d258
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_data_manager_impl_private.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_data_manager_impl_private.cc
+@@ -1675,7 +1675,7 @@ void GpuDataManagerImplPrivate::RecordCo
+ UMA_HISTOGRAM_ENUMERATION("GPU.CompositingMode", compositing_mode);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool GpuDataManagerImplPrivate::IsGpuMemoryBufferNV12Supported() {
+ return is_gpu_memory_buffer_NV12_supported_;
+ }
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h
new file mode 100644
index 0000000000..305823341a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_data_manager_impl_private.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_data_manager_impl_private.h
+@@ -147,7 +147,7 @@ class CONTENT_EXPORT GpuDataManagerImplP
+ void OnDisplayMetricsChanged(const display::Display& display,
+ uint32_t changed_metrics);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported();
+ void SetGpuMemoryBufferNV12Supported(bool supported);
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -311,7 +311,7 @@ class CONTENT_EXPORT GpuDataManagerImplP
+ bool application_is_visible_ = true;
+
+ bool disable_gpu_compositing_ = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool is_gpu_memory_buffer_NV12_supported_ = false;
+ #endif // BUILDFLAG(IS_LINUX)
+ };
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc b/electron34/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
new file mode 100644
index 0000000000..37d378b2dd
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_memory_buffer_manager_singleton.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_memory_buffer_manager_singleton.cc
+@@ -46,7 +46,7 @@ scoped_refptr<base::SingleThreadTaskRunn
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsGpuMemoryBufferNV12Supported() {
+ static bool is_computed = false;
+ static bool supported = false;
+@@ -111,7 +111,7 @@ void GpuMemoryBufferManagerSingleton::Re
+ }
+
+ void GpuMemoryBufferManagerSingleton::OnGpuExtraInfoUpdate() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Dynamic check whether the NV12 format is supported as it may be
+ // inconsistent between the system GBM (Generic Buffer Management) and
+ // chromium miniGBM.
diff --git a/electron34/patches/patch-content_browser_gpu_gpu__process__host.cc b/electron34/patches/patch-content_browser_gpu_gpu__process__host.cc
new file mode 100644
index 0000000000..524479706c
--- /dev/null
+++ b/electron34/patches/patch-content_browser_gpu_gpu__process__host.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/gpu/gpu_process_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/gpu/gpu_process_host.cc
+@@ -275,6 +275,7 @@ static const char* const kSwitchNames[]
+ switches::kDisableSkiaGraphite,
+ switches::kDisableSkiaGraphitePrecompilation,
+ switches::kDisableLowEndDeviceMode,
++ switches::kDisableUnveil,
+ switches::kProfilingAtStart,
+ switches::kProfilingFile,
+ switches::kProfilingFlush,
+@@ -302,7 +303,7 @@ static const char* const kSwitchNames[]
+ switches::kOzoneDumpFile,
+ switches::kEnableNativeGpuMemoryBuffers,
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ switches::kX11Display,
+ switches::kNoXshm,
+ #endif
diff --git a/electron34/patches/patch-content_browser_media_capture_desktop__capture__device.cc b/electron34/patches/patch-content_browser_media_capture_desktop__capture__device.cc
new file mode 100644
index 0000000000..fc8e31a50b
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_capture_desktop__capture__device.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/capture/desktop_capture_device.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/capture/desktop_capture_device.cc
+@@ -811,8 +811,14 @@ std::unique_ptr<media::VideoCaptureDevic
+
+ switch (source.type) {
+ case DesktopMediaID::TYPE_SCREEN: {
+- std::unique_ptr<webrtc::DesktopCapturer> screen_capturer(
+- webrtc::DesktopCapturer::CreateScreenCapturer(options));
++ std::unique_ptr<webrtc::DesktopCapturer> screen_capturer;
++ if (auto generic_capturer =
++ webrtc::DesktopCapturer::CreateGenericCapturer(options);
++ generic_capturer && generic_capturer->GetDelegatedSourceListController()) {
++ screen_capturer = std::move(generic_capturer);
++ } else {
++ screen_capturer = webrtc::DesktopCapturer::CreateScreenCapturer(options);
++ }
+ if (screen_capturer && screen_capturer->SelectSource(source.id)) {
+ capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
+ std::move(screen_capturer), options);
+@@ -825,8 +831,14 @@ std::unique_ptr<media::VideoCaptureDevic
+ }
+
+ case DesktopMediaID::TYPE_WINDOW: {
+- std::unique_ptr<webrtc::DesktopCapturer> window_capturer =
+- webrtc::DesktopCapturer::CreateWindowCapturer(options);
++ std::unique_ptr<webrtc::DesktopCapturer> window_capturer;
++ if (auto generic_capturer =
++ webrtc::DesktopCapturer::CreateGenericCapturer(options);
++ generic_capturer && generic_capturer->GetDelegatedSourceListController()) {
++ window_capturer = std::move(generic_capturer);
++ } else {
++ window_capturer = webrtc::DesktopCapturer::CreateWindowCapturer(options);
++ }
+ if (window_capturer && window_capturer->SelectSource(source.id)) {
+ capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
+ std::move(window_capturer), options);
diff --git a/electron34/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc b/electron34/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc
new file mode 100644
index 0000000000..7f8cb6f38f
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/capture/desktop_capture_device_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/capture/desktop_capture_device_mac.cc
+@@ -28,7 +28,7 @@ class DesktopCaptureDeviceMac : public I
+ ~DesktopCaptureDeviceMac() override = default;
+
+ // IOSurfaceCaptureDeviceBase:
+- void OnStart() override {
++ void OnStart(std::optional<bool> use_native_picker) override {
+ requested_format_ = capture_params().requested_format;
+ requested_format_.pixel_format = media::PIXEL_FORMAT_NV12;
+ DCHECK_GT(requested_format_.frame_size.GetArea(), 0);
diff --git a/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc b/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc
new file mode 100644
index 0000000000..37d226ce0c
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/capture/io_surface_capture_device_base_mac.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/capture/io_surface_capture_device_base_mac.cc
+@@ -20,7 +20,7 @@ void IOSurfaceCaptureDeviceBase::Allocat
+ client_ = std::move(client);
+ capture_params_ = params;
+
+- OnStart();
++ OnStart(params.use_native_picker);
+ }
+
+ void IOSurfaceCaptureDeviceBase::StopAndDeAllocate() {
diff --git a/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h b/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h
new file mode 100644
index 0000000000..2920bd6779
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/capture/io_surface_capture_device_base_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/capture/io_surface_capture_device_base_mac.h
+@@ -25,7 +25,7 @@ class CONTENT_EXPORT IOSurfaceCaptureDev
+ ~IOSurfaceCaptureDeviceBase() override;
+
+ // OnStart is called by AllocateAndStart.
+- virtual void OnStart() = 0;
++ virtual void OnStart(std::optional<bool> use_native_picker) = 0;
+
+ // OnStop is called by StopAndDeAllocate.
+ virtual void OnStop() = 0;
diff --git a/electron34/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm b/electron34/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
new file mode 100644
index 0000000000..a452a8d931
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
@@ -0,0 +1,288 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/capture/screen_capture_kit_device_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/capture/screen_capture_kit_device_mac.mm
+@@ -26,6 +26,61 @@ using SampleCallback = base::RepeatingCa
+ std::optional<gfx::Rect>,
+ bool)>;
+ using ErrorCallback = base::RepeatingClosure;
++using CancelCallback = base::RepeatingClosure;
++
++API_AVAILABLE(macos(15.0))
++@interface ScreenCaptureKitPickerHelper
++ : NSObject <SCContentSharingPickerObserver>
++
++- (void)contentSharingPicker:(SCContentSharingPicker *)picker
++ didCancelForStream:(SCStream *)stream;
++
++- (void)contentSharingPicker:(SCContentSharingPicker *)picker
++ didUpdateWithFilter:(SCContentFilter *)filter
++ forStream:(SCStream *)stream;
++
++- (void)contentSharingPickerStartDidFailWithError:(NSError *)error;
++
++@end
++
++@implementation ScreenCaptureKitPickerHelper {
++ base::RepeatingCallback<void(SCContentFilter *)> _pickerCallback;
++ ErrorCallback _errorCallback;
++ CancelCallback _cancelCallback;
++}
++
++- (void)contentSharingPicker:(SCContentSharingPicker *)picker
++ didCancelForStream:(SCStream *)stream {
++ // TODO: This doesn't appear to be called on Apple's side;
++ // implement this logic
++ _cancelCallback.Run();
++}
++
++- (void)contentSharingPicker:(SCContentSharingPicker *)picker
++ didUpdateWithFilter:(SCContentFilter *)filter
++ forStream:(SCStream *)stream {
++ if (stream == nil) {
++ _pickerCallback.Run(filter);
++ [picker removeObserver:self];
++ }
++}
++
++- (void)contentSharingPickerStartDidFailWithError:(NSError *)error {
++ _errorCallback.Run();
++}
++
++- (instancetype)initWithStreamPickCallback:(base::RepeatingCallback<void(SCContentFilter *)>)pickerCallback
++ cancelCallback:(CancelCallback)cancelCallback
++ errorCallback:(ErrorCallback)errorCallback {
++ if (self = [super init]) {
++ _pickerCallback = pickerCallback;
++ _cancelCallback = cancelCallback;
++ _errorCallback = errorCallback;
++ }
++ return self;
++}
++
++@end
+
+ namespace {
+ API_AVAILABLE(macos(12.3))
+@@ -100,18 +155,22 @@ API_AVAILABLE(macos(12.3))
+ : NSObject <SCStreamDelegate, SCStreamOutput>
+
+ - (instancetype)initWithSampleCallback:(SampleCallback)sampleCallback
++ cancelCallback:(CancelCallback)cancelCallback
+ errorCallback:(ErrorCallback)errorCallback;
+ @end
+
+ @implementation ScreenCaptureKitDeviceHelper {
+ SampleCallback _sampleCallback;
++ CancelCallback _cancelCallback;
+ ErrorCallback _errorCallback;
+ }
+
+ - (instancetype)initWithSampleCallback:(SampleCallback)sampleCallback
++ cancelCallback:(CancelCallback)cancelCallback
+ errorCallback:(ErrorCallback)errorCallback {
+ if (self = [super init]) {
+ _sampleCallback = sampleCallback;
++ _cancelCallback = cancelCallback;
+ _errorCallback = errorCallback;
+ }
+ return self;
+@@ -187,7 +246,8 @@ BASE_FEATURE(kScreenCaptureKitFullDeskto
+
+ class API_AVAILABLE(macos(12.3)) ScreenCaptureKitDeviceMac
+ : public IOSurfaceCaptureDeviceBase,
+- public ScreenCaptureKitResetStreamInterface {
++ public ScreenCaptureKitResetStreamInterface
++ {
+ public:
+ explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source,
+ SCContentFilter* filter)
+@@ -198,18 +258,42 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ device_task_runner_,
+ base::BindRepeating(&ScreenCaptureKitDeviceMac::OnStreamSample,
+ weak_factory_.GetWeakPtr()));
++ CancelCallback cancel_callback = base::BindPostTask(
++ device_task_runner_,
++ base::BindRepeating(&ScreenCaptureKitDeviceMac::OnStreamError,
++ weak_factory_.GetWeakPtr()));
+ ErrorCallback error_callback = base::BindPostTask(
+ device_task_runner_,
+ base::BindRepeating(&ScreenCaptureKitDeviceMac::OnStreamError,
+ weak_factory_.GetWeakPtr()));
+ helper_ = [[ScreenCaptureKitDeviceHelper alloc]
+ initWithSampleCallback:sample_callback
++ cancelCallback:cancel_callback
+ errorCallback:error_callback];
++
++ if (@available(macOS 15.0, *)) {
++ auto picker_callback = base::BindPostTask(
++ device_task_runner_,
++ base::BindRepeating(&ScreenCaptureKitDeviceMac::OnContentFilterReady, weak_factory_.GetWeakPtr())
++ );
++ picker_helper_ = [[ScreenCaptureKitPickerHelper alloc] initWithStreamPickCallback:picker_callback cancelCallback:cancel_callback errorCallback:error_callback];
++ [[SCContentSharingPicker sharedPicker] addObserver:picker_helper_];
++ }
+ }
+ ScreenCaptureKitDeviceMac(const ScreenCaptureKitDeviceMac&) = delete;
+ ScreenCaptureKitDeviceMac& operator=(const ScreenCaptureKitDeviceMac&) =
+ delete;
+- ~ScreenCaptureKitDeviceMac() override = default;
++ ~ScreenCaptureKitDeviceMac() override {
++ if (@available(macOS 15.0, *)) {
++ auto* picker = [SCContentSharingPicker sharedPicker];
++ ScreenCaptureKitDeviceMac::active_streams_--;
++ picker.maximumStreamCount = @(ScreenCaptureKitDeviceMac::active_streams_);
++ if (ScreenCaptureKitDeviceMac::active_streams_ == 0 && picker.active) {
++ picker.active = false;
++ [[SCContentSharingPicker sharedPicker] removeObserver:picker_helper_];
++ }
++ }
++ }
+
+ void OnShareableContentCreated(SCShareableContent* content) {
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
+@@ -230,8 +314,17 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ // fallback. See https://crbug.com/325530044.
+ if (source_.id == display.displayID ||
+ source_.id == webrtc::kFullDesktopScreenId) {
++ NSArray<NSWindow*>* exclude_ns_windows = [[[NSApplication sharedApplication] windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSWindow* win, NSDictionary *bindings) {
++ return [win sharingType] == NSWindowSharingNone;
++ }]];
++ NSArray<SCWindow*>* exclude_windows = [[content windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(SCWindow* win, NSDictionary *bindings) {
++ for (NSWindow* excluded : exclude_ns_windows) {
++ if ((CGWindowID)[excluded windowNumber] == [win windowID]) return true;
++ }
++ return false;
++ }]];
+ filter = [[SCContentFilter alloc] initWithDisplay:display
+- excludingWindows:@[]];
++ excludingWindows:exclude_windows];
+ stream_config_content_size_ =
+ gfx::Size(display.width, display.height);
+ break;
+@@ -268,7 +361,7 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ return;
+ }
+
+- if (@available(macOS 14.0, *)) {
++ if (@available(macOS 15.0, *)) {
+ // Update the content size. This step is neccessary when used together
+ // with SCContentSharingPicker. If the Chrome picker is used, it will
+ // change to retina resolution if applicable.
+@@ -277,6 +370,9 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ filter.contentRect.size.height * filter.pointPixelScale);
+ }
+
++ OnContentFilterReady(filter);
++ }
++ void OnContentFilterReady(SCContentFilter* filter) {
+ gfx::RectF dest_rect_in_frame;
+ actual_capture_format_ = capture_params().requested_format;
+ actual_capture_format_.pixel_format = media::PIXEL_FORMAT_NV12;
+@@ -290,6 +386,7 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ stream_ = [[SCStream alloc] initWithFilter:filter
+ configuration:config
+ delegate:helper_];
++
+ {
+ NSError* error = nil;
+ bool add_stream_output_result =
+@@ -443,7 +540,7 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ if (fullscreen_module_) {
+ fullscreen_module_->Reset();
+ }
+- OnStart();
++ OnStart(std::nullopt);
+ } else {
+ client()->OnError(media::VideoCaptureError::kScreenCaptureKitStreamError,
+ FROM_HERE, "Stream delegate called didStopWithError");
+@@ -466,23 +563,41 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ }
+
+ // IOSurfaceCaptureDeviceBase:
+- void OnStart() override {
++ void OnStart(std::optional<bool> use_native_picker) override {
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
+- if (filter_) {
+- // SCContentSharingPicker is used where filter_ is set on creation.
+- CreateStream(filter_);
+- } else {
+- // Chrome picker is used.
+- auto content_callback = base::BindPostTask(
+- device_task_runner_,
+- base::BindRepeating(
+- &ScreenCaptureKitDeviceMac::OnShareableContentCreated,
+- weak_factory_.GetWeakPtr()));
+- auto handler = ^(SCShareableContent* content, NSError* error) {
+- content_callback.Run(content);
+- };
+- [SCShareableContent getShareableContentWithCompletionHandler:handler];
++
++ if (@available(macOS 15.0, *)) {
++ constexpr bool DefaultUseNativePicker = true;
++ if (use_native_picker.value_or(DefaultUseNativePicker) &&
++ source_.id == DesktopMediaID::kMacOsNativePickerId &&
++ source_.window_id < 0) {
++ auto* picker = [SCContentSharingPicker sharedPicker];
++ ScreenCaptureKitDeviceMac::active_streams_++;
++ picker.maximumStreamCount = @(ScreenCaptureKitDeviceMac::active_streams_);
++ if (!picker.active) {
++ picker.active = true;
++ }
++ NSMutableArray<NSNumber*>* exclude_ns_windows = [NSMutableArray array];
++ [[[[NSApplication sharedApplication] windows] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSWindow* win, NSDictionary *bindings) {
++ return [win sharingType] == NSWindowSharingNone;
++ }]] enumerateObjectsUsingBlock:^(NSWindow* win, NSUInteger idx, BOOL *stop) {
++ [exclude_ns_windows addObject:@([win windowNumber])];
++ }];
++ picker.defaultConfiguration.excludedWindowIDs = exclude_ns_windows;
++ [picker present];
++ return;
++ }
+ }
++
++ auto content_callback = base::BindPostTask(
++ device_task_runner_,
++ base::BindRepeating(
++ &ScreenCaptureKitDeviceMac::OnShareableContentCreated,
++ weak_factory_.GetWeakPtr()));
++ auto handler = ^(SCShareableContent* content, NSError* error) {
++ content_callback.Run(content);
++ };
++ [SCShareableContent getShareableContentWithCompletionHandler:handler];
+ }
+ void OnStop() override {
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
+@@ -540,6 +655,8 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ }
+
+ private:
++ static int active_streams_;
++
+ const DesktopMediaID source_;
+ SCContentFilter* const filter_;
+ const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
+@@ -557,6 +674,10 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ // Helper class that acts as output and delegate for `stream_`.
+ ScreenCaptureKitDeviceHelper* __strong helper_;
+
++ // Helper class that acts as an observer for SCContentSharingPicker
++ API_AVAILABLE(macos(15.0))
++ ScreenCaptureKitPickerHelper* __strong picker_helper_;
++
+ // This is used to detect when a captured presentation enters fullscreen mode.
+ // If this happens, the module will call the ResetStreamTo function.
+ std::unique_ptr<ScreenCaptureKitFullscreenModule> fullscreen_module_;
+@@ -569,6 +690,8 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ base::WeakPtrFactory<ScreenCaptureKitDeviceMac> weak_factory_{this};
+ };
+
++int ScreenCaptureKitDeviceMac::active_streams_ = 0;
++
+ } // namespace
+
+ // Although ScreenCaptureKit is available in 12.3 there were some bugs that
diff --git a/electron34/patches/patch-content_browser_media_frameless__media__interface__proxy.h b/electron34/patches/patch-content_browser_media_frameless__media__interface__proxy.h
new file mode 100644
index 0000000000..fa4b909649
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_frameless__media__interface__proxy.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/frameless_media_interface_proxy.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/frameless_media_interface_proxy.h
+@@ -19,7 +19,7 @@
+ #include "mojo/public/cpp/bindings/receiver_set.h"
+ #include "mojo/public/cpp/bindings/remote.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "media/mojo/mojom/stable/stable_video_decoder.mojom.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -105,7 +105,7 @@ class FramelessMediaInterfaceProxy final
+ // Connections to the renderer.
+ mojo::ReceiverSet<media::mojom::InterfaceFactory> receivers_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Connection to the StableVideoDecoderFactory that lives in a utility
+ // process. This is only used for out-of-process video decoding and only when
+ // the FramelessMediaInterfaceProxy is created without a RenderProcessHost
diff --git a/electron34/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc b/electron34/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc
new file mode 100644
index 0000000000..64dac171d5
--- /dev/null
+++ b/electron34/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/media/media_keys_listener_manager_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/media/media_keys_listener_manager_impl.cc
+@@ -88,7 +88,11 @@ bool MediaKeysListenerManagerImpl::Start
+ CanActiveMediaSessionControllerReceiveEvents();
+
+ // Tell the underlying MediaKeysListener to listen for the key.
+- if (should_start_watching && media_keys_listener_ &&
++ if (
++#if BUILDFLAG(IS_MAC)
++ !media_key_handling_enabled_ &&
++#endif // BUILDFLAG(IS_MAC)
++ should_start_watching && media_keys_listener_ &&
+ !media_keys_listener_->StartWatchingMediaKey(key_code)) {
+ return false;
+ }
+@@ -333,7 +337,7 @@ void MediaKeysListenerManagerImpl::Start
+ return;
+ }
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_WIN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) || BUILDFLAG(IS_WIN)
+ // Create SystemMediaControls with the SingletonHwnd.
+ browser_system_media_controls_ =
+ system_media_controls::SystemMediaControls::Create(
+@@ -362,6 +366,20 @@ void MediaKeysListenerManagerImpl::Start
+ this, ui::MediaKeysListener::Scope::kGlobal);
+ DCHECK(media_keys_listener_);
+ }
++
++#if BUILDFLAG(IS_MAC)
++ // Chromium's implementation of SystemMediaControls falls
++ // down into MPRemoteCommandCenter, which makes it such that an app will not
++ // will not receive remote control events until it begins playing audio.
++ // If there's not already a MediaKeysListener instance, create one so
++ // that globalShortcuts work correctly.
++ if (!media_keys_listener_) {
++ media_keys_listener_ = ui::MediaKeysListener::Create(
++ this, ui::MediaKeysListener::Scope::kGlobal);
++ DCHECK(media_keys_listener_);
++ }
++#endif
++
+ EnsureAuxiliaryServices();
+ }
+
+@@ -413,6 +431,11 @@ void MediaKeysListenerManagerImpl::Updat
+ case ui::VKEY_MEDIA_STOP:
+ browser_system_media_controls_->SetIsStopEnabled(should_enable);
+ break;
++ case ui::VKEY_VOLUME_DOWN:
++ case ui::VKEY_VOLUME_UP:
++ case ui::VKEY_VOLUME_MUTE:
++ // Do nothing.
++ break;
+ default:
+ NOTREACHED();
+ }
+@@ -455,6 +478,11 @@ void MediaKeysListenerManagerImpl::Updat
+ case ui::VKEY_MEDIA_STOP:
+ smc->SetIsStopEnabled(should_enable);
+ break;
++ case ui::VKEY_VOLUME_DOWN:
++ case ui::VKEY_VOLUME_UP:
++ case ui::VKEY_VOLUME_MUTE:
++ // Do nothing.
++ break;
+ default:
+ NOTREACHED();
+ }
diff --git a/electron34/patches/patch-content_browser_network__service__instance__impl.cc b/electron34/patches/patch-content_browser_network__service__instance__impl.cc
new file mode 100644
index 0000000000..c2edcdc29a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_network__service__instance__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/network_service_instance_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/network_service_instance_impl.cc
+@@ -85,7 +85,7 @@
+ #include "content/browser/network/network_service_process_tracker_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/system_dns_resolution/system_dns_resolver.h"
+ #include "services/network/public/mojom/system_dns_resolution.mojom-forward.h"
+ #endif
+@@ -368,7 +368,7 @@ void CreateInProcessNetworkService(
+ std::move(receiver)));
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Runs a self-owned SystemDnsResolverMojoImpl. This is meant to run on a
+ // high-priority thread pool.
+ void RunSystemDnsResolverOnThreadPool(
+@@ -437,7 +437,7 @@ network::mojom::NetworkServiceParamsPtr
+ }
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (GetContentClient()
+ ->browser()
+ ->ShouldRunOutOfProcessSystemDnsResolution() &&
diff --git a/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.cc b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.cc
new file mode 100644
index 0000000000..e088cf8b8a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/notifications/blink_notification_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/notifications/blink_notification_service_impl.cc
+@@ -87,12 +87,14 @@ BlinkNotificationServiceImpl::BlinkNotif
+ BrowserContext* browser_context,
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderProcessHost* render_process_host,
++ RenderFrameHost* render_frame_host,
+ const blink::StorageKey& storage_key,
+ const GURL& document_url,
+ const WeakDocumentPtr& weak_document_ptr,
+ RenderProcessHost::NotificationServiceCreatorType creator_type,
+ mojo::PendingReceiver<blink::mojom::NotificationService> receiver)
+ : notification_context_(notification_context),
++ render_frame_host_(render_frame_host),
+ browser_context_(browser_context),
+ service_worker_context_(std::move(service_worker_context)),
+ render_process_host_id_(render_process_host->GetID()),
+@@ -184,7 +186,7 @@ void BlinkNotificationServiceImpl::Displ
+ creator_type_);
+
+ browser_context_->GetPlatformNotificationService()->DisplayNotification(
+- notification_id, storage_key_.origin().GetURL(), document_url_,
++ render_frame_host_, notification_id, storage_key_.origin().GetURL(), document_url_,
+ platform_notification_data, notification_resources);
+ }
+
diff --git a/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.h b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.h
new file mode 100644
index 0000000000..aa87ba1bda
--- /dev/null
+++ b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/notifications/blink_notification_service_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/notifications/blink_notification_service_impl.h
+@@ -44,6 +44,7 @@ class CONTENT_EXPORT BlinkNotificationSe
+ BrowserContext* browser_context,
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context,
+ RenderProcessHost* render_process_host,
++ RenderFrameHost* render_frame_host,
+ const blink::StorageKey& storage_key,
+ const GURL& document_url,
+ const WeakDocumentPtr& weak_document_ptr,
+@@ -113,6 +114,7 @@ class CONTENT_EXPORT BlinkNotificationSe
+ raw_ptr<PlatformNotificationContextImpl, DanglingUntriaged>
+ notification_context_;
+
++ raw_ptr<RenderFrameHost> render_frame_host_;
+ raw_ptr<BrowserContext> browser_context_;
+
+ scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_;
diff --git a/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc
new file mode 100644
index 0000000000..06d09e57a0
--- /dev/null
+++ b/electron34/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/notifications/blink_notification_service_impl_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/notifications/blink_notification_service_impl_unittest.cc
+@@ -132,7 +132,7 @@ class BlinkNotificationServiceImplTest :
+ notification_service_ = std::make_unique<BlinkNotificationServiceImpl>(
+ notification_context_.get(), &browser_context_,
+ embedded_worker_helper_->context_wrapper(), &render_process_host_,
+- storage_key_,
++ nullptr, storage_key_,
+ /*document_url=*/GURL(),
+ contents_.get()->GetPrimaryMainFrame()->GetWeakDocumentPtr(),
+ RenderProcessHost::NotificationServiceCreatorType::kDocument,
diff --git a/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.cc b/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.cc
new file mode 100644
index 0000000000..a45047abe5
--- /dev/null
+++ b/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/notifications/platform_notification_context_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/notifications/platform_notification_context_impl.cc
+@@ -282,6 +282,7 @@ void PlatformNotificationContextImpl::Sh
+
+ void PlatformNotificationContextImpl::CreateService(
+ RenderProcessHost* render_process_host,
++ RenderFrameHost* render_frame_host,
+ const blink::StorageKey& storage_key,
+ const GURL& document_url,
+ const WeakDocumentPtr& weak_document_ptr,
+@@ -290,7 +291,7 @@ void PlatformNotificationContextImpl::Cr
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ services_.push_back(std::make_unique<BlinkNotificationServiceImpl>(
+ this, browser_context_, service_worker_context_, render_process_host,
+- storage_key, document_url, weak_document_ptr, creator_type,
++ render_frame_host, storage_key, document_url, weak_document_ptr, creator_type,
+ std::move(receiver)));
+ }
+
diff --git a/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.h b/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.h
new file mode 100644
index 0000000000..5b3c643583
--- /dev/null
+++ b/electron34/patches/patch-content_browser_notifications_platform__notification__context__impl.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/notifications/platform_notification_context_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/notifications/platform_notification_context_impl.h
+@@ -47,6 +47,7 @@ class PlatformNotificationServiceProxy;
+ class RenderProcessHost;
+ class ServiceWorkerContextWrapper;
+ class WeakDocumentPtr;
++class RenderFrameHost;
+
+ // Implementation of the Web Notification storage context. The public methods
+ // defined in this interface must only be called on the UI thread.
+@@ -80,6 +81,7 @@ class CONTENT_EXPORT PlatformNotificatio
+ // service is created by a dedicated worker, or is `nullptr` otherwise.
+ void CreateService(
+ RenderProcessHost* render_process_host,
++ RenderFrameHost* render_frame_host,
+ const blink::StorageKey& storage_key,
+ const GURL& document_url,
+ const WeakDocumentPtr& weak_document_ptr,
diff --git a/electron34/patches/patch-content_browser_permissions_permission__controller__impl.cc b/electron34/patches/patch-content_browser_permissions_permission__controller__impl.cc
new file mode 100644
index 0000000000..b44fa44629
--- /dev/null
+++ b/electron34/patches/patch-content_browser_permissions_permission__controller__impl.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/permissions/permission_controller_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/permissions/permission_controller_impl.cc
+@@ -94,6 +94,7 @@ PermissionToSchedulingFeature(Permission
+ case PermissionType::POINTER_LOCK:
+ case PermissionType::AUTOMATIC_FULLSCREEN:
+ case PermissionType::WEB_APP_INSTALLATION:
++ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
+ return std::nullopt;
+ }
+ }
diff --git a/electron34/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc b/electron34/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
new file mode 100644
index 0000000000..fd90b65c1e
--- /dev/null
+++ b/electron34/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/ppapi_plugin_process_host_receiver_bindings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/ppapi_plugin_process_host_receiver_bindings.cc
+@@ -8,7 +8,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+ #include "content/browser/font_service.h" // nogncheck
+ #endif
+@@ -17,7 +17,7 @@ namespace content {
+
+ void PpapiPluginProcessHost::BindHostReceiver(
+ mojo::GenericPendingReceiver receiver) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>())
+ ConnectToFontService(std::move(font_receiver));
+ #endif
diff --git a/electron34/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc b/electron34/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc
new file mode 100644
index 0000000000..7e4e7dc48f
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc
@@ -0,0 +1,124 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/code_cache_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/code_cache_host_impl.cc
+@@ -6,6 +6,7 @@
+
+ #include <utility>
+
++#include "base/containers/contains.h"
+ #include "base/functional/bind.h"
+ #include "base/functional/callback_helpers.h"
+ #include "base/metrics/histogram_functions.h"
+@@ -29,6 +30,7 @@
+ #include "third_party/blink/public/common/scheme_registry.h"
+ #include "url/gurl.h"
+ #include "url/origin.h"
++#include "url/url_util.h"
+
+ using blink::mojom::CacheStorageError;
+
+@@ -36,6 +38,11 @@ namespace content {
+
+ namespace {
+
++bool ProcessLockURLIsCodeCacheScheme(const ProcessLock& process_lock) {
++ return base::Contains(url::GetCodeCacheSchemes(),
++ process_lock.lock_url().scheme());
++}
++
+ bool CheckSecurityForAccessingCodeCacheData(
+ const GURL& resource_url,
+ int render_process_id,
+@@ -46,39 +53,57 @@ bool CheckSecurityForAccessingCodeCacheD
+
+ // Code caching is only allowed for http(s) and chrome/chrome-untrusted
+ // scripts. Furthermore, there is no way for http(s) pages to load chrome or
++ // Code caching is only allowed for scripts from:
++ // 1. http: and https: schemes.
++ // 2. chrome: and chrome-untrusted: schemes.
++ // 3. Schemes registered by content/ embedder via url::AddCodeCacheScheme.
++ //
++ // Furthermore, we know there are no way for http(s) pages to load chrome or
+ // chrome-untrusted scripts, so any http(s) page attempting to store data
+ // about a chrome or chrome-untrusted script would be an indication of
+ // suspicious activity.
+- if (resource_url.SchemeIs(content::kChromeUIScheme) ||
+- resource_url.SchemeIs(content::kChromeUIUntrustedScheme)) {
+- if (!process_lock.is_locked_to_site()) {
+- // We can't tell for certain whether this renderer is doing something
+- // malicious, but we don't trust it enough to store data.
+- return false;
+- }
++ if (resource_url.SchemeIsHTTPOrHTTPS()) {
+ if (process_lock.matches_scheme(url::kHttpScheme) ||
+ process_lock.matches_scheme(url::kHttpsScheme)) {
+- if (operation == CodeCacheHostImpl::Operation::kWrite) {
++ return true;
++ }
++ // Pages in custom schemes like isolated-app: are allowed to load http(s)
++ // resources.
++ if (ProcessLockURLIsCodeCacheScheme(process_lock)) {
++ return true;
++ }
++ // It is possible for WebUI pages to include open-web content, but such
++ // usage is rare and we've decided that reasoning about security is easier
++ // if the WebUI code cache includes only WebUI scripts.
++ return false;
++ }
++
++ if (resource_url.SchemeIs(kChromeUIScheme) ||
++ resource_url.SchemeIs(kChromeUIUntrustedScheme)) {
++ if (process_lock.matches_scheme(kChromeUIScheme) ||
++ process_lock.matches_scheme(kChromeUIUntrustedScheme)) {
++ return true;
++ }
++ if (operation == CodeCacheHostImpl::Operation::kWrite) {
++ if (process_lock.matches_scheme(url::kHttpScheme) ||
++ process_lock.matches_scheme(url::kHttpsScheme)) {
+ mojo::ReportBadMessage("HTTP(S) pages cannot cache WebUI code");
+ }
++ if (ProcessLockURLIsCodeCacheScheme(process_lock)) {
++ mojo::ReportBadMessage(
++ "Page whose scheme are allowed by content/ embedders cannot cache "
++ "WebUI code. Did the embedder misconfigured content/?");
++ }
+ return false;
+ }
+ // Other schemes which might successfully load chrome or chrome-untrusted
+ // scripts, such as the PDF viewer, are unsupported but not considered
+- // dangerous.
+- return process_lock.matches_scheme(content::kChromeUIScheme) ||
+- process_lock.matches_scheme(content::kChromeUIUntrustedScheme);
+- }
+- if (resource_url.SchemeIsHTTPOrHTTPS() ||
+- blink::CommonSchemeRegistry::IsExtensionScheme(resource_url.scheme())) {
+- if (process_lock.matches_scheme(content::kChromeUIScheme) ||
+- process_lock.matches_scheme(content::kChromeUIUntrustedScheme)) {
+- // It is possible for WebUI pages to include open-web content, but such
+- // usage is rare and we've decided that reasoning about security is easier
+- // if the WebUI code cache includes only WebUI scripts.
+- return false;
+- }
+- return true;
++ // dangerous. Similarly, the process might not be locked to a site.
++ return false;
++ }
++
++ if (base::Contains(url::GetCodeCacheSchemes(), resource_url.scheme())) {
++ return ProcessLockURLIsCodeCacheScheme(process_lock);
+ }
+
+ if (operation == CodeCacheHostImpl::Operation::kWrite) {
+@@ -433,6 +458,7 @@ std::optional<GURL> CodeCacheHostImpl::G
+ process_lock.matches_scheme(url::kHttpsScheme) ||
+ process_lock.matches_scheme(content::kChromeUIScheme) ||
+ process_lock.matches_scheme(content::kChromeUIUntrustedScheme) ||
++ ProcessLockURLIsCodeCacheScheme(process_lock) ||
+ blink::CommonSchemeRegistry::IsExtensionScheme(
+ process_lock.lock_url().scheme())) {
+ return process_lock.lock_url();
diff --git a/electron34/patches/patch-content_browser_renderer__host_delegated__frame__host.cc b/electron34/patches/patch-content_browser_renderer__host_delegated__frame__host.cc
new file mode 100644
index 0000000000..4fd8bef8f6
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_delegated__frame__host.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/delegated_frame_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/delegated_frame_host.cc
+@@ -318,7 +318,7 @@ void DelegatedFrameHost::EmbedSurface(
+
+ if (!primary_surface_id ||
+ primary_surface_id->local_surface_id() != local_surface_id_) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // On Windows and Linux, we would like to produce new content as soon as
+ // possible or the OS will create an additional black gutter. Until we can
+ // block resize on surface synchronization on these platforms, we will not
diff --git a/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc b/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc
new file mode 100644
index 0000000000..642b251536
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/legacy_render_widget_host_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/legacy_render_widget_host_win.cc
+@@ -325,12 +325,12 @@ LRESULT LegacyRenderWidgetHostHWND::OnMo
+ WPARAM w_param,
+ LPARAM l_param,
+ BOOL& handled) {
+- if (message == WM_MOUSEMOVE) {
++ if (message == WM_MOUSEMOVE || message == WM_NCMOUSEMOVE) {
+ if (!mouse_tracking_enabled_) {
+ mouse_tracking_enabled_ = true;
+ TRACKMOUSEEVENT tme;
+ tme.cbSize = sizeof(tme);
+- tme.dwFlags = TME_LEAVE;
++ tme.dwFlags = message == WM_NCMOUSEMOVE ? TME_NONCLIENT | TME_LEAVE : TME_LEAVE;
+ tme.hwndTrack = hwnd();
+ tme.dwHoverTime = 0;
+ TrackMouseEvent(&tme);
+@@ -361,7 +361,10 @@ LRESULT LegacyRenderWidgetHostHWND::OnMo
+ // out of the picture.
+ if (!handled &&
+ (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) {
+- ret = ::DefWindowProc(GetParent(), message, w_param, l_param);
++ // Send WM_NCMOUSEMOVE messages using the LegacyRenderWidgetHostHWND's
++ // handle so mouse tracking on non-client areas doesn't break.
++ HWND target = message == WM_NCMOUSEMOVE ? hwnd() : GetParent();
++ ret = ::DefWindowProc(target, message, w_param, l_param);
+ handled = TRUE;
+ }
+ }
diff --git a/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h b/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h
new file mode 100644
index 0000000000..95db46a901
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/legacy_render_widget_host_win.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/legacy_render_widget_host_win.h
+@@ -103,6 +103,7 @@ class CONTENT_EXPORT LegacyRenderWidgetH
+ MESSAGE_HANDLER_EX(WM_VSCROLL, OnScroll)
+ MESSAGE_HANDLER_EX(WM_NCHITTEST, OnNCHitTest)
+ MESSAGE_RANGE_HANDLER(WM_NCMOUSEMOVE, WM_NCXBUTTONDBLCLK, OnMouseRange)
++ MESSAGE_HANDLER_EX(WM_NCMOUSELEAVE, OnMouseLeave)
+ MESSAGE_HANDLER_EX(WM_NCCALCSIZE, OnNCCalcSize)
+ MESSAGE_HANDLER_EX(WM_SIZE, OnSize)
+ MESSAGE_HANDLER_EX(WM_DESTROY, OnDestroy)
diff --git a/electron34/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc b/electron34/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc
new file mode 100644
index 0000000000..39ec4e82c0
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+@@ -329,8 +329,16 @@ void InProcessVideoCaptureDeviceLauncher
+ break;
+ }
+
++#if defined(USE_AURA)
++ bool allow_window_id = false;
++#elif BUILDFLAG(IS_MAC)
++ bool allow_window_id =
++ desktop_id.id == DesktopMediaID::kMacOsNativePickerId;
++#endif
++
+ #if defined(USE_AURA) || BUILDFLAG(IS_MAC)
+- if (desktop_id.window_id != DesktopMediaID::kNullId) {
++ if (!allow_window_id &&
++ desktop_id.window_id != DesktopMediaID::kNullId) {
+ // For the other capturers, when a bug reports the type of capture it's
+ // easy enough to determine which capturer was used, but it's a little
+ // fuzzier with window capture.
+@@ -346,13 +354,15 @@ void InProcessVideoCaptureDeviceLauncher
+ }
+ #endif // defined(USE_AURA) || BUILDFLAG(IS_MAC)
+
++ media::VideoCaptureParams updated_params = params;
++ updated_params.use_native_picker = stream_type != blink::mojom::MediaStreamType::GUM_DESKTOP_VIDEO_CAPTURE;
+ // All cases other than tab capture or Aura desktop/window capture.
+ TRACE_EVENT_INSTANT0(TRACE_DISABLED_BY_DEFAULT("video_and_image_capture"),
+ "UsingDesktopCapturer", TRACE_EVENT_SCOPE_THREAD);
+ start_capture_closure = base::BindOnce(
+ &InProcessVideoCaptureDeviceLauncher::
+ DoStartDesktopCaptureOnDeviceThread,
+- base::Unretained(this), desktop_id, params,
++ base::Unretained(this), desktop_id, updated_params,
+ CreateDeviceClient(media::VideoCaptureBufferType::kSharedMemory,
+ kMaxNumberOfBuffers, std::move(receiver),
+ std::move(receiver_on_io_thread)),
diff --git a/electron34/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc b/electron34/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
new file mode 100644
index 0000000000..f503769157
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/media/service_video_capture_device_launcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/media/service_video_capture_device_launcher.cc
+@@ -25,7 +25,7 @@
+ #include "media/base/media_switches.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/browser/gpu/gpu_data_manager_impl.h"
+ #endif
+
+@@ -173,7 +173,7 @@ void ServiceVideoCaptureDeviceLauncher::
+ }
+ #else
+ if (switches::IsVideoCaptureUseGpuMemoryBufferEnabled()) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux, additionally check whether the NV12 GPU memory buffer is
+ // supported.
+ if (GpuDataManagerImpl::GetInstance()->IsGpuMemoryBufferNV12Supported())
diff --git a/electron34/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc b/electron34/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc
new file mode 100644
index 0000000000..08f7fa5f16
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/navigation_controller_impl_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/navigation_controller_impl_unittest.cc
+@@ -163,6 +163,12 @@ class MockPageBroadcast : public blink::
+ (network::mojom::AttributionSupport support),
+ (override));
+
++ MOCK_METHOD(
++ void,
++ SetSchedulerThrottling,
++ (bool allowed),
++ (override));
++
+ mojo::PendingAssociatedRemote<blink::mojom::PageBroadcast> GetRemote() {
+ return receiver_.BindNewEndpointAndPassDedicatedRemote();
+ }
diff --git a/electron34/patches/patch-content_browser_renderer__host_navigation__request.cc b/electron34/patches/patch-content_browser_renderer__host_navigation__request.cc
new file mode 100644
index 0000000000..ef8171c5e5
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_navigation__request.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/navigation_request.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/navigation_request.cc
+@@ -10806,6 +10806,12 @@ NavigationRequest::GetOriginForURLLoader
+ "blob");
+ }
+
++ if (!common_params().url.IsStandard()) {
++ return std::make_pair(url::Origin::Resolve(common_params().url,
++ url::Origin()),
++ "url_non_standard");
++ }
++
+ // In cases not covered above, URLLoaderFactory should be associated with the
+ // origin of |common_params.url| and/or |common_params.initiator_origin|.
+ url::Origin resolved_origin = url::Origin::Resolve(
diff --git a/electron34/patches/patch-content_browser_renderer__host_navigator.cc b/electron34/patches/patch-content_browser_renderer__host_navigator.cc
new file mode 100644
index 0000000000..e0ca257786
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_navigator.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/navigator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/navigator.cc
+@@ -1450,6 +1450,7 @@ void Navigator::RecordNavigationMetrics(
+ .InMilliseconds());
+ }
+
++#if 0
+ // If this is a same-process navigation and we have timestamps for unload
+ // durations, fill those metrics out as well.
+ if (params.unload_start && params.unload_end &&
+@@ -1499,6 +1500,7 @@ void Navigator::RecordNavigationMetrics(
+ first_before_unload_start_time)
+ .InMilliseconds());
+ }
++#endif
+
+ builder.Record(ukm::UkmRecorder::Get());
+ metrics_data_.reset();
diff --git a/electron34/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc b/electron34/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
new file mode 100644
index 0000000000..44f0233f40
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/pepper/pepper_file_io_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/pepper/pepper_file_io_host.cc
+@@ -462,7 +462,7 @@ void PepperFileIOHost::OnLocalFileOpened
+ ppapi::host::ReplyMessageContext reply_context,
+ const base::FilePath& path,
+ base::File::Error error_code) {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Quarantining a file before its contents are available is only supported on
+ // Windows and Linux.
+ if (!FileOpenForWrite(open_flags_) || error_code != base::File::FILE_OK) {
+@@ -496,7 +496,7 @@ void PepperFileIOHost::OnLocalFileOpened
+ #endif
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void PepperFileIOHost::OnLocalFileQuarantined(
+ ppapi::host::ReplyMessageContext reply_context,
+ const base::FilePath& path,
diff --git a/electron34/patches/patch-content_browser_renderer__host_policy__container__host.cc b/electron34/patches/patch-content_browser_renderer__host_policy__container__host.cc
new file mode 100644
index 0000000000..c35ed263f4
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_policy__container__host.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/policy_container_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/policy_container_host.cc
+@@ -135,9 +135,11 @@ PolicyContainerPolicies::PolicyContainer
+ allow_cross_origin_isolation(allow_cross_origin_isolation) {}
+
+ PolicyContainerPolicies::PolicyContainerPolicies(
+- const blink::mojom::PolicyContainerPolicies& policies)
++ const blink::mojom::PolicyContainerPolicies& policies,
++ bool is_web_secure_context)
+ : referrer_policy(policies.referrer_policy),
+ ip_address_space(policies.ip_address_space),
++ is_web_secure_context(is_web_secure_context),
+ content_security_policies(
+ mojo::Clone(policies.content_security_policies)),
+ cross_origin_embedder_policy(policies.cross_origin_embedder_policy),
diff --git a/electron34/patches/patch-content_browser_renderer__host_policy__container__host.h b/electron34/patches/patch-content_browser_renderer__host_policy__container__host.h
new file mode 100644
index 0000000000..315ced8333
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_policy__container__host.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/policy_container_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/policy_container_host.h
+@@ -49,7 +49,8 @@ struct CONTENT_EXPORT PolicyContainerPol
+ bool allow_cross_origin_isolation);
+
+ explicit PolicyContainerPolicies(
+- const blink::mojom::PolicyContainerPolicies& policies);
++ const blink::mojom::PolicyContainerPolicies& policies,
++ bool is_web_secure_context);
+
+ // Used when loading workers from network schemes.
+ // WARNING: This does not populate referrer policy.
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc b/electron34/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc
new file mode 100644
index 0000000000..3906c4c41a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_frame_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_frame_host_impl.cc
+@@ -784,8 +784,8 @@ void VerifyThatBrowserAndRendererCalcula
+ // TODO(crbug.com/40092527): Consider adding a separate boolean that
+ // tracks this instead of piggybacking `origin_calculation_debug_info`.
+ if (renderer_side_origin.opaque() &&
+- browser_side_origin_and_debug_info.first->opaque() &&
+- params.origin_calculation_debug_info.ends_with("is_newly_created")) {
++ browser_side_origin_and_debug_info.first->opaque() /*&&
++ params.origin_calculation_debug_info.ends_with("is_newly_created")*/) {
+ origins_match = (renderer_side_origin.GetTupleOrPrecursorTupleIfOpaque() ==
+ browser_side_origin_and_debug_info.first
+ ->GetTupleOrPrecursorTupleIfOpaque());
+@@ -8295,6 +8295,17 @@ void RenderFrameHostImpl::EnterFullscree
+ }
+ }
+
++ // Entering fullscreen from webview should also notify its outer frame.
++ if (frame_tree_node()->render_manager()->IsMainFrameForInnerDelegate()) {
++ RenderFrameProxyHost* outer_proxy =
++ frame_tree_node()->render_manager()->GetProxyToOuterDelegate();
++ DCHECK(outer_proxy);
++ if (outer_proxy->is_render_frame_proxy_live()) {
++ outer_proxy->GetAssociatedRemoteFrame()->WillEnterFullscreen(
++ options.Clone());
++ }
++ }
++
+ // Focus the window if another frame may have delegated the capability.
+ if (had_fullscreen_token && !GetView()->HasFocus())
+ GetView()->Focus();
+@@ -9188,6 +9199,7 @@ void RenderFrameHostImpl::CreateNewWindo
+ last_committed_origin_, params->window_container_type,
+ params->target_url, params->referrer.To<Referrer>(),
+ params->frame_name, params->disposition, *params->features,
++ params->raw_features, params->body,
+ effective_transient_activation_state, params->opener_suppressed,
+ &no_javascript_access);
+
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc b/electron34/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc
new file mode 100644
index 0000000000..f326979c27
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_frame_host_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_frame_host_manager.cc
+@@ -4617,6 +4617,9 @@ RenderFrameHostManager::GetSiteInstanceF
+ request->ResetStateForSiteInstanceChange();
+ }
+
++ GetContentClient()->browser()->RegisterPendingSiteInstance(
++ render_frame_host_.get(), dest_site_instance.get());
++
+ return dest_site_instance;
+ }
+
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.cc b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.cc
new file mode 100644
index 0000000000..93f3720d46
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.cc
@@ -0,0 +1,90 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_process_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_process_host_impl.cc
+@@ -220,7 +220,7 @@
+ #include "third_party/blink/public/mojom/android_font_lookup/android_font_lookup.mojom.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <sys/resource.h>
+
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+@@ -1082,7 +1082,7 @@ static constexpr size_t kUnknownPlatform
+ // to indicate failure and std::numeric_limits<size_t>::max() to indicate
+ // unlimited.
+ size_t GetPlatformProcessLimit() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct rlimit limit;
+ if (getrlimit(RLIMIT_NPROC, &limit) != 0)
+ return kUnknownPlatformProcessLimit;
+@@ -1259,7 +1259,7 @@ RenderProcessHostImpl::IOThreadHostImpl:
+
+ void RenderProcessHostImpl::IOThreadHostImpl::SetPid(
+ base::ProcessId child_pid) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ child_thread_type_switcher_.SetPid(child_pid);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
+@@ -1754,6 +1754,10 @@ bool RenderProcessHostImpl::Init() {
+ std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
+ std::make_unique<RendererSandboxedProcessLauncherDelegateWin>(
+ *cmd_line, IsPdf(), IsJitDisabled());
++#elif BUILDFLAG(USE_ZYGOTE)
++ bool use_zygote = !cmd_line->HasSwitch(switches::kNoZygote);
++ std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
++ std::make_unique<RendererSandboxedProcessLauncherDelegate>(use_zygote);
+ #else
+ std::unique_ptr<SandboxedProcessLauncherDelegate> sandbox_delegate =
+ std::make_unique<RendererSandboxedProcessLauncherDelegate>();
+@@ -2106,7 +2110,7 @@ void RenderProcessHostImpl::CreateNotifi
+ case RenderProcessHost::NotificationServiceCreatorType::kSharedWorker:
+ case RenderProcessHost::NotificationServiceCreatorType::kDedicatedWorker: {
+ storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
+- this, storage_key, /*document_url=*/GURL(), weak_document_ptr,
++ this, rfh, storage_key, /*document_url=*/GURL(), weak_document_ptr,
+ creator_type, std::move(receiver));
+ break;
+ }
+@@ -2114,7 +2118,7 @@ void RenderProcessHostImpl::CreateNotifi
+ CHECK(rfh);
+
+ storage_partition_impl_->GetPlatformNotificationContext()->CreateService(
+- this, storage_key, rfh->GetLastCommittedURL(), weak_document_ptr,
++ this, rfh, storage_key, rfh->GetLastCommittedURL(), weak_document_ptr,
+ creator_type, std::move(receiver));
+ break;
+ }
+@@ -3261,7 +3265,7 @@ void RenderProcessHostImpl::AppendRender
+ base::TimeTicks::UnixEpoch().since_origin().InMicroseconds()));
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Append `kDisableVideoCaptureUseGpuMemoryBuffer` flag if there is no support
+ // for NV12 GPU memory buffer.
+ if (switches::IsVideoCaptureUseGpuMemoryBufferEnabled() &&
+@@ -3318,6 +3322,7 @@ void RenderProcessHostImpl::PropagateBro
+ switches::kDisableSpeechAPI,
+ switches::kDisableThreadedCompositing,
+ switches::kDisableTouchDragDrop,
++ switches::kDisableUnveil,
+ switches::kDisableV8IdleTasks,
+ switches::kDisableVideoCaptureUseGpuMemoryBuffer,
+ switches::kDisableWebGLImageChromium,
+@@ -5107,7 +5112,7 @@ uint64_t RenderProcessHostImpl::GetPriva
+ // - Win: https://crbug.com/707022 .
+ uint64_t total_size = 0;
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ total_size = dump->platform_private_footprint->rss_anon_bytes +
+ dump->platform_private_footprint->vm_swap_bytes;
+ #elif BUILDFLAG(IS_APPLE)
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.h b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.h
new file mode 100644
index 0000000000..02a1d99d5c
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_process_host_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_process_host_impl.h
+@@ -102,7 +102,7 @@
+ #include "media/fuchsia_media_codec_provider_impl.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/browser/child_thread_type_switcher_linux.h"
+ #include "media/mojo/mojom/video_encode_accelerator.mojom.h"
+ #endif
+@@ -973,7 +973,7 @@ class CONTENT_EXPORT RenderProcessHostIm
+ std::unique_ptr<service_manager::BinderRegistry> binders_;
+ mojo::Receiver<mojom::ChildProcessHost> receiver_{this};
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::Remote<media::mojom::VideoEncodeAcceleratorProviderFactory>
+ video_encode_accelerator_factory_remote_;
+ ChildThreadTypeSwitcher child_thread_type_switcher_;
+@@ -1219,7 +1219,7 @@ class CONTENT_EXPORT RenderProcessHostIm
+ // if the request isn't handled on the IO thread.
+ void OnBindHostReceiver(mojo::GenericPendingReceiver receiver);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Provides /proc/{renderer pid}/status and statm files for the renderer,
+ // because the files are required to calculate the renderer's private
+ // footprint on Chromium Linux. Regarding MacOS X and Windows, we have
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc
new file mode 100644
index 0000000000..8178b0a3b0
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_process_host_impl_receiver_bindings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_process_host_impl_receiver_bindings.cc
+@@ -52,7 +52,7 @@
+ #include "third_party/blink/public/mojom/webdatabase/web_database.mojom.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+ #include "content/browser/font_service.h" // nogncheck
+ #include "content/browser/media/video_encode_accelerator_provider_launcher.h"
+@@ -341,7 +341,7 @@ void RenderProcessHostImpl::IOThreadHost
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>()) {
+ ConnectToFontService(std::move(font_receiver));
+ return;
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.cc b/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.cc
new file mode 100644
index 0000000000..5faf9065c4
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_view_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_view_host_impl.cc
+@@ -274,7 +274,7 @@ void RenderViewHostImpl::GetPlatformSpec
+ display::win::ScreenWin::GetSystemMetricsInDIP(SM_CYVSCROLL);
+ prefs->arrow_bitmap_width_horizontal_scroll_bar_in_dips =
+ display::win::ScreenWin::GetSystemMetricsInDIP(SM_CXHSCROLL);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kSystemFontFamily)) {
+ prefs->system_font_family_name =
+@@ -754,6 +754,11 @@ void RenderViewHostImpl::SetBackgroundOp
+ GetWidget()->GetAssociatedFrameWidget()->SetBackgroundOpaque(opaque);
+ }
+
++void RenderViewHostImpl::SetSchedulerThrottling(bool allowed) {
++ if (auto& broadcast = GetAssociatedPageBroadcast())
++ broadcast->SetSchedulerThrottling(allowed);
++}
++
+ bool RenderViewHostImpl::IsMainFrameActive() {
+ return is_active();
+ }
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.h b/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.h
new file mode 100644
index 0000000000..0e8efb0215
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__view__host__impl.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_view_host_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_view_host_impl.h
+@@ -135,6 +135,7 @@ class CONTENT_EXPORT RenderViewHostImpl
+ void EnablePreferredSizeMode() override;
+ void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
+
++ void SetSchedulerThrottling(bool allowed) override;
+ void SendWebPreferencesToRenderer();
+ void SendRendererPreferencesToRenderer(
+ const blink::RendererPreferences& preferences);
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h
new file mode 100644
index 0000000000..2aca54b66f
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_delegate.h
+@@ -27,6 +27,7 @@
+ #include "ui/base/mojom/window_show_state.mojom-forward.h"
+ #include "ui/base/ui_base_types.h"
+ #include "ui/gfx/mojom/delegated_ink_point_renderer.mojom.h"
++#include "ui/base/cursor/cursor.h"
+ #include "ui/gfx/native_widget_types.h"
+
+ namespace blink {
+@@ -293,6 +294,9 @@ class CONTENT_EXPORT RenderWidgetHostDel
+ // Returns the associated RenderViewHostDelegateView*, if possible.
+ virtual RenderViewHostDelegateView* GetDelegateView();
+
++ // Notify the delegate of the RenderWidget's changing cursor.
++ virtual void OnCursorChanged(const ui::Cursor& cursor) {}
++
+ // Returns true if the provided RenderWidgetHostImpl matches the current
+ // RenderWidgetHost on the primary main frame, and false otherwise.
+ virtual bool IsWidgetForPrimaryMainFrame(RenderWidgetHostImpl*);
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc
new file mode 100644
index 0000000000..418ca5ecc0
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_impl.cc
+@@ -789,6 +789,10 @@ void RenderWidgetHostImpl::WasHidden() {
+ return;
+ }
+
++ if (disable_hidden_) {
++ return;
++ }
++
+ // Cancel pending pointer lock requests, unless there's an open user prompt.
+ // Prompts should remain open and functional across tab switches.
+ if (!delegate_->IsWaitingForPointerLockPrompt(this)) {
+@@ -1978,6 +1982,9 @@ void RenderWidgetHostImpl::SetCursor(con
+ if (view_) {
+ view_->UpdateCursor(cursor);
+ }
++ if (delegate_) {
++ delegate_->OnCursorChanged(cursor);
++ }
+ }
+
+ void RenderWidgetHostImpl::ShowContextMenuAtPoint(
+@@ -2041,9 +2048,8 @@ RenderWidgetHostImpl::GetWidgetInputHand
+ void RenderWidgetHostImpl::NotifyScreenInfoChanged() {
+ // The resize message (which may not happen immediately) will carry with it
+ // the screen info as well as the new size (if the screen has changed scale
+- // factor). Force sending the new visual properties even if there is one in
+- // flight to ensure proper IPC ordering for features like the Fullscreen API.
+- SynchronizeVisualPropertiesIgnoringPendingAck();
++ // factor).
++ SynchronizeVisualProperties();
+
+ // The device scale factor will be same for all the views contained by the
+ // primary main frame, so just set it once.
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.h b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.h
new file mode 100644
index 0000000000..b867d06414
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__impl.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_impl.h
+@@ -1023,6 +1023,9 @@ class CONTENT_EXPORT RenderWidgetHostImp
+ // Requests a commit and forced redraw in the renderer compositor.
+ void ForceRedrawForTesting();
+
++ // Electron: Prevents the widget from getting hidden.
++ bool disable_hidden_ = false;
++
+ protected:
+ // |routing_id| must not be MSG_ROUTING_NONE.
+ // If this object outlives |delegate|, DetachDelegate() must be called when
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
new file mode 100644
index 0000000000..f5587ff798
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
@@ -0,0 +1,86 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_aura.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_aura.cc
+@@ -122,7 +122,7 @@
+ #include "ui/gfx/gdi_util.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/accessibility/platform/browser_accessibility_auralinux.h"
+ #include "ui/base/ime/linux/text_edit_command_auralinux.h"
+ #include "ui/base/ime/text_input_flags.h"
+@@ -485,7 +485,7 @@ gfx::NativeViewAccessible RenderWidgetHo
+ return ToBrowserAccessibilityWin(manager->GetBrowserAccessibilityRoot())
+ ->GetCOM();
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::BrowserAccessibilityManager* manager =
+ host()->GetOrCreateRootBrowserAccessibilityManager();
+ if (manager && manager->GetBrowserAccessibilityRoot())
+@@ -586,8 +586,8 @@ void RenderWidgetHostViewAura::ShowImpl(
+ // OnShowWithPageVisibility will not call NotifyHostAndDelegateOnWasShown,
+ // which updates `visibility_`, unless the host is hidden. Make sure no update
+ // is needed.
+- CHECK(host_->is_hidden() || visibility_ == Visibility::VISIBLE);
+- OnShowWithPageVisibility(page_visibility);
++ if (host_->is_hidden() || visibility_ == Visibility::VISIBLE)
++ OnShowWithPageVisibility(page_visibility);
+ }
+
+ void RenderWidgetHostViewAura::EnsurePlatformVisibility(
+@@ -650,7 +650,7 @@ void RenderWidgetHostViewAura::HideImpl(
+ CHECK(visibility_ == Visibility::HIDDEN ||
+ visibility_ == Visibility::OCCLUDED);
+
+- if (!host()->is_hidden()) {
++ if (!host()->is_hidden() && !host()->disable_hidden_) {
+ host()->WasHidden();
+ aura::WindowTreeHost* host = window_->GetHost();
+ aura::Window* parent = window_->parent();
+@@ -1773,7 +1773,7 @@ bool RenderWidgetHostViewAura::ShouldDoL
+ return host() && host()->delegate() && host()->delegate()->ShouldDoLearning();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool RenderWidgetHostViewAura::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
+@@ -2736,7 +2736,7 @@ bool RenderWidgetHostViewAura::NeedsInpu
+ }
+
+ bool RenderWidgetHostViewAura::NeedsMouseCapture() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return NeedsInputGrab();
+ #else
+ return false;
+@@ -2920,7 +2920,7 @@ void RenderWidgetHostViewAura::ForwardKe
+ if (!target_host)
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* linux_ui = ui::LinuxUi::instance();
+ std::vector<ui::TextEditCommandAuraLinux> commands;
+ if (!event.skip_if_unhandled && linux_ui && event.os_event &&
+@@ -3118,6 +3118,12 @@ void RenderWidgetHostViewAura::OnTextSel
+ }
+ }
+
++void RenderWidgetHostViewAura::OnFocusedInputElementChanged(
++ TextInputManager* text_input_manager,
++ RenderWidgetHostViewBase* view) {
++ FocusedNodeChanged(false, {});
++}
++
+ void RenderWidgetHostViewAura::SetPopupChild(
+ RenderWidgetHostViewAura* popup_child_host_view) {
+ popup_child_host_view_ = popup_child_host_view;
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h
new file mode 100644
index 0000000000..a01cdff27f
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_aura.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_aura.h
+@@ -275,7 +275,7 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ ukm::SourceId GetClientSourceForMetrics() const override;
+ bool ShouldDoLearning() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
+@@ -650,6 +650,8 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ RenderWidgetHostViewBase* updated_view) override;
+ void OnTextSelectionChanged(TextInputManager* text_input_mangager,
+ RenderWidgetHostViewBase* updated_view) override;
++ void OnFocusedInputElementChanged(TextInputManager* text_input_manager,
++ RenderWidgetHostViewBase* view) override;
+
+ // Detaches |this| from the input method object.
+ // is_removed flag is true if this is called while the window is
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc
new file mode 100644
index 0000000000..138234390d
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_base.cc
+@@ -634,6 +634,13 @@ void RenderWidgetHostViewBase::OnFrameTo
+ host()->DidProcessFrame(frame_token, activation_time);
+ }
+
++RenderWidgetHostViewBase* RenderWidgetHostViewBase::CreateViewForWidget(
++ RenderWidgetHost* render_widget_host,
++ RenderWidgetHost* embedder_render_widget_host,
++ WebContentsView* web_contents_view) {
++ return web_contents_view->CreateViewForWidget(render_widget_host);
++}
++
+ void RenderWidgetHostViewBase::ProcessMouseEvent(
+ const blink::WebMouseEvent& event,
+ const ui::LatencyInfo& latency) {
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h
new file mode 100644
index 0000000000..830246dfe5
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_base.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_base.h
+@@ -29,8 +29,11 @@
+ #include "components/viz/common/surfaces/scoped_surface_id_allocator.h"
+ #include "components/viz/common/surfaces/surface_id.h"
+ #include "content/browser/renderer_host/display_feature.h"
++#include "content/browser/renderer_host/visible_time_request_trigger.h"
++#include "content/browser/web_contents/web_contents_view.h"
+ #include "content/common/content_export.h"
+ #include "content/public/browser/render_frame_metadata_provider.h"
++#include "content/public/browser/render_widget_host.h"
+ #include "content/public/browser/render_widget_host_view.h"
+ #include "content/public/common/page_visibility_state.h"
+ #include "content/public/common/widget_type.h"
+@@ -70,9 +73,11 @@ namespace content {
+ class DevicePosturePlatformProvider;
+ class MouseWheelPhaseHandler;
+ class RenderWidgetHostImpl;
++class RenderWidgetHostViewGuest;
+ class ScopedViewTransitionResources;
+ class TextInputManager;
+ class TouchSelectionControllerClientManager;
++class WebContentsView;
+ class WebContentsAccessibility;
+ class DelegatedFrameHost;
+ class SyntheticGestureTarget;
+@@ -144,6 +149,10 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ void ProcessGestureEvent(const blink::WebGestureEvent& event,
+ const ui::LatencyInfo& latency) override;
+ RenderWidgetHostViewBase* GetRootView() override;
++ virtual RenderWidgetHostViewBase* CreateViewForWidget(
++ RenderWidgetHost* render_widget_host,
++ RenderWidgetHost* embedder_render_widget_host,
++ WebContentsView* web_contents_view);
+ void OnAutoscrollStart() override;
+ const viz::DisplayHitTestQueryMap& GetDisplayHitTestQuery() const override;
+
+@@ -181,6 +190,9 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ const gfx::Rect& keyboard_rect) override {}
+ bool IsHTMLFormPopup() const override;
+
++ virtual void InitAsGuest(RenderWidgetHostView* parent_host_view,
++ RenderWidgetHostViewGuest* guest_view) {}
++
+ // This only needs to be overridden by RenderWidgetHostViewBase subclasses
+ // that handle content embedded within other RenderWidgetHostViews.
+ gfx::PointF TransformPointToRootCoordSpaceF(
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
new file mode 100644
index 0000000000..f48fbebca9
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_event_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_event_handler.cc
+@@ -602,7 +602,7 @@ bool RenderWidgetHostViewEventHandler::C
+ if (event->type() == ui::EventType::kMouseExited) {
+ if (mouse_locked || selection_popup)
+ return false;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Don't forward the mouse leave message which is received when the context
+ // menu is displayed by the page. This confuses the page and causes state
+ // changes.
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h
new file mode 100644
index 0000000000..521c42c1f7
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_mac.h
+@@ -23,6 +23,7 @@
+ #include "content/browser/renderer_host/text_input_manager.h"
+ #include "content/common/content_export.h"
+ #include "content/common/render_widget_host_ns_view.mojom.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/associated_receiver.h"
+ #include "mojo/public/cpp/bindings/associated_remote.h"
+ #include "third_party/blink/public/mojom/webshare/webshare.mojom.h"
+@@ -53,7 +54,9 @@ class CursorManager;
+
+ @protocol RenderWidgetHostViewMacDelegate;
+
++#if !IS_MAS_BUILD()
+ @class NSAccessibilityRemoteUIElement;
++#endif
+ @class RenderWidgetHostViewCocoa;
+
+ namespace content {
+@@ -684,9 +687,11 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ // EnsureSurfaceSynchronizedForWebTest().
+ uint32_t latest_capture_sequence_number_ = 0u;
+
++#if !IS_MAS_BUILD()
+ // Remote accessibility objects corresponding to the NSWindow that this is
+ // displayed to the user in.
+ NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
++#endif
+
+ // Used to force the NSApplication's focused accessibility element to be the
+ // content::BrowserAccessibilityCocoa accessibility tree when the NSView for
diff --git a/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
new file mode 100644
index 0000000000..ce359d67ea
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
@@ -0,0 +1,90 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/render_widget_host_view_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/render_widget_host_view_mac.mm
+@@ -48,6 +48,7 @@
+ #include "content/public/browser/render_widget_host.h"
+ #include "content/public/browser/web_contents.h"
+ #include "content/public/common/page_visibility_state.h"
++#include "electron/mas.h"
+ #include "media/base/media_switches.h"
+ #include "skia/ext/platform_canvas.h"
+ #include "skia/ext/skia_utils_mac.h"
+@@ -273,8 +274,10 @@ RenderWidgetHostViewMac::~RenderWidgetHo
+ void RenderWidgetHostViewMac::MigrateNSViewBridge(
+ remote_cocoa::mojom::Application* remote_cocoa_application,
+ uint64_t parent_ns_view_id) {
++#if !IS_MAS_BUILD()
+ // Destroy the previous remote accessibility element.
+ remote_window_accessible_ = nil;
++#endif
+
+ // Reset `ns_view_` before resetting `remote_ns_view_` to avoid dangling
+ // pointers. `ns_view_` gets reinitialized later in this method.
+@@ -556,7 +559,11 @@ void RenderWidgetHostViewMac::WasOcclude
+ return;
+
+ host()->WasHidden();
+- browser_compositor_->SetRenderWidgetHostIsHidden(true);
++ // Consider the RWHV occluded only if it is not attached to a window
++ // (e.g. unattached BrowserView). Otherwise we treat it as visible to
++ // prevent unnecessary compositor recycling.
++ const bool unattached = ![GetInProcessNSView() window];
++ browser_compositor_->SetRenderWidgetHostIsHidden(unattached);
+ }
+
+ void RenderWidgetHostViewMac::SetSize(const gfx::Size& size) {
+@@ -1636,8 +1643,10 @@ RenderWidgetHostViewMac::AccessibilityGe
+
+ gfx::NativeViewAccessible
+ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
++#if !IS_MAS_BUILD()
+ if (remote_window_accessible_)
+ return remote_window_accessible_;
++#endif
+ return [GetInProcessNSView() window];
+ }
+
+@@ -1686,9 +1695,11 @@ id RenderWidgetHostViewMac::GetFocusedBr
+ }
+
+ void RenderWidgetHostViewMac::SetAccessibilityWindow(NSWindow* window) {
++#if !IS_MAS_BUILD()
+ // When running in-process, just use the NSView's NSWindow as its own
+ // accessibility element.
+ remote_window_accessible_ = nil;
++#endif
+ }
+
+ bool RenderWidgetHostViewMac::SyncIsWidgetForMainFrame(
+@@ -2212,20 +2223,26 @@ void RenderWidgetHostViewMac::StopSpeaki
+ void RenderWidgetHostViewMac::GetRenderWidgetAccessibilityToken(
+ GetRenderWidgetAccessibilityTokenCallback callback) {
+ base::ProcessId pid = getpid();
++#if !IS_MAS_BUILD()
+ id element_id = GetNativeViewAccessible();
+ std::vector<uint8_t> token =
+ ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
+ std::move(callback).Run(pid, token);
++#else
++ std::move(callback).Run(pid, std::vector<uint8_t>());
++#endif
+ }
+
+ void RenderWidgetHostViewMac::SetRemoteAccessibilityWindowToken(
+ const std::vector<uint8_t>& window_token) {
++#if !IS_MAS_BUILD()
+ if (window_token.empty()) {
+ remote_window_accessible_ = nil;
+ } else {
+ remote_window_accessible_ =
+ ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
+ }
++#endif
+ }
+
+ ///////////////////////////////////////////////////////////////////////////////
diff --git a/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc b/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc
new file mode 100644
index 0000000000..4d6d2f7c0b
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.cc
+@@ -35,6 +35,9 @@ namespace content {
+
+ #if BUILDFLAG(USE_ZYGOTE)
+ ZygoteCommunication* RendererSandboxedProcessLauncherDelegate::GetZygote() {
++ if (!use_zygote_) {
++ return nullptr;
++ }
+ const base::CommandLine& browser_command_line =
+ *base::CommandLine::ForCurrentProcess();
+ base::CommandLine::StringType renderer_prefix =
+@@ -70,6 +73,9 @@ RendererSandboxedProcessLauncherDelegate
+ is_pdf_renderer_(is_pdf_renderer) {
+ // PDF renderers must be jitless.
+ CHECK(!is_pdf_renderer || is_jit_disabled);
++#if BUILDFLAG(USE_ZYGOTE)
++ use_zygote_ = !cmd_line->HasSwitch(switches::kNoZygote);
++#endif
+ if (is_jit_disabled) {
+ dynamic_code_can_be_disabled_ = true;
+ return;
diff --git a/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h b/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h
new file mode 100644
index 0000000000..41f59d20fe
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/renderer_sandboxed_process_launcher_delegate.h
+@@ -18,6 +18,11 @@ class CONTENT_EXPORT RendererSandboxedPr
+ public:
+ RendererSandboxedProcessLauncherDelegate() = default;
+
++#if BUILDFLAG(USE_ZYGOTE)
++ RendererSandboxedProcessLauncherDelegate(bool use_zygote):
++ use_zygote_(use_zygote) {}
++#endif
++
+ ~RendererSandboxedProcessLauncherDelegate() override = default;
+
+ #if BUILDFLAG(USE_ZYGOTE)
+@@ -30,6 +35,11 @@ class CONTENT_EXPORT RendererSandboxedPr
+
+ // sandbox::policy::SandboxDelegate:
+ sandbox::mojom::Sandbox GetSandboxType() override;
++
++ private:
++#if BUILDFLAG(USE_ZYGOTE)
++ bool use_zygote_ = true;
++#endif
+ };
+
+ #if BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-content_browser_renderer__host_text__input__manager.cc b/electron34/patches/patch-content_browser_renderer__host_text__input__manager.cc
new file mode 100644
index 0000000000..4eee8a4295
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_text__input__manager.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/text_input_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/text_input_manager.cc
+@@ -183,6 +183,7 @@ void TextInputManager::UpdateTextInputSt
+
+ if (text_input_state.type == ui::TEXT_INPUT_TYPE_NONE &&
+ active_view_ != view) {
++ NotifyFocusedInputElementChanged(active_view_);
+ // We reached here because an IPC is received to reset the TextInputState
+ // for |view|. But |view| != |active_view_|, which suggests that at least
+ // one other view has become active and we have received the corresponding
+@@ -485,6 +486,12 @@ void TextInputManager::NotifyObserversAb
+ observer.OnUpdateTextInputStateCalled(this, updated_view, did_update_state);
+ }
+
++void TextInputManager::NotifyFocusedInputElementChanged(
++ RenderWidgetHostViewBase* view) {
++ for (auto& observer : observer_list_)
++ observer.OnFocusedInputElementChanged(this, view);
++}
++
+ TextInputManager::SelectionRegion::SelectionRegion() = default;
+
+ TextInputManager::SelectionRegion::SelectionRegion(
diff --git a/electron34/patches/patch-content_browser_renderer__host_text__input__manager.h b/electron34/patches/patch-content_browser_renderer__host_text__input__manager.h
new file mode 100644
index 0000000000..22d4af3652
--- /dev/null
+++ b/electron34/patches/patch-content_browser_renderer__host_text__input__manager.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/renderer_host/text_input_manager.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/renderer_host/text_input_manager.h
+@@ -72,6 +72,10 @@ class CONTENT_EXPORT TextInputManager {
+ virtual void OnTextSelectionChanged(
+ TextInputManager* text_input_manager,
+ RenderWidgetHostViewBase* updated_view) {}
++ // Called when focused input element has changed
++ virtual void OnFocusedInputElementChanged(
++ TextInputManager* text_input_manager,
++ RenderWidgetHostViewBase* updated_view) {}
+ };
+
+ // Text selection bounds.
+@@ -308,6 +312,7 @@ class CONTENT_EXPORT TextInputManager {
+
+ void NotifyObserversAboutInputStateUpdate(RenderWidgetHostViewBase* view,
+ bool did_update_state);
++ void NotifyFocusedInputElementChanged(RenderWidgetHostViewBase* view);
+
+ // The view with active text input state, i.e., a focused <input> element.
+ // It will be nullptr if no such view exists. Note that the active view
diff --git a/electron34/patches/patch-content_browser_sandbox__host__linux.cc b/electron34/patches/patch-content_browser_sandbox__host__linux.cc
new file mode 100644
index 0000000000..cd2b2b1eb3
--- /dev/null
+++ b/electron34/patches/patch-content_browser_sandbox__host__linux.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/sandbox_host_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/sandbox_host_linux.cc
+@@ -45,6 +45,7 @@ void SandboxHostLinux::Init() {
+ // Instead, it replies on a temporary socket provided by the caller.
+ PCHECK(0 == shutdown(browser_socket, SHUT_WR)) << "shutdown";
+
++#if !BUILDFLAG(IS_BSD)
+ int pipefds[2];
+ CHECK(0 == pipe(pipefds));
+ const int child_lifeline_fd = pipefds[0];
+@@ -55,6 +56,7 @@ void SandboxHostLinux::Init() {
+ ipc_thread_ = std::make_unique<base::DelegateSimpleThread>(
+ ipc_handler_.get(), "sandbox_ipc_thread");
+ ipc_thread_->Start();
++#endif
+ }
+
+ } // namespace content
diff --git a/electron34/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc b/electron34/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
new file mode 100644
index 0000000000..71877d95b0
--- /dev/null
+++ b/electron34/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/scheduler/responsiveness/jank_monitor_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/scheduler/responsiveness/jank_monitor_impl.cc
+@@ -340,7 +340,7 @@ void JankMonitorImpl::ThreadExecutionSta
+ // in context menus, among others). Simply ignore the mismatches for now.
+ // See https://crbug.com/929813 for the details of why the mismatch
+ // happens.
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(IS_OZONE)
+ task_execution_metadata_.clear();
+ #endif
diff --git a/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc b/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
new file mode 100644
index 0000000000..b4402d4630
--- /dev/null
+++ b/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/scheduler/responsiveness/native_event_observer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/scheduler/responsiveness/native_event_observer.cc
+@@ -15,7 +15,7 @@
+
+ #include "ui/events/platform/platform_event_source.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/env.h"
+ #include "ui/events/event.h"
+ #endif
+@@ -39,7 +39,7 @@ NativeEventObserver::~NativeEventObserve
+ DeregisterObserver();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void NativeEventObserver::RegisterObserver() {
+ aura::Env::GetInstance()->AddWindowEventDispatcherObserver(this);
+ }
diff --git a/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h b/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h
new file mode 100644
index 0000000000..f6486b29d2
--- /dev/null
+++ b/electron34/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/scheduler/responsiveness/native_event_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/scheduler/responsiveness/native_event_observer.h
+@@ -16,7 +16,7 @@
+ #include "content/public/browser/native_event_processor_observer_mac.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/window_event_dispatcher_observer.h"
+ #endif
+
+@@ -41,7 +41,7 @@ namespace responsiveness {
+ class CONTENT_EXPORT NativeEventObserver
+ #if BUILDFLAG(IS_MAC)
+ : public NativeEventProcessorObserver
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ : public aura::WindowEventDispatcherObserver
+ #elif BUILDFLAG(IS_WIN)
+ : public base::MessagePumpForUI::Observer
+@@ -58,7 +58,7 @@ class CONTENT_EXPORT NativeEventObserver
+ NativeEventObserver(WillRunEventCallback will_run_event_callback,
+ DidRunEventCallback did_run_event_callback);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ NativeEventObserver(const NativeEventObserver&) = delete;
+ NativeEventObserver& operator=(const NativeEventObserver&) = delete;
+@@ -74,7 +74,7 @@ class CONTENT_EXPORT NativeEventObserver
+ // Exposed for tests.
+ void WillRunNativeEvent(const void* opaque_identifier) override;
+ void DidRunNativeEvent(const void* opaque_identifier) override;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // aura::WindowEventDispatcherObserver overrides:
+ void OnWindowEventDispatcherStartedProcessing(
+ aura::WindowEventDispatcher* dispatcher,
+@@ -91,7 +91,7 @@ class CONTENT_EXPORT NativeEventObserver
+ void RegisterObserver();
+ void DeregisterObserver();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct EventInfo {
+ raw_ptr<const void> unique_id;
+ };
diff --git a/electron34/patches/patch-content_browser_service__process__host__impl.cc b/electron34/patches/patch-content_browser_service__process__host__impl.cc
new file mode 100644
index 0000000000..b9e0757141
--- /dev/null
+++ b/electron34/patches/patch-content_browser_service__process__host__impl.cc
@@ -0,0 +1,63 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/service_process_host_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/service_process_host_impl.cc
+@@ -73,12 +73,15 @@ class ServiceProcessTracker {
+ processes_.erase(iter);
+ }
+
+- void NotifyCrashed(ServiceProcessId id) {
++ void NotifyCrashed(ServiceProcessId id, int exit_code) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ auto iter = processes_.find(id);
+ CHECK(iter != processes_.end(), base::NotFatalUntil::M130);
+- for (auto& observer : observers_)
+- observer.OnServiceProcessCrashed(iter->second.Duplicate());
++ for (auto& observer : observers_) {
++ auto params = iter->second.Duplicate();
++ params.set_exit_code(exit_code);
++ observer.OnServiceProcessCrashed(params);
++ }
+ processes_.erase(iter);
+ }
+
+@@ -154,7 +157,7 @@ class UtilityProcessClient : public Util
+ process_info_->service_process_id());
+ }
+
+- void OnProcessCrashed() override {
++ void OnProcessCrashed(int exit_code) override {
+ // TODO(crbug.com/40654042): It is unclear how we can observe
+ // |OnProcessCrashed()| without observing |OnProcessLaunched()| first, but
+ // it can happen on Android. Ignore the notification in this case.
+@@ -162,7 +165,7 @@ class UtilityProcessClient : public Util
+ return;
+
+ GetServiceProcessTracker().NotifyCrashed(
+- process_info_->service_process_id());
++ process_info_->service_process_id(), exit_code);
+ }
+
+ private:
+@@ -205,6 +208,17 @@ void LaunchServiceProcess(mojo::GenericP
+ options.allow_gpu_client.value()) {
+ host->SetAllowGpuClient();
+ }
++
++#if BUILDFLAG(IS_WIN)
++ host->SetStdioHandles(std::move(options.stdout_handle), std::move(options.stderr_handle));
++ host->SetFeedbackCursorOff(options.feedback_cursor_off);
++#elif BUILDFLAG(IS_POSIX)
++ host->SetAdditionalFds(std::move(options.fds_to_remap));
++#endif
++ host->SetCurrentDirectory(options.current_directory);
++ host->SetEnv(options.environment);
++ if (options.clear_environment)
++ host->ClearEnvironment();
+ host->Start();
+ host->GetChildProcess()->BindServiceInterface(std::move(receiver));
+ }
diff --git a/electron34/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc b/electron34/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc
new file mode 100644
index 0000000000..cbe3452530
--- /dev/null
+++ b/electron34/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/service_worker/service_worker_context_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/service_worker/service_worker_context_wrapper.cc
+@@ -1959,6 +1959,26 @@ ServiceWorkerContextWrapper::GetLoaderFa
+ loader_factory_bundle_info =
+ context()->loader_factory_bundle_for_update_check()->Clone();
+
++ // Give the embedder a chance to register custom schemes that can
++ // handle loading the service worker main script.
++ // Previous registration triggered by
++ // ServiceWorkerContextWrapper::CreateNonNetworkPendingURLLoaderFactoryBundleForUpdateCheck
++ // happens early on browser startup before the JS in the main process
++ // is run by the embedder.
++ auto& pending_scheme_specific_factories =
++ static_cast<blink::PendingURLLoaderFactoryBundle*>(
++ loader_factory_bundle_info.get())
++ ->pending_scheme_specific_factories();
++ ContentBrowserClient::NonNetworkURLLoaderFactoryMap non_network_factories;
++ GetContentClient()
++ ->browser()
++ ->RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
++ storage_partition_->browser_context(), &non_network_factories);
++ for (auto& [scheme, factory_remote] : non_network_factories) {
++ pending_scheme_specific_factories.emplace(
++ scheme, std::move(factory_remote));
++ }
++
+ if (auto* config = content::WebUIConfigMap::GetInstance().GetConfig(
+ browser_context(), scope)) {
+ // If this is a Service Worker for a WebUI, the WebUI's URLDataSource
+@@ -1978,9 +1998,7 @@ ServiceWorkerContextWrapper::GetLoaderFa
+ features::kEnableServiceWorkersForChromeScheme) &&
+ scope.scheme_piece() == kChromeUIScheme) {
+ config->RegisterURLDataSource(browser_context());
+- static_cast<blink::PendingURLLoaderFactoryBundle*>(
+- loader_factory_bundle_info.get())
+- ->pending_scheme_specific_factories()
++ pending_scheme_specific_factories
+ .emplace(kChromeUIScheme, CreateWebUIServiceWorkerLoaderFactory(
+ browser_context(), kChromeUIScheme,
+ base::flat_set<std::string>()));
+@@ -1988,9 +2006,7 @@ ServiceWorkerContextWrapper::GetLoaderFa
+ features::kEnableServiceWorkersForChromeUntrusted) &&
+ scope.scheme_piece() == kChromeUIUntrustedScheme) {
+ config->RegisterURLDataSource(browser_context());
+- static_cast<blink::PendingURLLoaderFactoryBundle*>(
+- loader_factory_bundle_info.get())
+- ->pending_scheme_specific_factories()
++ pending_scheme_specific_factories
+ .emplace(kChromeUIUntrustedScheme,
+ CreateWebUIServiceWorkerLoaderFactory(
+ browser_context(), kChromeUIUntrustedScheme,
diff --git a/electron34/patches/patch-content_browser_service__worker_service__worker__registry.cc b/electron34/patches/patch-content_browser_service__worker_service__worker__registry.cc
new file mode 100644
index 0000000000..8f516546bb
--- /dev/null
+++ b/electron34/patches/patch-content_browser_service__worker_service__worker__registry.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/service_worker/service_worker_registry.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/service_worker/service_worker_registry.cc
+@@ -1076,7 +1076,8 @@ ServiceWorkerRegistry::GetOrCreateRegist
+ if (data.policy_container_policies) {
+ version->set_policy_container_host(
+ base::MakeRefCounted<PolicyContainerHost>(
+- PolicyContainerPolicies(*data.policy_container_policies)));
++ PolicyContainerPolicies(*data.policy_container_policies,
++ /*is_web_secure_context=*/true)));
+ }
+ if (data.router_rules && version->IsStaticRouterEnabled()) {
+ auto error = version->SetupRouterEvaluator(*data.router_rules);
diff --git a/electron34/patches/patch-content_browser_site__instance__impl.cc b/electron34/patches/patch-content_browser_site__instance__impl.cc
new file mode 100644
index 0000000000..07354a7624
--- /dev/null
+++ b/electron34/patches/patch-content_browser_site__instance__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/site_instance_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/site_instance_impl.cc
+@@ -210,7 +210,7 @@ scoped_refptr<SiteInstanceImpl> SiteInst
+ BrowserContext* browser_context,
+ const StoragePartitionConfig& partition_config) {
+ DCHECK(browser_context);
+- DCHECK(!partition_config.is_default());
++ // DCHECK(!partition_config.is_default());
+
+ auto guest_site_info =
+ SiteInfo::CreateForGuest(browser_context, partition_config);
diff --git a/electron34/patches/patch-content_browser_utility__process__host.cc b/electron34/patches/patch-content_browser_utility__process__host.cc
new file mode 100644
index 0000000000..1edd030364
--- /dev/null
+++ b/electron34/patches/patch-content_browser_utility__process__host.cc
@@ -0,0 +1,137 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/utility_process_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/utility_process_host.cc
+@@ -62,7 +62,7 @@
+ #include "content/browser/v8_snapshot_files.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_util.h"
+ #include "base/files/scoped_file.h"
+ #include "base/pickle.h"
+@@ -86,7 +86,7 @@ namespace content {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::ScopedFD PassNetworkContextParentDirs(
+ std::vector<base::FilePath> network_context_parent_dirs) {
+ base::Pickle pickle;
+@@ -179,11 +179,13 @@ const ChildProcessData& UtilityProcessHo
+ return process_->GetData();
+ }
+
+-#if BUILDFLAG(IS_POSIX)
+ void UtilityProcessHost::SetEnv(const base::EnvironmentMap& env) {
+ env_ = env;
+ }
+-#endif
++
++void UtilityProcessHost::ClearEnvironment() {
++ inherit_environment_ = false;
++}
+
+ bool UtilityProcessHost::Start() {
+ return StartProcess();
+@@ -230,6 +232,30 @@ void UtilityProcessHost::SetZygoteForTes
+ }
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
++#if BUILDFLAG(IS_WIN)
++void UtilityProcessHost::SetStdioHandles(
++ base::win::ScopedHandle stdout_handle,
++ base::win::ScopedHandle stderr_handle) {
++ stdout_handle_ = std::move(stdout_handle);
++ stderr_handle_ = std::move(stderr_handle);
++}
++#elif BUILDFLAG(IS_POSIX)
++void UtilityProcessHost::SetAdditionalFds(base::FileHandleMappingVector mapping) {
++ fds_to_remap_ = std::move(mapping);
++}
++#endif
++
++void UtilityProcessHost::SetCurrentDirectory(
++ const base::FilePath& cwd) {
++ current_directory_ = cwd;
++}
++
++#if BUILDFLAG(IS_WIN)
++void UtilityProcessHost::SetFeedbackCursorOff(bool feedback_cursor_off) {
++ feedback_cursor_off_ = feedback_cursor_off;
++}
++#endif // BUILDFLAG(IS_WIN)
++
+ mojom::ChildProcess* UtilityProcessHost::GetChildProcess() {
+ return static_cast<ChildProcessHostImpl*>(process_->GetHost())
+ ->child_process();
+@@ -347,7 +373,7 @@ bool UtilityProcessHost::StartProcess()
+ switches::kMuteAudio,
+ switches::kUseFileForFakeAudioCapture,
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+- BUILDFLAG(IS_SOLARIS)
++ BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_NETBSD)
+ switches::kAlsaInputDevice,
+ switches::kAlsaOutputDevice,
+ #endif
+@@ -403,7 +429,7 @@ bool UtilityProcessHost::StartProcess()
+ file_data_->files_to_preload.merge(GetV8SnapshotFilesToPreload(*cmd_line));
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The network service should have access to the parent directories
+ // necessary for its usage.
+ if (sandbox_type_ == sandbox::mojom::Sandbox::kNetwork) {
+@@ -420,7 +446,7 @@ bool UtilityProcessHost::StartProcess()
+ if (metrics_name_ == video_capture::mojom::VideoCaptureService::Name_) {
+ bool pass_gpu_buffer_flag =
+ switches::IsVideoCaptureUseGpuMemoryBufferEnabled();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Check if NV12 GPU memory buffer supported at the same time.
+ pass_gpu_buffer_flag =
+ pass_gpu_buffer_flag &&
+@@ -432,9 +458,26 @@ bool UtilityProcessHost::StartProcess()
+ }
+ #endif // BUILDFLAG(ENABLE_GPU_CHANNEL_MEDIA_CAPTURE) && !BUILDFLAG(IS_WIN)
+
++#if BUILDFLAG(IS_WIN)
++ file_data_->stdout_handle = std::move(stdout_handle_);
++ file_data_->stderr_handle = std::move(stderr_handle_);
++#elif BUILDFLAG(IS_POSIX)
++ if (!fds_to_remap_.empty()) {
++ for (const auto& remapped_fd : fds_to_remap_) {
++ file_data_->additional_remapped_fds.emplace(
++ remapped_fd.second, remapped_fd.first);
++ }
++ }
++#endif
++
+ std::unique_ptr<UtilitySandboxedProcessLauncherDelegate> delegate =
+ std::make_unique<UtilitySandboxedProcessLauncherDelegate>(
+- sandbox_type_, env_, *cmd_line);
++ sandbox_type_, env_, current_directory_, *cmd_line,
++ inherit_environment_);
++
++#if BUILDFLAG(IS_WIN)
++ delegate->SetFeedbackCursorOff(feedback_cursor_off_);
++#endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_WIN)
+ if (!preload_libraries_.empty()) {
+@@ -472,7 +515,7 @@ void UtilityProcessHost::OnProcessCrashe
+ // Take ownership of |client_| so the destructor doesn't notify it of
+ // termination.
+ auto client = std::move(client_);
+- client->OnProcessCrashed();
++ client->OnProcessCrashed(exit_code);
+ }
+
+ std::optional<std::string> UtilityProcessHost::GetServiceName() {
diff --git a/electron34/patches/patch-content_browser_utility__process__host.h b/electron34/patches/patch-content_browser_utility__process__host.h
new file mode 100644
index 0000000000..be60e056e6
--- /dev/null
+++ b/electron34/patches/patch-content_browser_utility__process__host.h
@@ -0,0 +1,94 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/utility_process_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/utility_process_host.h
+@@ -30,6 +30,10 @@
+ #include "content/public/common/zygote/zygote_handle.h"
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
++#if BUILDFLAG(IS_WIN)
++#include "base/win/scoped_handle.h"
++#endif
++
+ namespace base {
+ class Thread;
+ } // namespace base
+@@ -75,7 +79,7 @@ class CONTENT_EXPORT UtilityProcessHost
+
+ virtual void OnProcessLaunched(const base::Process& process) {}
+ virtual void OnProcessTerminatedNormally() {}
+- virtual void OnProcessCrashed() {}
++ virtual void OnProcessCrashed(int exit_code) {}
+ };
+
+ // This class is self-owned. It must be instantiated using new, and shouldn't
+@@ -99,9 +103,13 @@ class CONTENT_EXPORT UtilityProcessHost
+
+ // Returns information about the utility child process.
+ const ChildProcessData& GetData();
+-#if BUILDFLAG(IS_POSIX)
++
++ // Set/Unset environment variables.
+ void SetEnv(const base::EnvironmentMap& env);
+-#endif
++
++ // Clear the environment for the new process before processing
++ // changes from SetEnv.
++ void ClearEnvironment();
+
+ // Starts the utility process.
+ bool Start();
+@@ -139,6 +147,21 @@ class CONTENT_EXPORT UtilityProcessHost
+ void SetZygoteForTesting(ZygoteCommunication* handle);
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
++#if BUILDFLAG(IS_WIN)
++ void SetStdioHandles(base::win::ScopedHandle stdout_handle,
++ base::win::ScopedHandle stderr_handle);
++#elif BUILDFLAG(IS_POSIX)
++ void SetAdditionalFds(base::FileHandleMappingVector mapping);
++#endif
++
++ // Sets the working directory of the process.
++ void SetCurrentDirectory(const base::FilePath& cwd);
++
++#if BUILDFLAG(IS_WIN)
++ // Specifies if the process should trigger mouse cursor feedback.
++ void SetFeedbackCursorOff(bool feedback_cursor_off);
++#endif // BUILDFLAG(IS_WIN)
++
+ // Returns a control interface for the running child process.
+ mojom::ChildProcess* GetChildProcess();
+
+@@ -192,6 +215,27 @@ class CONTENT_EXPORT UtilityProcessHost
+ std::optional<raw_ptr<ZygoteCommunication>> zygote_for_testing_;
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
++#if BUILDFLAG(IS_WIN)
++ // Specifies the handles for redirection of stdout and stderr.
++ base::win::ScopedHandle stdout_handle_;
++ base::win::ScopedHandle stderr_handle_;
++#elif BUILDFLAG(IS_POSIX)
++ // Specifies file descriptors to propagate into the child process
++ // based on the mapping.
++ base::FileHandleMappingVector fds_to_remap_;
++#endif
++
++ // If not empty, change to this directory before executing the new process.
++ base::FilePath current_directory_;
++
++ // Inherit enviroment from parent process.
++ bool inherit_environment_ = true;
++
++#if BUILDFLAG(IS_WIN)
++ // Specifies if the process should trigger mouse cursor feedback.
++ bool feedback_cursor_off_ = false;
++#endif // BUILDFLAG(IS_WIN)
++
+ // Indicates whether the process has been successfully launched yet, or if
+ // launch failed.
+ enum class LaunchState {
diff --git a/electron34/patches/patch-content_browser_utility__process__host__receiver__bindings.cc b/electron34/patches/patch-content_browser_utility__process__host__receiver__bindings.cc
new file mode 100644
index 0000000000..cbbe3097ed
--- /dev/null
+++ b/electron34/patches/patch-content_browser_utility__process__host__receiver__bindings.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/utility_process_host_receiver_bindings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/utility_process_host_receiver_bindings.cc
+@@ -10,7 +10,7 @@
+ #include "content/public/common/content_client.h"
+ #include "media/media_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "components/services/font/public/mojom/font_service.mojom.h" // nogncheck
+ #include "content/browser/font_service.h" // nogncheck
+ #endif
+@@ -24,7 +24,7 @@ namespace content {
+
+ void UtilityProcessHost::BindHostReceiver(
+ mojo::GenericPendingReceiver receiver) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (auto font_receiver = receiver.As<font_service::mojom::FontService>()) {
+ ConnectToFontService(std::move(font_receiver));
+ return;
diff --git a/electron34/patches/patch-content_browser_utility__sandbox__delegate.cc b/electron34/patches/patch-content_browser_utility__sandbox__delegate.cc
new file mode 100644
index 0000000000..0dd397e6be
--- /dev/null
+++ b/electron34/patches/patch-content_browser_utility__sandbox__delegate.cc
@@ -0,0 +1,111 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/utility_sandbox_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/utility_sandbox_delegate.cc
+@@ -41,17 +41,19 @@ UtilitySandboxedProcessLauncherDelegate:
+ UtilitySandboxedProcessLauncherDelegate(
+ sandbox::mojom::Sandbox sandbox_type,
+ const base::EnvironmentMap& env,
+- const base::CommandLine& cmd_line)
++ const base::FilePath& cwd,
++ const base::CommandLine& cmd_line,
++ bool inherit_environment)
+ :
+-#if BUILDFLAG(IS_POSIX)
+ env_(env),
+-#endif
++ current_directory_(cwd),
+ sandbox_type_(sandbox_type),
+ #if BUILDFLAG(IS_WIN)
+ app_container_disabled_(
+ GetContentClient()->browser()->IsAppContainerDisabled(sandbox_type)),
+ #endif
+- cmd_line_(cmd_line) {
++ cmd_line_(cmd_line),
++ inherit_environment_(inherit_environment) {
+ #if DCHECK_IS_ON()
+ bool supported_sandbox_type =
+ sandbox_type_ == sandbox::mojom::Sandbox::kNoSandbox ||
+@@ -83,10 +85,10 @@ UtilitySandboxedProcessLauncherDelegate:
+ #if BUILDFLAG(IS_FUCHSIA)
+ sandbox_type_ == sandbox::mojom::Sandbox::kVideoCapture ||
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoEncoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -100,10 +102,10 @@ UtilitySandboxedProcessLauncherDelegate:
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+ sandbox_type_ == sandbox::mojom::Sandbox::kScreenAI ||
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kVideoEffects ||
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kOnDeviceTranslation ||
+ #endif
+ sandbox_type_ == sandbox::mojom::Sandbox::kAudio ||
+@@ -120,11 +122,28 @@ UtilitySandboxedProcessLauncherDelegate:
+ return sandbox_type_;
+ }
+
+-#if BUILDFLAG(IS_POSIX)
+ base::EnvironmentMap UtilitySandboxedProcessLauncherDelegate::GetEnvironment() {
+ return env_;
+ }
+-#endif // BUILDFLAG(IS_POSIX)
++
++bool UtilitySandboxedProcessLauncherDelegate::ShouldInheritEnvironment() {
++ return inherit_environment_;
++}
++
++base::FilePath UtilitySandboxedProcessLauncherDelegate::GetCurrentDirectory() {
++ return current_directory_;
++}
++
++#if BUILDFLAG(IS_WIN)
++void UtilitySandboxedProcessLauncherDelegate::SetFeedbackCursorOff(
++ bool feedback_cursor_off) {
++ feedback_cursor_off_ = feedback_cursor_off;
++}
++
++bool UtilitySandboxedProcessLauncherDelegate::ShouldShowFeedbackCursor() {
++ return !feedback_cursor_off_;
++}
++#endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(USE_ZYGOTE)
+ ZygoteCommunication* UtilitySandboxedProcessLauncherDelegate::GetZygote() {
+@@ -149,10 +168,10 @@ ZygoteCommunication* UtilitySandboxedPro
+ // process upon startup.
+ if (sandbox_type_ == sandbox::mojom::Sandbox::kNetwork ||
+ sandbox_type_ == sandbox::mojom::Sandbox::kOnDeviceModelExecution ||
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kHardwareVideoEncoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -170,7 +189,7 @@ ZygoteCommunication* UtilitySandboxedPro
+ #if BUILDFLAG(ENABLE_SCREEN_AI_SERVICE)
+ sandbox_type_ == sandbox::mojom::Sandbox::kScreenAI ||
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ sandbox_type_ == sandbox::mojom::Sandbox::kVideoEffects ||
+ sandbox_type_ == sandbox::mojom::Sandbox::kOnDeviceTranslation ||
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-content_browser_utility__sandbox__delegate.h b/electron34/patches/patch-content_browser_utility__sandbox__delegate.h
new file mode 100644
index 0000000000..42c040c672
--- /dev/null
+++ b/electron34/patches/patch-content_browser_utility__sandbox__delegate.h
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/utility_sandbox_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/utility_sandbox_delegate.h
+@@ -34,7 +34,9 @@ class CONTENT_EXPORT UtilitySandboxedPro
+ public:
+ UtilitySandboxedProcessLauncherDelegate(sandbox::mojom::Sandbox sandbox_type,
+ const base::EnvironmentMap& env,
+- const base::CommandLine& cmd_line);
++ const base::FilePath& cwd,
++ const base::CommandLine& cmd_line,
++ bool inherit_environment);
+ ~UtilitySandboxedProcessLauncherDelegate() override;
+
+ sandbox::mojom::Sandbox GetSandboxType() override;
+@@ -59,9 +61,14 @@ class CONTENT_EXPORT UtilitySandboxedPro
+ ZygoteCommunication* GetZygote() override;
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
+-#if BUILDFLAG(IS_POSIX)
+ base::EnvironmentMap GetEnvironment() override;
+-#endif // BUILDFLAG(IS_POSIX)
++ bool ShouldInheritEnvironment() override;
++ base::FilePath GetCurrentDirectory() override;
++
++#if BUILDFLAG(IS_WIN)
++ void SetFeedbackCursorOff(bool feedback_cursor_off);
++ bool ShouldShowFeedbackCursor() override;
++#endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(USE_ZYGOTE)
+ void SetZygote(ZygoteCommunication* handle);
+@@ -72,9 +79,7 @@ class CONTENT_EXPORT UtilitySandboxedPro
+ #endif // BUILDFLAG(IS_MAC)
+
+ private:
+-#if BUILDFLAG(IS_POSIX)
+ base::EnvironmentMap env_;
+-#endif // BUILDFLAG(IS_POSIX)
+
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries_;
+@@ -84,12 +89,17 @@ class CONTENT_EXPORT UtilitySandboxedPro
+ std::optional<raw_ptr<ZygoteCommunication>> zygote_;
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
++ base::FilePath current_directory_;
+ const sandbox::mojom::Sandbox sandbox_type_;
+ #if BUILDFLAG(IS_WIN)
+ // If true then App Container will not be used for this utility process.
+ const bool app_container_disabled_;
+ #endif // BUILDFLAG(IS_WIN)
+ base::CommandLine cmd_line_;
++ bool inherit_environment_;
++#if BUILDFLAG(IS_WIN)
++ bool feedback_cursor_off_ = false;
++#endif // BUILDFLAG(IS_WIN)
+ };
+ } // namespace content
+
diff --git a/electron34/patches/patch-content_browser_v8__snapshot__files.cc b/electron34/patches/patch-content_browser_v8__snapshot__files.cc
new file mode 100644
index 0000000000..9c53775338
--- /dev/null
+++ b/electron34/patches/patch-content_browser_v8__snapshot__files.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/v8_snapshot_files.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/v8_snapshot_files.cc
+@@ -17,7 +17,7 @@ namespace content {
+ std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>>
+ GetV8SnapshotFilesToPreload(base::CommandLine& process_command_line) {
+ std::map<std::string, absl::variant<base::FilePath, base::ScopedFD>> files;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(USE_V8_CONTEXT_SNAPSHOT)
+ files[kV8ContextSnapshotDataDescriptor] = base::FilePath(
+ FILE_PATH_LITERAL(BUILDFLAG(V8_CONTEXT_SNAPSHOT_FILENAME)));
diff --git a/electron34/patches/patch-content_browser_web__contents_slow__web__preference__cache.cc b/electron34/patches/patch-content_browser_web__contents_slow__web__preference__cache.cc
new file mode 100644
index 0000000000..03fafe5983
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_slow__web__preference__cache.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/slow_web_preference_cache.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/slow_web_preference_cache.cc
+@@ -16,7 +16,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "ui/events/devices/input_device_observer_win.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/events/devices/device_data_manager.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "ui/base/device_form_factor.h"
+@@ -54,7 +54,7 @@ SlowWebPreferenceCache::SlowWebPreferenc
+
+ #if BUILDFLAG(IS_WIN)
+ ui::InputDeviceObserverWin::GetInstance()->AddObserver(this);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ui::DeviceDataManager::GetInstance()->AddObserver(this);
+ #elif BUILDFLAG(IS_ANDROID)
+ ui::InputDeviceObserverAndroid::GetInstance()->AddObserver(this);
+@@ -64,7 +64,7 @@ SlowWebPreferenceCache::SlowWebPreferenc
+ SlowWebPreferenceCache::~SlowWebPreferenceCache() {
+ #if BUILDFLAG(IS_WIN)
+ ui::InputDeviceObserverWin::GetInstance()->RemoveObserver(this);
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ui::DeviceDataManager::GetInstance()->RemoveObserver(this);
+ #elif BUILDFLAG(IS_ANDROID)
+ ui::InputDeviceObserverAndroid::GetInstance()->RemoveObserver(this);
diff --git a/electron34/patches/patch-content_browser_web__contents_web__contents__impl.cc b/electron34/patches/patch-content_browser_web__contents_web__contents__impl.cc
new file mode 100644
index 0000000000..1b31fea78b
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_web__contents__impl.cc
@@ -0,0 +1,171 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/web_contents_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/web_contents_impl.cc
+@@ -3760,6 +3760,13 @@ void WebContentsImpl::Init(const WebCont
+ params.main_frame_name, GetOpener(), primary_main_frame_policy,
+ base::UnguessableToken::Create());
+
++ if (params.view && params.delegate_view) {
++ view_.reset(params.view);
++ render_view_host_delegate_view_ = params.delegate_view;
++ }
++
++ if (!view_) {
++
+ std::unique_ptr<WebContentsViewDelegate> delegate =
+ GetContentClient()->browser()->GetWebContentsViewDelegate(this);
+
+@@ -3770,6 +3777,7 @@ void WebContentsImpl::Init(const WebCont
+ view_ = CreateWebContentsView(this, std::move(delegate),
+ &render_view_host_delegate_view_);
+ }
++ } // !view_
+ CHECK(render_view_host_delegate_view_);
+ CHECK(view_.get());
+
+@@ -4009,21 +4017,25 @@ KeyboardEventProcessingResult WebContent
+ const input::NativeWebKeyboardEvent& event) {
+ OPTIONAL_TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"),
+ "WebContentsImpl::PreHandleKeyboardEvent");
+- auto* outermost_contents = GetOutermostWebContents();
+- // TODO(wjmaclean): Generalize this to forward all key events to the outermost
+- // delegate's handler.
+- if (outermost_contents != this && IsFullscreen() &&
+- event.windows_key_code == ui::VKEY_ESCAPE) {
+- // When an inner WebContents has focus and is fullscreen, redirect <esc>
+- // key events to the outermost WebContents so it can be handled by that
+- // WebContents' delegate.
+- if (outermost_contents->PreHandleKeyboardEvent(event) ==
+- KeyboardEventProcessingResult::HANDLED) {
++
++ auto handled = delegate_ ? delegate_->PreHandleKeyboardEvent(this, event)
++ : KeyboardEventProcessingResult::NOT_HANDLED;
++
++ if (IsFullscreen() && event.windows_key_code == ui::VKEY_ESCAPE) {
++ if (handled == KeyboardEventProcessingResult::HANDLED)
+ return KeyboardEventProcessingResult::HANDLED;
++
++ // When an inner WebContents has focus and is fullscreen, traverse through
++ // containing webcontents to any that may handle the escape key.
++ while (auto* outer_web_contents = GetOuterWebContents()) {
++ auto result = outer_web_contents->PreHandleKeyboardEvent(event);
++ if (result == KeyboardEventProcessingResult::HANDLED) {
++ return KeyboardEventProcessingResult::HANDLED;
++ }
+ }
+ }
+- return delegate_ ? delegate_->PreHandleKeyboardEvent(this, event)
+- : KeyboardEventProcessingResult::NOT_HANDLED;
++
++ return handled;
+ }
+
+ bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {
+@@ -4182,7 +4194,7 @@ void WebContentsImpl::EnterFullscreenMod
+ OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::EnterFullscreenMode");
+ DCHECK(CanEnterFullscreenMode(requesting_frame));
+ DCHECK(requesting_frame->IsActive());
+- DCHECK(ContainsOrIsFocusedWebContents());
++ DCHECK(ContainsOrIsFocusedWebContents() || IsGuest());
+ if (base::FeatureList::IsEnabled(
+ features::kAutomaticFullscreenContentSetting)) {
+ // Ensure the window is made active to take input focus. The user may have
+@@ -4790,8 +4802,7 @@ FrameTree* WebContentsImpl::CreateNewWin
+
+ if (delegate_ && delegate_->IsWebContentsCreationOverridden(
+ source_site_instance, params.window_container_type,
+- opener->GetLastCommittedURL(), params.frame_name,
+- params.target_url)) {
++ opener->GetLastCommittedURL(), params)) {
+ auto* web_contents_impl =
+ static_cast<WebContentsImpl*>(delegate_->CreateCustomWebContents(
+ opener, source_site_instance, is_new_browsing_instance,
+@@ -4810,9 +4821,6 @@ FrameTree* WebContentsImpl::CreateNewWin
+ bool renderer_started_hidden =
+ params.disposition == WindowOpenDisposition::NEW_BACKGROUND_TAB;
+
+- // While some guest types do not have a guest SiteInstance, the ones that
+- // don't all override WebContents creation above.
+- CHECK_EQ(source_site_instance->IsGuest(), IsGuest());
+ bool is_guest = IsGuest();
+
+ // We usually create the new window in the same BrowsingInstance (group of
+@@ -4895,6 +4903,12 @@ FrameTree* WebContentsImpl::CreateNewWin
+ SetPartitionedPopinOpenerOnNewWindowIfNeeded(new_contents_impl, params,
+ opener);
+
++ if (delegate_) {
++ delegate_->WebContentsCreatedWithFullParams(this, render_process_id,
++ opener->GetRoutingID(),
++ params, new_contents_impl);
++ }
++
+ // If the new frame has a name, make sure any SiteInstances that can find
+ // this named frame have proxies for it. Must be called after
+ // SetSessionStorageNamespace, since this calls CreateRenderView, which uses
+@@ -4936,12 +4950,6 @@ FrameTree* WebContentsImpl::CreateNewWin
+ AddWebContentsDestructionObserver(new_contents_impl);
+ }
+
+- if (delegate_) {
+- delegate_->WebContentsCreated(this, render_process_id,
+- opener->GetRoutingID(), params.frame_name,
+- params.target_url, new_contents_impl);
+- }
+-
+ observers_.NotifyObservers(&WebContentsObserver::DidOpenRequestedURL,
+ new_contents_impl, opener, params.target_url,
+ params.referrer.To<Referrer>(), params.disposition,
+@@ -5620,6 +5628,11 @@ TextInputManager* WebContentsImpl::GetTe
+ return text_input_manager_.get();
+ }
+
++void WebContentsImpl::OnCursorChanged(const ui::Cursor& cursor) {
++ observers_.NotifyObservers(&WebContentsObserver::OnCursorChanged,
++ cursor);
++}
++
+ bool WebContentsImpl::IsWidgetForPrimaryMainFrame(
+ RenderWidgetHostImpl* render_widget_host) {
+ return render_widget_host == GetPrimaryMainFrame()->GetRenderWidgetHost();
+@@ -9381,7 +9394,7 @@ void WebContentsImpl::OnFocusedElementCh
+ "WebContentsImpl::OnFocusedElementChangedInFrame",
+ "render_frame_host", frame);
+ RenderWidgetHostViewBase* root_view =
+- static_cast<RenderWidgetHostViewBase*>(GetRenderWidgetHostView());
++ static_cast<RenderWidgetHostViewBase*>(GetTopLevelRenderWidgetHostView());
+ if (!root_view || !frame->GetView()) {
+ return;
+ }
+@@ -9518,25 +9531,13 @@ void WebContentsImpl::RendererUnresponsi
+ base::RepeatingClosure hang_monitor_restarter) {
+ OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::RendererUnresponsive",
+ "render_widget_host", render_widget_host);
+- if (ShouldIgnoreUnresponsiveRenderer()) {
++ if (IsBeingDestroyed()) {
+ return;
+ }
+
+ bool visible = GetVisibility() == Visibility::VISIBLE;
+ RecordRendererUnresponsiveMetrics(visible, render_widget_host);
+
+- // Do not report hangs (to task manager, to hang renderer dialog, etc.) for
+- // invisible tabs (like extension background page, background tabs). See
+- // https://crbug.com/881812 for rationale and for choosing the visibility
+- // (rather than process priority) as the signal here.
+- if (!visible) {
+- return;
+- }
+-
+- if (!render_widget_host->renderer_initialized()) {
+- return;
+- }
+-
+ CrashRepHandlingOutcome outcome =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kNoErrorDialogs)
diff --git a/electron34/patches/patch-content_browser_web__contents_web__contents__impl.h b/electron34/patches/patch-content_browser_web__contents_web__contents__impl.h
new file mode 100644
index 0000000000..681ce54989
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_web__contents__impl.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/web_contents_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/web_contents_impl.h
+@@ -1130,6 +1130,7 @@ class CONTENT_EXPORT WebContentsImpl
+ void SendScreenRects() override;
+ void SendActiveState(bool active) override;
+ TextInputManager* GetTextInputManager() override;
++ void OnCursorChanged(const ui::Cursor& cursor) override;
+ bool IsWidgetForPrimaryMainFrame(
+ RenderWidgetHostImpl* render_widget_host) override;
+ bool IsShowingContextMenuOnPage() const override;
diff --git a/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura.cc b/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura.cc
new file mode 100644
index 0000000000..db97fd702a
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/web_contents_view_aura.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/web_contents_view_aura.cc
+@@ -174,7 +174,7 @@ class WebDragSourceAura : public content
+ raw_ptr<aura::Window> window_;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Fill out the OSExchangeData with a file contents, synthesizing a name if
+ // necessary.
+ void PrepareDragForFileContents(const DropData& drop_data,
+@@ -258,7 +258,7 @@ void PrepareDragData(const DropData& dro
+ if (!drop_data.download_metadata.empty())
+ PrepareDragForDownload(drop_data, provider, web_contents);
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // We set the file contents before the URL because the URL also sets file
+ // contents (to a .URL shortcut). We want to prefer file content data over
+ // a shortcut so we add it first.
+@@ -1326,7 +1326,7 @@ void WebContentsViewAura::OnMouseEvent(u
+ // Linux window managers like to handle raise-on-click themselves. If we
+ // raise-on-click manually, this may override user settings that prevent
+ // focus-stealing.
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // It is possible for the web-contents to be destroyed while it is being
+ // activated. Use a weak-ptr to track whether that happened or not.
+ // More in https://crbug.com/1040725
diff --git a/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc b/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc
new file mode 100644
index 0000000000..9e464c8478
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/web_contents_view_aura_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/web_contents_view_aura_unittest.cc
+@@ -97,7 +97,7 @@ class TestDragDropClient : public aura::
+ drag_drop_data_ = std::move(data);
+ return DragOperation::kCopy;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void UpdateDragImage(const gfx::ImageSkia& image,
+ const gfx::Vector2d& offset) override {}
+ #endif
diff --git a/electron34/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc b/electron34/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc
new file mode 100644
index 0000000000..c2ee2b7917
--- /dev/null
+++ b/electron34/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/web_contents/web_contents_view_drag_security_info.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/web_contents/web_contents_view_drag_security_info.cc
+@@ -66,7 +66,7 @@ bool WebContentsViewDragSecurityInfo::Is
+ // browser-side checks only have local tree fragment (potentially with
+ // multiple origins) granularity at best, but a drag operation eventually
+ // targets one single frame in that local tree fragment.
+- return target_rwh->GetSiteInstanceGroup()->GetId() == site_instance_group_id_;
++ return true;
+ }
+
+ } // namespace content
diff --git a/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc b/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc
new file mode 100644
index 0000000000..70377c10ad
--- /dev/null
+++ b/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/webui/web_ui_main_frame_observer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/webui/web_ui_main_frame_observer.cc
+@@ -14,7 +14,7 @@
+ #include "content/public/browser/navigation_handle.h"
+ #include "content/public/browser/web_ui_controller.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/feature_list.h"
+ #include "base/functional/callback_helpers.h"
+ #include "base/logging.h"
+@@ -32,7 +32,7 @@ namespace content {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Remove the pieces of the URL we don't want to send back with the error
+ // reports. In particular, do not send query or fragments as those can have
+ // privacy-sensitive information in them.
+@@ -56,7 +56,7 @@ WebUIMainFrameObserver::WebUIMainFrameOb
+
+ WebUIMainFrameObserver::~WebUIMainFrameObserver() = default;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void WebUIMainFrameObserver::OnDidAddMessageToConsole(
+ RenderFrameHost* source_frame,
+ blink::mojom::ConsoleMessageLevel log_level,
+@@ -171,7 +171,7 @@ void WebUIMainFrameObserver::ReadyToComm
+
+ // TODO(crbug.com/40149439) This is currently disabled due to Windows DLL
+ // thunking issues. Fix & re-enable.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ MaybeEnableWebUIJavaScriptErrorReporting(navigation_handle);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
diff --git a/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.h b/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.h
new file mode 100644
index 0000000000..45d6e584cd
--- /dev/null
+++ b/electron34/patches/patch-content_browser_webui_web__ui__main__frame__observer.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/webui/web_ui_main_frame_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/webui/web_ui_main_frame_observer.h
+@@ -44,7 +44,7 @@ class CONTENT_EXPORT WebUIMainFrameObser
+
+ // TODO(crbug.com/40149439) This is currently disabled due to Windows DLL
+ // thunking issues. Fix & re-enable.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On official Google builds, capture and report JavaScript error messages on
+ // WebUI surfaces back to Google. This allows us to fix JavaScript errors and
+ // exceptions.
+@@ -64,7 +64,7 @@ class CONTENT_EXPORT WebUIMainFrameObser
+ private:
+ const GURL& GetUrlForLogging() const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void MaybeEnableWebUIJavaScriptErrorReporting(
+ NavigationHandle* navigation_handle);
+
diff --git a/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc b/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
new file mode 100644
index 0000000000..dd6fcf6d09
--- /dev/null
+++ b/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
@@ -0,0 +1,87 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/zygote_host/zygote_host_impl_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/zygote_host/zygote_host_impl_linux.cc
+@@ -19,8 +19,10 @@
+ #include "build/chromeos_buildflags.h"
+ #include "content/common/zygote/zygote_commands_linux.h"
+ #include "content/common/zygote/zygote_communication_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "content/common/zygote/zygote_handle_impl_linux.h"
+ #include "content/public/common/zygote/zygote_handle.h"
++#endif
+ #include "sandbox/linux/services/credentials.h"
+ #include "sandbox/linux/services/namespace_sandbox.h"
+ #include "sandbox/linux/suid/client/setuid_sandbox_host.h"
+@@ -38,6 +40,7 @@ namespace content {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ // Receive a fixed message on fd and return the sender's PID.
+ // Returns true if the message received matches the expected message.
+ bool ReceiveFixedMessage(int fd,
+@@ -60,6 +63,7 @@ bool ReceiveFixedMessage(int fd,
+ return false;
+ return true;
+ }
++#endif
+
+ } // namespace
+
+@@ -69,9 +73,13 @@ ZygoteHost* ZygoteHost::GetInstance() {
+ }
+
+ ZygoteHostImpl::ZygoteHostImpl()
++#if !BUILDFLAG(IS_BSD)
+ : use_namespace_sandbox_(false),
+ use_suid_sandbox_(false),
+ use_suid_sandbox_for_adj_oom_score_(false),
++#else
++ :
++#endif
+ sandbox_binary_(),
+ zygote_pids_lock_(),
+ zygote_pids_() {}
+@@ -84,6 +92,7 @@ ZygoteHostImpl* ZygoteHostImpl::GetInsta
+ }
+
+ void ZygoteHostImpl::Init(const base::CommandLine& command_line) {
++#if !BUILDFLAG(IS_BSD)
+ if (command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
+ return;
+ }
+@@ -138,6 +147,7 @@ void ZygoteHostImpl::Init(const base::Co
+ "you can try using --"
+ << sandbox::policy::switches::kNoSandbox << ".";
+ }
++#endif
+ }
+
+ void ZygoteHostImpl::AddZygotePid(pid_t pid) {
+@@ -162,6 +172,7 @@ pid_t ZygoteHostImpl::LaunchZygote(
+ base::CommandLine* cmd_line,
+ base::ScopedFD* control_fd,
+ base::FileHandleMappingVector additional_remapped_fds) {
++#if !BUILDFLAG(IS_BSD)
+ int fds[2];
+ CHECK_EQ(0, socketpair(AF_UNIX, SOCK_SEQPACKET | SOCK_CLOEXEC, 0, fds));
+ CHECK(base::UnixDomainSocket::EnableReceiveProcessId(fds[0]));
+@@ -230,9 +241,12 @@ pid_t ZygoteHostImpl::LaunchZygote(
+
+ AddZygotePid(pid);
+ return pid;
++#else
++ return 0;
++#endif
+ }
+
+-#if !BUILDFLAG(IS_OPENBSD)
++#if !BUILDFLAG(IS_BSD)
+ void ZygoteHostImpl::AdjustRendererOOMScore(base::ProcessHandle pid,
+ int score) {
+ // 1) You can't change the oom_score_adj of a non-dumpable process
diff --git a/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h b/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h
new file mode 100644
index 0000000000..a6aa696ea2
--- /dev/null
+++ b/electron34/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/browser/zygote_host/zygote_host_impl_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/browser/zygote_host/zygote_host_impl_linux.h
+@@ -47,12 +47,14 @@ class CONTENT_EXPORT ZygoteHostImpl : pu
+ base::ScopedFD* control_fd,
+ base::FileHandleMappingVector additional_remapped_fds);
+
++#if !BUILDFLAG(IS_BSD)
+ void AdjustRendererOOMScore(base::ProcessHandle process_handle,
+ int score) override;
+ #if BUILDFLAG(IS_CHROMEOS)
+ void ReinitializeLogging(uint32_t logging_dest,
+ base::PlatformFile log_file_fd) override;
+ #endif // BUILDFLAG(IS_CHROMEOS)
++#endif
+
+ bool HasZygote() { return !zygote_pids_.empty(); }
+
+@@ -67,9 +69,11 @@ class CONTENT_EXPORT ZygoteHostImpl : pu
+
+ int renderer_sandbox_status_;
+
++#if !BUILDFLAG(IS_BSD)
+ bool use_namespace_sandbox_;
+ bool use_suid_sandbox_;
+ bool use_suid_sandbox_for_adj_oom_score_;
++#endif
+ std::string sandbox_binary_;
+
+ // This lock protects the |zygote_pids_| set.
diff --git a/electron34/patches/patch-content_child_BUILD.gn b/electron34/patches/patch-content_child_BUILD.gn
new file mode 100644
index 0000000000..bcb646af52
--- /dev/null
+++ b/electron34/patches/patch-content_child_BUILD.gn
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/child/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/child/BUILD.gn
+@@ -131,6 +131,13 @@ target(link_target_type, "child") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "sandboxed_process_thread_type_handler.cc",
++ "sandboxed_process_thread_type_handler.h",
++ ]
++ }
++
+ if (is_win) {
+ sources += [
+ "dwrite_font_proxy/dwrite_font_proxy_init_impl_win.cc",
diff --git a/electron34/patches/patch-content_child_child__process.cc b/electron34/patches/patch-content_child_child__process.cc
new file mode 100644
index 0000000000..d011c107e4
--- /dev/null
+++ b/electron34/patches/patch-content_child_child__process.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/child/child_process.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/child/child_process.cc
+@@ -31,7 +31,7 @@
+ #include "content/common/android/cpu_time_metrics.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+
+@@ -178,7 +178,7 @@ void ChildProcess::set_main_thread(Child
+ main_thread_.reset(thread);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ void ChildProcess::SetIOThreadType(base::ThreadType thread_type) {
+ if (!io_thread_) {
+ return;
diff --git a/electron34/patches/patch-content_child_child__process.h b/electron34/patches/patch-content_child_child__process.h
new file mode 100644
index 0000000000..645b21f843
--- /dev/null
+++ b/electron34/patches/patch-content_child_child__process.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/child/child_process.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/child/child_process.h
+@@ -79,7 +79,7 @@ class CONTENT_EXPORT ChildProcess {
+ return io_thread_runner_.get();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Changes the thread type of the child process IO thread.
+ void SetIOThreadType(base::ThreadType thread_type);
+ #endif
diff --git a/electron34/patches/patch-content_common_BUILD.gn b/electron34/patches/patch-content_common_BUILD.gn
new file mode 100644
index 0000000000..12c9092f9d
--- /dev/null
+++ b/electron34/patches/patch-content_common_BUILD.gn
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/BUILD.gn
+@@ -286,6 +286,7 @@ source_set("common") {
+ "//ui/shell_dialogs",
+ "//url",
+ "//url/ipc:url_ipc",
++ "//electron/build/config:generate_mas_config",
+ ]
+
+ defines = []
+@@ -385,19 +386,28 @@ source_set("common") {
+ }
+
+ if (is_linux || is_chromeos) {
+- sources += [
+- "gpu_pre_sandbox_hook_linux.cc",
+- "gpu_pre_sandbox_hook_linux.h",
+- ]
++ if (is_bsd) {
++ sources += [
++ "gpu_pre_sandbox_hook_bsd.cc",
++ "gpu_pre_sandbox_hook_bsd.h",
++ ]
++ } else {
++ sources += [
++ "gpu_pre_sandbox_hook_linux.cc",
++ "gpu_pre_sandbox_hook_linux.h",
++ ]
++ }
+ public_deps += [ "//sandbox/policy" ]
+ deps += [
+ ":sandbox_support_linux",
+ "//media/gpu:buildflags",
+ "//sandbox/linux:sandbox_services",
+- "//sandbox/linux:seccomp_bpf",
+ "//sandbox/policy:chromecast_sandbox_allowlist_buildflags",
+ "//third_party/fontconfig",
+ ]
++ if (use_seccomp_bpf) {
++ deps += [ "//sandbox/linux:seccomp_bpf" ]
++ }
+ if (use_v4l2_codec) {
+ deps += [ "//media/gpu/v4l2" ]
+ }
diff --git a/electron34/patches/patch-content_common_features.cc b/electron34/patches/patch-content_common_features.cc
new file mode 100644
index 0000000000..ff6e9b610d
--- /dev/null
+++ b/electron34/patches/patch-content_common_features.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/features.cc
+@@ -156,7 +156,7 @@ BASE_FEATURE(kEnableBackForwardCacheForO
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+ // Enables error reporting for JS errors inside DevTools frontend host
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kEnableDevToolsJsErrorReporting,
+ "EnableDevToolsJsErrorReporting",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+@@ -315,7 +315,7 @@ BASE_FEATURE(kGroupNIKByJoiningOrigin,
+ // process and having browser process handle adjusting thread properties (nice
+ // value, c-group, latency sensitivity...) for children which have sandbox
+ // restrictions.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ BASE_FEATURE(kHandleChildThreadTypeChangesInBrowser,
+ "HandleChildThreadTypeChangesInBrowser",
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-content_common_features.h b/electron34/patches/patch-content_common_features.h
new file mode 100644
index 0000000000..51638917ae
--- /dev/null
+++ b/electron34/patches/patch-content_common_features.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/features.h
+@@ -35,7 +35,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kDev
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kDocumentPolicyNegotiation);
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(
+ kEnableBackForwardCacheForOngoingSubframeNavigation);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEnableDevToolsJsErrorReporting);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEmbeddingRequiresOptIn);
+@@ -79,7 +79,7 @@ CONTENT_EXPORT extern const base::Featur
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kGpuInfoCollectionSeparatePrefetch);
+ #endif
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kGroupNIKByJoiningOrigin);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kHandleChildThreadTypeChangesInBrowser);
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
diff --git a/electron34/patches/patch-content_common_font__list__unittest.cc b/electron34/patches/patch-content_common_font__list__unittest.cc
new file mode 100644
index 0000000000..e09460147c
--- /dev/null
+++ b/electron34/patches/patch-content_common_font__list__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/font_list_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/font_list_unittest.cc
+@@ -48,7 +48,7 @@ TEST(FontList, GetFontList) {
+ EXPECT_TRUE(HasFontWithName(fonts, "MS Gothic", "MS Gothic"));
+ EXPECT_TRUE(HasFontWithName(fonts, "Segoe UI", "Segoe UI"));
+ EXPECT_TRUE(HasFontWithName(fonts, "Verdana", "Verdana"));
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ EXPECT_TRUE(HasFontWithName(fonts, "Arimo", "Arimo"));
+ #else
+ EXPECT_TRUE(HasFontWithName(fonts, "Arial", "Arial"));
diff --git a/electron34/patches/patch-content_common_frame.mojom b/electron34/patches/patch-content_common_frame.mojom
new file mode 100644
index 0000000000..325705d944
--- /dev/null
+++ b/electron34/patches/patch-content_common_frame.mojom
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/frame.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/frame.mojom
+@@ -617,6 +617,10 @@ struct CreateNewWindowParams {
+ // The navigation initiator's user activation and ad status.
+ blink.mojom.NavigationInitiatorActivationAndAdStatus
+ initiator_activation_and_ad_status;
++
++ // Extra fields added by Electron.
++ string raw_features;
++ network.mojom.URLRequestBody? body;
+ };
+
+ // Operation result when the renderer asks the browser to create a new window.
diff --git a/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
new file mode 100644
index 0000000000..8cdc96e1ac
--- /dev/null
+++ b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
@@ -0,0 +1,77 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/gpu_pre_sandbox_hook_bsd.cc.orig 2025-05-24 17:57:53.488808380 +0000
++++ content/common/gpu_pre_sandbox_hook_bsd.cc
+@@ -0,0 +1,68 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "content/common/gpu_pre_sandbox_hook_bsd.h"
++
++#include <dlfcn.h>
++#include <errno.h>
++#include <sys/stat.h>
++
++#include <memory>
++#include <sstream>
++#include <utility>
++#include <vector>
++
++#include "base/base_paths.h"
++#include "base/files/file_enumerator.h"
++#include "base/files/file_path.h"
++#include "base/files/scoped_file.h"
++#include "base/functional/bind.h"
++#include "base/logging.h"
++#include "base/path_service.h"
++#include "base/strings/stringprintf.h"
++#include "build/build_config.h"
++#include "build/buildflag.h"
++#include "build/chromeos_buildflags.h"
++#include "content/public/common/content_switches.h"
++#include "media/gpu/buildflags.h"
++
++namespace content {
++namespace {
++
++constexpr int dlopen_flag = RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE;
++
++void LoadVulkanLibraries() {
++ // Try to preload Vulkan libraries. Failure is not an error as not all may be
++ // present.
++ const char* kLibraries[] = {
++ "libvulkan.so",
++ "libvulkan_intel.so",
++ "libvulkan_intel_hasvk.so",
++ "libvulkan_radeon.so",
++ };
++ for (const auto* library : kLibraries) {
++ dlopen(library, dlopen_flag);
++ }
++}
++
++bool LoadLibrariesForGpu(
++ const sandbox::policy::SandboxSeccompBPF::Options& options) {
++ LoadVulkanLibraries();
++
++ return true;
++}
++
++} // namespace
++
++bool GpuPreSandboxHook(sandbox::policy::SandboxLinux::Options options) {
++ if (!LoadLibrariesForGpu(options))
++ return false;
++
++ // TODO(tsepez): enable namspace sandbox here once crashes are understood.
++
++ errno = 0;
++ return true;
++}
++
++} // namespace content
diff --git a/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h
new file mode 100644
index 0000000000..35651e9931
--- /dev/null
+++ b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/gpu_pre_sandbox_hook_bsd.h.orig 2025-05-24 17:57:53.488940795 +0000
++++ content/common/gpu_pre_sandbox_hook_bsd.h
+@@ -0,0 +1,20 @@
++// Copyright 2017 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
++#define CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
++
++#include "base/component_export.h"
++#include "sandbox/policy/sandbox.h"
++
++namespace content {
++
++// A pre-sandbox hook to use on Linux-based systems in sandboxed processes that
++// require general GPU usage.
++COMPONENT_EXPORT(GPU_PRE_SANDBOX_HOOK)
++bool GpuPreSandboxHook(sandbox::policy::SandboxLinux::Options options);
++
++} // namespace content
++
++#endif // CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_BSD_H_
diff --git a/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h
new file mode 100644
index 0000000000..20ced202c4
--- /dev/null
+++ b/electron34/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/gpu_pre_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/gpu_pre_sandbox_hook_linux.h
+@@ -5,8 +5,13 @@
+ #ifndef CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_LINUX_H_
+ #define CONTENT_COMMON_GPU_PRE_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
+ #include "base/component_export.h"
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace content {
+
diff --git a/electron34/patches/patch-content_common_sandbox__init__win.cc b/electron34/patches/patch-content_common_sandbox__init__win.cc
new file mode 100644
index 0000000000..428f3257e5
--- /dev/null
+++ b/electron34/patches/patch-content_common_sandbox__init__win.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/sandbox_init_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/sandbox_init_win.cc
+@@ -23,7 +23,7 @@ namespace content {
+ sandbox::ResultCode StartSandboxedProcess(
+ SandboxedProcessLauncherDelegate* delegate,
+ const base::CommandLine& target_command_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ sandbox::StartSandboxedProcessCallback result_callback) {
+ std::string type_str =
+ target_command_line.GetSwitchValueASCII(switches::kProcessType);
+@@ -45,7 +45,7 @@ sandbox::ResultCode StartSandboxedProces
+ }
+
+ return sandbox::policy::SandboxWin::StartSandboxedProcess(
+- full_command_line, handles_to_inherit, delegate,
++ full_command_line, options, delegate,
+ std::move(result_callback));
+ }
+
diff --git a/electron34/patches/patch-content_common_url__schemes.cc b/electron34/patches/patch-content_common_url__schemes.cc
new file mode 100644
index 0000000000..07ef29c1f4
--- /dev/null
+++ b/electron34/patches/patch-content_common_url__schemes.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/url_schemes.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/url_schemes.cc
+@@ -98,6 +98,14 @@ void RegisterContentSchemes(bool should_
+ for (auto& scheme : schemes.empty_document_schemes)
+ url::AddEmptyDocumentScheme(scheme.c_str());
+
++ for (auto& scheme : schemes.code_cache_schemes) {
++ CHECK_NE(scheme, kChromeUIScheme);
++ CHECK_NE(scheme, kChromeUIUntrustedScheme);
++ CHECK_NE(scheme, url::kHttpScheme);
++ CHECK_NE(scheme, url::kHttpsScheme);
++ url::AddCodeCacheScheme(scheme.c_str());
++ }
++
+ #if BUILDFLAG(IS_ANDROID)
+ if (schemes.allow_non_standard_schemes_in_origins)
+ url::EnableNonStandardSchemesForAndroidWebView();
diff --git a/electron34/patches/patch-content_common_user__agent.cc b/electron34/patches/patch-content_common_user__agent.cc
new file mode 100644
index 0000000000..2c60e1de8a
--- /dev/null
+++ b/electron34/patches/patch-content_common_user__agent.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/common/user_agent.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/common/user_agent.cc
+@@ -45,7 +45,7 @@ std::string GetUserAgentPlatform() {
+ return "";
+ #elif BUILDFLAG(IS_MAC)
+ return "Macintosh; ";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return "X11; "; // strange, but that's what Firefox uses
+ #elif BUILDFLAG(IS_ANDROID)
+ return "Linux; ";
+@@ -71,7 +71,7 @@ std::string GetUnifiedPlatform() {
+ return "Windows NT 10.0; Win64; x64";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return "Fuchsia";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "X11; Linux x86_64";
+ #elif BUILDFLAG(IS_IOS)
+ if (ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET) {
+@@ -296,6 +296,16 @@ std::string BuildOSCpuInfoFromOSVersionA
+ "Android %s", os_version.c_str()
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "Fuchsia"
++#elif BUILDFLAG(IS_BSD)
++#if defined(__x86_64__)
++ "Linux x86_64; %s %s",
++#elif defined(__aarch64__)
++ "Linux aarch64; %s %s",
++#else
++ "Linux i686; %s %s",
++#endif
++ unixinfo.sysname, // e.g. Linux
++ cpu_type.c_str() // e.g. i686
+ #elif BUILDFLAG(IS_IOS)
+ "CPU %s OS %s like Mac OS X", cpu_type.c_str(),
+ os_version.c_str()
diff --git a/electron34/patches/patch-content_gpu_gpu__child__thread.cc b/electron34/patches/patch-content_gpu_gpu__child__thread.cc
new file mode 100644
index 0000000000..0271d1ed33
--- /dev/null
+++ b/electron34/patches/patch-content_gpu_gpu__child__thread.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/gpu/gpu_child_thread.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/gpu/gpu_child_thread.cc
+@@ -58,7 +58,7 @@
+ #include "third_party/skia/include/ports/SkFontConfigInterface.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+
+@@ -146,7 +146,8 @@ void GpuChildThread::Init(const base::Ti
+
+ viz_main_.gpu_service()->set_start_time(process_start_time);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ SandboxedProcessThreadTypeHandler::NotifyMainChildThreadCreated();
+ #endif
+
diff --git a/electron34/patches/patch-content_gpu_gpu__main.cc b/electron34/patches/patch-content_gpu_gpu__main.cc
new file mode 100644
index 0000000000..c68075d1e2
--- /dev/null
+++ b/electron34/patches/patch-content_gpu_gpu__main.cc
@@ -0,0 +1,98 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/gpu/gpu_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/gpu/gpu_main.cc
+@@ -95,10 +95,14 @@
+ #include "sandbox/win/src/sandbox.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #include "content/common/gpu_pre_sandbox_hook_linux.h"
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "sandbox/policy/sandbox_type.h"
+ #endif
+
+@@ -117,7 +121,7 @@ namespace content {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool StartSandboxLinux(gpu::GpuWatchdogThread*,
+ const gpu::GPUInfo*,
+ const gpu::GpuPreferences&);
+@@ -175,7 +179,7 @@ class ContentSandboxHelper : public gpu:
+ bool EnsureSandboxInitialized(gpu::GpuWatchdogThread* watchdog_thread,
+ const gpu::GPUInfo* gpu_info,
+ const gpu::GpuPreferences& gpu_prefs) override {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return StartSandboxLinux(watchdog_thread, gpu_info, gpu_prefs);
+ #elif BUILDFLAG(IS_WIN)
+ return StartSandboxWindows(sandbox_info_);
+@@ -258,6 +262,10 @@ int GpuMain(MainFunctionParams parameter
+ // to the GpuProcessHost once the GpuServiceImpl has started.
+ viz::GpuServiceImpl::InstallPreInitializeLogHandler();
+
++ auto* client = GetContentClient()->gpu();
++ if (client)
++ client->PreCreateMessageLoop();
++
+ // We are experiencing what appear to be memory-stomp issues in the GPU
+ // process. These issues seem to be impacting the task executor and listeners
+ // registered to it. Create the task executor on the heap to guard against
+@@ -293,7 +301,7 @@ int GpuMain(MainFunctionParams parameter
+ std::make_unique<base::SingleThreadTaskExecutor>(
+ gpu_preferences.message_pump_type);
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #error "Unsupported Linux platform."
+ #elif BUILDFLAG(IS_MAC)
+ // Cross-process CoreAnimation requires a CFRunLoop to function at all, and
+@@ -318,7 +326,8 @@ int GpuMain(MainFunctionParams parameter
+ base::PlatformThread::SetName("CrGpuMain");
+ mojo::InterfaceEndpointClient::SetThreadNameSuffixForMetrics("GpuMain");
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ // Thread type delegate of the process should be registered before
+ // thread type change below for the main thread and for thread pool in
+ // ChildProcess constructor.
+@@ -368,7 +377,6 @@ int GpuMain(MainFunctionParams parameter
+ #endif
+ const bool dead_on_arrival = !init_success;
+
+- auto* client = GetContentClient()->gpu();
+ if (client) {
+ client->PostSandboxInitialized();
+ }
+@@ -449,7 +457,7 @@ int GpuMain(MainFunctionParams parameter
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool StartSandboxLinux(gpu::GpuWatchdogThread* watchdog_thread,
+ const gpu::GPUInfo* gpu_info,
+ const gpu::GpuPreferences& gpu_prefs) {
+@@ -489,7 +497,7 @@ bool StartSandboxLinux(gpu::GpuWatchdogT
+ sandbox_options.accelerated_video_encode_enabled =
+ !gpu_prefs.disable_accelerated_video_encode;
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Video decoding of many video streams can use thousands of FDs as well as
+ // Exo clients like Lacros.
+ // See https://crbug.com/1417237
diff --git a/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc b/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
new file mode 100644
index 0000000000..f396fc15ef
--- /dev/null
+++ b/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/ppapi_plugin/ppapi_blink_platform_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/ppapi_plugin/ppapi_blink_platform_impl.cc
+@@ -21,7 +21,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #include "mojo/public/cpp/bindings/pending_remote.h"
+ #endif
+@@ -36,7 +36,7 @@ typedef struct CGFont* CGFontRef;
+ namespace content {
+
+ PpapiBlinkPlatformImpl::PpapiBlinkPlatformImpl() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ ChildThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -55,7 +55,7 @@ PpapiBlinkPlatformImpl::~PpapiBlinkPlatf
+ void PpapiBlinkPlatformImpl::Shutdown() {}
+
+ blink::WebSandboxSupport* PpapiBlinkPlatformImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ return nullptr;
diff --git a/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h b/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
new file mode 100644
index 0000000000..b2ebbec7b9
--- /dev/null
+++ b/electron34/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/ppapi_plugin/ppapi_blink_platform_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/ppapi_plugin/ppapi_blink_platform_impl.h
+@@ -36,7 +36,7 @@ class PpapiBlinkPlatformImpl : public Bl
+ blink::WebString DefaultLocale() override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+ };
diff --git a/electron34/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc b/electron34/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc
new file mode 100644
index 0000000000..ef202b1add
--- /dev/null
+++ b/electron34/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/ppapi_plugin/ppapi_plugin_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/ppapi_plugin/ppapi_plugin_main.cc
+@@ -52,6 +52,11 @@
+ #include "gin/v8_initializer.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#include "sandbox/policy/sandbox_type.h"
++#endif
++
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+ #include <stdlib.h>
+ #endif
+@@ -141,7 +146,7 @@ int PpapiPluginMain(MainFunctionParams p
+ gin::V8Initializer::LoadV8Snapshot();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
+ sandbox::policy::SandboxLinux::GetInstance()->InitializeSandbox(
+ sandbox::policy::SandboxTypeFromCommandLine(command_line),
+ sandbox::policy::SandboxLinux::PreSandboxHook(),
diff --git a/electron34/patches/patch-content_public_app_content__main__delegate.cc b/electron34/patches/patch-content_public_app_content__main__delegate.cc
new file mode 100644
index 0000000000..12169d7ffb
--- /dev/null
+++ b/electron34/patches/patch-content_public_app_content__main__delegate.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/app/content_main_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/app/content_main_delegate.cc
+@@ -4,6 +4,8 @@
+
+ #include "content/public/app/content_main_delegate.h"
+
++#include <string_view>
++
+ #include "base/check.h"
+ #include "build/build_config.h"
+ #include "content/public/browser/content_browser_client.h"
+@@ -91,6 +93,10 @@ std::optional<int> ContentMainDelegate::
+ return std::nullopt;
+ }
+
++std::string_view ContentMainDelegate::GetBrowserV8SnapshotFilename() {
++ return std::string_view();
++}
++
+ ContentClient* ContentMainDelegate::CreateContentClient() {
+ return new ContentClient();
+ }
diff --git a/electron34/patches/patch-content_public_app_content__main__delegate.h b/electron34/patches/patch-content_public_app_content__main__delegate.h
new file mode 100644
index 0000000000..0ccb78a07e
--- /dev/null
+++ b/electron34/patches/patch-content_public_app_content__main__delegate.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/app/content_main_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/app/content_main_delegate.h
+@@ -8,6 +8,7 @@
+ #include <memory>
+ #include <optional>
+ #include <string>
++#include <string_view>
+ #include <vector>
+
+ #include "build/build_config.h"
+@@ -173,6 +174,8 @@ class CONTENT_EXPORT ContentMainDelegate
+ virtual bool ShouldHandleConsoleControlEvents();
+ #endif
+
++ virtual std::string_view GetBrowserV8SnapshotFilename();
++
+ protected:
+ friend class ContentClientCreator;
+ friend class ContentClientInitializer;
diff --git a/electron34/patches/patch-content_public_browser_content__browser__client.cc b/electron34/patches/patch-content_public_browser_content__browser__client.cc
new file mode 100644
index 0000000000..2b36315e5e
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_content__browser__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/content_browser_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/content_browser_client.cc
+@@ -785,6 +785,8 @@ bool ContentBrowserClient::CanCreateWind
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::string& raw_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access) {
+@@ -1355,7 +1357,7 @@ bool ContentBrowserClient::ShouldRunOutO
+ // that can be adequately sandboxed.
+ // Currently Android's network service will not run out of process or sandboxed,
+ // so OutOfProcessSystemDnsResolution is not currently enabled on Android.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-content_public_browser_content__browser__client.h b/electron34/patches/patch-content_public_browser_content__browser__client.h
new file mode 100644
index 0000000000..41872f930a
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_content__browser__client.h
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/content_browser_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/content_browser_client.h
+@@ -195,6 +195,7 @@ class NetworkService;
+ class TrustedURLLoaderHeaderClient;
+ } // namespace mojom
+ struct ResourceRequest;
++class ResourceRequestBody;
+ } // namespace network
+
+ namespace sandbox {
+@@ -334,6 +335,11 @@ class CONTENT_EXPORT ContentBrowserClien
+
+ virtual ~ContentBrowserClient() = default;
+
++ // Electron: Registers a pending site instance during a navigation.
++ virtual void RegisterPendingSiteInstance(
++ content::RenderFrameHost* rfh,
++ content::SiteInstance* pending_site_instance) {}
++
+ // Allows the embedder to set any number of custom BrowserMainParts
+ // implementations for the browser startup code. See comments in
+ // browser_main_parts.h.
+@@ -1348,6 +1354,8 @@ class CONTENT_EXPORT ContentBrowserClien
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::string& raw_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access);
diff --git a/electron34/patches/patch-content_public_browser_desktop__media__id.h b/electron34/patches/patch-content_public_browser_desktop__media__id.h
new file mode 100644
index 0000000000..54c3a329a2
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_desktop__media__id.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/desktop_media_id.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/desktop_media_id.h
+@@ -27,6 +27,8 @@ struct CONTENT_EXPORT DesktopMediaID {
+ static constexpr Id kNullId = 0;
+ // Represents a fake id to create a dummy capturer for autotests.
+ static constexpr Id kFakeId = -3;
++ // Represents an id to use native macOS picker for screenshare
++ static constexpr Id kMacOsNativePickerId = -4;
+
+ #if defined(USE_AURA) || BUILDFLAG(IS_MAC)
+ // Assigns integer identifier to the |window| and returns its DesktopMediaID.
diff --git a/electron34/patches/patch-content_public_browser_platform__notification__service.h b/electron34/patches/patch-content_public_browser_platform__notification__service.h
new file mode 100644
index 0000000000..08c43119db
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_platform__notification__service.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/platform_notification_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/platform_notification_service.h
+@@ -26,6 +26,8 @@ struct PlatformNotificationData;
+
+ namespace content {
+
++class RenderFrameHost;
++
+ // The service using which notifications can be presented to the user. There
+ // should be a unique instance of the PlatformNotificationService depending
+ // on the browsing context being used.
+@@ -41,6 +43,7 @@ class CONTENT_EXPORT PlatformNotificatio
+ // This method must be called on the UI thread. |document_url| is empty when
+ // the display notification originates from a worker.
+ virtual void DisplayNotification(
++ RenderFrameHost* render_frame_host,
+ const std::string& notification_id,
+ const GURL& origin,
+ const GURL& document_url,
diff --git a/electron34/patches/patch-content_public_browser_render__view__host.h b/electron34/patches/patch-content_public_browser_render__view__host.h
new file mode 100644
index 0000000000..36236f3798
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_render__view__host.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/render_view_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/render_view_host.h
+@@ -75,6 +75,9 @@ class CONTENT_EXPORT RenderViewHost {
+ virtual void WriteIntoTrace(
+ perfetto::TracedProto<TraceProto> context) const = 0;
+
++ // Disable/Enable scheduler throttling.
++ virtual void SetSchedulerThrottling(bool allowed) {}
++
+ private:
+ // This interface should only be implemented inside content.
+ friend class RenderViewHostImpl;
diff --git a/electron34/patches/patch-content_public_browser_service__process__host.cc b/electron34/patches/patch-content_public_browser_service__process__host.cc
new file mode 100644
index 0000000000..4a43fb6e13
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_service__process__host.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/service_process_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/service_process_host.cc
+@@ -53,12 +53,53 @@ ServiceProcessHost::Options::WithExtraCo
+ return *this;
+ }
+
++#if BUILDFLAG(IS_WIN)
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithStdoutHandle(
++ base::win::ScopedHandle handle) {
++ stdout_handle = std::move(handle);
++ return *this;
++}
++
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithStderrHandle(
++ base::win::ScopedHandle handle) {
++ stderr_handle = std::move(handle);
++ return *this;
++}
++#elif BUILDFLAG(IS_POSIX)
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithAdditionalFds(
++ base::FileHandleMappingVector mapping) {
++ fds_to_remap = std::move(mapping);
++ return *this;
++}
++#endif
++
+ ServiceProcessHost::Options& ServiceProcessHost::Options::WithProcessCallback(
+ base::OnceCallback<void(const base::Process&)> callback) {
+ process_callback = std::move(callback);
+ return *this;
+ }
+
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithCurrentDirectory(
++ const base::FilePath& cwd) {
++ current_directory = cwd;
++ return *this;
++}
++
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithEnvironment(
++ const base::EnvironmentMap& env, bool new_environment) {
++ environment = env;
++ clear_environment = new_environment;
++ return *this;
++}
++
++#if BUILDFLAG(IS_WIN)
++ServiceProcessHost::Options& ServiceProcessHost::Options::WithFeedbackCursorOff(
++ bool turn_feedback_cursor_off) {
++ feedback_cursor_off = turn_feedback_cursor_off;
++ return *this;
++}
++#endif // #if BUILDFLAG(IS_WIN)
++
+ #if BUILDFLAG(IS_WIN)
+ ServiceProcessHost::Options&
+ ServiceProcessHost::Options::WithPreloadedLibraries(
diff --git a/electron34/patches/patch-content_public_browser_service__process__host.h b/electron34/patches/patch-content_public_browser_service__process__host.h
new file mode 100644
index 0000000000..fff2f85a10
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_service__process__host.h
@@ -0,0 +1,87 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/service_process_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/service_process_host.h
+@@ -14,6 +14,7 @@
+ #include "base/command_line.h"
+ #include "base/functional/callback.h"
+ #include "base/observer_list_types.h"
++#include "base/process/launch.h"
+ #include "base/process/process_handle.h"
+ #include "content/common/content_export.h"
+ #include "content/public/browser/service_process_info.h"
+@@ -28,6 +29,10 @@
+ #include "base/types/pass_key.h"
+ #endif // BUILDFLAG(IS_WIN)
+
++#if BUILDFLAG(IS_WIN)
++#include "base/win/scoped_handle.h"
++#endif
++
+ namespace base {
+ class Process;
+ } // namespace base
+@@ -94,11 +99,35 @@ class CONTENT_EXPORT ServiceProcessHost
+ // Specifies extra command line switches to append before launch.
+ Options& WithExtraCommandLineSwitches(std::vector<std::string> switches);
+
++#if BUILDFLAG(IS_WIN)
++ // Specifies the handles for redirection of stdout and stderr.
++ Options& WithStdoutHandle(base::win::ScopedHandle stdout_handle);
++ Options& WithStderrHandle(base::win::ScopedHandle stderr_handle);
++#elif BUILDFLAG(IS_POSIX)
++ // Specifies file descriptors to propagate into the child process
++ // based on the mapping.
++ Options& WithAdditionalFds(base::FileHandleMappingVector mapping);
++#endif
++
+ // Specifies a callback to be invoked with service process once it's
+ // launched. Will be on UI thread.
+ Options& WithProcessCallback(
+ base::OnceCallback<void(const base::Process&)>);
+
++ // Specifies the working directory for the launched process.
++ Options& WithCurrentDirectory(const base::FilePath& cwd);
++
++ // Specifies the environment that should be applied to the process.
++ // |new_environment| controls whether the process should inherit
++ // environment from the parent process.
++ Options& WithEnvironment(const base::EnvironmentMap& environment,
++ bool new_environment);
++
++#if BUILDFLAG(IS_WIN)
++ // Specifies if the process should trigger mouse cursor feedback.
++ Options& WithFeedbackCursorOff(bool feedback_cursor_off);
++#endif // #if BUILDFLAG(IS_WIN)
++
+ #if BUILDFLAG(IS_WIN)
+ // Specifies libraries to preload before the sandbox is locked down. Paths
+ // should be absolute paths. Libraries will be preloaded before sandbox
+@@ -127,11 +156,23 @@ class CONTENT_EXPORT ServiceProcessHost
+ std::optional<GURL> site;
+ std::optional<int> child_flags;
+ std::vector<std::string> extra_switches;
++#if BUILDFLAG(IS_WIN)
++ base::win::ScopedHandle stdout_handle;
++ base::win::ScopedHandle stderr_handle;
++#elif BUILDFLAG(IS_POSIX)
++ base::FileHandleMappingVector fds_to_remap;
++#endif
+ base::OnceCallback<void(const base::Process&)> process_callback;
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries;
+ #endif // BUILDFLAG(IS_WIN)
+ std::optional<bool> allow_gpu_client;
++ base::FilePath current_directory;
++ base::EnvironmentMap environment;
++ bool clear_environment = false;
++#if BUILDFLAG(IS_WIN)
++ bool feedback_cursor_off = false;
++#endif // BUILDFLAG(IS_WIN)
+ };
+
+ // An interface which can be implemented and registered/unregistered with
diff --git a/electron34/patches/patch-content_public_browser_service__process__info.h b/electron34/patches/patch-content_public_browser_service__process__info.h
new file mode 100644
index 0000000000..bf59fc2f66
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_service__process__info.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/service_process_info.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/service_process_info.h
+@@ -64,7 +64,13 @@ class CONTENT_EXPORT ServiceProcessInfo
+ const std::optional<GURL>& site() const { return site_; }
+ const base::Process& GetProcess() const { return process_; }
+
++ void set_exit_code(int exit_code) { exit_code_ = exit_code; }
++ int exit_code() const { return exit_code_; }
++
+ private:
++ // The exit code of the process, if it has exited.
++ int exit_code_ = 0;
++
+ // The name of the service interface for which the process was launched.
+ std::string service_interface_name_;
+
diff --git a/electron34/patches/patch-content_public_browser_web__contents.h b/electron34/patches/patch-content_public_browser_web__contents.h
new file mode 100644
index 0000000000..1a5e8dbd67
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_web__contents.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/web_contents.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/web_contents.h
+@@ -111,10 +111,13 @@ class BrowserPluginGuestDelegate;
+ class GuestPageHolder;
+ class RenderFrameHost;
+ class RenderViewHost;
++class RenderViewHostDelegateView;
+ class RenderWidgetHostView;
++class RenderWidgetHostViewBase;
+ class ScreenOrientationDelegate;
+ class SiteInstance;
+ class WebContentsDelegate;
++class WebContentsView;
+ class WebUI;
+ struct DropData;
+ struct MHTMLGenerationParams;
+@@ -275,6 +278,10 @@ class WebContents : public PageNavigator
+ network::mojom::WebSandboxFlags starting_sandbox_flags =
+ network::mojom::WebSandboxFlags::kNone;
+
++ // Optionally specify the view and delegate view.
++ raw_ptr<content::WebContentsView> view = nullptr;
++ raw_ptr<content::RenderViewHostDelegateView> delegate_view = nullptr;
++
+ // Value used to set the last time the WebContents was made active, this is
+ // the value that'll be returned by GetLastActiveTimeTicks(). If this is
+ // left default initialized then the value is not passed on to the
diff --git a/electron34/patches/patch-content_public_browser_web__contents__delegate.cc b/electron34/patches/patch-content_public_browser_web__contents__delegate.cc
new file mode 100644
index 0000000000..bfdfca38cd
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_web__contents__delegate.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/web_contents_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/web_contents_delegate.cc
+@@ -31,6 +31,17 @@ namespace content {
+
+ WebContentsDelegate::WebContentsDelegate() = default;
+
++void WebContentsDelegate::WebContentsCreatedWithFullParams(
++ WebContents* source_contents,
++ int opener_render_process_id,
++ int opener_render_frame_id,
++ const mojom::CreateNewWindowParams& params,
++ WebContents* new_contents) {
++ WebContentsCreated(source_contents, opener_render_process_id,
++ opener_render_frame_id, params.frame_name,
++ params.target_url, new_contents);
++}
++
+ WebContents* WebContentsDelegate::OpenURLFromTab(
+ WebContents* source,
+ const OpenURLParams& params,
+@@ -141,8 +152,7 @@ bool WebContentsDelegate::IsWebContentsC
+ SiteInstance* source_site_instance,
+ mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const mojom::CreateNewWindowParams& params) {
+ return false;
+ }
+
diff --git a/electron34/patches/patch-content_public_browser_web__contents__delegate.h b/electron34/patches/patch-content_public_browser_web__contents__delegate.h
new file mode 100644
index 0000000000..8e1cdcb3eb
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_web__contents__delegate.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/web_contents_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/web_contents_delegate.h
+@@ -18,6 +18,7 @@
+ #include "base/types/expected.h"
+ #include "build/build_config.h"
+ #include "content/common/content_export.h"
++#include "content/common/frame.mojom.h"
+ #include "content/public/browser/back_forward_transition_animation_manager.h"
+ #include "content/public/browser/eye_dropper.h"
+ #include "content/public/browser/fullscreen_types.h"
+@@ -346,8 +347,7 @@ class CONTENT_EXPORT WebContentsDelegate
+ SiteInstance* source_site_instance,
+ mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url);
++ const mojom::CreateNewWindowParams& params);
+
+ // Allow delegate to creates a custom WebContents when
+ // WebContents::CreateNewWindow() is called. This function is only called
+@@ -368,6 +368,13 @@ class CONTENT_EXPORT WebContentsDelegate
+ const StoragePartitionConfig& partition_config,
+ SessionStorageNamespace* session_storage_namespace);
+
++ virtual void WebContentsCreatedWithFullParams(
++ WebContents* source_contents,
++ int opener_render_process_id,
++ int opener_render_frame_id,
++ const mojom::CreateNewWindowParams& params,
++ WebContents* new_contents);
++
+ // Notifies the delegate about the creation of a new WebContents. This
+ // typically happens when popups are created.
+ virtual void WebContentsCreated(WebContents* source_contents,
diff --git a/electron34/patches/patch-content_public_browser_web__contents__observer.h b/electron34/patches/patch-content_public_browser_web__contents__observer.h
new file mode 100644
index 0000000000..b07f9ab59a
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_web__contents__observer.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/web_contents_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/web_contents_observer.h
+@@ -37,6 +37,7 @@
+ #include "third_party/blink/public/mojom/media/capture_handle_config.mojom-forward.h"
+ #include "third_party/skia/include/core/SkColor.h"
+ #include "ui/accessibility/ax_location_and_scroll_updates.h"
++#include "ui/base/cursor/cursor.h"
+ #include "ui/base/page_transition_types.h"
+ #include "ui/base/window_open_disposition.h"
+
+@@ -617,6 +618,9 @@ class CONTENT_EXPORT WebContentsObserver
+ // Invoked when the primary main frame changes size.
+ virtual void PrimaryMainFrameWasResized(bool width_changed) {}
+
++ // Invoked every time the RenderWidget's cursor changes.
++ virtual void OnCursorChanged(const ui::Cursor& cursor) {}
++
+ // Invoked when the given frame changes its window.name property.
+ virtual void FrameNameChanged(RenderFrameHost* render_frame_host,
+ const std::string& name) {}
diff --git a/electron34/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h b/electron34/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h
new file mode 100644
index 0000000000..fdc08142a3
--- /dev/null
+++ b/electron34/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/browser/zygote_host/zygote_host_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/browser/zygote_host/zygote_host_linux.h
+@@ -35,11 +35,13 @@ class ZygoteHost {
+ // after the first render has been forked.
+ virtual int GetRendererSandboxStatus() = 0;
+
++#if !BUILDFLAG(IS_BSD)
+ // Adjust the OOM score of the given renderer's PID. The allowed
+ // range for the score is [0, 1000], where higher values are more
+ // likely to be killed by the OOM killer.
+ virtual void AdjustRendererOOMScore(base::ProcessHandle process_handle,
+ int score) = 0;
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS)
+ // Reinitialize logging for the Zygote processes. Needed on ChromeOS, which
diff --git a/electron34/patches/patch-content_public_common_BUILD.gn b/electron34/patches/patch-content_public_common_BUILD.gn
new file mode 100644
index 0000000000..1b078dc172
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/BUILD.gn
+@@ -377,6 +377,8 @@ mojom("interfaces") {
+ "//content/common/*",
+ "//extensions/common:mojom",
+ "//extensions/common:mojom_blink",
++ "//electron/shell/common:plugin",
++ "//electron/shell/common:web_contents_utility",
+ ]
+
+ sources = [
diff --git a/electron34/patches/patch-content_public_common_content__client.h b/electron34/patches/patch-content_public_common_content__client.h
new file mode 100644
index 0000000000..a0c6f335fd
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_content__client.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/content_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/content_client.h
+@@ -142,6 +142,9 @@ class CONTENT_EXPORT ContentClient {
+ // Registers a URL scheme as strictly empty documents, allowing them to
+ // commit synchronously.
+ std::vector<std::string> empty_document_schemes;
++ // Registers a URL scheme whose js and wasm scripts have V8 code cache
++ // enabled.
++ std::vector<std::string> code_cache_schemes;
+ // Registers a URL scheme as extension scheme.
+ std::vector<std::string> extension_schemes;
+ // Registers a URL scheme with a predefined default custom handler.
diff --git a/electron34/patches/patch-content_public_common_content__features.cc b/electron34/patches/patch-content_public_common_content__features.cc
new file mode 100644
index 0000000000..e8aa2bef94
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_content__features.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/content_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/content_features.cc
+@@ -72,7 +72,7 @@ BASE_FEATURE(kAudioServiceOutOfProcess,
+ // TODO(crbug.com/40118868): Remove !IS_CHROMEOS_LACROS once lacros starts being
+ // built with OS_CHROMEOS instead of OS_LINUX.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+- (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -1278,9 +1278,9 @@ BASE_FEATURE(kWebAssemblyTiering,
+ BASE_FEATURE(kWebAssemblyTrapHandler,
+ "WebAssemblyTrapHandler",
+ #if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)) && \
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)) && \
+ defined(ARCH_CPU_X86_64)) || \
+- ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)) && \
++ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)) && \
+ defined(ARCH_CPU_ARM64))
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+@@ -1317,7 +1317,11 @@ BASE_FEATURE(kWebUICodeCache,
+
+ // Controls whether the WebUSB API is enabled:
+ // https://wicg.github.io/webusb
++#if BUILDFLAG(IS_BSD)
++BASE_FEATURE(kWebUsb, "WebUSB", base::FEATURE_DISABLED_BY_DEFAULT);
++#else
+ BASE_FEATURE(kWebUsb, "WebUSB", base::FEATURE_ENABLED_BY_DEFAULT);
++#endif
+
+ // Controls whether the WebXR Device API is enabled.
+ BASE_FEATURE(kWebXr, "WebXR", base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-content_public_common_content__switches.cc b/electron34/patches/patch-content_public_common_content__switches.cc
new file mode 100644
index 0000000000..f12363cb43
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_content__switches.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/content_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/content_switches.cc
+@@ -347,6 +347,8 @@ const char kEnableIsolatedWebAppsInRende
+ // builds.
+ const char kEnableLogging[] = "enable-logging";
+
++const char kDisableUnveil[] = "disable-unveil";
++
+ // Enables the type, downlinkMax attributes of the NetInfo API. Also, enables
+ // triggering of change attribute of the NetInfo API when there is a change in
+ // the connection type.
+@@ -954,7 +956,7 @@ const char kPreventResizingContentsForTe
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Allows sending text-to-speech requests to speech-dispatcher, a common
+ // Linux speech service. Because it's buggy, the user must explicitly
+ // enable it so that visiting a random webpage can't cause instability.
diff --git a/electron34/patches/patch-content_public_common_content__switches.h b/electron34/patches/patch-content_public_common_content__switches.h
new file mode 100644
index 0000000000..211d42f7ca
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_content__switches.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/content_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/content_switches.h
+@@ -109,6 +109,7 @@ CONTENT_EXPORT extern const char kEnable
+ CONTENT_EXPORT extern const char kEnableIsolatedWebAppsInRenderer[];
+ CONTENT_EXPORT extern const char kEnableLCDText[];
+ CONTENT_EXPORT extern const char kEnableLogging[];
++CONTENT_EXPORT extern const char kDisableUnveil[];
+ CONTENT_EXPORT extern const char kEnableNetworkInformationDownlinkMax[];
+ CONTENT_EXPORT extern const char kEnableCanvas2DLayers[];
+ CONTENT_EXPORT extern const char kEnablePluginPlaceholderTesting[];
+@@ -262,7 +263,7 @@ CONTENT_EXPORT extern const char kPreven
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ CONTENT_EXPORT extern const char kEnableSpeechDispatcher[];
+ CONTENT_EXPORT extern const char kLLVMProfileFile[];
+ #endif
diff --git a/electron34/patches/patch-content_public_common_sandbox__init__win.h b/electron34/patches/patch-content_public_common_sandbox__init__win.h
new file mode 100644
index 0000000000..dff48be222
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_sandbox__init__win.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/sandbox_init_win.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/sandbox_init_win.h
+@@ -29,7 +29,7 @@ class SandboxedProcessLauncherDelegate;
+ CONTENT_EXPORT sandbox::ResultCode StartSandboxedProcess(
+ SandboxedProcessLauncherDelegate* delegate,
+ const base::CommandLine& target_command_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ sandbox::StartSandboxedProcessCallback result_callback);
+
+ } // namespace content
diff --git a/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc b/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc
new file mode 100644
index 0000000000..764d50a4df
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/sandboxed_process_launcher_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/sandboxed_process_launcher_delegate.cc
+@@ -70,11 +70,23 @@ ZygoteCommunication* SandboxedProcessLau
+ }
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
+-#if BUILDFLAG(IS_POSIX)
+ base::EnvironmentMap SandboxedProcessLauncherDelegate::GetEnvironment() {
+ return base::EnvironmentMap();
+ }
+-#endif // BUILDFLAG(IS_POSIX)
++
++bool SandboxedProcessLauncherDelegate::ShouldInheritEnvironment() {
++ return true;
++}
++
++base::FilePath SandboxedProcessLauncherDelegate::GetCurrentDirectory() {
++ return base::FilePath();
++}
++
++#if BUILDFLAG(IS_WIN)
++bool SandboxedProcessLauncherDelegate::ShouldShowFeedbackCursor() {
++ return true;
++}
++#endif // #if BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_MAC)
+
diff --git a/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h b/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h
new file mode 100644
index 0000000000..64f3485db4
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/sandboxed_process_launcher_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/sandboxed_process_launcher_delegate.h
+@@ -8,6 +8,7 @@
+ #include <optional>
+
+ #include "base/environment.h"
++#include "base/files/file_path.h"
+ #include "base/files/scoped_file.h"
+ #include "base/process/process.h"
+ #include "build/build_config.h"
+@@ -62,10 +63,19 @@ class CONTENT_EXPORT SandboxedProcessLau
+ virtual ZygoteCommunication* GetZygote();
+ #endif // BUILDFLAG(USE_ZYGOTE)
+
+-#if BUILDFLAG(IS_POSIX)
+ // Override this if the process needs a non-empty environment map.
+ virtual base::EnvironmentMap GetEnvironment();
+-#endif // BUILDFLAG(IS_POSIX)
++
++ // Override this if the process should not inherit parent environment.
++ virtual bool ShouldInheritEnvironment();
++
++ // Specifies the directory to change to before executing the process.
++ virtual base::FilePath GetCurrentDirectory();
++
++#if BUILDFLAG(IS_WIN)
++ // Override this if the process should not trigger mouse cursor feedback.
++ virtual bool ShouldShowFeedbackCursor();
++#endif // #if BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_MAC)
+ // Whether or not to disclaim TCC responsibility for the process, defaults to
diff --git a/electron34/patches/patch-content_public_common_zygote_features.gni b/electron34/patches/patch-content_public_common_zygote_features.gni
new file mode 100644
index 0000000000..6fbdf86fa5
--- /dev/null
+++ b/electron34/patches/patch-content_public_common_zygote_features.gni
@@ -0,0 +1,14 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/common/zygote/features.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/common/zygote/features.gni
+@@ -2,4 +2,4 @@
+ # Use of this source code is governed by a BSD-style license that can be
+ # found in the LICENSE file.
+
+-use_zygote = is_posix && !is_android && !is_apple
++use_zygote = is_posix && !is_android && !is_mac && !is_bsd
diff --git a/electron34/patches/patch-content_public_gpu_content__gpu__client.h b/electron34/patches/patch-content_public_gpu_content__gpu__client.h
new file mode 100644
index 0000000000..d839111fdc
--- /dev/null
+++ b/electron34/patches/patch-content_public_gpu_content__gpu__client.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/gpu/content_gpu_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/gpu/content_gpu_client.h
+@@ -31,6 +31,10 @@ class CONTENT_EXPORT ContentGpuClient {
+ public:
+ virtual ~ContentGpuClient() {}
+
++ // Allows the embedder to perform platform-specific initialization before
++ // creating the message loop.
++ virtual void PreCreateMessageLoop() {}
++
+ // Called during initialization once the GpuService has been initialized.
+ virtual void GpuServiceInitialized() {}
+
diff --git a/electron34/patches/patch-content_public_renderer_content__renderer__client.h b/electron34/patches/patch-content_public_renderer_content__renderer__client.h
new file mode 100644
index 0000000000..dcfdcecf7a
--- /dev/null
+++ b/electron34/patches/patch-content_public_renderer_content__renderer__client.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/renderer/content_renderer_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/renderer/content_renderer_client.h
+@@ -417,6 +417,16 @@ class CONTENT_EXPORT ContentRendererClie
+ virtual void DidInitializeWorkerContextOnWorkerThread(
+ v8::Local<v8::Context> context) {}
+
++ // Notifies that a worker script has been downloaded, scope initialized and
++ // ready for evaluation. This function is called from the worker thread.
++ virtual void WorkerScriptReadyForEvaluationOnWorkerThread(
++ v8::Local<v8::Context> context) {}
++
++ // Notifies that a worker context will be destroyed. This function is called
++ // from the worker thread.
++ virtual void WillDestroyWorkerContextOnWorkerThread(
++ v8::Local<v8::Context> context) {}
++
+ // Overwrites the given URL to use an HTML5 embed if possible.
+ // An empty URL is returned if the URL is not overriden.
+ virtual GURL OverrideFlashEmbedWithHTML(const GURL& url);
diff --git a/electron34/patches/patch-content_public_renderer_render__frame__observer.h b/electron34/patches/patch-content_public_renderer_render__frame__observer.h
new file mode 100644
index 0000000000..057c260ea4
--- /dev/null
+++ b/electron34/patches/patch-content_public_renderer_render__frame__observer.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/public/renderer/render_frame_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/public/renderer/render_frame_observer.h
+@@ -150,6 +150,8 @@ class CONTENT_EXPORT RenderFrameObserver
+ virtual void DidHandleOnloadEvents() {}
+ virtual void DidCreateScriptContext(v8::Local<v8::Context> context,
+ int32_t world_id) {}
++ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
++ int32_t world_id) {}
+ virtual void WillReleaseScriptContext(v8::Local<v8::Context> context,
+ int32_t world_id) {}
+ virtual void DidClearWindowObject() {}
diff --git a/electron34/patches/patch-content_renderer_BUILD.gn b/electron34/patches/patch-content_renderer_BUILD.gn
new file mode 100644
index 0000000000..2989b9efd6
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/BUILD.gn
+@@ -334,6 +334,7 @@ target(link_target_type, "renderer") {
+ "//ui/surface",
+ "//url",
+ "//v8",
++ "//electron/build/config:generate_mas_config",
+ ]
+ allow_circular_includes_from = []
+
diff --git a/electron34/patches/patch-content_renderer_render__frame__impl.cc b/electron34/patches/patch-content_renderer_render__frame__impl.cc
new file mode 100644
index 0000000000..32fc741fca
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_render__frame__impl.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/render_frame_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/render_frame_impl.cc
+@@ -4792,6 +4792,12 @@ void RenderFrameImpl::DidCreateScriptCon
+ observer.DidCreateScriptContext(context, world_id);
+ }
+
++void RenderFrameImpl::DidInstallConditionalFeatures(
++ v8::Local<v8::Context> context, int world_id) {
++ for (auto& observer : observers_)
++ observer.DidInstallConditionalFeatures(context, world_id);
++}
++
+ void RenderFrameImpl::WillReleaseScriptContext(v8::Local<v8::Context> context,
+ int world_id) {
+ for (auto& observer : observers_)
+@@ -6865,6 +6871,10 @@ WebView* RenderFrameImpl::CreateNewWindo
+ request.HasUserGesture(), GetWebFrame()->IsAdFrame(),
+ GetWebFrame()->IsAdScriptInStack());
+
++ params->raw_features = features.raw_features.Utf8(
++ WTF::UTF8ConversionMode::kStrictUTF8ConversionReplacingUnpairedSurrogatesWithFFFD);
++ params->body = GetRequestBodyForWebURLRequest(request);
++
+ // We preserve this information before sending the message since |params| is
+ // moved on send.
+ bool is_background_tab =
diff --git a/electron34/patches/patch-content_renderer_render__frame__impl.h b/electron34/patches/patch-content_renderer_render__frame__impl.h
new file mode 100644
index 0000000000..85503c2020
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_render__frame__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/render_frame_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/render_frame_impl.h
+@@ -651,6 +651,8 @@ class CONTENT_EXPORT RenderFrameImpl
+ void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
+ void DidCreateScriptContext(v8::Local<v8::Context> context,
+ int world_id) override;
++ void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
++ int world_id) override;
+ void WillReleaseScriptContext(v8::Local<v8::Context> context,
+ int world_id) override;
+ void DidChangeScrollOffset() override;
diff --git a/electron34/patches/patch-content_renderer_render__process__impl.cc b/electron34/patches/patch-content_renderer_render__process__impl.cc
new file mode 100644
index 0000000000..dbae67c8f6
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_render__process__impl.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/render_process_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/render_process_impl.cc
+@@ -200,6 +200,9 @@ RenderProcessImpl::RenderProcessImpl()
+ v8::V8::SetFlagsFromString(kSABPerContextFlag, sizeof(kSABPerContextFlag));
+ }
+
++ // Freezing flags after init conflicts with node in the renderer.
++ v8::V8::SetFlagsFromString("--no-freeze-flags-after-init");
++
+ if (base::FeatureList::IsEnabled(features::kWebAssemblyTrapHandler)) {
+ content::GetContentClient()->renderer()->SetUpWebAssemblyTrapHandler();
+ }
diff --git a/electron34/patches/patch-content_renderer_render__thread__impl.cc b/electron34/patches/patch-content_renderer_render__thread__impl.cc
new file mode 100644
index 0000000000..763c6ef972
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_render__thread__impl.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/render_thread_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/render_thread_impl.cc
+@@ -212,6 +212,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_BSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -1046,7 +1048,7 @@ media::GpuVideoAcceleratorFactories* Ren
+ kGpuStreamIdMedia, kGpuStreamPriorityMedia);
+
+ const bool enable_video_decode_accelerator =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FeatureList::IsEnabled(media::kAcceleratedVideoDecodeLinux) &&
+ #endif // BUILDFLAG(IS_LINUX)
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
+@@ -1055,7 +1057,7 @@ media::GpuVideoAcceleratorFactories* Ren
+ gpu::kGpuFeatureStatusEnabled);
+
+ const bool enable_video_encode_accelerator =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FeatureList::IsEnabled(media::kAcceleratedVideoEncodeLinux) &&
+ #else
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoEncode) &&
+@@ -1306,7 +1308,7 @@ bool RenderThreadImpl::IsLcdTextEnabled(
+ }
+
+ bool RenderThreadImpl::IsElasticOverscrollEnabled() {
+- return is_elastic_overscroll_enabled_;
++ return base::CommandLine::ForCurrentProcess()->HasSwitch("scroll-bounce");
+ }
+
+ gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() {
+@@ -1850,7 +1852,7 @@ std::unique_ptr<CodecFactory> RenderThre
+ bool enable_video_encode_accelerator) {
+ mojo::PendingRemote<media::mojom::VideoEncodeAcceleratorProvider>
+ vea_provider;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(media::kUseOutOfProcessVideoEncoding)) {
+ BindHostReceiver(vea_provider.InitWithNewPipeAndPassReceiver());
+ } else {
diff --git a/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.cc b/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.cc
new file mode 100644
index 0000000000..4f7fbb8c91
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.cc
@@ -0,0 +1,76 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/renderer_blink_platform_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/renderer_blink_platform_impl.cc
+@@ -127,7 +127,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+@@ -196,13 +196,13 @@ RendererBlinkPlatformImpl::RendererBlink
+ is_locked_to_site_(false),
+ main_thread_scheduler_(main_thread_scheduler),
+ next_frame_sink_id_(uint32_t{std::numeric_limits<int32_t>::max()} + 1) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ sk_sp<font_service::FontLoader> font_loader;
+ #endif
+
+ // RenderThread may not exist in some tests.
+ if (RenderThreadImpl::current()) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ RenderThreadImpl::current()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -222,7 +222,7 @@ RendererBlinkPlatformImpl::RendererBlink
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (sandboxEnabled()) {
+ #if BUILDFLAG(IS_MAC)
+ sandbox_support_ = std::make_unique<WebSandboxSupportMac>();
+@@ -283,7 +283,7 @@ void RendererBlinkPlatformImpl::SetThrea
+ #endif
+
+ blink::WebSandboxSupport* RendererBlinkPlatformImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ // These platforms do not require sandbox support.
+@@ -875,12 +875,24 @@ void RendererBlinkPlatformImpl::WillStop
+ WorkerThreadRegistry::Instance()->WillStopCurrentWorkerThread();
+ }
+
++void RendererBlinkPlatformImpl::WorkerContextWillDestroy(
++ const v8::Local<v8::Context>& worker) {
++ GetContentClient()->renderer()->WillDestroyWorkerContextOnWorkerThread(
++ worker);
++}
++
+ void RendererBlinkPlatformImpl::WorkerContextCreated(
+ const v8::Local<v8::Context>& worker) {
+ GetContentClient()->renderer()->DidInitializeWorkerContextOnWorkerThread(
+ worker);
+ }
+
++void RendererBlinkPlatformImpl::WorkerScriptReadyForEvaluation(
++ const v8::Local<v8::Context>& worker) {
++ GetContentClient()->renderer()->WorkerScriptReadyForEvaluationOnWorkerThread(
++ worker);
++}
++
+ bool RendererBlinkPlatformImpl::AllowScriptExtensionForServiceWorker(
+ const blink::WebSecurityOrigin& script_origin) {
+ return GetContentClient()->renderer()->AllowScriptExtensionForServiceWorker(
diff --git a/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.h b/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.h
new file mode 100644
index 0000000000..45720a4779
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_renderer__blink__platform__impl.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/renderer_blink_platform_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/renderer_blink_platform_impl.h
+@@ -194,6 +194,9 @@ class CONTENT_EXPORT RendererBlinkPlatfo
+ void DidStartWorkerThread() override;
+ void WillStopWorkerThread() override;
+ void WorkerContextCreated(const v8::Local<v8::Context>& worker) override;
++ void WorkerScriptReadyForEvaluation(
++ const v8::Local<v8::Context>& worker) override;
++ void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) override;
+ bool AllowScriptExtensionForServiceWorker(
+ const blink::WebSecurityOrigin& script_origin) override;
+ blink::ProtocolHandlerSecurityLevel GetProtocolHandlerSecurityLevel(
+@@ -254,7 +257,7 @@ class CONTENT_EXPORT RendererBlinkPlatfo
+ void Collect3DContextInformation(blink::Platform::GraphicsInfo* gl_info,
+ const gpu::GPUInfo& gpu_info) const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+
diff --git a/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc b/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc
new file mode 100644
index 0000000000..c5fe818e52
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/renderer_main_platform_delegate_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/renderer_main_platform_delegate_linux.cc
+@@ -44,6 +44,7 @@ bool RendererMainPlatformDelegate::Enabl
+ // any renderer has been started.
+ // Here, we test that the status of SeccompBpf in the renderer is consistent
+ // with what SandboxLinux::GetStatus() said we would do.
++#if !BUILDFLAG(IS_BSD)
+ auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance();
+ if (linux_sandbox->GetStatus() & sandbox::policy::SandboxLinux::kSeccompBPF) {
+ CHECK(linux_sandbox->seccomp_bpf_started());
+@@ -65,6 +66,7 @@ bool RendererMainPlatformDelegate::Enabl
+ CHECK_EQ(errno, EPERM);
+ }
+ #endif // __x86_64__
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm b/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
new file mode 100644
index 0000000000..e978d8492e
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/renderer_main_platform_delegate_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/renderer_main_platform_delegate_mac.mm
+@@ -7,12 +7,15 @@
+ #import <Cocoa/Cocoa.h>
+
+ #include "base/check_op.h"
++#include "electron/mas.h"
+ #include "sandbox/mac/seatbelt.h"
+ #include "sandbox/mac/system_services.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ CGError CGSSetDenyWindowServerConnections(bool);
+ }
++#endif
+
+ namespace content {
+
+@@ -22,6 +25,7 @@ namespace {
+ // verifies there are no existing open connections), and then indicates that
+ // Chrome should continue execution without access to launchservicesd.
+ void DisableSystemServices() {
++#if !IS_MAS_BUILD()
+ // Tell the WindowServer that we don't want to make any future connections.
+ // This will return Success as long as there are no open connections, which
+ // is what we want.
+@@ -30,6 +34,7 @@ void DisableSystemServices() {
+
+ sandbox::DisableLaunchServices();
+ sandbox::DisableCoreServicesCheckFix();
++#endif
+ }
+
+ } // namespace
diff --git a/electron34/patches/patch-content_renderer_theme__helper__mac.mm b/electron34/patches/patch-content_renderer_theme__helper__mac.mm
new file mode 100644
index 0000000000..400d1f3d91
--- /dev/null
+++ b/electron34/patches/patch-content_renderer_theme__helper__mac.mm
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/renderer/theme_helper_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/renderer/theme_helper_mac.mm
+@@ -7,16 +7,28 @@
+ #include <Cocoa/Cocoa.h>
+
+ #include "base/strings/sys_string_conversions.h"
++#include "electron/mas.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ bool CGFontRenderingGetFontSmoothingDisabled(void);
+ }
+-
++#endif
+ namespace content {
+
+ bool IsSubpixelAntialiasingAvailable() {
++#if !IS_MAS_BUILD()
+ // See https://trac.webkit.org/changeset/239306/webkit for more info.
+ return !CGFontRenderingGetFontSmoothingDisabled();
++#else
++ NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
++ NSString *default_key = @"CGFontRenderingGetFontSmoothingDisabled";
++ // Check that key exists since boolForKey defaults to NO when the
++ // key is missing and this key in fact defaults to YES;
++ if ([defaults objectForKey:default_key] == nil)
++ return false;
++ return ![defaults boolForKey:default_key];
++#endif
+ }
+
+ } // namespace content
diff --git a/electron34/patches/patch-content_shell_BUILD.gn b/electron34/patches/patch-content_shell_BUILD.gn
new file mode 100644
index 0000000000..37980257b5
--- /dev/null
+++ b/electron34/patches/patch-content_shell_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/BUILD.gn
+@@ -1087,7 +1087,7 @@ group("content_shell_crash_test") {
+ if (is_win) {
+ data_deps += [ "//build/win:copy_cdb_to_output" ]
+ }
+- if (is_posix) {
++ if (is_posix && !is_bsd) {
+ data_deps += [
+ "//third_party/breakpad:dump_syms",
+ "//third_party/breakpad:minidump_stackwalk",
diff --git a/electron34/patches/patch-content_shell_app_shell__main__delegate.cc b/electron34/patches/patch-content_shell_app_shell__main__delegate.cc
new file mode 100644
index 0000000000..e6d4c06f5e
--- /dev/null
+++ b/electron34/patches/patch-content_shell_app_shell__main__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/app/shell_main_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/app/shell_main_delegate.cc
+@@ -269,7 +269,7 @@ void ShellMainDelegate::PreSandboxStartu
+ // Reporting for sub-processes will be initialized in ZygoteForked.
+ if (process_type != switches::kZygoteProcess) {
+ crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ crash_reporter::SetFirstChanceExceptionHandler(
+ v8::TryHandleWebAssemblyTrapPosix);
+ #endif
diff --git a/electron34/patches/patch-content_shell_browser_shell__browser__main__parts.cc b/electron34/patches/patch-content_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 0000000000..74254c6584
--- /dev/null
+++ b/electron34/patches/patch-content_shell_browser_shell__browser__main__parts.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/browser/shell_browser_main_parts.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/browser/shell_browser_main_parts.cc
+@@ -51,7 +51,7 @@
+ #include "net/base/network_change_notifier.h"
+ #endif
+
+-#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ #include "ui/base/ime/init/input_method_initializer.h"
+ #endif
+
+@@ -68,7 +68,7 @@
+ #include "chromeos/lacros/dbus/lacros_dbus_thread_manager.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h" // nogncheck
+ #include "ui/linux/linux_ui_factory.h" // nogncheck
+ #endif
+@@ -139,7 +139,7 @@ void ShellBrowserMainParts::PostCreateMa
+ }
+
+ int ShellBrowserMainParts::PreEarlyInitialization() {
+-#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ ui::InitializeInputMethodForTesting();
+ #endif
+ #if BUILDFLAG(IS_ANDROID)
+@@ -168,7 +168,7 @@ void ShellBrowserMainParts::ToolkitIniti
+ if (switches::IsRunWebTestsSwitchPresent())
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::LinuxUi::SetInstance(ui::GetDefaultLinuxUi());
+ #endif
+ }
+@@ -215,7 +215,7 @@ void ShellBrowserMainParts::PostMainMess
+ ShellDevToolsManagerDelegate::StopHttpHandler();
+ browser_context_.reset();
+ off_the_record_browser_context_.reset();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::LinuxUi::SetInstance(nullptr);
+ #endif
+ performance_manager_lifetime_.reset();
diff --git a/electron34/patches/patch-content_shell_browser_shell__paths.cc b/electron34/patches/patch-content_shell_browser_shell__paths.cc
new file mode 100644
index 0000000000..481293f04b
--- /dev/null
+++ b/electron34/patches/patch-content_shell_browser_shell__paths.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/browser/shell_paths.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/browser/shell_paths.cc
+@@ -13,7 +13,7 @@
+
+ #if BUILDFLAG(IS_FUCHSIA)
+ #include "base/fuchsia/file_utils.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #endif
+
+@@ -25,7 +25,7 @@ bool GetDefaultUserDataDirectory(base::F
+ #if BUILDFLAG(IS_WIN)
+ CHECK(base::PathService::Get(base::DIR_LOCAL_APP_DATA, result));
+ *result = result->Append(std::wstring(L"content_shell"));
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ base::FilePath config_dir(base::nix::GetXDGDirectory(
+ env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir));
diff --git a/electron34/patches/patch-content_shell_renderer_shell__content__renderer__client.cc b/electron34/patches/patch-content_shell_renderer_shell__content__renderer__client.cc
new file mode 100644
index 0000000000..5d61809077
--- /dev/null
+++ b/electron34/patches/patch-content_shell_renderer_shell__content__renderer__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/renderer/shell_content_renderer_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/renderer/shell_content_renderer_client.cc
+@@ -54,7 +54,7 @@
+ #include "media/base/media_switches.h"
+ #endif
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ (defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_ARM64))
+ #define ENABLE_WEB_ASSEMBLY_TRAP_HANDLER_LINUX
+ #include "base/debug/stack_trace.h"
diff --git a/electron34/patches/patch-content_shell_utility_shell__content__utility__client.cc b/electron34/patches/patch-content_shell_utility_shell__content__utility__client.cc
new file mode 100644
index 0000000000..e1579307ac
--- /dev/null
+++ b/electron34/patches/patch-content_shell_utility_shell__content__utility__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/shell/utility/shell_content_utility_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/shell/utility/shell_content_utility_client.cc
+@@ -38,7 +38,7 @@
+ #include "sandbox/policy/sandbox.h"
+ #include "services/test/echo/echo_service.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/test/sandbox_status_service.h"
+ #endif
+
+@@ -187,7 +187,7 @@ void ShellContentUtilityClient::ExposeIn
+ binders->Add<mojom::PowerMonitorTest>(
+ base::BindRepeating(&PowerMonitorTestImpl::MakeSelfOwnedReceiver),
+ base::SingleThreadTaskRunner::GetCurrentDefault());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (register_sandbox_status_helper_) {
+ binders->Add<content::mojom::SandboxStatusService>(
+ base::BindRepeating(
diff --git a/electron34/patches/patch-content_test_BUILD.gn b/electron34/patches/patch-content_test_BUILD.gn
new file mode 100644
index 0000000000..4653c61bf3
--- /dev/null
+++ b/electron34/patches/patch-content_test_BUILD.gn
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/test/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/test/BUILD.gn
+@@ -643,6 +643,7 @@ static_library("test_support") {
+ "//url",
+ "//url/mojom:url_mojom_gurl",
+ "//v8",
++ "//electron/build/config:generate_mas_config"
+ ]
+
+ data_deps = [
+@@ -1112,6 +1113,7 @@ static_library("browsertest_support") {
+ }
+
+ configs += [ "//v8:external_startup_data" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ mojom("content_test_mojo_bindings") {
+@@ -1772,7 +1774,7 @@ test("content_browsertests") {
+ "../test/url_loader_interceptor_browsertest.cc",
+ ]
+
+- if (is_linux) {
++ if ((is_linux) && !is_bsd) {
+ sources += [ "../browser/network/address_map_linux_browsertest.cc" ]
+ }
+
+@@ -1953,6 +1955,7 @@ test("content_browsertests") {
+ "//ui/shell_dialogs",
+ "//ui/snapshot",
+ "//ui/webui:test_support",
++ "//electron/build/config:generate_mas_config"
+ ]
+
+ if (!(is_chromeos_ash && target_cpu == "arm64" && current_cpu == "arm")) {
+@@ -3236,6 +3239,7 @@ test("content_unittests") {
+ "//ui/latency:test_support",
+ "//ui/shell_dialogs:shell_dialogs",
+ "//ui/webui:test_support",
++ "//electron/build/config:generate_mas_config"
+ ]
+
+ if (enable_nocompile_tests) {
diff --git a/electron34/patches/patch-content_test_mock__platform__notification__service.cc b/electron34/patches/patch-content_test_mock__platform__notification__service.cc
new file mode 100644
index 0000000000..94ef0f53a4
--- /dev/null
+++ b/electron34/patches/patch-content_test_mock__platform__notification__service.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/test/mock_platform_notification_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/test/mock_platform_notification_service.cc
+@@ -29,6 +29,7 @@ MockPlatformNotificationService::MockPla
+ MockPlatformNotificationService::~MockPlatformNotificationService() = default;
+
+ void MockPlatformNotificationService::DisplayNotification(
++ RenderFrameHost* render_frame_host,
+ const std::string& notification_id,
+ const GURL& origin,
+ const GURL& document_url,
diff --git a/electron34/patches/patch-content_test_mock__platform__notification__service.h b/electron34/patches/patch-content_test_mock__platform__notification__service.h
new file mode 100644
index 0000000000..a94ab3e8dc
--- /dev/null
+++ b/electron34/patches/patch-content_test_mock__platform__notification__service.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/test/mock_platform_notification_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/test/mock_platform_notification_service.h
+@@ -53,6 +53,7 @@ class MockPlatformNotificationService :
+
+ // PlatformNotificationService implementation.
+ void DisplayNotification(
++ RenderFrameHost* render_frame_host,
+ const std::string& notification_id,
+ const GURL& origin,
+ const GURL& document_url,
diff --git a/electron34/patches/patch-content_test_test__page__broadcast.h b/electron34/patches/patch-content_test_test__page__broadcast.h
new file mode 100644
index 0000000000..73e7b63fc5
--- /dev/null
+++ b/electron34/patches/patch-content_test_test__page__broadcast.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/test/test_page_broadcast.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/test/test_page_broadcast.h
+@@ -50,6 +50,7 @@ class TestPageBroadcast : public blink::
+ network::mojom::AttributionSupport support) override;
+ void UpdateColorProviders(
+ const blink::ColorProviderColorMaps& color_provider_colors) override;
++ void SetSchedulerThrottling(bool allowed) override {}
+
+ mojo::AssociatedReceiver<blink::mojom::PageBroadcast> receiver_;
+ };
diff --git a/electron34/patches/patch-content_utility_services.cc b/electron34/patches/patch-content_utility_services.cc
new file mode 100644
index 0000000000..178ab535b2
--- /dev/null
+++ b/electron34/patches/patch-content_utility_services.cc
@@ -0,0 +1,80 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/services.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/services.cc
+@@ -74,7 +74,7 @@
+ extern sandbox::TargetServices* g_utility_target_services;
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "media/mojo/services/mojo_video_encode_accelerator_provider_factory.h"
+ #include "sandbox/linux/services/libc_interceptor.h"
+ #include "sandbox/policy/mojom/sandbox.mojom.h"
+@@ -102,7 +102,7 @@ extern sandbox::TargetServices* g_utilit
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ #include "content/common/features.h"
+ #include "media/mojo/services/stable_video_decoder_factory_process_service.h" // nogncheck
+@@ -238,7 +238,7 @@ auto RunAudio(mojo::PendingReceiver<audi
+ << "task_policy_set TASK_QOS_POLICY";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auto* command_line = base::CommandLine::ForCurrentProcess();
+ if (sandbox::policy::SandboxTypeFromCommandLine(*command_line) ==
+ sandbox::mojom::Sandbox::kNoSandbox) {
+@@ -388,7 +388,7 @@ auto RunOOPArcVideoAcceleratorFactorySer
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ auto RunStableVideoDecoderFactoryProcessService(
+ mojo::PendingReceiver<
+@@ -399,7 +399,7 @@ auto RunStableVideoDecoderFactoryProcess
+ #endif // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) &&
+ // (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ auto RunVideoEncodeAcceleratorProviderFactory(
+ mojo::PendingReceiver<media::mojom::VideoEncodeAcceleratorProviderFactory>
+ receiver) {
+@@ -422,7 +422,7 @@ void RegisterIOThreadServices(mojo::Serv
+ // loop of type IO that can get notified when pipes have data.
+ services.Add(RunNetworkService);
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ if (base::FeatureList::IsEnabled(
+ features::kRunStableVideoDecoderFactoryProcessServiceOnIOThread)) {
+@@ -478,7 +478,7 @@ void RegisterMainThreadServices(mojo::Se
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH) && (BUILDFLAG(USE_VAAPI) ||
+ // BUILDFLAG(USE_V4L2_CODEC))
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)) && \
+ (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+ if (!base::FeatureList::IsEnabled(
+ features::kRunStableVideoDecoderFactoryProcessServiceOnIOThread)) {
+@@ -487,7 +487,7 @@ void RegisterMainThreadServices(mojo::Se
+ #endif // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)) &&
+ // (BUILDFLAG(USE_VAAPI) || BUILDFLAG(USE_V4L2_CODEC))
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ services.Add(RunVideoEncodeAcceleratorProviderFactory);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc b/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..1093cc50ae
--- /dev/null
+++ b/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/speech/speech_recognition_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/speech/speech_recognition_sandbox_hook_linux.cc
+@@ -12,11 +12,14 @@
+ #include "sandbox/linux/syscall_broker/broker_command.h"
+ #include "sandbox/linux/syscall_broker/broker_file_permission.h"
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace speech {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ // Gets the file permissions required by the Speech On-Device API (SODA).
+@@ -50,9 +53,11 @@ std::vector<BrokerFilePermission> GetSod
+ }
+
+ } // namespace
++#endif
+
+ bool SpeechRecognitionPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(ENABLE_SODA_INTEGRATION_TESTS)
+ base::FilePath test_binary_path = GetSodaTestBinaryPath();
+ DVLOG(0) << "SODA test binary path: " << test_binary_path.value().c_str();
+@@ -75,6 +80,7 @@ bool SpeechRecognitionPreSandboxHook(
+ }),
+ GetSodaFilePermissions(), options);
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h b/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
new file mode 100644
index 0000000000..1115d0915e
--- /dev/null
+++ b/electron34/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/speech/speech_recognition_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/speech/speech_recognition_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef CONTENT_UTILITY_SPEECH_SPEECH_RECOGNITION_SANDBOX_HOOK_LINUX_H_
+ #define CONTENT_UTILITY_SPEECH_SPEECH_RECOGNITION_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace speech {
+
diff --git a/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc b/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
new file mode 100644
index 0000000000..4173837bf8
--- /dev/null
+++ b/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/utility_blink_platform_with_sandbox_support_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/utility_blink_platform_with_sandbox_support_impl.cc
+@@ -9,7 +9,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+ #include "content/child/child_process_sandbox_support_impl_mac.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/child_process_sandbox_support_impl_linux.h"
+ #endif
+
+@@ -17,7 +17,7 @@ namespace content {
+
+ UtilityBlinkPlatformWithSandboxSupportImpl::
+ UtilityBlinkPlatformWithSandboxSupportImpl() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::PendingRemote<font_service::mojom::FontService> font_service;
+ UtilityThread::Get()->BindHostReceiver(
+ font_service.InitWithNewPipeAndPassReceiver());
+@@ -35,7 +35,7 @@ UtilityBlinkPlatformWithSandboxSupportIm
+
+ blink::WebSandboxSupport*
+ UtilityBlinkPlatformWithSandboxSupportImpl::GetSandboxSupport() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return sandbox_support_.get();
+ #else
+ return nullptr;
diff --git a/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h b/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
new file mode 100644
index 0000000000..22fa36195f
--- /dev/null
+++ b/electron34/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/utility_blink_platform_with_sandbox_support_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/utility_blink_platform_with_sandbox_support_impl.h
+@@ -33,7 +33,7 @@ class UtilityBlinkPlatformWithSandboxSup
+ blink::WebSandboxSupport* GetSandboxSupport() override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<blink::WebSandboxSupport> sandbox_support_;
+ #endif
+ };
diff --git a/electron34/patches/patch-content_utility_utility__main.cc b/electron34/patches/patch-content_utility_utility__main.cc
new file mode 100644
index 0000000000..d2336e7ef2
--- /dev/null
+++ b/electron34/patches/patch-content_utility_utility__main.cc
@@ -0,0 +1,161 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/utility_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/utility_main.cc
+@@ -38,17 +38,21 @@
+ #include "services/tracing/public/cpp/trace_startup.h"
+ #include "services/video_effects/public/cpp/buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/file_descriptor_store.h"
+ #include "base/files/file_util.h"
+ #include "base/pickle.h"
+ #include "content/child/sandboxed_process_thread_type_handler.h"
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/common/gpu_pre_sandbox_hook_linux.h"
++#endif
+ #include "content/public/common/content_descriptor_keys.h"
+ #include "content/utility/speech/speech_recognition_sandbox_hook_linux.h"
+ #include "gpu/config/gpu_info_collector.h"
+ #include "media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "services/audio/audio_sandbox_hook_linux.h"
+ #include "services/network/network_sandbox_hook_linux.h"
+ // gn check is not smart enough to realize that this include only applies to
+@@ -60,11 +64,16 @@
+ #endif
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(ENABLE_VIDEO_EFFECTS) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#include "content/common/gpu_pre_sandbox_hook_bsd.h"
++#endif
++
++#if BUILDFLAG(ENABLE_VIDEO_EFFECTS) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ #include "services/video_effects/video_effects_sandbox_hook_linux.h" // nogncheck
+ #endif // BUILDFLAG(ENABLE_VIDEO_EFFECTS) && BUILDFLAG(IS_LINUX)
+
+@@ -79,7 +88,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #if (BUILDFLAG(ENABLE_SCREEN_AI_SERVICE) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)))
+ #include "services/screen_ai/public/cpp/utilities.h" // nogncheck
+ #include "services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.h" // nogncheck
+ #endif
+@@ -103,7 +112,7 @@
+ sandbox::TargetServices* g_utility_target_services = nullptr;
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ #include "components/services/on_device_translation/sandbox_hook.h"
+ #endif // BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION) && BUILDFLAG(IS_LINUX)
+
+@@ -111,7 +120,7 @@ namespace content {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::vector<std::string> GetNetworkContextsParentDirectories() {
+ base::MemoryMappedFile::Region region;
+ base::ScopedFD read_pipe_fd = base::FileDescriptorStore::GetInstance().TakeFD(
+@@ -138,9 +147,10 @@ std::vector<std::string> GetNetworkConte
+ return dirs;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ bool ShouldUseAmdGpuPolicy(sandbox::mojom::Sandbox sandbox_type) {
+ const bool obtain_gpu_info =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ sandbox_type == sandbox::mojom::Sandbox::kHardwareVideoDecoding ||
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+ sandbox_type == sandbox::mojom::Sandbox::kHardwareVideoEncoding;
+@@ -155,6 +165,7 @@ bool ShouldUseAmdGpuPolicy(sandbox::mojo
+
+ return false;
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ #if BUILDFLAG(IS_WIN)
+@@ -252,7 +263,8 @@ int UtilityMain(MainFunctionParams param
+ CHECK(on_device_model::OnDeviceModelService::PreSandboxInit());
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ // Thread type delegate of the process should be registered before first
+ // thread type change in ChildProcess constructor. It also needs to be
+ // registered before the process has multiple threads, which may race with
+@@ -264,7 +276,7 @@ int UtilityMain(MainFunctionParams param
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Initializes the sandbox before any threads are created.
+ // TODO(jorgelo): move this after GTK initialization when we enable a strict
+ // Seccomp-BPF policy.
+@@ -294,7 +306,7 @@ int UtilityMain(MainFunctionParams param
+ pre_sandbox_hook =
+ base::BindOnce(&speech::SpeechRecognitionPreSandboxHook);
+ break;
+-#if BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_ON_DEVICE_TRANSLATION) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ case sandbox::mojom::Sandbox::kOnDeviceTranslation:
+ pre_sandbox_hook = base::BindOnce(
+ &on_device_translation::OnDeviceTranslationSandboxHook);
+@@ -308,13 +320,13 @@ int UtilityMain(MainFunctionParams param
+ screen_ai::GetBinaryPathSwitch()));
+ break;
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case sandbox::mojom::Sandbox::kVideoEffects:
+ pre_sandbox_hook =
+ base::BindOnce(&video_effects::VideoEffectsPreSandboxHook);
+ break;
+ #endif // BUILDFLAG(IS_LINUX)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ case sandbox::mojom::Sandbox::kHardwareVideoDecoding:
+ pre_sandbox_hook =
+ base::BindOnce(&media::HardwareVideoDecodingPreSandboxHook);
+@@ -341,6 +353,7 @@ int UtilityMain(MainFunctionParams param
+ default:
+ break;
+ }
++#if !BUILDFLAG(IS_BSD)
+ if (!sandbox::policy::IsUnsandboxedSandboxType(sandbox_type) &&
+ (parameters.zygote_child || !pre_sandbox_hook.is_null())) {
+ sandbox_options.use_amd_specific_policies =
+@@ -348,6 +361,11 @@ int UtilityMain(MainFunctionParams param
+ sandbox::policy::Sandbox::Initialize(
+ sandbox_type, std::move(pre_sandbox_hook), sandbox_options);
+ }
++#else
++ sandbox::policy::Sandbox::Initialize(
++ sandbox_type, std::move(pre_sandbox_hook),
++ sandbox::policy::SandboxLinux::Options());
++#endif
+
+ // Start the HangWatcher now that the sandbox is engaged, if it hasn't
+ // already been started.
diff --git a/electron34/patches/patch-content_utility_utility__thread__impl.cc b/electron34/patches/patch-content_utility_utility__thread__impl.cc
new file mode 100644
index 0000000000..5325674d03
--- /dev/null
+++ b/electron34/patches/patch-content_utility_utility__thread__impl.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/utility/utility_thread_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/utility/utility_thread_impl.cc
+@@ -31,7 +31,7 @@
+ #include "mojo/public/cpp/bindings/pending_receiver.h"
+ #include "mojo/public/cpp/bindings/service_factory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "content/child/sandboxed_process_thread_type_handler.h"
+ #endif
+
+@@ -251,7 +251,8 @@ void UtilityThreadImpl::Init() {
+
+ GetContentClient()->utility()->UtilityThreadStarted();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++// XXX BSD
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ SandboxedProcessThreadTypeHandler::NotifyMainChildThreadCreated();
+ #endif
+
diff --git a/electron34/patches/patch-content_web__test_BUILD.gn b/electron34/patches/patch-content_web__test_BUILD.gn
new file mode 100644
index 0000000000..e7f4ea6b5d
--- /dev/null
+++ b/electron34/patches/patch-content_web__test_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/web_test/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/web_test/BUILD.gn
+@@ -228,6 +228,7 @@ static_library("web_test_browser") {
+ "//ui/gl",
+ "//ui/shell_dialogs:shell_dialogs",
+ "//url",
++ "//electron/build/config:generate_mas_config"
+ ]
+
+ # TODO(crbug.com/40139469): Blink test plugin must be migrated from PPAPI.
diff --git a/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.cc b/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.cc
new file mode 100644
index 0000000000..cce77bf992
--- /dev/null
+++ b/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/web_test/browser/web_test_content_browser_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/web_test/browser/web_test_content_browser_client.cc
+@@ -521,6 +521,8 @@ bool WebTestContentBrowserClient::CanCre
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::string& raw_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access) {
diff --git a/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.h b/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.h
new file mode 100644
index 0000000000..9bd811c945
--- /dev/null
+++ b/electron34/patches/patch-content_web__test_browser_web__test__content__browser__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/web_test/browser/web_test_content_browser_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/web_test/browser/web_test_content_browser_client.h
+@@ -92,6 +92,8 @@ class WebTestContentBrowserClient : publ
+ const std::string& frame_name,
+ WindowOpenDisposition disposition,
+ const blink::mojom::WindowFeatures& features,
++ const std::string& raw_features,
++ const scoped_refptr<network::ResourceRequestBody>& body,
+ bool user_gesture,
+ bool opener_suppressed,
+ bool* no_javascript_access) override;
diff --git a/electron34/patches/patch-content_zygote_BUILD.gn b/electron34/patches/patch-content_zygote_BUILD.gn
new file mode 100644
index 0000000000..62a7dd9a5f
--- /dev/null
+++ b/electron34/patches/patch-content_zygote_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/zygote/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/zygote/BUILD.gn
+@@ -5,7 +5,7 @@
+ import("//build/config/nacl/config.gni")
+ import("//content/public/common/zygote/features.gni")
+
+-if (is_linux || is_chromeos) {
++if ((is_linux || is_chromeos) && !is_bsd) {
+ source_set("zygote") {
+ sources = [
+ "zygote_linux.cc",
diff --git a/electron34/patches/patch-content_zygote_zygote__linux.cc b/electron34/patches/patch-content_zygote_zygote__linux.cc
new file mode 100644
index 0000000000..b48a9ed995
--- /dev/null
+++ b/electron34/patches/patch-content_zygote_zygote__linux.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/zygote/zygote_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/zygote/zygote_linux.cc
+@@ -1,6 +1,7 @@
+ // Copyright 2012 The Chromium Authors
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
++#if 0
+
+ #ifdef UNSAFE_BUFFERS_BUILD
+ // TODO(crbug.com/342213636): Remove this and spanify to fix the errors.
+@@ -710,3 +711,4 @@ void Zygote::HandleReinitializeLoggingRe
+ }
+
+ } // namespace content
++#endif
diff --git a/electron34/patches/patch-content_zygote_zygote__main__linux.cc b/electron34/patches/patch-content_zygote_zygote__main__linux.cc
new file mode 100644
index 0000000000..a82f2f6697
--- /dev/null
+++ b/electron34/patches/patch-content_zygote_zygote__main__linux.cc
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- content/zygote/zygote_main_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ content/zygote/zygote_main_linux.cc
+@@ -11,7 +11,9 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <string.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/prctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -41,7 +43,9 @@
+ #include "sandbox/linux/services/thread_helpers.h"
+ #include "sandbox/linux/suid/client/setuid_sandbox_client.h"
+ #include "sandbox/policy/linux/sandbox_debug_handling_linux.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "sandbox/policy/sandbox.h"
+ #include "sandbox/policy/switches.h"
+ #include "third_party/icu/source/i18n/unicode/timezone.h"
+@@ -50,11 +54,13 @@ namespace content {
+
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ void CloseFds(const std::vector<int>& fds) {
+ for (const auto& it : fds) {
+ PCHECK(0 == IGNORE_EINTR(close(it)));
+ }
+ }
++#endif
+
+ base::OnceClosure ClosureFromTwoClosures(base::OnceClosure one,
+ base::OnceClosure two) {
+@@ -157,9 +163,11 @@ static void EnterLayerOneSandbox(sandbox
+ CHECK(!using_layer1_sandbox);
+ }
+ }
++#endif
+
+ bool ZygoteMain(
+ std::vector<std::unique_ptr<ZygoteForkDelegate>> fork_delegates) {
++#if !BUILDFLAG(IS_BSD)
+ sandbox::SetAmZygoteOrRenderer(true, GetSandboxFD());
+
+ auto* linux_sandbox = sandbox::policy::SandboxLinux::GetInstance();
+@@ -224,6 +232,9 @@ bool ZygoteMain(
+
+ // This function call can return multiple times, once per fork().
+ return zygote.ProcessRequests();
++#else
++ return false;
++#endif
+ }
+
+ } // namespace content
diff --git a/electron34/patches/patch-device_bluetooth_BUILD.gn b/electron34/patches/patch-device_bluetooth_BUILD.gn
new file mode 100644
index 0000000000..63db62b0a2
--- /dev/null
+++ b/electron34/patches/patch-device_bluetooth_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/bluetooth/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/bluetooth/BUILD.gn
+@@ -258,6 +258,7 @@ component("bluetooth") {
+ "IOKit.framework",
+ "Foundation.framework",
+ ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_mac) {
diff --git a/electron34/patches/patch-device_bluetooth_bluetooth__adapter.cc b/electron34/patches/patch-device_bluetooth_bluetooth__adapter.cc
new file mode 100644
index 0000000000..4027d35a94
--- /dev/null
+++ b/electron34/patches/patch-device_bluetooth_bluetooth__adapter.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/bluetooth/bluetooth_adapter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/bluetooth/bluetooth_adapter.cc
+@@ -32,7 +32,7 @@ namespace device {
+ BluetoothAdapter::ServiceOptions::ServiceOptions() = default;
+ BluetoothAdapter::ServiceOptions::~ServiceOptions() = default;
+
+-#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && \
++#if !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD) && \
+ !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX)
+ // static
+ scoped_refptr<BluetoothAdapter> BluetoothAdapter::CreateAdapter() {
diff --git a/electron34/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm b/electron34/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
new file mode 100644
index 0000000000..2ac4e9f11f
--- /dev/null
+++ b/electron34/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/bluetooth/bluetooth_adapter_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/bluetooth/bluetooth_adapter_mac.mm
+@@ -38,7 +38,9 @@
+ #include "device/bluetooth/bluetooth_discovery_session_outcome.h"
+ #include "device/bluetooth/bluetooth_socket_mac.h"
+ #include "device/bluetooth/public/cpp/bluetooth_address.h"
++#include "electron/mas.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ // Undocumented IOBluetooth Preference API [1]. Used by `blueutil` [2] and
+ // `Karabiner` [3] to programmatically control the Bluetooth state. Calling the
+@@ -52,6 +54,7 @@ extern "C" {
+ // [4] https://support.apple.com/kb/PH25091
+ void IOBluetoothPreferenceSetControllerPowerState(int state);
+ }
++#endif
+
+ // A simple helper class that forwards any Bluetooth device connect notification
+ // to its wrapped |_adapter|.
+@@ -161,8 +164,10 @@ BluetoothAdapterMac::BluetoothAdapterMac
+ : controller_state_function_(
+ base::BindRepeating(&BluetoothAdapterMac::GetHostControllerState,
+ base::Unretained(this))),
++#if !IS_MAS_BUILD()
+ power_state_function_(
+ base::BindRepeating(IOBluetoothPreferenceSetControllerPowerState)),
++#endif
+ device_paired_status_callback_(
+ base::BindRepeating(&IsDeviceSystemPaired)) {
+ }
+@@ -313,8 +318,12 @@ base::WeakPtr<BluetoothAdapter> Bluetoot
+ }
+
+ bool BluetoothAdapterMac::SetPoweredImpl(bool powered) {
++#if !IS_MAS_BUILD()
+ power_state_function_.Run(base::strict_cast<int>(powered));
+ return true;
++#else
++ return false;
++#endif
+ }
+
+ base::WeakPtr<BluetoothLowEnergyAdapterApple>
diff --git a/electron34/patches/patch-device_bluetooth_cast__bluetooth.gni b/electron34/patches/patch-device_bluetooth_cast__bluetooth.gni
new file mode 100644
index 0000000000..64248bd536
--- /dev/null
+++ b/electron34/patches/patch-device_bluetooth_cast__bluetooth.gni
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/bluetooth/cast_bluetooth.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/bluetooth/cast_bluetooth.gni
+@@ -2,5 +2,5 @@ import("//build/config/features.gni")
+
+ declare_args() {
+ force_cast_bluetooth = false
+- use_bluez = (is_linux && !is_castos && use_dbus) || is_chromeos
++ use_bluez = use_dbus && !is_bsd
+ }
diff --git a/electron34/patches/patch-device_gamepad_BUILD.gn b/electron34/patches/patch-device_gamepad_BUILD.gn
new file mode 100644
index 0000000000..1a8c9e28fc
--- /dev/null
+++ b/electron34/patches/patch-device_gamepad_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/gamepad/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/gamepad/BUILD.gn
+@@ -99,7 +99,7 @@ component("gamepad") {
+ "hid_writer_linux.cc",
+ "hid_writer_linux.h",
+ ]
+- if (use_udev) {
++ if (use_udev && !is_bsd) {
+ sources += [
+ "gamepad_device_linux.cc",
+ "gamepad_device_linux.h",
diff --git a/electron34/patches/patch-device_gamepad_gamepad__provider.cc b/electron34/patches/patch-device_gamepad_gamepad__provider.cc
new file mode 100644
index 0000000000..f91576fd5a
--- /dev/null
+++ b/electron34/patches/patch-device_gamepad_gamepad__provider.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/gamepad/gamepad_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/gamepad/gamepad_provider.cc
+@@ -157,7 +157,7 @@ void GamepadProvider::Initialize(std::un
+
+ if (!polling_thread_)
+ polling_thread_ = std::make_unique<base::Thread>("Gamepad polling thread");
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, the data fetcher needs to watch file descriptors, so the message
+ // loop needs to be a libevent loop.
+ const base::MessagePumpType kMessageLoopType = base::MessagePumpType::IO;
diff --git a/electron34/patches/patch-device_gamepad_hid__writer__linux.cc b/electron34/patches/patch-device_gamepad_hid__writer__linux.cc
new file mode 100644
index 0000000000..5511e4448a
--- /dev/null
+++ b/electron34/patches/patch-device_gamepad_hid__writer__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- device/gamepad/hid_writer_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ device/gamepad/hid_writer_linux.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include <unistd.h>
++
+ #include "device/gamepad/hid_writer_linux.h"
+
+ #include <unistd.h>
diff --git a/electron34/patches/patch-electron_BUILD.gn b/electron34/patches/patch-electron_BUILD.gn
new file mode 100644
index 0000000000..8c53a6255b
--- /dev/null
+++ b/electron34/patches/patch-electron_BUILD.gn
@@ -0,0 +1,66 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/BUILD.gn.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/BUILD.gn
+@@ -529,7 +529,7 @@ source_set("electron_lib") {
+ defines += [ "GDK_DISABLE_DEPRECATION_WARNINGS" ]
+ }
+
+- if (!is_mas_build) {
++ if (!is_mas_build && !is_bsd) {
+ deps += [
+ "//components/crash/core/app",
+ "//components/crash/core/browser",
+@@ -622,6 +622,12 @@ source_set("electron_lib") {
+ cflags_objcc = [ "-fobjc-weak" ]
+ }
+ }
++ if (is_bsd) {
++ sources -= [
++ "shell/common/crash_keys.cc",
++ "shell/common/crash_keys.h",
++ ]
++ }
+ if (is_linux) {
+ libs = [ "xshmfence" ]
+ deps += [
+@@ -1190,7 +1196,7 @@ if (is_mac) {
+ ":electron_lib",
+ ":electron_win32_resources",
+ ":packed_resources",
+- "//components/crash/core/app",
++ # "//components/crash/core/app",
+ "//content:sandbox_helper_win",
+ "//electron/buildflags",
+ "//ui/strings",
+@@ -1216,7 +1222,7 @@ if (is_mac) {
+ public_deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ data_deps += [ "//components/crash/core/app:chrome_crashpad_handler" ]
+ }
+
+@@ -1283,7 +1289,7 @@ if (is_mac) {
+ configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ deps += [ "//sandbox/linux:chrome_sandbox" ]
+ }
+ }
+@@ -1391,7 +1397,7 @@ dist_zip("electron_dist_zip") {
+ ":electron_version_file",
+ ":licenses",
+ ]
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ data_deps += [ "//sandbox/linux:chrome_sandbox" ]
+ }
+ deps = data_deps
diff --git a/electron34/patches/patch-electron_build_args_all.gn b/electron34/patches/patch-electron_build_args_all.gn
new file mode 100644
index 0000000000..3ad59aa332
--- /dev/null
+++ b/electron34/patches/patch-electron_build_args_all.gn
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/build/args/all.gn.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/build/args/all.gn
+@@ -14,8 +14,8 @@ v8_enable_snapshot_native_code_counters
+ v8_enable_javascript_promise_hooks = true
+
+ enable_cdm_host_verification = false
+-proprietary_codecs = true
+-ffmpeg_branding = "Chrome"
++# proprietary_codecs = true
++# ffmpeg_branding = "Chrome"
+
+ enable_printing = true
+
diff --git a/electron34/patches/patch-electron_build_args_release.gn b/electron34/patches/patch-electron_build_args_release.gn
new file mode 100644
index 0000000000..cbf29d9c97
--- /dev/null
+++ b/electron34/patches/patch-electron_build_args_release.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/build/args/release.gn.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/build/args/release.gn
+@@ -7,7 +7,7 @@ is_official_build = true
+ # explicitly override here to build OpenH264 encoder/FFmpeg decoder.
+ # The initialization of the decoder depends on whether ffmpeg has
+ # been built with H.264 support.
+-rtc_use_h264 = proprietary_codecs
++# rtc_use_h264 = proprietary_codecs
+
+ # By default, Electron builds ffmpeg with proprietary codecs enabled. In order
+ # to facilitate users who don't want to ship proprietary codecs in ffmpeg, or
diff --git a/electron34/patches/patch-electron_default__app_default__app.ts b/electron34/patches/patch-electron_default__app_default__app.ts
new file mode 100644
index 0000000000..849e31eb28
--- /dev/null
+++ b/electron34/patches/patch-electron_default__app_default__app.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/default_app/default_app.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/default_app/default_app.ts
+@@ -61,7 +61,7 @@ async function createWindow (backgroundC
+ show: false
+ };
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd'|| process.platform === 'netbsd') {
+ options.icon = url.fileURLToPath(new URL('icon.png', import.meta.url));
+ }
+
diff --git a/electron34/patches/patch-electron_filenames.gni b/electron34/patches/patch-electron_filenames.gni
new file mode 100644
index 0000000000..707fbf451a
--- /dev/null
+++ b/electron34/patches/patch-electron_filenames.gni
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/filenames.gni.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/filenames.gni
+@@ -245,8 +245,8 @@ filenames = {
+ "shell/app/command_line_args.h",
+ "shell/app/electron_content_client.cc",
+ "shell/app/electron_content_client.h",
+- "shell/app/electron_crash_reporter_client.cc",
+- "shell/app/electron_crash_reporter_client.h",
++ # "shell/app/electron_crash_reporter_client.cc",
++ # "shell/app/electron_crash_reporter_client.h",
+ "shell/app/electron_main_delegate.cc",
+ "shell/app/electron_main_delegate.h",
+ "shell/app/node_main.cc",
diff --git a/electron34/patches/patch-electron_lib_browser_api_app.ts b/electron34/patches/patch-electron_lib_browser_api_app.ts
new file mode 100644
index 0000000000..9623765e9e
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_api_app.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/api/app.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/api/app.ts
+@@ -67,7 +67,7 @@ if (process.platform === 'darwin') {
+ app.dock!.getMenu = () => dockMenu;
+ }
+
+-if (process.platform === 'linux') {
++if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ const patternVmRSS = /^VmRSS:\s*(\d+) kB$/m;
+ const patternVmHWM = /^VmHWM:\s*(\d+) kB$/m;
+
diff --git a/electron34/patches/patch-electron_lib_browser_api_dialog.ts b/electron34/patches/patch-electron_lib_browser_api_dialog.ts
new file mode 100644
index 0000000000..d7c4a08f5b
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_api_dialog.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/api/dialog.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/api/dialog.ts
+@@ -41,7 +41,7 @@ const normalizeAccessKey = (text: string
+ // existing single underscores with a second underscore, replace double
+ // ampersands with a single ampersand, and replace a single ampersand with
+ // a single underscore
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ return text.replaceAll('_', '__').replaceAll(/&(.?)/g, (match, after) => {
+ if (after === '&') return after;
+ return `_${after}`;
diff --git a/electron34/patches/patch-electron_lib_browser_api_menu-item-roles.ts b/electron34/patches/patch-electron_lib_browser_api_menu-item-roles.ts
new file mode 100644
index 0000000000..db691c4947
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_api_menu-item-roles.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/api/menu-item-roles.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/api/menu-item-roles.ts
+@@ -2,7 +2,7 @@ import { app, BaseWindow, BrowserWindow,
+
+ const isMac = process.platform === 'darwin';
+ const isWindows = process.platform === 'win32';
+-const isLinux = process.platform === 'linux';
++const isLinux = (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd');
+
+ type RoleId = 'about' | 'close' | 'copy' | 'cut' | 'delete' | 'forcereload' | 'front' | 'help' | 'hide' | 'hideothers' | 'minimize' |
+ 'paste' | 'pasteandmatchstyle' | 'quit' | 'redo' | 'reload' | 'resetzoom' | 'selectall' | 'services' | 'recentdocuments' | 'clearrecentdocuments' |
diff --git a/electron34/patches/patch-electron_lib_browser_api_power-monitor.ts b/electron34/patches/patch-electron_lib_browser_api_power-monitor.ts
new file mode 100644
index 0000000000..c395c8a292
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_api_power-monitor.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/api/power-monitor.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/api/power-monitor.ts
+@@ -17,7 +17,7 @@ class PowerMonitor extends EventEmitter
+ const pm = createPowerMonitor();
+ pm.emit = this.emit.bind(this);
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ // On Linux, we inhibit shutdown in order to give the app a chance to
+ // decide whether or not it wants to prevent the shutdown. We don't
+ // inhibit the shutdown event unless there's a listener for it. This
diff --git a/electron34/patches/patch-electron_lib_browser_init.ts b/electron34/patches/patch-electron_lib_browser_init.ts
new file mode 100644
index 0000000000..295118b607
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_init.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/init.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/init.ts
+@@ -162,7 +162,7 @@ const mainStartupScript = packageJson.ma
+ const KNOWN_XDG_DESKTOP_VALUES = new Set(['Pantheon', 'Unity:Unity7', 'pop:GNOME']);
+
+ function currentPlatformSupportsAppIndicator () {
+- if (process.platform !== 'linux') return false;
++ if (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') return false;
+ const currentDesktop = process.env.XDG_CURRENT_DESKTOP;
+
+ if (!currentDesktop) return false;
diff --git a/electron34/patches/patch-electron_lib_browser_rpc-server.ts b/electron34/patches/patch-electron_lib_browser_rpc-server.ts
new file mode 100644
index 0000000000..0de03f3126
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_browser_rpc-server.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/browser/rpc-server.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/browser/rpc-server.ts
+@@ -28,7 +28,7 @@ const allowedClipboardMethods = (() => {
+ switch (process.platform) {
+ case 'darwin':
+ return new Set(['readFindText', 'writeFindText']);
+- case 'linux':
++ case 'linux': case 'freebsd': case 'netbsd':
+ return new Set(Object.keys(clipboard));
+ default:
+ return new Set();
diff --git a/electron34/patches/patch-electron_lib_renderer_api_clipboard.ts b/electron34/patches/patch-electron_lib_renderer_api_clipboard.ts
new file mode 100644
index 0000000000..cbc41105ba
--- /dev/null
+++ b/electron34/patches/patch-electron_lib_renderer_api_clipboard.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/lib/renderer/api/clipboard.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/lib/renderer/api/clipboard.ts
+@@ -7,7 +7,7 @@ const makeRemoteMethod = function (metho
+ return (...args: any[]) => ipcRendererUtils.invokeSync(IPC_MESSAGES.BROWSER_CLIPBOARD_SYNC, method, ...args);
+ };
+
+-if (process.platform === 'linux') {
++if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ // On Linux we could not access clipboard in renderer process.
+ for (const method of Object.keys(clipboard) as (keyof Electron.Clipboard)[]) {
+ clipboard[method] = makeRemoteMethod(method);
diff --git a/electron34/patches/patch-electron_script_lib_config.py b/electron34/patches/patch-electron_script_lib_config.py
new file mode 100644
index 0000000000..ee8a869127
--- /dev/null
+++ b/electron34/patches/patch-electron_script_lib_config.py
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/script/lib/config.py.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/script/lib/config.py
+@@ -7,6 +7,10 @@ PLATFORM = {
+ 'cygwin': 'win32',
+ 'msys': 'win32',
+ 'darwin': 'darwin',
++ 'freebsd13': 'freebsd',
++ 'freebsd14': 'freebsd',
++ 'freebsd15': 'freebsd',
++ 'netbsd': 'netbsd',
+ 'linux': 'linux',
+ 'linux2': 'linux',
+ 'win32': 'win32',
diff --git a/electron34/patches/patch-electron_script_lib_utils.js b/electron34/patches/patch-electron_script_lib_utils.js
new file mode 100644
index 0000000000..6a75684404
--- /dev/null
+++ b/electron34/patches/patch-electron_script_lib_utils.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/script/lib/utils.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/script/lib/utils.js
+@@ -19,7 +19,7 @@ function getElectronExec () {
+ return `out/${OUT_DIR}/Electron.app/Contents/MacOS/Electron`;
+ case 'win32':
+ return `out/${OUT_DIR}/electron.exe`;
+- case 'linux':
++ case 'linux': case 'freebsd': case 'netbsd':
+ return `out/${OUT_DIR}/electron`;
+ default:
+ throw new Error('Unknown platform');
diff --git a/electron34/patches/patch-electron_script_spec-runner.js b/electron34/patches/patch-electron_script_spec-runner.js
new file mode 100644
index 0000000000..caf5311558
--- /dev/null
+++ b/electron34/patches/patch-electron_script_spec-runner.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/script/spec-runner.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/script/spec-runner.js
+@@ -200,7 +200,7 @@ async function runTestUsingElectron (spe
+ exe = path.resolve(BASE, utils.getElectronExec());
+ }
+ const runnerArgs = [`electron/${specDir}`, ...unknownArgs.slice(2)];
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe);
+ exe = 'python3';
+ }
diff --git a/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.cc b/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.cc
new file mode 100644
index 0000000000..657738d238
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/app/electron_crash_reporter_client.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/app/electron_crash_reporter_client.cc
+@@ -91,7 +91,7 @@ ElectronCrashReporterClient::ElectronCra
+
+ ElectronCrashReporterClient::~ElectronCrashReporterClient() = default;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ElectronCrashReporterClient::SetCrashReporterClientIdFromGUID(
+ const std::string& client_guid) {
+ crash_keys::SetMetricsClientIdFromGUID(client_guid);
+@@ -192,7 +192,7 @@ void ElectronCrashReporterClient::GetPro
+ (*annotations)["ver"] = ELECTRON_VERSION_STRING;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ bool ElectronCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
+ return false;
+ }
diff --git a/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.h b/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.h
new file mode 100644
index 0000000000..5628a29713
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_app_electron__crash__reporter__client.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/app/electron_crash_reporter_client.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/app/electron_crash_reporter_client.h
+@@ -30,7 +30,7 @@ class ElectronCrashReporterClient : publ
+ const std::map<std::string, std::string>& annotations);
+
+ // crash_reporter::CrashReporterClient implementation.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetCrashReporterClientIdFromGUID(
+ const std::string& client_guid) override;
+ void GetProductNameAndVersion(const char** product_name,
+@@ -69,7 +69,7 @@ class ElectronCrashReporterClient : publ
+ bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled) override;
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldMonitorCrashHandlerExpensively() override;
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_app_electron__main__delegate.cc b/electron34/patches/patch-electron_shell_app_electron__main__delegate.cc
new file mode 100644
index 0000000000..463e27641d
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_app_electron__main__delegate.cc
@@ -0,0 +1,69 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/app/electron_main_delegate.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/app/electron_main_delegate.cc
+@@ -59,13 +59,13 @@
+ #include "chrome/child/v8_crashpad_support_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #include "v8/include/v8-wasm-trap-handler-posix.h"
+ #include "v8/include/v8.h"
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crash_switches.h" // nogncheck
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "components/crash/core/common/crash_key.h"
+@@ -156,7 +156,7 @@ bool ElectronPathProvider(int key, base:
+ create_dir = true;
+ break;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case DIR_APP_DATA: {
+ auto env = base::Environment::Create();
+ cur = base::nix::GetXDGDirectory(
+@@ -282,7 +282,7 @@ std::optional<int> ElectronMainDelegate:
+ base::win::PinUser32();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Check for --no-sandbox parameter when running as root.
+ if (getuid() == 0 && IsSandboxEnabled(command_line))
+ LOG(FATAL) << "Running as root without --"
+@@ -332,7 +332,7 @@ void ElectronMainDelegate::PreSandboxSta
+ /* is_preinit = */ IsBrowserProcess() || IsZygoteProcess());
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ crash_reporter::InitializeCrashKeys();
+ #endif
+
+@@ -367,7 +367,7 @@ void ElectronMainDelegate::PreSandboxSta
+ }
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ crash_keys::SetCrashKeysFromCommandLine(*command_line);
+ crash_keys::SetPlatformCrashKey();
+ #endif
+@@ -402,7 +402,7 @@ std::optional<int> ElectronMainDelegate:
+ #if BUILDFLAG(IS_MAC)
+ RegisterAtomCrApp();
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the global activation token sent as an environment variable.
+ auto env = base::Environment::Create();
+ base::nix::ExtractXdgActivationTokenFromEnv(*env);
diff --git a/electron34/patches/patch-electron_shell_app_node__main.cc b/electron34/patches/patch-electron_shell_app_node__main.cc
new file mode 100644
index 0000000000..72cf0c14b0
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_app_node__main.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/app/node_main.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/app/node_main.cc
+@@ -47,7 +47,7 @@
+ #include "shell/common/mac/codesign_util.h"
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "shell/app/electron_crash_reporter_client.h"
+ #include "shell/common/crash_keys.h"
+@@ -98,14 +98,14 @@ bool UnsetHijackableEnvs(base::Environme
+ }
+ #endif
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void SetCrashKeyStub(const std::string& key, const std::string& value) {}
+ void ClearCrashKeyStub(const std::string& key) {}
+ #endif
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+@@ -270,7 +270,7 @@ int NodeMain(int argc, char* argv[]) {
+ // Setup process.crashReporter in child node processes
+ auto reporter = gin_helper::Dictionary::CreateEmpty(isolate);
+ reporter.SetMethod("getParameters", &GetParameters);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ reporter.SetMethod("addExtraParameter", &SetCrashKeyStub);
+ reporter.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
+ #else
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__app.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__app.cc
new file mode 100644
index 0000000000..3a2365fd62
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__app.cc
@@ -0,0 +1,80 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_app.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_app.cc
+@@ -96,7 +96,7 @@
+ #include "shell/common/process_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/nix/scoped_xdg_activation_token_injector.h"
+ #include "base/nix/xdg_util.h"
+ #endif
+@@ -420,7 +420,7 @@ bool NotificationCallbackWrapper(
+ base::CommandLine cmd,
+ const base::FilePath& cwd,
+ const std::vector<uint8_t> additional_data) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the global activation token sent as a command line switch by another
+ // electron app instance. This also removes the switch after use to prevent
+ // any side effects of leaving it in the command line after this point.
+@@ -606,7 +606,7 @@ void App::OnWillFinishLaunching() {
+ }
+
+ void App::OnFinishLaunching(base::Value::Dict launch_info) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set the application name for audio streams shown in external
+ // applications. Only affects pulseaudio currently.
+ media::AudioManager::SetGlobalAppName(Browser::Get()->GetName());
+@@ -947,7 +947,7 @@ void App::SetPath(gin_helper::ErrorThrow
+ }
+
+ void App::SetDesktopName(const std::string& desktop_name) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto env = base::Environment::Create();
+ env->SetVar("CHROME_DESKTOP", desktop_name);
+ #endif
+@@ -1051,7 +1051,7 @@ bool App::RequestSingleInstanceLock(gin:
+ base::BindRepeating(NotificationCallbackWrapper, cb));
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Read the xdg-activation token and set it in the command line for the
+ // duration of the notification in order to ensure this is propagated to an
+ // already running electron app instance if it exists.
+@@ -1346,7 +1346,7 @@ std::vector<gin_helper::Dictionary> App:
+ pid_dict.Set("name", process_metric.second->name);
+ }
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ auto memory_info = process_metric.second->GetMemoryInfo();
+
+ auto memory_dict = gin_helper::Dictionary::CreateEmpty(isolate);
+@@ -1720,7 +1720,7 @@ gin::ObjectTemplateBuilder App::GetObjec
+ .SetMethod(
+ "removeAsDefaultProtocolClient",
+ base::BindRepeating(&Browser::RemoveAsDefaultProtocolClient, browser))
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ .SetMethod(
+ "getApplicationInfoForProtocol",
+ base::BindRepeating(&Browser::GetApplicationInfoForProtocol, browser))
+@@ -1778,7 +1778,7 @@ gin::ObjectTemplateBuilder App::GetObjec
+ .SetMethod("getJumpListSettings", &App::GetJumpListSettings)
+ .SetMethod("setJumpList", &App::SetJumpList)
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .SetMethod("isUnityRunning",
+ base::BindRepeating(&Browser::IsUnityRunning, browser))
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.cc
new file mode 100644
index 0000000000..02a9b1417e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_base_window.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_base_window.cc
+@@ -41,7 +41,7 @@
+ #include "shell/browser/ui/views/win_frame_view.h"
+ #include "shell/browser/ui/win/taskbar_host.h"
+ #include "ui/base/win/shell.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "shell/browser/ui/views/opaque_frame_view.h"
+ #endif
+
+@@ -986,7 +986,7 @@ void BaseWindow::SetIconImpl(v8::Isolate
+ static_cast<NativeWindowViews*>(window_.get())
+ ->SetIcon(native_image->GetHICON(GetSystemMetrics(SM_CXSMICON)),
+ native_image->GetHICON(GetSystemMetrics(SM_CXICON)));
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static_cast<NativeWindowViews*>(window_.get())
+ ->SetIcon(native_image->image().AsImageSkia());
+ #endif
+@@ -1043,7 +1043,7 @@ void BaseWindow::SetAppDetails(const gin
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void BaseWindow::SetTitleBarOverlay(const gin_helper::Dictionary& options,
+ gin_helper::Arguments* args) {
+ // Ensure WCO is already enabled on this window
+@@ -1296,7 +1296,7 @@ void BaseWindow::BuildPrototype(v8::Isol
+ .SetMethod("setThumbnailToolTip", &BaseWindow::SetThumbnailToolTip)
+ .SetMethod("setAppDetails", &BaseWindow::SetAppDetails)
+ #endif
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ .SetMethod("setTitleBarOverlay", &BaseWindow::SetTitleBarOverlay)
+ #endif
+ .SetProperty("id", &BaseWindow::GetID);
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.h b/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.h
new file mode 100644
index 0000000000..f5ff379d1a
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__base__window.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_base_window.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_base_window.h
+@@ -251,7 +251,7 @@ class BaseWindow : public gin_helper::Tr
+ void SetAppDetails(const gin_helper::Dictionary& options);
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetTitleBarOverlay(const gin_helper::Dictionary& options,
+ gin_helper::Arguments* args);
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
new file mode 100644
index 0000000000..3776da929d
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
@@ -0,0 +1,78 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_crash_reporter.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_crash_reporter.cc
+@@ -30,7 +30,7 @@
+ #include "shell/common/process_util.h"
+ #include "shell/common/thread_restrictions.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "components/crash/core/app/crashpad.h" // nogncheck
+ #include "components/crash/core/browser/crash_upload_list_crashpad.h" // nogncheck
+ #include "components/crash/core/common/crash_key.h"
+@@ -64,7 +64,7 @@ bool g_crash_reporter_initialized = fals
+
+ namespace electron::api::crash_reporter {
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ namespace {
+
+ void NoOp() {}
+@@ -135,7 +135,7 @@ void Start(const std::string& submit_url
+ const std::map<std::string, std::string>& extra,
+ bool is_node_process) {
+ TRACE_EVENT0("electron", "crash_reporter::Start");
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ if (g_crash_reporter_initialized)
+ return;
+ g_crash_reporter_initialized = true;
+@@ -181,7 +181,7 @@ void Start(const std::string& submit_url
+
+ namespace {
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void GetUploadedReports(
+ v8::Isolate* isolate,
+ base::OnceCallback<void(v8::Local<v8::Value>)> callback) {
+@@ -236,13 +236,13 @@ v8::Local<v8::Value> GetUploadedReports(
+ #endif
+
+ void SetUploadToServer(bool upload) {
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ ElectronCrashReporterClient::Get()->SetCollectStatsConsent(upload);
+ #endif
+ }
+
+ bool GetUploadToServer() {
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return ElectronCrashReporterClient::Get()->GetCollectStatsConsent();
+@@ -251,7 +251,7 @@ bool GetUploadToServer() {
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+@@ -263,7 +263,7 @@ void Initialize(v8::Local<v8::Object> ex
+ void* priv) {
+ gin_helper::Dictionary dict(context->GetIsolate(), exports);
+ dict.SetMethod("start", &electron::api::crash_reporter::Start);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ dict.SetMethod("addExtraParameter", &electron::api::crash_reporter::NoOp);
+ dict.SetMethod("removeExtraParameter", &electron::api::crash_reporter::NoOp);
+ #else
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
new file mode 100644
index 0000000000..ea3713c8a2
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_desktop_capturer.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_desktop_capturer.cc
+@@ -47,7 +47,7 @@
+ #endif
+
+ namespace {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Private function in ui/base/x/x11_display_util.cc
+ base::flat_map<x11::RandR::Output, int> GetMonitors(
+ std::pair<uint32_t, uint32_t> version,
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc
new file mode 100644
index 0000000000..1b7df7da91
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_power_monitor.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_power_monitor.cc
+@@ -128,6 +128,11 @@ void PowerMonitor::OnSpeedLimitChange(in
+ gin::DataObjectBuilder(isolate).Set("limit", speed_limit).Build());
+ }
+
++#if BUILDFLAG(IS_BSD)
++void PowerMonitor::SetListeningForShutdown(bool is_listening) {
++}
++#endif
++
+ #if BUILDFLAG(IS_LINUX)
+ void PowerMonitor::SetListeningForShutdown(bool is_listening) {
+ if (is_listening) {
+@@ -153,7 +158,7 @@ gin::ObjectTemplateBuilder PowerMonitor:
+ auto builder =
+ gin_helper::EventEmitterMixin<PowerMonitor>::GetObjectTemplateBuilder(
+ isolate);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ builder.SetMethod("setListeningForShutdown",
+ &PowerMonitor::SetListeningForShutdown);
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h b/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h
new file mode 100644
index 0000000000..8fd8c1c2ca
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_power_monitor.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_power_monitor.h
+@@ -40,7 +40,7 @@ class PowerMonitor final : public gin::W
+ explicit PowerMonitor(v8::Isolate* isolate);
+ ~PowerMonitor() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetListeningForShutdown(bool);
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc
new file mode 100644
index 0000000000..43194a5303
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_safe_storage.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_safe_storage.cc
+@@ -19,7 +19,7 @@ const char* kEncryptionVersionPrefixV11
+ bool use_password_v10 = false;
+
+ bool IsEncryptionAvailable() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Calling IsEncryptionAvailable() before the app is ready results in a crash
+ // on Linux.
+ // Refs: https://github.com/electron/electron/issues/32206.
+@@ -38,7 +38,7 @@ void SetUsePasswordV10(bool use) {
+ use_password_v10 = use;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string GetSelectedLinuxBackend() {
+ if (!electron::Browser::Get()->is_ready())
+ return "unknown";
+@@ -135,7 +135,7 @@ void Initialize(v8::Local<v8::Object> ex
+ gin_helper::Dictionary dict(isolate, exports);
+ dict.SetMethod("decryptString", &DecryptString);
+ dict.SetMethod("encryptString", &EncryptString);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ dict.SetMethod("getSelectedStorageBackend", &GetSelectedLinuxBackend);
+ #endif
+ dict.SetMethod("isEncryptionAvailable", &IsEncryptionAvailable);
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc b/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc
new file mode 100644
index 0000000000..27d928af14
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc
@@ -0,0 +1,83 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_web_contents.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_web_contents.cc
+@@ -157,11 +157,11 @@
+ #include "ui/base/cocoa/defaults_utils.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/window.h"
+ #include "ui/gfx/font_render_params.h"
+ #endif
+@@ -193,7 +193,7 @@
+ #include "content/public/browser/plugin_service.h"
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "chrome/browser/hang_monitor/hang_crash_dump.h" // nogncheck
+ #endif
+
+@@ -567,7 +567,7 @@ std::optional<base::TimeDelta> GetCursor
+ ui::TextInsertionCaretBlinkPeriodFromDefaults());
+ if (system_value)
+ return *system_value;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (auto* linux_ui = ui::LinuxUi::instance())
+ return linux_ui->GetCursorBlinkInterval();
+ #elif BUILDFLAG(IS_WIN)
+@@ -928,7 +928,7 @@ void WebContents::InitWithSessionAndOpti
+ accept_languages.pop_back();
+ prefs->accept_languages = accept_languages;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Update font settings.
+ static const gfx::FontRenderParams params(
+ gfx::GetFontRenderParams(gfx::FontRenderParamsQuery(), nullptr));
+@@ -2787,13 +2787,13 @@ void WebContents::ForcefullyCrashRendere
+
+ content::RenderProcessHost* rph = rwh->GetProcess();
+ if (rph) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // A generic |CrashDumpHungChildProcess()| is not implemented for Linux.
+ // Instead we send an explicit IPC to crash on the renderer's IO thread.
+ rph->ForceCrash();
+ #else
+ // Try to generate a crash report for the hung process.
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ CrashDumpHungChildProcess(rph->GetProcess().Handle());
+ #endif
+ rph->Shutdown(content::RESULT_CODE_HUNG);
+@@ -3476,7 +3476,7 @@ void WebContents::CopyImageAt(int x, int
+ void WebContents::Focus() {
+ // Focusing on WebContents does not automatically focus the window on macOS
+ // and Linux, do it manually to match the behavior on Windows.
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (owner_window())
+ owner_window()->Focus(true);
+ #endif
+@@ -4353,7 +4353,7 @@ ui::ImageModel WebContents::GetDevToolsW
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void WebContents::GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) {
+ *class_name = Browser::Get()->GetName();
diff --git a/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.h b/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.h
new file mode 100644
index 0000000000..0e1ced950e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_electron__api__web__contents.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/electron_api_web_contents.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/electron_api_web_contents.h
+@@ -782,7 +782,7 @@ class WebContents final : public Exclusi
+ #if defined(TOOLKIT_VIEWS) && !BUILDFLAG(IS_MAC)
+ ui::ImageModel GetDevToolsWindowIcon() override;
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) override;
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_api_process__metric.h b/electron34/patches/patch-electron_shell_browser_api_process__metric.h
new file mode 100644
index 0000000000..dc2d26db52
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_api_process__metric.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/api/process_metric.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/api/process_metric.h
+@@ -14,7 +14,7 @@
+
+ namespace electron {
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ struct ProcessMemoryInfo {
+ size_t working_set_size = 0;
+ size_t peak_working_set_size = 0;
+@@ -48,7 +48,7 @@ struct ProcessMetric {
+ const std::string& name = std::string());
+ ~ProcessMetric();
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ ProcessMemoryInfo GetMemoryInfo() const;
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_browser.cc b/electron34/patches/patch-electron_shell_browser_browser.cc
new file mode 100644
index 0000000000..4bbf42889d
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_browser.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/browser.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/browser.cc
+@@ -71,7 +71,7 @@ Browser* Browser::Get() {
+ return ElectronBrowserMainParts::Get()->browser();
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void Browser::Focus(gin::Arguments* args) {
+ // Focus on the first visible window.
+ for (auto* const window : WindowList::GetWindows()) {
diff --git a/electron34/patches/patch-electron_shell_browser_browser.h b/electron34/patches/patch-electron_shell_browser_browser.h
new file mode 100644
index 0000000000..1fef7c9acf
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_browser.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/browser.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/browser.h
+@@ -144,7 +144,7 @@ class Browser : private WindowListObserv
+
+ std::u16string GetApplicationNameForProtocol(const GURL& url);
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // get the name, icon and path for an application
+ v8::Local<v8::Promise> GetApplicationInfoForProtocol(v8::Isolate* isolate,
+ const GURL& url);
+@@ -272,10 +272,10 @@ class Browser : private WindowListObserv
+ PCWSTR GetAppUserModelID();
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Whether Unity launcher is running.
+ bool IsUnityRunning();
+-#endif // BUILDFLAG(IS_LINUX)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // Tell the application to open a file.
+ bool OpenFile(const std::string& file_path);
diff --git a/electron34/patches/patch-electron_shell_browser_browser__linux.cc b/electron34/patches/patch-electron_shell_browser_browser__linux.cc
new file mode 100644
index 0000000000..a9df05df9e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_browser__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/browser_linux.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/browser_linux.cc
+@@ -7,7 +7,7 @@
+ #include <fcntl.h>
+ #include <stdlib.h>
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <gtk/gtk.h>
+ #endif
+
+@@ -23,7 +23,7 @@
+ #include "shell/common/gin_converters/login_item_settings_converter.h"
+ #include "shell/common/thread_restrictions.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "shell/browser/linux/unity_service.h"
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_browser__process__impl.cc b/electron34/patches/patch-electron_shell_browser_browser__process__impl.cc
new file mode 100644
index 0000000000..1ec5df0add
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_browser__process__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/browser_process_impl.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/browser_process_impl.cc
+@@ -338,7 +338,7 @@ electron::ResolveProxyHelper* BrowserPro
+ return resolve_proxy_helper_.get();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void BrowserProcessImpl::SetLinuxStorageBackend(
+ os_crypt::SelectedLinuxBackend selected_backend) {
+ switch (selected_backend) {
+@@ -361,7 +361,7 @@ void BrowserProcessImpl::SetLinuxStorage
+ NOTREACHED();
+ }
+ }
+-#endif // BUILDFLAG(IS_LINUX)
++#endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
+ locale_ = locale;
diff --git a/electron34/patches/patch-electron_shell_browser_browser__process__impl.h b/electron34/patches/patch-electron_shell_browser_browser__process__impl.h
new file mode 100644
index 0000000000..cc0bd27292
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_browser__process__impl.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/browser_process_impl.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/browser_process_impl.h
+@@ -21,7 +21,7 @@
+ #include "services/network/public/cpp/shared_url_loader_factory.h"
+ #include "shell/browser/net/system_network_context_manager.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/key_storage_util_linux.h"
+ #endif
+
+@@ -60,7 +60,7 @@ class BrowserProcessImpl : public Browse
+ const std::string& GetSystemLocale() const;
+ electron::ResolveProxyHelper* GetResolveProxyHelper();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetLinuxStorageBackend(os_crypt::SelectedLinuxBackend selected_backend);
+ [[nodiscard]] const std::string& linux_storage_backend() const {
+ return selected_linux_storage_backend_;
+@@ -150,7 +150,7 @@ class BrowserProcessImpl : public Browse
+ std::unique_ptr<PrefService> local_state_;
+ std::string locale_;
+ std::string system_locale_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string selected_linux_storage_backend_;
+ #endif
+ embedder_support::OriginTrialsSettingsStorage origin_trials_settings_storage_;
diff --git a/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.cc b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.cc
new file mode 100644
index 0000000000..ee0fb83cd6
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.cc
@@ -0,0 +1,90 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/electron_browser_main_parts.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/electron_browser_main_parts.cc
+@@ -76,7 +76,7 @@
+ #include "ui/wm/core/wm_state.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "chrome/browser/ui/views/dark_mode_manager_linux.h"
+ #include "device/bluetooth/bluetooth_adapter_factory.h"
+@@ -129,7 +129,7 @@ namespace electron {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class LinuxUiGetterImpl : public ui::LinuxUiGetter {
+ public:
+ LinuxUiGetterImpl() = default;
+@@ -209,7 +209,7 @@ int ElectronBrowserMainParts::PreEarlyIn
+ #if BUILDFLAG(IS_POSIX)
+ HandleSIGCHLD();
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DetectOzonePlatform();
+ ui::OzonePlatform::PreEarlyInitialization();
+ #endif
+@@ -300,7 +300,7 @@ int ElectronBrowserMainParts::PreCreateT
+ // happen before the ResourceBundle is loaded
+ if (locale.empty())
+ l10n_util::OverrideLocaleWithCocoaLocale();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // l10n_util::GetApplicationLocaleInternal uses g_get_language_names(),
+ // which keys off of getenv("LC_ALL").
+ // We must set this env first to make ui::ResourceBundle accept the custom
+@@ -331,7 +331,7 @@ int ElectronBrowserMainParts::PreCreateT
+ ElectronBrowserClient::SetApplicationLocale(app_locale);
+ fake_browser_process_->SetApplicationLocale(app_locale);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Reset to the original LC_ALL since we should not be changing it.
+ if (!locale.empty()) {
+ if (lc_all)
+@@ -388,7 +388,7 @@ void ElectronBrowserMainParts::PostDestr
+ }
+
+ void ElectronBrowserMainParts::ToolkitInitialized() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* linux_ui = ui::GetDefaultLinuxUi();
+ CHECK(linux_ui);
+ linux_ui_getter_ = std::make_unique<LinuxUiGetterImpl>();
+@@ -494,7 +494,7 @@ void ElectronBrowserMainParts::WillRunMa
+ }
+
+ void ElectronBrowserMainParts::PostCreateMainMessageLoop() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::string app_name = electron::Browser::Get()->GetName();
+ #endif
+ #if BUILDFLAG(IS_LINUX)
+@@ -506,7 +506,9 @@ void ElectronBrowserMainParts::PostCreat
+
+ if (!bluez::BluezDBusManager::IsInitialized())
+ bluez::DBusBluezManagerWrapperLinux::Initialize();
++#endif
+
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set up crypt config. This needs to be done before anything starts the
+ // network service, as the raw encryption key needs to be shared with the
+ // network service for encrypted cookie storage.
+@@ -601,7 +603,7 @@ void ElectronBrowserMainParts::PostMainM
+ fake_browser_process_->PostMainMessageLoopRun();
+ content::DevToolsAgentHost::StopRemoteDebuggingPipeHandler();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ui::OzonePlatform::GetInstance()->PostMainMessageLoopRun();
+ #endif
+ }
diff --git a/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.h b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.h
new file mode 100644
index 0000000000..2f17d7c50e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/electron_browser_main_parts.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/electron_browser_main_parts.h
+@@ -124,7 +124,7 @@ class ElectronBrowserMainParts : public
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void DetectOzonePlatform();
+ #endif
+
+@@ -146,7 +146,7 @@ class ElectronBrowserMainParts : public
+ std::unique_ptr<display::Screen> screen_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<ui::DarkModeManagerLinux> dark_mode_manager_;
+ std::unique_ptr<ui::LinuxUiGetter> linux_ui_getter_;
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
new file mode 100644
index 0000000000..14a2606575
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/electron_browser_main_parts_posix.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/electron_browser_main_parts_posix.cc
+@@ -210,6 +210,9 @@ void ElectronBrowserMainParts::InstallSh
+ g_pipe_pid = getpid();
+ g_shutdown_pipe_read_fd = pipefd[0];
+ g_shutdown_pipe_write_fd = pipefd[1];
++#if defined(OS_BSD)
++ const size_t kShutdownDetectorThreadStackSize = 0;
++#else
+ #if !defined(ADDRESS_SANITIZER)
+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 2;
+ #else
+@@ -217,6 +220,7 @@ void ElectronBrowserMainParts::InstallSh
+ // stack size to avoid hitting the guard page.
+ const size_t kShutdownDetectorThreadStackSize = PTHREAD_STACK_MIN * 4;
+ #endif
++#endif
+ ShutdownDetector* detector = new ShutdownDetector(
+ g_shutdown_pipe_read_fd, std::move(shutdown_callback), task_runner);
+
diff --git a/electron34/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc b/electron34/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
new file mode 100644
index 0000000000..df7001d886
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc
+@@ -54,6 +54,10 @@ bool ElectronRuntimeAPIDelegate::GetPlat
+ info->os = extensions::api::runtime::PlatformOs::kLinux;
+ } else if (strcmp(os, "openbsd") == 0) {
+ info->os = extensions::api::runtime::PlatformOs::kOpenbsd;
++ } else if (strcmp(os, "freebsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kFreebsd;
++ } else if (strcmp(os, "netbsd") == 0) {
++ info->os = extensions::api::runtime::PlatformOs::kNetbsd;
+ } else {
+ NOTREACHED();
+ }
diff --git a/electron34/patches/patch-electron_shell_browser_native__window.cc b/electron34/patches/patch-electron_shell_browser_native__window.cc
new file mode 100644
index 0000000000..ebd32bd052
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_native__window.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/native_window.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/native_window.cc
+@@ -200,7 +200,7 @@ void NativeWindow::InitFromOptions(const
+ } else {
+ SetSizeConstraints(size_constraints);
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool closable;
+ if (options.Get(options::kClosable, &closable)) {
+ SetClosable(closable);
diff --git a/electron34/patches/patch-electron_shell_browser_native__window__views.cc b/electron34/patches/patch-electron_shell_browser_native__window__views.cc
new file mode 100644
index 0000000000..2add471e18
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_native__window__views.cc
@@ -0,0 +1,197 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/native_window_views.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/native_window_views.cc
+@@ -49,7 +49,7 @@
+ #include "ui/wm/core/shadow_types.h"
+ #include "ui/wm/core/window_util.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/strings/string_util.h"
+ #include "shell/browser/browser.h"
+ #include "shell/browser/linux/unity_service.h"
+@@ -294,7 +294,7 @@ NativeWindowViews::NativeWindowViews(con
+ params.parent = parent->GetNativeWindow();
+
+ params.native_widget = new ElectronDesktopNativeWidgetAura(this);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string name = Browser::Get()->GetName();
+ // Set WM_WINDOW_ROLE.
+ params.wm_role_name = "browser-window";
+@@ -320,7 +320,7 @@ NativeWindowViews::NativeWindowViews(con
+ std::string window_type;
+ options.Get(options::kType, &window_type);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Set _GTK_THEME_VARIANT to dark if we have "dark-theme" option set.
+ bool use_dark_theme = false;
+ if (options.Get(options::kDarkTheme, &use_dark_theme) && use_dark_theme) {
+@@ -427,7 +427,7 @@ NativeWindowViews::NativeWindowViews(con
+ if (window)
+ window->AddPreTargetHandler(this);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On linux after the widget is initialized we might have to force set the
+ // bounds if the bounds are smaller than the current display
+ SetBounds(gfx::Rect(GetPosition(), bounds.size()), false);
+@@ -463,7 +463,7 @@ NativeWindowViews::~NativeWindowViews()
+ }
+
+ void NativeWindowViews::SetGTKDarkThemeEnabled(bool use_dark_theme) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ const std::string color = use_dark_theme ? "dark" : "light";
+ auto* connection = x11::Connection::Get();
+@@ -525,7 +525,7 @@ void NativeWindowViews::Show() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+
+@@ -541,7 +541,7 @@ void NativeWindowViews::ShowInactive() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+
+@@ -560,7 +560,7 @@ void NativeWindowViews::Hide() {
+
+ NotifyWindowHide();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowUnmapped();
+ #endif
+@@ -591,7 +591,7 @@ bool NativeWindowViews::IsVisible() cons
+ bool NativeWindowViews::IsEnabled() const {
+ #if BUILDFLAG(IS_WIN)
+ return ::IsWindowEnabled(GetAcceleratedWidget());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11())
+ return !event_disabler_.get();
+ NOTIMPLEMENTED();
+@@ -831,7 +831,7 @@ void NativeWindowViews::SetBounds(const
+ }
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux and Windows the minimum and maximum size should be updated with
+ // window size when window is not resizable.
+ if (!resizable_) {
+@@ -1089,7 +1089,7 @@ bool NativeWindowViews::IsClosable() con
+ return false;
+ }
+ return !(info.fState & MFS_DISABLED);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #endif
+ }
+@@ -1129,7 +1129,7 @@ ui::ZOrderLevel NativeWindowViews::GetZO
+ // for now to avoid breaking API contract, but should consider the long
+ // term plan for this aligning with upstream.
+ void NativeWindowViews::Center() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto display =
+ display::Screen::GetScreen()->GetDisplayNearestWindow(GetNativeWindow());
+ gfx::Rect window_bounds_in_screen = display.work_area();
+@@ -1350,7 +1350,7 @@ bool NativeWindowViews::IsFocusable() co
+ }
+
+ void NativeWindowViews::SetMenu(ElectronMenuModel* menu_model) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Remove global menu bar.
+ if (global_menu_bar_ && menu_model == nullptr) {
+ global_menu_bar_.reset();
+@@ -1405,7 +1405,7 @@ void NativeWindowViews::SetMenu(Electron
+ void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
+ NativeWindow::SetParentWindow(parent);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ auto* connection = x11::Connection::Get();
+ connection->SetProperty(
+@@ -1451,7 +1451,7 @@ void NativeWindowViews::SetProgressBar(d
+ NativeWindow::ProgressState state) {
+ #if BUILDFLAG(IS_WIN)
+ taskbar_host_.SetProgressBar(GetAcceleratedWidget(), progress, state);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (unity::IsRunning()) {
+ unity::SetProgressFraction(progress);
+ }
+@@ -1529,7 +1529,7 @@ bool NativeWindowViews::IsVisibleOnAllWo
+ if (const auto* view_native_widget = widget()->native_widget_private())
+ return view_native_widget->IsVisibleOnAllWorkspaces();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsX11()) {
+ // Use the presence/absence of _NET_WM_STATE_STICKY in _NET_WM_STATE to
+ // determine whether the current window is visible on all workspaces.
+@@ -1552,7 +1552,7 @@ content::DesktopMediaID NativeWindowView
+ #if BUILDFLAG(IS_WIN)
+ window_handle =
+ reinterpret_cast<content::DesktopMediaID::Id>(accelerated_widget);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ window_handle = static_cast<uint32_t>(accelerated_widget);
+ #endif
+ aura::WindowTreeHost* const host =
+@@ -1650,7 +1650,7 @@ void NativeWindowViews::SetIcon(HICON wi
+ SendMessage(hwnd, WM_SETICON, ICON_BIG,
+ reinterpret_cast<LPARAM>(app_icon_.get()));
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NativeWindowViews::SetIcon(const gfx::ImageSkia& icon) {
+ auto* tree_host = views::DesktopWindowTreeHostLinux::GetHostForWidget(
+ GetAcceleratedWidget());
+@@ -1746,7 +1746,7 @@ bool NativeWindowViews::CanMaximize() co
+ bool NativeWindowViews::CanMinimize() const {
+ #if BUILDFLAG(IS_WIN)
+ return minimizable_;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #endif
+ }
+@@ -1802,7 +1802,7 @@ void NativeWindowViews::HandleKeyboardEv
+ if (widget_destroyed_)
+ return;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (event.windows_key_code == ui::VKEY_BROWSER_BACK)
+ NotifyWindowExecuteAppCommand(kBrowserBackward);
+ else if (event.windows_key_code == ui::VKEY_BROWSER_FORWARD)
+@@ -1821,7 +1821,7 @@ void NativeWindowViews::OnMouseEvent(ui:
+ // Alt+Click should not toggle menu bar.
+ root_view_.ResetAltState();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (event->changed_button_flags() == ui::EF_BACK_MOUSE_BUTTON)
+ NotifyWindowExecuteAppCommand(kBrowserBackward);
+ else if (event->changed_button_flags() == ui::EF_FORWARD_MOUSE_BUTTON)
diff --git a/electron34/patches/patch-electron_shell_browser_native__window__views.h b/electron34/patches/patch-electron_shell_browser_native__window__views.h
new file mode 100644
index 0000000000..7b6e97481c
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_native__window__views.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/native_window_views.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/native_window_views.h
+@@ -25,7 +25,7 @@
+
+ namespace electron {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class GlobalMenuBarX11;
+ #endif
+
+@@ -162,7 +162,7 @@ class NativeWindowViews : public NativeW
+ LPARAM l_param,
+ LRESULT* result);
+ void SetIcon(HICON small_icon, HICON app_icon);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetIcon(const gfx::ImageSkia& icon);
+ #endif
+
+@@ -246,7 +246,7 @@ class NativeWindowViews : public NativeW
+ // events from resizing the window.
+ extensions::SizeConstraints old_size_constraints_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<GlobalMenuBarX11> global_menu_bar_;
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_net_system__network__context__manager.cc b/electron34/patches/patch-electron_shell_browser_net_system__network__context__manager.cc
new file mode 100644
index 0000000000..563bec5542
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_net_system__network__context__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/net/system_network_context_manager.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/net/system_network_context_manager.cc
+@@ -39,7 +39,7 @@
+ #include "shell/common/options_switches.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "components/os_crypt/sync/key_storage_config_linux.h"
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc b/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc
new file mode 100644
index 0000000000..626479998b
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/osr/osr_host_display_client.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/osr/osr_host_display_client.cc
+@@ -95,7 +95,7 @@ void OffScreenHostDisplayClient::CreateL
+ layered_window_updater_->SetActive(active_);
+ }
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ void OffScreenHostDisplayClient::DidCompleteSwapWithNewSize(
+ const gfx::Size& size) {}
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.h b/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.h
new file mode 100644
index 0000000000..5d62a230ea
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_osr_osr__host__display__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/osr/osr_host_display_client.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/osr/osr_host_display_client.h
+@@ -74,7 +74,7 @@ class OffScreenHostDisplayClient : publi
+ mojo::PendingReceiver<viz::mojom::LayeredWindowUpdater> receiver)
+ override;
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ void DidCompleteSwapWithNewSize(const gfx::Size& size) override;
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_osr_osr__paint__event.h b/electron34/patches/patch-electron_shell_browser_osr_osr__paint__event.h
new file mode 100644
index 0000000000..424791bef3
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_osr_osr__paint__event.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/osr/osr_paint_event.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/osr/osr_paint_event.h
+@@ -96,7 +96,7 @@ struct OffscreenSharedTextureValue {
+ // On Windows it is a HANDLE to the shared D3D11 texture.
+ // On macOS it is a IOSurface* to the shared IOSurface.
+ uintptr_t shared_texture_handle;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::vector<OffscreenNativePixmapPlaneInfo> planes;
+ uint64_t modifier;
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_osr_osr__video__consumer.cc b/electron34/patches/patch-electron_shell_browser_osr_osr__video__consumer.cc
new file mode 100644
index 0000000000..e7a056c5e6
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_osr_osr__video__consumer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/osr/osr_video_consumer.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/osr/osr_video_consumer.cc
+@@ -103,7 +103,7 @@ void OffScreenVideoConsumer::OnFrameCapt
+ #elif BUILDFLAG(IS_APPLE)
+ texture.shared_texture_handle =
+ reinterpret_cast<uintptr_t>(gmb_handle.io_surface.get());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const auto& native_pixmap = gmb_handle.native_pixmap_handle;
+ texture.modifier = native_pixmap.modifier;
+ for (const auto& plane : native_pixmap.planes) {
diff --git a/electron34/patches/patch-electron_shell_browser_printing_printing__utils.cc b/electron34/patches/patch-electron_shell_browser_printing_printing__utils.cc
new file mode 100644
index 0000000000..3db960ee6c
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_printing_printing__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/printing/printing_utils.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/printing/printing_utils.cc
+@@ -31,7 +31,7 @@
+ #include <ApplicationServices/ApplicationServices.h>
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <gtk/gtk.h>
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_browser_relauncher__linux.cc b/electron34/patches/patch-electron_shell_browser_relauncher__linux.cc
new file mode 100644
index 0000000000..8730dd0836
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_relauncher__linux.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/relauncher_linux.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/relauncher_linux.cc
+@@ -6,8 +6,10 @@
+
+ #include <fcntl.h>
+ #include <signal.h>
++#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+ #include <sys/prctl.h>
+ #include <sys/signalfd.h>
++#endif
+
+ #include "base/files/scoped_file.h"
+ #include "base/logging.h"
+@@ -24,6 +26,10 @@ void RelauncherSynchronizeWithParent() {
+ base::ScopedFD relauncher_sync_fd(kRelauncherSyncFD);
+ static const auto signum = SIGUSR2;
+
++#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
++ PLOG(ERROR) << "signalfd & prctl";
++ fprintf(stderr, "Not Implemented signalfd & prctl in atom/browser/relauncher_linux.cc");
++#else
+ // send signum to current process when parent process ends.
+ if (HANDLE_EINTR(prctl(PR_SET_PDEATHSIG, signum)) != 0) {
+ PLOG(ERROR) << "prctl";
+@@ -48,6 +54,7 @@ void RelauncherSynchronizeWithParent() {
+
+ // Wait for the parent to exit
+ parentWaiter.Wait();
++#endif
+ }
+
+ int LaunchProgram(const StringVector& relauncher_args,
diff --git a/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc b/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc
new file mode 100644
index 0000000000..f847bcd55c
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/inspectable_web_contents.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/inspectable_web_contents.cc
+@@ -552,7 +552,7 @@ void InspectableWebContents::LoadComplet
+ prefs.FindString("currentDockState");
+ base::RemoveChars(*current_dock_state, "\"", &dock_state_);
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* api_web_contents = api::WebContents::From(GetWebContents());
+ if (api_web_contents) {
+ auto* win =
diff --git a/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h b/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
new file mode 100644
index 0000000000..2df8c03f4c
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/inspectable_web_contents_view_delegate.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/inspectable_web_contents_view_delegate.h
+@@ -24,7 +24,7 @@ class InspectableWebContentsViewDelegate
+ // Returns the icon of devtools window.
+ virtual ui::ImageModel GetDevToolsWindowIcon();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Called when creating devtools window.
+ virtual void GetDevToolsWindowWMClass(std::string* name,
+ std::string* class_name) {}
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc b/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
new file mode 100644
index 0000000000..11fd28b76d
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/electron_views_delegate.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/electron_views_delegate.cc
+@@ -9,7 +9,7 @@
+ #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
+ #include "ui/views/widget/native_widget_aura.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #include "ui/linux/linux_ui.h"
+@@ -17,7 +17,7 @@
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool IsDesktopEnvironmentUnity() {
+ auto env = base::Environment::Create();
+ base::nix::DesktopEnvironment desktop_env =
+@@ -54,7 +54,7 @@ void ViewsDelegate::NotifyMenuItemFocuse
+ int item_count,
+ bool has_submenu) {}
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
+ return nullptr;
+ }
+@@ -82,7 +82,7 @@ void ViewsDelegate::OnBeforeWidgetInit(
+ }
+
+ bool ViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Ubuntu Unity, the system always provides a title bar for maximized
+ // windows.
+ if (!maximized)
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h b/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h
new file mode 100644
index 0000000000..df856f1c0e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/electron_views_delegate.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/electron_views_delegate.h
+@@ -44,7 +44,7 @@ class ViewsDelegate : public views::View
+ HICON GetSmallWindowIcon() const override;
+ int GetAppbarAutohideEdges(HMONITOR monitor,
+ base::OnceClosure callback) override;
+-#elif BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#elif (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* GetDefaultWindowIcon() const override;
+ #endif
+ std::unique_ptr<views::NonClientFrameView> CreateDefaultNonClientFrameView(
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc b/electron34/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc
new file mode 100644
index 0000000000..250da5d3cf
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/inspectable_web_contents_view_views.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/inspectable_web_contents_view_views.cc
+@@ -193,7 +193,7 @@ void InspectableWebContentsViewViews::Se
+ params.delegate = devtools_window_delegate_;
+ params.bounds = inspectable_web_contents()->dev_tools_bounds();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ params.wm_role_name = "devtools";
+ if (GetDelegate())
+ GetDelegate()->GetDevToolsWindowWMClass(¶ms.wm_class_name,
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.cc b/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.cc
new file mode 100644
index 0000000000..1c3016a3da
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/menu_bar.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/menu_bar.cc
+@@ -14,7 +14,7 @@
+ #include "ui/views/background.h"
+ #include "ui/views/layout/box_layout.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/gtk/gtk_util.h" // nogncheck
+ #endif
+
+@@ -214,7 +214,7 @@ void MenuBar::ViewHierarchyChanged(
+
+ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
+ if (theme) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ background_color_ = gtk::GetBgColor("GtkMenuBar#menubar");
+ enabled_color_ =
+ gtk::GetFgColor("GtkMenuBar#menubar GtkMenuItem#menuitem GtkLabel");
+@@ -239,7 +239,7 @@ void MenuBar::RebuildChildren() {
+ }
+
+ void MenuBar::UpdateViewColors() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // set menubar background color
+ SetBackground(views::CreateSolidBackground(background_color_));
+ #endif
+@@ -247,7 +247,7 @@ void MenuBar::UpdateViewColors() {
+ // set child colors
+ if (menu_model_ == nullptr)
+ return;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const auto& textColor =
+ window_->IsFocused() ? enabled_color_ : disabled_color_;
+ for (views::View* child : GetChildrenInZOrder()) {
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.h b/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.h
new file mode 100644
index 0000000000..4d7aab3aeb
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_menu__bar.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/menu_bar.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/menu_bar.h
+@@ -84,7 +84,7 @@ class MenuBar : public views::Accessible
+ View* FindAccelChild(char16_t key);
+
+ SkColor background_color_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SkColor enabled_color_;
+ SkColor disabled_color_;
+ #endif
diff --git a/electron34/patches/patch-electron_shell_browser_ui_views_submenu__button.cc b/electron34/patches/patch-electron_shell_browser_ui_views_submenu__button.cc
new file mode 100644
index 0000000000..0e1160dce1
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_browser_ui_views_submenu__button.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/browser/ui/views/submenu_button.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/browser/ui/views/submenu_button.cc
+@@ -22,7 +22,7 @@ SubmenuButton::SubmenuButton(PressedCall
+ const SkColor& background_color)
+ : views::MenuButton(std::move(callback), gfx::RemoveAccelerator(title)),
+ background_color_(background_color) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Dont' use native style border.
+ SetBorder(CreateDefaultBorder());
+ #endif
diff --git a/electron34/patches/patch-electron_shell_common_api_electron__api__clipboard.cc b/electron34/patches/patch-electron_shell_common_api_electron__api__clipboard.cc
new file mode 100644
index 0000000000..6376f1d86f
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_api_electron__api__clipboard.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/api/electron_api_clipboard.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/api/electron_api_clipboard.cc
+@@ -58,7 +58,7 @@ std::string Clipboard::Read(const std::s
+ ui::ClipboardFormatType::CustomPlatformType(format_string));
+ bool rawFormatAvailable = clipboard->IsFormatAvailable(
+ rawFormat, ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!rawFormatAvailable) {
+ rawFormatAvailable = clipboard->IsFormatAvailable(
+ rawFormat, ui::ClipboardBuffer::kSelection, /* data_dst = */ nullptr);
+@@ -74,7 +74,7 @@ std::string Clipboard::Read(const std::s
+ custom_format_names =
+ clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kCopyPaste,
+ /* data_dst = */ nullptr);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!custom_format_names.contains(format_string)) {
+ custom_format_names =
+ clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kSelection,
diff --git a/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.cc b/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.cc
new file mode 100644
index 0000000000..b8242162a9
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/api/electron_api_native_image.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/api/electron_api_native_image.cc
+@@ -640,7 +640,7 @@ void Initialize(v8::Local<v8::Object> ex
+ native_image.SetMethod("createFromDataURL", &NativeImage::CreateFromDataURL);
+ native_image.SetMethod("createFromNamedImage",
+ &NativeImage::CreateFromNamedImage);
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ native_image.SetMethod("createThumbnailFromPath",
+ &NativeImage::CreateThumbnailFromPath);
+ #endif
diff --git a/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.h b/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.h
new file mode 100644
index 0000000000..21bc39d093
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_api_electron__api__native__image.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/api/electron_api_native_image.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/api/electron_api_native_image.h
+@@ -80,7 +80,7 @@ class NativeImage final : public gin::Wr
+ const GURL& url);
+ static gin::Handle<NativeImage> CreateFromNamedImage(gin::Arguments* args,
+ std::string name);
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ static v8::Local<v8::Promise> CreateThumbnailFromPath(
+ v8::Isolate* isolate,
+ const base::FilePath& path,
diff --git a/electron34/patches/patch-electron_shell_common_api_electron__bindings.cc b/electron34/patches/patch-electron_shell_common_api_electron__bindings.cc
new file mode 100644
index 0000000000..d7176c848c
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_api_electron__bindings.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/api/electron_bindings.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/api/electron_bindings.cc
+@@ -254,7 +254,7 @@ void ElectronBindings::DidReceiveMemoryD
+ if (target_pid == dump.pid()) {
+ auto dict = gin_helper::Dictionary::CreateEmpty(isolate);
+ const auto& osdump = dump.os_dump();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ dict.Set("residentSet", osdump.resident_set_kb);
+ #endif
+ dict.Set("private", osdump.private_footprint_kb);
diff --git a/electron34/patches/patch-electron_shell_common_electron__command__line.cc b/electron34/patches/patch-electron_shell_common_electron__command__line.cc
new file mode 100644
index 0000000000..0b454f154b
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_electron__command__line.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/electron_command_line.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/electron_command_line.cc
+@@ -26,7 +26,7 @@ void ElectronCommandLine::Init(int argc,
+ argv_.assign(argv, argv + argc);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ void ElectronCommandLine::InitializeFromCommandLine() {
+ argv_ = base::CommandLine::ForCurrentProcess()->argv();
diff --git a/electron34/patches/patch-electron_shell_common_electron__command__line.h b/electron34/patches/patch-electron_shell_common_electron__command__line.h
new file mode 100644
index 0000000000..7e18417458
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_electron__command__line.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/electron_command_line.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/electron_command_line.h
+@@ -22,7 +22,7 @@ class ElectronCommandLine {
+
+ static void Init(int argc, base::CommandLine::CharType** argv);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux the command line has to be read from base::CommandLine since
+ // it is using zygote.
+ static void InitializeFromCommandLine();
diff --git a/electron34/patches/patch-electron_shell_common_electron__paths.h b/electron34/patches/patch-electron_shell_common_electron__paths.h
new file mode 100644
index 0000000000..7b256593f5
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_electron__paths.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/electron_paths.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/electron_paths.h
+@@ -30,7 +30,7 @@ enum {
+ DIR_RECENT, // Directory where recent files live
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ DIR_APP_DATA, // Application Data directory under the user profile.
+ #endif
+
diff --git a/electron34/patches/patch-electron_shell_common_gin__converters_osr__converter.cc b/electron34/patches/patch-electron_shell_common_gin__converters_osr__converter.cc
new file mode 100644
index 0000000000..8ddf6e6a5b
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_gin__converters_osr__converter.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/gin_converters/osr_converter.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/gin_converters/osr_converter.cc
+@@ -117,7 +117,7 @@ v8::Local<v8::Value> Converter<electron:
+ const_cast<uintptr_t*>(&val.shared_texture_handle)),
+ sizeof(val.shared_texture_handle));
+ dict.Set("sharedTextureHandle", handle_buf.ToLocalChecked());
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto v8_planes = base::ToVector(val.planes, [isolate](const auto& plane) {
+ gin::Dictionary v8_plane(isolate, v8::Object::New(isolate));
+ v8_plane.Set("stride", plane.stride);
diff --git a/electron34/patches/patch-electron_shell_common_gin__converters_std__converter.h b/electron34/patches/patch-electron_shell_common_gin__converters_std__converter.h
new file mode 100644
index 0000000000..8fc9e77e63
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_gin__converters_std__converter.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/gin_converters/std_converter.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/gin_converters/std_converter.h
+@@ -57,7 +57,7 @@ struct Converter<std::array<T, N>> {
+ }
+ };
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ template <>
+ struct Converter<unsigned long> { // NOLINT(runtime/int)
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
diff --git a/electron34/patches/patch-electron_shell_common_node__bindings.cc b/electron34/patches/patch-electron_shell_common_node__bindings.cc
new file mode 100644
index 0000000000..ddb269070e
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_node__bindings.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/node_bindings.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/node_bindings.cc
+@@ -45,7 +45,7 @@
+ #include "third_party/electron_node/src/debug_utils.h"
+ #include "third_party/electron_node/src/module_wrap.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "shell/common/crash_keys.h"
+ #endif
+
+@@ -159,7 +159,7 @@ bool g_is_initialized = false;
+ void V8FatalErrorCallback(const char* location, const char* message) {
+ LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.message", message);
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.location", location);
+ #endif
+@@ -535,7 +535,7 @@ void NodeBindings::Initialize(v8::Local<
+ TRACE_EVENT0("electron", "NodeBindings::Initialize");
+ // Open node's error reporting system for browser process.
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Get real command line in renderer process forked by zygote.
+ if (browser_env_ != BrowserEnvironment::kBrowser)
+ ElectronCommandLine::InitializeFromCommandLine();
diff --git a/electron34/patches/patch-electron_shell_common_node__bindings__linux.cc b/electron34/patches/patch-electron_shell_common_node__bindings__linux.cc
new file mode 100644
index 0000000000..8ba40f79e9
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_node__bindings__linux.cc
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/node_bindings_linux.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/node_bindings_linux.cc
+@@ -4,12 +4,25 @@
+
+ #include "shell/common/node_bindings_linux.h"
+
++#if !defined(OS_BSD)
+ #include <sys/epoll.h>
++#else
++#include <errno.h>
++#include <sys/select.h>
++#include <sys/sysctl.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#endif
+
+ namespace electron {
+
+ NodeBindingsLinux::NodeBindingsLinux(BrowserEnvironment browser_env)
++#if !defined(OS_BSD)
+ : NodeBindings(browser_env), epoll_(epoll_create(1)) {
++#else
++ : NodeBindings(browser_env) {
++#endif
++#if !defined(OS_BSD)
+ auto* const event_loop = uv_loop();
+
+ int backend_fd = uv_backend_fd(event_loop);
+@@ -17,11 +30,13 @@ NodeBindingsLinux::NodeBindingsLinux(Bro
+ ev.events = EPOLLIN;
+ ev.data.fd = backend_fd;
+ epoll_ctl(epoll_, EPOLL_CTL_ADD, backend_fd, &ev);
++#endif
+ }
+
+ void NodeBindingsLinux::PollEvents() {
+ auto* const event_loop = uv_loop();
+
++#if !defined(OS_BSD)
+ int timeout = uv_backend_timeout(event_loop);
+
+ // Wait for new libuv events.
+@@ -30,6 +45,26 @@ void NodeBindingsLinux::PollEvents() {
+ struct epoll_event ev;
+ r = epoll_wait(epoll_, &ev, 1, timeout);
+ } while (r == -1 && errno == EINTR);
++#else
++ struct timeval tv;
++ int timeout = uv_backend_timeout(event_loop);
++ if (timeout != -1) {
++ tv.tv_sec = timeout / 1000;
++ tv.tv_usec = (timeout % 1000) * 1000;
++ }
++
++ fd_set readset;
++ int fd = uv_backend_fd(event_loop);
++ FD_ZERO(&readset);
++ FD_SET(fd, &readset);
++
++ // Wait for new libuv events.
++ int r;
++ do {
++ r = select(fd + 1, &readset, nullptr, nullptr,
++ timeout == -1 ? nullptr : &tv);
++ } while (r == -1 && errno == EINTR);
++#endif
+ }
+
+ // static
diff --git a/electron34/patches/patch-electron_shell_common_platform__util.h b/electron34/patches/patch-electron_shell_common_platform__util.h
new file mode 100644
index 0000000000..793740ed0d
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_common_platform__util.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/common/platform_util.h.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/common/platform_util.h
+@@ -56,7 +56,7 @@ bool SetLoginItemEnabled(const std::stri
+ bool enabled);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Returns a success flag.
+ // Unlike libgtkui, does *not* use "chromium-browser.desktop" as a fallback.
+ bool GetDesktopName(std::string* setme);
diff --git a/electron34/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc b/electron34/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
new file mode 100644
index 0000000000..6c9eb6b653
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/renderer/api/electron_api_crash_reporter_renderer.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/renderer/api/electron_api_crash_reporter_renderer.cc
+@@ -6,7 +6,7 @@
+ #include "shell/common/gin_helper/dictionary.h"
+ #include "shell/common/node_includes.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "shell/common/crash_keys.h"
+ #endif
+
+@@ -14,13 +14,13 @@ namespace {
+
+ v8::Local<v8::Value> GetParameters(v8::Isolate* isolate) {
+ std::map<std::string, std::string> keys;
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::GetCrashKeys(&keys);
+ #endif
+ return gin::ConvertToV8(isolate, keys);
+ }
+
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ void SetCrashKeyStub(const std::string& key, const std::string& value) {}
+ void ClearCrashKeyStub(const std::string& key) {}
+ #endif
+@@ -30,7 +30,7 @@ void Initialize(v8::Local<v8::Object> ex
+ v8::Local<v8::Context> context,
+ void* priv) {
+ gin_helper::Dictionary dict(context->GetIsolate(), exports);
+-#if IS_MAS_BUILD()
++#if IS_MAS_BUILD() || BUILDFLAG(IS_BSD)
+ dict.SetMethod("addExtraParameter", &SetCrashKeyStub);
+ dict.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
+ #else
diff --git a/electron34/patches/patch-electron_shell_services_node_node__service.cc b/electron34/patches/patch-electron_shell_services_node_node__service.cc
new file mode 100644
index 0000000000..9c4e80ed2b
--- /dev/null
+++ b/electron34/patches/patch-electron_shell_services_node_node__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/shell/services/node/node_service.cc.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/shell/services/node/node_service.cc
+@@ -22,7 +22,7 @@
+ #include "shell/common/node_includes.h"
+ #include "shell/services/node/parent_port.h"
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ #include "shell/common/crash_keys.h"
+ #endif
+
+@@ -39,7 +39,7 @@ void V8FatalErrorCallback(const char* lo
+ g_client_remote->OnV8FatalError(location, outstream.str());
+ }
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.message", message);
+ electron::crash_keys::SetCrashKey("electron.v8-fatal.location", location);
+ #endif
diff --git a/electron34/patches/patch-electron_spec_api-app-spec.ts b/electron34/patches/patch-electron_spec_api-app-spec.ts
new file mode 100644
index 0000000000..8b3e2ebda4
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-app-spec.ts
@@ -0,0 +1,130 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-app-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-app-spec.ts
+@@ -126,11 +126,11 @@ describe('app module', () => {
+ });
+
+ describe('app.getPreferredSystemLanguages()', () => {
+- ifit(process.platform !== 'linux')('should not be empty', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should not be empty', () => {
+ expect(app.getPreferredSystemLanguages().length).to.not.equal(0);
+ });
+
+- ifit(process.platform === 'linux')('should be empty or contain C entry', () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('should be empty or contain C entry', () => {
+ const languages = app.getPreferredSystemLanguages();
+ if (languages.length) {
+ expect(languages).to.not.include('C');
+@@ -193,7 +193,7 @@ describe('app module', () => {
+ expect(code).to.equal(123, 'exit code should be 123, if you see this please tag @MarshallOfSound');
+ });
+
+- ifit(['darwin', 'linux'].includes(process.platform))('exits gracefully', async function () {
++ ifit(['darwin', 'linux', 'freebsd', 'netbsd'].includes(process.platform))('exits gracefully', async function () {
+ const electronPath = process.execPath;
+ const appPath = path.join(fixturesPath, 'api', 'singleton');
+ appProcess = cp.spawn(electronPath, [appPath]);
+@@ -447,7 +447,7 @@ describe('app module', () => {
+ // let w = null
+
+ // before(function () {
+- // if (process.platform !== 'linux') {
++ // if (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') {
+ // this.skip()
+ // }
+ // })
+@@ -554,7 +554,7 @@ describe('app module', () => {
+ describe('app.badgeCount', () => {
+ const platformIsNotSupported =
+ (process.platform === 'win32') ||
+- (process.platform === 'linux' && !app.isUnityRunning());
++ ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && !app.isUnityRunning());
+
+ const expectedBadgeCount = 42;
+
+@@ -598,7 +598,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux' && !process.mas && (process.platform !== 'darwin' || process.arch === 'arm64'))('app.get/setLoginItemSettings API', function () {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd' && !process.mas && (process.platform !== 'darwin' || process.arch === 'arm64'))('app.get/setLoginItemSettings API', function () {
+ const isMac = process.platform === 'darwin';
+ const isWin = process.platform === 'win32';
+
+@@ -978,7 +978,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('accessibilitySupportEnabled property', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('accessibilitySupportEnabled property', () => {
+ it('with properties', () => {
+ it('can set accessibility support enabled', () => {
+ expect(app.accessibilitySupportEnabled).to.eql(false);
+@@ -1178,7 +1178,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('select-client-certificate event', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('select-client-certificate event', () => {
+ let w: BrowserWindow;
+
+ before(function () {
+@@ -1313,7 +1313,7 @@ describe('app module', () => {
+
+ describe('getApplicationNameForProtocol()', () => {
+ // TODO: Linux CI doesn't have registered http & https handlers
+- ifit(!(process.env.CI && process.platform === 'linux'))('returns application names for common protocols', function () {
++ ifit(!(process.env.CI && (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')))('returns application names for common protocols', function () {
+ // We can't expect particular app names here, but these protocols should
+ // at least have _something_ registered. Except on our Linux CI
+ // environment apparently.
+@@ -1331,7 +1331,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('getApplicationInfoForProtocol()', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('getApplicationInfoForProtocol()', () => {
+ it('returns promise rejection for a bogus protocol', async function () {
+ await expect(
+ app.getApplicationInfoForProtocol('bogus-protocol://')
+@@ -1381,7 +1381,7 @@ describe('app module', () => {
+ });
+
+ // FIXME Get these specs running on Linux CI
+- ifdescribe(process.platform !== 'linux')('getFileIcon() API', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('getFileIcon() API', () => {
+ const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico');
+ const sizes = {
+ small: 16,
+@@ -1463,7 +1463,7 @@ describe('app module', () => {
+ expect(entry.memory).to.have.property('privateBytes').that.is.greaterThan(0);
+ }
+
+- if (process.platform !== 'linux') {
++ if (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') {
+ expect(entry.sandboxed).to.be.a('boolean');
+ }
+
+@@ -1537,7 +1537,7 @@ describe('app module', () => {
+
+ it('succeeds with complete GPUInfo', async () => {
+ const completeInfo = await getGPUInfo('complete');
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ // For linux and macOS complete info is same as basic info
+ await verifyBasicGPUInfo(completeInfo);
+ const basicInfo = await getGPUInfo('basic');
+@@ -1561,7 +1561,7 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(!(process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
++ ifdescribe(!((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
+ let appProcess: cp.ChildProcess = null as any;
+ let server: net.Server = null as any;
+ const socketPath = process.platform === 'win32' ? '\\\\.\\pipe\\electron-mixed-sandbox' : '/tmp/electron-mixed-sandbox';
diff --git a/electron34/patches/patch-electron_spec_api-browser-window-spec.ts b/electron34/patches/patch-electron_spec_api-browser-window-spec.ts
new file mode 100644
index 0000000000..29fe7a1d40
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-browser-window-spec.ts
@@ -0,0 +1,188 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-browser-window-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-browser-window-spec.ts
+@@ -69,7 +69,7 @@ describe('BrowserWindow module', () => {
+ }).not.to.throw();
+ });
+
+- ifit(process.platform === 'linux')('does not crash when setting large window icons', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('does not crash when setting large window icons', async () => {
+ const appPath = path.join(fixtures, 'apps', 'xwindow-icon');
+ const appProcess = childProcess.spawn(process.execPath, [appPath]);
+ await once(appProcess, 'exit');
+@@ -296,7 +296,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('BrowserWindow.getContentProtection', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('BrowserWindow.getContentProtection', () => {
+ afterEach(closeAllWindows);
+ it('can set content protection', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -1170,7 +1170,7 @@ describe('BrowserWindow module', () => {
+
+ describe('BrowserWindow.minimize()', () => {
+ // TODO(codebytere): Enable for Linux once maximize/minimize events work in CI.
+- ifit(process.platform !== 'linux')('should not be visible when the window is minimized', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should not be visible when the window is minimized', async () => {
+ const minimize = once(w, 'minimize');
+ w.minimize();
+ await minimize;
+@@ -1187,7 +1187,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // TODO(dsanders11): Enable for Linux once CI plays nice with these kinds of tests
+- ifit(process.platform !== 'linux')('should not restore maximized windows', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should not restore maximized windows', async () => {
+ const maximize = once(w, 'maximize');
+ const shown = once(w, 'show');
+ w.maximize();
+@@ -1252,7 +1252,7 @@ describe('BrowserWindow module', () => {
+ expect(w.isFocused()).to.equal(true);
+ });
+
+- ifit(process.platform !== 'linux')('acquires focus status from the other windows', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('acquires focus status from the other windows', async () => {
+ const w1 = new BrowserWindow({ show: false });
+ const w2 = new BrowserWindow({ show: false });
+ const w3 = new BrowserWindow({ show: false });
+@@ -1353,7 +1353,7 @@ describe('BrowserWindow module', () => {
+ expect(w.isFocused()).to.equal(false);
+ });
+
+- ifit(process.platform !== 'linux')('transfers focus status to the next window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('transfers focus status to the next window', async () => {
+ const w1 = new BrowserWindow({ show: false });
+ const w2 = new BrowserWindow({ show: false });
+ const w3 = new BrowserWindow({ show: false });
+@@ -1812,7 +1812,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Maximized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('Maximized state', () => {
+ it('checks normal bounds when maximized', async () => {
+ const bounds = w.getBounds();
+ const maximize = once(w, 'maximize');
+@@ -2022,7 +2022,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Minimized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('Minimized state', () => {
+ it('checks normal bounds when minimized', async () => {
+ const bounds = w.getBounds();
+ const minimize = once(w, 'minimize');
+@@ -2986,7 +2986,7 @@ describe('BrowserWindow module', () => {
+ describe('BrowserWindow.setOpacity(opacity)', () => {
+ afterEach(closeAllWindows);
+
+- ifdescribe(process.platform !== 'linux')(('Windows and Mac'), () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')(('Windows and Mac'), () => {
+ it('make window with initial opacity', () => {
+ const w = new BrowserWindow({ show: false, opacity: 0.5 });
+ expect(w.getOpacity()).to.equal(0.5);
+@@ -3012,7 +3012,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')(('Linux'), () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')(('Linux'), () => {
+ it('sets 1 regardless of parameter', () => {
+ const w = new BrowserWindow({ show: false });
+ w.setOpacity(0);
+@@ -3223,7 +3223,7 @@ describe('BrowserWindow module', () => {
+ expect(overlayRectPreMax.height).to.equal(size);
+
+ // 'maximize' event is not emitted on Linux in CI.
+- if (process.platform !== 'linux' && !w.isMaximized()) {
++ if ((process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3289,7 +3289,7 @@ describe('BrowserWindow module', () => {
+ expect(preMaxHeight).to.equal(size);
+
+ // 'maximize' event is not emitted on Linux in CI.
+- if (process.platform !== 'linux' && !w.isMaximized()) {
++ if ((process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3954,7 +3954,7 @@ describe('BrowserWindow module', () => {
+ expect(test.nodeTimers).to.equal(true);
+ expect(test.nodeUrl).to.equal(true);
+
+- if (process.platform === 'linux' && test.osSandbox) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && test.osSandbox) {
+ expect(test.creationTime).to.be.null('creation time');
+ expect(test.systemMemoryInfo).to.be.null('system memory info');
+ } else {
+@@ -4459,7 +4459,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('max/minimize events', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('max/minimize events', () => {
+ afterEach(closeAllWindows);
+ it('emits an event when window is maximized', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -4730,7 +4730,7 @@ describe('BrowserWindow module', () => {
+ // TODO(zcbenz):
+ // This test does not run on Linux CI. See:
+ // https://github.com/electron/electron/issues/28699
+- ifit(process.platform === 'linux' && !process.env.CI)('should bring a minimized maximized window back to maximized state', async () => {
++ ifit((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && !process.env.CI)('should bring a minimized maximized window back to maximized state', async () => {
+ const w = new BrowserWindow({});
+ const maximize = once(w, 'maximize');
+ w.maximize();
+@@ -4747,7 +4747,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // TODO(dsanders11): Enable once maximize event works on Linux again on CI
+- ifdescribe(process.platform !== 'linux')('BrowserWindow.maximize()', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('BrowserWindow.maximize()', () => {
+ afterEach(closeAllWindows);
+ it('should show the window if it is not currently shown', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -4784,7 +4784,7 @@ describe('BrowserWindow module', () => {
+
+ // TODO(dsanders11): Enable once minimize event works on Linux again.
+ // See https://github.com/electron/electron/issues/28699
+- ifit(process.platform !== 'linux')('should not restore a minimized window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should not restore a minimized window', async () => {
+ const w = new BrowserWindow();
+ const minimize = once(w, 'minimize');
+ w.minimize();
+@@ -5270,7 +5270,7 @@ describe('BrowserWindow module', () => {
+ });
+
+ // On Linux there is no "resizable" property of a window.
+- ifit(process.platform !== 'linux')('does affect maximizability when disabled and enabled', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('does affect maximizability when disabled and enabled', () => {
+ const w = new BrowserWindow({ show: false });
+ expect(w.resizable).to.be.true('resizable');
+
+@@ -5480,7 +5480,7 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('window states (excluding Linux)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('window states (excluding Linux)', () => {
+ // Not implemented on Linux.
+ afterEach(closeAllWindows);
+
+@@ -6654,7 +6654,7 @@ describe('BrowserWindow module', () => {
+ describe('"transparent" option', () => {
+ afterEach(closeAllWindows);
+
+- ifit(process.platform !== 'linux')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('correctly returns isMaximized() when the window is maximized then minimized', async () => {
+ const w = new BrowserWindow({
+ frame: false,
+ transparent: true
diff --git a/electron34/patches/patch-electron_spec_api-clipboard-spec.ts b/electron34/patches/patch-electron_spec_api-clipboard-spec.ts
new file mode 100644
index 0000000000..e0aaaa41a1
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-clipboard-spec.ts
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-clipboard-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-clipboard-spec.ts
+@@ -54,7 +54,7 @@ ifdescribe(process.platform !== 'win32'
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('clipboard.readBookmark', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('clipboard.readBookmark', () => {
+ it('returns title and url', () => {
+ clipboard.writeBookmark('a title', 'https://electronjs.org');
+
+@@ -73,7 +73,7 @@ ifdescribe(process.platform !== 'win32'
+ });
+
+ describe('clipboard.read()', () => {
+- ifit(process.platform !== 'linux')('does not crash when reading various custom clipboard types', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('does not crash when reading various custom clipboard types', () => {
+ const type = process.platform === 'darwin' ? 'NSFilenamesPboardType' : 'FileNameW';
+
+ expect(() => {
+@@ -114,7 +114,7 @@ ifdescribe(process.platform !== 'win32'
+ const readImage = clipboard.readImage();
+ expect(readImage.toDataURL()).to.equal(i.toDataURL());
+
+- if (process.platform !== 'linux') {
++ if (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') {
+ if (process.platform !== 'win32') {
+ expect(clipboard.readBookmark()).to.deep.equal(bookmark);
+ } else {
diff --git a/electron34/patches/patch-electron_spec_api-content-tracing-spec.ts b/electron34/patches/patch-electron_spec_api-content-tracing-spec.ts
new file mode 100644
index 0000000000..2f0dc56f1c
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-content-tracing-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-content-tracing-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-content-tracing-spec.ts
+@@ -9,7 +9,7 @@ import { setTimeout } from 'node:timers/
+ import { ifdescribe } from './lib/spec-helpers';
+
+ // FIXME: The tests are skipped on linux arm/arm64
+-ifdescribe(!(['arm', 'arm64'].includes(process.arch)) || (process.platform !== 'linux'))('contentTracing', () => {
++ifdescribe(!(['arm', 'arm64'].includes(process.arch)) || (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd'))('contentTracing', () => {
+ const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => {
+ await app.whenReady();
+
diff --git a/electron34/patches/patch-electron_spec_api-crash-reporter-spec.ts b/electron34/patches/patch-electron_spec_api-crash-reporter-spec.ts
new file mode 100644
index 0000000000..2790479fcd
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-crash-reporter-spec.ts
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-crash-reporter-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-crash-reporter-spec.ts
+@@ -14,7 +14,7 @@ import { setTimeout } from 'node:timers/
+ import { ifdescribe, ifit, defer, startRemoteControlApp, repeatedly, listen } from './lib/spec-helpers';
+
+ const isWindowsOnArm = process.platform === 'win32' && process.arch === 'arm64';
+-const isLinuxOnArm = process.platform === 'linux' && process.arch.includes('arm');
++const isLinuxOnArm = ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && process.arch.includes('arm'));
+
+ type CrashInfo = {
+ prod: string
+@@ -47,7 +47,7 @@ function checkCrash (expectedProcessType
+
+ // TODO(nornagon): minidumps are sometimes (not always) turning up empty on
+ // 32-bit Linux. Figure out why.
+- if (!(process.platform === 'linux' && process.arch === 'ia32')) {
++ if (!((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && process.arch === 'ia32')) {
+ expect(fields.upload_file_minidump.length).to.be.greaterThan(0);
+ }
+ }
+@@ -184,7 +184,7 @@ ifdescribe(!isLinuxOnArm && !process.mas
+
+ // Ensures that passing in crashpadHandlerPID flag for Linx child processes
+ // does not affect child process args.
+- ifit(process.platform === 'linux')('ensure linux child process args are not modified', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('ensure linux child process args are not modified', async () => {
+ const { port, waitForCrash } = await startServer();
+ let exitCode: number | null = null;
+ const appPath = path.join(__dirname, 'fixtures', 'apps', 'crash');
+@@ -533,7 +533,7 @@ ifdescribe(!isLinuxOnArm && !process.mas
+ }
+ }
+
+- const processList = process.platform === 'linux'
++ const processList = (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')
+ ? ['main', 'renderer', 'sandboxed-renderer']
+ : ['main', 'renderer', 'sandboxed-renderer', 'node'];
+ for (const crashingProcess of processList) {
+@@ -546,7 +546,7 @@ ifdescribe(!isLinuxOnArm && !process.mas
+ return app.getPath('crashDumps');
+ });
+ let reportsDir = crashesDir;
+- if (process.platform === 'darwin' || process.platform === 'linux') {
++ if (process.platform === 'darwin' || process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
+@@ -570,7 +570,7 @@ ifdescribe(!isLinuxOnArm && !process.mas
+ expect(remoteCrashesDir).to.equal(crashesDir);
+
+ let reportsDir = crashesDir;
+- if (process.platform === 'darwin' || process.platform === 'linux') {
++ if (process.platform === 'darwin' || process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
diff --git a/electron34/patches/patch-electron_spec_api-desktop-capturer-spec.ts b/electron34/patches/patch-electron_spec_api-desktop-capturer-spec.ts
new file mode 100644
index 0000000000..ca964a73be
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-desktop-capturer-spec.ts
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-desktop-capturer-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-desktop-capturer-spec.ts
+@@ -45,7 +45,7 @@ ifdescribe(!process.arch.includes('arm')
+ });
+
+ // Linux doesn't return any window sources.
+- ifit(process.platform !== 'linux')('returns an empty display_id for window sources', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('returns an empty display_id for window sources', async () => {
+ const w = new BrowserWindow({ width: 200, height: 200 });
+ await w.loadURL('about:blank');
+
+@@ -57,7 +57,7 @@ ifdescribe(!process.arch.includes('arm')
+ }
+ });
+
+- ifit(process.platform !== 'linux')('returns display_ids matching the Screen API', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('returns display_ids matching the Screen API', async () => {
+ const displays = screen.getAllDisplays();
+ const sources = await desktopCapturer.getSources({ types: ['screen'] });
+ expect(sources).to.be.an('array').of.length(displays.length);
+@@ -118,7 +118,7 @@ ifdescribe(!process.arch.includes('arm')
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -154,7 +154,7 @@ ifdescribe(!process.arch.includes('arm')
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -223,7 +223,7 @@ ifdescribe(!process.arch.includes('arm')
+ // TODO(julien.isorce): investigate why |sources| is empty on the linux
+ // bots while it is not on my workstation, as expected, with and without
+ // the --ci parameter.
+- if (process.platform === 'linux' && sources.length === 0) {
++ if ((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && sources.length === 0) {
+ destroyWindows();
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
diff --git a/electron34/patches/patch-electron_spec_api-menu-spec.ts b/electron34/patches/patch-electron_spec_api-menu-spec.ts
new file mode 100644
index 0000000000..9b5f8415fb
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-menu-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-menu-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-menu-spec.ts
+@@ -890,7 +890,7 @@ describe('Menu module', function () {
+ // https://github.com/electron/electron/issues/35724
+ // Maximizing window is enough to trigger the bug
+ // FIXME(dsanders11): Test always passes on CI, even pre-fix
+- ifit(process.platform === 'linux' && !process.env.CI)('does not trigger issue #35724', (done) => {
++ ifit((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && !process.env.CI)('does not trigger issue #35724', (done) => {
+ const showAndCloseMenu = async () => {
+ await setTimeout(1000);
+ menu.popup({ window: w, x: 50, y: 50 });
diff --git a/electron34/patches/patch-electron_spec_api-native-image-spec.ts b/electron34/patches/patch-electron_spec_api-native-image-spec.ts
new file mode 100644
index 0000000000..9b27446dff
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-native-image-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-native-image-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-native-image-spec.ts
+@@ -428,7 +428,7 @@ describe('nativeImage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('createThumbnailFromPath(path, size)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('createThumbnailFromPath(path, size)', () => {
+ useRemoteContext({ webPreferences: { contextIsolation: false, nodeIntegration: true } });
+
+ it('throws when invalid size is passed', async () => {
diff --git a/electron34/patches/patch-electron_spec_api-net-log-spec.ts b/electron34/patches/patch-electron_spec_api-net-log-spec.ts
new file mode 100644
index 0000000000..4520b5b8d7
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-net-log-spec.ts
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-net-log-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-net-log-spec.ts
+@@ -121,7 +121,7 @@ describe('netLog module', () => {
+ expect(JSON.parse(dump).events.some((x: any) => x.params && x.params.bytes && Buffer.from(x.params.bytes, 'base64').includes(unique))).to.be.true('uuid present in dump');
+ });
+
+- ifit(process.platform !== 'linux')('should begin and end logging automatically when --log-net-log is passed', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should begin and end logging automatically when --log-net-log is passed', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
+@@ -134,7 +134,7 @@ describe('netLog module', () => {
+ expect(fs.existsSync(dumpFile)).to.be.true('dump file exists');
+ });
+
+- ifit(process.platform !== 'linux')('should begin and end logging automatically when --log-net-log is passed, and behave correctly when .startLogging() and .stopLogging() is called', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should begin and end logging automatically when --log-net-log is passed, and behave correctly when .startLogging() and .stopLogging() is called', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
+@@ -150,7 +150,7 @@ describe('netLog module', () => {
+ expect(fs.existsSync(dumpFileDynamic)).to.be.true('dynamic dump file exists');
+ });
+
+- ifit(process.platform !== 'linux')('should end logging automatically when only .startLogging() is called', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should end logging automatically when only .startLogging() is called', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
diff --git a/electron34/patches/patch-electron_spec_api-notification-dbus-spec.ts b/electron34/patches/patch-electron_spec_api-notification-dbus-spec.ts
new file mode 100644
index 0000000000..2ad240a49d
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-notification-dbus-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-notification-dbus-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-notification-dbus-spec.ts
+@@ -19,7 +19,7 @@ import { ifdescribe } from './lib/spec-h
+
+ const fixturesPath = path.join(__dirname, 'fixtures');
+
+-const skip = process.platform !== 'linux' ||
++const skip = (process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') ||
+ process.arch === 'ia32' ||
+ process.arch.indexOf('arm') === 0 ||
+ !process.env.DBUS_SESSION_BUS_ADDRESS;
diff --git a/electron34/patches/patch-electron_spec_api-power-monitor-spec.ts b/electron34/patches/patch-electron_spec_api-power-monitor-spec.ts
new file mode 100644
index 0000000000..0ac4b724b2
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-power-monitor-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-power-monitor-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-power-monitor-spec.ts
+@@ -18,7 +18,7 @@ import { ifdescribe, startRemoteControlA
+ describe('powerMonitor', () => {
+ let logindMock: any, dbusMockPowerMonitor: any, getCalls: any, emitSignal: any, reset: any;
+
+- ifdescribe(process.platform === 'linux' && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
++ ifdescribe((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && process.env.DBUS_SYSTEM_BUS_ADDRESS != null)('when powerMonitor module is loaded with dbus mock', () => {
+ before(async () => {
+ const systemBus = dbus.systemBus();
+ const loginService = systemBus.getService('org.freedesktop.login1');
diff --git a/electron34/patches/patch-electron_spec_api-process-spec.ts b/electron34/patches/patch-electron_spec_api-process-spec.ts
new file mode 100644
index 0000000000..e4a696c17f
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-process-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-process-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-process-spec.ts
+@@ -39,7 +39,7 @@ describe('process module', () => {
+ it('resolves promise successfully with valid data', async () => {
+ const memoryInfo = await invoke(() => process.getProcessMemoryInfo());
+ expect(memoryInfo).to.be.an('object');
+- if (process.platform === 'linux' || process.platform === 'win32') {
++ if (process.platform === 'linux' || process.platform === 'win32' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0);
+ }
+ expect(memoryInfo.private).to.be.a('number').greaterThan(0);
diff --git a/electron34/patches/patch-electron_spec_api-protocol-spec.ts b/electron34/patches/patch-electron_spec_api-protocol-spec.ts
new file mode 100644
index 0000000000..0cb741c233
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-protocol-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-protocol-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-protocol-spec.ts
+@@ -1738,7 +1738,7 @@ describe('protocol module', () => {
+
+ // TODO(nornagon): this test doesn't pass on Linux currently, investigate.
+ // test is also flaky on CI on macOS so it is currently disabled there as well.
+- ifit(process.platform !== 'linux' && (!process.env.CI || process.platform !== 'darwin'))('is fast', async () => {
++ ifit((process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') && (!process.env.CI || process.platform !== 'darwin'))('is fast', async () => {
+ // 128 MB of spaces.
+ const chunk = new Uint8Array(128 * 1024 * 1024);
+ chunk.fill(' '.charCodeAt(0));
diff --git a/electron34/patches/patch-electron_spec_api-safe-storage-spec.ts b/electron34/patches/patch-electron_spec_api-safe-storage-spec.ts
new file mode 100644
index 0000000000..9638e7e9c5
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-safe-storage-spec.ts
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-safe-storage-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-safe-storage-spec.ts
+@@ -29,7 +29,7 @@ describe('safeStorage module', () => {
+
+ describe('safeStorage module', () => {
+ before(() => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ });
+@@ -47,7 +47,7 @@ describe('safeStorage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')('SafeStorage.getSelectedStorageBackend()', () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('SafeStorage.getSelectedStorageBackend()', () => {
+ it('should return a valid backend', () => {
+ expect(safeStorage.getSelectedStorageBackend()).to.equal('basic_text');
+ });
diff --git a/electron34/patches/patch-electron_spec_api-screen-spec.ts b/electron34/patches/patch-electron_spec_api-screen-spec.ts
new file mode 100644
index 0000000000..e8006f43b6
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-screen-spec.ts
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-screen-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-screen-spec.ts
+@@ -95,7 +95,7 @@ describe('screen module', () => {
+
+ const { size } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ expect(size).to.have.property('width').that.is.a('number');
+ expect(size).to.have.property('height').that.is.a('number');
+ } else {
+@@ -109,7 +109,7 @@ describe('screen module', () => {
+
+ const { workAreaSize } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ expect(workAreaSize).to.have.property('width').that.is.a('number');
+ expect(workAreaSize).to.have.property('height').that.is.a('number');
+ } else {
+@@ -125,7 +125,7 @@ describe('screen module', () => {
+ expect(bounds).to.have.property('x').that.is.a('number');
+ expect(bounds).to.have.property('y').that.is.a('number');
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ expect(bounds).to.have.property('width').that.is.a('number');
+ expect(bounds).to.have.property('height').that.is.a('number');
+ } else {
diff --git a/electron34/patches/patch-electron_spec_api-shell-spec.ts b/electron34/patches/patch-electron_spec_api-shell-spec.ts
new file mode 100644
index 0000000000..db70d2c27d
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-shell-spec.ts
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-shell-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-shell-spec.ts
+@@ -37,7 +37,7 @@ describe('shell module', () => {
+
+ afterEach(async () => {
+ // reset env vars to prevent side effects
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ process.env.DE = envVars.de;
+ process.env.BROWSER = envVars.browser;
+ process.env.DISPLAY = envVars.display;
+@@ -57,6 +57,16 @@ describe('shell module', () => {
+ process.env.DE = 'generic';
+ process.env.DISPLAY = '';
+ requestReceived = Promise.resolve();
++ } else if (process.platform === 'freebsd' || process.platform === 'openbsd' || process.platform === 'netbsd') {
++ process.env.BROWSER = '/usr/bin/true';
++ process.env.DE = 'generic';
++ process.env.DISPLAY = '';
++ requestReceived = Promise.resolve();
++ } else if (process.platform === 'netbsd') {
++ process.env.BROWSER = '/usr/bin/true';
++ process.env.DE = 'generic';
++ process.env.DISPLAY = '';
++ requestReceived = Promise.resolve();
+ } else if (process.platform === 'darwin') {
+ // On the Mac CI machines, Safari tries to ask for a password to the
+ // code signing keychain we set up to test code signing (see
diff --git a/electron34/patches/patch-electron_spec_api-subframe-spec.ts b/electron34/patches/patch-electron_spec_api-subframe-spec.ts
new file mode 100644
index 0000000000..deb54dd96e
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-subframe-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-subframe-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-subframe-spec.ts
+@@ -218,7 +218,7 @@ describe('renderer nodeIntegrationInSubF
+ });
+
+ // app.getAppMetrics() does not return sandbox information on Linux.
+-ifdescribe(process.platform !== 'linux')('cross-site frame sandboxing', () => {
++ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('cross-site frame sandboxing', () => {
+ let server: http.Server;
+ let crossSiteUrl: string;
+ let serverUrl: string;
diff --git a/electron34/patches/patch-electron_spec_api-tray-spec.ts b/electron34/patches/patch-electron_spec_api-tray-spec.ts
new file mode 100644
index 0000000000..ed983804a4
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-tray-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-tray-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-tray-spec.ts
+@@ -131,7 +131,7 @@ describe('tray module', () => {
+ describe('tray.getBounds()', () => {
+ afterEach(() => { tray.destroy(); });
+
+- ifit(process.platform !== 'linux')('returns a bounds object', function () {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('returns a bounds object', function () {
+ const bounds = tray.getBounds();
+ expect(bounds).to.be.an('object').and.to.have.all.keys('x', 'y', 'width', 'height');
+ });
diff --git a/electron34/patches/patch-electron_spec_api-utility-process-spec.ts b/electron34/patches/patch-electron_spec_api-utility-process-spec.ts
new file mode 100644
index 0000000000..150cf6542c
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-utility-process-spec.ts
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-utility-process-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-utility-process-spec.ts
+@@ -452,7 +452,7 @@ describe('utilityProcess module', () =>
+ expect(output).to.include(result);
+ });
+
+- ifit(process.platform !== 'linux')('can access exposed main process modules from the utility process', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('can access exposed main process modules from the utility process', async () => {
+ const message = 'Message from utility process';
+ const child = utilityProcess.fork(path.join(fixturesPath, 'expose-main-process-module.js'));
+ await once(child, 'spawn');
+@@ -489,7 +489,7 @@ describe('utilityProcess module', () =>
+ await closeWindow(w);
+ });
+
+- ifit(process.platform === 'linux')('allows executing a setuid binary with child_process', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('allows executing a setuid binary with child_process', async () => {
+ const child = utilityProcess.fork(path.join(fixturesPath, 'suid.js'));
+ await once(child, 'spawn');
+ const [data] = await once(child, 'message');
diff --git a/electron34/patches/patch-electron_spec_api-web-contents-spec.ts b/electron34/patches/patch-electron_spec_api-web-contents-spec.ts
new file mode 100644
index 0000000000..63fab89416
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-web-contents-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-web-contents-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-web-contents-spec.ts
+@@ -2652,7 +2652,7 @@ describe('webContents module', () => {
+ });
+
+ // TODO(codebytere): OOPIF printing is disabled on Linux at the moment due to crashes.
+- ifit(process.platform !== 'linux')('can print cross-origin iframes', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('can print cross-origin iframes', async () => {
+ server = http.createServer((_, res) => {
+ res.writeHead(200);
+ res.end(`
diff --git a/electron34/patches/patch-electron_spec_api-web-frame-main-spec.ts b/electron34/patches/patch-electron_spec_api-web-frame-main-spec.ts
new file mode 100644
index 0000000000..1b6c50e6c7
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_api-web-frame-main-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/api-web-frame-main-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/api-web-frame-main-spec.ts
+@@ -315,7 +315,7 @@ describe('webFrameMain module', () => {
+ });
+
+ // TODO(jkleinsc) fix this flaky test on linux
+- ifit(process.platform !== 'linux')('throws upon accessing properties when disposed', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('throws upon accessing properties when disposed', async () => {
+ await w.loadFile(path.join(subframesPath, 'frame-with-frame-container.html'));
+ const { mainFrame } = w.webContents;
+ w.destroy();
diff --git a/electron34/patches/patch-electron_spec_chromium-spec.ts b/electron34/patches/patch-electron_spec_chromium-spec.ts
new file mode 100644
index 0000000000..c58f614ec6
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_chromium-spec.ts
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/chromium-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/chromium-spec.ts
+@@ -474,13 +474,13 @@ describe('command line switches', () =>
+ it('should not set an invalid locale', async () => testLocale('asdfkl', `${currentLocale}|${currentSystemLocale}|${currentPreferredLanguages}`));
+
+ const lcAll = String(process.env.LC_ALL);
+- ifit(process.platform === 'linux')('current process has a valid LC_ALL env', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('current process has a valid LC_ALL env', async () => {
+ // The LC_ALL env should not be set to DOM locale string.
+ expect(lcAll).to.not.equal(app.getLocale());
+ });
+- ifit(process.platform === 'linux')('should not change LC_ALL', async () => testLocale('fr', lcAll, true));
+- ifit(process.platform === 'linux')('should not change LC_ALL when setting invalid locale', async () => testLocale('asdfkl', lcAll, true));
+- ifit(process.platform === 'linux')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('should not change LC_ALL', async () => testLocale('fr', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('should not change LC_ALL when setting invalid locale', async () => testLocale('asdfkl', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true));
+ });
+
+ describe('--remote-debugging-pipe switch', () => {
+@@ -2922,12 +2922,12 @@ describe('font fallback', () => {
+ expect(fonts[0].familyName).to.equal('Arial');
+ } else if (process.platform === 'darwin') {
+ expect(fonts[0].familyName).to.equal('Helvetica');
+- } else if (process.platform === 'linux') {
++ } else if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ expect(fonts[0].familyName).to.equal('DejaVu Sans');
+ } // I think this depends on the distro? We don't specify a default.
+ });
+
+- ifit(process.platform !== 'linux')('should fall back to Japanese font for sans-serif Japanese script', async function () {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('should fall back to Japanese font for sans-serif Japanese script', async function () {
+ const html = `
+ <html lang="ja-JP">
+ <head>
+@@ -3471,7 +3471,7 @@ describe('paste execCommand', () => {
+ });
+ });
+
+-ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
++ifdescribe(((process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
+ let w: BrowserWindow;
+
+ const expectedBadgeCount = 42;
diff --git a/electron34/patches/patch-electron_spec_crash-spec.ts b/electron34/patches/patch-electron_spec_crash-spec.ts
new file mode 100644
index 0000000000..5ab98b5105
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_crash-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/crash-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/crash-spec.ts
+@@ -52,7 +52,7 @@ const shouldRunCase = (crashCase: string
+ if (process.platform === 'win32') {
+ return process.arch !== 'ia32';
+ } else {
+- return (process.platform !== 'linux' || (process.arch !== 'arm64' && process.arch !== 'arm'));
++ return ((process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd') || (process.arch !== 'arm64' && process.arch !== 'arm'));
+ }
+ }
+ default: {
diff --git a/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js b/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
new file mode 100644
index 0000000000..44df4cb47d
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/fixtures/api/safe-storage/decrypt-app/main.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/fixtures/api/safe-storage/decrypt-app/main.js
+@@ -7,7 +7,7 @@ const pathToEncryptedString = path.resol
+ const readFile = fs.readFile;
+
+ app.whenReady().then(async () => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encryptedString = await readFile(pathToEncryptedString);
diff --git a/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js b/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
new file mode 100644
index 0000000000..7035030585
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/fixtures/api/safe-storage/encrypt-app/main.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/fixtures/api/safe-storage/encrypt-app/main.js
+@@ -7,7 +7,7 @@ const pathToEncryptedString = path.resol
+ const writeFile = fs.writeFile;
+
+ app.whenReady().then(async () => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encrypted = safeStorage.encryptString('plaintext');
diff --git a/electron34/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js b/electron34/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
new file mode 100644
index 0000000000..9325f3d560
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/fixtures/crash-cases/safe-storage/index.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/fixtures/crash-cases/safe-storage/index.js
+@@ -22,7 +22,7 @@ const { expect } = require('chai');
+ await app.whenReady();
+ // isEncryptionAvailable() will always return false on CI due to a mocked
+ // dbus as mentioned above.
+- expect(safeStorage.isEncryptionAvailable()).to.equal(process.platform !== 'linux');
++ expect(safeStorage.isEncryptionAvailable()).to.equal(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd');
+ if (safeStorage.isEncryptionAvailable()) {
+ const plaintext = 'plaintext';
+ const ciphertext = safeStorage.encryptString(plaintext);
diff --git a/electron34/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js b/electron34/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
new file mode 100644
index 0000000000..a44bb24104
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/fixtures/native-addon/uv-dlopen/index.js.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/fixtures/native-addon/uv-dlopen/index.js
+@@ -4,7 +4,7 @@ const testLoadLibrary = require('./build
+
+ const lib = (() => {
+ switch (process.platform) {
+- case 'linux':
++ case 'linux': case 'freebsd': case 'netbsd':
+ return path.resolve(__dirname, 'build/Release/foo.so');
+ case 'darwin':
+ return path.resolve(__dirname, 'build/Release/foo.dylib');
diff --git a/electron34/patches/patch-electron_spec_node-spec.ts b/electron34/patches/patch-electron_spec_node-spec.ts
new file mode 100644
index 0000000000..7a7fc39d09
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_node-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/node-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/node-spec.ts
+@@ -148,7 +148,7 @@ describe('node feature', () => {
+ });
+
+ describe('child_process.exec', () => {
+- ifit(process.platform === 'linux')('allows executing a setuid binary from non-sandboxed renderer', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd')('allows executing a setuid binary from non-sandboxed renderer', async () => {
+ // Chrome uses prctl(2) to set the NO_NEW_PRIVILEGES flag on Linux (see
+ // https://github.com/torvalds/linux/blob/40fde647cc/Documentation/userspace-api/no_new_privs.rst).
+ // We disable this for unsandboxed processes, which the renderer tests
diff --git a/electron34/patches/patch-electron_spec_version-bump-spec.ts b/electron34/patches/patch-electron_spec_version-bump-spec.ts
new file mode 100644
index 0000000000..59b28bc9b5
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_version-bump-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/version-bump-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/version-bump-spec.ts
+@@ -53,7 +53,7 @@ class GitFake {
+ }
+
+ describe('version-bumper', () => {
+- ifdescribe(!(process.platform === 'linux' && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
++ ifdescribe(!((process.platform === 'linux' || process.platform === 'freebsd' || process.platform === 'netbsd') && process.arch.indexOf('arm') === 0) && process.platform !== 'darwin')('nextVersion', () => {
+ describe('bump versions', () => {
+ const nightlyPattern = /[0-9.]*(-nightly.(\d{4})(\d{2})(\d{2}))$/g;
+ const betaPattern = /[0-9.]*(-beta[0-9.]*)/g;
diff --git a/electron34/patches/patch-electron_spec_visibility-state-spec.ts b/electron34/patches/patch-electron_spec_visibility-state-spec.ts
new file mode 100644
index 0000000000..3c4577148e
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_visibility-state-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/visibility-state-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/visibility-state-spec.ts
+@@ -11,7 +11,7 @@ import { closeAllWindows } from './lib/w
+
+ // visibilityState specs pass on linux with a real window manager but on CI
+ // the environment does not let these specs pass
+-ifdescribe(process.platform !== 'linux')('document.visibilityState', () => {
++ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('document.visibilityState', () => {
+ let w: BaseWindow & {webContents: WebContents};
+
+ before(() => {
diff --git a/electron34/patches/patch-electron_spec_webview-spec.ts b/electron34/patches/patch-electron_spec_webview-spec.ts
new file mode 100644
index 0000000000..fa4d3b3e9c
--- /dev/null
+++ b/electron34/patches/patch-electron_spec_webview-spec.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- electron/spec/webview-spec.ts.orig 2025-05-09 16:52:15.000000000 +0000
++++ electron/spec/webview-spec.ts
+@@ -559,7 +559,7 @@ describe('<webview> tag', function () {
+ });
+
+ // FIXME(zcbenz): Fullscreen events do not work on Linux.
+- ifit(process.platform !== 'linux')('exiting fullscreen should unfullscreen window', async () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' && process.platform !== 'netbsd')('exiting fullscreen should unfullscreen window', async () => {
+ const [w, webview] = await loadWebViewWindow();
+ const enterFullScreen = once(w, 'enter-full-screen');
+ await webview.executeJavaScript('document.getElementById("div").requestFullscreen()', true);
diff --git a/electron34/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc b/electron34/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 0000000000..477e7961e5
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/api/api_browser_context_keyed_service_factories.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/api/api_browser_context_keyed_service_factories.cc
+@@ -118,7 +118,7 @@ void EnsureApiBrowserContextKeyedService
+ #endif
+ MessageService::GetFactoryInstance();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ NetworkingPrivateEventRouterFactory::GetInstance();
+ #endif
+ OffscreenDocumentManager::GetFactory();
diff --git a/electron34/patches/patch-extensions_browser_api_management_management__api.cc b/electron34/patches/patch-extensions_browser_api_management_management__api.cc
new file mode 100644
index 0000000000..f74f6dcacd
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_api_management_management__api.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/api/management/management_api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/api/management/management_api.cc
+@@ -285,7 +285,7 @@ bool PlatformSupportsApprovalFlowForExte
+ #if BUILDFLAG(IS_CHROMEOS)
+ // ChromeOS devices have this feature already shipped.
+ return true;
+-#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(
+ supervised_user::kEnableExtensionsPermissionsForSupervisedUsersOnDesktop);
+ #else
diff --git a/electron34/patches/patch-extensions_browser_api_messaging_message__service.cc b/electron34/patches/patch-extensions_browser_api_messaging_message__service.cc
new file mode 100644
index 0000000000..4138a3b5ab
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_api_messaging_message__service.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/api/messaging/message_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/api/messaging/message_service.cc
+@@ -78,7 +78,7 @@ namespace {
+ const char kReceivingEndDoesntExistError[] =
+ "Could not establish connection. Receiving end does not exist.";
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kMissingPermissionError[] =
+ "Access to native messaging requires nativeMessaging permission.";
+ const char kProhibitedByPoliciesError[] =
+@@ -551,7 +551,7 @@ void MessageService::OpenChannelToNative
+ return;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool has_permission = extension->permissions_data()->HasAPIPermission(
+ mojom::APIPermissionID::kNativeMessaging);
+ if (!has_permission) {
diff --git a/electron34/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc b/electron34/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
new file mode 100644
index 0000000000..c7695d1e63
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/api/networking_private/networking_private_delegate_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/api/networking_private/networking_private_delegate_factory.cc
+@@ -12,7 +12,7 @@
+
+ #if BUILDFLAG(IS_CHROMEOS)
+ #include "extensions/browser/api/networking_private/networking_private_chromeos.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "extensions/browser/api/networking_private/networking_private_linux.h"
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ #include "components/wifi/wifi_service.h"
+@@ -63,7 +63,7 @@ NetworkingPrivateDelegateFactory::BuildS
+ std::unique_ptr<NetworkingPrivateDelegate> delegate;
+ #if BUILDFLAG(IS_CHROMEOS)
+ delegate = std::make_unique<NetworkingPrivateChromeOS>(browser_context);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ delegate = std::make_unique<NetworkingPrivateLinux>();
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ std::unique_ptr<wifi::WiFiService> wifi_service(wifi::WiFiService::Create());
+@@ -74,7 +74,7 @@ NetworkingPrivateDelegateFactory::BuildS
+ #endif
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (ui_factory_) {
+ delegate->set_ui_delegate(ui_factory_->CreateDelegate());
+ }
diff --git a/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.cc b/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.cc
new file mode 100644
index 0000000000..e7fec804fc
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/app_view/app_view_guest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/app_view/app_view_guest.cc
+@@ -153,8 +153,7 @@ bool AppViewGuest::IsWebContentsCreation
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ CHECK(!base::FeatureList::IsEnabled(features::kGuestViewMPArch));
+
+ return true;
diff --git a/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.h b/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.h
new file mode 100644
index 0000000000..5d94a5038a
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_app__view_app__view__guest.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/app_view/app_view_guest.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/app_view/app_view_guest.h
+@@ -10,6 +10,7 @@
+ #include "base/containers/id_map.h"
+ #include "base/values.h"
+ #include "components/guest_view/browser/guest_view.h"
++#include "content/common/frame.mojom-shared.h"
+ #include "extensions/browser/guest_view/app_view/app_view_guest_delegate.h"
+ #include "extensions/browser/lazy_context_task_queue.h"
+
+@@ -77,8 +78,7 @@ class AppViewGuest : public guest_view::
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) final;
++ const content::mojom::CreateNewWindowParams& params) final;
+ content::WebContents* CreateCustomWebContents(
+ content::RenderFrameHost* opener,
+ content::SiteInstance* source_site_instance,
diff --git a/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc b/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc
new file mode 100644
index 0000000000..829a23233f
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/extension_options/extension_options_guest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/extension_options/extension_options_guest.cc
+@@ -249,8 +249,7 @@ bool ExtensionOptionsGuest::IsWebContent
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ CHECK(!base::FeatureList::IsEnabled(features::kGuestViewMPArch));
+
+ // This method handles opening links from within the guest. Since this guest
diff --git a/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h b/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h
new file mode 100644
index 0000000000..54aaf4ac20
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/extension_options/extension_options_guest.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/extension_options/extension_options_guest.h
+@@ -70,8 +70,7 @@ class ExtensionOptionsGuest
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) final;
++ const content::mojom::CreateNewWindowParams& params) final;
+ content::WebContents* CreateCustomWebContents(
+ content::RenderFrameHost* opener,
+ content::SiteInstance* source_site_instance,
diff --git a/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc b/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc
new file mode 100644
index 0000000000..50266bcb40
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+@@ -425,8 +425,7 @@ bool MimeHandlerViewGuest::IsWebContents
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ CHECK(!base::FeatureList::IsEnabled(features::kGuestViewMPArch));
+
+ return true;
diff --git a/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h b/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h
new file mode 100644
index 0000000000..aeeb5e05f7
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
+@@ -181,8 +181,7 @@ class MimeHandlerViewGuest
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ content::WebContents* CreateCustomWebContents(
+ content::RenderFrameHost* opener,
+ content::SiteInstance* source_site_instance,
diff --git a/electron34/patches/patch-extensions_browser_script__injection__tracker.cc b/electron34/patches/patch-extensions_browser_script__injection__tracker.cc
new file mode 100644
index 0000000000..475d87a2b9
--- /dev/null
+++ b/electron34/patches/patch-extensions_browser_script__injection__tracker.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/browser/script_injection_tracker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/browser/script_injection_tracker.cc
+@@ -174,7 +174,6 @@ std::vector<const UserScript*> GetLoaded
+ UserScriptManager* manager =
+ ExtensionSystem::Get(process.GetBrowserContext())->user_script_manager();
+ if (!manager) {
+- CHECK_IS_TEST();
+ return std::vector<const UserScript*>();
+ }
+
diff --git a/electron34/patches/patch-extensions_common_api___permission__features.json b/electron34/patches/patch-extensions_common_api___permission__features.json
new file mode 100644
index 0000000000..34f313660f
--- /dev/null
+++ b/electron34/patches/patch-extensions_common_api___permission__features.json
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/common/api/_permission_features.json.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/common/api/_permission_features.json
+@@ -138,7 +138,7 @@
+ {
+ "channel": "stable",
+ "extension_types": ["platform_app"],
+- "platforms": ["chromeos", "win", "mac", "linux"],
++ "platforms": ["chromeos", "win", "mac", "linux", "openbsd", "freebsd", "netbsd"],
+ "allowlist": [
+ "1C93BD3CF875F4A73C0B2A163BB8FBDA8B8B3D80", // http://crbug.com/387169
+ "A3BC37E2148AC4E99BE4B16AF9D42DD1E592BBBE", // http://crbug.com/387169
+@@ -432,7 +432,7 @@
+ }, {
+ "channel": "stable",
+ "extension_types": ["extension", "legacy_packaged_app", "platform_app"],
+- "platforms": ["chromeos", "mac", "win", "linux", "fuchsia"],
++ "platforms": ["chromeos", "mac", "win", "linux", "fuchsia", "openbsd", "freebsd", "netbsd"],
+ "allowlist": [
+ "0DE0F05680A4A056BCEC864ED8DDA84296F82B40", // http://crbug.com/434651
+ "1C93BD3CF875F4A73C0B2A163BB8FBDA8B8B3D80", // http://crbug.com/293683
+@@ -476,7 +476,7 @@
+ "networkingPrivate": {
+ "channel": "stable",
+ "extension_types": ["extension", "legacy_packaged_app", "platform_app"],
+- "platforms": ["chromeos", "mac", "win", "linux", "fuchsia"],
++ "platforms": ["chromeos", "mac", "win", "linux", "fuchsia", "openbsd", "freebsd", "netbsd"],
+ "allowlist": [
+ // DO NOT ADD ANY MORE ENTRIES HERE.
+ // networkingPrivate is being migrated to networking.onc.
diff --git a/electron34/patches/patch-extensions_common_api_runtime.json b/electron34/patches/patch-extensions_common_api_runtime.json
new file mode 100644
index 0000000000..c95c9fee5d
--- /dev/null
+++ b/electron34/patches/patch-extensions_common_api_runtime.json
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/common/api/runtime.json.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/common/api/runtime.json
+@@ -86,6 +86,8 @@
+ {"name": "cros", "description": "Specifies the Chrome operating system."},
+ {"name": "linux", "description": "Specifies the Linux operating system."},
+ {"name": "openbsd", "description": "Specifies the OpenBSD operating system."},
++ {"name": "freebsd", "description": "Specifies the FreeBSD operating system."},
++ {"name": "netbsd", "description": "Specifies the NetBSD operating system."},
+ {"name": "fuchsia", "description": "Specifies the Fuchsia operating system."}
+ ]
+ },
diff --git a/electron34/patches/patch-extensions_common_command.cc b/electron34/patches/patch-extensions_common_command.cc
new file mode 100644
index 0000000000..5241b81b38
--- /dev/null
+++ b/electron34/patches/patch-extensions_common_command.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/common/command.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/common/command.cc
+@@ -284,7 +284,7 @@ std::string Command::CommandPlatform() {
+ return values::kKeybindingPlatformMac;
+ #elif BUILDFLAG(IS_CHROMEOS)
+ return values::kKeybindingPlatformChromeOs;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return values::kKeybindingPlatformLinux;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ // TODO(crbug.com/40220501): Change this once we decide what string should be
diff --git a/electron34/patches/patch-extensions_common_features_feature.cc b/electron34/patches/patch-extensions_common_features_feature.cc
new file mode 100644
index 0000000000..0c063204ed
--- /dev/null
+++ b/electron34/patches/patch-extensions_common_features_feature.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/common/features/feature.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/common/features/feature.cc
+@@ -29,6 +29,8 @@ Feature::Platform Feature::GetCurrentPla
+ return WIN_PLATFORM;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return FUCHSIA_PLATFORM;
++#elif BUILDFLAG(IS_BSD)
++ return LINUX_PLATFORM;
+ #else
+ return UNSPECIFIED_PLATFORM;
+ #endif
diff --git a/electron34/patches/patch-extensions_renderer_bindings_api__binding__util.cc b/electron34/patches/patch-extensions_renderer_bindings_api__binding__util.cc
new file mode 100644
index 0000000000..dc930e6708
--- /dev/null
+++ b/electron34/patches/patch-extensions_renderer_bindings_api__binding__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/renderer/bindings/api_binding_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/renderer/bindings/api_binding_util.cc
+@@ -128,7 +128,7 @@ void InvalidateContext(v8::Local<v8::Con
+ std::string GetPlatformString() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return "chromeos";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "linux";
+ #elif BUILDFLAG(IS_MAC)
+ return "mac";
diff --git a/electron34/patches/patch-extensions_renderer_bindings_argument__spec.cc b/electron34/patches/patch-extensions_renderer_bindings_argument__spec.cc
new file mode 100644
index 0000000000..5ff1515c23
--- /dev/null
+++ b/electron34/patches/patch-extensions_renderer_bindings_argument__spec.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/renderer/bindings/argument_spec.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/renderer/bindings/argument_spec.cc
+@@ -18,6 +18,8 @@
+ #include "gin/data_object_builder.h"
+ #include "gin/dictionary.h"
+
++#include <cmath>
++
+ namespace extensions {
+
+ namespace {
diff --git a/electron34/patches/patch-extensions_renderer_script__injection.cc b/electron34/patches/patch-extensions_renderer_script__injection.cc
new file mode 100644
index 0000000000..538eaba07a
--- /dev/null
+++ b/electron34/patches/patch-extensions_renderer_script__injection.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/renderer/script_injection.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/renderer/script_injection.cc
+@@ -317,6 +317,7 @@ void ScriptInjection::InjectJs(std::set<
+ blink::mojom::LoadEventBlockingOption::kBlock,
+ base::BindOnce(&ScriptInjection::OnJsInjectionCompleted,
+ weak_ptr_factory_.GetWeakPtr()),
++ base::NullCallback(),
+ blink::BackForwardCacheAware::kPossiblyDisallow,
+ injector_->ExpectsResults(), injector_->ShouldWaitForPromise());
+ }
diff --git a/electron34/patches/patch-extensions_shell_app_shell__main__delegate.cc b/electron34/patches/patch-extensions_shell_app_shell__main__delegate.cc
new file mode 100644
index 0000000000..4bff2e2442
--- /dev/null
+++ b/electron34/patches/patch-extensions_shell_app_shell__main__delegate.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/shell/app/shell_main_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/shell/app/shell_main_delegate.cc
+@@ -40,7 +40,7 @@
+ #if BUILDFLAG(IS_WIN)
+ #include "base/base_paths_win.h"
+ #include "base/process/process_info.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/nix/xdg_util.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "base/base_paths_mac.h"
+@@ -60,7 +60,7 @@ base::FilePath GetDataPath() {
+ }
+
+ base::FilePath data_dir;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<base::Environment> env(base::Environment::Create());
+ data_dir = base::nix::GetXDGDirectory(
+ env.get(), base::nix::kXdgConfigHomeEnvVar, base::nix::kDotConfigDir);
diff --git a/electron34/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc b/electron34/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
new file mode 100644
index 0000000000..05999171ce
--- /dev/null
+++ b/electron34/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/shell/browser/api/runtime/shell_runtime_api_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/shell/browser/api/runtime/shell_runtime_api_delegate.cc
+@@ -45,7 +45,7 @@ void ShellRuntimeAPIDelegate::OpenURL(co
+ bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
+ #if BUILDFLAG(IS_CHROMEOS)
+ info->os = api::runtime::PlatformOs::kCros;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ info->os = api::runtime::PlatformOs::kLinux;
+ #endif
+ return true;
diff --git a/electron34/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc b/electron34/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 0000000000..871f98ad76
--- /dev/null
+++ b/electron34/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/shell/browser/shell_browser_main_parts.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/shell/browser/shell_browser_main_parts.cc
+@@ -137,7 +137,7 @@ void ShellBrowserMainParts::PostCreateMa
+ switches::kAppShellAllowRoaming)) {
+ network_controller_->SetCellularAllowRoaming(true);
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // app_shell doesn't need GTK, so the fake input method context can work.
+ // See crbug.com/381852 and revision fb69f142.
+ // TODO(michaelpg): Verify this works for target environments.
diff --git a/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc b/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc
new file mode 100644
index 0000000000..d03298f419
--- /dev/null
+++ b/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/shell/browser/shell_extensions_api_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/shell/browser/shell_extensions_api_client.cc
+@@ -18,7 +18,7 @@
+ #include "extensions/shell/browser/shell_virtual_keyboard_delegate.h"
+ #include "extensions/shell/browser/shell_web_view_guest_delegate.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "extensions/shell/browser/api/file_system/shell_file_system_delegate.h"
+ #endif
+
+@@ -54,7 +54,7 @@ ShellExtensionsAPIClient::CreateDisplayI
+ return std::make_unique<ShellDisplayInfoProvider>();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ FileSystemDelegate* ShellExtensionsAPIClient::GetFileSystemDelegate() {
+ if (!file_system_delegate_)
+ file_system_delegate_ = std::make_unique<ShellFileSystemDelegate>();
diff --git a/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.h b/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.h
new file mode 100644
index 0000000000..cbcede0f6a
--- /dev/null
+++ b/electron34/patches/patch-extensions_shell_browser_shell__extensions__api__client.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- extensions/shell/browser/shell_extensions_api_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ extensions/shell/browser/shell_extensions_api_client.h
+@@ -34,14 +34,14 @@ class ShellExtensionsAPIClient : public
+ content::BrowserContext* browser_context) const override;
+ std::unique_ptr<DisplayInfoProvider> CreateDisplayInfoProvider()
+ const override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ FileSystemDelegate* GetFileSystemDelegate() override;
+ #endif
+ MessagingDelegate* GetMessagingDelegate() override;
+ FeedbackPrivateDelegate* GetFeedbackPrivateDelegate() override;
+
+ private:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<FileSystemDelegate> file_system_delegate_;
+ #endif
+ std::unique_ptr<MessagingDelegate> messaging_delegate_;
diff --git a/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc b/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc
new file mode 100644
index 0000000000..be7b85806c
--- /dev/null
+++ b/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- fuchsia_web/webengine/browser/frame_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ fuchsia_web/webengine/browser/frame_impl.cc
+@@ -574,8 +574,7 @@ bool FrameImpl::IsWebContentsCreationOve
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ // Specify a generous upper bound for unacknowledged popup windows, so that we
+ // can catch bad client behavior while not interfering with normal operation.
+ constexpr size_t kMaxPendingWebContentsCount = 10;
diff --git a/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.h b/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.h
new file mode 100644
index 0000000000..97c8edf7eb
--- /dev/null
+++ b/electron34/patches/patch-fuchsia__web_webengine_browser_frame__impl.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- fuchsia_web/webengine/browser/frame_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ fuchsia_web/webengine/browser/frame_impl.h
+@@ -307,8 +307,7 @@ class WEB_ENGINE_EXPORT FrameImpl : publ
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ void WebContentsCreated(content::WebContents* source_contents,
+ int opener_render_process_id,
+ int opener_render_frame_id,
diff --git a/electron34/patches/patch-gin_converter.cc b/electron34/patches/patch-gin_converter.cc
new file mode 100644
index 0000000000..4e260cce10
--- /dev/null
+++ b/electron34/patches/patch-gin_converter.cc
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/converter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/converter.cc
+@@ -20,6 +20,7 @@
+ #include "v8/include/v8-value.h"
+
+ using v8::ArrayBuffer;
++using v8::ArrayBufferView;
+ using v8::External;
+ using v8::Function;
+ using v8::Int32;
+@@ -246,6 +247,20 @@ bool Converter<Local<ArrayBuffer>>::From
+ return true;
+ }
+
++Local<Value> Converter<Local<ArrayBufferView>>::ToV8(Isolate* isolate,
++ Local<ArrayBufferView> val) {
++ return val.As<Value>();
++}
++
++bool Converter<Local<ArrayBufferView>>::FromV8(Isolate* isolate,
++ Local<Value> val,
++ Local<ArrayBufferView>* out) {
++ if (!val->IsArrayBufferView())
++ return false;
++ *out = Local<ArrayBufferView>::Cast(val);
++ return true;
++}
++
+ Local<Value> Converter<Local<External>>::ToV8(Isolate* isolate,
+ Local<External> val) {
+ return val.As<Value>();
diff --git a/electron34/patches/patch-gin_converter.h b/electron34/patches/patch-gin_converter.h
new file mode 100644
index 0000000000..57f3c5ba3e
--- /dev/null
+++ b/electron34/patches/patch-gin_converter.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/converter.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/converter.h
+@@ -191,6 +191,15 @@ struct GIN_EXPORT Converter<v8::Local<v8
+ };
+
+ template<>
++struct GIN_EXPORT Converter<v8::Local<v8::ArrayBufferView> > {
++ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
++ v8::Local<v8::ArrayBufferView> val);
++ static bool FromV8(v8::Isolate* isolate,
++ v8::Local<v8::Value> val,
++ v8::Local<v8::ArrayBufferView>* out);
++};
++
++template<>
+ struct GIN_EXPORT Converter<v8::Local<v8::External> > {
+ static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
+ v8::Local<v8::External> val);
diff --git a/electron34/patches/patch-gin_isolate__holder.cc b/electron34/patches/patch-gin_isolate__holder.cc
new file mode 100644
index 0000000000..3fd635270c
--- /dev/null
+++ b/electron34/patches/patch-gin_isolate__holder.cc
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/isolate_holder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/isolate_holder.cc
+@@ -34,6 +34,8 @@ v8::ArrayBuffer::Allocator* g_array_buff
+ const intptr_t* g_reference_table = nullptr;
+ v8::FatalErrorCallback g_fatal_error_callback = nullptr;
+ v8::OOMErrorCallback g_oom_error_callback = nullptr;
++bool g_initialized_microtasks_runner = false;
++bool g_destroyed_microtasks_runner = false;
+
+ std::unique_ptr<v8::Isolate::CreateParams> getModifiedIsolateParams(
+ std::unique_ptr<v8::Isolate::CreateParams> params,
+@@ -76,7 +78,8 @@ IsolateHolder::IsolateHolder(
+ v8::CreateHistogramCallback create_histogram_callback,
+ v8::AddHistogramSampleCallback add_histogram_sample_callback,
+ scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner,
+- scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner)
++ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner,
++ v8::Isolate* isolate)
+ : IsolateHolder(std::move(task_runner),
+ access_mode,
+ isolate_type,
+@@ -86,7 +89,8 @@ IsolateHolder::IsolateHolder(
+ add_histogram_sample_callback),
+ isolate_creation_mode,
+ std::move(user_visible_task_runner),
+- std::move(best_effort_task_runner)) {}
++ std::move(best_effort_task_runner),
++ isolate) {}
+
+ IsolateHolder::IsolateHolder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+@@ -95,7 +99,8 @@ IsolateHolder::IsolateHolder(
+ std::unique_ptr<v8::Isolate::CreateParams> params,
+ IsolateCreationMode isolate_creation_mode,
+ scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner,
+- scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner)
++ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner,
++ v8::Isolate* isolate)
+ : access_mode_(access_mode), isolate_type_(isolate_type) {
+ CHECK(Initialized())
+ << "You need to invoke gin::IsolateHolder::Initialize first";
+@@ -106,7 +111,7 @@ IsolateHolder::IsolateHolder(
+ v8::ArrayBuffer::Allocator* allocator = params->array_buffer_allocator;
+ DCHECK(allocator);
+
+- isolate_ = v8::Isolate::Allocate();
++ isolate_ = isolate ? isolate : v8::Isolate::Allocate();
+ isolate_data_ = std::make_unique<PerIsolateData>(
+ isolate_, allocator, access_mode_, task_runner,
+ std::move(user_visible_task_runner), std::move(best_effort_task_runner));
+@@ -154,9 +159,10 @@ void IsolateHolder::Initialize(ScriptMod
+ const intptr_t* reference_table,
+ const std::string js_command_line_flags,
+ v8::FatalErrorCallback fatal_error_callback,
+- v8::OOMErrorCallback oom_error_callback) {
++ v8::OOMErrorCallback oom_error_callback,
++ bool create_v8_platform) {
+ CHECK(allocator);
+- V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback);
++ V8Initializer::Initialize(mode, js_command_line_flags, oom_error_callback, create_v8_platform);
+ g_array_buffer_allocator = allocator;
+ g_reference_table = reference_table;
+ g_fatal_error_callback = fatal_error_callback;
+@@ -190,10 +196,26 @@ IsolateHolder::getDefaultIsolateParams()
+ return params;
+ }
+
++// static
++bool IsolateHolder::DestroyedMicrotasksRunner() {
++ return g_initialized_microtasks_runner &&
++ g_destroyed_microtasks_runner;
++}
++
+ void IsolateHolder::EnableIdleTasks(
+ std::unique_ptr<V8IdleTaskRunner> idle_task_runner) {
+ DCHECK(isolate_data_.get());
+ isolate_data_->EnableIdleTasks(std::move(idle_task_runner));
+ }
+
++void IsolateHolder::WillCreateMicrotasksRunner() {
++ DCHECK(!g_initialized_microtasks_runner);
++ g_initialized_microtasks_runner = true;
++}
++
++void IsolateHolder::WillDestroyMicrotasksRunner() {
++ DCHECK(g_initialized_microtasks_runner);
++ g_destroyed_microtasks_runner = true;
++}
++
+ } // namespace gin
diff --git a/electron34/patches/patch-gin_object__template__builder.cc b/electron34/patches/patch-gin_object__template__builder.cc
new file mode 100644
index 0000000000..59463ba8c7
--- /dev/null
+++ b/electron34/patches/patch-gin_object__template__builder.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/object_template_builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/object_template_builder.cc
+@@ -216,6 +216,13 @@ ObjectTemplateBuilder::ObjectTemplateBui
+ template_->SetInternalFieldCount(kNumberOfInternalFields);
+ }
+
++ObjectTemplateBuilder::ObjectTemplateBuilder(v8::Isolate* isolate,
++ const char* type_name,
++ v8::Local<v8::ObjectTemplate> tmpl)
++ : isolate_(isolate), type_name_(type_name), template_(tmpl) {
++ template_->SetInternalFieldCount(kNumberOfInternalFields);
++}
++
+ ObjectTemplateBuilder::ObjectTemplateBuilder(
+ const ObjectTemplateBuilder& other) = default;
+
diff --git a/electron34/patches/patch-gin_object__template__builder.h b/electron34/patches/patch-gin_object__template__builder.h
new file mode 100644
index 0000000000..02e81266ed
--- /dev/null
+++ b/electron34/patches/patch-gin_object__template__builder.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/object_template_builder.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/object_template_builder.h
+@@ -46,6 +46,9 @@ class GIN_EXPORT ObjectTemplateBuilder {
+ public:
+ explicit ObjectTemplateBuilder(v8::Isolate* isolate);
+ ObjectTemplateBuilder(v8::Isolate* isolate, const char* type_name);
++ ObjectTemplateBuilder(v8::Isolate* isolate,
++ const char* type_name,
++ v8::Local<v8::ObjectTemplate> tmpl);
+ ObjectTemplateBuilder(const ObjectTemplateBuilder& other);
+ ~ObjectTemplateBuilder();
+
diff --git a/electron34/patches/patch-gin_public_gin__embedders.h b/electron34/patches/patch-gin_public_gin__embedders.h
new file mode 100644
index 0000000000..7d0a60ce8f
--- /dev/null
+++ b/electron34/patches/patch-gin_public_gin__embedders.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/public/gin_embedders.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/public/gin_embedders.h
+@@ -20,6 +20,8 @@ enum GinEmbedder : uint16_t {
+ kEmbedderBlink,
+ kEmbedderPDFium,
+ kEmbedderFuchsia,
++ kEmbedderElectron,
++ kEmbedderBlinkTag,
+ };
+
+ } // namespace gin
diff --git a/electron34/patches/patch-gin_public_isolate__holder.h b/electron34/patches/patch-gin_public_isolate__holder.h
new file mode 100644
index 0000000000..38396ef0a1
--- /dev/null
+++ b/electron34/patches/patch-gin_public_isolate__holder.h
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/public/isolate_holder.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/public/isolate_holder.h
+@@ -87,7 +87,8 @@ class GIN_EXPORT IsolateHolder {
+ scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner =
+ nullptr,
+ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner =
+- nullptr);
++ nullptr,
++ v8::Isolate* isolate = nullptr);
+ IsolateHolder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ AccessMode access_mode,
+@@ -97,7 +98,8 @@ class GIN_EXPORT IsolateHolder {
+ scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner =
+ nullptr,
+ scoped_refptr<base::SingleThreadTaskRunner> best_effort_task_runner =
+- nullptr);
++ nullptr,
++ v8::Isolate* isolate = nullptr);
+ IsolateHolder(const IsolateHolder&) = delete;
+ IsolateHolder& operator=(const IsolateHolder&) = delete;
+ ~IsolateHolder();
+@@ -117,7 +119,8 @@ class GIN_EXPORT IsolateHolder {
+ const intptr_t* reference_table = nullptr,
+ const std::string js_command_line_flags = {},
+ v8::FatalErrorCallback fatal_error_callback = nullptr,
+- v8::OOMErrorCallback oom_error_callback = nullptr);
++ v8::OOMErrorCallback oom_error_callback = nullptr,
++ bool create_v8_platform = true);
+
+ // Returns whether `Initialize` has already been invoked in the process.
+ // Initialization is a one-way operation (i.e., this method cannot return
+@@ -127,6 +130,8 @@ class GIN_EXPORT IsolateHolder {
+ // Should only be called after v8::IsolateHolder::Initialize() is invoked.
+ static std::unique_ptr<v8::Isolate::CreateParams> getDefaultIsolateParams();
+
++ static bool DestroyedMicrotasksRunner();
++
+ v8::Isolate* isolate() { return isolate_; }
+
+ // This method returns if v8::Locker is needed to access isolate.
+@@ -140,6 +145,9 @@ class GIN_EXPORT IsolateHolder {
+
+ void EnableIdleTasks(std::unique_ptr<V8IdleTaskRunner> idle_task_runner);
+
++ void WillCreateMicrotasksRunner();
++ void WillDestroyMicrotasksRunner();
++
+ // This method returns V8IsolateMemoryDumpProvider of this isolate, used for
+ // testing.
+ V8IsolateMemoryDumpProvider* isolate_memory_dump_provider_for_testing()
diff --git a/electron34/patches/patch-gin_public_v8__platform.h b/electron34/patches/patch-gin_public_v8__platform.h
new file mode 100644
index 0000000000..3e864c7c43
--- /dev/null
+++ b/electron34/patches/patch-gin_public_v8__platform.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/public/v8_platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/public/v8_platform.h
+@@ -32,6 +32,7 @@ class GIN_EXPORT V8Platform : public v8:
+ // enabling Arm's Branch Target Instructions for executable pages. This is
+ // verified in the tests for gin::PageAllocator.
+ PageAllocator* GetPageAllocator() override;
++ static PageAllocator* GetCurrentPageAllocator();
+ #if PA_BUILDFLAG(ENABLE_THREAD_ISOLATION)
+ ThreadIsolatedAllocator* GetThreadIsolatedAllocator() override;
+ #endif
diff --git a/electron34/patches/patch-gin_v8__initializer.cc b/electron34/patches/patch-gin_v8__initializer.cc
new file mode 100644
index 0000000000..41d6361633
--- /dev/null
+++ b/electron34/patches/patch-gin_v8__initializer.cc
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/v8_initializer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/v8_initializer.cc
+@@ -543,7 +543,8 @@ void SetFlags(IsolateHolder::ScriptMode
+ // static
+ void V8Initializer::Initialize(IsolateHolder::ScriptMode mode,
+ const std::string& js_command_line_flags,
+- v8::OOMErrorCallback oom_error_callback) {
++ v8::OOMErrorCallback oom_error_callback,
++ bool create_v8_platform) {
+ static bool v8_is_initialized = false;
+ if (v8_is_initialized)
+ return;
+@@ -553,7 +554,8 @@ void V8Initializer::Initialize(IsolateHo
+ // See https://crbug.com/v8/11043
+ SetFlags(mode, js_command_line_flags);
+
+- v8::V8::InitializePlatform(V8Platform::Get());
++ if (create_v8_platform)
++ v8::V8::InitializePlatform(V8Platform::Get());
+
+ // Set this as early as possible in order to ensure OOM errors are reported
+ // correctly.
+@@ -653,8 +655,7 @@ void V8Initializer::GetV8ExternalSnapsho
+
+ #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+
+-// static
+-void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
++void V8Initializer::LoadV8SnapshotFromFileName(std::string_view file_name, V8SnapshotFileType snapshot_file_type) {
+ if (g_mapped_snapshot) {
+ // TODO(crbug.com/40558459): Confirm not loading different type of snapshot
+ // files in a process.
+@@ -663,11 +664,18 @@ void V8Initializer::LoadV8Snapshot(V8Sna
+
+ base::MemoryMappedFile::Region file_region;
+ base::File file =
+- OpenV8File(GetSnapshotFileName(snapshot_file_type), &file_region);
++ OpenV8File(file_name.data(), &file_region);
+ LoadV8SnapshotFromFile(std::move(file), &file_region, snapshot_file_type);
+ }
+
+ // static
++void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
++ const char* file_name = GetSnapshotFileName(snapshot_file_type);
++
++ LoadV8SnapshotFromFileName(file_name, snapshot_file_type);
++}
++
++// static
+ void V8Initializer::LoadV8SnapshotFromFile(
+ base::File snapshot_file,
+ base::MemoryMappedFile::Region* snapshot_file_region,
diff --git a/electron34/patches/patch-gin_v8__initializer.h b/electron34/patches/patch-gin_v8__initializer.h
new file mode 100644
index 0000000000..8de0924dec
--- /dev/null
+++ b/electron34/patches/patch-gin_v8__initializer.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/v8_initializer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/v8_initializer.h
+@@ -7,6 +7,8 @@
+
+ #include <stdint.h>
+
++#include <string_view>
++
+ #include "base/files/file.h"
+ #include "base/files/memory_mapped_file.h"
+ #include "build/build_config.h"
+@@ -31,7 +33,8 @@ class GIN_EXPORT V8Initializer {
+ // This should be called by IsolateHolder::Initialize().
+ static void Initialize(IsolateHolder::ScriptMode mode,
+ const std::string& js_command_line_flags = {},
+- v8::OOMErrorCallback oom_error_callback = nullptr);
++ v8::OOMErrorCallback oom_error_callback = nullptr,
++ bool create_v8_platform = true);
+
+ // Get address and size information for currently loaded snapshot.
+ // If no snapshot is loaded, the return values are null for addresses
+@@ -41,6 +44,7 @@ class GIN_EXPORT V8Initializer {
+ int* snapshot_size_out);
+
+ #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
++ static void LoadV8SnapshotFromFileName(std::string_view file_name, V8SnapshotFileType snapshot_file_type);
+ // Load V8 snapshot from default resources, if they are available.
+ static void LoadV8Snapshot(
+ V8SnapshotFileType snapshot_file_type = V8SnapshotFileType::kDefault);
diff --git a/electron34/patches/patch-gin_v8__platform.cc b/electron34/patches/patch-gin_v8__platform.cc
new file mode 100644
index 0000000000..5ceb6a1c5c
--- /dev/null
+++ b/electron34/patches/patch-gin_v8__platform.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/v8_platform.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/v8_platform.cc
+@@ -204,6 +204,10 @@ ThreadIsolatedAllocator* V8Platform::Get
+ }
+ #endif // PA_BUILDFLAG(ENABLE_THREAD_ISOLATION)
+
++PageAllocator* V8Platform::GetCurrentPageAllocator() {
++ return g_page_allocator.Pointer();
++}
++
+ void V8Platform::OnCriticalMemoryPressure() {
+ // We only have a reservation on 32-bit Windows systems.
+ // TODO(bbudge) Make the #if's in BlinkInitializer match.
diff --git a/electron34/patches/patch-gin_wrappable.cc b/electron34/patches/patch-gin_wrappable.cc
new file mode 100644
index 0000000000..403c48e957
--- /dev/null
+++ b/electron34/patches/patch-gin_wrappable.cc
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/wrappable.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/wrappable.cc
+@@ -13,6 +13,9 @@ namespace gin {
+ WrappableBase::WrappableBase() = default;
+
+ WrappableBase::~WrappableBase() {
++ if (!wrapper_.IsEmpty()) {
++ wrapper_.ClearWeak();
++ }
+ wrapper_.Reset();
+ }
+
+@@ -28,15 +31,24 @@ const char* WrappableBase::GetTypeName()
+ void WrappableBase::FirstWeakCallback(
+ const v8::WeakCallbackInfo<WrappableBase>& data) {
+ WrappableBase* wrappable = data.GetParameter();
+- wrappable->dead_ = true;
+- wrappable->wrapper_.Reset();
+- data.SetSecondPassCallback(SecondWeakCallback);
++ WrappableBase* wrappable_from_field =
++ static_cast<WrappableBase*>(data.GetInternalField(1));
++ if (wrappable && wrappable == wrappable_from_field) {
++ wrappable->dead_ = true;
++ wrappable->wrapper_.Reset();
++ data.SetSecondPassCallback(SecondWeakCallback);
++ }
+ }
+
+ void WrappableBase::SecondWeakCallback(
+ const v8::WeakCallbackInfo<WrappableBase>& data) {
++ if (IsolateHolder::DestroyedMicrotasksRunner()) {
++ return;
++ }
+ WrappableBase* wrappable = data.GetParameter();
+- delete wrappable;
++ if (wrappable) {
++ delete wrappable;
++ }
+ }
+
+ v8::MaybeLocal<v8::Object> WrappableBase::GetWrapperImpl(v8::Isolate* isolate,
+@@ -71,10 +83,16 @@ v8::MaybeLocal<v8::Object> WrappableBase
+ void* values[] = {info, this};
+ wrapper->SetAlignedPointerInInternalFields(2, indices, values);
+ wrapper_.Reset(isolate, wrapper);
+- wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kParameter);
++ wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kInternalFields);
+ return v8::MaybeLocal<v8::Object>(wrapper);
+ }
+
++void WrappableBase::ClearWeak() {
++ if (!wrapper_.IsEmpty()) {
++ wrapper_.ClearWeak();
++ }
++}
++
+ namespace internal {
+
+ void* FromV8Impl(v8::Isolate* isolate, v8::Local<v8::Value> val,
diff --git a/electron34/patches/patch-gin_wrappable.h b/electron34/patches/patch-gin_wrappable.h
new file mode 100644
index 0000000000..5ee5ec47ed
--- /dev/null
+++ b/electron34/patches/patch-gin_wrappable.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gin/wrappable.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gin/wrappable.h
+@@ -80,6 +80,13 @@ class GIN_EXPORT WrappableBase {
+ v8::MaybeLocal<v8::Object> GetWrapperImpl(v8::Isolate* isolate,
+ WrapperInfo* wrapper_info);
+
++ // Make this wrappable strong again. This is useful when the wrappable is
++ // destroyed outside the finalizer callbacks and we want to avoid scheduling
++ // the weak callbacks if they haven't been scheduled yet.
++ // NOTE!!! this does not prevent finalization callbacks from running if they
++ // have already been processed.
++ void ClearWeak();
++
+ private:
+ static void FirstWeakCallback(
+ const v8::WeakCallbackInfo<WrappableBase>& data);
diff --git a/electron34/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc b/electron34/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc
new file mode 100644
index 0000000000..f307eb9ef4
--- /dev/null
+++ b/electron34/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- google_apis/gcm/engine/heartbeat_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ google_apis/gcm/engine/heartbeat_manager.cc
+@@ -32,7 +32,7 @@ const int kMinClientHeartbeatIntervalMs
+ // Minimum time spent sleeping before we force a new heartbeat.
+ const int kMinSuspendTimeMs = 1000 * 10; // 10 seconds.
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // The period at which to check if the heartbeat time has passed. Used to
+ // protect against platforms where the timer is delayed by the system being
+ // suspended. Only needed on linux because the other OSes provide a standard
+@@ -191,7 +191,7 @@ void HeartbeatManager::RestartTimer() {
+ base::BindRepeating(&HeartbeatManager::OnHeartbeatTriggered,
+ weak_ptr_factory_.GetWeakPtr()));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Windows, Mac, Android, iOS, and Chrome OS all provide a way to be notified
+ // when the system is suspending or resuming. The only one that does not is
+ // Linux so we need to poll to check for missed heartbeats.
+@@ -214,7 +214,7 @@ void HeartbeatManager::CheckForMissedHea
+ return;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Otherwise check again later.
+ io_task_runner_->PostDelayedTask(
+ FROM_HERE,
diff --git a/electron34/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc b/electron34/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc
new file mode 100644
index 0000000000..b409ee4936
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/dawn_context_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/dawn_context_provider.cc
+@@ -303,7 +303,7 @@ wgpu::BackendType DawnContextProvider::G
+ return base::FeatureList::IsEnabled(features::kSkiaGraphiteDawnUseD3D12)
+ ? wgpu::BackendType::D3D12
+ : wgpu::BackendType::D3D11;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ return wgpu::BackendType::Vulkan;
+ #elif BUILDFLAG(IS_APPLE)
+ return wgpu::BackendType::Metal;
diff --git a/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
new file mode 100644
index 0000000000..05fbe8452f
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/gles2_cmd_decoder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/gles2_cmd_decoder.cc
+@@ -2874,7 +2874,7 @@ GLES2Decoder* GLES2Decoder::Create(
+ }
+
+ // Allow linux to run fuzzers.
+-#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_VALIDATING_COMMAND_DECODER) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return new GLES2DecoderImpl(client, command_buffer_service, outputter, group);
+ #else
+ LOG(FATAL) << "Validating command decoder is not supported.";
+@@ -3285,6 +3285,13 @@ gpu::ContextResult GLES2DecoderImpl::Ini
+ }
+ }
+
++ if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2) {
++ // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled.
++ // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec:
++ // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4
++ DoEnable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
++ }
++
+ if (group_->gpu_preferences().enable_gpu_driver_debug_logging &&
+ feature_info_->feature_flags().khr_debug) {
+ InitializeGLDebugLogging(true, GLDebugMessageCallback, &logger_);
diff --git a/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__passthrough.cc b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__passthrough.cc
new file mode 100644
index 0000000000..1a499b2d52
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__passthrough.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/gles2_cmd_decoder_passthrough.cc
+@@ -1065,6 +1065,17 @@ gpu::ContextResult GLES2DecoderPassthrou
+ api()->glDisableFn(GL_TEXTURE_RECTANGLE_ANGLE);
+ #endif
+
++ // TEMPORARY: Set primitive restart to enabled by default for WebGL2. Clear
++ // errors afterwards so that when this state is initialized and validated in
++ // ANGLE, it will not generate errors during command buffer initialization.
++ if (feature_info_->context_type() == CONTEXT_TYPE_WEBGL2) {
++ // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled.
++ // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec:
++ // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4
++ api()->glEnableFn(GL_PRIMITIVE_RESTART_FIXED_INDEX);
++ CheckErrorCallbackState();
++ }
++
+ // Register this object as a GPU switching observer.
+ if (feature_info_->IsWebGLContext()) {
+ ui::GpuSwitchingManager::GetInstance()->AddObserver(this);
+@@ -2160,6 +2171,11 @@ bool GLES2DecoderPassthroughImpl::IsIgno
+ case GL_DEBUG_OUTPUT:
+ return true;
+
++ case GL_PRIMITIVE_RESTART_FIXED_INDEX:
++ // Disable setting primitive restart at the command decoder level until
++ // it's blocked in ANGLE for WebGL contexts.
++ return feature_info_->IsWebGLContext();
++
+ default:
+ return false;
+ }
diff --git a/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__unittest__base.cc b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__unittest__base.cc
new file mode 100644
index 0000000000..b3f78b9658
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder__unittest__base.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+@@ -440,6 +440,13 @@ ContextResult GLES2DecoderTestBase::Mayb
+ }
+ #endif
+
++ if (init.context_type == CONTEXT_TYPE_WEBGL2 &&
++ group_->feature_info()->gl_version_info().is_es3) {
++ EXPECT_CALL(*gl_, Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX))
++ .Times(1)
++ .RetiresOnSaturation();
++ }
++
+ if (context_->HasRobustness()) {
+ EXPECT_CALL(*gl_, GetGraphicsResetStatusARB())
+ .WillOnce(Return(init.lose_context_on_init ? GL_GUILTY_CONTEXT_RESET_ARB
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.cc
new file mode 100644
index 0000000000..a6a7f0bc8d
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_context_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_context_state.cc
+@@ -60,7 +60,7 @@
+ #include "gpu/vulkan/vulkan_implementation.h"
+ #include "gpu/vulkan/vulkan_util.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "gpu/command_buffer/service/external_semaphore_pool.h"
+ #endif
+
+@@ -379,7 +379,7 @@ SharedContextState::SharedContextState(
+ if (gr_context_type_ == GrContextType::kVulkan) {
+ if (vk_context_provider_) {
+ #if BUILDFLAG(ENABLE_VULKAN) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD))
+ external_semaphore_pool_ = std::make_unique<ExternalSemaphorePool>(this);
+ #endif
+ use_virtualized_gl_contexts_ = false;
+@@ -416,7 +416,7 @@ SharedContextState::~SharedContextState(
+ }
+
+ #if BUILDFLAG(ENABLE_VULKAN) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD))
+ external_semaphore_pool_.reset();
+ #endif
+
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.h b/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.h
new file mode 100644
index 0000000000..5fdf7c3975
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__context__state.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_context_state.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_context_state.h
+@@ -222,7 +222,7 @@ class GPU_GLES2_EXPORT SharedContextStat
+ return &memory_type_tracker_;
+ }
+ #if BUILDFLAG(ENABLE_VULKAN) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD))
+ ExternalSemaphorePool* external_semaphore_pool() {
+ return external_semaphore_pool_.get();
+ }
+@@ -429,7 +429,7 @@ class GPU_GLES2_EXPORT SharedContextStat
+ bool disable_check_reset_status_throttling_for_test_ = false;
+
+ #if BUILDFLAG(ENABLE_VULKAN) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD))
+ std::unique_ptr<ExternalSemaphorePool> external_semaphore_pool_;
+ #endif
+
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
new file mode 100644
index 0000000000..02c6b983c3
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.cc
+@@ -20,7 +20,7 @@ namespace {
+ // TODO(penghuang): verify the scanout is the right usage for video playback.
+ // crbug.com/1280798
+ constexpr SharedImageUsageSet kSupportedUsage =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ SHARED_IMAGE_USAGE_SCANOUT |
+ #endif
+ SHARED_IMAGE_USAGE_GLES2_READ | SHARED_IMAGE_USAGE_GLES2_WRITE |
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
new file mode 100644
index 0000000000..c92c162588
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/external_vk_image_backing.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/external_vk_image_backing.cc
+@@ -57,7 +57,7 @@
+ #include "ui/gl/gl_version_info.h"
+ #include "ui/gl/scoped_binders.h"
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ #include "gpu/command_buffer/service/shared_image/external_vk_image_dawn_representation.h"
+ #if BUILDFLAG(DAWN_ENABLE_BACKEND_OPENGLES)
+ #include "gpu/command_buffer/service/shared_image/dawn_gl_texture_representation.h"
+@@ -702,7 +702,7 @@ std::unique_ptr<DawnImageRepresentation>
+ wgpu::BackendType backend_type,
+ std::vector<wgpu::TextureFormat> view_formats,
+ scoped_refptr<SharedContextState> context_state) {
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ auto wgpu_format = ToDawnFormat(format());
+
+ if (wgpu_format == wgpu::TextureFormat::Undefined) {
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc
new file mode 100644
index 0000000000..84dfb21b0d
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/external_vk_image_backing_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/external_vk_image_backing_factory.cc
+@@ -176,7 +176,7 @@ bool IsFormatSupported(viz::SharedImageF
+
+ SharedImageUsageSet SupportedUsage() {
+ SharedImageUsageSet supported_usage =
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_DAWN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_DAWN)
+ SHARED_IMAGE_USAGE_WEBGPU_READ | SHARED_IMAGE_USAGE_WEBGPU_WRITE |
+ SHARED_IMAGE_USAGE_WEBGPU_SWAP_CHAIN_TEXTURE |
+ SHARED_IMAGE_USAGE_WEBGPU_STORAGE_TEXTURE |
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
new file mode 100644
index 0000000000..b1c5204e20
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/shared_image_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/shared_image_factory.cc
+@@ -48,7 +48,7 @@
+ #include "gpu/command_buffer/service/shared_image/angle_vulkan_image_backing_factory.h"
+ #include "gpu/vulkan/vulkan_device_queue.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "gpu/command_buffer/service/shared_image/external_vk_image_backing_factory.h"
+ #endif
+
+@@ -112,7 +112,7 @@ gfx::GpuMemoryBufferType GetNativeBuffer
+ return gfx::GpuMemoryBufferType::IO_SURFACE_BUFFER;
+ #elif BUILDFLAG(IS_ANDROID)
+ return gfx::GpuMemoryBufferType::ANDROID_HARDWARE_BUFFER;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return gfx::GpuMemoryBufferType::NATIVE_PIXMAP;
+ #elif BUILDFLAG(IS_WIN)
+ return gfx::GpuMemoryBufferType::DXGI_SHARED_HANDLE;
+@@ -316,7 +316,7 @@ SharedImageFactory::SharedImageFactory(
+ context_state_, workarounds_);
+ factories_.push_back(std::move(ozone_factory));
+ }
+-#if BUILDFLAG(ENABLE_VULKAN) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA))
++#if BUILDFLAG(ENABLE_VULKAN) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD))
+ if (gr_context_type_ == GrContextType::kVulkan) {
+ auto external_vk_image_factory =
+ std::make_unique<ExternalVkImageBackingFactory>(context_state_);
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
new file mode 100644
index 0000000000..31730f0fbd
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/shared_image_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/shared_image_manager.cc
+@@ -604,7 +604,7 @@ bool SharedImageManager::SupportsScanout
+ return true;
+ #elif BUILDFLAG(IS_ANDROID)
+ return base::AndroidHardwareBufferCompat::IsSupportAvailable();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // We are in the process of tightening scanout support on Ozone to be guarded
+ // by overlays being supported rather than merely native pixmaps being
+ // supported, as native pixmap support doesn't always imply that those native
diff --git a/electron34/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc b/electron34/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
new file mode 100644
index 0000000000..f8a8a1fbaa
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/shared_image/wrapped_sk_image_backing.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/shared_image/wrapped_sk_image_backing.cc
+@@ -214,7 +214,7 @@ bool WrappedSkImageBacking::Initialize(c
+
+ constexpr GrRenderable is_renderable = GrRenderable::kYes;
+ constexpr GrProtected is_protected = GrProtected::kNo;
+-#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX)
++#if DCHECK_IS_ON() && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // Blue for single-planar and magenta-ish for multi-planar.
+ SkColor4f fallback_color =
+ format().is_single_plane() ? SkColors::kBlue : SkColors::kWhite;
diff --git a/electron34/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc b/electron34/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
new file mode 100644
index 0000000000..ce839e7e17
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/service/webgpu_decoder_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/service/webgpu_decoder_impl.cc
+@@ -1341,7 +1341,7 @@ WGPUFuture WebGPUDecoderImpl::RequestAda
+ force_fallback_adapter = true;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!shared_context_state_->GrContextIsVulkan() &&
+ !shared_context_state_->IsGraphiteDawnVulkan() &&
+ use_webgpu_adapter_ != WebGPUAdapterName::kOpenGLES) {
+@@ -2026,7 +2026,7 @@ WebGPUDecoderImpl::AssociateMailboxDawn(
+ }
+
+ #if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_APPLE) && \
+- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_LINUX)
++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ if (usage & wgpu::TextureUsage::StorageBinding) {
+ LOG(ERROR) << "AssociateMailbox: wgpu::TextureUsage::StorageBinding is NOT "
+ "supported yet on this platform.";
diff --git a/electron34/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc b/electron34/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
new file mode 100644
index 0000000000..09c65ee08b
--- /dev/null
+++ b/electron34/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
+@@ -32,7 +32,7 @@
+ #include "ui/gfx/half_float.h"
+ #include "ui/gl/test/gl_test_support.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h"
+ #include "ui/gfx/linux/client_native_pixmap_factory_dmabuf.h"
+ #endif
+@@ -75,7 +75,7 @@ class GpuMemoryBufferTest : public testi
+ GLManager gl_;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ class GpuMemoryBufferTestEGL : public testing::Test,
+ public gpu::GpuCommandBufferTestEGL {
+ public:
diff --git a/electron34/patches/patch-gpu_config_gpu__control__list.cc b/electron34/patches/patch-gpu_config_gpu__control__list.cc
new file mode 100644
index 0000000000..d764879246
--- /dev/null
+++ b/electron34/patches/patch-gpu_config_gpu__control__list.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/config/gpu_control_list.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/config/gpu_control_list.cc
+@@ -276,7 +276,7 @@ bool GpuControlList::More::GLVersionInfo
+ GpuControlList::GLType GpuControlList::More::GetDefaultGLType() {
+ #if BUILDFLAG(IS_CHROMEOS)
+ return kGLTypeGL;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kGLTypeGL;
+ #elif BUILDFLAG(IS_MAC)
+ return kGLTypeGL;
+@@ -847,7 +847,7 @@ GpuControlList::OsType GpuControlList::G
+ return kOsAndroid;
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return kOsFuchsia;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_OPENBSD)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return kOsLinux;
+ #elif BUILDFLAG(IS_MAC)
+ return kOsMacosx;
diff --git a/electron34/patches/patch-gpu_config_gpu__finch__features.cc b/electron34/patches/patch-gpu_config_gpu__finch__features.cc
new file mode 100644
index 0000000000..9eac3b986f
--- /dev/null
+++ b/electron34/patches/patch-gpu_config_gpu__finch__features.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/config/gpu_finch_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/config/gpu_finch_features.cc
+@@ -166,7 +166,8 @@ BASE_FEATURE(kAllowHardwareBufferUsageFl
+ BASE_FEATURE(kDefaultEnableGpuRasterization,
+ "DefaultEnableGpuRasterization",
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++ BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-gpu_config_gpu__info__collector.cc b/electron34/patches/patch-gpu_config_gpu__info__collector.cc
new file mode 100644
index 0000000000..4059a5f1ee
--- /dev/null
+++ b/electron34/patches/patch-gpu_config_gpu__info__collector.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/config/gpu_info_collector.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/config/gpu_info_collector.cc
+@@ -358,7 +358,7 @@ void ReportWebGPUAdapterMetrics(dawn::na
+ void ReportWebGPUSupportMetrics(dawn::native::Instance* instance) {
+ static BASE_FEATURE(kCollectWebGPUSupportMetrics,
+ "CollectWebGPUSupportMetrics",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_ENABLED_BY_DEFAULT);
diff --git a/electron34/patches/patch-gpu_config_gpu__test__config.cc b/electron34/patches/patch-gpu_config_gpu__test__config.cc
new file mode 100644
index 0000000000..b1cc6004ca
--- /dev/null
+++ b/electron34/patches/patch-gpu_config_gpu__test__config.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/config/gpu_test_config.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/config/gpu_test_config.cc
+@@ -29,7 +29,7 @@ GPUTestConfig::OS GetCurrentOS() {
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ return GPUTestConfig::kOsChromeOS;
+ #elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || \
+- BUILDFLAG(IS_OPENBSD)
++ BUILDFLAG(IS_BSD)
+ return GPUTestConfig::kOsLinux;
+ #elif BUILDFLAG(IS_WIN)
+ int32_t major_version = 0;
diff --git a/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc b/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
new file mode 100644
index 0000000000..72da523abb
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/common/gpu_memory_buffer_support.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/common/gpu_memory_buffer_support.cc
+@@ -26,7 +26,7 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #endif
+
+-#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/common/gpu_memory_buffer_impl_native_pixmap.h"
+ #endif
+
+@@ -55,7 +55,7 @@ GpuMemoryBufferSupport::GetNativeGpuMemo
+ return gfx::IO_SURFACE_BUFFER;
+ #elif BUILDFLAG(IS_ANDROID)
+ return gfx::ANDROID_HARDWARE_BUFFER;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ return gfx::NATIVE_PIXMAP;
+ #elif BUILDFLAG(IS_WIN)
+ return gfx::DXGI_SHARED_HANDLE;
diff --git a/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h b/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h
new file mode 100644
index 0000000000..edfc4d2344
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/common/gpu_memory_buffer_support.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/common/gpu_memory_buffer_support.h
+@@ -21,7 +21,7 @@
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ namespace gfx {
+ class ClientNativePixmapFactory;
+ } // namespace gfx
diff --git a/electron34/patches/patch-gpu_ipc_service_BUILD.gn b/electron34/patches/patch-gpu_ipc_service_BUILD.gn
new file mode 100644
index 0000000000..aa69c5c0ed
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/BUILD.gn
+@@ -135,6 +135,7 @@ component("service") {
+ "QuartzCore.framework",
+ ]
+ defines += [ "GL_SILENCE_DEPRECATION" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+ if (is_ios) {
+ sources += [ "image_transport_surface_ios.mm" ]
diff --git a/electron34/patches/patch-gpu_ipc_service_gpu__init.cc b/electron34/patches/patch-gpu_ipc_service_gpu__init.cc
new file mode 100644
index 0000000000..15585986e3
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_gpu__init.cc
@@ -0,0 +1,80 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/gpu_init.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/gpu_init.cc
+@@ -388,7 +388,7 @@ bool GpuInit::InitializeAndStartSandbox(
+ enable_watchdog = false;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool gpu_sandbox_start_early = gpu_preferences_.gpu_sandbox_start_early;
+ #else // !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
+ // For some reasons MacOSX's VideoToolbox might crash when called after
+@@ -425,7 +425,7 @@ bool GpuInit::InitializeAndStartSandbox(
+ }
+
+ bool attempted_startsandbox = false;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Chrome OS ARM Mali, GPU driver userspace creates threads when
+ // initializing a GL context, so start the sandbox early.
+ // TODO(zmo): Need to collect OS version before this.
+@@ -527,7 +527,7 @@ bool GpuInit::InitializeAndStartSandbox(
+ gpu_preferences_.gr_context_type = GrContextType::kGL;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The ContentSandboxHelper is currently the only one implementation of
+ // GpuSandboxHelper and it has no dependency. Except on Linux where
+ // VaapiWrapper checks the GL implementation to determine which display
+@@ -609,7 +609,7 @@ bool GpuInit::InitializeAndStartSandbox(
+ command_line, gpu_feature_info_,
+ gpu_preferences_.disable_software_rasterizer, false);
+ if (gl_use_swiftshader_) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VLOG(1) << "Quit GPU process launch to fallback to SwiftShader cleanly "
+ << "on Linux";
+ return false;
+@@ -765,7 +765,7 @@ bool GpuInit::InitializeAndStartSandbox(
+
+ InitializePlatformOverlaySettings(&gpu_info_, gpu_feature_info_);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Driver may create a compatibility profile context when collect graphics
+ // information on Linux platform. Try to collect graphics information
+ // based on core profile context after disabling platform extensions.
+@@ -820,7 +820,7 @@ bool GpuInit::InitializeAndStartSandbox(
+ }
+ }
+ }
+-#if BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_CHROMEOS_DEVICE))
+ if (!gl_disabled && !gl_use_swiftshader_ && std::getenv("RUNNING_UNDER_RR")) {
+ // https://rr-project.org/ is a Linux-only record-and-replay debugger that
+@@ -1007,7 +1007,7 @@ void GpuInit::InitializeInProcess(base::
+ }
+ bool gl_disabled = gl::GetGLImplementation() == gl::kGLImplementationDisabled;
+
+-#if BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_CHROMEOS_DEVICE))
+ if (!gl_disabled && !gl_use_swiftshader_ && std::getenv("RUNNING_UNDER_RR")) {
+ // https://rr-project.org/ is a Linux-only record-and-replay debugger that
+@@ -1062,7 +1062,7 @@ void GpuInit::InitializeInProcess(base::
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Driver may create a compatibility profile context when collect graphics
+ // information on Linux platform. Try to collect graphics information
+ // based on core profile context after disabling platform extensions.
diff --git a/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc b/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
new file mode 100644
index 0000000000..e9deaaae2f
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/gpu_memory_buffer_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/gpu_memory_buffer_factory.cc
+@@ -14,7 +14,7 @@
+ #include "gpu/ipc/service/gpu_memory_buffer_factory_io_surface.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h"
+ #endif
+
+@@ -71,7 +71,7 @@ GpuMemoryBufferFactory::CreateNativeType
+ // to have a factory that vends invalid GMB handles rather than having no
+ // factory at all.
+ return std::make_unique<GpuMemoryBufferFactoryStub>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return std::make_unique<GpuMemoryBufferFactoryNativePixmap>(
+ vulkan_context_provider);
+ #elif BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory__dxgi.cc b/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory__dxgi.cc
new file mode 100644
index 0000000000..8fa71e60f6
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory__dxgi.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/gpu_memory_buffer_factory_dxgi.cc
+@@ -178,7 +178,8 @@ gfx::GpuMemoryBufferHandle GpuMemoryBuff
+ // so make sure that the usage is one that we support.
+ DCHECK(usage == gfx::BufferUsage::GPU_READ ||
+ usage == gfx::BufferUsage::SCANOUT ||
+- usage == gfx::BufferUsage::SCANOUT_CPU_READ_WRITE)
++ usage == gfx::BufferUsage::SCANOUT_CPU_READ_WRITE ||
++ usage == gfx::BufferUsage::SCANOUT_VEA_CPU_READ)
+ << "Incorrect usage, usage=" << gfx::BufferUsageToString(usage);
+
+ D3D11_TEXTURE2D_DESC desc = {
+@@ -192,7 +193,9 @@ gfx::GpuMemoryBufferHandle GpuMemoryBuff
+ D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET,
+ 0,
+ D3D11_RESOURCE_MISC_SHARED_NTHANDLE |
+- D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX};
++ static_cast<UINT>(usage == gfx::BufferUsage::SCANOUT_VEA_CPU_READ
++ ? D3D11_RESOURCE_MISC_SHARED
++ : D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX)};
+
+ Microsoft::WRL::ComPtr<ID3D11Texture2D> d3d11_texture;
+
diff --git a/electron34/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h b/electron34/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h
new file mode 100644
index 0000000000..6c4b384766
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/image_transport_surface_overlay_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/image_transport_surface_overlay_mac.h
+@@ -8,6 +8,7 @@
+ #include <vector>
+
+ #include "base/memory/weak_ptr.h"
++#include "electron/mas.h"
+ #include "gpu/ipc/service/command_buffer_stub.h"
+ #include "gpu/ipc/service/image_transport_surface.h"
+ #include "ui/gfx/ca_layer_result.h"
+@@ -23,7 +24,9 @@
+ #include "ui/display/types/display_constants.h"
+ #endif
+
++#if !IS_MAS_BUILD()
+ @class CAContext;
++#endif
+ @class CALayer;
+
+ namespace ui {
diff --git a/electron34/patches/patch-gpu_ipc_service_x__util.h b/electron34/patches/patch-gpu_ipc_service_x__util.h
new file mode 100644
index 0000000000..6594f4dd3b
--- /dev/null
+++ b/electron34/patches/patch-gpu_ipc_service_x__util.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/ipc/service/x_util.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/ipc/service/x_util.h
+@@ -12,7 +12,7 @@
+ #include "gpu/ipc/service/gpu_config.h"
+ #include "ui/base/ozone_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+
+ namespace gpu {
+
diff --git a/electron34/patches/patch-gpu_vulkan_generate__bindings.py b/electron34/patches/patch-gpu_vulkan_generate__bindings.py
new file mode 100644
index 0000000000..f147cc8bee
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_generate__bindings.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/generate_bindings.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/generate_bindings.py
+@@ -271,7 +271,7 @@ VULKAN_DEVICE_FUNCTIONS = [
+ ]
+ },
+ {
+- 'ifdef': 'BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)',
++ 'ifdef': 'BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)',
+ 'extension': 'VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME',
+ 'functions': [
+ 'vkGetImageDrmFormatModifierPropertiesEXT',
diff --git a/electron34/patches/patch-gpu_vulkan_semaphore__handle.cc b/electron34/patches/patch-gpu_vulkan_semaphore__handle.cc
new file mode 100644
index 0000000000..c75ecb03b5
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_semaphore__handle.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/semaphore_handle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/semaphore_handle.cc
+@@ -39,7 +39,7 @@ SemaphoreHandle::SemaphoreHandle(gfx::Gp
+ // https://fuchsia.dev/reference/fidl/fuchsia.ui.scenic.
+ Init(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA,
+ fence_handle.Release());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ Init(VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR,
+ fence_handle.Release());
+ #elif BUILDFLAG(IS_POSIX)
+@@ -64,7 +64,7 @@ gfx::GpuFenceHandle SemaphoreHandle::ToG
+ // VkSemaphore, which can then be used to submit present work, see
+ // https://fuchsia.dev/reference/fidl/fuchsia.ui.scenic.
+ fence_handle.Adopt(TakeHandle());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (type_ == VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR) {
+ fence_handle.Adopt(TakeHandle());
+ } else {
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.cc b/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.cc
new file mode 100644
index 0000000000..3d9fd9dfdb
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_device_queue.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_device_queue.cc
+@@ -154,7 +154,7 @@ bool VulkanDeviceQueue::Initialize(
+
+ // In dual-CPU cases, we cannot detect the active GPU correctly on Linux,
+ // so don't select GPU device based on the |gpu_info|.
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ // If gpu_info is provided, the device should match it.
+ if (gpu_info && (device_properties.vendorID != gpu_info->gpu.vendor_id ||
+ device_properties.deviceID != gpu_info->gpu.device_id)) {
+@@ -297,7 +297,7 @@ bool VulkanDeviceQueue::Initialize(
+ // Android, Fuchsia, Linux, and CrOS (VaapiVideoDecoder) need YCbCr sampler
+ // support.
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!physical_device_info.feature_sampler_ycbcr_conversion) {
+ LOG(ERROR) << "samplerYcbcrConversion is not supported.";
+ return false;
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.h b/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.h
new file mode 100644
index 0000000000..31584f0ace
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__device__queue.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_device_queue.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_device_queue.h
+@@ -179,7 +179,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanDev
+ #endif
+
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VkPhysicalDeviceSamplerYcbcrConversionFeatures
+ sampler_ycbcr_conversion_features_{
+ VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES};
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.cc b/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.cc
new file mode 100644
index 0000000000..52c97fba59
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_function_pointers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_function_pointers.cc
+@@ -1297,7 +1297,7 @@ bool VulkanFunctionPointers::BindDeviceF
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (gfx::HasExtension(enabled_extensions,
+ VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME)) {
+ constexpr char kvkGetImageDrmFormatModifierPropertiesEXT[] =
+@@ -1498,7 +1498,7 @@ void VulkanFunctionPointers::ResetForTes
+ vkGetSwapchainImagesKHR = nullptr;
+ vkQueuePresentKHR = nullptr;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ vkGetImageDrmFormatModifierPropertiesEXT = nullptr;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.h b/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.h
new file mode 100644
index 0000000000..f52fd30328
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__function__pointers.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_function_pointers.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_function_pointers.h
+@@ -322,7 +322,7 @@ struct COMPONENT_EXPORT(VULKAN) VulkanFu
+ VulkanFunction<PFN_vkGetSwapchainImagesKHR> vkGetSwapchainImagesKHR;
+ VulkanFunction<PFN_vkQueuePresentKHR> vkQueuePresentKHR;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VulkanFunction<PFN_vkGetImageDrmFormatModifierPropertiesEXT>
+ vkGetImageDrmFormatModifierPropertiesEXT;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -1336,7 +1336,7 @@ ALWAYS_INLINE VkResult vkQueuePresentKHR
+ pPresentInfo);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ALWAYS_INLINE VkResult vkGetImageDrmFormatModifierPropertiesEXT(
+ VkDevice device,
+ VkImage image,
+@@ -1346,4 +1346,4 @@ ALWAYS_INLINE VkResult vkGetImageDrmForm
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#endif // GPU_VULKAN_VULKAN_FUNCTION_POINTERS_H_
+\ No newline at end of file
++#endif // GPU_VULKAN_VULKAN_FUNCTION_POINTERS_H_
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__image.h b/electron34/patches/patch-gpu_vulkan_vulkan__image.h
new file mode 100644
index 0000000000..64da4aabe1
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__image.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_image.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_image.h
+@@ -87,7 +87,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanIma
+ VkImageUsageFlags usage,
+ VkImageCreateFlags flags);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static std::unique_ptr<VulkanImage> CreateWithExternalMemoryAndModifiers(
+ VulkanDeviceQueue* device_queue,
+ const gfx::Size& size,
+@@ -199,7 +199,7 @@ class COMPONENT_EXPORT(VULKAN) VulkanIma
+ VkImageTiling image_tiling,
+ uint32_t queue_family_index);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool InitializeWithExternalMemoryAndModifiers(VulkanDeviceQueue* device_queue,
+ const gfx::Size& size,
+ VkFormat format,
diff --git a/electron34/patches/patch-gpu_vulkan_vulkan__util.cc b/electron34/patches/patch-gpu_vulkan_vulkan__util.cc
new file mode 100644
index 0000000000..3da358136d
--- /dev/null
+++ b/electron34/patches/patch-gpu_vulkan_vulkan__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- gpu/vulkan/vulkan_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ gpu/vulkan/vulkan_util.cc
+@@ -473,7 +473,7 @@ bool CheckVulkanCompatibilities(
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) && !defined(OZONE_PLATFORM_IS_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !defined(OZONE_PLATFORM_IS_X11)
+ // Vulkan is only supported with X11 on Linux for now.
+ return false;
+ #else
diff --git a/electron34/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc b/electron34/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
new file mode 100644
index 0000000000..66d4926abc
--- /dev/null
+++ b/electron34/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- headless/lib/browser/headless_browser_main_parts_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ headless/lib/browser/headless_browser_main_parts_posix.cc
+@@ -21,13 +21,13 @@
+ #include "content/public/browser/browser_thread.h"
+ #include "headless/lib/browser/headless_browser_impl.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/command_line.h"
+ #include "components/os_crypt/sync/key_storage_config_linux.h"
+ #include "components/os_crypt/sync/os_crypt.h"
+ #include "headless/public/switches.h"
+
+-#if defined(USE_DBUS)
++#if defined(USE_DBUS) && !BUILDFLAG(IS_BSD)
+ #include "device/bluetooth/dbus/bluez_dbus_manager.h"
+ #endif
+
+@@ -161,7 +161,7 @@ class BrowserShutdownHandler {
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kProductName[] = "HeadlessChrome";
+ #endif
+
+@@ -169,9 +169,9 @@ void HeadlessBrowserMainParts::PostCreat
+ BrowserShutdownHandler::Install(base::BindOnce(
+ &HeadlessBrowserImpl::ShutdownWithExitCode, browser_->GetWeakPtr()));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+-#if defined(USE_DBUS)
++#if defined(USE_DBUS) && !BUILDFLAG(IS_BSD)
+ bluez::BluezDBusManager::Initialize(/*system_bus=*/nullptr);
+ #endif
+
diff --git a/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.cc b/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.cc
new file mode 100644
index 0000000000..acb548c0f8
--- /dev/null
+++ b/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- headless/lib/browser/headless_content_browser_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ headless/lib/browser/headless_content_browser_client.cc
+@@ -56,7 +56,7 @@
+ #include "content/public/common/content_descriptors.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)) && defined(HEADLESS_USE_PREFS)
++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(HEADLESS_USE_PREFS)
+ #include "components/os_crypt/sync/os_crypt.h" // nogncheck
+ #include "content/public/browser/network_service_util.h"
+ #endif
+@@ -516,7 +516,7 @@ void HeadlessContentBrowserClient::Handl
+
+ void HeadlessContentBrowserClient::SetEncryptionKey(
+ ::network::mojom::NetworkService* network_service) {
+-#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)) && defined(HEADLESS_USE_PREFS)
++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(HEADLESS_USE_PREFS)
+ // The OSCrypt keys are process bound, so if network service is out of
+ // process, send it the required key if it is available.
+ if (content::IsOutOfProcessNetworkService()
diff --git a/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.h b/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.h
new file mode 100644
index 0000000000..bc43c9a797
--- /dev/null
+++ b/electron34/patches/patch-headless_lib_browser_headless__content__browser__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- headless/lib/browser/headless_content_browser_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ headless/lib/browser/headless_content_browser_client.h
+@@ -45,7 +45,7 @@ class HeadlessContentBrowserClient : pub
+ CreateDevToolsManagerDelegate() override;
+ content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
+ content::BrowserContext* context) override;
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ void GetAdditionalMappedFilesForChildProcess(
+ const base::CommandLine& command_line,
+ int child_process_id,
diff --git a/electron34/patches/patch-headless_lib_browser_headless__web__contents__impl.cc b/electron34/patches/patch-headless_lib_browser_headless__web__contents__impl.cc
new file mode 100644
index 0000000000..ab7a522d51
--- /dev/null
+++ b/electron34/patches/patch-headless_lib_browser_headless__web__contents__impl.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- headless/lib/browser/headless_web_contents_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ headless/lib/browser/headless_web_contents_impl.cc
+@@ -69,7 +69,7 @@ BASE_FEATURE(kPrerender2InHeadlessMode,
+ namespace {
+
+ void UpdatePrefsFromSystemSettings(blink::RendererPreferences* prefs) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ content::UpdateFontRendererPreferencesFromSystemSettings(prefs);
+ #endif
+
+@@ -205,8 +205,7 @@ class HeadlessWebContentsImpl::Delegate
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override {
++ const content::mojom::CreateNewWindowParams& params) override {
+ return headless_web_contents_->browser_context()
+ ->options()
+ ->block_new_web_contents();
diff --git a/electron34/patches/patch-headless_lib_headless__content__main__delegate.cc b/electron34/patches/patch-headless_lib_headless__content__main__delegate.cc
new file mode 100644
index 0000000000..88e80fbfd5
--- /dev/null
+++ b/electron34/patches/patch-headless_lib_headless__content__main__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- headless/lib/headless_content_main_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ headless/lib/headless_content_main_delegate.cc
+@@ -407,7 +407,7 @@ void HeadlessContentMainDelegate::InitCr
+ if (process_type != ::switches::kZygoteProcess) {
+ g_headless_crash_client.Pointer()->set_crash_dumps_dir(
+ command_line.GetSwitchValuePath(switches::kCrashDumpsDir));
+-#if !BUILDFLAG(IS_WIN)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD)
+ crash_reporter::InitializeCrashpad(process_type.empty(), process_type);
+ #endif // !BUILDFLAG(IS_WIN)
+ crash_keys::SetSwitchesFromCommandLine(command_line, nullptr);
diff --git a/electron34/patches/patch-ipc_ipc__channel.h b/electron34/patches/patch-ipc_ipc__channel.h
new file mode 100644
index 0000000000..8d579c9a9e
--- /dev/null
+++ b/electron34/patches/patch-ipc_ipc__channel.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ipc/ipc_channel.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ipc/ipc_channel.h
+@@ -218,7 +218,7 @@ class COMPONENT_EXPORT(IPC) Channel : pu
+ static std::string GenerateUniqueRandomChannelID();
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Sandboxed processes live in a PID namespace, so when sending the IPC hello
+ // message from client to server we need to send the PID from the global
+ // PID namespace.
diff --git a/electron34/patches/patch-ipc_ipc__channel__common.cc b/electron34/patches/patch-ipc_ipc__channel__common.cc
new file mode 100644
index 0000000000..80eae9aa0d
--- /dev/null
+++ b/electron34/patches/patch-ipc_ipc__channel__common.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ipc/ipc_channel_common.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ipc/ipc_channel_common.cc
+@@ -10,7 +10,7 @@
+
+ namespace IPC {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ namespace {
+ int g_global_pid = 0;
diff --git a/electron34/patches/patch-ipc_ipc__channel__mojo.cc b/electron34/patches/patch-ipc_ipc__channel__mojo.cc
new file mode 100644
index 0000000000..92d93dbd49
--- /dev/null
+++ b/electron34/patches/patch-ipc_ipc__channel__mojo.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ipc/ipc_channel_mojo.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ipc/ipc_channel_mojo.cc
+@@ -105,7 +105,7 @@ class ThreadSafeChannelProxy : public mo
+ };
+
+ base::ProcessId GetSelfPID() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (int global_pid = Channel::GetGlobalPid())
+ return global_pid;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-ipc_ipc__message__utils.cc b/electron34/patches/patch-ipc_ipc__message__utils.cc
new file mode 100644
index 0000000000..1126341d5f
--- /dev/null
+++ b/electron34/patches/patch-ipc_ipc__message__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ipc/ipc_message_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ipc/ipc_message_utils.cc
+@@ -399,7 +399,7 @@ void ParamTraits<unsigned int>::Log(cons
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ void ParamTraits<long>::Log(const param_type& p, std::string* l) {
+ l->append(base::NumberToString(p));
diff --git a/electron34/patches/patch-ipc_ipc__message__utils.h b/electron34/patches/patch-ipc_ipc__message__utils.h
new file mode 100644
index 0000000000..1041496914
--- /dev/null
+++ b/electron34/patches/patch-ipc_ipc__message__utils.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ipc/ipc_message_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ipc/ipc_message_utils.h
+@@ -214,7 +214,7 @@ struct ParamTraits<unsigned int> {
+ // Since we want to support Android 32<>64 bit IPC, as long as we don't have
+ // these traits for 32 bit ARM then that'll catch any errors.
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_ANDROID) && defined(ARCH_CPU_64_BITS))
+ template <>
+ struct ParamTraits<long> {
diff --git a/electron34/patches/patch-media_BUILD.gn b/electron34/patches/patch-media_BUILD.gn
new file mode 100644
index 0000000000..60dcc5dd92
--- /dev/null
+++ b/electron34/patches/patch-media_BUILD.gn
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/BUILD.gn
+@@ -99,6 +99,12 @@ config("media_config") {
+ defines += [ "DLOPEN_PULSEAUDIO" ]
+ }
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
++# if (use_audioio) {
++# defines += [ "USE_AUDIOIO" ]
++# }
+ }
+
+ # Internal grouping of the configs necessary to support sub-folders having their
diff --git a/electron34/patches/patch-media_audio_BUILD.gn b/electron34/patches/patch-media_audio_BUILD.gn
new file mode 100644
index 0000000000..15076d07a0
--- /dev/null
+++ b/electron34/patches/patch-media_audio_BUILD.gn
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/BUILD.gn
+@@ -198,6 +198,7 @@ source_set("audio") {
+ "CoreMedia.framework",
+ ]
+ weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_ios) {
+@@ -269,10 +270,46 @@ source_set("audio") {
+ deps += [ "//media/base/android:media_jni_headers" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "linux/audio_manager_linux.cc" ]
+ }
+
++ if (is_bsd && !use_audioio) {
++ sources += [ "sndio/audio_manager_sndio.cc" ]
++ }
++
++ if (use_sndio) {
++ libs += [ "sndio" ]
++ sources += [
++ "sndio/sndio_input.cc",
++ "sndio/sndio_input.h",
++ "sndio/sndio_output.cc",
++ "sndio/sndio_output.h"
++ ]
++ }
++
++ if (use_audioio) {
++ sources += [
++ "audioio/audio_manager_audioio.cc",
++ "audioio/audio_manager_audioio.h",
++ "audioio/audioio_input.cc",
++ "audioio/audioio_input.h",
++ "audioio/audioio_output.cc",
++ "audioio/audioio_output.h"
++ ]
++ }
++
++ if (use_audioio) {
++ sources += [
++ "audioio/audio_manager_audioio.cc",
++ "audioio/audio_manager_audioio.h",
++ "audioio/audioio_input.cc",
++ "audioio/audioio_input.h",
++ "audioio/audioio_output.cc",
++ "audioio/audioio_output.h"
++ ]
++ }
++
+ if (use_alsa) {
+ libs += [ "asound" ]
+ sources += [
diff --git a/electron34/patches/patch-media_audio_alsa_audio__manager__alsa.cc b/electron34/patches/patch-media_audio_alsa_audio__manager__alsa.cc
new file mode 100644
index 0000000000..e83205b5ab
--- /dev/null
+++ b/electron34/patches/patch-media_audio_alsa_audio__manager__alsa.cc
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/alsa/audio_manager_alsa.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/alsa/audio_manager_alsa.cc
+@@ -100,7 +100,9 @@ void AudioManagerAlsa::GetAlsaAudioDevic
+ int card = -1;
+
+ // Loop through the physical sound cards to get ALSA device hints.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && card >= 0) {
++#endif
+ void** hints = NULL;
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+@@ -112,7 +114,9 @@ void AudioManagerAlsa::GetAlsaAudioDevic
+ DLOG(WARNING) << "GetAlsaAudioDevices: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+ }
+
+ void AudioManagerAlsa::GetAlsaDevicesInfo(AudioManagerAlsa::StreamType type,
+@@ -195,7 +199,11 @@ bool AudioManagerAlsa::IsAlsaDeviceAvail
+ // goes through software conversion if needed (e.g. incompatible
+ // sample rate).
+ // TODO(joi): Should we prefer "hw" instead?
++#if BUILDFLAG(IS_BSD)
++ static const char kDeviceTypeDesired[] = "plug";
++#else
+ static const char kDeviceTypeDesired[] = "plughw";
++#endif
+ return strncmp(kDeviceTypeDesired, device_name,
+ std::size(kDeviceTypeDesired) - 1) == 0;
+ }
+@@ -247,7 +255,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDe
+ // Loop through the sound cards.
+ // Don't use snd_device_name_hint(-1,..) since there is an access violation
+ // inside this ALSA API with libasound.so.2.0.0.
++#if !BUILDFLAG(IS_BSD)
+ while (!wrapper_->CardNext(&card) && (card >= 0) && !has_device) {
++#endif
+ int error = wrapper_->DeviceNameHint(card, kPcmInterfaceName, &hints);
+ if (!error) {
+ for (void** hint_iter = hints; *hint_iter != NULL; hint_iter++) {
+@@ -271,7 +281,9 @@ bool AudioManagerAlsa::HasAnyAlsaAudioDe
+ DLOG(WARNING) << "HasAnyAudioDevice: unable to get device hints: "
+ << wrapper_->StrError(error);
+ }
++#if !BUILDFLAG(IS_BSD)
+ }
++#endif
+
+ return has_device;
+ }
diff --git a/electron34/patches/patch-media_audio_apple_audio__low__latency__input.cc b/electron34/patches/patch-media_audio_apple_audio__low__latency__input.cc
new file mode 100644
index 0000000000..ae57af05b4
--- /dev/null
+++ b/electron34/patches/patch-media_audio_apple_audio__low__latency__input.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/apple/audio_low_latency_input.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/apple/audio_low_latency_input.cc
+@@ -28,6 +28,7 @@
+ #include "base/strings/sys_string_conversions.h"
+ #include "base/time/time.h"
+ #include "base/trace_event/trace_event.h"
++#include "electron/mas.h"
+ #include "media/audio/apple/audio_manager_apple.h"
+ #include "media/audio/apple/scoped_audio_unit.h"
+ #include "media/base/audio_bus.h"
+@@ -39,19 +40,23 @@
+
+ namespace {
+ extern "C" {
++#if !IS_MAS_BUILD()
+ // See:
+ // https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/PAL/pal/spi/cf/CoreAudioSPI.h?rev=228264
+ OSStatus AudioDeviceDuck(AudioDeviceID inDevice,
+ Float32 inDuckedLevel,
+ const AudioTimeStamp* __nullable inStartTime,
+ Float32 inRampDuration) __attribute__((weak_import));
++#endif
+ }
+
+ void UndoDucking(AudioDeviceID output_device_id) {
++#if !IS_MAS_BUILD()
+ if (AudioDeviceDuck != nullptr) {
+ // Ramp the volume back up over half a second.
+ AudioDeviceDuck(output_device_id, 1.0, nullptr, 0.5);
+ }
++#endif
+ }
+ } // namespace
+ #endif
diff --git a/electron34/patches/patch-media_audio_audio__input__device.cc b/electron34/patches/patch-media_audio_audio__input__device.cc
new file mode 100644
index 0000000000..b5c4380bc1
--- /dev/null
+++ b/electron34/patches/patch-media_audio_audio__input__device.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/audio_input_device.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/audio_input_device.cc
+@@ -269,7 +269,7 @@ void AudioInputDevice::OnStreamCreated(
+ // here. See comments in AliveChecker and PowerObserverHelper for details and
+ // todos.
+ if (detect_dead_stream_ == DeadStreamDetection::kEnabled) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const bool stop_at_first_alive_notification = true;
+ const bool pause_check_during_suspend = false;
+ #else
diff --git a/electron34/patches/patch-media_audio_audio__output__proxy__unittest.cc b/electron34/patches/patch-media_audio_audio__output__proxy__unittest.cc
new file mode 100644
index 0000000000..ce0bf3a2ee
--- /dev/null
+++ b/electron34/patches/patch-media_audio_audio__output__proxy__unittest.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/audio_output_proxy_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/audio_output_proxy_unittest.cc
+@@ -443,7 +443,11 @@ class AudioOutputProxyTest : public test
+ // |stream| is closed at this point. Start() should reopen it again.
+ EXPECT_CALL(manager(), MakeAudioOutputStream(_, _, _))
+ .Times(2)
++#if BUILDFLAG(IS_BSD)
++ .WillRepeatedly(Return(static_cast<AudioOutputStream*>(NULL)));
++#else
+ .WillRepeatedly(Return(reinterpret_cast<AudioOutputStream*>(NULL)));
++#endif
+
+ EXPECT_CALL(callback_, OnError(_)).Times(2);
+
diff --git a/electron34/patches/patch-media_audio_pulse_pulse__util.cc b/electron34/patches/patch-media_audio_pulse_pulse__util.cc
new file mode 100644
index 0000000000..58303ddb0e
--- /dev/null
+++ b/electron34/patches/patch-media_audio_pulse_pulse__util.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/pulse/pulse_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/audio/pulse/pulse_util.cc
+@@ -50,8 +50,12 @@ constexpr char kBrowserDisplayName[] = "
+
+ #if defined(DLOPEN_PULSEAUDIO)
+ static const base::FilePath::CharType kPulseLib[] =
++#if BUILDFLAG(IS_BSD)
++ FILE_PATH_LITERAL("libpulse.so");
++#else
+ FILE_PATH_LITERAL("libpulse.so.0");
+ #endif
++#endif
+
+ void DestroyMainloop(pa_threaded_mainloop* mainloop) {
+ pa_threaded_mainloop_stop(mainloop);
diff --git a/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.cc b/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.cc
new file mode 100644
index 0000000000..5c1822648a
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.cc
@@ -0,0 +1,222 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/audio_manager_sndio.cc.orig 2025-05-24 17:57:53.535705576 +0000
++++ media/audio/sndio/audio_manager_sndio.cc
+@@ -0,0 +1,213 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/command_line.h"
++#include "base/metrics/histogram_macros.h"
++#include "base/memory/ptr_util.h"
++
++#include "media/audio/sndio/audio_manager_sndio.h"
++
++#include "media/audio/audio_device_description.h"
++#include "media/audio/audio_output_dispatcher.h"
++#if defined(USE_SNDIO)
++#include "media/audio/sndio/sndio_input.h"
++#include "media/audio/sndio/sndio_output.h"
++#endif
++#if defined(USE_PULSEAUDIO)
++#include "media/audio/pulse/audio_manager_pulse.h"
++#include "media/audio/pulse/pulse_util.h"
++#endif
++#if defined(USE_ALSA)
++#include "media/audio/alsa/audio_manager_alsa.h"
++#endif
++#include "media/audio/fake_audio_manager.h"
++#include "media/base/limits.h"
++#include "media/base/media_switches.h"
++
++namespace media {
++
++#if defined(USE_SNDIO)
++// Maximum number of output streams that can be open simultaneously.
++static const int kMaxOutputStreams = 50;
++
++// Default sample rate for input and output streams.
++static const int kDefaultSampleRate = 48000;
++
++void AddDefaultDevice(AudioDeviceNames* device_names) {
++ DCHECK(device_names->empty());
++ device_names->push_front(AudioDeviceName::CreateDefault());
++}
++
++bool AudioManagerSndio::HasAudioOutputDevices() {
++ return true;
++}
++
++bool AudioManagerSndio::HasAudioInputDevices() {
++ return true;
++}
++
++void AudioManagerSndio::GetAudioInputDeviceNames(
++ AudioDeviceNames* device_names) {
++ DCHECK(device_names->empty());
++ AddDefaultDevice(device_names);
++}
++
++void AudioManagerSndio::GetAudioOutputDeviceNames(
++ AudioDeviceNames* device_names) {
++ AddDefaultDevice(device_names);
++}
++
++#if defined(USE_SNDIO)
++const char* AudioManagerSndio::GetName() {
++ return "SNDIO";
++}
++#endif
++
++AudioParameters AudioManagerSndio::GetInputStreamParameters(
++ const std::string& device_id) {
++ static const int kDefaultInputBufferSize = 1024;
++
++ int user_buffer_size = GetUserBufferSize();
++ int buffer_size = user_buffer_size ?
++ user_buffer_size : kDefaultInputBufferSize;
++
++ return AudioParameters(
++ AudioParameters::AUDIO_PCM_LOW_LATENCY, ChannelLayoutConfig::Stereo(),
++ kDefaultSampleRate, buffer_size);
++}
++
++AudioManagerSndio::AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory)
++ : AudioManagerBase(std::move(audio_thread),
++ audio_log_factory) {
++ DLOG(WARNING) << "AudioManagerSndio";
++ SetMaxOutputStreamsAllowed(kMaxOutputStreams);
++}
++
++AudioManagerSndio::~AudioManagerSndio() = default;
++
++AudioOutputStream* AudioManagerSndio::MakeLinearOutputStream(
++ const AudioParameters& params,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++ return MakeOutputStream(params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeLowLatencyOutputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DLOG_IF(ERROR, !device_id.empty()) << "Not implemented!";
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++ return MakeOutputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLinearInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LINEAR, params.format());
++ return MakeInputStream(params);
++}
++
++AudioInputStream* AudioManagerSndio::MakeLowLatencyInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) {
++ DCHECK_EQ(AudioParameters::AUDIO_PCM_LOW_LATENCY, params.format());
++ return MakeInputStream(params);
++}
++
++AudioParameters AudioManagerSndio::GetPreferredOutputStreamParameters(
++ const std::string& output_device_id,
++ const AudioParameters& input_params) {
++ // TODO(tommi): Support |output_device_id|.
++ DLOG_IF(ERROR, !output_device_id.empty()) << "Not implemented!";
++ static const int kDefaultOutputBufferSize = 2048;
++
++ ChannelLayoutConfig channel_layout_config = ChannelLayoutConfig::Stereo();
++ int sample_rate = kDefaultSampleRate;
++ int buffer_size = kDefaultOutputBufferSize;
++ if (input_params.IsValid()) {
++ sample_rate = input_params.sample_rate();
++ channel_layout_config = input_params.channel_layout_config();
++ buffer_size = std::min(buffer_size, input_params.frames_per_buffer());
++ }
++
++ int user_buffer_size = GetUserBufferSize();
++ if (user_buffer_size)
++ buffer_size = user_buffer_size;
++
++ return AudioParameters(
++ AudioParameters::AUDIO_PCM_LOW_LATENCY,
++ channel_layout_config, sample_rate, buffer_size);
++}
++
++AudioInputStream* AudioManagerSndio::MakeInputStream(
++ const AudioParameters& params) {
++ DLOG(WARNING) << "MakeInputStream";
++ return new SndioAudioInputStream(this,
++ AudioDeviceDescription::kDefaultDeviceId, params);
++}
++
++AudioOutputStream* AudioManagerSndio::MakeOutputStream(
++ const AudioParameters& params) {
++ DLOG(WARNING) << "MakeOutputStream";
++ return new SndioAudioOutputStream(params, this);
++}
++#endif
++
++std::unique_ptr<media::AudioManager> CreateAudioManager(
++ std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory) {
++ DLOG(WARNING) << "CreateAudioManager";
++
++ auto _ab = kAudioBackendParam.Get();
++
++ // For testing allow audio output to be disabled.
++ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
++ switches::kDisableAudioOutput) ||
++ !base::FeatureList::IsEnabled(media::kAudioBackend)) {
++ return std::make_unique<FakeAudioManager>(std::move(audio_thread),
++ audio_log_factory);
++ }
++
++#if defined(USE_PULSEAUDIO)
++ pa_threaded_mainloop* pa_mainloop = nullptr;
++ pa_context* pa_context = nullptr;
++ if (_ab != AudioBackend::kSndio && _ab != AudioBackend::kAlsa &&
++ pulse::InitPulse(&pa_mainloop, &pa_context)) {
++ return std::make_unique<AudioManagerPulse>(
++ std::move(audio_thread), audio_log_factory, pa_mainloop, pa_context);
++ } else if (_ab == AudioBackend::kAuto) {
++ LOG(WARNING) << "Falling back to SNDIO for audio output. PulseAudio is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++#if defined(USE_SNDIO)
++ if (_ab != AudioBackend::kPulseAudio && _ab != AudioBackend::kAlsa) {
++ return std::make_unique<AudioManagerSndio>(std::move(audio_thread),
++ audio_log_factory);
++ } else if (_ab == AudioBackend::kAuto) {
++ LOG(WARNING) << "Falling back to ALSA audio output. SNDIO is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++#if defined(USE_ALSA)
++ if (_ab != AudioBackend::kPulseAudio && _ab != AudioBackend::kSndio) {
++ return std::make_unique<AudioManagerAlsa>(std::move(audio_thread),
++ audio_log_factory);
++ } else if (_ab == AudioBackend::kAuto) {
++ LOG(WARNING) << "Falling back to fake audio output. ALSA is not "
++ "available or could not be initialized.";
++ }
++#endif
++
++ return std::make_unique<FakeAudioManager>(std::move(audio_thread),
++ audio_log_factory);
++}
++
++} // namespace media
diff --git a/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.h b/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.h
new file mode 100644
index 0000000000..c737a6a664
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_audio__manager__sndio.h
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/audio_manager_sndio.h.orig 2025-05-24 17:57:53.535847560 +0000
++++ media/audio/sndio/audio_manager_sndio.h
+@@ -0,0 +1,66 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++#define MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
++
++#include <set>
++
++#include "base/compiler_specific.h"
++#include "base/memory/ref_counted.h"
++#include "base/threading/thread.h"
++#include "media/audio/audio_manager_base.h"
++
++namespace media {
++
++class MEDIA_EXPORT AudioManagerSndio : public AudioManagerBase {
++ public:
++ AudioManagerSndio(std::unique_ptr<AudioThread> audio_thread,
++ AudioLogFactory* audio_log_factory);
++
++ AudioManagerSndio(const AudioManagerSndio&) = delete;
++ AudioManagerSndio& operator=(const AudioManagerSndio&) = delete;
++
++ ~AudioManagerSndio() override;
++
++ // Implementation of AudioManager.
++ bool HasAudioOutputDevices() override;
++ bool HasAudioInputDevices() override;
++ void GetAudioInputDeviceNames(AudioDeviceNames* device_names) override;
++ void GetAudioOutputDeviceNames(AudioDeviceNames* device_names) override;
++ AudioParameters GetInputStreamParameters(
++ const std::string& device_id) override;
++ const char* GetName() override;
++
++ // Implementation of AudioManagerBase.
++ AudioOutputStream* MakeLinearOutputStream(
++ const AudioParameters& params,
++ const LogCallback& log_callback) override;
++ AudioOutputStream* MakeLowLatencyOutputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++ AudioInputStream* MakeLinearInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++ AudioInputStream* MakeLowLatencyInputStream(
++ const AudioParameters& params,
++ const std::string& device_id,
++ const LogCallback& log_callback) override;
++
++ protected:
++ AudioParameters GetPreferredOutputStreamParameters(
++ const std::string& output_device_id,
++ const AudioParameters& input_params) override;
++
++ private:
++ // Called by MakeLinearOutputStream and MakeLowLatencyOutputStream.
++ AudioOutputStream* MakeOutputStream(const AudioParameters& params);
++ AudioInputStream* MakeInputStream(const AudioParameters& params);
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_AUDIO_MANAGER_SNDIO_H_
diff --git a/electron34/patches/patch-media_audio_sndio_sndio__input.cc b/electron34/patches/patch-media_audio_sndio_sndio__input.cc
new file mode 100644
index 0000000000..457e80e15b
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_sndio__input.cc
@@ -0,0 +1,209 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/sndio_input.cc.orig 2025-05-24 17:57:53.535978672 +0000
++++ media/audio/sndio/sndio_input.cc
+@@ -0,0 +1,200 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/audio_manager_sndio.h"
++#include "media/audio/audio_manager.h"
++#include "media/audio/sndio/sndio_input.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioInputStream::OnMoveCallback(void *arg, int delta)
++{
++ SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++ self->hw_delay += delta;
++}
++
++void *SndioAudioInputStream::ThreadEntry(void *arg) {
++ SndioAudioInputStream* self = static_cast<SndioAudioInputStream*>(arg);
++
++ self->ThreadLoop();
++ return NULL;
++}
++
++SndioAudioInputStream::SndioAudioInputStream(AudioManagerBase* manager,
++ const std::string& device_name,
++ const AudioParameters& params)
++ : manager(manager),
++ params(params),
++ audio_bus(AudioBus::Create(params)),
++ state(kClosed) {
++}
++
++SndioAudioInputStream::~SndioAudioInputStream() {
++ if (state != kClosed)
++ Close();
++}
++
++AudioInputStream::OpenOutcome SndioAudioInputStream::Open() {
++ struct sio_par par;
++ int sig;
++
++ if (state != kClosed)
++ return OpenOutcome::kFailed;
++
++ if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++ params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++ LOG(WARNING) << "Unsupported audio format.";
++ return OpenOutcome::kFailed;
++ }
++
++ sio_initpar(&par);
++ par.rate = params.sample_rate();
++ par.rchan = params.channels();
++ par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++ par.bps = par.bits / 8;
++ par.sig = sig = par.bits != 8 ? 1 : 0;
++ par.le = SIO_LE_NATIVE;
++ par.appbufsz = params.frames_per_buffer();
++
++ hdl = sio_open(SIO_DEVANY, SIO_REC, 0);
++
++ if (hdl == NULL) {
++ LOG(ERROR) << "Couldn't open audio device.";
++ return OpenOutcome::kFailed;
++ }
++
++ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++ LOG(ERROR) << "Couldn't set audio parameters.";
++ goto bad_close;
++ }
++
++ if (par.rate != (unsigned int)params.sample_rate() ||
++ par.rchan != (unsigned int)params.channels() ||
++ par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++ par.sig != (unsigned int)sig ||
++ (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++ (par.bits != par.bps * 8)) {
++ LOG(ERROR) << "Unsupported audio parameters.";
++ goto bad_close;
++ }
++ state = kStopped;
++ buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++ sio_onmove(hdl, &OnMoveCallback, this);
++ return OpenOutcome::kSuccess;
++bad_close:
++ sio_close(hdl);
++ return OpenOutcome::kFailed;
++}
++
++void SndioAudioInputStream::Start(AudioInputCallback* cb) {
++
++ StartAgc();
++
++ state = kRunning;
++ hw_delay = 0;
++ callback = cb;
++ sio_start(hdl);
++ if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++ LOG(ERROR) << "Failed to create real-time thread for recording.";
++ sio_stop(hdl);
++ state = kStopped;
++ }
++}
++
++void SndioAudioInputStream::Stop() {
++
++ if (state == kStopped)
++ return;
++
++ state = kStopWait;
++ pthread_join(thread, NULL);
++ sio_stop(hdl);
++ state = kStopped;
++
++ StopAgc();
++}
++
++void SndioAudioInputStream::Close() {
++
++ if (state == kClosed)
++ goto release;
++
++ if (state == kRunning)
++ Stop();
++
++ state = kClosed;
++ delete [] buffer;
++ sio_close(hdl);
++
++release:
++ manager->ReleaseInputStream(this);
++}
++
++double SndioAudioInputStream::GetMaxVolume() {
++ // Not supported
++ return 0.0;
++}
++
++void SndioAudioInputStream::SetVolume(double volume) {
++ // Not supported. Do nothing.
++}
++
++double SndioAudioInputStream::GetVolume() {
++ // Not supported.
++ return 0.0;
++}
++
++bool SndioAudioInputStream::IsMuted() {
++ // Not supported.
++ return false;
++}
++
++void SndioAudioInputStream::SetOutputDeviceForAec(
++ const std::string& output_device_id) {
++ // Not supported.
++}
++
++void SndioAudioInputStream::ThreadLoop(void) {
++ size_t todo, n;
++ char *data;
++ unsigned int nframes;
++ double normalized_volume = 0.0;
++
++ nframes = audio_bus->frames();
++
++ while (state == kRunning && !sio_eof(hdl)) {
++
++ GetAgcVolume(&normalized_volume);
++
++ // read one block
++ todo = nframes * params.GetBytesPerFrame(kSampleFormat);
++ data = buffer;
++ while (todo > 0) {
++ n = sio_read(hdl, data, todo);
++ if (n == 0)
++ return; // unrecoverable I/O error
++ todo -= n;
++ data += n;
++ }
++ hw_delay -= nframes;
++
++ // convert frames count to TimeDelta
++ const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++ params.sample_rate());
++
++ // push into bus
++ audio_bus->FromInterleaved<SignedInt16SampleTypeTraits>(reinterpret_cast<int16_t*>(buffer), nframes);
++
++
++ // invoke callback
++ callback->OnData(audio_bus.get(), base::TimeTicks::Now() - delay, 1., {});
++ }
++}
++
++} // namespace media
diff --git a/electron34/patches/patch-media_audio_sndio_sndio__input.h b/electron34/patches/patch-media_audio_sndio_sndio__input.h
new file mode 100644
index 0000000000..d9afcd9720
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_sndio__input.h
@@ -0,0 +1,100 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/sndio_input.h.orig 2025-05-24 17:57:53.536116237 +0000
++++ media/audio/sndio/sndio_input.h
+@@ -0,0 +1,91 @@
++// Copyright 2013 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
++
++#include <stdint.h>
++#include <string>
++#include <sndio.h>
++
++#include "base/compiler_specific.h"
++#include "base/memory/weak_ptr.h"
++#include "base/time/time.h"
++#include "media/audio/agc_audio_stream.h"
++#include "media/audio/audio_io.h"
++#include "media/audio/audio_device_description.h"
++#include "media/base/audio_parameters.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioInputStream : public AgcAudioStream<AudioInputStream> {
++ public:
++ // Pass this to the constructor if you want to attempt auto-selection
++ // of the audio recording device.
++ static const char kAutoSelectDevice[];
++
++ // Create a PCM Output stream for the SNDIO device identified by
++ // |device_name|. If unsure of what to use for |device_name|, use
++ // |kAutoSelectDevice|.
++ SndioAudioInputStream(AudioManagerBase* audio_manager,
++ const std::string& device_name,
++ const AudioParameters& params);
++
++ SndioAudioInputStream(const SndioAudioInputStream&) = delete;
++ SndioAudioInputStream& operator=(const SndioAudioInputStream&) = delete;
++
++ ~SndioAudioInputStream() override;
++
++ // Implementation of AudioInputStream.
++ OpenOutcome Open() override;
++ void Start(AudioInputCallback* callback) override;
++ void Stop() override;
++ void Close() override;
++ double GetMaxVolume() override;
++ void SetVolume(double volume) override;
++ double GetVolume() override;
++ bool IsMuted() override;
++ void SetOutputDeviceForAec(const std::string& output_device_id) override;
++
++ private:
++
++ enum StreamState {
++ kClosed, // Not opened yet
++ kStopped, // Device opened, but not started yet
++ kRunning, // Started, device playing
++ kStopWait // Stopping, waiting for the real-time thread to exit
++ };
++
++ // C-style call-backs
++ static void OnMoveCallback(void *arg, int delta);
++ static void* ThreadEntry(void *arg);
++
++ // Continuously moves data from the device to the consumer
++ void ThreadLoop();
++ // Our creator, the audio manager needs to be notified when we close.
++ AudioManagerBase* manager;
++ // Parameters of the source
++ AudioParameters params;
++ // We store data here for consumer
++ std::unique_ptr<AudioBus> audio_bus;
++ // Call-back that consumes recorded data
++ AudioInputCallback* callback; // Valid during a recording session.
++ // Handle of the audio device
++ struct sio_hdl* hdl;
++ // Current state of the stream
++ enum StreamState state;
++ // High priority thread running ThreadLoop()
++ pthread_t thread;
++ // Number of frames buffered in the hardware
++ int hw_delay;
++ // Temporary buffer where data is stored sndio-compatible format
++ char* buffer;
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_SNDIO_INPUT_H_
diff --git a/electron34/patches/patch-media_audio_sndio_sndio__output.cc b/electron34/patches/patch-media_audio_sndio_sndio__output.cc
new file mode 100644
index 0000000000..1d01b95d15
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_sndio__output.cc
@@ -0,0 +1,196 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/sndio_output.cc.orig 2025-05-24 17:57:53.536246969 +0000
++++ media/audio/sndio/sndio_output.cc
+@@ -0,0 +1,187 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "base/logging.h"
++#include "base/time/time.h"
++#include "base/time/default_tick_clock.h"
++#include "media/audio/audio_manager_base.h"
++#include "media/base/audio_timestamp_helper.h"
++#include "media/audio/sndio/sndio_output.h"
++
++namespace media {
++
++static const SampleFormat kSampleFormat = kSampleFormatS16;
++
++void SndioAudioOutputStream::OnMoveCallback(void *arg, int delta) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->hw_delay -= delta;
++}
++
++void SndioAudioOutputStream::OnVolCallback(void *arg, unsigned int vol) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->vol = vol;
++}
++
++void *SndioAudioOutputStream::ThreadEntry(void *arg) {
++ SndioAudioOutputStream* self = static_cast<SndioAudioOutputStream*>(arg);
++
++ self->ThreadLoop();
++ return NULL;
++}
++
++SndioAudioOutputStream::SndioAudioOutputStream(const AudioParameters& params,
++ AudioManagerBase* manager)
++ : manager(manager),
++ params(params),
++ audio_bus(AudioBus::Create(params)),
++ state(kClosed),
++ mutex(PTHREAD_MUTEX_INITIALIZER) {
++}
++
++SndioAudioOutputStream::~SndioAudioOutputStream() {
++ if (state != kClosed)
++ Close();
++}
++
++bool SndioAudioOutputStream::Open() {
++ if (params.format() != AudioParameters::AUDIO_PCM_LINEAR &&
++ params.format() != AudioParameters::AUDIO_PCM_LOW_LATENCY) {
++ LOG(WARNING) << "Unsupported audio format.";
++ return false;
++ }
++ state = kStopped;
++ volpending = 0;
++ vol = SIO_MAXVOL;
++ buffer = new char[audio_bus->frames() * params.GetBytesPerFrame(kSampleFormat)];
++ return true;
++}
++
++void SndioAudioOutputStream::Close() {
++ if (state == kClosed)
++ goto release;
++ if (state == kRunning)
++ Stop();
++ state = kClosed;
++ delete [] buffer;
++release:
++ manager->ReleaseOutputStream(this); // Calls the destructor
++}
++
++void SndioAudioOutputStream::Start(AudioSourceCallback* callback) {
++ struct sio_par par;
++ int sig;
++
++ sio_initpar(&par);
++ par.rate = params.sample_rate();
++ par.pchan = params.channels();
++ par.bits = SampleFormatToBitsPerChannel(kSampleFormat);
++ par.bps = par.bits / 8;
++ par.sig = sig = par.bits != 8 ? 1 : 0;
++ par.le = SIO_LE_NATIVE;
++ par.appbufsz = params.frames_per_buffer();
++
++ hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0);
++ if (hdl == NULL) {
++ LOG(ERROR) << "Couldn't open audio device.";
++ return;
++ }
++ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par)) {
++ LOG(ERROR) << "Couldn't set audio parameters.";
++ sio_close(hdl);
++ return;
++ }
++ if (par.rate != (unsigned int)params.sample_rate() ||
++ par.pchan != (unsigned int)params.channels() ||
++ par.bits != (unsigned int)SampleFormatToBitsPerChannel(kSampleFormat) ||
++ par.sig != (unsigned int)sig ||
++ (par.bps > 1 && par.le != SIO_LE_NATIVE) ||
++ (par.bits != par.bps * 8)) {
++ LOG(ERROR) << "Unsupported audio parameters.";
++ sio_close(hdl);
++ return;
++ }
++
++ sio_onmove(hdl, &OnMoveCallback, this);
++ sio_onvol(hdl, &OnVolCallback, this);
++
++ state = kRunning;
++ hw_delay = 0;
++ source = callback;
++ sio_start(hdl);
++
++ if (pthread_create(&thread, NULL, &ThreadEntry, this) != 0) {
++ LOG(ERROR) << "Failed to create real-time thread.";
++ sio_stop(hdl);
++ sio_close(hdl);
++ state = kStopped;
++ }
++}
++
++void SndioAudioOutputStream::Stop() {
++ if (state == kStopped)
++ return;
++ state = kStopWait;
++ pthread_join(thread, NULL);
++ sio_stop(hdl);
++ sio_close(hdl);
++ state = kStopped;
++}
++
++void SndioAudioOutputStream::SetVolume(double v) {
++ pthread_mutex_lock(&mutex);
++ vol = v * SIO_MAXVOL;
++ volpending = 1;
++ pthread_mutex_unlock(&mutex);
++}
++
++void SndioAudioOutputStream::GetVolume(double* v) {
++ pthread_mutex_lock(&mutex);
++ *v = vol * (1. / SIO_MAXVOL);
++ pthread_mutex_unlock(&mutex);
++}
++
++// This stream is always used with sub second buffer sizes, where it's
++// sufficient to simply always flush upon Start().
++void SndioAudioOutputStream::Flush() {}
++
++void SndioAudioOutputStream::ThreadLoop(void) {
++ int avail, count, result;
++
++ while (state == kRunning) {
++ // Update volume if needed
++ pthread_mutex_lock(&mutex);
++ if (volpending) {
++ volpending = 0;
++ sio_setvol(hdl, vol);
++ }
++ pthread_mutex_unlock(&mutex);
++
++ // Get data to play
++ const base::TimeDelta delay = AudioTimestampHelper::FramesToTime(hw_delay,
++ params.sample_rate());
++ count = source->OnMoreData(delay, base::TimeTicks::Now(), {}, audio_bus.get());
++ audio_bus->ToInterleaved<SignedInt16SampleTypeTraits>(count, reinterpret_cast<int16_t*>(buffer));
++ if (count == 0) {
++ // We have to submit something to the device
++ count = audio_bus->frames();
++ memset(buffer, 0, count * params.GetBytesPerFrame(kSampleFormat));
++ LOG(WARNING) << "No data to play, running empty cycle.";
++ }
++
++ // Submit data to the device
++ avail = count * params.GetBytesPerFrame(kSampleFormat);
++ result = sio_write(hdl, buffer, avail);
++ if (result == 0) {
++ LOG(WARNING) << "Audio device disconnected.";
++ break;
++ }
++
++ // Update hardware pointer
++ hw_delay += count;
++ }
++}
++
++} // namespace media
diff --git a/electron34/patches/patch-media_audio_sndio_sndio__output.h b/electron34/patches/patch-media_audio_sndio_sndio__output.h
new file mode 100644
index 0000000000..5d16449b76
--- /dev/null
+++ b/electron34/patches/patch-media_audio_sndio_sndio__output.h
@@ -0,0 +1,97 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/audio/sndio/sndio_output.h.orig 2025-05-24 17:57:53.536385737 +0000
++++ media/audio/sndio/sndio_output.h
+@@ -0,0 +1,88 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++#define MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
++
++#include <pthread.h>
++#include <sndio.h>
++
++#include "base/time/tick_clock.h"
++#include "base/time/time.h"
++#include "media/audio/audio_io.h"
++
++namespace media {
++
++class AudioManagerBase;
++
++// Implementation of AudioOutputStream using sndio(7)
++class SndioAudioOutputStream : public AudioOutputStream {
++ public:
++ // The manager is creating this object
++ SndioAudioOutputStream(const AudioParameters& params,
++ AudioManagerBase* manager);
++
++ SndioAudioOutputStream(const SndioAudioOutputStream&) = delete;
++ SndioAudioOutputStream& operator=(const SndioAudioOutputStream&) = delete;
++
++ virtual ~SndioAudioOutputStream();
++
++ // Implementation of AudioOutputStream.
++ bool Open() override;
++ void Close() override;
++ void Start(AudioSourceCallback* callback) override;
++ void Stop() override;
++ void SetVolume(double volume) override;
++ void GetVolume(double* volume) override;
++ void Flush() override;
++
++ friend void sndio_onmove(void *arg, int delta);
++ friend void sndio_onvol(void *arg, unsigned int vol);
++ friend void *sndio_threadstart(void *arg);
++
++ private:
++ enum StreamState {
++ kClosed, // Not opened yet
++ kStopped, // Device opened, but not started yet
++ kRunning, // Started, device playing
++ kStopWait // Stopping, waiting for the real-time thread to exit
++ };
++
++ // C-style call-backs
++ static void OnMoveCallback(void *arg, int delta);
++ static void OnVolCallback(void *arg, unsigned int vol);
++ static void* ThreadEntry(void *arg);
++
++ // Continuously moves data from the producer to the device
++ void ThreadLoop(void);
++
++ // Our creator, the audio manager needs to be notified when we close.
++ AudioManagerBase* manager;
++ // Parameters of the source
++ AudioParameters params;
++ // Source stores data here
++ std::unique_ptr<AudioBus> audio_bus;
++ // Call-back that produces data to play
++ AudioSourceCallback* source;
++ // Handle of the audio device
++ struct sio_hdl* hdl;
++ // Current state of the stream
++ enum StreamState state;
++ // High priority thread running ThreadLoop()
++ pthread_t thread;
++ // Protects vol, volpending and hw_delay
++ pthread_mutex_t mutex;
++ // Current volume in the 0..SIO_MAXVOL range
++ int vol;
++ // Set to 1 if volumes must be refreshed in the realtime thread
++ int volpending;
++ // Number of frames buffered in the hardware
++ int hw_delay;
++ // Temporary buffer where data is stored sndio-compatible format
++ char* buffer;
++};
++
++} // namespace media
++
++#endif // MEDIA_AUDIO_SNDIO_SNDIO_OUTPUT_H_
diff --git a/electron34/patches/patch-media_base_audio__latency.cc b/electron34/patches/patch-media_base_audio__latency.cc
new file mode 100644
index 0000000000..544cad23d6
--- /dev/null
+++ b/electron34/patches/patch-media_base_audio__latency.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/audio_latency.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/audio_latency.cc
+@@ -148,7 +148,7 @@ int AudioLatency::GetRtcBufferSize(int s
+ }
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // On Linux, MacOS and Fuchsia, the low level IO implementations on the
+ // browser side supports all buffer size the clients want. We use the native
+ // peer connection buffer size (10ms) to achieve best possible performance.
diff --git a/electron34/patches/patch-media_base_libaom__thread__wrapper.cc b/electron34/patches/patch-media_base_libaom__thread__wrapper.cc
new file mode 100644
index 0000000000..364eb700c6
--- /dev/null
+++ b/electron34/patches/patch-media_base_libaom__thread__wrapper.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/libaom_thread_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/libaom_thread_wrapper.cc
+@@ -5,17 +5,21 @@
+ #include "base/logging.h"
+ #include "media/base/codec_worker_impl.h"
+ #include "media/base/libvpx_thread_wrapper.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "third_party/libaom/source/libaom/aom_util/aom_thread.h"
++#endif
+
+ namespace media {
+
+ void InitLibAomThreadWrapper() {
++#if !BUILDFLAG(IS_BSD)
+ const AVxWorkerInterface interface =
+ CodecWorkerImpl<AVxWorkerInterface, AVxWorkerImpl, AVxWorker,
+ AVxWorkerStatus, AVX_WORKER_STATUS_NOT_OK,
+ AVX_WORKER_STATUS_OK,
+ AVX_WORKER_STATUS_WORKING>::GetCodecWorkerInterface();
+ CHECK(aom_set_worker_interface(&interface));
++#endif
+ }
+
+ } // namespace media
diff --git a/electron34/patches/patch-media_base_libvpx__thread__wrapper.cc b/electron34/patches/patch-media_base_libvpx__thread__wrapper.cc
new file mode 100644
index 0000000000..7a8ccef358
--- /dev/null
+++ b/electron34/patches/patch-media_base_libvpx__thread__wrapper.cc
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/libvpx_thread_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/libvpx_thread_wrapper.cc
+@@ -5,11 +5,14 @@
+ #include "media/base/libvpx_thread_wrapper.h"
+
+ #include "media/base/codec_worker_impl.h"
++#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_NETBSD)
+ #include "third_party/libvpx/source/libvpx/vpx_util/vpx_thread.h"
++#endif
+
+ namespace media {
+
+ void InitLibVpxThreadWrapper() {
++#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_NETBSD)
+ const VPxWorkerInterface interface =
+ CodecWorkerImpl<VPxWorkerInterface, VPxWorkerImpl, VPxWorker,
+ VPxWorkerStatus, VPX_WORKER_STATUS_NOT_OK,
+@@ -17,6 +20,7 @@ void InitLibVpxThreadWrapper() {
+ VPX_WORKER_STATUS_WORKING>::GetCodecWorkerInterface();
+
+ CHECK(vpx_set_worker_interface(&interface));
++#endif
+ }
+
+ } // namespace media
diff --git a/electron34/patches/patch-media_base_media__switches.cc b/electron34/patches/patch-media_base_media__switches.cc
new file mode 100644
index 0000000000..73750d4d39
--- /dev/null
+++ b/electron34/patches/patch-media_base_media__switches.cc
@@ -0,0 +1,132 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/media_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/media_switches.cc
+@@ -20,7 +20,7 @@
+ #include "ui/gl/gl_features.h"
+ #include "ui/gl/gl_utils.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/cpu.h"
+ #endif
+
+@@ -60,7 +60,7 @@ const char kReportVp9AsAnUnsupportedMime
+ "report-vp9-as-an-unsupported-mime-type";
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+- BUILDFLAG(IS_SOLARIS)
++ BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_NETBSD)
+ // The Alsa device to use when opening an audio input stream.
+ const char kAlsaInputDevice[] = "alsa-input-device";
+ // The Alsa device to use when opening an audio stream.
+@@ -371,8 +371,8 @@ BASE_FEATURE(kUseSCContentSharingPicker,
+ "UseSCContentSharingPicker",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_MAC)
+-
+-#if BUILDFLAG(IS_LINUX)
++
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enables system audio mirroring using pulseaudio.
+ BASE_FEATURE(kPulseaudioLoopbackForCast,
+ "PulseaudioLoopbackForCast",
+@@ -382,6 +382,31 @@ BASE_FEATURE(kPulseaudioLoopbackForCast,
+ BASE_FEATURE(kPulseaudioLoopbackForScreenShare,
+ "PulseaudioLoopbackForScreenShare",
+ base::FEATURE_DISABLED_BY_DEFAULT);
++
++BASE_FEATURE(kAudioBackend,
++ "AudioBackend",
++ base::FEATURE_ENABLED_BY_DEFAULT);
++
++constexpr base::FeatureParam<AudioBackend>::Option
++ kAudioBackendOptions[] = {
++ {AudioBackend::kAuto,
++ "auto"},
++ {AudioBackend::kAudioIO, "audioio"},
++ {AudioBackend::kPulseAudio, "pulseaudio"},
++ {AudioBackend::kSndio, "sndio"},
++ {AudioBackend::kAlsa, "alsa"}};
++
++const base::FeatureParam<AudioBackend>
++ kAudioBackendParam{
++ &kAudioBackend, "audio-backend",
++#if BUILDFLAG(IS_OPENBSD)
++ AudioBackend::kSndio,
++#elif BUILDFLAG(IS_NETBSD)
++ AudioBackend::kAudioIO,
++#elif BUILDFLAG(IS_FREEBSD)
++ AudioBackend::kAuto,
++#endif
++ &kAudioBackendOptions};
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // When enabled, MediaCapabilities will check with GPU Video Accelerator
+@@ -627,7 +652,7 @@ BASE_FEATURE(kFileDialogsBlockPictureInP
+ // Show toolbar button that opens dialog for controlling media sessions.
+ BASE_FEATURE(kGlobalMediaControls,
+ "GlobalMediaControls",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -650,7 +675,7 @@ BASE_FEATURE(kGlobalMediaControlsUpdated
+ // If enabled, users can request Media Remoting without fullscreen-in-tab.
+ BASE_FEATURE(kMediaRemotingWithoutFullscreen,
+ "MediaRemotingWithoutFullscreen",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -662,7 +687,7 @@ BASE_FEATURE(kMediaRemotingWithoutFullsc
+ BASE_FEATURE(kGlobalMediaControlsPictureInPicture,
+ "GlobalMediaControlsPictureInPicture",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -691,7 +716,7 @@ BASE_FEATURE(kUnifiedAutoplay,
+ "UnifiedAutoplay",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enable vaapi/v4l2 video decoding on linux. This is already enabled by default
+ // on chromeos, but needs an experiment on linux.
+ BASE_FEATURE(kAcceleratedVideoDecodeLinux,
+@@ -795,7 +820,7 @@ BASE_FEATURE(kVSyncMjpegDecoding,
+ "VSyncMjpegDecoding",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enable H264 temporal layer encoding with V4L2 HW encoder on ChromeOS.
+ BASE_FEATURE(kV4L2H264TemporalLayerHWEncoding,
+ "V4L2H264TemporalLayerHWEncoding",
+@@ -1395,7 +1420,7 @@ BASE_FEATURE(kUseGTFOOutOfProcessVideoDe
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Spawn utility processes to perform hardware encode acceleration instead of
+ // using the GPU process.
+ BASE_FEATURE(kUseOutOfProcessVideoEncoding,
+@@ -1475,7 +1500,7 @@ BASE_FEATURE(kRecordWebAudioEngagement,
+ "RecordWebAudioEngagement",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Reduces the number of buffers needed in the output video frame pool to
+ // populate the Renderer pipeline for hardware accelerated VideoDecoder in
+ // non-low latency scenarios.
diff --git a/electron34/patches/patch-media_base_media__switches.h b/electron34/patches/patch-media_base_media__switches.h
new file mode 100644
index 0000000000..8594626d33
--- /dev/null
+++ b/electron34/patches/patch-media_base_media__switches.h
@@ -0,0 +1,73 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/media_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/media_switches.h
+@@ -44,7 +44,7 @@ MEDIA_EXPORT extern const char kDisableB
+ MEDIA_EXPORT extern const char kReportVp9AsAnUnsupportedMimeType[];
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD) || \
+- BUILDFLAG(IS_SOLARIS)
++ BUILDFLAG(IS_SOLARIS) || BUILDFLAG(IS_NETBSD)
+ MEDIA_EXPORT extern const char kAlsaInputDevice[];
+ MEDIA_EXPORT extern const char kAlsaOutputDevice[];
+ #endif
+@@ -325,13 +325,26 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kMedia
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlaybackSpeedButton);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMediaEngagementData);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPreloadMetadataSuspend);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPulseaudioLoopbackForCast);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPulseaudioLoopbackForScreenShare);
++
++enum class AudioBackend {
++ kAuto,
++ kPulseAudio,
++ kSndio,
++ kAudioIO,
++ kAlsa
++};
++
++MEDIA_EXPORT BASE_DECLARE_FEATURE(kAudioBackend);
++MEDIA_EXPORT extern const base::FeatureParam<
++ AudioBackend>
++ kAudioBackendParam;
+ #endif // BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordMediaEngagementScores);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kRecordWebAudioEngagement);
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kReduceHardwareVideoDecoderBuffers);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kResumeBackgroundVideo);
+@@ -345,7 +358,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kSuspe
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUnifiedAutoplay);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAndroidOverlayForSecureOnly);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMediaStream);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kAcceleratedVideoDecodeLinux);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kAcceleratedVideoDecodeLinuxGL);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kAcceleratedVideoEncodeLinux);
+@@ -366,7 +379,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapi
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9SModeHWEncoding);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVSyncMjpegDecoding);
+ #endif // defined(ARCH_CPU_X86_FAMILY) && BUILDFLAG(IS_CHROMEOS)
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kV4L2H264TemporalLayerHWEncoding);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoBlitColorAccuracy);
+@@ -498,7 +511,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOu
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseGTFOOutOfProcessVideoDecoding);
+ #endif // BUILDFLAG(ALLOW_OOP_VIDEO_DECODER)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseOutOfProcessVideoEncoding);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/electron34/patches/patch-media_base_user__input__monitor__unittest.cc b/electron34/patches/patch-media_base_user__input__monitor__unittest.cc
new file mode 100644
index 0000000000..2121616b5d
--- /dev/null
+++ b/electron34/patches/patch-media_base_user__input__monitor__unittest.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/user_input_monitor_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/user_input_monitor_unittest.cc
+@@ -13,7 +13,7 @@
+ #include "build/build_config.h"
+ #include "testing/gtest/include/gtest/gtest.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_descriptor_watcher_posix.h"
+ #endif
+
+@@ -49,7 +49,7 @@ class UserInputMonitorTest : public test
+ } // namespace
+
+ TEST_F(UserInputMonitorTest, CreatePlatformSpecific) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::test::TaskEnvironment task_environment(
+ base::test::TaskEnvironment::MainThreadType::IO);
+ #else
+@@ -72,7 +72,7 @@ TEST_F(UserInputMonitorTest, CreatePlatf
+ }
+
+ TEST_F(UserInputMonitorTest, CreatePlatformSpecificWithMapping) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::test::TaskEnvironment task_environment(
+ base::test::TaskEnvironment::MainThreadType::IO);
+ #else
diff --git a/electron34/patches/patch-media_base_video__frame.cc b/electron34/patches/patch-media_base_video__frame.cc
new file mode 100644
index 0000000000..3a5b414da1
--- /dev/null
+++ b/electron34/patches/patch-media_base_video__frame.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/video_frame.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/video_frame.cc
+@@ -88,7 +88,7 @@ std::string VideoFrame::StorageTypeToStr
+ return "OWNED_MEMORY";
+ case VideoFrame::STORAGE_SHMEM:
+ return "SHMEM";
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case VideoFrame::STORAGE_DMABUFS:
+ return "DMABUFS";
+ #endif
+@@ -102,7 +102,7 @@ std::string VideoFrame::StorageTypeToStr
+ // static
+ bool VideoFrame::IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
+ return
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // This is not strictly needed but makes explicit that, at VideoFrame
+ // level, DmaBufs are not mappable from userspace.
+ storage_type != VideoFrame::STORAGE_DMABUFS &&
+@@ -414,7 +414,7 @@ VideoFrame::CreateFrameForGpuMemoryBuffe
+ : shared_image->GetStrideForVideoFrame(i);
+ }
+ uint64_t modifier = gfx::NativePixmapHandle::kNoModifier;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool is_native_buffer =
+ gpu_memory_buffer
+ ? (gpu_memory_buffer->GetType() != gfx::SHARED_MEMORY_BUFFER)
+@@ -755,7 +755,7 @@ scoped_refptr<VideoFrame> VideoFrame::Wr
+ return frame;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
+ const VideoFrameLayout& layout,
+@@ -1461,7 +1461,7 @@ scoped_refptr<gpu::ClientSharedImage> Vi
+ return wrapped_frame_ ? wrapped_frame_->shared_image() : shared_image_;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ size_t VideoFrame::NumDmabufFds() const {
+ if (wrapped_frame_) {
+ return wrapped_frame_->NumDmabufFds();
diff --git a/electron34/patches/patch-media_base_video__frame.h b/electron34/patches/patch-media_base_video__frame.h
new file mode 100644
index 0000000000..1413c52e05
--- /dev/null
+++ b/electron34/patches/patch-media_base_video__frame.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/base/video_frame.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/base/video_frame.h
+@@ -50,7 +50,7 @@
+ #include "base/apple/scoped_cftyperef.h"
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/scoped_file.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -94,7 +94,7 @@ class MEDIA_EXPORT VideoFrame : public b
+ STORAGE_UNOWNED_MEMORY = 2, // External, non owned data pointers.
+ STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer.
+ STORAGE_SHMEM = 4, // Backed by read-only shared memory.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // TODO(mcasas): Consider turning this type into STORAGE_NATIVE
+ // based on the idea of using this same enum value for both DMA
+ // buffers on Linux and CVPixelBuffers on Mac (which currently use
+@@ -369,7 +369,7 @@ class MEDIA_EXPORT VideoFrame : public b
+ ReleaseMailboxAndGpuMemoryBufferCB mailbox_holder_and_gmb_release_cb,
+ base::TimeDelta timestamp);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Wraps provided dmabufs
+ // (https://www.kernel.org/doc/html/latest/driver-api/dma-buf.html) with a
+ // VideoFrame. The frame will take ownership of |dmabuf_fds|, and will
+@@ -682,7 +682,7 @@ class MEDIA_EXPORT VideoFrame : public b
+ // wait for the included sync point.
+ scoped_refptr<gpu::ClientSharedImage> shared_image() const;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The number of DmaBufs will be equal or less than the number of planes of
+ // the frame. If there are less, this means that the last FD contains the
+ // remaining planes. Should be > 0 for STORAGE_DMABUFS.
+@@ -946,7 +946,7 @@ class MEDIA_EXPORT VideoFrame : public b
+ // GpuMemoryBuffers. Clients will set this flag while creating a VideoFrame.
+ bool is_mappable_si_enabled_ = false;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ // Dmabufs for the frame, used when storage is STORAGE_DMABUFS. Size is either
+ // equal or less than the number of planes of the frame. If it is less, then
diff --git a/electron34/patches/patch-media_capture_content_video__capture__oracle.cc b/electron34/patches/patch-media_capture_content_video__capture__oracle.cc
new file mode 100644
index 0000000000..57694282c0
--- /dev/null
+++ b/electron34/patches/patch-media_capture_content_video__capture__oracle.cc
@@ -0,0 +1,122 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/content/video_capture_oracle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/content/video_capture_oracle.cc
+@@ -118,8 +118,9 @@ void VideoCaptureOracle::SetCaptureSizeC
+ void VideoCaptureOracle::SetAutoThrottlingEnabled(bool enabled) {
+ const bool was_enabled =
+ (capture_size_throttling_mode_ != kThrottlingDisabled);
+- if (was_enabled == enabled)
++ if (was_enabled == enabled) {
+ return;
++ }
+ capture_size_throttling_mode_ =
+ enabled ? kThrottlingEnabled : kThrottlingDisabled;
+ VLOG(1) << "Capture size auto-throttling is now "
+@@ -127,19 +128,22 @@ void VideoCaptureOracle::SetAutoThrottli
+
+ // When not auto-throttling, have the CaptureResolutionChooser target the max
+ // resolution within constraints.
+- if (!enabled)
++ if (!enabled) {
+ resolution_chooser_.SetTargetFrameArea(std::numeric_limits<int>::max());
++ }
+
+- if (next_frame_number_ > 0)
++ if (next_frame_number_ > 0) {
+ CommitCaptureSizeAndReset(GetFrameTimestamp(next_frame_number_ - 1));
++ }
+ }
+
+ void VideoCaptureOracle::SetSourceSize(const gfx::Size& source_size) {
+ resolution_chooser_.SetSourceSize(source_size);
+ // If the |resolution_chooser_| computed a new capture size, that will become
+ // visible via a future call to ObserveEventAndDecideCapture().
+- source_size_change_time_ = (next_frame_number_ == 0) ?
+- base::TimeTicks() : GetFrameTimestamp(next_frame_number_ - 1);
++ source_size_change_time_ = (next_frame_number_ == 0)
++ ? base::TimeTicks()
++ : GetFrameTimestamp(next_frame_number_ - 1);
+ }
+
+ bool VideoCaptureOracle::ObserveEventAndDecideCapture(
+@@ -172,6 +176,15 @@ bool VideoCaptureOracle::ObserveEventAnd
+ if (should_sample) {
+ event_time = content_sampler_.frame_timestamp();
+ duration_of_next_frame_ = content_sampler_.sampling_period();
++ } else {
++ // https://crbug.com/391118566
++ // The content sampler may not sample the frame, if the
++ // `detected_region_` does not match the `damage_rect`. In this case,
++ // the capture may halt up to kNonAnimatingThreshold (250ms) and cause
++ // the video stutter, until it recovers and do another animation
++ // detection. To avoid this, we should use the smoothing sampler as a
++ // fallback to prevent the bad output.
++ should_sample = smoothing_sampler_.ShouldSample();
+ }
+ last_time_animation_was_detected_ = event_time;
+ } else {
+@@ -198,8 +211,9 @@ bool VideoCaptureOracle::ObserveEventAnd
+ NOTREACHED();
+ }
+
+- if (!should_sample)
++ if (!should_sample) {
+ return false;
++ }
+
+ // If the exact duration of the next frame has not been determined, estimate
+ // it using the difference between the current and last frame.
+@@ -373,16 +387,18 @@ void VideoCaptureOracle::RecordConsumerF
+
+ // resource_utilization feedback.
+
+- if (capture_size_throttling_mode_ == kThrottlingDisabled)
++ if (capture_size_throttling_mode_ == kThrottlingDisabled) {
+ return;
++ }
+
+ if (!std::isfinite(feedback.resource_utilization)) {
+ LOG(DFATAL) << "Non-finite utilization provided by consumer for frame #"
+ << frame_number << ": " << feedback.resource_utilization;
+ return;
+ }
+- if (feedback.resource_utilization <= 0.0)
++ if (feedback.resource_utilization <= 0.0) {
+ return; // Non-positive values are normal, meaning N/A.
++ }
+
+ if (capture_size_throttling_mode_ != kThrottlingActive) {
+ VLOG(1) << "Received consumer feedback at frame #" << frame_number
+@@ -553,12 +569,14 @@ int VideoCaptureOracle::AnalyzeForIncrea
+ const int current_area = capture_size_.GetArea();
+ const int increased_area =
+ resolution_chooser_.FindLargerFrameSize(current_area, 1).GetArea();
+- if (increased_area <= current_area)
++ if (increased_area <= current_area) {
+ return -1;
++ }
+
+ // Determine whether the buffer pool could handle an increase in area.
+- if (!HasSufficientRecentFeedback(buffer_pool_utilization_, analyze_time))
++ if (!HasSufficientRecentFeedback(buffer_pool_utilization_, analyze_time)) {
+ return -1;
++ }
+ if (buffer_pool_utilization_.current() > 0.0) {
+ const int buffer_capable_area = base::saturated_cast<int>(
+ current_area / buffer_pool_utilization_.current());
+@@ -593,8 +611,9 @@ int VideoCaptureOracle::AnalyzeForIncrea
+
+ // At this point, the system is currently under-utilized. Reset the start
+ // time if the system was not under-utilized when the last analysis was made.
+- if (start_time_of_underutilization_.is_null())
++ if (start_time_of_underutilization_.is_null()) {
+ start_time_of_underutilization_ = analyze_time;
++ }
+
+ // If the under-utilization started soon after the last source size change,
+ // permit an immediate increase in the capture area. This allows the system
diff --git a/electron34/patches/patch-media_capture_content_video__capture__oracle__unittest.cc b/electron34/patches/patch-media_capture_content_video__capture__oracle__unittest.cc
new file mode 100644
index 0000000000..e4c856d236
--- /dev/null
+++ b/electron34/patches/patch-media_capture_content_video__capture__oracle__unittest.cc
@@ -0,0 +1,111 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/content/video_capture_oracle_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/content/video_capture_oracle_unittest.cc
+@@ -158,21 +158,26 @@ TEST(VideoCaptureOracleTest, Transitions
+ const bool provide_animated_content_event =
+ (i % 100) >= 25 && (i % 100) < 75;
+
+- // Only the few events that trigger the lock-out transition should be
+- // dropped, because the AnimatedContentSampler doesn't yet realize the
+- // animation ended. Otherwise, the oracle should always decide to sample
+- // because one of its samplers says to.
+- const bool require_oracle_says_sample = (i % 100) < 75 || (i % 100) >= 78;
++ // https://crbug.com/391118566
++ // Previously the AnimatedContentSampler has a bug that cause jank.
++ // The oracle should always use SmoothEventSampler as a fallback. If
++ // AnimatedContentSampler doesn't yet realize the animation ended or
++ // doesn't keep up with the prediction it make, and it will wait for
++ // kNonAnimatingThreshold before it lock-out and hand over to smooth
++ // handler. This will cause the video to stutter and it is unacceptable.
++ // So, when the AnimatedContentSampler goes into wrong state, we now
++ // use SmoothEventSampler's decision as a fallback to prevent jank output
++ // and still has a overall limit on capture frequency.
+ const bool oracle_says_sample = oracle.ObserveEventAndDecideCapture(
+ VideoCaptureOracle::kCompositorUpdate,
+ provide_animated_content_event ? animation_damage_rect : gfx::Rect(),
+ t);
+- if (require_oracle_says_sample)
+- ASSERT_TRUE(oracle_says_sample);
+- if (!oracle_says_sample) {
+- ASSERT_EQ(base::TimeDelta(), oracle.estimated_frame_duration());
+- continue;
+- }
++
++ // Because we now use SmoothEventSampler as a fallback, oracle should
++ // always say sample. The previous AnimatedContentSampler lock-out
++ // dropped frame are now revived by SmoothEventSampler, since this test's
++ // capture frequency always meets min capture limit requirement.
++ ASSERT_TRUE(oracle_says_sample);
+ ASSERT_LT(base::TimeDelta(), oracle.estimated_frame_duration());
+
+ const int frame_number = oracle.next_frame_number();
+@@ -184,12 +189,9 @@ TEST(VideoCaptureOracleTest, Transitions
+ if (!last_frame_timestamp.is_null()) {
+ const base::TimeDelta delta = frame_timestamp - last_frame_timestamp;
+ EXPECT_LE(event_increment.InMicroseconds(), delta.InMicroseconds());
+- // Right after the AnimatedContentSampler lock-out transition, there were
+- // a few frames dropped, so allow a gap in the timestamps. Otherwise, the
+- // delta between frame timestamps should never be more than 2X the
++ // The delta between frame timestamps should never be more than 2X the
+ // |event_increment|.
+- const base::TimeDelta max_acceptable_delta =
+- (i % 100) == 78 ? event_increment * 5 : event_increment * 2;
++ const base::TimeDelta max_acceptable_delta = event_increment * 2;
+ EXPECT_GE(max_acceptable_delta.InMicroseconds(), delta.InMicroseconds());
+ }
+ last_frame_timestamp = frame_timestamp;
+@@ -444,9 +446,9 @@ void RunAutoThrottleTest(bool is_content
+ // expect the resolution to remain constant. Repeat.
+ for (int i = 0; i < 2; ++i) {
+ const gfx::Size starting_size = oracle.capture_size();
+- SCOPED_TRACE(::testing::Message() << "Stepping down from "
+- << starting_size.ToString()
+- << ", i=" << i);
++ SCOPED_TRACE(::testing::Message()
++ << "Stepping down from " << starting_size.ToString()
++ << ", i=" << i);
+
+ gfx::Size stepped_down_size;
+ end_t = t + base::Seconds(10);
+@@ -471,9 +473,10 @@ void RunAutoThrottleTest(bool is_content
+ oracle.RecordCapture(with_consumer_feedback ? 0.25 : utilization);
+ base::TimeTicks ignored;
+ ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
+- if (with_consumer_feedback)
++ if (with_consumer_feedback) {
+ oracle.RecordConsumerFeedback(frame_number,
+ media::VideoCaptureFeedback(utilization));
++ }
+ }
+ }
+
+@@ -482,9 +485,9 @@ void RunAutoThrottleTest(bool is_content
+ // utilization and expect the resolution to remain constant. Repeat.
+ for (int i = 0; i < 2; ++i) {
+ const gfx::Size starting_size = oracle.capture_size();
+- SCOPED_TRACE(::testing::Message() << "Stepping up from "
+- << starting_size.ToString()
+- << ", i=" << i);
++ SCOPED_TRACE(::testing::Message()
++ << "Stepping up from " << starting_size.ToString()
++ << ", i=" << i);
+
+ gfx::Size stepped_up_size;
+ end_t = t + base::Seconds(is_content_animating ? 90 : 10);
+@@ -513,9 +516,10 @@ void RunAutoThrottleTest(bool is_content
+ oracle.RecordCapture(with_consumer_feedback ? 0.25 : utilization);
+ base::TimeTicks ignored;
+ ASSERT_TRUE(oracle.CompleteCapture(frame_number, true, &ignored));
+- if (with_consumer_feedback)
++ if (with_consumer_feedback) {
+ oracle.RecordConsumerFeedback(frame_number,
+ media::VideoCaptureFeedback(utilization));
++ }
+ }
+ }
+ }
diff --git a/electron34/patches/patch-media_capture_video__capture__types.h b/electron34/patches/patch-media_capture_video__capture__types.h
new file mode 100644
index 0000000000..876a4a22f6
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video__capture__types.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video_capture_types.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video_capture_types.h
+@@ -355,6 +355,8 @@ struct CAPTURE_EXPORT VideoCaptureParams
+ // Flag indicating whether HiDPI mode should be enabled for tab capture
+ // sessions.
+ bool is_high_dpi_enabled = true;
++
++ std::optional<bool> use_native_picker;
+ };
+
+ CAPTURE_EXPORT std::ostream& operator<<(
diff --git a/electron34/patches/patch-media_capture_video_create__video__capture__device__factory.cc b/electron34/patches/patch-media_capture_video_create__video__capture__device__factory.cc
new file mode 100644
index 0000000000..071bd27d94
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_create__video__capture__device__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/create_video_capture_device_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/create_video_capture_device_factory.cc
+@@ -13,7 +13,7 @@
+ #include "media/capture/video/fake_video_capture_device_factory.h"
+ #include "media/capture/video/file_video_capture_device_factory.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "media/capture/video/linux/video_capture_device_factory_linux.h"
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "media/capture/video/chromeos/public/cros_features.h"
+@@ -56,7 +56,7 @@ CreateFakeVideoCaptureDeviceFactory() {
+ std::unique_ptr<VideoCaptureDeviceFactory>
+ CreatePlatformSpecificVideoCaptureDeviceFactory(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<VideoCaptureDeviceFactoryLinux>(ui_task_runner);
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ if (base::SysInfo::IsRunningOnChromeOS())
diff --git a/electron34/patches/patch-media_capture_video_fake__video__capture__device__factory.cc b/electron34/patches/patch-media_capture_video_fake__video__capture__device__factory.cc
new file mode 100644
index 0000000000..ef9f725701
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_fake__video__capture__device__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/fake_video_capture_device_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/fake_video_capture_device_factory.cc
+@@ -231,7 +231,7 @@ void FakeVideoCaptureDeviceFactory::GetD
+ int entry_index = 0;
+ for (const auto& entry : devices_config_) {
+ VideoCaptureApi api =
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE;
+ #elif BUILDFLAG(IS_IOS)
+ VideoCaptureApi::UNKNOWN;
diff --git a/electron34/patches/patch-media_capture_video_file__video__capture__device__factory.cc b/electron34/patches/patch-media_capture_video_file__video__capture__device__factory.cc
new file mode 100644
index 0000000000..ebe468a680
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_file__video__capture__device__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/file_video_capture_device_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/file_video_capture_device_factory.cc
+@@ -52,7 +52,7 @@ void FileVideoCaptureDeviceFactory::GetD
+ VideoCaptureApi::WIN_DIRECT_SHOW;
+ #elif BUILDFLAG(IS_MAC)
+ VideoCaptureApi::MACOSX_AVFOUNDATION;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ VideoCaptureApi::LINUX_V4L2_SINGLE_PLANE;
+ #else
+ VideoCaptureApi::UNKNOWN;
diff --git a/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc b/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc
new file mode 100644
index 0000000000..097b08a53f
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/fake_v4l2_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/fake_v4l2_impl.cc
+@@ -562,7 +562,7 @@ int FakeV4L2Impl::close(int fd) {
+ return kSuccessReturnValue;
+ }
+
+-int FakeV4L2Impl::ioctl(int fd, int request, void* argp) {
++int FakeV4L2Impl::ioctl(int fd, unsigned long request, void* argp) {
+ base::AutoLock lock(lock_);
+ auto device_iter = opened_devices_.find(fd);
+ if (device_iter == opened_devices_.end())
diff --git a/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.h b/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.h
new file mode 100644
index 0000000000..fb09a998aa
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_fake__v4l2__impl.h
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/fake_v4l2_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/fake_v4l2_impl.h
+@@ -8,7 +8,13 @@
+ #include <map>
+ #include <string>
+
++#include "build/build_config.h"
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++#include <sys/videoio.h>
++typedef __uint32_t __u32;
++#else
+ #include <linux/videodev2.h>
++#endif
+
+ #include "base/synchronization/lock.h"
+ #include "media/capture/capture_export.h"
+@@ -38,7 +44,7 @@ class CAPTURE_EXPORT FakeV4L2Impl : publ
+ // Implementation of V4L2CaptureDevice interface:
+ int open(const char* device_name, int flags) override;
+ int close(int fd) override;
+- int ioctl(int fd, int request, void* argp) override;
++ int ioctl(int fd, unsigned long request, void* argp) override;
+ void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc
new file mode 100644
index 0000000000..20beb8d561
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc
@@ -0,0 +1,183 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/v4l2_capture_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/v4l2_capture_delegate.cc
+@@ -5,8 +5,10 @@
+ #include "media/capture/video/linux/v4l2_capture_delegate.h"
+
+ #include <fcntl.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <linux/version.h>
+ #include <linux/videodev2.h>
++#endif
+ #include <poll.h>
+ #include <sys/ioctl.h>
+ #include <sys/mman.h>
+@@ -29,17 +31,19 @@
+ #include "media/capture/video/blob_utils.h"
+ #include "media/capture/video/linux/video_capture_device_linux.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "media/capture/capture_switches.h"
+ #include "media/capture/video/linux/v4l2_capture_delegate_gpu_helper.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+ using media::mojom::MeteringMode;
+
++#if !BUILDFLAG(IS_BSD)
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 6, 0)
+ // 16 bit depth, Realsense F200.
+ #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ')
+ #endif
++#endif
+
+ // TODO(aleksandar.stojiljkovic): Wrap this with kernel version check once the
+ // format is introduced to kernel.
+@@ -49,6 +53,14 @@ using media::mojom::MeteringMode;
+ #define V4L2_PIX_FMT_INVZ v4l2_fourcc('I', 'N', 'V', 'Z')
+ #endif
+
++#ifndef V4L2_COLORSPACE_OPRGB
++#define V4L2_COLORSPACE_OPRGB V4L2_COLORSPACE_ADOBERGB
++#endif
++
++#ifndef V4L2_XFER_FUNC_OPRGB
++#define V4L2_XFER_FUNC_OPRGB V4L2_XFER_FUNC_ADOBERGB
++#endif
++
+ namespace media {
+
+ namespace {
+@@ -268,7 +280,7 @@ bool V4L2CaptureDelegate::IsBlockedContr
+ // static
+ bool V4L2CaptureDelegate::IsControllableControl(
+ int control_id,
+- const base::RepeatingCallback<int(int, void*)>& do_ioctl) {
++ const base::RepeatingCallback<int(unsigned int, void*)>& do_ioctl) {
+ const int special_control_id = GetControllingSpecialControl(control_id);
+ if (!special_control_id) {
+ // The control is not controlled by a special control thus the control is
+@@ -324,7 +336,7 @@ V4L2CaptureDelegate::V4L2CaptureDelegate
+ is_capturing_(false),
+ timeout_count_(0),
+ rotation_(rotation) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ use_gpu_buffer_ = switches::IsVideoCaptureUseGpuMemoryBufferEnabled();
+ #endif // BUILDFLAG(IS_LINUX)
+ }
+@@ -451,7 +463,7 @@ void V4L2CaptureDelegate::AllocateAndSta
+
+ client_->OnStarted();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (use_gpu_buffer_) {
+ v4l2_gpu_helper_ = std::make_unique<V4L2CaptureDelegateGpuHelper>();
+ }
+@@ -795,7 +807,7 @@ base::WeakPtr<V4L2CaptureDelegate> V4L2C
+
+ V4L2CaptureDelegate::~V4L2CaptureDelegate() = default;
+
+-bool V4L2CaptureDelegate::RunIoctl(int request, void* argp) {
++bool V4L2CaptureDelegate::RunIoctl(unsigned int request, void* argp) {
+ int num_retries = 0;
+ for (; DoIoctl(request, argp) < 0 && num_retries < kMaxIOCtrlRetries;
+ ++num_retries) {
+@@ -805,7 +817,7 @@ bool V4L2CaptureDelegate::RunIoctl(int r
+ return num_retries != kMaxIOCtrlRetries;
+ }
+
+-int V4L2CaptureDelegate::DoIoctl(int request, void* argp) {
++int V4L2CaptureDelegate::DoIoctl(unsigned int request, void* argp) {
+ return HANDLE_EINTR(v4l2_->ioctl(device_fd_.get(), request, argp));
+ }
+
+@@ -816,6 +828,7 @@ bool V4L2CaptureDelegate::IsControllable
+ }
+
+ void V4L2CaptureDelegate::ReplaceControlEventSubscriptions() {
++#if !BUILDFLAG(IS_BSD)
+ constexpr uint32_t kControlIds[] = {V4L2_CID_AUTO_EXPOSURE_BIAS,
+ V4L2_CID_AUTO_WHITE_BALANCE,
+ V4L2_CID_BRIGHTNESS,
+@@ -843,6 +856,7 @@ void V4L2CaptureDelegate::ReplaceControl
+ << ", {type = V4L2_EVENT_CTRL, id = " << control_id << "}";
+ }
+ }
++#endif
+ }
+
+ mojom::RangePtr V4L2CaptureDelegate::RetrieveUserControlRange(int control_id) {
+@@ -1023,7 +1037,11 @@ void V4L2CaptureDelegate::DoCapture() {
+
+ pollfd device_pfd = {};
+ device_pfd.fd = device_fd_.get();
++#if !BUILDFLAG(IS_BSD)
+ device_pfd.events = POLLIN | POLLPRI;
++#else
++ device_pfd.events = POLLIN;
++#endif
+
+ const int result =
+ HANDLE_EINTR(v4l2_->poll(&device_pfd, 1, kCaptureTimeoutMs));
+@@ -1043,6 +1061,12 @@ void V4L2CaptureDelegate::DoCapture() {
+ // in older kernels, and stopping and starting the stream gets the camera
+ // out of this bad state. Upgrading the kernel is difficult so this is our
+ // way out for now.
++#if BUILDFLAG(IS_NETBSD)
++ // On NetBSD cause: StartStream@media/capture/video/linux/v4l2_capture_delegate.cc:1017,
++ // Error requesting MMAP buffers from V4L2, OS message: Device busy (16)
++ // so do nothing, just wait for timeout_count_ >= kContinuousTimeoutLimit
++ DLOG(WARNING) << "DoCapture: poll timeout";
++#else
+ DLOG(WARNING) << "Restarting camera stream";
+ if (!StopStream() || !StartStream())
+ return;
+@@ -1050,6 +1074,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ FROM_HERE,
+ base::BindOnce(&V4L2CaptureDelegate::DoCapture, GetWeakPtr()));
+ return;
++#endif
+ } else if (timeout_count_ >= kContinuousTimeoutLimit) {
+ SetErrorState(
+ VideoCaptureError::kV4L2MultipleContinuousTimeoutsWhileReadPolling,
+@@ -1061,6 +1086,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ timeout_count_ = 0;
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ // Dequeue events if the driver has filled in some.
+ if (device_pfd.revents & POLLPRI) {
+ bool controls_changed = false;
+@@ -1094,6 +1120,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ client_->OnCaptureConfigurationChanged();
+ }
+ }
++#endif
+
+ // Deenqueue, send and reenqueue a buffer if the driver has filled one in.
+ if (device_pfd.revents & POLLIN) {
+@@ -1147,7 +1174,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ // workable on Linux.
+
+ // See http://crbug.com/959919.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (use_gpu_buffer_) {
+ v4l2_gpu_helper_->OnIncomingCapturedData(
+ client_.get(), buffer_tracker->start(),
+@@ -1220,7 +1247,7 @@ void V4L2CaptureDelegate::SetErrorState(
+ client_->OnError(error, from_here, reason);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ColorSpace V4L2CaptureDelegate::BuildColorSpaceFromv4l2() {
+ v4l2_colorspace v4l2_primary = (v4l2_colorspace)video_fmt_.fmt.pix.colorspace;
+ v4l2_quantization v4l2_range =
diff --git a/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h
new file mode 100644
index 0000000000..26b1f122d6
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h
@@ -0,0 +1,66 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/v4l2_capture_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/v4l2_capture_delegate.h
+@@ -22,7 +22,7 @@
+ #include "media/capture/video/linux/v4l2_capture_device_impl.h"
+ #include "media/capture/video/video_capture_device.h"
+
+-#if BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_OPENBSD) || defined(OS_NETBSD)
+ #include <sys/videoio.h>
+ #else
+ #include <linux/videodev2.h>
+@@ -34,7 +34,7 @@ class Location;
+
+ namespace media {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class V4L2CaptureDelegateGpuHelper;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -85,7 +85,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate
+ static bool IsBlockedControl(int control_id);
+ static bool IsControllableControl(
+ int control_id,
+- const base::RepeatingCallback<int(int, void*)>& do_ioctl);
++ const base::RepeatingCallback<int(unsigned int, void*)>& do_ioctl);
+
+ private:
+ friend class V4L2CaptureDelegateTest;
+@@ -96,10 +96,10 @@ class CAPTURE_EXPORT V4L2CaptureDelegate
+ // device file descriptor or (re)starting streaming, can fail but works after
+ // retrying (https://crbug.com/670262). Returns false if the |request| ioctl
+ // fails too many times.
+- bool RunIoctl(int request, void* argp);
++ bool RunIoctl(unsigned int request, void* argp);
+
+ // Simple wrapper to do HANDLE_EINTR(v4l2_->ioctl(device_fd_.get(), ...)).
+- int DoIoctl(int request, void* argp);
++ int DoIoctl(unsigned int request, void* argp);
+
+ // Check whether the control is controllable (and not changed automatically).
+ bool IsControllableControl(int control_id);
+@@ -129,7 +129,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate
+ const base::Location& from_here,
+ const std::string& reason);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Systems which describe a "color space" usually map that to one or more of
+ // {primary, matrix, transfer, range}. BuildColorSpaceFromv4l2() will use the
+ // matched value as first priority. Otherwise, if there is no best matching
+@@ -163,7 +163,7 @@ class CAPTURE_EXPORT V4L2CaptureDelegate
+ // Clockwise rotation in degrees. This value should be 0, 90, 180, or 270.
+ int rotation_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Support GPU memory buffer.
+ bool use_gpu_buffer_;
+ std::unique_ptr<V4L2CaptureDelegateGpuHelper> v4l2_gpu_helper_;
diff --git a/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device.h b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device.h
new file mode 100644
index 0000000000..ec7b838fa6
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/v4l2_capture_device.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/v4l2_capture_device.h
+@@ -21,7 +21,7 @@ class CAPTURE_EXPORT V4L2CaptureDevice
+ public:
+ virtual int open(const char* device_name, int flags) = 0;
+ virtual int close(int fd) = 0;
+- virtual int ioctl(int fd, int request, void* argp) = 0;
++ virtual int ioctl(int fd, unsigned long request, void* argp) = 0;
+ virtual void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
new file mode 100644
index 0000000000..810cb726cd
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/v4l2_capture_device_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/v4l2_capture_device_impl.cc
+@@ -22,7 +22,7 @@ int V4L2CaptureDeviceImpl::close(int fd)
+ return ::close(fd);
+ }
+
+-int V4L2CaptureDeviceImpl::ioctl(int fd, int request, void* argp) {
++int V4L2CaptureDeviceImpl::ioctl(int fd, unsigned long request, void* argp) {
+ return ::ioctl(fd, request, argp);
+ }
+
diff --git a/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h
new file mode 100644
index 0000000000..03a9423822
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/v4l2_capture_device_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/v4l2_capture_device_impl.h
+@@ -19,7 +19,7 @@ class CAPTURE_EXPORT V4L2CaptureDeviceIm
+ public:
+ int open(const char* device_name, int flags) override;
+ int close(int fd) override;
+- int ioctl(int fd, int request, void* argp) override;
++ int ioctl(int fd, unsigned long request, void* argp) override;
+ void* mmap(void* start,
+ size_t length,
+ int prot,
diff --git a/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc b/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
new file mode 100644
index 0000000000..b1dadfdc58
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
@@ -0,0 +1,107 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/video_capture_device_factory_v4l2.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/video_capture_device_factory_v4l2.cc
+@@ -23,7 +23,7 @@
+ #include "media/capture/video/linux/scoped_v4l2_device_fd.h"
+ #include "media/capture/video/linux/video_capture_device_linux.h"
+
+-#if BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
+ #include <sys/videoio.h>
+ #else
+ #include <linux/videodev2.h>
+@@ -38,6 +38,7 @@ bool CompareCaptureDevices(const VideoCa
+ return a.descriptor < b.descriptor;
+ }
+
++#if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_NETBSD)
+ // USB VID and PID are both 4 bytes long.
+ const size_t kVidPidSize = 4;
+ const size_t kMaxInterfaceNameSize = 256;
+@@ -70,11 +71,24 @@ std::string ExtractFileNameFromDeviceId(
+ DCHECK(base::StartsWith(device_id, kDevDir, base::CompareCase::SENSITIVE));
+ return device_id.substr(strlen(kDevDir), device_id.length());
+ }
++#endif
+
+ class DevVideoFilePathsDeviceProvider
+ : public VideoCaptureDeviceFactoryV4L2::DeviceProvider {
+ public:
+ void GetDeviceIds(std::vector<std::string>* target_container) override {
++#if BUILDFLAG(IS_OPENBSD)
++ char device[12];
++ int fd;
++ /* unveil(2) limits access to /dev/, try /dev/video[0-7] */
++ for (int n = 0; n < 8; n++) {
++ snprintf(device, sizeof(device), "/dev/video%d", n);
++ if ((fd = open(device, O_RDONLY)) != -1) {
++ close(fd);
++ target_container->emplace_back(device);
++ }
++ }
++#else
+ const base::FilePath path("/dev/");
+ base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES,
+ "video*");
+@@ -82,9 +96,13 @@ class DevVideoFilePathsDeviceProvider
+ const base::FileEnumerator::FileInfo info = enumerator.GetInfo();
+ target_container->emplace_back(path.value() + info.GetName().value());
+ }
++#endif
+ }
+
+ std::string GetDeviceModelId(const std::string& device_id) override {
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++ return std::string();
++#else
+ const std::string file_name = ExtractFileNameFromDeviceId(device_id);
+ std::string usb_id;
+ const std::string vid_path =
+@@ -101,9 +119,13 @@ class DevVideoFilePathsDeviceProvider
+ }
+
+ return usb_id;
++#endif
+ }
+
+ std::string GetDeviceDisplayName(const std::string& device_id) override {
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++ return std::string();
++#else
+ const std::string file_name = ExtractFileNameFromDeviceId(device_id);
+ const std::string interface_path =
+ base::StringPrintf(kInterfacePathTemplate, file_name.c_str());
+@@ -114,6 +136,7 @@ class DevVideoFilePathsDeviceProvider
+ return std::string();
+ }
+ return display_name;
++#endif
+ }
+ };
+
+@@ -219,7 +242,7 @@ void VideoCaptureDeviceFactoryV4L2::GetD
+ std::move(callback).Run(std::move(devices_info));
+ }
+
+-int VideoCaptureDeviceFactoryV4L2::DoIoctl(int fd, int request, void* argp) {
++int VideoCaptureDeviceFactoryV4L2::DoIoctl(int fd, unsigned int request, void* argp) {
+ return HANDLE_EINTR(v4l2_->ioctl(fd, request, argp));
+ }
+
+@@ -279,6 +302,11 @@ std::vector<float> VideoCaptureDeviceFac
+ frame_rates.push_back(
+ frame_interval.discrete.denominator /
+ static_cast<float>(frame_interval.discrete.numerator));
++#if BUILDFLAG(IS_NETBSD)
++ // On NetBSD VIDIOC_ENUM_FRAMEINTERVALS(video_enum_frameival) always return the same values
++ // and not handle index, what is cause infinity loop. One round is enough.
++ break;
++#endif
+ }
+ } else if (frame_interval.type == V4L2_FRMIVAL_TYPE_CONTINUOUS ||
+ frame_interval.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
diff --git a/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h b/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
new file mode 100644
index 0000000000..e8597c0c4b
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/video_capture_device_factory_v4l2.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/video_capture_device_factory_v4l2.h
+@@ -51,7 +51,7 @@ class CAPTURE_EXPORT VideoCaptureDeviceF
+
+ private:
+ // Simple wrapper to do HANDLE_EINTR(v4l2_->ioctl(fd, ...)).
+- int DoIoctl(int fd, int request, void* argp);
++ int DoIoctl(int fd, unsigned int request, void* argp);
+
+ VideoCaptureControlSupport GetControlSupport(int fd);
+ bool GetControlSupport(int fd, int control_id);
diff --git a/electron34/patches/patch-media_capture_video_linux_video__capture__device__linux.cc b/electron34/patches/patch-media_capture_video_linux_video__capture__device__linux.cc
new file mode 100644
index 0000000000..cae9d83471
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_linux_video__capture__device__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/linux/video_capture_device_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/linux/video_capture_device_linux.cc
+@@ -15,7 +15,7 @@
+ #include "build/build_config.h"
+ #include "media/capture/video/linux/v4l2_capture_delegate.h"
+
+-#if BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
+ #include <sys/videoio.h>
+ #else
+ #include <linux/videodev2.h>
diff --git a/electron34/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc b/electron34/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
new file mode 100644
index 0000000000..cffa01d2be
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/video_capture_buffer_tracker_factory_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/video_capture_buffer_tracker_factory_impl.cc
+@@ -14,7 +14,7 @@
+ #include "media/capture/video/chromeos/gpu_memory_buffer_tracker_cros.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "media/capture/video/apple/gpu_memory_buffer_tracker_apple.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "media/capture/video/linux/v4l2_gpu_memory_buffer_tracker.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "media/capture/video/win/gpu_memory_buffer_tracker_win.h"
+@@ -42,7 +42,7 @@ VideoCaptureBufferTrackerFactoryImpl::Cr
+ return std::make_unique<GpuMemoryBufferTrackerCros>();
+ #elif BUILDFLAG(IS_APPLE)
+ return std::make_unique<GpuMemoryBufferTrackerApple>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<V4L2GpuMemoryBufferTracker>();
+ #elif BUILDFLAG(IS_WIN)
+ if (!dxgi_device_manager_) {
diff --git a/electron34/patches/patch-media_capture_video_video__capture__device__client.cc b/electron34/patches/patch-media_capture_video_video__capture__device__client.cc
new file mode 100644
index 0000000000..cf4a1a23e2
--- /dev/null
+++ b/electron34/patches/patch-media_capture_video_video__capture__device__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/capture/video/video_capture_device_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/capture/video/video_capture_device_client.cc
+@@ -172,7 +172,7 @@ FourccAndFlip GetFourccAndFlipFromPixelF
+ CHECK(!is_width_odd && !is_height_odd);
+ return {libyuv::FOURCC_UYVY};
+ case media::PIXEL_FORMAT_RGB24:
+- if constexpr (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) {
++ if constexpr (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) {
+ // Linux RGB24 defines red at lowest byte address,
+ // see http://linuxtv.org/downloads/v4l-dvb-apis/packed-rgb.html.
+ return {libyuv::FOURCC_RAW};
diff --git a/electron34/patches/patch-media_cdm_cdm__paths__unittest.cc b/electron34/patches/patch-media_cdm_cdm__paths__unittest.cc
new file mode 100644
index 0000000000..a6fbe153fd
--- /dev/null
+++ b/electron34/patches/patch-media_cdm_cdm__paths__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/cdm/cdm_paths_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/cdm/cdm_paths_unittest.cc
+@@ -27,7 +27,7 @@ const char kComponentPlatform[] =
+ "win";
+ #elif BUILDFLAG(IS_CHROMEOS)
+ "cros";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ "linux";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ "fuchsia";
diff --git a/electron34/patches/patch-media_cdm_library__cdm_cdm__paths.gni b/electron34/patches/patch-media_cdm_library__cdm_cdm__paths.gni
new file mode 100644
index 0000000000..e87d3f0b58
--- /dev/null
+++ b/electron34/patches/patch-media_cdm_library__cdm_cdm__paths.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/cdm/library_cdm/cdm_paths.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/cdm/library_cdm/cdm_paths.gni
+@@ -15,7 +15,7 @@ assert(enable_library_cdms)
+ # Explicitly define what we use to avoid confusion.
+ if (is_chromeos) {
+ component_os = "cros"
+-} else if (is_linux) {
++} else if (is_linux || is_bsd) {
+ component_os = "linux"
+ } else if (is_win) {
+ component_os = "win"
diff --git a/electron34/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py b/electron34/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py
new file mode 100644
index 0000000000..be0dcc70c6
--- /dev/null
+++ b/electron34/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py
@@ -0,0 +1,82 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/ffmpeg/scripts/build_ffmpeg.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/ffmpeg/scripts/build_ffmpeg.py
+@@ -33,7 +33,7 @@ NDK_ROOT_DIR = os.path.abspath(
+ SUCCESS_TOKEN = 'THIS_BUILD_WORKED'
+
+ sys.path.append(os.path.join(CHROMIUM_ROOT_DIR, 'build'))
+-import gn_helpers
++#import gn_helpers
+
+ BRANDINGS = [
+ 'Chrome',
+@@ -43,6 +43,9 @@ BRANDINGS = [
+ ARCH_MAP = {
+ 'android': ['ia32', 'x64', 'arm-neon', 'arm64'],
+ 'linux': ['ia32', 'x64', 'noasm-x64', 'arm', 'arm-neon', 'arm64'],
++ 'openbsd': ['x64', 'arm64', 'ia32'],
++ 'freebsd': ['x64', 'arm64', 'ia32'],
++ 'netbsd': ['x64', 'arm64', 'ia32'],
+ 'mac': ['x64', 'arm64'],
+ 'win': ['ia32', 'x64', 'arm64'],
+ }
+@@ -122,7 +125,7 @@ def PrintAndCheckCall(argv, *args, **kwa
+
+
+ def GetDsoName(target_os, dso_name, dso_version):
+- if target_os in ('linux', 'linux-noasm', 'android'):
++ if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd', 'netbsd'):
+ return 'lib%s.so.%s' % (dso_name, dso_version)
+ elif target_os == 'mac':
+ return 'lib%s.%s.dylib' % (dso_name, dso_version)
+@@ -475,7 +478,7 @@ def BuildFFmpeg(target_os, target_arch,
+ # removing <sys/sysctl.h> soon, so this is needed to silence a deprecation
+ # #warning which will be converted to an error via -Werror.
+ # There is also no prctl.h
+- if target_os in ['linux', 'linux-noasm']:
++ if target_os in ['linux', 'linux-noasm', 'openbsd', 'freebsd', 'netbsd']:
+ pre_make_rewrites += [
+ (r'(#define HAVE_SYSCTL [01])',
+ r'#define HAVE_SYSCTL 0 /* \1 -- forced to 0 for Fuchsia */'),
+@@ -598,7 +601,7 @@ def main(argv):
+ configure_args = args[2:]
+
+ if target_os not in ('android', 'linux', 'linux-noasm', 'mac', 'win',
+- 'all'):
++ 'all', 'openbsd', 'freebsd', 'netbsd'):
+ parser.print_help()
+ return 1
+
+@@ -712,7 +715,7 @@ def ConfigureAndBuild(target_arch, targe
+ '--optflags="-O2"',
+ ])
+
+- if target_os in ('linux', 'linux-noasm', 'android'):
++ if target_os in ('linux', 'linux-noasm', 'android', 'openbsd', 'freebsd', 'netbsd'):
+ if target_arch == 'x64':
+ if target_os == 'android':
+ configure_flags['Common'].extend([
+@@ -827,9 +830,6 @@ def ConfigureAndBuild(target_arch, targe
+
+ configure_flags['Common'].extend([
+ '--target-os=linux',
+- '--sysroot=' +
+- os.path.join(CHROMIUM_ROOT_DIR,
+- 'build/linux/debian_bullseye_arm64-sysroot'),
+ # See crbug.com/1467681. These could be removed eventually
+ '--disable-dotprod',
+ '--disable-i8mm',
+@@ -921,7 +921,7 @@ def ConfigureAndBuild(target_arch, targe
+ # typically be the system one, so explicitly configure use of Clang's
+ # ld.lld, to ensure that things like cross-compilation and LTO work.
+ # This does not work for ia32 and is always used on mac.
+- if target_arch != 'ia32' and target_os != 'mac':
++ if target_arch != 'ia32' and target_os != 'mac' and target_os != 'netbsd':
+ configure_flags['Common'].append('--extra-ldflags=-fuse-ld=lld')
+
+ # Should be run on Mac, unless we're cross-compiling on Linux.
diff --git a/electron34/patches/patch-media_ffmpeg_scripts_robo__lib_config.py b/electron34/patches/patch-media_ffmpeg_scripts_robo__lib_config.py
new file mode 100644
index 0000000000..2989896e9d
--- /dev/null
+++ b/electron34/patches/patch-media_ffmpeg_scripts_robo__lib_config.py
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/ffmpeg/scripts/robo_lib/config.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/ffmpeg/scripts/robo_lib/config.py
+@@ -55,19 +55,13 @@ class RoboConfiguration:
+ self._llvm_path = os.path.join(self.chrome_src(), "third_party",
+ "llvm-build", "Release+Asserts", "bin")
+
+- self.EnsurePathContainsLLVM()
+- self.EnsureNoMakeInfo()
+ self.EnsureFFmpegHome()
+ self.EnsureGNConfig()
+- self.ComputeBranchName()
+
+ if not quiet:
+ shell.log(f"Using chrome src: {self.chrome_src()}")
+ shell.log(f"Using script dir: {self._script_directory}")
+ shell.log(f"Using ffmpeg home: {self.ffmpeg_home()}")
+- shell.log(f"On branch: {self.branch_name()}")
+- if self.sushi_branch_name():
+- shell.log(f"On sushi branch: {self.sushi_branch_name()}")
+
+ # Filename that we'll ask generate_gn.py to write git commands to.
+ # TODO: Should this use script_directory, or stay with ffmpeg? As long as
+@@ -186,9 +180,9 @@ class RoboConfiguration:
+
+ if re.match(r"i.86", platform.machine()):
+ self._host_architecture = "ia32"
+- elif platform.machine() == "x86_64" or platform.machine() == "AMD64":
++ elif platform.machine() == "x86_64" or platform.machine() == "AMD64" or platform.machine() == "amd64":
+ self._host_architecture = "x64"
+- elif platform.machine() == "aarch64":
++ elif platform.machine() == "aarch64" or platform.machine() == "arm64":
+ self._host_architecture = "arm64"
+ elif platform.machine() == "mips32":
+ self._host_architecture = "mipsel"
+@@ -223,6 +217,12 @@ class RoboConfiguration:
+ elif platform.system() == "Windows" or "CYGWIN_NT" in platform.system(
+ ):
+ self._host_operating_system = "win"
++ elif platform.system() == "OpenBSD":
++ self._host_operating_system = "openbsd"
++ elif platform.system() == "FreeBSD":
++ self._host_operating_system = "freebsd"
++ elif platform.system() == "NetBSD":
++ self._host_operating_system = "netbsd"
+ else:
+ raise ValueError(f"Unsupported platform: {platform.system()}")
+
+@@ -231,8 +231,8 @@ class RoboConfiguration:
+ wd = os.getcwd()
+ # Walk up the tree until we find src/AUTHORS
+ while wd != "/":
+- if os.path.isfile(os.path.join(wd, "src", "AUTHORS")):
+- self._chrome_src = os.path.join(wd, "src")
++ if os.path.isfile(os.path.join(wd, "third_party", "DEPS")):
++ self._chrome_src = wd
+ return
+ wd = os.path.dirname(wd)
+ raise Exception("could not find src/AUTHORS in any parent of the wd")
diff --git a/electron34/patches/patch-media_gpu_buffer__validation.cc b/electron34/patches/patch-media_gpu_buffer__validation.cc
new file mode 100644
index 0000000000..d43fc8c39c
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_buffer__validation.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/buffer_validation.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/buffer_validation.cc
+@@ -15,7 +15,7 @@
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <sys/types.h>
+ #include <unistd.h>
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -23,7 +23,7 @@
+ namespace media {
+
+ bool GetFileSize(const int fd, size_t* size) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (fd < 0) {
+ VLOG(1) << "Invalid file descriptor";
+ return false;
+@@ -77,7 +77,7 @@ bool VerifyGpuMemoryBufferHandle(
+ VLOG(1) << "Unsupported: " << pixel_format;
+ return false;
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const size_t num_planes = media::VideoFrame::NumPlanes(pixel_format);
+ if (num_planes != gmb_handle.native_pixmap_handle.planes.size() ||
+ num_planes == 0) {
diff --git a/electron34/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc b/electron34/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc
new file mode 100644
index 0000000000..693143373c
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/chromeos/gl_image_processor_backend.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/chromeos/gl_image_processor_backend.cc
+@@ -28,6 +28,10 @@
+ #include "ui/ozone/public/ozone_platform.h"
+ #include "ui/ozone/public/surface_factory_ozone.h"
+
++#ifndef GL_CONTEXT_LOST_KHR
++#define GL_CONTEXT_LOST_KHR 0x0507
++#endif
++
+ namespace media {
+
+ namespace {
diff --git a/electron34/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc b/electron34/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
new file mode 100644
index 0000000000..23f2c566e8
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/chromeos/libyuv_image_processor_backend.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/chromeos/libyuv_image_processor_backend.cc
+@@ -53,7 +53,7 @@ static constexpr struct {
+ #define CONV(in, out, trans, result) \
+ {Fourcc::in, Fourcc::out, Transform::trans, SupportResult::result}
+ // Conversion.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CONV(NV12, AR24, kConversion, Supported),
+ #endif
+ CONV(NV12, NV12, kConversion, Supported),
+@@ -412,7 +412,7 @@ int LibYUVImageProcessorBackend::DoConve
+ fr->GetWritableVisibleData(VideoFrame::Plane::kUV)), \
+ fr->stride(VideoFrame::Plane::kUV)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define ARGB_DATA(fr) \
+ fr->GetWritableVisibleData(VideoFrame::Plane::kARGB), \
+ fr->stride(VideoFrame::Plane::kARGB)
+@@ -574,7 +574,7 @@ int LibYUVImageProcessorBackend::DoConve
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (output->format() == PIXEL_FORMAT_ARGB) {
+ if (input_config_.fourcc == Fourcc(Fourcc::NV12)) {
+ return LIBYUV_FUNC(NV12ToARGB, Y_UV_DATA(input),
diff --git a/electron34/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc b/electron34/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
new file mode 100644
index 0000000000..4af77d1217
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/chromeos/mailbox_video_frame_converter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/chromeos/mailbox_video_frame_converter.cc
+@@ -67,7 +67,7 @@ viz::SharedImageFormat GetSharedImageFor
+ << static_cast<int>(buffer_format);
+ NOTREACHED();
+ }
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If format is true multiplanar format, we prefer external sampler on
+ // ChromeOS and Linux.
+ if (format.is_multi_plane()) {
diff --git a/electron34/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc b/electron34/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc
new file mode 100644
index 0000000000..c69d253da1
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/chromeos/platform_video_frame_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/chromeos/platform_video_frame_utils.cc
+@@ -67,7 +67,7 @@ static std::unique_ptr<ui::GbmDevice> Cr
+ const base::FilePath dev_path(FILE_PATH_LITERAL(
+ base::StrCat({drm_node_file_prefix, base::NumberToString(i)})));
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_V4L2_CODEC)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_V4L2_CODEC)
+ const bool is_render_node = base::Contains(drm_node_file_prefix, "render");
+
+ // TODO(b/313513760): don't guard base::File::FLAG_WRITE behind
diff --git a/electron34/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc b/electron34/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc
new file mode 100644
index 0000000000..a999a242c5
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/chromeos/video_decoder_pipeline.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/chromeos/video_decoder_pipeline.cc
+@@ -1097,7 +1097,7 @@ VideoDecoderPipeline::PickDecoderOutputF
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_VAAPI)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_VAAPI)
+ // Linux should always use a custom allocator (to allocate buffers using
+ // libva) and a PlatformVideoFramePool.
+ CHECK(allocator.has_value());
+@@ -1106,7 +1106,7 @@ VideoDecoderPipeline::PickDecoderOutputF
+ // VideoFrame::StorageType of VideoFrame::STORAGE_DMABUFS.
+ main_frame_pool_->AsPlatformVideoFramePool()->SetCustomFrameAllocator(
+ *allocator, VideoFrame::STORAGE_DMABUFS);
+-#elif BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_V4L2_CODEC)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_V4L2_CODEC)
+ // Linux w/ V4L2 should not use a custom allocator
+ // Only tested with video_decode_accelerator_tests
+ // TODO(wenst@) Test with full Chromium Browser
+@@ -1288,7 +1288,7 @@ VideoDecoderPipeline::PickDecoderOutputF
+ << " VideoFrames";
+ auxiliary_frame_pool_->set_parent_task_runner(decoder_task_runner_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The custom allocator creates frames backed by NativePixmap, which uses a
+ // VideoFrame::StorageType of VideoFrame::STORAGE_DMABUFS.
+ auxiliary_frame_pool_->AsPlatformVideoFramePool()->SetCustomFrameAllocator(
diff --git a/electron34/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc b/electron34/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
new file mode 100644
index 0000000000..63c922d487
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/gpu_video_encode_accelerator_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/gpu_video_encode_accelerator_factory.cc
+@@ -118,7 +118,7 @@ std::vector<VEAFactoryFunction> GetVEAFa
+ return vea_factory_functions;
+
+ #if BUILDFLAG(USE_VAAPI)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(kAcceleratedVideoEncodeLinux)) {
+ vea_factory_functions.push_back(base::BindRepeating(&CreateVaapiVEA));
+ }
+@@ -126,7 +126,7 @@ std::vector<VEAFactoryFunction> GetVEAFa
+ vea_factory_functions.push_back(base::BindRepeating(&CreateVaapiVEA));
+ #endif
+ #elif BUILDFLAG(USE_V4L2_CODEC)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (base::FeatureList::IsEnabled(kAcceleratedVideoEncodeLinux)) {
+ vea_factory_functions.push_back(base::BindRepeating(&CreateV4L2VEA));
+ }
diff --git a/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc b/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..07e3a8b0d4
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.cc
+@@ -16,7 +16,9 @@
+ #include "media/gpu/vaapi/vaapi_wrapper.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
++#endif
+
+ // TODO(b/195769334): the hardware video decoding sandbox is really only useful
+ // when building with VA-API or V4L2 (otherwise, we're not really doing hardware
+@@ -32,6 +34,7 @@ using sandbox::syscall_broker::BrokerFil
+ namespace media {
+ namespace {
+
++#if !BUILDFLAG(IS_BSD)
+ void AllowAccessToRenderNodes(std::vector<BrokerFilePermission>& permissions,
+ bool include_sys_dev_char,
+ bool read_write) {
+@@ -188,6 +191,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ NOTREACHED();
+ #endif // BUILDFLAG(USE_V4L2_CODEC)
+ }
++#endif
+
+ } // namespace
+
+@@ -203,6 +207,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ // (at least).
+ bool HardwareVideoDecodingPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ using HardwareVideoDecodingProcessPolicy =
+ sandbox::policy::HardwareVideoDecodingProcessPolicy;
+ using PolicyType =
+@@ -248,6 +253,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ // |permissions| is empty?
+ sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess(
+ command_set, permissions, options);
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h b/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
new file mode 100644
index 0000000000..8d823896b1
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/sandbox/hardware_video_decoding_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_DECODING_SANDBOX_HOOK_LINUX_H_
+ #define MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_DECODING_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace media {
+
diff --git a/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc b/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..eb2abd8dac
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.cc
+@@ -18,12 +18,15 @@
+ #include "media/gpu/v4l2/v4l2_device.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
++#endif
+
+ namespace media {
+
+ bool HardwareVideoEncodingPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ sandbox::syscall_broker::BrokerCommandSet command_set;
+ std::vector<BrokerFilePermission> permissions;
+
+@@ -132,6 +135,7 @@ bool HardwareVideoEncodingPreSandboxHook
+ dlopen("libvulkan_radeon.so", kDlopenFlags);
+ }
+ #endif
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h b/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
new file mode 100644
index 0000000000..c8879da081
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/sandbox/hardware_video_encoding_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+ #define MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace media {
+
+@@ -14,4 +20,4 @@ bool HardwareVideoEncodingPreSandboxHook
+
+ } // namespace media
+
+-#endif // MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
+\ No newline at end of file
++#endif // MEDIA_GPU_SANDBOX_HARDWARE_VIDEO_ENCODING_SANDBOX_HOOK_LINUX_H_
diff --git a/electron34/patches/patch-media_gpu_test_raw__video.cc b/electron34/patches/patch-media_gpu_test_raw__video.cc
new file mode 100644
index 0000000000..36a5e8640c
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_test_raw__video.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/test/raw_video.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/test/raw_video.cc
+@@ -61,7 +61,7 @@ std::unique_ptr<base::MemoryMappedFile>
+ base::File::FLAG_READ | base::File::FLAG_WRITE
+ // On Windows FLAG_CREATE_ALWAYS will require FLAG_WRITE, and FLAG_APPEND
+ // must not be specified.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ | base::File::FLAG_APPEND
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ ),
diff --git a/electron34/patches/patch-media_gpu_test_video__frame__file__writer.cc b/electron34/patches/patch-media_gpu_test_video__frame__file__writer.cc
new file mode 100644
index 0000000000..afb76d020d
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_test_video__frame__file__writer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/test/video_frame_file_writer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/test/video_frame_file_writer.cc
+@@ -26,7 +26,7 @@
+ #include "testing/gtest/include/gtest/gtest.h"
+ #include "ui/gfx/codec/png_codec.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/mman.h>
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-media_gpu_test_video__frame__helpers.cc b/electron34/patches/patch-media_gpu_test_video__frame__helpers.cc
new file mode 100644
index 0000000000..0fe354ef3e
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_test_video__frame__helpers.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/test/video_frame_helpers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/test/video_frame_helpers.cc
+@@ -22,7 +22,7 @@
+ #include "ui/gfx/buffer_format_util.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/mman.h>
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-media_gpu_test_video__frame__validator.cc b/electron34/patches/patch-media_gpu_test_video__frame__validator.cc
new file mode 100644
index 0000000000..b54adce739
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_test_video__frame__validator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/test/video_frame_validator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/test/video_frame_validator.cc
+@@ -33,7 +33,7 @@
+ #include "testing/gtest/include/gtest/gtest.h"
+ #include "ui/gfx/gpu_memory_buffer.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include <sys/mman.h>
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc b/electron34/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc
new file mode 100644
index 0000000000..e12ce5ba1b
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/vaapi/vaapi_video_decoder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/vaapi/vaapi_video_decoder.cc
+@@ -782,7 +782,7 @@ void VaapiVideoDecoder::ApplyResolutionC
+ const gfx::Size decoder_natural_size =
+ aspect_ratio_.GetNaturalSize(decoder_visible_rect);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::optional<DmabufVideoFramePool::CreateFrameCB> allocator =
+ base::BindRepeating(&AllocateCustomFrameProxy, weak_this_);
+ std::vector<ImageProcessor::PixelLayoutCandidate> candidates = {
diff --git a/electron34/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc b/electron34/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc
new file mode 100644
index 0000000000..00bded9688
--- /dev/null
+++ b/electron34/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/gpu/vaapi/vaapi_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/gpu/vaapi/vaapi_wrapper.cc
+@@ -78,7 +78,7 @@
+ using media_gpu_vaapi::kModuleVa_prot;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/files/file_util.h"
+ #include "base/strings/string_split.h"
+ #endif
diff --git a/electron34/patches/patch-media_media__options.gni b/electron34/patches/patch-media_media__options.gni
new file mode 100644
index 0000000000..1ade906c7f
--- /dev/null
+++ b/electron34/patches/patch-media_media__options.gni
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/media_options.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/media_options.gni
+@@ -197,12 +197,18 @@ declare_args() {
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enable runtime selection of sndio(7)
++ use_sndio = false
++
++ # Enable runtime selection of audio(4)
++ use_audioio = false
++
+ # Alsa should be used on all non-Android, non-Mac POSIX systems - with the
+ # exception of CastOS desktop builds.
+ #
+ # TODO(crbug.com/1336055): Remove legacy target_cpu hack used for targeting
+ # desktop Chromecast builds.
+- if (is_posix && !is_android && !is_apple &&
++ if (is_posix && !is_android && !is_apple && !is_bsd &&
+ (!is_castos || (target_cpu == "x86" || target_cpu == "x64") ||
+ is_cast_audio_only)) {
+ use_alsa = true
diff --git a/electron34/patches/patch-media_mojo_mojom_stable_BUILD.gn b/electron34/patches/patch-media_mojo_mojom_stable_BUILD.gn
new file mode 100644
index 0000000000..f416dc3555
--- /dev/null
+++ b/electron34/patches/patch-media_mojo_mojom_stable_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/mojo/mojom/stable/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/mojo/mojom/stable/BUILD.gn
+@@ -196,7 +196,7 @@ source_set("unit_tests") {
+ } else if (use_v4l2_codec) {
+ deps += [ "//media/gpu/v4l2:v4l2_status" ]
+ }
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "mojom_traits_test_util.cc",
+ "mojom_traits_test_util.h",
diff --git a/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc b/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
new file mode 100644
index 0000000000..2160e0e0d6
--- /dev/null
+++ b/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
+@@ -854,7 +854,7 @@ const gfx::GpuMemoryBufferId& StructTrai
+ return input.id;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ gfx::NativePixmapHandle StructTraits<
+ media::stable::mojom::NativeGpuMemoryBufferHandleDataView,
+@@ -875,7 +875,7 @@ bool StructTraits<media::stable::mojom::
+
+ output->type = gfx::NATIVE_PIXMAP;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!data.ReadPlatformHandle(&output->native_pixmap_handle))
+ return false;
+ return true;
diff --git a/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h b/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
new file mode 100644
index 0000000000..122ed87c91
--- /dev/null
+++ b/electron34/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
+@@ -705,7 +705,7 @@ struct StructTraits<media::stable::mojom
+ static const gfx::GpuMemoryBufferId& id(
+ const gfx::GpuMemoryBufferHandle& input);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static gfx::NativePixmapHandle platform_handle(
+ gfx::GpuMemoryBufferHandle& input);
+ #else
diff --git a/electron34/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc b/electron34/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc
new file mode 100644
index 0000000000..27fe74bf35
--- /dev/null
+++ b/electron34/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/mojo/mojom/video_frame_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/mojo/mojom/video_frame_mojom_traits.cc
+@@ -22,7 +22,7 @@
+ #include "ui/gfx/mojom/color_space_mojom_traits.h"
+ #include "ui/gfx/mojom/hdr_metadata_mojom_traits.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/posix/eintr_wrapper.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
diff --git a/electron34/patches/patch-media_video_fake__gpu__memory__buffer.cc b/electron34/patches/patch-media_video_fake__gpu__memory__buffer.cc
new file mode 100644
index 0000000000..5ea7710d77
--- /dev/null
+++ b/electron34/patches/patch-media_video_fake__gpu__memory__buffer.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/video/fake_gpu_memory_buffer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/video/fake_gpu_memory_buffer.cc
+@@ -14,7 +14,7 @@
+ #include "media/base/format_utils.h"
+ #include "media/base/video_frame.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <fcntl.h>
+ #include <sys/stat.h>
+ #include <sys/types.h>
+@@ -63,7 +63,7 @@ class FakeGpuMemoryBufferImpl : public g
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::ScopedFD GetDummyFD() {
+ base::ScopedFD fd(open("/dev/zero", O_RDWR));
+ DCHECK(fd.is_valid());
+@@ -102,7 +102,7 @@ FakeGpuMemoryBuffer::FakeGpuMemoryBuffer
+ static base::AtomicSequenceNumber buffer_id_generator;
+ handle_.id = gfx::GpuMemoryBufferId(buffer_id_generator.GetNext());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (size_t i = 0; i < VideoFrame::NumPlanes(video_pixel_format_); i++) {
+ const gfx::Size plane_size_in_bytes =
+ VideoFrame::PlaneSize(video_pixel_format_, i, size_);
+@@ -176,7 +176,7 @@ gfx::GpuMemoryBufferHandle FakeGpuMemory
+ gfx::GpuMemoryBufferHandle handle;
+ handle.type = gfx::NATIVE_PIXMAP;
+ handle.id = handle_.id;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ handle.native_pixmap_handle =
+ gfx::CloneHandleForIPC(handle_.native_pixmap_handle);
+ #endif
diff --git a/electron34/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc b/electron34/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
new file mode 100644
index 0000000000..393c0c6e22
--- /dev/null
+++ b/electron34/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/video/gpu_memory_buffer_video_frame_pool.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/video/gpu_memory_buffer_video_frame_pool.cc
+@@ -641,7 +641,7 @@ void GpuMemoryBufferVideoFramePool::Pool
+ }
+
+ bool is_software_backed_video_frame = !video_frame->HasSharedImage();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ is_software_backed_video_frame &= !video_frame->HasDmaBufs();
+ #endif
+
+@@ -1049,7 +1049,7 @@ scoped_refptr<VideoFrame> GpuMemoryBuffe
+ media::IOSurfaceIsWebGPUCompatible(handle.io_surface.get());
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ is_webgpu_compatible =
+ handle.native_pixmap_handle.supports_zero_copy_webgpu_import;
+ #endif
+@@ -1229,7 +1229,7 @@ GpuMemoryBufferVideoFramePool::PoolImpl:
+ si_usage |= gpu::SHARED_IMAGE_USAGE_SCANOUT;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40194712): Always add the flag once the
+ // OzoneImageBacking is by default turned on.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
diff --git a/electron34/patches/patch-media_video_renderable__gpu__memory__buffer__video__frame__pool.cc b/electron34/patches/patch-media_video_renderable__gpu__memory__buffer__video__frame__pool.cc
new file mode 100644
index 0000000000..f7188683c5
--- /dev/null
+++ b/electron34/patches/patch-media_video_renderable__gpu__memory__buffer__video__frame__pool.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/video/renderable_gpu_memory_buffer_video_frame_pool.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/video/renderable_gpu_memory_buffer_video_frame_pool.cc
+@@ -193,7 +193,7 @@ gfx::Size GetBufferSizeInPixelsForVideoP
+ bool FrameResources::Initialize() {
+ auto* context = pool_->GetContext();
+
+- constexpr gfx::BufferUsage kBufferUsage =
++ gfx::BufferUsage buffer_usage =
+ #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS)
+ gfx::BufferUsage::SCANOUT_VEA_CPU_READ
+ #else
+@@ -207,6 +207,23 @@ bool FrameResources::Initialize() {
+ const gfx::Size buffer_size_in_pixels =
+ GetBufferSizeInPixelsForVideoPixelFormat(format_, coded_size_);
+
++#if BUILDFLAG(IS_WIN)
++ // For CEF OSR feature, currently there's no other place in chromium use RGBA.
++ // If the format is RGBA, currently CEF do not write to the texture anymore
++ // once the GMB is returned from CopyRequest. So there will be no race
++ // condition on that texture. We can request a GMB without a keyed mutex to
++ // accelerate and probably prevent some driver deadlock.
++ if (format_ == PIXEL_FORMAT_ARGB || format_ == PIXEL_FORMAT_ABGR) {
++ // This value is 'borrowed', SCANOUT_VEA_CPU_READ is probably invalid
++ // cause there's no real SCANOUT on Windows. We simply use this enum as a
++ // flag to disable mutex in the GMBFactoryDXGI because this enum is also
++ // used above in macOS and CrOS for similar usage (claim no other one will
++ // concurrently use the resource).
++ // https://chromium-review.googlesource.com/c/chromium/src/+/5302103
++ buffer_usage = gfx::BufferUsage::SCANOUT_VEA_CPU_READ;
++ }
++#endif
++
+ constexpr gpu::SharedImageUsageSet kSharedImageUsage =
+ #if BUILDFLAG(IS_MAC)
+ gpu::SHARED_IMAGE_USAGE_MACOS_VIDEO_TOOLBOX |
+@@ -231,7 +248,7 @@ bool FrameResources::Initialize() {
+ viz::GetSharedImageFormat(buffer_format);
+
+ shared_image_ = context->CreateSharedImage(
+- buffer_size_in_pixels, kBufferUsage, si_format, color_space_,
++ buffer_size_in_pixels, buffer_usage, si_format, color_space_,
+ kTopLeft_GrSurfaceOrigin, kPremul_SkAlphaType, kSharedImageUsage,
+ sync_token_);
+ if (!shared_image_) {
diff --git a/electron34/patches/patch-media_video_video__encode__accelerator__adapter.cc b/electron34/patches/patch-media_video_video__encode__accelerator__adapter.cc
new file mode 100644
index 0000000000..f8160b8f49
--- /dev/null
+++ b/electron34/patches/patch-media_video_video__encode__accelerator__adapter.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/video/video_encode_accelerator_adapter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/video/video_encode_accelerator_adapter.cc
+@@ -159,7 +159,7 @@ VideoEncodeAccelerator::Config SetUpVeaC
+ config.input_format = PIXEL_FORMAT_I420;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (format != PIXEL_FORMAT_I420 ||
+ !VideoFrame::IsStorageTypeMappable(storage_type)) {
+ // ChromeOS/Linux hardware video encoders supports I420 on-memory
+@@ -518,7 +518,7 @@ void VideoEncodeAcceleratorAdapter::Init
+ profile_, options_, format, first_frame->storage_type(),
+ supported_rc_modes_, required_encoder_type_, is_gpu_supported_format);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Linux/ChromeOS require a special configuration to use dmabuf storage.
+ // We need to keep sending frames the same way the first frame was sent.
+ // Other platforms will happily mix GpuMemoryBuffer storage with regular
diff --git a/electron34/patches/patch-media_video_video__encode__accelerator__adapter__test.cc b/electron34/patches/patch-media_video_video__encode__accelerator__adapter__test.cc
new file mode 100644
index 0000000000..68cc640e3d
--- /dev/null
+++ b/electron34/patches/patch-media_video_video__encode__accelerator__adapter__test.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/video/video_encode_accelerator_adapter_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/video/video_encode_accelerator_adapter_test.cc
+@@ -458,7 +458,7 @@ TEST_P(VideoEncodeAcceleratorAdapterTest
+ CreateGreenFrame(large_size, pixel_format, base::Milliseconds(2));
+
+ VideoPixelFormat expected_input_format = PIXEL_FORMAT_I420;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (pixel_format != PIXEL_FORMAT_I420 || !small_frame->IsMappable())
+ expected_input_format = PIXEL_FORMAT_NV12;
+ #endif
diff --git a/electron34/patches/patch-media_webrtc_audio__processor.cc b/electron34/patches/patch-media_webrtc_audio__processor.cc
new file mode 100644
index 0000000000..88033fdc1b
--- /dev/null
+++ b/electron34/patches/patch-media_webrtc_audio__processor.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/webrtc/audio_processor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/webrtc/audio_processor.cc
+@@ -521,7 +521,7 @@ std::optional<double> AudioProcessor::Pr
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
+ DCHECK_LE(volume, 1.0);
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_OPENBSD)
++ BUILDFLAG(IS_BSD)
+ // We have a special situation on Linux where the microphone volume can be
+ // "higher than maximum". The input volume slider in the sound preference
+ // allows the user to set a scaling that is higher than 100%. It means that
diff --git a/electron34/patches/patch-media_webrtc_helpers.cc b/electron34/patches/patch-media_webrtc_helpers.cc
new file mode 100644
index 0000000000..65d04d564c
--- /dev/null
+++ b/electron34/patches/patch-media_webrtc_helpers.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/webrtc/helpers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/webrtc/helpers.cc
+@@ -43,14 +43,14 @@ void ConfigAutomaticGainControl(const Au
+ return;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool kInputVolumeAdjustmentOverrideAllowed = true;
+ #elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+ const bool kInputVolumeAdjustmentOverrideAllowed = false;
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Use AGC2 digital and input volume controller.
+ // TODO(crbug.com/40872787): Remove `kWebRtcAllowInputVolumeAdjustment` safely
+ // and set `input_volume_controller.enabled` true.
diff --git a/electron34/patches/patch-media_webrtc_helpers__unittests.cc b/electron34/patches/patch-media_webrtc_helpers__unittests.cc
new file mode 100644
index 0000000000..4627b0120b
--- /dev/null
+++ b/electron34/patches/patch-media_webrtc_helpers__unittests.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- media/webrtc/helpers_unittests.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ media/webrtc/helpers_unittests.cc
+@@ -40,7 +40,7 @@ TEST(CreateWebRtcAudioProcessingModuleTe
+ EXPECT_TRUE(config.echo_canceller.enabled);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ EXPECT_FALSE(config.gain_controller1.enabled);
+ EXPECT_TRUE(config.gain_controller2.enabled);
+ #elif BUILDFLAG(IS_CASTOS) || BUILDFLAG(IS_CAST_ANDROID)
+@@ -73,7 +73,7 @@ TEST(CreateWebRtcAudioProcessingModuleTe
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ InputVolumeAdjustmentEnabledWithAgc2) {
+ ::base::test::ScopedFeatureList feature_list;
+@@ -89,7 +89,7 @@ TEST(CreateWebRtcAudioProcessingModuleTe
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ CanDisableInputVolumeAdjustmentWithAgc2) {
+ ::base::test::ScopedFeatureList feature_list;
+@@ -106,7 +106,7 @@ TEST(CreateWebRtcAudioProcessingModuleTe
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ TEST(CreateWebRtcAudioProcessingModuleTest,
+ OnlyOneInputVolumeControllerEnabledOnDesktopPlatforms) {
+ auto config = CreateApmGetConfig(
diff --git a/electron34/patches/patch-mojo_core_BUILD.gn b/electron34/patches/patch-mojo_core_BUILD.gn
new file mode 100644
index 0000000000..38a011697e
--- /dev/null
+++ b/electron34/patches/patch-mojo_core_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/core/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/core/BUILD.gn
+@@ -163,7 +163,7 @@ source_set("impl_for_embedder") {
+ ]
+ }
+
+- if ((is_linux || is_chromeos || is_android) && !is_nacl) {
++ if ((is_linux || is_chromeos || is_android) && !is_nacl && !is_bsd) {
+ sources += [
+ "channel_linux.cc",
+ "channel_linux.h",
diff --git a/electron34/patches/patch-mojo_core_channel.cc b/electron34/patches/patch-mojo_core_channel.cc
new file mode 100644
index 0000000000..9f6b66dde2
--- /dev/null
+++ b/electron34/patches/patch-mojo_core_channel.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/core/channel.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/core/channel.cc
+@@ -83,7 +83,11 @@ const size_t kMaxAttachedHandles = 64;
+ const size_t kMaxAttachedHandles = 253;
+ #endif // BUILDFLAG(IS_FUCHSIA)
+
++#if defined(__i386__) && defined(OS_FREEBSD)
++const size_t kChannelMessageAlignment = 4;
++#else
+ static_assert(alignof(std::max_align_t) >= kChannelMessageAlignment, "");
++#endif
+ Channel::AlignedBuffer MakeAlignedBuffer(size_t size) {
+ // Generic allocators (such as malloc) return a pointer that is suitably
+ // aligned for storing any type of object with a fundamental alignment
diff --git a/electron34/patches/patch-mojo_core_embedder_features.h b/electron34/patches/patch-mojo_core_embedder_features.h
new file mode 100644
index 0000000000..affdd3e228
--- /dev/null
+++ b/electron34/patches/patch-mojo_core_embedder_features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/core/embedder/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/core/embedder/features.h
+@@ -16,7 +16,7 @@ namespace core {
+
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL) && \
+ !BUILDFLAG(MOJO_USE_APPLE_CHANNEL)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(MOJO_CORE_EMBEDDER_FEATURES)
+ BASE_DECLARE_FEATURE(kMojoLinuxChannelSharedMem);
+
diff --git a/electron34/patches/patch-mojo_core_ipcz__driver_transport.cc b/electron34/patches/patch-mojo_core_ipcz__driver_transport.cc
new file mode 100644
index 0000000000..f181870e52
--- /dev/null
+++ b/electron34/patches/patch-mojo_core_ipcz__driver_transport.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/core/ipcz_driver/transport.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/core/ipcz_driver/transport.cc
+@@ -34,6 +34,7 @@
+ #include "third_party/ipcz/include/ipcz/ipcz.h"
+
+ #if BUILDFLAG(IS_WIN)
++#include "base/win/win_util.h"
+ #include "mojo/public/cpp/platform/platform_handle_security_util_win.h"
+ #endif
+
+@@ -135,10 +136,12 @@ bool EncodeHandle(PlatformHandle& handle
+ HandleOwner handle_owner,
+ HandleData& out_handle_data,
+ bool is_remote_process_untrusted) {
++ CHECK(handle.is_valid());
+ // Duplicating INVALID_HANDLE_VALUE passes a process handle. If you intend to
+ // do this, you must open a valid process handle, not pass the result of
+- // GetCurrentProcess(). e.g. https://crbug.com/243339.
+- CHECK(handle.is_valid());
++ // GetCurrentProcess() or GetCurrentThread(). e.g. https://crbug.com/243339.
++ CHECK(!handle.is_pseudo_handle());
++
+ if (handle_owner == HandleOwner::kSender) {
+ // Nothing to do when sending handles that belong to us. The recipient must
+ // be sufficiently privileged and equipped to duplicate such handles to
+@@ -178,6 +181,10 @@ PlatformHandle DecodeHandle(HandleData d
+ HandleOwner handle_owner,
+ Transport& from_transport) {
+ const HANDLE handle = DataToHandle(data);
++ // Do not decode sentinel values used by Windows (INVALID_HANDLE_VALUE &
++ // GetCurrentThread()).
++ CHECK(!base::win::IsPseudoHandle(handle));
++
+ if (handle_owner == HandleOwner::kRecipient) {
+ if (from_transport.destination_type() != Transport::kBroker &&
+ !from_transport.is_peer_trusted() && !remote_process.is_current()) {
diff --git a/electron34/patches/patch-mojo_core_platform__handle__in__transit.cc b/electron34/patches/patch-mojo_core_platform__handle__in__transit.cc
new file mode 100644
index 0000000000..08096c0f77
--- /dev/null
+++ b/electron34/patches/patch-mojo_core_platform__handle__in__transit.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/core/platform_handle_in_transit.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/core/platform_handle_in_transit.cc
+@@ -18,6 +18,7 @@
+
+ #include "base/win/nt_status.h"
+ #include "base/win/scoped_handle.h"
++#include "base/win/win_util.h"
+ #include "mojo/public/cpp/platform/platform_handle_security_util_win.h"
+ #endif
+
+@@ -37,8 +38,8 @@ HANDLE TransferHandle(HANDLE handle,
+
+ // Duplicating INVALID_HANDLE_VALUE passes a process handle. If you intend to
+ // do this, you must open a valid process handle, not pass the result of
+- // GetCurrentProcess(). e.g. https://crbug.com/243339.
+- CHECK(handle != INVALID_HANDLE_VALUE);
++ // GetCurrentProcess() or GetCurrentThread(). e.g. https://crbug.com/243339.
++ CHECK(!base::win::IsPseudoHandle(handle));
+
+ HANDLE out_handle;
+ BOOL result =
+@@ -164,17 +165,7 @@ bool PlatformHandleInTransit::TransferTo
+ #if BUILDFLAG(IS_WIN)
+ // static
+ bool PlatformHandleInTransit::IsPseudoHandle(HANDLE handle) {
+- // Note that there appears to be no official documentation covering the
+- // existence of specific pseudo handle values. In practice it's clear that
+- // e.g. -1 is the current process, -2 is the current thread, etc. The largest
+- // negative value known to be an issue with DuplicateHandle in the fuzzer is
+- // -12.
+- //
+- // Note that there is virtually no risk of a real handle value falling within
+- // this range and being misclassified as a pseudo handle.
+- constexpr int kMinimumKnownPseudoHandleValue = -12;
+- const auto value = static_cast<int32_t>(reinterpret_cast<uintptr_t>(handle));
+- return value < 0 && value >= kMinimumKnownPseudoHandleValue;
++ return base::win::IsPseudoHandle(handle);
+ }
+
+ // static
diff --git a/electron34/patches/patch-mojo_public_cpp_platform_platform__handle.h b/electron34/patches/patch-mojo_public_cpp_platform_platform__handle.h
new file mode 100644
index 0000000000..54a56f9c2c
--- /dev/null
+++ b/electron34/patches/patch-mojo_public_cpp_platform_platform__handle.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/public/cpp/platform/platform_handle.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/public/cpp/platform/platform_handle.h
+@@ -13,6 +13,7 @@
+
+ #if BUILDFLAG(IS_WIN)
+ #include "base/win/scoped_handle.h"
++#include "base/win/win_util.h"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include <lib/zx/handle.h>
+ #elif BUILDFLAG(IS_APPLE)
+@@ -117,6 +118,9 @@ class COMPONENT_EXPORT(MOJO_CPP_PLATFORM
+ bool is_valid() const { return is_valid_handle(); }
+ bool is_valid_handle() const { return handle_.IsValid(); }
+ bool is_handle() const { return type_ == Type::kHandle; }
++ bool is_pseudo_handle() const {
++ return base::win::IsPseudoHandle(handle_.get());
++ }
+ const base::win::ScopedHandle& GetHandle() const { return handle_; }
+ base::win::ScopedHandle TakeHandle() {
+ DCHECK_EQ(type_, Type::kHandle);
diff --git a/electron34/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc b/electron34/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc
new file mode 100644
index 0000000000..bd44d11069
--- /dev/null
+++ b/electron34/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/public/cpp/platform/socket_utils_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/public/cpp/platform/socket_utils_posix.cc
+@@ -34,7 +34,7 @@ bool IsRecoverableError() {
+ }
+
+ bool GetPeerEuid(base::PlatformFile fd, uid_t* peer_euid) {
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ uid_t socket_euid;
+ gid_t socket_gid;
+ if (getpeereid(fd, &socket_euid, &socket_gid) < 0) {
diff --git a/electron34/patches/patch-mojo_public_tools_bindings_mojom.gni b/electron34/patches/patch-mojo_public_tools_bindings_mojom.gni
new file mode 100644
index 0000000000..37da4e8c84
--- /dev/null
+++ b/electron34/patches/patch-mojo_public_tools_bindings_mojom.gni
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- mojo/public/tools/bindings/mojom.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ mojo/public/tools/bindings/mojom.gni
+@@ -791,6 +791,26 @@ template("mojom") {
+ enabled_features += [ "is_apple" ]
+ }
+
++ if (is_openbsd) {
++ enabled_features += [ "is_openbsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
++ if (is_netbsd) {
++ enabled_features += [ "is_netbsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
++ if (is_netbsd) {
++ enabled_features += [ "is_netbsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
++ if (is_freebsd) {
++ enabled_features += [ "is_freebsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
+ action(parser_target_name) {
+ allow_remote = true
+
diff --git a/electron34/patches/patch-net_BUILD.gn b/electron34/patches/patch-net_BUILD.gn
new file mode 100644
index 0000000000..4aa52f3543
--- /dev/null
+++ b/electron34/patches/patch-net_BUILD.gn
@@ -0,0 +1,101 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/BUILD.gn
+@@ -126,7 +126,7 @@ net_configs = [
+ "//build/config/compiler:wexit_time_destructors",
+ ]
+
+-if (is_linux || is_chromeos) {
++if ((is_linux || is_chromeos) && !is_bsd) {
+ net_configs += [ "//build/config/linux:libresolv" ]
+ }
+
+@@ -1293,6 +1293,19 @@ component("net") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [
++ "base/address_map_cache_linux.cc",
++ "base/address_map_cache_linux.h",
++ "base/address_map_linux.cc",
++ "base/address_map_linux.h",
++ "base/address_tracker_linux.cc",
++ "base/address_tracker_linux.h",
++ "base/network_change_notifier_linux.cc",
++ "base/network_interfaces_linux.cc",
++ ]
++ }
++
+ if (is_mac) {
+ sources += [
+ "base/network_notification_thread_mac.cc",
+@@ -1456,7 +1469,7 @@ component("net") {
+ }
+
+ # Use getifaddrs() on POSIX platforms, except Linux.
+- if (is_posix && !is_linux && !is_chromeos) {
++ if ((is_posix && !is_linux && !is_chromeos) || is_bsd) {
+ sources += [
+ "base/network_interfaces_getifaddrs.cc",
+ "base/network_interfaces_getifaddrs.h",
+@@ -2138,7 +2151,7 @@ static_library("test_support") {
+ ]
+ }
+
+- if (is_linux || is_chromeos || is_android) {
++ if ((is_linux || is_chromeos || is_android) && !is_bsd) {
+ sources += [
+ "base/address_tracker_linux_test_util.cc",
+ "base/address_tracker_linux_test_util.h",
+@@ -2948,14 +2961,14 @@ target(_test_target_type, "net_unittests
+ ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ sources += [
+ "base/network_change_notifier_linux_unittest.cc",
+ "proxy_resolution/proxy_config_service_linux_unittest.cc",
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "base/address_tracker_linux_unittest.cc",
+ "base/network_interfaces_linux_unittest.cc",
+@@ -3048,6 +3061,10 @@ target(_test_target_type, "net_unittests
+ ]
+ }
+
++ if (is_bsd) {
++ deps += [ "//sandbox/policy" ]
++ }
++
+ if (enable_websockets) {
+ sources += [
+ "server/http_connection_unittest.cc",
+@@ -3114,7 +3131,7 @@ target(_test_target_type, "net_unittests
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "tools/quic/quic_simple_server_test.cc" ]
+ }
+
+@@ -3253,7 +3270,7 @@ target(_test_target_type, "net_unittests
+ }
+
+ # Use getifaddrs() on POSIX platforms, except Linux.
+- if (is_posix && !is_linux && !is_chromeos) {
++ if (is_posix && !is_linux && !is_chromeos && !is_bsd) {
+ sources += [ "base/network_interfaces_getifaddrs_unittest.cc" ]
+ }
+
diff --git a/electron34/patches/patch-net_base_features.cc b/electron34/patches/patch-net_base_features.cc
new file mode 100644
index 0000000000..fa56c77016
--- /dev/null
+++ b/electron34/patches/patch-net_base_features.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/features.cc
+@@ -26,7 +26,7 @@ BASE_FEATURE(kCapReferrerToOriginOnCross
+ BASE_FEATURE(kAsyncDns,
+ "AsyncDns",
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -528,7 +528,12 @@ BASE_FEATURE(kSpdyHeadersToHttpResponseU
+ "SpdyHeadersToHttpResponseUseBuilder",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++// No IP_RECVTOS support
+ BASE_FEATURE(kReportEcn, "ReportEcn", base::FEATURE_DISABLED_BY_DEFAULT);
++#else
++BASE_FEATURE(kReportEcn, "ReportEcn", base::FEATURE_DISABLED_BY_DEFAULT);
++#endif
+
+ BASE_FEATURE(kUseNewAlpsCodepointHttp2,
+ "UseNewAlpsCodepointHttp2",
diff --git a/electron34/patches/patch-net_base_mock__network__change__notifier.cc b/electron34/patches/patch-net_base_mock__network__change__notifier.cc
new file mode 100644
index 0000000000..45e45e42bb
--- /dev/null
+++ b/electron34/patches/patch-net_base_mock__network__change__notifier.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/mock_network_change_notifier.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/mock_network_change_notifier.cc
+@@ -103,7 +103,7 @@ MockNetworkChangeNotifier::GetCurrentCon
+ return connection_cost_;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ AddressMapOwnerLinux* MockNetworkChangeNotifier::GetAddressMapOwnerInternal() {
+ return address_map_owner_;
+ }
diff --git a/electron34/patches/patch-net_base_mock__network__change__notifier.h b/electron34/patches/patch-net_base_mock__network__change__notifier.h
new file mode 100644
index 0000000000..40284f1cdb
--- /dev/null
+++ b/electron34/patches/patch-net_base_mock__network__change__notifier.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/mock_network_change_notifier.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/mock_network_change_notifier.h
+@@ -84,7 +84,7 @@ class MockNetworkChangeNotifier : public
+ // use_default_connection_cost_implementation is set to true.
+ ConnectionCost GetCurrentConnectionCost() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetAddressMapOwnerLinux(AddressMapOwnerLinux* address_map_owner) {
+ address_map_owner_ = address_map_owner;
+ }
+@@ -104,7 +104,7 @@ class MockNetworkChangeNotifier : public
+ bool use_default_connection_cost_implementation_ = false;
+ NetworkChangeNotifier::NetworkList connected_networks_;
+ std::unique_ptr<SystemDnsConfigChangeNotifier> dns_config_notifier_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ raw_ptr<AddressMapOwnerLinux> address_map_owner_ = nullptr;
+ #endif
+ };
diff --git a/electron34/patches/patch-net_base_network__change__notifier.cc b/electron34/patches/patch-net_base_network__change__notifier.cc
new file mode 100644
index 0000000000..83313fdeeb
--- /dev/null
+++ b/electron34/patches/patch-net_base_network__change__notifier.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/network_change_notifier.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/network_change_notifier.cc
+@@ -37,7 +37,7 @@
+ #include "net/base/network_change_notifier_linux.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "net/base/network_change_notifier_apple.h"
+-#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "net/base/network_change_notifier_passive.h"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include "net/base/network_change_notifier_fuchsia.h"
+@@ -324,6 +324,9 @@ std::unique_ptr<NetworkChangeNotifier> N
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return std::make_unique<NetworkChangeNotifierFuchsia>(
+ /*require_wlan=*/false);
++#elif BUILDFLAG(IS_BSD)
++ return std::make_unique<MockNetworkChangeNotifier>(
++ /*dns_config_notifier*/nullptr);
+ #else
+ NOTIMPLEMENTED();
+ return nullptr;
+@@ -520,7 +523,7 @@ base::cstring_view NetworkChangeNotifier
+ return kConnectionTypeNames[type];
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ AddressMapOwnerLinux* NetworkChangeNotifier::GetAddressMapOwner() {
+ return g_network_change_notifier
+@@ -866,7 +869,7 @@ NetworkChangeNotifier::NetworkChangeNoti
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ AddressMapOwnerLinux* NetworkChangeNotifier::GetAddressMapOwnerInternal() {
+ return nullptr;
+ }
diff --git a/electron34/patches/patch-net_base_network__change__notifier.h b/electron34/patches/patch-net_base_network__change__notifier.h
new file mode 100644
index 0000000000..0b0fbf4a07
--- /dev/null
+++ b/electron34/patches/patch-net_base_network__change__notifier.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/network_change_notifier.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/network_change_notifier.h
+@@ -19,7 +19,7 @@
+ #include "net/base/net_export.h"
+ #include "net/base/network_handle.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "net/base/address_map_linux.h"
+ #endif
+
+@@ -460,7 +460,7 @@ class NET_EXPORT NetworkChangeNotifier {
+ // packets sent lazily.
+ static bool IsDefaultNetworkActive();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Returns the AddressTrackerLinux if present.
+ static AddressMapOwnerLinux* GetAddressMapOwner();
+ #endif
+@@ -630,7 +630,7 @@ class NET_EXPORT NetworkChangeNotifier {
+ SystemDnsConfigChangeNotifier* system_dns_config_notifier = nullptr,
+ bool omit_observers_in_constructor_for_testing = false);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Returns the AddressMapOwnerLinux if present.
+ virtual AddressMapOwnerLinux* GetAddressMapOwnerInternal();
+ #endif
diff --git a/electron34/patches/patch-net_base_network__change__notifier__passive.cc b/electron34/patches/patch-net_base_network__change__notifier__passive.cc
new file mode 100644
index 0000000000..ef90f19fd2
--- /dev/null
+++ b/electron34/patches/patch-net_base_network__change__notifier__passive.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/network_change_notifier_passive.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/network_change_notifier_passive.cc
+@@ -107,7 +107,7 @@ NetworkChangeNotifierPassive::GetAddress
+ NetworkChangeNotifier::NetworkChangeCalculatorParams
+ NetworkChangeNotifierPassive::NetworkChangeCalculatorParamsPassive() {
+ NetworkChangeCalculatorParams params;
+-#if BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Delay values arrived at by simple experimentation and adjusted so as to
+ // produce a single signal when switching between network connections.
+ params.ip_address_offline_delay_ = base::Milliseconds(4000);
diff --git a/electron34/patches/patch-net_base_network__interfaces__posix.h b/electron34/patches/patch-net_base_network__interfaces__posix.h
new file mode 100644
index 0000000000..a0c6e93d7d
--- /dev/null
+++ b/electron34/patches/patch-net_base_network__interfaces__posix.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/network_interfaces_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/network_interfaces_posix.h
+@@ -8,6 +8,8 @@
+ // This file provides some basic functionality shared between
+ // network_interfaces_linux.cc and network_interfaces_getifaddrs.cc.
+
++#include <sys/socket.h>
++
+ #include <string>
+
+ struct sockaddr;
diff --git a/electron34/patches/patch-net_base_sockaddr__util__posix.cc b/electron34/patches/patch-net_base_sockaddr__util__posix.cc
new file mode 100644
index 0000000000..d740d7c983
--- /dev/null
+++ b/electron34/patches/patch-net_base_sockaddr__util__posix.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/sockaddr_util_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/sockaddr_util_posix.cc
+@@ -46,7 +46,8 @@ bool FillUnixAddress(const std::string&
+ return true;
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++ // XXX ?
+ // Convert the path given into abstract socket name. It must start with
+ // the '\0' character, so we are adding it. |addr_len| must specify the
+ // length of the structure exactly, as potentially the socket name may
diff --git a/electron34/patches/patch-net_base_sockaddr__util__posix__unittest.cc b/electron34/patches/patch-net_base_sockaddr__util__posix__unittest.cc
new file mode 100644
index 0000000000..1633d4d160
--- /dev/null
+++ b/electron34/patches/patch-net_base_sockaddr__util__posix__unittest.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/base/sockaddr_util_posix_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/base/sockaddr_util_posix_unittest.cc
+@@ -88,7 +88,8 @@ TEST(FillUnixAddressTest, AbstractLinuxA
+ size_t path_max = MaxPathLength(&storage);
+ std::string path(path_max, '0');
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
++ // XXX?
+ EXPECT_TRUE(FillUnixAddress(path, /*use_abstract_namespace=*/true, &storage));
+
+ EXPECT_EQ(path.size() + 1U + offsetof(struct sockaddr_un, sun_path),
diff --git a/electron34/patches/patch-net_cert_cert__verify__proc.h b/electron34/patches/patch-net_cert_cert__verify__proc.h
new file mode 100644
index 0000000000..7ed0508642
--- /dev/null
+++ b/electron34/patches/patch-net_cert_cert__verify__proc.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/cert/cert_verify_proc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/cert/cert_verify_proc.h
+@@ -186,7 +186,7 @@ class NET_EXPORT CertVerifyProc
+ kMaxValue = kChainLengthOne
+ };
+
+-#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(CHROME_ROOT_STORE_ONLY))
+ // Creates and returns a CertVerifyProc that uses the system verifier.
+ // |cert_net_fetcher| may not be used, depending on the implementation.
diff --git a/electron34/patches/patch-net_disk__cache_backend__experiment.h b/electron34/patches/patch-net_disk__cache_backend__experiment.h
new file mode 100644
index 0000000000..a181bde2e7
--- /dev/null
+++ b/electron34/patches/patch-net_disk__cache_backend__experiment.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/disk_cache/backend_experiment.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/disk_cache/backend_experiment.h
+@@ -14,7 +14,7 @@ namespace disk_cache {
+ // default.
+ constexpr bool IsSimpleBackendEnabledByDefaultPlatform() {
+ return BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) ||
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC);
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD);
+ }
+
+ // True if assigned to any of disk cache backend experiment groups.
diff --git a/electron34/patches/patch-net_disk__cache_simple_simple__file__tracker.cc b/electron34/patches/patch-net_disk__cache_simple_simple__file__tracker.cc
new file mode 100644
index 0000000000..a12b85513d
--- /dev/null
+++ b/electron34/patches/patch-net_disk__cache_simple_simple__file__tracker.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/disk_cache/simple/simple_file_tracker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/disk_cache/simple/simple_file_tracker.cc
+@@ -35,7 +35,17 @@ void RecordFileDescripterLimiterOp(FileD
+ } // namespace
+
+ SimpleFileTracker::SimpleFileTracker(int file_limit)
++#if defined(OS_OPENBSD)
++{
++ // cap the file descriptor limit at 85% of the size of the
++ // file descriptor table and also substract the amount of
++ // currently used file descriptors as this should give us
++ // enough reserve to avoid hitting the limit
++ file_limit_ = (getdtablesize() * 0.85) - getdtablecount();
++}
++#else
+ : file_limit_(file_limit) {}
++#endif
+
+ SimpleFileTracker::~SimpleFileTracker() {
+ DCHECK(lru_.empty());
diff --git a/electron34/patches/patch-net_dns_BUILD.gn b/electron34/patches/patch-net_dns_BUILD.gn
new file mode 100644
index 0000000000..7d6a639599
--- /dev/null
+++ b/electron34/patches/patch-net_dns_BUILD.gn
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/BUILD.gn
+@@ -138,7 +138,7 @@ source_set("dns") {
+ "dns_config_service_android.cc",
+ "dns_config_service_android.h",
+ ]
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
+ sources += [
+ "dns_config_service_linux.cc",
+ "dns_config_service_linux.h",
+@@ -171,7 +171,10 @@ source_set("dns") {
+ ]
+ }
+
+- deps = [ "//net:net_deps" ]
++ deps = [
++ "//net:net_deps",
++ "///services/screen_ai/buildflags",
++ ]
+
+ public_deps = [
+ ":dns_client",
+@@ -179,6 +182,7 @@ source_set("dns") {
+ ":host_resolver_manager",
+ ":mdns_client",
+ "//net:net_public_deps",
++ "//printing/buildflags",
+ ]
+
+ allow_circular_includes_from = [
+@@ -187,6 +191,8 @@ source_set("dns") {
+ ":host_resolver_manager",
+ ":mdns_client",
+ ]
++
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ # The standard API of net/dns.
+@@ -447,9 +453,9 @@ source_set("tests") {
+
+ if (is_android) {
+ sources += [ "dns_config_service_android_unittest.cc" ]
+- } else if (is_linux) {
++ } else if (is_linux && !is_bsd) {
+ sources += [ "dns_config_service_linux_unittest.cc" ]
+- } else if (is_posix) {
++ } else if (is_posix && !is_bsd) {
+ sources += [ "dns_config_service_posix_unittest.cc" ]
+ }
+
diff --git a/electron34/patches/patch-net_dns_address__info.cc b/electron34/patches/patch-net_dns_address__info.cc
new file mode 100644
index 0000000000..c98ad1f9ec
--- /dev/null
+++ b/electron34/patches/patch-net_dns_address__info.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/address_info.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/address_info.cc
+@@ -83,8 +83,12 @@ AddressInfo::AddressInfoAndResult Addres
+ // error.
+ // http://crbug.com/134142
+ err = ERR_NAME_NOT_RESOLVED;
+-#elif BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_FREEBSD)
++#elif BUILDFLAG(IS_POSIX)
++#ifdef EAI_NODATA
+ if (os_error != EAI_NONAME && os_error != EAI_NODATA)
++#else
++ if (os_error != EAI_NONAME)
++#endif
+ err = ERR_NAME_RESOLUTION_FAILED;
+ #endif
+
diff --git a/electron34/patches/patch-net_dns_address__sorter__posix.cc b/electron34/patches/patch-net_dns_address__sorter__posix.cc
new file mode 100644
index 0000000000..b630768b78
--- /dev/null
+++ b/electron34/patches/patch-net_dns_address__sorter__posix.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/address_sorter_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/address_sorter_posix.cc
+@@ -32,6 +32,7 @@
+ #include "net/dns/netinet_in_var_ios.h"
+ #else
+ #include <netinet/in_var.h>
++#include <netinet6/in6_var.h>
+ #endif // BUILDFLAG(IS_IOS)
+ #endif
+ #include <vector>
diff --git a/electron34/patches/patch-net_dns_dns__config__service__posix.cc b/electron34/patches/patch-net_dns_dns__config__service__posix.cc
new file mode 100644
index 0000000000..14dcc48836
--- /dev/null
+++ b/electron34/patches/patch-net_dns_dns__config__service__posix.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/dns_config_service_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/dns_config_service_posix.cc
+@@ -28,6 +28,7 @@
+ #include "base/threading/scoped_blocking_call.h"
+ #include "base/time/time.h"
+ #include "build/build_config.h"
++#include "electron/mas.h"
+ #include "net/base/ip_endpoint.h"
+ #include "net/dns/dns_config.h"
+ #include "net/dns/dns_hosts.h"
+@@ -39,6 +40,11 @@
+ #include "net/dns/dns_config_watcher_mac.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "base/command_line.h"
++#include "sandbox/policy/switches.h"
++#endif
++
+ namespace net {
+
+ namespace internal {
+@@ -136,7 +142,13 @@ class DnsConfigServicePosix::Watcher : p
+ bool Watch() override {
+ CheckOnCorrectSequence();
+
++// pledge + unveil
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ if (!command_line->HasSwitch(sandbox::policy::switches::kNoSandbox))
++ return false;
++
+ bool success = true;
++#if !IS_MAS_BUILD()
+ if (!config_watcher_.Watch(base::BindRepeating(&Watcher::OnConfigChanged,
+ base::Unretained(this)))) {
+ LOG(ERROR) << "DNS config watch failed to start.";
+@@ -153,6 +165,7 @@ class DnsConfigServicePosix::Watcher : p
+ success = false;
+ }
+ #endif // !BUILDFLAG(IS_IOS)
++#endif
+ return success;
+ }
+
diff --git a/electron34/patches/patch-net_dns_dns__reloader.cc b/electron34/patches/patch-net_dns_dns__reloader.cc
new file mode 100644
index 0000000000..1ff9d715ec
--- /dev/null
+++ b/electron34/patches/patch-net_dns_dns__reloader.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/dns_reloader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/dns_reloader.cc
+@@ -10,6 +10,7 @@
+ // - there's not guarantee it exists at all. :(
+ #if BUILDFLAG(IS_POSIX)
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ // This code only works on systems where the C library provides res_ninit(3) and
+@@ -31,7 +32,7 @@
+ // an old musl bug that was fixed by musl c8fdcfe5, but Fuchsia's SDK doesn't
+ // have that change.
+ #if defined(__RES) && __RES >= 19991006 && !BUILDFLAG(IS_APPLE) && \
+- !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA)
++ !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_FUCHSIA) && !BUILDFLAG(IS_NETBSD)
+ // We define this so we don't need to restate the complex condition here twice
+ // below - it would be easy for the copies below to get out of sync.
+ #define USE_RES_NINIT
diff --git a/electron34/patches/patch-net_dns_dns__util.cc b/electron34/patches/patch-net_dns_dns__util.cc
new file mode 100644
index 0000000000..e51564fdc6
--- /dev/null
+++ b/electron34/patches/patch-net_dns_dns__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/dns_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/dns_util.cc
+@@ -29,6 +29,8 @@
+ #include "net/dns/public/util.h"
+ #include "net/third_party/uri_template/uri_template.h"
+
++#include <sys/socket.h>
++
+ #if BUILDFLAG(IS_POSIX)
+ #include <net/if.h>
+ #include <netinet/in.h>
diff --git a/electron34/patches/patch-net_dns_host__resolver__proc.cc b/electron34/patches/patch-net_dns_host__resolver__proc.cc
new file mode 100644
index 0000000000..2ee3b5bc9d
--- /dev/null
+++ b/electron34/patches/patch-net_dns_host__resolver__proc.cc
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/host_resolver_proc.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/host_resolver_proc.cc
+@@ -15,10 +15,6 @@
+ #include "net/base/net_errors.h"
+ #include "net/dns/host_resolver_system_task.h"
+
+-#if BUILDFLAG(IS_OPENBSD)
+-#define AI_ADDRCONFIG 0
+-#endif
+-
+ namespace net {
+
+ HostResolverProc* HostResolverProc::default_proc_ = nullptr;
diff --git a/electron34/patches/patch-net_dns_public_BUILD.gn b/electron34/patches/patch-net_dns_public_BUILD.gn
new file mode 100644
index 0000000000..db8016ab6d
--- /dev/null
+++ b/electron34/patches/patch-net_dns_public_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/public/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/public/BUILD.gn
+@@ -78,7 +78,7 @@ source_set("tests") {
+ "doh_provider_entry_unittest.cc",
+ ]
+
+- if (is_posix && !is_android) {
++ if (is_posix && !is_android && !is_bsd) {
+ sources += [ "resolv_reader_unittest.cc" ]
+ }
+
diff --git a/electron34/patches/patch-net_dns_public_resolv__reader.cc b/electron34/patches/patch-net_dns_public_resolv__reader.cc
new file mode 100644
index 0000000000..3d37e9be8e
--- /dev/null
+++ b/electron34/patches/patch-net_dns_public_resolv__reader.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/public/resolv_reader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/public/resolv_reader.cc
+@@ -40,7 +40,7 @@ std::optional<std::vector<IPEndPoint>> G
+ if (!(res.options & RES_INIT))
+ return std::nullopt;
+
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ union res_sockaddr_union addresses[MAXNS];
+ int nscount = res_getservers(const_cast<res_state>(&res), addresses, MAXNS);
+ DCHECK_GE(nscount, 0);
diff --git a/electron34/patches/patch-net_dns_public_resolv__reader.h b/electron34/patches/patch-net_dns_public_resolv__reader.h
new file mode 100644
index 0000000000..99f1c3507f
--- /dev/null
+++ b/electron34/patches/patch-net_dns_public_resolv__reader.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/public/resolv_reader.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/public/resolv_reader.h
+@@ -5,6 +5,7 @@
+ #ifndef NET_DNS_PUBLIC_RESOLV_READER_H_
+ #define NET_DNS_PUBLIC_RESOLV_READER_H_
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ #include <memory>
diff --git a/electron34/patches/patch-net_dns_public_scoped__res__state.cc b/electron34/patches/patch-net_dns_public_scoped__res__state.cc
new file mode 100644
index 0000000000..0bc628b9dc
--- /dev/null
+++ b/electron34/patches/patch-net_dns_public_scoped__res__state.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/public/scoped_res_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/public/scoped_res_state.cc
+@@ -28,7 +28,7 @@ ScopedResState::~ScopedResState() {
+ #if !BUILDFLAG(IS_OPENBSD) && !BUILDFLAG(IS_FUCHSIA)
+
+ // Prefer res_ndestroy where available.
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ res_ndestroy(&res_);
+ #else
+ res_nclose(&res_);
diff --git a/electron34/patches/patch-net_dns_public_scoped__res__state.h b/electron34/patches/patch-net_dns_public_scoped__res__state.h
new file mode 100644
index 0000000000..97c4d72e25
--- /dev/null
+++ b/electron34/patches/patch-net_dns_public_scoped__res__state.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/dns/public/scoped_res_state.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/dns/public/scoped_res_state.h
+@@ -5,6 +5,7 @@
+ #ifndef NET_DNS_PUBLIC_SCOPED_RES_STATE_H_
+ #define NET_DNS_PUBLIC_SCOPED_RES_STATE_H_
+
++#include <netinet/in.h>
+ #include <resolv.h>
+
+ #include <optional>
diff --git a/electron34/patches/patch-net_filter_zstd__source__stream.cc b/electron34/patches/patch-net_filter_zstd__source__stream.cc
new file mode 100644
index 0000000000..f74ed709d1
--- /dev/null
+++ b/electron34/patches/patch-net_filter_zstd__source__stream.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/filter/zstd_source_stream.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/filter/zstd_source_stream.cc
+@@ -7,6 +7,7 @@
+ #include <algorithm>
+ #include <unordered_map>
+ #include <utility>
++#include <unordered_map>
+
+ #define ZSTD_STATIC_LINKING_ONLY
+
diff --git a/electron34/patches/patch-net_http_http__auth__gssapi__posix.cc b/electron34/patches/patch-net_http_http__auth__gssapi__posix.cc
new file mode 100644
index 0000000000..9893f96f52
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__auth__gssapi__posix.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_auth_gssapi_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_auth_gssapi_posix.cc
+@@ -375,8 +375,9 @@ base::NativeLibrary GSSAPISharedLibrary:
+ static const char* const kDefaultLibraryNames[] = {
+ #if BUILDFLAG(IS_APPLE)
+ "/System/Library/Frameworks/GSS.framework/GSS"
+-#elif BUILDFLAG(IS_OPENBSD)
+- "libgssapi.so" // Heimdal - OpenBSD
++#elif BUILDFLAG(IS_BSD)
++ "libgssapi_krb5.so.2", // MIT Kerberos - FreeBSD
++ "libgssapi.so" // Heimdal - OpenBSD, FreeBSD
+ #else
+ "libgssapi_krb5.so.2", // MIT Kerberos - FC, Suse10, Debian
+ "libgssapi.so.4", // Heimdal - Suse10, MDK
diff --git a/electron34/patches/patch-net_http_http__auth__gssapi__posix.h b/electron34/patches/patch-net_http_http__auth__gssapi__posix.h
new file mode 100644
index 0000000000..9462285e98
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__auth__gssapi__posix.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_auth_gssapi_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_auth_gssapi_posix.h
+@@ -21,6 +21,9 @@
+ #if BUILDFLAG(IS_APPLE)
+ #include <GSS/gssapi.h>
+ #elif BUILDFLAG(IS_FREEBSD)
++#ifndef GSS_C_DELEG_POLICY_FLAG
++#define GSS_C_DELEG_POLICY_FLAG 32768
++#endif
+ #include <gssapi/gssapi.h>
+ #else
+ #include <gssapi.h>
diff --git a/electron34/patches/patch-net_http_http__auth__handler__negotiate.cc b/electron34/patches/patch-net_http_http__auth__handler__negotiate.cc
new file mode 100644
index 0000000000..3e70e8c549
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__auth__handler__negotiate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_auth_handler_negotiate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_auth_handler_negotiate.cc
+@@ -120,7 +120,7 @@ int HttpAuthHandlerNegotiate::Factory::C
+ #elif BUILDFLAG(IS_POSIX)
+ if (is_unsupported_)
+ return ERR_UNSUPPORTED_AUTH_SCHEME;
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Note: Don't set is_unsupported_ = true here. AllowGssapiLibraryLoad()
+ // might change to true during a session.
+ if (!http_auth_preferences() ||
diff --git a/electron34/patches/patch-net_http_http__auth__preferences.cc b/electron34/patches/patch-net_http_http__auth__preferences.cc
new file mode 100644
index 0000000000..46c3f51e10
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__auth__preferences.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_auth_preferences.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_auth_preferences.cc
+@@ -39,7 +39,7 @@ std::string HttpAuthPreferences::AuthAnd
+ }
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool HttpAuthPreferences::AllowGssapiLibraryLoad() const {
+ return allow_gssapi_library_load_;
+ }
diff --git a/electron34/patches/patch-net_http_http__auth__preferences.h b/electron34/patches/patch-net_http_http__auth__preferences.h
new file mode 100644
index 0000000000..c96d7a9a4c
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__auth__preferences.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_auth_preferences.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_auth_preferences.h
+@@ -50,7 +50,7 @@ class NET_EXPORT HttpAuthPreferences {
+ #if BUILDFLAG(IS_ANDROID)
+ virtual std::string AuthAndroidNegotiateAccountType() const;
+ #endif
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ virtual bool AllowGssapiLibraryLoad() const;
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ virtual bool CanUseDefaultCredentials(
+@@ -86,7 +86,7 @@ class NET_EXPORT HttpAuthPreferences {
+ }
+ #endif // BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void set_allow_gssapi_library_load(bool allow_gssapi_library_load) {
+ allow_gssapi_library_load_ = allow_gssapi_library_load;
+ }
+@@ -137,7 +137,7 @@ class NET_EXPORT HttpAuthPreferences {
+ std::string auth_android_negotiate_account_type_;
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool allow_gssapi_library_load_ = true;
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-net_http_http__network__session.cc b/electron34/patches/patch-net_http_http__network__session.cc
new file mode 100644
index 0000000000..e295eaec9a
--- /dev/null
+++ b/electron34/patches/patch-net_http_http__network__session.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/http/http_network_session.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/http/http_network_session.cc
+@@ -20,7 +20,9 @@
+ #include "build/build_config.h"
+ #include "net/base/features.h"
+ #include "net/dns/host_resolver.h"
++#if defined(USE_KERBEROS)
+ #include "net/http/http_auth_handler_factory.h"
++#endif
+ #include "net/http/http_response_body_drainer.h"
+ #include "net/http/http_stream_factory.h"
+ #include "net/http/http_stream_pool.h"
diff --git a/electron34/patches/patch-net_proxy__resolution_proxy__config__service.cc b/electron34/patches/patch-net_proxy__resolution_proxy__config__service.cc
new file mode 100644
index 0000000000..764a5a480e
--- /dev/null
+++ b/electron34/patches/patch-net_proxy__resolution_proxy__config__service.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/proxy_resolution/proxy_config_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/proxy_resolution/proxy_config_service.cc
+@@ -19,20 +19,20 @@
+ #include "net/proxy_resolution/proxy_config_service_ios.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "net/proxy_resolution/proxy_config_service_mac.h"
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/proxy_resolution/proxy_config_service_linux.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "net/proxy_resolution/proxy_config_service_android.h"
+ #endif
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/traffic_annotation/network_traffic_annotation.h"
+ #endif
+
+ namespace net {
+
+ namespace {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr net::NetworkTrafficAnnotationTag kSystemProxyConfigTrafficAnnotation =
+ net::DefineNetworkTrafficAnnotation("proxy_config_system", R"(
+ semantics {
+@@ -108,7 +108,7 @@ ProxyConfigService::CreateSystemProxyCon
+ << "profile_io_data.cc::CreateProxyConfigService and this should "
+ << "be used only for examples.";
+ return std::make_unique<UnsetProxyConfigService>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<ProxyConfigServiceLinux> linux_config_service(
+ std::make_unique<ProxyConfigServiceLinux>());
+
diff --git a/electron34/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc b/electron34/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc
new file mode 100644
index 0000000000..7360c1c999
--- /dev/null
+++ b/electron34/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/proxy_resolution/proxy_config_service_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/proxy_resolution/proxy_config_service_linux.cc
+@@ -11,7 +11,9 @@
+
+ #include <errno.h>
+ #include <limits.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/inotify.h>
++#endif
+ #include <unistd.h>
+
+ #include <map>
+@@ -510,6 +512,7 @@ bool SettingGetterImplGSettings::CheckVe
+ }
+ #endif // defined(USE_GIO)
+
++#if !BUILDFLAG(IS_BSD)
+ // Converts |value| from a decimal string to an int. If there was a failure
+ // parsing, returns |default_value|.
+ int StringToIntOrDefault(std::string_view value, int default_value) {
+@@ -1038,6 +1041,7 @@ class SettingGetterImplKDE : public Prox
+ // events on.
+ scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
+ };
++#endif
+
+ } // namespace
+
+@@ -1256,9 +1260,11 @@ ProxyConfigServiceLinux::Delegate::Deleg
+ case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE5:
+ case base::nix::DESKTOP_ENVIRONMENT_KDE6:
++#if !BUILDFLAG(IS_BSD)
+ setting_getter_ =
+ std::make_unique<SettingGetterImplKDE>(env_var_getter_.get());
+ break;
++#endif
+ case base::nix::DESKTOP_ENVIRONMENT_XFCE:
+ case base::nix::DESKTOP_ENVIRONMENT_LXQT:
+ case base::nix::DESKTOP_ENVIRONMENT_OTHER:
diff --git a/electron34/patches/patch-net_socket_socket__posix.cc b/electron34/patches/patch-net_socket_socket__posix.cc
new file mode 100644
index 0000000000..c20c709dde
--- /dev/null
+++ b/electron34/patches/patch-net_socket_socket__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/socket/socket_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/socket/socket_posix.cc
+@@ -516,7 +516,7 @@ void SocketPosix::ReadCompleted() {
+ }
+
+ int SocketPosix::DoWrite(IOBuffer* buf, int buf_len) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Disable SIGPIPE for this write. Although Chromium globally disables
+ // SIGPIPE, the net stack may be used in other consumers which do not do
+ // this. MSG_NOSIGNAL is a Linux-only API. On OS X, this is a setsockopt on
diff --git a/electron34/patches/patch-net_socket_socks5__client__socket.cc b/electron34/patches/patch-net_socket_socks5__client__socket.cc
new file mode 100644
index 0000000000..332aad0ecf
--- /dev/null
+++ b/electron34/patches/patch-net_socket_socks5__client__socket.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/socket/socks5_client_socket.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/socket/socks5_client_socket.cc
+@@ -24,6 +24,9 @@
+ #include "net/log/net_log_event_type.h"
+ #include "net/traffic_annotation/network_traffic_annotation.h"
+
++#include <sys/types.h>
++#include <netinet/in.h>
++
+ namespace net {
+
+ const unsigned int SOCKS5ClientSocket::kGreetReadHeaderSize = 2;
diff --git a/electron34/patches/patch-net_socket_tcp__socket__posix.cc b/electron34/patches/patch-net_socket_tcp__socket__posix.cc
new file mode 100644
index 0000000000..aaff2eeb66
--- /dev/null
+++ b/electron34/patches/patch-net_socket_tcp__socket__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/socket/tcp_socket_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/socket/tcp_socket_posix.cc
+@@ -98,6 +98,17 @@ bool SetTCPKeepAlive(int fd, bool enable
+ PLOG(ERROR) << "Failed to set TCP_KEEPALIVE on fd: " << fd;
+ return false;
+ }
++#elif BUILDFLAG(IS_FREEBSD)
++ // Set seconds until first TCP keep alive.
++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &delay, sizeof(delay))) {
++ PLOG(ERROR) << "Failed to set TCP_KEEPIDLE on fd: " << fd;
++ return false;
++ }
++ // Set seconds between TCP keep alives.
++ if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPINTVL, &delay, sizeof(delay))) {
++ PLOG(ERROR) << "Failed to set TCP_KEEPINTVL on fd: " << fd;
++ return false;
++ }
+ #endif
+ }
+
diff --git a/electron34/patches/patch-net_socket_udp__socket__posix.cc b/electron34/patches/patch-net_socket_udp__socket__posix.cc
new file mode 100644
index 0000000000..f3d2d9f398
--- /dev/null
+++ b/electron34/patches/patch-net_socket_udp__socket__posix.cc
@@ -0,0 +1,132 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/socket/udp_socket_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/socket/udp_socket_posix.cc
+@@ -78,6 +78,32 @@ constexpr int kBindRetries = 10;
+ constexpr int kPortStart = 1024;
+ constexpr int kPortEnd = 65535;
+
++#if BUILDFLAG(IS_NETBSD)
++int GetIPv4AddressFromIndex(int socket, uint32_t index, uint32_t* address) {
++ if (!index) {
++ *address = htonl(INADDR_ANY);
++ return OK;
++ }
++
++ sockaddr_in* result = nullptr;
++
++ ifreq ifr;
++ ifr.ifr_addr.sa_family = AF_INET;
++ if (!if_indextoname(index, ifr.ifr_name))
++ return MapSystemError(errno);
++ int rv = ioctl(socket, SIOCGIFADDR, &ifr);
++ if (rv == -1)
++ return MapSystemError(errno);
++ result = reinterpret_cast<sockaddr_in*>(&ifr.ifr_addr);
++
++ if (!result)
++ return ERR_ADDRESS_INVALID;
++
++ *address = result->sin_addr.s_addr;
++ return OK;
++}
++#endif
++
+ int GetSocketFDHash(int fd) {
+ return fd ^ 1595649551;
+ }
+@@ -522,12 +548,17 @@ int UDPSocketPosix::SetRecvTos() {
+ #endif // BUILDFLAG(IS_APPLE)
+ }
+
++#ifdef IP_RECVTOS
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_RECVTOS, &ecn, sizeof(ecn));
++#else
++ int rv = -1;
++ errno = EOPNOTSUPP;
++#endif
+ return rv == 0 ? OK : MapSystemError(errno);
+ }
+
+ void UDPSocketPosix::SetMsgConfirm(bool confirm) {
+-#if !BUILDFLAG(IS_APPLE)
++#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ if (confirm) {
+ sendto_flags_ |= MSG_CONFIRM;
+ } else {
+@@ -548,7 +579,7 @@ int UDPSocketPosix::SetBroadcast(bool br
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+ int value = broadcast ? 1 : 0;
+ int rv;
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // SO_REUSEPORT on OSX permits multiple processes to each receive
+ // UDP multicast or broadcast datagrams destined for the bound
+ // port.
+@@ -849,9 +880,17 @@ int UDPSocketPosix::SetMulticastOptions(
+ if (multicast_interface_ != 0) {
+ switch (addr_family_) {
+ case AF_INET: {
++#if BUILDFLAG(IS_NETBSD)
++ ip_mreq mreq = {};
++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_,
++ &mreq.imr_interface.s_addr);
++ if (error != OK)
++ return error;
++#else
+ ip_mreqn mreq = {};
+ mreq.imr_ifindex = multicast_interface_;
+ mreq.imr_address.s_addr = htonl(INADDR_ANY);
++#endif
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_MULTICAST_IF,
+ reinterpret_cast<const char*>(&mreq), sizeof(mreq));
+ if (rv)
+@@ -885,7 +924,7 @@ int UDPSocketPosix::DoBind(const IPEndPo
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ if (last_error == EINVAL)
+ return ERR_ADDRESS_IN_USE;
+-#elif BUILDFLAG(IS_APPLE)
++#elif BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ if (last_error == EADDRNOTAVAIL)
+ return ERR_ADDRESS_IN_USE;
+ #endif
+@@ -913,9 +952,17 @@ int UDPSocketPosix::JoinGroup(const IPAd
+ case IPAddress::kIPv4AddressSize: {
+ if (addr_family_ != AF_INET)
+ return ERR_ADDRESS_INVALID;
++#if BUILDFLAG(IS_NETBSD)
++ ip_mreq mreq = {};
++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_,
++ &mreq.imr_interface.s_addr);
++ if (error != OK)
++ return error;
++#else
+ ip_mreqn mreq = {};
+ mreq.imr_ifindex = multicast_interface_;
+ mreq.imr_address.s_addr = htonl(INADDR_ANY);
++#endif
+ memcpy(&mreq.imr_multiaddr, group_address.bytes().data(),
+ IPAddress::kIPv4AddressSize);
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+@@ -952,9 +999,17 @@ int UDPSocketPosix::LeaveGroup(const IPA
+ case IPAddress::kIPv4AddressSize: {
+ if (addr_family_ != AF_INET)
+ return ERR_ADDRESS_INVALID;
++#if BUILDFLAG(IS_NETBSD)
++ ip_mreq mreq = {};
++ int error = GetIPv4AddressFromIndex(socket_, multicast_interface_,
++ &mreq.imr_interface.s_addr);
++ if (error != OK)
++ return error;
++#else
+ ip_mreqn mreq = {};
+ mreq.imr_ifindex = multicast_interface_;
+ mreq.imr_address.s_addr = INADDR_ANY;
++#endif
+ memcpy(&mreq.imr_multiaddr, group_address.bytes().data(),
+ IPAddress::kIPv4AddressSize);
+ int rv = setsockopt(socket_, IPPROTO_IP, IP_DROP_MEMBERSHIP,
diff --git a/electron34/patches/patch-net_socket_udp__socket__unittest.cc b/electron34/patches/patch-net_socket_udp__socket__unittest.cc
new file mode 100644
index 0000000000..4a27317600
--- /dev/null
+++ b/electron34/patches/patch-net_socket_udp__socket__unittest.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/socket/udp_socket_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/socket/udp_socket_unittest.cc
+@@ -372,7 +372,7 @@ TEST_F(UDPSocketTest, PartialRecv) {
+ EXPECT_EQ(second_packet, received);
+ }
+
+-#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // - MacOS: requires root permissions on OSX 10.7+.
+ // - Android: devices attached to testbots don't have default network, so
+ // broadcasting to 255.255.255.255 returns error -109 (Address not reachable).
+@@ -683,7 +683,7 @@ TEST_F(UDPSocketTest, ClientSetDoNotFrag
+ EXPECT_THAT(rv, IsOk());
+
+ rv = client.SetDoNotFragment();
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050633): IP_MTU_DISCOVER is not implemented on Fuchsia.
+ EXPECT_THAT(rv, IsError(ERR_NOT_IMPLEMENTED));
+ #else
+@@ -705,7 +705,7 @@ TEST_F(UDPSocketTest, ServerSetDoNotFrag
+ EXPECT_THAT(rv, IsOk());
+
+ rv = server.SetDoNotFragment();
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/42050633): IP_MTU_DISCOVER is not implemented on Fuchsia.
+ EXPECT_THAT(rv, IsError(ERR_NOT_IMPLEMENTED));
+ #else
+@@ -764,7 +764,7 @@ TEST_F(UDPSocketTest, JoinMulticastGroup
+
+ // TODO(crbug.com/40620614): failing on device on iOS 12.2.
+ // TODO(crbug.com/40189274): flaky on Mac 11.
+-#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #define MAYBE_SharedMulticastAddress DISABLED_SharedMulticastAddress
+ #else
+ #define MAYBE_SharedMulticastAddress SharedMulticastAddress
+@@ -818,7 +818,7 @@ TEST_F(UDPSocketTest, MAYBE_SharedMultic
+ NetLogSource());
+ ASSERT_THAT(client_socket.Connect(send_address), IsOk());
+
+-#if !BUILDFLAG(IS_CHROMEOS_ASH)
++#if !BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_BSD)
+ // Send a message via the multicast group. That message is expected be be
+ // received by both receving sockets.
+ //
diff --git a/electron34/patches/patch-net_third__party_quiche_BUILD.gn b/electron34/patches/patch-net_third__party_quiche_BUILD.gn
new file mode 100644
index 0000000000..8037eeff6a
--- /dev/null
+++ b/electron34/patches/patch-net_third__party_quiche_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/third_party/quiche/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/third_party/quiche/BUILD.gn
+@@ -29,7 +29,7 @@ import("//net/third_party/quiche/src/bui
+ import("//testing/libfuzzer/fuzzer_test.gni")
+ import("//third_party/protobuf/proto_library.gni")
+
+-build_epoll_based_tools = is_linux || is_chromeos
++build_epoll_based_tools = (is_linux && !is_bsd) || is_chromeos
+
+ config("quiche_internal_config") {
+ cflags = []
diff --git a/electron34/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc b/electron34/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
new file mode 100644
index 0000000000..e4337cb036
--- /dev/null
+++ b/electron34/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/tools/cert_verify_tool/cert_verify_tool.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/tools/cert_verify_tool/cert_verify_tool.cc
+@@ -35,7 +35,7 @@
+ #include "third_party/boringssl/src/pki/trust_store.h"
+ #include "third_party/boringssl/src/pki/trust_store_collection.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "net/proxy_resolution/proxy_config.h"
+ #include "net/proxy_resolution/proxy_config_service_fixed.h"
+ #endif
+@@ -67,7 +67,7 @@ void SetUpOnNetworkThread(
+ base::WaitableEvent* initialization_complete_event) {
+ net::URLRequestContextBuilder url_request_context_builder;
+ url_request_context_builder.set_user_agent(GetUserAgent());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, use a fixed ProxyConfigService, since the default one
+ // depends on glib.
+ //
+@@ -580,7 +580,7 @@ int main(int argc, char** argv) {
+ std::string impls_str = command_line.GetSwitchValueASCII("impls");
+ if (impls_str.empty()) {
+ // Default value.
+-#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || \
++#if !(BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(CHROME_ROOT_STORE_ONLY))
+ impls_str = "platform,";
+ #endif
diff --git a/electron34/patches/patch-net_tools_net__watcher_net__watcher.cc b/electron34/patches/patch-net_tools_net__watcher_net__watcher.cc
new file mode 100644
index 0000000000..d37950a2dd
--- /dev/null
+++ b/electron34/patches/patch-net_tools_net__watcher_net__watcher.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/tools/net_watcher/net_watcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/tools/net_watcher/net_watcher.cc
+@@ -32,7 +32,7 @@
+ #include "net/proxy_resolution/proxy_config_service.h"
+ #include "net/proxy_resolution/proxy_config_with_annotation.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "net/base/network_change_notifier_linux.h"
+ #endif
+
+@@ -44,7 +44,7 @@ namespace {
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Flag to specifies which network interfaces to ignore. Interfaces should
+ // follow as a comma seperated list.
+ const char kIgnoreNetifFlag[] = "ignore-netif";
+@@ -163,7 +163,7 @@ int main(int argc, char* argv[]) {
+
+ NetWatcher net_watcher;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ std::string ignored_netifs_str =
+ command_line->GetSwitchValueASCII(kIgnoreNetifFlag);
diff --git a/electron34/patches/patch-net_traffic__annotation_network__traffic__annotation.h b/electron34/patches/patch-net_traffic__annotation_network__traffic__annotation.h
new file mode 100644
index 0000000000..7e18c1871b
--- /dev/null
+++ b/electron34/patches/patch-net_traffic__annotation_network__traffic__annotation.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/traffic_annotation/network_traffic_annotation.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/traffic_annotation/network_traffic_annotation.h
+@@ -375,7 +375,7 @@ struct MutablePartialNetworkTrafficAnnot
+ } // namespace net
+
+ // Placeholder for unannotated usages.
+-#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ #define TRAFFIC_ANNOTATION_WITHOUT_PROTO(ANNOTATION_ID) \
+ net::DefineNetworkTrafficAnnotation(ANNOTATION_ID, "No proto yet.")
+ #endif
+@@ -389,7 +389,7 @@ struct MutablePartialNetworkTrafficAnnot
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+
+ #define NO_TRAFFIC_ANNOTATION_YET \
+ net::DefineNetworkTrafficAnnotation("undefined", "Nothing here yet.")
diff --git a/electron34/patches/patch-net_url__request_static__http__user__agent__settings.h b/electron34/patches/patch-net_url__request_static__http__user__agent__settings.h
new file mode 100644
index 0000000000..617bb4ae77
--- /dev/null
+++ b/electron34/patches/patch-net_url__request_static__http__user__agent__settings.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/url_request/static_http_user_agent_settings.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/url_request/static_http_user_agent_settings.h
+@@ -30,13 +30,17 @@ class NET_EXPORT StaticHttpUserAgentSett
+ accept_language_ = new_accept_language;
+ }
+
++ void set_user_agent(const std::string& new_user_agent) {
++ user_agent_ = new_user_agent;
++ }
++
+ // HttpUserAgentSettings implementation
+ std::string GetAcceptLanguage() const override;
+ std::string GetUserAgent() const override;
+
+ private:
+ std::string accept_language_;
+- const std::string user_agent_;
++ std::string user_agent_;
+ };
+
+ } // namespace net
diff --git a/electron34/patches/patch-net_url__request_url__request__context.cc b/electron34/patches/patch-net_url__request_url__request__context.cc
new file mode 100644
index 0000000000..f11aae8131
--- /dev/null
+++ b/electron34/patches/patch-net_url__request_url__request__context.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/url_request/url_request_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/url_request/url_request_context.cc
+@@ -122,7 +122,7 @@ const HttpNetworkSessionContext* URLRequ
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ std::unique_ptr<URLRequest> URLRequestContext::CreateRequest(
+ const GURL& url,
+ RequestPriority priority,
diff --git a/electron34/patches/patch-net_url__request_url__request__context.h b/electron34/patches/patch-net_url__request_url__request__context.h
new file mode 100644
index 0000000000..41e7348694
--- /dev/null
+++ b/electron34/patches/patch-net_url__request_url__request__context.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/url_request/url_request_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/url_request/url_request_context.h
+@@ -92,7 +92,7 @@ class NET_EXPORT URLRequestContext final
+ // TODO(crbug.com/40118868): Revisit once build flag switch of lacros-chrome is
+ // complete.
+ #if !BUILDFLAG(IS_WIN) && \
+- !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ !(BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
+ // This function should not be used in Chromium, please use the version with
+ // NetworkTrafficAnnotationTag in the future.
+ //
diff --git a/electron34/patches/patch-net_url__request_url__request__context__builder.cc b/electron34/patches/patch-net_url__request_url__request__context__builder.cc
new file mode 100644
index 0000000000..a70601b2b9
--- /dev/null
+++ b/electron34/patches/patch-net_url__request_url__request__context__builder.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- net/url_request/url_request_context_builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ net/url_request/url_request_context_builder.cc
+@@ -447,7 +447,7 @@ std::unique_ptr<URLRequestContext> URLRe
+ }
+
+ if (!proxy_resolution_service_) {
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ // TODO(willchan): Switch to using this code when
+ // ProxyConfigService::CreateSystemProxyConfigService()'s
+ // signature doesn't suck.
diff --git a/electron34/patches/patch-pdf_pdfium_pdfium__engine.cc b/electron34/patches/patch-pdf_pdfium_pdfium__engine.cc
new file mode 100644
index 0000000000..3aa7136020
--- /dev/null
+++ b/electron34/patches/patch-pdf_pdfium_pdfium__engine.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- pdf/pdfium/pdfium_engine.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ pdf/pdfium/pdfium_engine.cc
+@@ -106,7 +106,7 @@
+ #include "ui/accessibility/ax_features.mojom-features.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "pdf/pdfium/pdfium_font_linux.h"
+ #endif
+
+@@ -535,7 +535,7 @@ void InitializeSDK(bool enable_v8,
+
+ FPDF_InitLibraryWithConfig(&config);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ g_font_mapping_mode = font_mapping_mode;
+ InitializeLinuxFontMapper();
+ #endif
diff --git a/electron34/patches/patch-ppapi_tests_test__utils.h b/electron34/patches/patch-ppapi_tests_test__utils.h
new file mode 100644
index 0000000000..26cc97ef44
--- /dev/null
+++ b/electron34/patches/patch-ppapi_tests_test__utils.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ppapi/tests/test_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ppapi/tests/test_utils.h
+@@ -314,6 +314,8 @@ do { \
+ #define PPAPI_OS_FREEBSD 1
+ #elif defined(__OpenBSD__)
+ #define PPAPI_OS_OPENBSD 1
++#elif defined(__NetBSD__)
++#define PPAPI_OS_NETBSD 1
+ #elif defined(__sun)
+ #define PPAPI_OS_SOLARIS 1
+ #else
+@@ -322,7 +324,8 @@ do { \
+
+ /* These are used to determine POSIX-like implementations vs Windows. */
+ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
+- defined(__OpenBSD__) || defined(__sun) || defined(__native_client__)
++ defined(__OpenBSD__) || defined(__sun) || defined(__native_client__) \
++ defined(__NetBSD__)
+ #define PPAPI_POSIX 1
+ #endif
+
diff --git a/electron34/patches/patch-printing_backend_cups__ipp__helper.cc b/electron34/patches/patch-printing_backend_cups__ipp__helper.cc
new file mode 100644
index 0000000000..174cea1eb7
--- /dev/null
+++ b/electron34/patches/patch-printing_backend_cups__ipp__helper.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/backend/cups_ipp_helper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/backend/cups_ipp_helper.cc
+@@ -202,7 +202,7 @@ void ExtractResolutions(const CupsOption
+ // Provide a default DPI if no valid DPI is found.
+ #if BUILDFLAG(IS_MAC)
+ constexpr gfx::Size kDefaultMissingDpi(kDefaultMacDpi, kDefaultMacDpi);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr gfx::Size kDefaultMissingDpi(kPixelsPerInch, kPixelsPerInch);
+ #else
+ constexpr gfx::Size kDefaultMissingDpi(kDefaultPdfDpi, kDefaultPdfDpi);
diff --git a/electron34/patches/patch-printing_backend_print__backend__cups.cc b/electron34/patches/patch-printing_backend_print__backend__cups.cc
new file mode 100644
index 0000000000..dbb2b02d2a
--- /dev/null
+++ b/electron34/patches/patch-printing_backend_print__backend__cups.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/backend/print_backend_cups.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/backend/print_backend_cups.cc
+@@ -33,7 +33,7 @@
+ #include "printing/mojom/print.mojom.h"
+ #include "url/gurl.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ #include "base/feature_list.h"
+ #include "printing/backend/cups_connection.h"
+ #include "printing/backend/print_backend_cups_ipp.h"
+@@ -63,7 +63,7 @@ int CaptureCupsDestCallback(void* data,
+ return 1; // Keep going.
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // This may be removed when Amazon Linux 2 reaches EOL (30 Jun 2025).
+ bool AreNewerCupsFunctionsAvailable() {
+ return cupsFindDestDefault && cupsFindDestSupported && cupsUserAgent &&
+@@ -292,7 +292,7 @@ bool PrintBackendCUPS::IsValidPrinter(co
+ #if !BUILDFLAG(IS_CHROMEOS)
+ scoped_refptr<PrintBackend> PrintBackend::CreateInstanceImpl(
+ const std::string& locale) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (AreNewerCupsFunctionsAvailable() &&
+ base::FeatureList::IsEnabled(features::kCupsIppPrintingBackend)) {
+ return base::MakeRefCounted<PrintBackendCupsIpp>(CupsConnection::Create());
diff --git a/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.cc b/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.cc
new file mode 100644
index 0000000000..18e6b2c68e
--- /dev/null
+++ b/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/mojom/printing_context_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/mojom/printing_context_mojom_traits.cc
+@@ -19,7 +19,7 @@
+ #include "base/numerics/safe_conversions.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "mojo/public/mojom/base/values.mojom.h"
+ #endif
+
+@@ -161,7 +161,7 @@ bool StructTraits<
+ }
+
+ out->set_pages_per_sheet(data.pages_per_sheet());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DCHECK(out->advanced_settings().empty());
+ if (!data.ReadAdvancedSettings(&out->advanced_settings()))
+ return false;
+@@ -238,7 +238,7 @@ bool StructTraits<
+ if (system_print_dialog_data.size() != dictionary_entries) {
+ return false;
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The dictionary must contain three strings.
+ const base::Value* value = system_print_dialog_data.Find(
+ printing::kLinuxSystemPrintDialogDataPrinter);
diff --git a/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.h b/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.h
new file mode 100644
index 0000000000..2ada2ed70e
--- /dev/null
+++ b/electron34/patches/patch-printing_mojom_printing__context__mojom__traits.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/mojom/printing_context_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/mojom/printing_context_mojom_traits.h
+@@ -166,7 +166,7 @@ struct StructTraits<printing::mojom::Pri
+ return s.pages_per_sheet();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static const printing::PrintSettings::AdvancedSettings& advanced_settings(
+ const printing::PrintSettings& s) {
+ return s.advanced_settings();
diff --git a/electron34/patches/patch-printing_print__settings.cc b/electron34/patches/patch-printing_print__settings.cc
new file mode 100644
index 0000000000..9af5655b2b
--- /dev/null
+++ b/electron34/patches/patch-printing_print__settings.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/print_settings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/print_settings.cc
+@@ -319,7 +319,7 @@ PrintSettings& PrintSettings::operator=(
+ #endif
+ is_modifiable_ = settings.is_modifiable_;
+ pages_per_sheet_ = settings.pages_per_sheet_;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (const auto& item : settings.advanced_settings_)
+ advanced_settings_.emplace(item.first, item.second.Clone());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -349,7 +349,7 @@ bool PrintSettings::operator==(const Pri
+ #endif
+ is_modifiable_, requested_custom_margins_in_points_,
+ pages_per_sheet_
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ advanced_settings_
+ #endif
+@@ -373,7 +373,7 @@ bool PrintSettings::operator==(const Pri
+ other.is_modifiable_,
+ other.requested_custom_margins_in_points_,
+ other.pages_per_sheet_
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ other.advanced_settings_
+ #endif
+@@ -413,7 +413,7 @@ void PrintSettings::Clear() {
+ #endif
+ is_modifiable_ = true;
+ pages_per_sheet_ = 1;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ advanced_settings_.clear();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-printing_print__settings.h b/electron34/patches/patch-printing_print__settings.h
new file mode 100644
index 0000000000..02f439a8ad
--- /dev/null
+++ b/electron34/patches/patch-printing_print__settings.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/print_settings.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/print_settings.h
+@@ -25,7 +25,7 @@
+ #include "base/values.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <map>
+
+ #include "base/values.h"
+@@ -51,7 +51,7 @@ inline constexpr char kMacSystemPrintDia
+ "print_settings";
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ inline constexpr char kLinuxSystemPrintDialogDataPrinter[] = "printer_name";
+ inline constexpr char kLinuxSystemPrintDialogDataPrintSettings[] =
+ "print_settings";
+@@ -101,7 +101,7 @@ class COMPONENT_EXPORT(PRINTING_SETTINGS
+ std::string vendor_id;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ using AdvancedSettings = std::map<std::string, base::Value>;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -276,7 +276,7 @@ class COMPONENT_EXPORT(PRINTING_SETTINGS
+ pages_per_sheet_ = pages_per_sheet;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ AdvancedSettings& advanced_settings() { return advanced_settings_; }
+ const AdvancedSettings& advanced_settings() const {
+ return advanced_settings_;
+@@ -429,7 +429,7 @@ class COMPONENT_EXPORT(PRINTING_SETTINGS
+ // Number of pages per sheet.
+ int pages_per_sheet_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Advanced settings.
+ AdvancedSettings advanced_settings_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-printing_print__settings__conversion.cc b/electron34/patches/patch-printing_print__settings__conversion.cc
new file mode 100644
index 0000000000..258cc25687
--- /dev/null
+++ b/electron34/patches/patch-printing_print__settings__conversion.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/print_settings_conversion.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/print_settings_conversion.cc
+@@ -285,7 +285,7 @@ std::unique_ptr<PrintSettings> PrintSett
+ settings->set_is_modifiable(is_modifiable.value());
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS) || (BUILDFLAG(IS_LINUX) && BUILDFLAG(USE_CUPS))
++#if BUILDFLAG(IS_CHROMEOS) || ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(USE_CUPS))
+ const base::Value::Dict* advanced_settings =
+ job_settings.FindDict(kSettingAdvancedSettings);
+ if (advanced_settings) {
diff --git a/electron34/patches/patch-printing_printing__context.cc b/electron34/patches/patch-printing_printing__context.cc
new file mode 100644
index 0000000000..17293e1006
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context.cc
+@@ -154,7 +154,6 @@ void PrintingContext::UsePdfSettings() {
+
+ mojom::ResultCode PrintingContext::UpdatePrintSettings(
+ base::Value::Dict job_settings) {
+- ResetSettings();
+ {
+ std::unique_ptr<PrintSettings> settings =
+ PrintSettingsFromJobSettings(job_settings);
diff --git a/electron34/patches/patch-printing_printing__context.h b/electron34/patches/patch-printing_printing__context.h
new file mode 100644
index 0000000000..553d0a34ef
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context.h
+@@ -206,6 +206,9 @@ class COMPONENT_EXPORT(PRINTING) Printin
+
+ bool PrintingAborted() const { return abort_printing_; }
+
++ // Reinitializes the settings for object reuse.
++ void ResetSettings();
++
+ int job_id() const { return job_id_; }
+
+ #if BUILDFLAG(ENABLE_OOP_PRINTING)
+@@ -224,9 +227,6 @@ class COMPONENT_EXPORT(PRINTING) Printin
+ Delegate* delegate,
+ ProcessBehavior process_behavior);
+
+- // Reinitializes the settings for object reuse.
+- void ResetSettings();
+-
+ // Does bookkeeping when an error occurs.
+ virtual mojom::ResultCode OnError();
+
diff --git a/electron34/patches/patch-printing_printing__context__linux.cc b/electron34/patches/patch-printing_printing__context__linux.cc
new file mode 100644
index 0000000000..c39f5e6644
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context__linux.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context_linux.cc
+@@ -23,7 +23,7 @@
+ #endif
+
+ // Avoid using LinuxUi on Fuchsia.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -66,7 +66,7 @@ mojom::ResultCode PrintingContextLinux::
+
+ ResetSettings();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::LinuxUi::instance())
+ return mojom::ResultCode::kSuccess;
+
+@@ -82,7 +82,7 @@ mojom::ResultCode PrintingContextLinux::
+ }
+
+ gfx::Size PrintingContextLinux::GetPdfPaperSizeDeviceUnits() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (ui::LinuxUi::instance())
+ return ui::LinuxUi::instance()->GetPdfPaperSize(this);
+ #endif
+@@ -95,7 +95,7 @@ mojom::ResultCode PrintingContextLinux::
+ DCHECK(!printer_settings.show_system_dialog);
+ DCHECK(!in_print_job_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::LinuxUi::instance())
+ return mojom::ResultCode::kSuccess;
+
diff --git a/electron34/patches/patch-printing_printing__context__mac.h b/electron34/patches/patch-printing_printing__context__mac.h
new file mode 100644
index 0000000000..8c44146de0
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context__mac.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context_mac.h
+@@ -84,6 +84,10 @@ class COMPONENT_EXPORT(PRINTING) Printin
+ // Returns true if the orientation was set.
+ bool SetOrientationIsLandscape(bool landscape);
+
++ // Set the page range in native print info object.
++ // Returns true if the range was set.
++ bool SetPrintRangeInPrintSettings(const PageRanges& ranges);
++
+ // Sets duplex mode in PMPrintSettings.
+ // Returns true if duplex mode is set.
+ bool SetDuplexModeInPrintSettings(mojom::DuplexMode mode);
diff --git a/electron34/patches/patch-printing_printing__context__mac.mm b/electron34/patches/patch-printing_printing__context__mac.mm
new file mode 100644
index 0000000000..f8e12641e3
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context__mac.mm
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context_mac.mm
+@@ -520,7 +520,8 @@ mojom::ResultCode PrintingContextMac::Up
+ !SetCollateInPrintSettings(settings_->collate()) ||
+ !SetDuplexModeInPrintSettings(settings_->duplex_mode()) ||
+ !SetOutputColor(static_cast<int>(settings_->color())) ||
+- !SetResolution(settings_->dpi_size())) {
++ !SetResolution(settings_->dpi_size()) ||
++ !SetPrintRangeInPrintSettings(settings_->ranges()) ) {
+ return OnError();
+ }
+ }
+@@ -673,6 +674,22 @@ bool PrintingContextMac::SetCopiesInPrin
+ return PMSetCopies(print_settings, copies, false) == noErr;
+ }
+
++bool PrintingContextMac::SetPrintRangeInPrintSettings(const PageRanges& ranges) {
++ // Default is already NSPrintAllPages - we can safely bail.
++ if (ranges.empty())
++ return true;
++
++ PMPrintSettings print_settings =
++ static_cast<PMPrintSettings>([print_info_ PMPrintSettings]);
++
++ // macOS does not allow multiple ranges, so pluck the first.
++ auto range = ranges.front();
++ bool set_first_page = PMSetFirstPage(print_settings, range.from + 1, false) == noErr;
++ bool set_last_page = PMSetLastPage(print_settings, range.to + 1, false) == noErr;
++
++ return set_first_page && set_last_page;
++}
++
+ bool PrintingContextMac::SetCollateInPrintSettings(bool collate) {
+ PMPrintSettings print_settings =
+ static_cast<PMPrintSettings>([print_info_ PMPrintSettings]);
diff --git a/electron34/patches/patch-printing_printing__context__system__dialog__win.cc b/electron34/patches/patch-printing_printing__context__system__dialog__win.cc
new file mode 100644
index 0000000000..d8927a69fd
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__context__system__dialog__win.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_context_system_dialog_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_context_system_dialog_win.cc
+@@ -77,14 +77,28 @@ void PrintingContextSystemDialogWin::Ask
+ PRINTPAGERANGE ranges[32];
+ dialog_options.nStartPage = START_PAGE_GENERAL;
+ if (max_pages) {
+- // Default initialize to print all the pages.
+ memset(ranges, 0, sizeof(ranges));
+- ranges[0].nFromPage = 1;
+- ranges[0].nToPage = max_pages;
+- dialog_options.nPageRanges = 1;
+- dialog_options.nMaxPageRanges = std::size(ranges);
++
++ auto page_ranges = settings_->ranges();
++ if (!page_ranges.empty()) {
++ for (size_t i = 0; i < page_ranges.size(); i++) {
++ auto range = page_ranges[i];
++ ranges[i].nFromPage = range.from + 1;
++ ranges[i].nToPage = range.to + 1;
++ }
++ dialog_options.nPageRanges = page_ranges.size();
++
++ // Ensure the Pages radio button is selected.
++ dialog_options.Flags |= PD_PAGENUMS;
++ } else {
++ ranges[0].nFromPage = 1;
++ ranges[0].nToPage = max_pages;
++ dialog_options.nPageRanges = 1;
++ }
++
+ dialog_options.nMinPage = 1;
+ dialog_options.nMaxPage = max_pages;
++ dialog_options.nMaxPageRanges = std::size(ranges);
+ dialog_options.lpPageRanges = ranges;
+ } else {
+ // No need to bother, we don't know how many pages are available.
diff --git a/electron34/patches/patch-printing_printing__features.cc b/electron34/patches/patch-printing_printing__features.cc
new file mode 100644
index 0000000000..0c5912dcc2
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__features.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_features.cc
+@@ -21,12 +21,12 @@ BASE_FEATURE(kAddPrinterViaPrintscanmgr,
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // Use the CUPS IPP printing backend instead of the original CUPS backend that
+ // calls the deprecated PPD API.
+ BASE_FEATURE(kCupsIppPrintingBackend,
+ "CupsIppPrintingBackend",
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_DISABLED_BY_DEFAULT
+ #else
+ base::FEATURE_ENABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-printing_printing__features.h b/electron34/patches/patch-printing_printing__features.h
new file mode 100644
index 0000000000..4138c704e7
--- /dev/null
+++ b/electron34/patches/patch-printing_printing__features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/printing_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/printing_features.h
+@@ -22,7 +22,7 @@ COMPONENT_EXPORT(PRINTING_BASE)
+ BASE_DECLARE_FEATURE(kAddPrinterViaPrintscanmgr);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(PRINTING_BASE) BASE_DECLARE_FEATURE(kCupsIppPrintingBackend);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
diff --git a/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc b/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..fb96348459
--- /dev/null
+++ b/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
@@ -0,0 +1,56 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/sandbox/print_backend_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/sandbox/print_backend_sandbox_hook_linux.cc
+@@ -10,20 +10,27 @@
+ #include "base/path_service.h"
+ #include "build/build_config.h"
+ #include "printing/buildflags/buildflags.h"
++#if !BUILDFLAG(IS_BSD)
+ #include "sandbox/linux/syscall_broker/broker_command.h"
+ #include "sandbox/linux/syscall_broker/broker_file_permission.h"
+ #include "sandbox/policy/export.h"
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#else
++#include "sandbox/policy/sandbox.h"
++#endif
+
+ #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CUPS)
+ #include "printing/backend/cups_connection_pool.h"
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace printing {
+
++#if !BUILDFLAG(IS_BSD)
+ namespace {
+
+ sandbox::syscall_broker::BrokerCommandSet GetPrintBackendBrokerCommandSet() {
+@@ -76,9 +83,11 @@ std::vector<BrokerFilePermission> GetPri
+ }
+
+ } // namespace
++#endif
+
+ bool PrintBackendPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(USE_CUPS)
+ // Create the socket connections to the CUPS server before engaging the
+ // sandbox, since new connections cannot be made after that.
+@@ -91,6 +100,7 @@ bool PrintBackendPreSandboxHook(
+ GetPrintBackendFilePermissions(), options);
+
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h b/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
new file mode 100644
index 0000000000..59baa1100d
--- /dev/null
+++ b/electron34/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- printing/sandbox/print_backend_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ printing/sandbox/print_backend_sandbox_hook_linux.h
+@@ -5,8 +5,13 @@
+ #ifndef PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_
+ #define PRINTING_SANDBOX_PRINT_BACKEND_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
+ #include "base/component_export.h"
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace printing {
+
diff --git a/electron34/patches/patch-remoting_base_chromoting__event.cc b/electron34/patches/patch-remoting_base_chromoting__event.cc
new file mode 100644
index 0000000000..78258975d9
--- /dev/null
+++ b/electron34/patches/patch-remoting_base_chromoting__event.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/base/chromoting_event.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/base/chromoting_event.cc
+@@ -192,7 +192,7 @@ void ChromotingEvent::AddSystemInfo() {
+ SetString(kCpuKey, base::SysInfo::OperatingSystemArchitecture());
+ SetString(kOsVersionKey, base::SysInfo::OperatingSystemVersion());
+ SetString(kWebAppVersionKey, STRINGIZE(VERSION));
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ Os os = Os::CHROMOTING_LINUX;
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ Os os = Os::CHROMOTING_CHROMEOS;
diff --git a/electron34/patches/patch-remoting_base_host__settings.cc b/electron34/patches/patch-remoting_base_host__settings.cc
new file mode 100644
index 0000000000..511d4315a8
--- /dev/null
+++ b/electron34/patches/patch-remoting_base_host__settings.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/base/host_settings.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/base/host_settings.cc
+@@ -7,7 +7,7 @@
+ #include "base/no_destructor.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ #include "remoting/base/file_host_settings.h"
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -44,7 +44,7 @@ HostSettings::~HostSettings() = default;
+
+ // static
+ HostSettings* HostSettings::GetInstance() {
+-#if BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS))
++#if BUILDFLAG(IS_APPLE) || (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)) || BUILDFLAG(IS_BSD)
+ static base::NoDestructor<FileHostSettings> instance(
+ FileHostSettings::GetSettingsFilePath());
+ #elif BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc b/electron34/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc
new file mode 100644
index 0000000000..6bc7268308
--- /dev/null
+++ b/electron34/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/codec/webrtc_video_encoder_vpx.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/codec/webrtc_video_encoder_vpx.cc
+@@ -93,7 +93,7 @@ void SetVp8CodecParameters(vpx_codec_enc
+ const webrtc::DesktopSize& size) {
+ SetCommonCodecParameters(config, size);
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_BSD) || BUILDFLAG(IS_LINUX)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ // On Linux, using too many threads for VP8 encoding has been linked to high
+ // CPU usage on machines that are under stress. See http://crbug.com/1151148.
+ // 5/3/2022 update: Perf testing has shown that doubling the number of threads
diff --git a/electron34/patches/patch-remoting_host_base_desktop__environment__options.cc b/electron34/patches/patch-remoting_host_base_desktop__environment__options.cc
new file mode 100644
index 0000000000..42d5d31604
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_base_desktop__environment__options.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/base/desktop_environment_options.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/base/desktop_environment_options.cc
+@@ -99,7 +99,7 @@ bool DesktopEnvironmentOptions::capture_
+ // TODO(joedow): Determine whether we can migrate additional platforms to
+ // using the DesktopCaptureWrapper instead of the DesktopCaptureProxy. Then
+ // clean up DesktopCapturerProxy::Core::CreateCapturer().
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return capture_video_on_dedicated_thread_;
+ #else
+ return false;
diff --git a/electron34/patches/patch-remoting_host_base_switches.cc b/electron34/patches/patch-remoting_host_base_switches.cc
new file mode 100644
index 0000000000..95db655ad4
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_base_switches.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/base/switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/base/switches.cc
+@@ -23,13 +23,13 @@ const char kProcessTypeEvaluateCapabilit
+ const char kProcessTypeFileChooser[] = "file_chooser";
+ const char kProcessTypeUrlForwarderConfigurator[] =
+ "url_forwarder_configurator";
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kProcessTypeXSessionChooser[] = "xsession_chooser";
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ const char kEvaluateCapabilitySwitchName[] = "evaluate-type";
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kEnableUtempter[] = "enable-utempter";
+ #endif
+
diff --git a/electron34/patches/patch-remoting_host_base_switches.h b/electron34/patches/patch-remoting_host_base_switches.h
new file mode 100644
index 0000000000..5c5c905002
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_base_switches.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/base/switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/base/switches.h
+@@ -35,13 +35,13 @@ extern const char kProcessTypeRdpDesktop
+ extern const char kProcessTypeEvaluateCapability[];
+ extern const char kProcessTypeFileChooser[];
+ extern const char kProcessTypeUrlForwarderConfigurator[];
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kProcessTypeXSessionChooser[];
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ extern const char kEvaluateCapabilitySwitchName[];
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Used to record client sessions to utmp/wtmp.
+ extern const char kEnableUtempter[];
+ #endif
diff --git a/electron34/patches/patch-remoting_host_basic__desktop__environment.cc b/electron34/patches/patch-remoting_host_basic__desktop__environment.cc
new file mode 100644
index 0000000000..d085e86dae
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_basic__desktop__environment.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/basic_desktop_environment.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/basic_desktop_environment.cc
+@@ -195,7 +195,7 @@ std::unique_ptr<DesktopCapturer> BasicDe
+ scoped_refptr<base::SingleThreadTaskRunner> capture_task_runner;
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ capture_task_runner = ui_task_runner_;
+-#elif BUILDFLAG(IS_LINUX) && defined(REMOTING_USE_WAYLAND)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_WAYLAND)
+ // Each capturer instance should get its own thread so the capturers don't
+ // compete with each other in multistream mode.
+ capture_task_runner = base::ThreadPool::CreateSingleThreadTaskRunner(
diff --git a/electron34/patches/patch-remoting_host_chromoting__host.cc b/electron34/patches/patch-remoting_host_chromoting__host.cc
new file mode 100644
index 0000000000..832da7d9a6
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_chromoting__host.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/chromoting_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/chromoting_host.cc
+@@ -135,7 +135,7 @@ void ChromotingHost::Start(const std::st
+ &ChromotingHost::OnIncomingSession, base::Unretained(this)));
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ChromotingHost::StartChromotingHostServices() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(!ipc_server_);
diff --git a/electron34/patches/patch-remoting_host_chromoting__host.h b/electron34/patches/patch-remoting_host_chromoting__host.h
new file mode 100644
index 0000000000..f0b1da4ad3
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_chromoting__host.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/chromoting_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/chromoting_host.h
+@@ -36,7 +36,7 @@
+ #include "remoting/protocol/session_manager.h"
+ #include "remoting/protocol/transport_context.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/chromoting_host_services_server.h"
+ #endif
+
+@@ -112,7 +112,7 @@ class ChromotingHost : public ClientSess
+ // This method can only be called once during the lifetime of this object.
+ void Start(const std::string& host_owner);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Starts running the ChromotingHostServices server and listening for incoming
+ // IPC binding requests.
+ // Currently only Linux runs the ChromotingHostServices server on the host
+@@ -220,7 +220,7 @@ class ChromotingHost : public ClientSess
+ // List of host extensions.
+ std::vector<std::unique_ptr<HostExtension>> extensions_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // IPC server that runs the CRD host service API. Non-null if the server name
+ // is set and the host is started.
+ // Currently only Linux runs the ChromotingHostServices server on the host
diff --git a/electron34/patches/patch-remoting_host_chromoting__host__context.cc b/electron34/patches/patch-remoting_host_chromoting__host__context.cc
new file mode 100644
index 0000000000..7d0a02ff3a
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_chromoting__host__context.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/chromoting_host_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/chromoting_host_context.cc
+@@ -293,7 +293,7 @@ std::unique_ptr<ChromotingHostContext> C
+ // on a UI thread.
+ scoped_refptr<AutoThreadTaskRunner> input_task_runner =
+ AutoThread::CreateWithType("ChromotingInputThread", ui_task_runner,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::MessagePumpType::UI);
+ #else
+ base::MessagePumpType::IO);
diff --git a/electron34/patches/patch-remoting_host_chromoting__host__services__client.cc b/electron34/patches/patch-remoting_host_chromoting__host__services__client.cc
new file mode 100644
index 0000000000..956f25c5ef
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_chromoting__host__services__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/chromoting_host_services_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/chromoting_host_services_client.cc
+@@ -59,7 +59,7 @@ mojo::PendingRemote<mojom::ChromotingHos
+
+ } // namespace
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ // static
+ constexpr char
+@@ -136,7 +136,7 @@ bool ChromotingHostServicesClient::Ensur
+ if (session_services_remote_.is_bound()) {
+ return true;
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!environment_->HasVar(kChromeRemoteDesktopSessionEnvVar)) {
+ LOG(WARNING) << "Current desktop environment is not remotable.";
+ return false;
diff --git a/electron34/patches/patch-remoting_host_client__session.cc b/electron34/patches/patch-remoting_host_client__session.cc
new file mode 100644
index 0000000000..b52abe3e8f
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_client__session.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/client_session.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/client_session.cc
+@@ -161,7 +161,7 @@ void ClientSession::NotifyClientResoluti
+ if (effective_policies_.curtain_required.value_or(false)) {
+ dpi_vector.set(resolution.x_dpi(), resolution.y_dpi());
+ }
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ dpi_vector.set(resolution.x_dpi(), resolution.y_dpi());
+ #endif
+
diff --git a/electron34/patches/patch-remoting_host_crash_crash__file__uploader.cc b/electron34/patches/patch-remoting_host_crash_crash__file__uploader.cc
new file mode 100644
index 0000000000..bcb15f712b
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_crash_crash__file__uploader.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/crash/crash_file_uploader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/crash/crash_file_uploader.cc
+@@ -44,7 +44,7 @@ constexpr char kMinidumpFileName[] = "du
+
+ #if BUILDFLAG(IS_WIN)
+ constexpr char kProductNameValue[] = "Chromoting";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr char kProductNameValue[] = "Chromoting_Linux";
+ #elif BUILDFLAG(IS_MAC)
+ constexpr char kProductNameValue[] = "Chromoting_Mac";
diff --git a/electron34/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc b/electron34/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc
new file mode 100644
index 0000000000..113d1c2ec8
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/desktop_and_cursor_conditional_composer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/desktop_and_cursor_conditional_composer.cc
+@@ -7,7 +7,7 @@
+ #include "base/functional/bind.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/linux/wayland_utils.h"
+ #endif
+
+@@ -96,7 +96,7 @@ bool DesktopAndCursorConditionalComposer
+ }
+
+ bool DesktopAndCursorConditionalComposer::SupportsFrameCallbacks() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return IsRunningWayland();
+ #else
+ return false;
diff --git a/electron34/patches/patch-remoting_host_desktop__capturer__proxy.cc b/electron34/patches/patch-remoting_host_desktop__capturer__proxy.cc
new file mode 100644
index 0000000000..11cac089e7
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_desktop__capturer__proxy.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/desktop_capturer_proxy.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/desktop_capturer_proxy.cc
+@@ -26,7 +26,7 @@
+ #include "remoting/host/chromeos/frame_sink_desktop_capturer.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #include "remoting/host/linux/wayland_desktop_capturer.h"
+@@ -91,7 +91,7 @@ void DesktopCapturerProxy::Core::CreateC
+
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ capturer_ = std::make_unique<FrameSinkDesktopCapturer>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ static base::nix::SessionType session_type = base::nix::SessionType::kUnset;
+ if (session_type == base::nix::SessionType::kUnset) {
+ std::unique_ptr<base::Environment> env = base::Environment::Create();
+@@ -298,7 +298,7 @@ void DesktopCapturerProxy::OnMetadata(we
+ bool DesktopCapturerProxy::SupportsFrameCallbacks() {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return IsRunningWayland();
+ #else
+ return false;
diff --git a/electron34/patches/patch-remoting_host_desktop__capturer__wrapper.cc b/electron34/patches/patch-remoting_host_desktop__capturer__wrapper.cc
new file mode 100644
index 0000000000..a9228ebf81
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_desktop__capturer__wrapper.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/desktop_capturer_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/desktop_capturer_wrapper.cc
+@@ -13,7 +13,7 @@
+ #include "third_party/webrtc/modules/desktop_capture/desktop_capturer.h"
+ #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/linux/wayland_desktop_capturer.h"
+ #include "remoting/host/linux/wayland_utils.h"
+ #endif
+@@ -33,7 +33,7 @@ void DesktopCapturerWrapper::CreateCaptu
+ SourceId id) {
+ DCHECK(!capturer_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ capturer_ = std::make_unique<WaylandDesktopCapturer>(options);
+ } else {
+@@ -112,7 +112,7 @@ void DesktopCapturerWrapper::OnCaptureRe
+ bool DesktopCapturerWrapper::SupportsFrameCallbacks() {
+ DCHECK_CALLED_ON_VALID_THREAD(thread_checker_);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return capturer_ && IsRunningWayland();
+ #else
+ return false;
diff --git a/electron34/patches/patch-remoting_host_evaluate__capability.cc b/electron34/patches/patch-remoting_host_evaluate__capability.cc
new file mode 100644
index 0000000000..86b3a11b5f
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_evaluate__capability.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/evaluate_capability.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/evaluate_capability.cc
+@@ -56,7 +56,7 @@ base::FilePath BuildHostBinaryPath() {
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (path.BaseName().value() ==
+ FILE_PATH_LITERAL("chrome-remote-desktop-host")) {
+ return path;
diff --git a/electron34/patches/patch-remoting_host_host__attributes.cc b/electron34/patches/patch-remoting_host_host__attributes.cc
new file mode 100644
index 0000000000..b94b56ff18
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_host__attributes.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/host_attributes.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/host_attributes.cc
+@@ -105,7 +105,7 @@ std::string GetHostAttributes() {
+ if (media::InitializeMediaFoundation()) {
+ result.push_back("HWEncoder");
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ result.push_back("HWEncoder");
+ #endif
+
diff --git a/electron34/patches/patch-remoting_host_host__details.cc b/electron34/patches/patch-remoting_host_host__details.cc
new file mode 100644
index 0000000000..c627057f52
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_host__details.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/host_details.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/host_details.cc
+@@ -23,7 +23,7 @@ std::string GetHostOperatingSystemName()
+ return "Mac";
+ #elif BUILDFLAG(IS_CHROMEOS_ASH)
+ return "ChromeOS";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return "Linux";
+ #elif BUILDFLAG(IS_ANDROID)
+ return "Android";
diff --git a/electron34/patches/patch-remoting_host_host__main.cc b/electron34/patches/patch-remoting_host_host__main.cc
new file mode 100644
index 0000000000..a2bdb679b7
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_host__main.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/host_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/host_main.cc
+@@ -50,7 +50,7 @@ int FileChooserMain();
+ int RdpDesktopSessionMain();
+ int UrlForwarderConfiguratorMain();
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ int XSessionChooserMain();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -63,7 +63,7 @@ const char kUsageMessage[] =
+ "\n"
+ "Options:\n"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ " --audio-pipe-name=<pipe> - Sets the pipe name to capture audio on "
+ "Linux.\n"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -156,7 +156,7 @@ MainRoutineFn SelectMainRoutine(const st
+ } else if (process_type == kProcessTypeUrlForwarderConfigurator) {
+ main_routine = &UrlForwarderConfiguratorMain;
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ } else if (process_type == kProcessTypeXSessionChooser) {
+ main_routine = &XSessionChooserMain;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -222,7 +222,7 @@ int HostMain(int argc, char** argv) {
+ // be initialized first, so that the preference for crash-reporting can be
+ // looked up in the config file.
+ if (IsUsageStatsAllowed()) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ InitializeCrashReporting();
+ #elif BUILDFLAG(IS_WIN)
+ // TODO: joedow - Enable crash reporting for the RDP process.
diff --git a/electron34/patches/patch-remoting_host_ipc__constants.cc b/electron34/patches/patch-remoting_host_ipc__constants.cc
new file mode 100644
index 0000000000..18f24fb604
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_ipc__constants.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/ipc_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/ipc_constants.cc
+@@ -17,7 +17,7 @@ namespace remoting {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ #if !defined(NDEBUG)
+ // Use a different IPC name for debug builds so that we can run the host
+@@ -81,7 +81,7 @@ GetChromotingHostServicesServerName() {
+ static const base::NoDestructor<mojo::NamedPlatformChannel::ServerName>
+ server_name(
+ named_mojo_ipc_server::WorkingDirectoryIndependentServerNameFromUTF8(
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux host creates the socket file in /tmp, and it won't be
+ // deleted until reboot, so we put username in the path in case
+ // the user switches the host owner.
diff --git a/electron34/patches/patch-remoting_host_it2me_it2me__host.cc b/electron34/patches/patch-remoting_host_it2me_it2me__host.cc
new file mode 100644
index 0000000000..4d6c17ee81
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_it2me_it2me__host.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/it2me/it2me_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/it2me/it2me_host.cc
+@@ -58,7 +58,7 @@
+ #include "remoting/host/chromeos/features.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/linux/wayland_manager.h"
+ #include "remoting/host/linux/wayland_utils.h"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -191,7 +191,7 @@ void It2MeHost::Connect(
+
+ OnPolicyUpdate(std::move(policies));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ WaylandManager::Get()->Init(host_context_->ui_task_runner());
+ }
+@@ -325,7 +325,7 @@ void It2MeHost::ConnectOnNetworkThread(
+
+ // Set up the desktop environment options.
+ DesktopEnvironmentOptions options(DesktopEnvironmentOptions::CreateDefault());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ options.desktop_capture_options()->set_prefer_cursor_embedded(true);
+ }
diff --git a/electron34/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc b/electron34/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc
new file mode 100644
index 0000000000..0eca8483cf
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/it2me/it2me_native_messaging_host_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/it2me/it2me_native_messaging_host_main.cc
+@@ -30,7 +30,7 @@
+ #include "remoting/host/resources.h"
+ #include "remoting/host/usage_stats_consent.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(REMOTING_USE_X11)
+ #include <gtk/gtk.h>
+ #include "base/linux_util.h"
+@@ -77,7 +77,7 @@ bool CurrentProcessHasUiAccess() {
+ // Creates a It2MeNativeMessagingHost instance, attaches it to stdin/stdout and
+ // runs the task executor until It2MeNativeMessagingHost signals shutdown.
+ int It2MeNativeMessagingHostMain(int argc, char** argv) {
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ if (!IsRunningWayland()) {
+ // Initialize Xlib for multi-threaded use, allowing non-Chromium code to
+ // use X11 safely (such as the WebRTC capturer, GTK ...)
+@@ -125,7 +125,7 @@ int It2MeNativeMessagingHostMain(int arg
+
+ remoting::LoadResources("");
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ // Required for any calls into GTK functions, such as the Disconnect and
+ // Continue windows. Calling with nullptr arguments because we don't have
+ // any command line arguments for gtk to consume.
+@@ -257,7 +257,7 @@ int It2MeNativeMessagingHostMain(int arg
+ PolicyWatcher::CreateWithTaskRunner(context->file_task_runner(),
+ context->management_service());
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ scoped_refptr<AutoThreadTaskRunner> input_task_runner;
+ if (!IsRunningWayland()) {
+ // Create an X11EventSource on all UI threads, so the global X11 connection
+@@ -284,7 +284,7 @@ int It2MeNativeMessagingHostMain(int arg
+ // Run the loop until channel is alive.
+ run_loop.Run();
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ if (!IsRunningWayland()) {
+ input_task_runner->PostTask(FROM_HERE, base::BindOnce([]() {
+ delete ui::X11EventSource::GetInstance();
diff --git a/electron34/patches/patch-remoting_host_me2me__desktop__environment.cc b/electron34/patches/patch-remoting_host_me2me__desktop__environment.cc
new file mode 100644
index 0000000000..2ef46c1a65
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_me2me__desktop__environment.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/me2me_desktop_environment.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/me2me_desktop_environment.cc
+@@ -108,7 +108,7 @@ std::string Me2MeDesktopEnvironment::Get
+ capabilities += protocol::kRemoteWebAuthnCapability;
+ }
+
+-#if BUILDFLAG(IS_LINUX) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ if (!IsRunningWayland()) {
+ capabilities += " ";
+ capabilities += protocol::kMultiStreamCapability;
+@@ -150,7 +150,7 @@ Me2MeDesktopEnvironment::Me2MeDesktopEnv
+ // properly under Xvfb.
+ mutable_desktop_capture_options()->set_use_update_notifications(true);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Setting this option to false means that the capture differ wrapper will not
+ // be used when the X11 capturer is selected. This reduces the X11 capture
+ // time by a few milliseconds per frame and is safe because we can rely on
+@@ -159,7 +159,7 @@ Me2MeDesktopEnvironment::Me2MeDesktopEnv
+ mutable_desktop_capture_options()->set_detect_updated_region(false);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ mutable_desktop_capture_options()->set_prefer_cursor_embedded(false);
+ }
+@@ -184,7 +184,7 @@ bool Me2MeDesktopEnvironment::Initialize
+
+ // Otherwise, if the session is shared with the local user start monitoring
+ // the local input and create the in-session UI.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool want_user_interface = false;
+ #elif BUILDFLAG(IS_APPLE)
+ // Don't try to display any UI on top of the system's login screen as this
diff --git a/electron34/patches/patch-remoting_host_mojo__caller__security__checker.cc b/electron34/patches/patch-remoting_host_mojo__caller__security__checker.cc
new file mode 100644
index 0000000000..10e4c3091e
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_mojo__caller__security__checker.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/mojo_caller_security_checker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/mojo_caller_security_checker.cc
+@@ -37,7 +37,7 @@
+ namespace remoting {
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr auto kAllowedCallerProgramNames =
+ base::MakeFixedFlatSet<base::FilePath::StringPieceType>({
+ "remote-open-url",
+@@ -98,7 +98,7 @@ bool IsTrustedMojoEndpoint(
+ return true;
+ #endif
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+
+ // TODO: yuweih - see if it's possible to move away from PID-based security
+ // checks, which might be susceptible of PID reuse attacks.
+@@ -122,7 +122,7 @@ bool IsTrustedMojoEndpoint(
+ base::FilePath::StringType program_name =
+ caller_process_image_path.BaseName().value();
+ if (!kAllowedCallerProgramNames.contains(program_name)) {
+-#if BUILDFLAG(IS_LINUX) && !defined(NDEBUG)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !defined(NDEBUG)
+ // Linux binaries generated in out/Debug are underscore-separated. To make
+ // debugging easier, we just check the name again with underscores replaced
+ // with hyphens.
diff --git a/electron34/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc b/electron34/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc
new file mode 100644
index 0000000000..25b63d5837
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/mouse_cursor_monitor_proxy.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/mouse_cursor_monitor_proxy.cc
+@@ -73,7 +73,7 @@ void MouseCursorMonitorProxy::Core::Crea
+
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ mouse_cursor_monitor_ = std::make_unique<MouseCursorMonitorAura>();
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ mouse_cursor_monitor_ = webrtc::MouseCursorMonitor::Create(options);
+ } else {
diff --git a/electron34/patches/patch-remoting_host_policy__watcher.cc b/electron34/patches/patch-remoting_host_policy__watcher.cc
new file mode 100644
index 0000000000..a6bedba5a7
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_policy__watcher.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/policy_watcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/policy_watcher.cc
+@@ -178,7 +178,7 @@ base::Value::Dict PolicyWatcher::GetDefa
+ true);
+ result.Set(key::kRemoteAccessHostAllowEnterpriseFileTransfer, false);
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ result.Set(key::kRemoteAccessHostMatchUsername, false);
+ #endif
+ #if !BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc b/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc
new file mode 100644
index 0000000000..8e0aa30760
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/remote_open_url/remote_open_url_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/remote_open_url/remote_open_url_client.cc
+@@ -18,7 +18,7 @@
+ #include "remoting/host/mojom/chromoting_host_services.mojom.h"
+ #include "remoting/host/mojom/remote_url_opener.mojom.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/remote_open_url/remote_open_url_client_delegate_linux.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "remoting/host/remote_open_url/remote_open_url_client_delegate_win.h"
+@@ -31,7 +31,7 @@ namespace {
+ constexpr base::TimeDelta kRequestTimeout = base::Seconds(5);
+
+ std::unique_ptr<RemoteOpenUrlClient::Delegate> CreateDelegate() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<RemoteOpenUrlClientDelegateLinux>();
+ #elif BUILDFLAG(IS_WIN)
+ return std::make_unique<RemoteOpenUrlClientDelegateWin>();
diff --git a/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc b/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc
new file mode 100644
index 0000000000..866779f1ff
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/remote_open_url/remote_open_url_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/remote_open_url/remote_open_url_util.cc
+@@ -29,7 +29,7 @@ const wchar_t kRegisteredApplicationsKey
+ #endif // BUILDFLAG(IS_WIN)
+
+ bool IsRemoteOpenUrlSupported() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return true;
+ #elif BUILDFLAG(IS_WIN)
+ // The MSI installs the ProgID and capabilities into registry, but not the
diff --git a/electron34/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc b/electron34/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc
new file mode 100644
index 0000000000..a7c8dc9bd8
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/remote_open_url/url_forwarder_configurator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/remote_open_url/url_forwarder_configurator.cc
+@@ -12,7 +12,7 @@ UrlForwarderConfigurator::UrlForwarderCo
+
+ UrlForwarderConfigurator::~UrlForwarderConfigurator() = default;
+
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_WIN)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_BSD)
+
+ // static
+ std::unique_ptr<UrlForwarderConfigurator> UrlForwarderConfigurator::Create() {
diff --git a/electron34/patches/patch-remoting_host_remoting__me2me__host.cc b/electron34/patches/patch-remoting_host_remoting__me2me__host.cc
new file mode 100644
index 0000000000..7e64d343cc
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_remoting__me2me__host.cc
@@ -0,0 +1,166 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/remoting_me2me_host.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/remoting_me2me_host.cc
+@@ -145,7 +145,7 @@
+ #include "remoting/host/mac/permission_utils.h"
+ #endif // BUILDFLAG(IS_APPLE)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(REMOTING_USE_X11)
+ #include <gtk/gtk.h>
+ #endif // defined(REMOTING_USE_X11)
+@@ -156,13 +156,13 @@
+ #endif // defined(REMOTING_USE_X11)
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/linux_util.h"
+ #include "remoting/host/audio_capturer_linux.h"
+ #include "remoting/host/linux/certificate_watcher.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/host_utmp_logger.h"
+ #endif
+
+@@ -176,7 +176,7 @@
+ #include "remoting/host/win/session_desktop_environment.h"
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/linux/wayland_manager.h"
+ #include "remoting/host/linux/wayland_utils.h"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -204,7 +204,7 @@ const char kApplicationName[] = "chromot
+ const char kStdinConfigPath[] = "-";
+ #endif // !defined(REMOTING_MULTI_PROCESS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The command line switch used to pass name of the pipe to capture audio on
+ // linux.
+ const char kAudioPipeSwitchName[] = "audio-pipe-name";
+@@ -448,7 +448,7 @@ class HostProcess : public ConfigWatcher
+ std::unique_ptr<AgentProcessBrokerClient> agent_process_broker_client_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Watch for certificate changes and kill the host when changes occur
+ std::unique_ptr<CertificateWatcher> cert_watcher_;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -510,7 +510,7 @@ class HostProcess : public ConfigWatcher
+ std::unique_ptr<FtlEchoMessageListener> ftl_echo_message_listener_;
+
+ std::unique_ptr<HostEventLogger> host_event_logger_;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<HostUTMPLogger> host_utmp_logger_;
+ #endif
+ std::unique_ptr<HostPowerSaveBlocker> power_save_blocker_;
+@@ -828,7 +828,7 @@ void HostProcess::StartOnNetworkThread()
+ void HostProcess::ShutdownOnNetworkThread() {
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
+ config_watcher_.reset();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ cert_watcher_.reset();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ }
+@@ -899,7 +899,7 @@ void HostProcess::CreateAuthenticatorFac
+ context_->url_loader_factory(), service_account_email_,
+ oauth_refresh_token_));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!cert_watcher_) {
+ cert_watcher_ = std::make_unique<CertificateWatcher>(
+ base::BindRepeating(&HostProcess::ShutdownHost,
+@@ -1041,13 +1041,13 @@ void HostProcess::StartOnUiThread() {
+ base::BindRepeating(&HostProcess::OnPolicyUpdate, base::Unretained(this)),
+ base::BindRepeating(&HostProcess::OnPolicyError, base::Unretained(this)));
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (IsRunningWayland()) {
+ WaylandManager::Get()->Init(context_->ui_task_runner());
+ }
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // If an audio pipe is specific on the command-line then initialize
+ // AudioCapturerLinux to capture from it.
+ base::FilePath audio_pipe_name =
+@@ -1124,7 +1124,7 @@ void HostProcess::ShutdownOnUiThread() {
+ // It is now safe for the HostProcess to be deleted.
+ self_ = nullptr;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Cause the global AudioPipeReader to be freed, otherwise the audio
+ // thread will remain in-use and prevent the process from exiting.
+ // TODO(wez): DesktopEnvironmentFactory should own the pipe reader.
+@@ -1132,7 +1132,7 @@ void HostProcess::ShutdownOnUiThread() {
+ AudioCapturerLinux::InitializePipeReader(nullptr, base::FilePath());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ context_->input_task_runner()->PostTask(
+ FROM_HERE,
+ base::BindOnce([]() { delete ui::X11EventSource::GetInstance(); }));
+@@ -1844,7 +1844,7 @@ void HostProcess::StartHost() {
+ corp_host_status_logger_->StartObserving(*session_manager);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ desktop_environment_options_.set_enable_remote_webauthn(is_corp_host_);
+ #endif
+
+@@ -1863,7 +1863,7 @@ void HostProcess::StartHost() {
+
+ host_->AddExtension(std::make_unique<TestEchoExtension>());
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(kEnableUtempter)) {
+ host_utmp_logger_ =
+@@ -1899,7 +1899,7 @@ void HostProcess::StartHost() {
+ // addresses.
+ host_->Start(*host_owner_emails_.begin());
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // For Windows, ChromotingHostServices connections are handled by the daemon
+ // process, then the message pipe is forwarded to the network process.
+ host_->StartChromotingHostServices();
+@@ -2043,7 +2043,7 @@ int HostProcessMain() {
+ HOST_LOG << "Starting host process: version " << STRINGIZE(VERSION);
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if defined(REMOTING_USE_X11)
+ // Initialize Xlib for multi-threaded use, allowing non-Chromium code to
+ // use X11 safely (such as the WebRTC capturer, GTK ...)
+@@ -2092,7 +2092,7 @@ int HostProcessMain() {
+ std::unique_ptr<net::NetworkChangeNotifier> network_change_notifier(
+ net::NetworkChangeNotifier::CreateIfNeeded());
+
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(REMOTING_USE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && defined(REMOTING_USE_X11)
+ // Create an X11EventSource on all UI threads, so the global X11 connection
+ // (x11::Connection::Get()) can dispatch X events.
+ auto event_source =
diff --git a/electron34/patches/patch-remoting_host_session__policies__from__dict.cc b/electron34/patches/patch-remoting_host_session__policies__from__dict.cc
new file mode 100644
index 0000000000..3505499b00
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_session__policies__from__dict.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/session_policies_from_dict.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/session_policies_from_dict.cc
+@@ -76,7 +76,7 @@ std::optional<SessionPolicies> SessionPo
+ .curtain_required =
+ dict.FindBool(policy::key::kRemoteAccessHostRequireCurtain),
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ .host_username_match_required =
+ dict.FindBool(policy::key::kRemoteAccessHostMatchUsername),
+ #endif
diff --git a/electron34/patches/patch-remoting_host_setup_start__host__main.cc b/electron34/patches/patch-remoting_host_setup_start__host__main.cc
new file mode 100644
index 0000000000..64ec3490b2
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_setup_start__host__main.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/setup/start_host_main.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/setup/start_host_main.cc
+@@ -38,7 +38,7 @@
+ #include <unistd.h>
+ #endif // BUILDFLAG(IS_POSIX)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "remoting/host/setup/daemon_controller_delegate_linux.h"
+ #include "remoting/host/setup/start_host_as_root.h"
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -369,7 +369,7 @@ bool InitializeCloudMachineParams(HostSt
+ } // namespace
+
+ int StartHostMain(int argc, char** argv) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Minimize the amount of code that runs as root on Posix systems.
+ if (getuid() == 0) {
+ return remoting::StartHostAsRoot(argc, argv);
+@@ -394,7 +394,7 @@ int StartHostMain(int argc, char** argv)
+
+ mojo::core::Init();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (command_line->HasSwitch("no-start")) {
+ // On Linux, registering the host with systemd and starting it is the only
+ // reason start_host requires root. The --no-start options skips that final
diff --git a/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc b/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc
new file mode 100644
index 0000000000..0ae7423e74
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/webauthn/remote_webauthn_caller_security_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/webauthn/remote_webauthn_caller_security_utils.cc
+@@ -10,7 +10,7 @@
+ #include "base/strings/utf_string_conversions.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "base/containers/fixed_flat_set.h"
+ #include "base/files/file_path.h"
+ #include "base/process/process_handle.h"
+@@ -38,7 +38,7 @@ namespace {
+
+ // No static variables needed for debug builds.
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+
+ constexpr auto kAllowedCallerPrograms =
+ base::MakeFixedFlatSet<base::FilePath::StringPieceType>({
+@@ -82,7 +82,7 @@ bool IsLaunchedByTrustedProcess() {
+ #if !defined(NDEBUG)
+ // Just return true on debug builds for the convenience of development.
+ return true;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ProcessId parent_pid =
+ base::GetParentProcessId(base::GetCurrentProcessHandle());
+ // Note that on Linux the process image may no longer exist in its original
diff --git a/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc b/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc
new file mode 100644
index 0000000000..62c2d155c2
--- /dev/null
+++ b/electron34/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/host/webauthn/remote_webauthn_extension_notifier.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/host/webauthn/remote_webauthn_extension_notifier.cc
+@@ -30,7 +30,7 @@
+ #include "base/task/thread_pool.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/nix/xdg_util.h"
+ #include "base/strings/string_util.h"
+@@ -75,14 +75,14 @@ static constexpr char kExtensionWakeupFi
+ // Caller should check if the directory exists before writing files to it. A
+ // directory only exists if the corresponding Chrome version is installed.
+ std::vector<base::FilePath> GetRemoteStateChangeDirPaths() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ constexpr base::FilePath::CharType kStateChangeDirName[] =
+ FILE_PATH_LITERAL("WebAuthenticationProxyRemoteSessionStateChange");
+ #endif
+
+ std::vector<base::FilePath> dirs;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // See: chrome/common/chrome_paths_linux.cc
+ auto env = base::Environment::Create();
+ base::FilePath base_path;
diff --git a/electron34/patches/patch-remoting_protocol_webrtc__video__stream.cc b/electron34/patches/patch-remoting_protocol_webrtc__video__stream.cc
new file mode 100644
index 0000000000..476a95fcdb
--- /dev/null
+++ b/electron34/patches/patch-remoting_protocol_webrtc__video__stream.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- remoting/protocol/webrtc_video_stream.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ remoting/protocol/webrtc_video_stream.cc
+@@ -267,7 +267,7 @@ WebrtcVideoStream::WebrtcVideoStream(con
+ : session_options_(session_options) {
+ // TODO(joedow): Dig into the threading model on other platforms to see if they
+ // can also be updated to run on a dedicated thread.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ core_task_runner_ = base::ThreadPool::CreateSingleThreadTaskRunner(
+ {base::TaskPriority::HIGHEST},
+ base::SingleThreadTaskRunnerThreadMode::DEDICATED);
diff --git a/electron34/patches/patch-sandbox_BUILD.gn b/electron34/patches/patch-sandbox_BUILD.gn
new file mode 100644
index 0000000000..4f6344c37a
--- /dev/null
+++ b/electron34/patches/patch-sandbox_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/BUILD.gn
+@@ -49,7 +49,7 @@ group("sandbox") {
+ "//sandbox/mac:system_services",
+ "//sandbox/mac/mojom",
+ ]
+- } else if (is_linux || is_chromeos || is_android) {
++ } else if ((is_linux && !is_bsd) || is_chromeos || is_android) {
+ public_deps = [ "//sandbox/linux:sandbox" ]
+ }
+ }
diff --git a/electron34/patches/patch-sandbox_features.gni b/electron34/patches/patch-sandbox_features.gni
new file mode 100644
index 0000000000..c9fd52a0b6
--- /dev/null
+++ b/electron34/patches/patch-sandbox_features.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/features.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/features.gni
+@@ -6,7 +6,7 @@
+ # currently.
+ # Do not disable seccomp_bpf anywhere without talking to
+ # security%chromium.org@localhost!
+-use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
++use_seccomp_bpf = !is_bsd && (is_linux || is_chromeos || is_android) &&
+ (current_cpu == "x86" || current_cpu == "x64" ||
+ current_cpu == "arm" || current_cpu == "arm64" ||
+ current_cpu == "mipsel" || current_cpu == "mips64el")
diff --git a/electron34/patches/patch-sandbox_linux_BUILD.gn b/electron34/patches/patch-sandbox_linux_BUILD.gn
new file mode 100644
index 0000000000..f6e4e65c33
--- /dev/null
+++ b/electron34/patches/patch-sandbox_linux_BUILD.gn
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/linux/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/linux/BUILD.gn
+@@ -12,11 +12,11 @@ if (is_android) {
+ }
+
+ declare_args() {
+- compile_suid_client = is_linux || is_chromeos
++ compile_suid_client = (is_linux || is_chromeos) && !is_bsd
+
+- compile_credentials = is_linux || is_chromeos
++ compile_credentials = (is_linux || is_chromeos) && !is_bsd
+
+- compile_syscall_broker = is_linux || is_chromeos
++ compile_syscall_broker = (is_linux || is_chromeos) && !is_bsd
+
+ # On Android, use plain GTest.
+ use_base_test_suite = is_linux || is_chromeos
+@@ -380,6 +380,17 @@ component("sandbox_services") {
+ "services/libc_interceptor.h",
+ ]
+ }
++
++ if (is_bsd) {
++ sources -= [
++ "services/scoped_process.cc",
++ "services/scoped_process.h",
++ "services/syscall_wrappers.cc",
++ "services/syscall_wrappers.h",
++ "services/yama.cc",
++ "services/yama.h",
++ ]
++ }
+ }
+
+ source_set("sandbox_services_headers") {
diff --git a/electron34/patches/patch-sandbox_linux_services_init__process__reaper.cc b/electron34/patches/patch-sandbox_linux_services_init__process__reaper.cc
new file mode 100644
index 0000000000..daa0a4ef5a
--- /dev/null
+++ b/electron34/patches/patch-sandbox_linux_services_init__process__reaper.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/linux/services/init_process_reaper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/linux/services/init_process_reaper.cc
+@@ -2,6 +2,7 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#if 0
+ #include "sandbox/linux/services/init_process_reaper.h"
+
+ #include <signal.h>
+@@ -100,3 +101,4 @@ bool CreateInitProcessReaper(base::OnceC
+ }
+
+ } // namespace sandbox.
++#endif
diff --git a/electron34/patches/patch-sandbox_linux_services_libc__interceptor.cc b/electron34/patches/patch-sandbox_linux_services_libc__interceptor.cc
new file mode 100644
index 0000000000..64dc9d8504
--- /dev/null
+++ b/electron34/patches/patch-sandbox_linux_services_libc__interceptor.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/linux/services/libc_interceptor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/linux/services/libc_interceptor.cc
+@@ -17,7 +17,9 @@
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <string.h>
++#if !BUILDFLAG(IS_BSD)
+ #include <sys/prctl.h>
++#endif
+ #include <sys/socket.h>
+ #include <sys/types.h>
+ #include <time.h>
+@@ -173,7 +175,7 @@ bool ReadTimeStruct(base::PickleIterator
+ } else {
+ base::AutoLock lock(g_timezones_lock.Get());
+ auto ret_pair = g_timezones.Get().insert(timezone);
+- output->tm_zone = ret_pair.first->c_str();
++ output->tm_zone = (char *)ret_pair.first->c_str();
+ }
+
+ return true;
diff --git a/electron34/patches/patch-sandbox_mac_BUILD.gn b/electron34/patches/patch-sandbox_mac_BUILD.gn
new file mode 100644
index 0000000000..7662e153c5
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_BUILD.gn
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/BUILD.gn
+@@ -39,6 +39,7 @@ component("seatbelt") {
+ ]
+ public_deps = [ "//third_party/protobuf:protobuf_lite" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ component("seatbelt_extension") {
+@@ -52,6 +53,7 @@ component("seatbelt_extension") {
+ libs = [ "sandbox" ]
+ public_deps = [ "//base" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ component("system_services") {
+@@ -66,6 +68,7 @@ component("system_services") {
+ deps = [ ":seatbelt_export" ]
+ public_deps = [ "//base" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ source_set("sandbox_unittests") {
diff --git a/electron34/patches/patch-sandbox_mac_sandbox__compiler.cc b/electron34/patches/patch-sandbox_mac_sandbox__compiler.cc
new file mode 100644
index 0000000000..110109d874
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_sandbox__compiler.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/sandbox_compiler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/sandbox_compiler.cc
+@@ -7,6 +7,7 @@
+ #include <string>
+ #include <vector>
+
++#include "electron/mas.h"
+ #include "sandbox/mac/seatbelt.h"
+
+ namespace sandbox {
+@@ -47,6 +48,7 @@ bool SandboxCompiler::SetParameter(const
+ }
+
+ bool SandboxCompiler::CompileAndApplyProfile(std::string& error) {
++#if !IS_MAS_BUILD()
+ if (mode_ == Target::kSource) {
+ std::vector<const char*> params;
+
+@@ -67,6 +69,9 @@ bool SandboxCompiler::CompileAndApplyPro
+ }
+ }
+ return false;
++#else
++ return true;
++#endif
+ }
+
+ bool SandboxCompiler::CompilePolicyToProto(mac::SandboxPolicy& policy,
diff --git a/electron34/patches/patch-sandbox_mac_sandbox__logging.cc b/electron34/patches/patch-sandbox_mac_sandbox__logging.cc
new file mode 100644
index 0000000000..7abf5127cc
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_sandbox__logging.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/sandbox_logging.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/sandbox_logging.cc
+@@ -16,6 +16,7 @@
+ #include <string>
+
+ #include "build/build_config.h"
++#include "electron/mas.h"
+ #include "sandbox/mac/sandbox_crash_message.h"
+
+ #if defined(ARCH_CPU_X86_64)
+@@ -33,9 +34,11 @@
+ }
+ #endif
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ void abort_report_np(const char*, ...);
+ }
++#endif
+
+ namespace sandbox::logging {
+
+@@ -76,9 +79,11 @@ void SendOsLog(Level level, const char*
+ sandbox::crash_message::SetCrashMessage(message);
+ }
+
++#if !IS_MAS_BUILD()
+ if (level == Level::FATAL) {
+ abort_report_np(message);
+ }
++#endif
+ }
+
+ // |error| is strerror(errno) when a P* logging function is called. Pass
diff --git a/electron34/patches/patch-sandbox_mac_seatbelt.cc b/electron34/patches/patch-sandbox_mac_seatbelt.cc
new file mode 100644
index 0000000000..14e7a2203d
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_seatbelt.cc
@@ -0,0 +1,176 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/seatbelt.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/seatbelt.cc
+@@ -4,12 +4,14 @@
+
+ #include "sandbox/mac/seatbelt.h"
+
++#include "electron/mas.h"
++
+ #include <errno.h>
+ #include <unistd.h>
+
+ extern "C" {
+ #include <sandbox.h>
+-
++#if !IS_MAS_BUILD()
+ int sandbox_init_with_parameters(const char* profile,
+ uint64_t flags,
+ const char* const parameters[],
+@@ -40,13 +42,13 @@ sandbox_profile_t* sandbox_compile_strin
+ char** error);
+ int sandbox_apply(sandbox_profile_t*);
+ void sandbox_free_profile(sandbox_profile_t*);
+-
++#endif
+ } // extern "C"
+
+ namespace sandbox {
+
+ namespace {
+-
++#if !IS_MAS_BUILD()
+ bool HandleSandboxResult(int rv, char* errorbuf, std::string* error) {
+ if (rv == 0) {
+ if (error)
+@@ -74,36 +76,48 @@ bool HandleSandboxErrno(int rv, const ch
+ }
+ return false;
+ }
+-
++#endif
+ } // namespace
+
+ // static
+ Seatbelt::Parameters Seatbelt::Parameters::Create() {
+ Parameters params;
++#if !IS_MAS_BUILD()
+ params.params_ = ::sandbox_create_params();
++#endif
+ return params;
+ }
+
+ Seatbelt::Parameters::Parameters() = default;
+
+ Seatbelt::Parameters::Parameters(Seatbelt::Parameters&& other) {
++#if !IS_MAS_BUILD()
+ params_ = std::exchange(other.params_, nullptr);
++#endif
+ }
+
+ Seatbelt::Parameters& Seatbelt::Parameters::operator=(
+ Seatbelt::Parameters&& other) {
++#if !IS_MAS_BUILD()
+ params_ = std::exchange(other.params_, nullptr);
++#endif
+ return *this;
+ }
+
+ bool Seatbelt::Parameters::Set(const char* key, const char* value) {
++#if !IS_MAS_BUILD()
+ return ::sandbox_set_param(params_, key, value) == 0;
++#else
++ return true;
++#endif
+ }
+
+ Seatbelt::Parameters::~Parameters() {
++#if !IS_MAS_BUILD()
+ if (params_) {
+ ::sandbox_free_params(params_);
+ }
++#endif
+ }
+
+ // Initialize the static member variables.
+@@ -114,6 +128,7 @@ const char* Seatbelt::kProfilePureComput
+
+ // static
+ bool Seatbelt::Init(const char* profile, uint64_t flags, std::string* error) {
++#if !IS_MAS_BUILD()
+ // OS X deprecated these functions, but did not provide a suitable replacement,
+ // so ignore the deprecation warning.
+ #pragma clang diagnostic push
+@@ -122,6 +137,9 @@ bool Seatbelt::Init(const char* profile,
+ int rv = ::sandbox_init(profile, flags, &errorbuf);
+ return HandleSandboxResult(rv, errorbuf, error);
+ #pragma clang diagnostic pop
++#else
++ return true;
++#endif
+ }
+
+ // static
+@@ -129,10 +147,14 @@ bool Seatbelt::InitWithParams(const char
+ uint64_t flags,
+ const char* const parameters[],
+ std::string* error) {
++#if !IS_MAS_BUILD()
+ char* errorbuf = nullptr;
+ int rv =
+ ::sandbox_init_with_parameters(profile, flags, parameters, &errorbuf);
+ return HandleSandboxResult(rv, errorbuf, error);
++#else
++ return true;
++#endif
+ }
+
+ // static
+@@ -140,6 +162,7 @@ bool Seatbelt::Compile(const char* profi
+ const Seatbelt::Parameters& params,
+ std::string& compiled_profile,
+ std::string* error) {
++#if !IS_MAS_BUILD()
+ char* errorbuf = nullptr;
+ sandbox_profile_t* sandbox_profile =
+ ::sandbox_compile_string(profile, params.params(), &errorbuf);
+@@ -149,33 +172,44 @@ bool Seatbelt::Compile(const char* profi
+ compiled_profile.assign(reinterpret_cast<const char*>(sandbox_profile->data),
+ sandbox_profile->size);
+ ::sandbox_free_profile(sandbox_profile);
++#endif
+ return true;
+ }
+
+ // static
+ bool Seatbelt::ApplyCompiledProfile(const std::string& profile,
+ std::string* error) {
++#if !IS_MAS_BUILD()
+ sandbox_profile_t sbox_profile = {
+ .builtin = nullptr,
+ .data = reinterpret_cast<const uint8_t*>(profile.data()),
+ .size = profile.size()};
+ return HandleSandboxErrno(::sandbox_apply(&sbox_profile),
+ "sandbox_apply: ", error);
++#else
++ return true;
++#endif
+ }
+
+ // static
+ void Seatbelt::FreeError(char* errorbuf) {
++#if !IS_MAS_BUILD()
+ // OS X deprecated these functions, but did not provide a suitable replacement,
+ // so ignore the deprecation warning.
+ #pragma clang diagnostic push
+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return ::sandbox_free_error(errorbuf);
+ #pragma clang diagnostic pop
++#endif
+ }
+
+ // static
+ bool Seatbelt::IsSandboxed() {
++#if !IS_MAS_BUILD()
+ return ::sandbox_check(getpid(), NULL, 0);
++#else
++ return true;
++#endif
+ }
+
+ } // namespace sandbox
diff --git a/electron34/patches/patch-sandbox_mac_seatbelt__extension.cc b/electron34/patches/patch-sandbox_mac_seatbelt__extension.cc
new file mode 100644
index 0000000000..5aa874db8a
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_seatbelt__extension.cc
@@ -0,0 +1,66 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/seatbelt_extension.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/seatbelt_extension.cc
+@@ -9,8 +9,10 @@
+ #include "base/check.h"
+ #include "base/memory/ptr_util.h"
+ #include "base/notreached.h"
++#include "electron/mas.h"
+ #include "sandbox/mac/seatbelt_extension_token.h"
+
++#if !IS_MAS_BUILD()
+ // libsandbox private API.
+ extern "C" {
+ extern const char* APP_SANDBOX_READ;
+@@ -22,6 +24,7 @@ char* sandbox_extension_issue_file(const
+ const char* path,
+ uint32_t flags);
+ }
++#endif
+
+ namespace sandbox {
+
+@@ -50,7 +53,11 @@ std::unique_ptr<SeatbeltExtension> Seatb
+
+ bool SeatbeltExtension::Consume() {
+ DCHECK(!token_.empty());
++#if !IS_MAS_BUILD()
+ handle_ = sandbox_extension_consume(token_.c_str());
++#else
++ handle_ = -1;
++#endif
+ return handle_ > 0;
+ }
+
+@@ -62,7 +69,11 @@ bool SeatbeltExtension::ConsumePermanent
+ }
+
+ bool SeatbeltExtension::Revoke() {
++#if !IS_MAS_BUILD()
+ int rv = sandbox_extension_release(handle_);
++#else
++ int rv = -1;
++#endif
+ handle_ = 0;
+ token_.clear();
+ return rv == 0;
+@@ -80,12 +91,14 @@ SeatbeltExtension::SeatbeltExtension(con
+ char* SeatbeltExtension::IssueToken(SeatbeltExtension::Type type,
+ const std::string& resource) {
+ switch (type) {
++#if !IS_MAS_BUILD()
+ case FILE_READ:
+ return sandbox_extension_issue_file(APP_SANDBOX_READ, resource.c_str(),
+ 0);
+ case FILE_READ_WRITE:
+ return sandbox_extension_issue_file(APP_SANDBOX_READ_WRITE,
+ resource.c_str(), 0);
++#endif
+ default:
+ NOTREACHED();
+ }
diff --git a/electron34/patches/patch-sandbox_mac_system__services.cc b/electron34/patches/patch-sandbox_mac_system__services.cc
new file mode 100644
index 0000000000..55b47db1c2
--- /dev/null
+++ b/electron34/patches/patch-sandbox_mac_system__services.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/mac/system_services.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/mac/system_services.cc
+@@ -8,7 +8,9 @@
+ #include <CoreFoundation/CoreFoundation.h>
+
+ #include "base/apple/osstatus_logging.h"
++#include "electron/mas.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ OSStatus SetApplicationIsDaemon(Boolean isDaemon);
+ void _LSSetApplicationLaunchServicesServerConnectionStatus(
+@@ -19,10 +21,12 @@ void _LSSetApplicationLaunchServicesServ
+ // https://github.com/WebKit/WebKit/blob/24aaedc770d192d03a07ba4a71727274aaa8fc07/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm#L840
+ void _CSCheckFixDisable();
+ } // extern "C"
++#endif
+
+ namespace sandbox {
+
+ void DisableLaunchServices() {
++ #if !IS_MAS_BUILD()
+ // Allow the process to continue without a LaunchServices ASN. The
+ // INIT_Process function in HIServices will abort if it cannot connect to
+ // launchservicesd to get an ASN. By setting this flag, HIServices skips
+@@ -36,10 +40,13 @@ void DisableLaunchServices() {
+ 0, ^bool(CFDictionaryRef options) {
+ return false;
+ });
++ #endif
+ }
+
+ void DisableCoreServicesCheckFix() {
++#if !IS_MAS_BUILD()
+ _CSCheckFixDisable();
++#endif
+ }
+
+ } // namespace sandbox
diff --git a/electron34/patches/patch-sandbox_policy_BUILD.gn b/electron34/patches/patch-sandbox_policy_BUILD.gn
new file mode 100644
index 0000000000..74cb071f30
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_BUILD.gn
@@ -0,0 +1,67 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/BUILD.gn
+@@ -50,7 +50,7 @@ component("policy") {
+ "//third_party/jni_zero",
+ ]
+ }
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "linux/bpf_audio_policy_linux.cc",
+ "linux/bpf_audio_policy_linux.h",
+@@ -129,6 +129,49 @@ component("policy") {
+ "//sandbox/linux:suid_sandbox_client",
+ ]
+ }
++ if (is_openbsd) {
++ sources += [
++ "openbsd/sandbox_openbsd.cc",
++ "openbsd/sandbox_openbsd.h",
++ ]
++ deps += [
++ "//sandbox:sandbox_buildflags",
++ "//ui/gfx/x",
++ ]
++ libs = [ "util" ]
++ }
++ if (is_netbsd) {
++ sources += [
++ "netbsd/sandbox_netbsd.cc",
++ "netbsd/sandbox_netbsd.h",
++ ]
++ deps += [
++ "//sandbox:sandbox_buildflags",
++ "//ui/gfx/x",
++ ]
++ libs = [ "util" ]
++ }
++ if (is_netbsd) {
++ sources += [
++ "netbsd/sandbox_netbsd.cc",
++ "netbsd/sandbox_netbsd.h",
++ ]
++ deps += [
++ "//sandbox:sandbox_buildflags",
++ "//ui/gfx/x",
++ ]
++ libs = [ "util" ]
++ }
++ if (is_freebsd) {
++ sources += [
++ "freebsd/sandbox_freebsd.cc",
++ "freebsd/sandbox_freebsd.h",
++ ]
++ deps += [
++ "//sandbox:sandbox_buildflags",
++ "//ui/gfx/x",
++ ]
++ }
+ if (is_chromeos_ash) {
+ sources += [
+ "linux/bpf_ime_policy_linux.cc",
diff --git a/electron34/patches/patch-sandbox_policy_features.cc b/electron34/patches/patch-sandbox_policy_features.cc
new file mode 100644
index 0000000000..7efd56f4f1
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_features.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/features.cc
+@@ -20,7 +20,11 @@ namespace sandbox::policy::features {
+ // (Only causes an effect when feature kNetworkServiceInProcess is disabled.)
+ BASE_FEATURE(kNetworkServiceSandbox,
+ "NetworkServiceSandbox",
++#if BUILDFLAG(IS_BSD)
++ base::FEATURE_ENABLED_BY_DEFAULT);
++#else
+ base::FEATURE_DISABLED_BY_DEFAULT);
++#endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ // Enables a fine-grained seccomp-BPF syscall filter for the network service.
+@@ -132,7 +136,7 @@ BASE_FEATURE(kSpectreVariant2Mitigation,
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Enabling the kNetworkServiceSandbox feature automatically enables Spectre
+ // variant 2 mitigations in the network service. This can lead to performance
+ // regressions, so enabling this feature will turn off the Spectre Variant 2
diff --git a/electron34/patches/patch-sandbox_policy_features.h b/electron34/patches/patch-sandbox_policy_features.h
new file mode 100644
index 0000000000..ec13ce31db
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/features.h
+@@ -45,7 +45,7 @@ SANDBOX_POLICY_EXPORT BASE_DECLARE_FEATU
+ SANDBOX_POLICY_EXPORT BASE_DECLARE_FEATURE(kSpectreVariant2Mitigation);
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SANDBOX_POLICY_EXPORT BASE_DECLARE_FEATURE(
+ kForceDisableSpectreVariant2MitigationInNetworkService);
+
diff --git a/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc b/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
new file mode 100644
index 0000000000..f929611837
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
@@ -0,0 +1,220 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/freebsd/sandbox_freebsd.cc.orig 2025-05-24 17:57:53.563800971 +0000
++++ sandbox/policy/freebsd/sandbox_freebsd.cc
+@@ -0,0 +1,211 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "sandbox/policy/freebsd/sandbox_freebsd.h"
++
++#include <dirent.h>
++#include <fcntl.h>
++#include <stdint.h>
++#include <sys/resource.h>
++#include <sys/stat.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include <limits>
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/command_line.h"
++#include "base/debug/stack_trace.h"
++#include "base/feature_list.h"
++#include "base/files/file_path.h"
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/logging.h"
++#include "base/memory/singleton.h"
++#include "base/path_service.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/strings/string_number_conversions.h"
++#include "base/system/sys_info.h"
++#include "base/threading/thread.h"
++#include "base/time/time.h"
++#include "build/build_config.h"
++#include "crypto/crypto_buildflags.h"
++#include "ppapi/buildflags/buildflags.h"
++#include "sandbox/constants.h"
++#include "sandbox/linux/services/credentials.h"
++#include "sandbox/linux/services/namespace_sandbox.h"
++#include "sandbox/linux/services/proc_util.h"
++#include "sandbox/linux/services/resource_limits.h"
++#include "sandbox/linux/services/thread_helpers.h"
++#include "sandbox/linux/syscall_broker/broker_command.h"
++#include "sandbox/linux/syscall_broker/broker_process.h"
++#include "sandbox/policy/sandbox.h"
++#include "sandbox/policy/sandbox_type.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "sandbox/policy/switches.h"
++#include "sandbox/sandbox_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++#if BUILDFLAG(USE_NSS_CERTS)
++#include "crypto/nss_util.h"
++#endif
++
++#include "third_party/boringssl/src/include/openssl/crypto.h"
++
++#include "ui/gfx/font_util.h"
++
++namespace sandbox {
++namespace policy {
++
++SandboxLinux::SandboxLinux()
++ : sandbox_status_flags_(kInvalid),
++ pre_initialized_(false),
++ initialize_sandbox_ran_(false),
++ broker_process_(nullptr) {
++}
++
++SandboxLinux::~SandboxLinux() {
++ if (pre_initialized_) {
++ CHECK(initialize_sandbox_ran_);
++ }
++}
++
++SandboxLinux* SandboxLinux::GetInstance() {
++ SandboxLinux* instance = base::Singleton<SandboxLinux>::get();
++ CHECK(instance);
++ return instance;
++}
++
++void SandboxLinux::StopThread(base::Thread* thread) {
++ DCHECK(thread);
++ thread->Stop();
++}
++
++void SandboxLinux::PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type) {
++ CHECK(!pre_initialized_);
++#if BUILDFLAG(USING_SANITIZER)
++ // Sanitizers need to open some resources before the sandbox is enabled.
++ // This should not fork, not launch threads, not open a directory.
++ __sanitizer_sandbox_on_notify(sanitizer_args());
++ sanitizer_args_.reset();
++#endif
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ base::SysInfo::AmountOfPhysicalMemory();
++ base::SysInfo::NumberOfProcessors();
++ base::SysInfo::CPUModelName();
++
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ {
++#if BUILDFLAG(USE_NSS_CERTS)
++ // The main process has to initialize the ~/.pki dir which won't work
++ // after unveil(2).
++ crypto::EnsureNSSInit();
++#endif
++ CRYPTO_pre_sandbox_init();
++
++ base::FilePath cache_directory, local_directory;
++
++ base::PathService::Get(base::DIR_CACHE, &cache_directory);
++ base::PathService::Get(base::DIR_HOME, &local_directory);
++
++ cache_directory = cache_directory.AppendASCII("chromium");
++ local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications");
++
++ if (!base::CreateDirectory(cache_directory)) {
++ LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory.";
++ }
++
++ if (!base::CreateDirectory(local_directory)) {
++ LOG(ERROR) << "Failed to create " << local_directory.value() << " directory.";
++ }
++
++ break;
++ }
++ case sandbox::mojom::Sandbox::kRenderer:
++ gfx::InitializeFonts();
++ break;
++ default:
++ break;
++ }
++
++ pre_initialized_ = true;
++}
++
++bool SandboxLinux::InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ SandboxLinux::PreSandboxHook hook,
++ const Options& options) {
++ DCHECK(!initialize_sandbox_ran_);
++ initialize_sandbox_ran_ = true;
++
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ if (command_line->HasSwitch(switches::kNoSandbox))
++ return true;
++
++ VLOG(1) << "SandboxLinux::InitializeSandbox: process_type="
++ << process_type << " sandbox_type=" << sandbox_type;
++
++ // Only one thread is running, pre-initialize if not already done.
++ if (!pre_initialized_)
++ PreinitializeSandbox(sandbox_type);
++
++ // Attempt to limit the future size of the address space of the process.
++ int error = 0;
++ const bool limited_as = LimitAddressSpace(&error);
++ if (error) {
++ // Restore errno. Internally to |LimitAddressSpace|, the errno due to
++ // setrlimit may be lost.
++ errno = error;
++ PCHECK(limited_as);
++ }
++
++ if (hook)
++ CHECK(std::move(hook).Run(options));
++
++ return true;
++}
++
++bool SandboxLinux::LimitAddressSpace(int* error) {
++#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
++ !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ if (SandboxTypeFromCommandLine(*command_line) == sandbox::mojom::Sandbox::kNoSandbox) {
++ return false;
++ }
++
++ // Unfortunately, it does not appear possible to set RLIMIT_AS such that it
++ // will both (a) be high enough to support V8's and WebAssembly's address
++ // space requirements while also (b) being low enough to mitigate exploits
++ // using integer overflows that require large allocations, heap spray, or
++ // other memory-hungry attack modes.
++
++ *error = sandbox::ResourceLimits::Lower(
++ RLIMIT_DATA, static_cast<rlim_t>(sandbox::kDataSizeLimit));
++
++ // Cache the resource limit before turning on the sandbox.
++ base::SysInfo::AmountOfVirtualMemory();
++ base::SysInfo::MaxSharedMemorySize();
++
++ return *error == 0;
++#else
++ base::SysInfo::AmountOfVirtualMemory();
++ return false;
++#endif // !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) &&
++ // !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h b/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
new file mode 100644
index 0000000000..172daee18f
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
@@ -0,0 +1,285 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/freebsd/sandbox_freebsd.h.orig 2025-05-24 17:57:53.563940831 +0000
++++ sandbox/policy/freebsd/sandbox_freebsd.h
+@@ -0,0 +1,276 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++#ifndef SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++#define SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/logging.h"
++#include "base/posix/global_descriptors.h"
++#include "sandbox/policy/export.h"
++#include "sandbox/policy/linux/sandbox_seccomp_bpf_linux.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "base/sanitizer_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++namespace base {
++template <typename T>
++struct DefaultSingletonTraits;
++class Thread;
++} // namespace base
++
++namespace sandbox {
++namespace syscall_broker {
++class BrokerProcess;
++} // namespace syscall_broker
++} // namespace sandbox
++
++namespace sandbox {
++namespace policy {
++
++// A singleton class to represent and change our sandboxing state for the
++// three main Linux sandboxes.
++// The sandboxing model allows using two layers of sandboxing. The first layer
++// can be implemented either with unprivileged namespaces or with the setuid
++// sandbox. This class provides a way to engage the namespace sandbox, but does
++// not deal with the legacy setuid sandbox directly.
++// The second layer is mainly based on seccomp-bpf and is engaged with
++// InitializeSandbox(). InitializeSandbox() is also responsible for "sealing"
++// the first layer of sandboxing. That is, InitializeSandbox must always be
++// called to have any meaningful sandboxing at all.
++class SANDBOX_POLICY_EXPORT SandboxLinux {
++ public:
++ // This is a list of sandbox IPC methods which the renderer may send to the
++ // sandbox host. See
++ // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md
++ // This isn't the full list, values < 32 are reserved for methods called from
++ // Skia, and values < 64 are reserved for libc_interceptor.cc.
++ enum LinuxSandboxIPCMethods {
++ DEPRECATED_METHOD_GET_FALLBACK_FONT_FOR_CHAR = 64,
++ DEPRECATED_METHOD_GET_CHILD_WITH_INODE,
++ DEPRECATED_METHOD_GET_STYLE_FOR_STRIKE,
++ METHOD_MAKE_SHARED_MEMORY_SEGMENT,
++ DEPRECATED_METHOD_MATCH_WITH_FALLBACK,
++ };
++
++ // These form a bitmask which describes the conditions of the Linux sandbox.
++ // Note: this doesn't strictly give you the current status, it states
++ // what will be enabled when the relevant processes are initialized.
++ enum Status {
++ // SUID sandbox active.
++ kSUID = 1 << 0,
++
++ // Sandbox is using a new PID namespace.
++ kPIDNS = 1 << 1,
++
++ // Sandbox is using a new network namespace.
++ kNetNS = 1 << 2,
++
++ // seccomp-bpf sandbox active.
++ kSeccompBPF = 1 << 3,
++
++ // The Yama LSM module is present and enforcing.
++ kYama = 1 << 4,
++
++ // seccomp-bpf sandbox is active and the kernel supports TSYNC.
++ kSeccompTSYNC = 1 << 5,
++
++ // User namespace sandbox active.
++ kUserNS = 1 << 6,
++
++ // A flag that denotes an invalid sandbox status.
++ kInvalid = 1 << 31,
++ };
++
++ // SandboxLinux Options are a superset of SandboxSecompBPF Options.
++ struct Options : public SandboxSeccompBPF::Options {
++ // When running with a zygote, the namespace sandbox will have already
++ // been engaged prior to initializing SandboxLinux itself, and need not
++ // be done so again. Set to true to indicate that there isn't a zygote
++ // for this process and the step is to be performed here explicitly.
++ bool engage_namespace_sandbox = false;
++
++ // Allow starting the sandbox with multiple threads already running. This
++ // will enable TSYNC for seccomp-BPF, which syncs the seccomp-BPF policy
++ // across all running threads.
++ bool allow_threads_during_sandbox_init = false;
++
++ // Enables the CHECK for open directories. The open directory check is only
++ // useful for the chroot jail (from the semantic layer of the sandbox), and
++ // can safely be disabled if we are only enabling the seccomp-BPF layer.
++ bool check_for_open_directories = true;
++ };
++
++ // Callers can provide this hook to run code right before the policy
++ // is passed to the BPF compiler and the sandbox is engaged. If
++ // pre_sandbox_hook() returns true, the sandbox will be engaged
++ // afterwards, otherwise the process is terminated.
++ using PreSandboxHook = base::OnceCallback<bool(Options)>;
++
++ // Get our singleton instance.
++ static SandboxLinux* GetInstance();
++
++ SandboxLinux(const SandboxLinux&) = delete;
++ SandboxLinux& operator=(const SandboxLinux&) = delete;
++
++ bool SetPledge(const char *pstring, const char *ppath);
++ bool SetUnveil(const std::string process_type, sandbox::mojom::Sandbox sandbox_type);
++
++ // Do some initialization that can only be done before any of the sandboxes
++ // are enabled. If using the setuid sandbox, this should be called manually
++ // before the setuid sandbox is engaged.
++ // Security: When this runs, it is imperative that either InitializeSandbox()
++ // runs as well or that all file descriptors returned in
++ // GetFileDescriptorsToClose() get closed.
++ // Otherwise file descriptors that bypass the security of the setuid sandbox
++ // would be kept open. One must be particularly careful if a process performs
++ // a fork().
++ void PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type);
++
++ // Check that the current process is the init process of a new PID
++ // namespace and then proceed to drop access to the file system by using
++ // a new unprivileged namespace. This is a layer-1 sandbox.
++ // In order for this sandbox to be effective, it must be "sealed" by calling
++ // InitializeSandbox().
++ void EngageNamespaceSandbox(bool from_zygote);
++
++ // Return a list of file descriptors to close if PreinitializeSandbox() ran
++ // but InitializeSandbox() won't. Avoid using.
++ // TODO(jln): get rid of this hack.
++ std::vector<int> GetFileDescriptorsToClose();
++
++ // Seal an eventual layer-1 sandbox and initialize the layer-2 sandbox with
++ // an adequate policy depending on the process type and command line
++ // arguments.
++ // Currently the layer-2 sandbox is composed of seccomp-bpf and address space
++ // limitations.
++ // This function should only be called without any thread running.
++ bool InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Stop |thread| in a way that can be trusted by the sandbox.
++ void StopThread(base::Thread* thread);
++
++ // Returns the status of the renderer, worker and ppapi sandbox. Can only
++ // be queried after going through PreinitializeSandbox(). This is a bitmask
++ // and uses the constants defined in "enum Status" above. Since the
++ // status needs to be provided before the sandboxes are actually started,
++ // this returns what will actually happen once InitializeSandbox()
++ // is called from inside these processes.
++ int GetStatus();
++
++ // Returns true if the current process is single-threaded or if the number
++ // of threads cannot be determined.
++ bool IsSingleThreaded() const;
++
++ // Returns true if we started Seccomp BPF.
++ bool seccomp_bpf_started() const;
++
++ // Check the policy and eventually start the seccomp-bpf sandbox. This should
++ // never be called with threads started. If we detect that threads have
++ // started we will crash.
++ bool StartSeccompBPF(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Limit the address space of the current process (and its children) to make
++ // some vulnerabilities harder to exploit. Writes the errno due to setrlimit
++ // (including 0 if no error) into |error|.
++ bool LimitAddressSpace(int* error);
++
++ // Returns a file descriptor to proc. The file descriptor is no longer valid
++ // after the sandbox has been sealed.
++ int proc_fd() const {
++ DCHECK_NE(-1, proc_fd_);
++ return proc_fd_;
++ }
++
++#if BUILDFLAG(USING_SANITIZER)
++ __sanitizer_sandbox_arguments* sanitizer_args() const {
++ return sanitizer_args_.get();
++ };
++#endif
++
++ // A BrokerProcess is a helper that is started before the sandbox is engaged,
++ // typically from a pre-sandbox hook, that will serve requests to access
++ // files over an IPC channel. The client of this runs from a SIGSYS handler
++ // triggered by the seccomp-bpf sandbox.
++ // |client_sandbox_policy| is the policy being run by the client, and is
++ // used to derive the equivalent broker-side policy.
++ // |broker_side_hook| is an alternate pre-sandbox hook to be run before the
++ // broker itself gets sandboxed, to which the broker side policy and
++ // |options| are passed.
++ // Crashes the process if the broker can not be started since continuation
++ // is impossible (and presumably unsafe).
++ // This should never be destroyed, as after the sandbox is started it is
++ // vital to the process.
++#if 0
++ void StartBrokerProcess(
++ const sandbox::syscall_broker::BrokerCommandSet& allowed_command_set,
++ std::vector<sandbox::syscall_broker::BrokerFilePermission> permissions,
++ PreSandboxHook broker_side_hook,
++ const Options& options);
++
++ sandbox::syscall_broker::BrokerProcess* broker_process() const {
++ return broker_process_;
++ }
++#endif
++
++ private:
++ friend struct base::DefaultSingletonTraits<SandboxLinux>;
++
++ SandboxLinux();
++ ~SandboxLinux();
++
++ // We must have been pre_initialized_ before using these.
++ bool seccomp_bpf_supported() const;
++ bool seccomp_bpf_with_tsync_supported() const;
++
++ // Returns true if it can be determined that the current process has open
++ // directories that are not managed by the SandboxLinux class. This would
++ // be a vulnerability as it would allow to bypass the setuid sandbox.
++ bool HasOpenDirectories() const;
++
++ // The last part of the initialization is to make sure any temporary "hole"
++ // in the sandbox is closed. For now, this consists of closing proc_fd_.
++ void SealSandbox();
++
++ // GetStatus() makes promises as to how the sandbox will behave. This
++ // checks that no promises have been broken.
++ void CheckForBrokenPromises(sandbox::mojom::Sandbox sandbox_type);
++
++ // Stop |thread| and make sure it does not appear in /proc/self/tasks/
++ // anymore.
++ void StopThreadAndEnsureNotCounted(base::Thread* thread) const;
++
++ // A file descriptor to /proc. It's dangerous to have it around as it could
++ // allow for sandbox bypasses. It needs to be closed before we consider
++ // ourselves sandboxed.
++ int proc_fd_;
++
++ bool seccomp_bpf_started_;
++ // The value returned by GetStatus(). Gets computed once and then cached.
++ int sandbox_status_flags_;
++ // Did PreinitializeSandbox() run?
++ bool pre_initialized_;
++ bool seccomp_bpf_supported_; // Accurate if pre_initialized_.
++ bool seccomp_bpf_with_tsync_supported_; // Accurate if pre_initialized_.
++ bool yama_is_enforcing_; // Accurate if pre_initialized_.
++ bool initialize_sandbox_ran_; // InitializeSandbox() was called.
++#if BUILDFLAG(USING_SANITIZER)
++ std::unique_ptr<__sanitizer_sandbox_arguments> sanitizer_args_;
++#endif
++ sandbox::syscall_broker::BrokerProcess* broker_process_; // Leaked as global.
++};
++
++} // namespace policy
++} // namespace sandbox
++
++#endif // SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
diff --git a/electron34/patches/patch-sandbox_policy_mac_sandbox__mac.mm b/electron34/patches/patch-sandbox_policy_mac_sandbox__mac.mm
new file mode 100644
index 0000000000..15c434935d
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_mac_sandbox__mac.mm
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/mac/sandbox_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/mac/sandbox_mac.mm
+@@ -36,6 +36,10 @@
+ #include "sandbox/policy/mac/utility.sb.h"
+ #include "sandbox/policy/mojom/sandbox.mojom.h"
+
++#if BUILDFLAG(ENABLE_PRINTING)
++#include "sandbox/policy/mac/print_backend.sb.h"
++#endif
++
+ namespace sandbox::policy {
+
+ base::FilePath GetCanonicalPath(const base::FilePath& path) {
diff --git a/electron34/patches/patch-sandbox_policy_mojom_sandbox.mojom b/electron34/patches/patch-sandbox_policy_mojom_sandbox.mojom
new file mode 100644
index 0000000000..6ecb0c6b19
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_mojom_sandbox.mojom
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/mojom/sandbox.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/mojom/sandbox.mojom
+@@ -81,6 +81,15 @@ enum Sandbox {
+ [EnableIf=is_fuchsia]
+ kVideoCapture,
+
++ [EnableIf=is_openbsd]
++ kVideoCapture,
++
++ [EnableIf=is_netbsd]
++ kVideoCapture,
++
++ [EnableIf=is_freebsd]
++ kVideoCapture,
++
+ // Allows access to file contents and Windows APIs for parsing icons from PE
+ // files.
+ [EnableIf=is_win]
diff --git a/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc b/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
new file mode 100644
index 0000000000..65f1c3628a
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
@@ -0,0 +1,220 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/netbsd/sandbox_netbsd.cc.orig 2025-05-24 17:57:53.564388203 +0000
++++ sandbox/policy/netbsd/sandbox_netbsd.cc
+@@ -0,0 +1,211 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "sandbox/policy/netbsd/sandbox_netbsd.h"
++
++#include <dirent.h>
++#include <fcntl.h>
++#include <stdint.h>
++#include <sys/resource.h>
++#include <sys/stat.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <unistd.h>
++
++#include <limits>
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/command_line.h"
++#include "base/debug/stack_trace.h"
++#include "base/feature_list.h"
++#include "base/files/file_path.h"
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/logging.h"
++#include "base/memory/singleton.h"
++#include "base/path_service.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/strings/string_number_conversions.h"
++#include "base/system/sys_info.h"
++#include "base/threading/thread.h"
++#include "base/time/time.h"
++#include "build/build_config.h"
++#include "crypto/crypto_buildflags.h"
++#include "ppapi/buildflags/buildflags.h"
++#include "sandbox/constants.h"
++#include "sandbox/linux/services/credentials.h"
++#include "sandbox/linux/services/namespace_sandbox.h"
++#include "sandbox/linux/services/proc_util.h"
++#include "sandbox/linux/services/resource_limits.h"
++#include "sandbox/linux/services/thread_helpers.h"
++#include "sandbox/linux/syscall_broker/broker_command.h"
++#include "sandbox/linux/syscall_broker/broker_process.h"
++#include "sandbox/policy/sandbox.h"
++#include "sandbox/policy/sandbox_type.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "sandbox/policy/switches.h"
++#include "sandbox/sandbox_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++#if BUILDFLAG(USE_NSS_CERTS)
++#include "crypto/nss_util.h"
++#endif
++
++#include "third_party/boringssl/src/include/openssl/crypto.h"
++
++#include "ui/gfx/font_util.h"
++
++namespace sandbox {
++namespace policy {
++
++SandboxLinux::SandboxLinux()
++ : sandbox_status_flags_(kInvalid),
++ pre_initialized_(false),
++ initialize_sandbox_ran_(false),
++ broker_process_(nullptr) {
++}
++
++SandboxLinux::~SandboxLinux() {
++ if (pre_initialized_) {
++ CHECK(initialize_sandbox_ran_);
++ }
++}
++
++SandboxLinux* SandboxLinux::GetInstance() {
++ SandboxLinux* instance = base::Singleton<SandboxLinux>::get();
++ CHECK(instance);
++ return instance;
++}
++
++void SandboxLinux::StopThread(base::Thread* thread) {
++ DCHECK(thread);
++ thread->Stop();
++}
++
++void SandboxLinux::PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type) {
++ CHECK(!pre_initialized_);
++#if BUILDFLAG(USING_SANITIZER)
++ // Sanitizers need to open some resources before the sandbox is enabled.
++ // This should not fork, not launch threads, not open a directory.
++ __sanitizer_sandbox_on_notify(sanitizer_args());
++ sanitizer_args_.reset();
++#endif
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ base::SysInfo::AmountOfPhysicalMemory();
++ base::SysInfo::NumberOfProcessors();
++ base::SysInfo::CPUModelName();
++
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ {
++#if BUILDFLAG(USE_NSS_CERTS)
++ // The main process has to initialize the ~/.pki dir which won't work
++ // after unveil(2).
++ crypto::EnsureNSSInit();
++#endif
++ CRYPTO_pre_sandbox_init();
++
++ base::FilePath cache_directory, local_directory;
++
++ base::PathService::Get(base::DIR_CACHE, &cache_directory);
++ base::PathService::Get(base::DIR_HOME, &local_directory);
++
++ cache_directory = cache_directory.AppendASCII("chromium");
++ local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications");
++
++ if (!base::CreateDirectory(cache_directory)) {
++ LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory.";
++ }
++
++ if (!base::CreateDirectory(local_directory)) {
++ LOG(ERROR) << "Failed to create " << local_directory.value() << " directory.";
++ }
++
++ break;
++ }
++ case sandbox::mojom::Sandbox::kRenderer:
++ gfx::InitializeFonts();
++ break;
++ default:
++ break;
++ }
++
++ pre_initialized_ = true;
++}
++
++bool SandboxLinux::InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ SandboxLinux::PreSandboxHook hook,
++ const Options& options) {
++ DCHECK(!initialize_sandbox_ran_);
++ initialize_sandbox_ran_ = true;
++
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ if (command_line->HasSwitch(switches::kNoSandbox))
++ return true;
++
++ VLOG(1) << "SandboxLinux::InitializeSandbox: process_type="
++ << process_type << " sandbox_type=" << sandbox_type;
++
++ // Only one thread is running, pre-initialize if not already done.
++ if (!pre_initialized_)
++ PreinitializeSandbox(sandbox_type);
++
++ // Attempt to limit the future size of the address space of the process.
++ int error = 0;
++ const bool limited_as = LimitAddressSpace(&error);
++ if (error) {
++ // Restore errno. Internally to |LimitAddressSpace|, the errno due to
++ // setrlimit may be lost.
++ errno = error;
++ PCHECK(limited_as);
++ }
++
++ if (hook)
++ CHECK(std::move(hook).Run(options));
++
++ return true;
++}
++
++bool SandboxLinux::LimitAddressSpace(int* error) {
++#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
++ !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ if (SandboxTypeFromCommandLine(*command_line) == sandbox::mojom::Sandbox::kNoSandbox) {
++ return false;
++ }
++
++ // Unfortunately, it does not appear possible to set RLIMIT_AS such that it
++ // will both (a) be high enough to support V8's and WebAssembly's address
++ // space requirements while also (b) being low enough to mitigate exploits
++ // using integer overflows that require large allocations, heap spray, or
++ // other memory-hungry attack modes.
++
++ *error = sandbox::ResourceLimits::Lower(
++ RLIMIT_DATA, static_cast<rlim_t>(sandbox::kDataSizeLimit));
++
++ // Cache the resource limit before turning on the sandbox.
++ base::SysInfo::AmountOfVirtualMemory();
++ base::SysInfo::MaxSharedMemorySize();
++
++ return *error == 0;
++#else
++ base::SysInfo::AmountOfVirtualMemory();
++ return false;
++#endif // !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) &&
++ // !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h b/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
new file mode 100644
index 0000000000..503956880e
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
@@ -0,0 +1,285 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/netbsd/sandbox_netbsd.h.orig 2025-05-24 17:57:53.564526158 +0000
++++ sandbox/policy/netbsd/sandbox_netbsd.h
+@@ -0,0 +1,276 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++#ifndef SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++#define SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/logging.h"
++#include "base/posix/global_descriptors.h"
++#include "sandbox/policy/export.h"
++#include "sandbox/policy/linux/sandbox_seccomp_bpf_linux.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "base/sanitizer_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++namespace base {
++template <typename T>
++struct DefaultSingletonTraits;
++class Thread;
++} // namespace base
++
++namespace sandbox {
++namespace syscall_broker {
++class BrokerProcess;
++} // namespace syscall_broker
++} // namespace sandbox
++
++namespace sandbox {
++namespace policy {
++
++// A singleton class to represent and change our sandboxing state for the
++// three main Linux sandboxes.
++// The sandboxing model allows using two layers of sandboxing. The first layer
++// can be implemented either with unprivileged namespaces or with the setuid
++// sandbox. This class provides a way to engage the namespace sandbox, but does
++// not deal with the legacy setuid sandbox directly.
++// The second layer is mainly based on seccomp-bpf and is engaged with
++// InitializeSandbox(). InitializeSandbox() is also responsible for "sealing"
++// the first layer of sandboxing. That is, InitializeSandbox must always be
++// called to have any meaningful sandboxing at all.
++class SANDBOX_POLICY_EXPORT SandboxLinux {
++ public:
++ // This is a list of sandbox IPC methods which the renderer may send to the
++ // sandbox host. See
++ // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md
++ // This isn't the full list, values < 32 are reserved for methods called from
++ // Skia, and values < 64 are reserved for libc_interceptor.cc.
++ enum LinuxSandboxIPCMethods {
++ DEPRECATED_METHOD_GET_FALLBACK_FONT_FOR_CHAR = 64,
++ DEPRECATED_METHOD_GET_CHILD_WITH_INODE,
++ DEPRECATED_METHOD_GET_STYLE_FOR_STRIKE,
++ METHOD_MAKE_SHARED_MEMORY_SEGMENT,
++ DEPRECATED_METHOD_MATCH_WITH_FALLBACK,
++ };
++
++ // These form a bitmask which describes the conditions of the Linux sandbox.
++ // Note: this doesn't strictly give you the current status, it states
++ // what will be enabled when the relevant processes are initialized.
++ enum Status {
++ // SUID sandbox active.
++ kSUID = 1 << 0,
++
++ // Sandbox is using a new PID namespace.
++ kPIDNS = 1 << 1,
++
++ // Sandbox is using a new network namespace.
++ kNetNS = 1 << 2,
++
++ // seccomp-bpf sandbox active.
++ kSeccompBPF = 1 << 3,
++
++ // The Yama LSM module is present and enforcing.
++ kYama = 1 << 4,
++
++ // seccomp-bpf sandbox is active and the kernel supports TSYNC.
++ kSeccompTSYNC = 1 << 5,
++
++ // User namespace sandbox active.
++ kUserNS = 1 << 6,
++
++ // A flag that denotes an invalid sandbox status.
++ kInvalid = 1 << 31,
++ };
++
++ // SandboxLinux Options are a superset of SandboxSecompBPF Options.
++ struct Options : public SandboxSeccompBPF::Options {
++ // When running with a zygote, the namespace sandbox will have already
++ // been engaged prior to initializing SandboxLinux itself, and need not
++ // be done so again. Set to true to indicate that there isn't a zygote
++ // for this process and the step is to be performed here explicitly.
++ bool engage_namespace_sandbox = false;
++
++ // Allow starting the sandbox with multiple threads already running. This
++ // will enable TSYNC for seccomp-BPF, which syncs the seccomp-BPF policy
++ // across all running threads.
++ bool allow_threads_during_sandbox_init = false;
++
++ // Enables the CHECK for open directories. The open directory check is only
++ // useful for the chroot jail (from the semantic layer of the sandbox), and
++ // can safely be disabled if we are only enabling the seccomp-BPF layer.
++ bool check_for_open_directories = true;
++ };
++
++ // Callers can provide this hook to run code right before the policy
++ // is passed to the BPF compiler and the sandbox is engaged. If
++ // pre_sandbox_hook() returns true, the sandbox will be engaged
++ // afterwards, otherwise the process is terminated.
++ using PreSandboxHook = base::OnceCallback<bool(Options)>;
++
++ // Get our singleton instance.
++ static SandboxLinux* GetInstance();
++
++ SandboxLinux(const SandboxLinux&) = delete;
++ SandboxLinux& operator=(const SandboxLinux&) = delete;
++
++ bool SetPledge(const char *pstring, const char *ppath);
++ bool SetUnveil(const std::string process_type, sandbox::mojom::Sandbox sandbox_type);
++
++ // Do some initialization that can only be done before any of the sandboxes
++ // are enabled. If using the setuid sandbox, this should be called manually
++ // before the setuid sandbox is engaged.
++ // Security: When this runs, it is imperative that either InitializeSandbox()
++ // runs as well or that all file descriptors returned in
++ // GetFileDescriptorsToClose() get closed.
++ // Otherwise file descriptors that bypass the security of the setuid sandbox
++ // would be kept open. One must be particularly careful if a process performs
++ // a fork().
++ void PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type);
++
++ // Check that the current process is the init process of a new PID
++ // namespace and then proceed to drop access to the file system by using
++ // a new unprivileged namespace. This is a layer-1 sandbox.
++ // In order for this sandbox to be effective, it must be "sealed" by calling
++ // InitializeSandbox().
++ void EngageNamespaceSandbox(bool from_zygote);
++
++ // Return a list of file descriptors to close if PreinitializeSandbox() ran
++ // but InitializeSandbox() won't. Avoid using.
++ // TODO(jln): get rid of this hack.
++ std::vector<int> GetFileDescriptorsToClose();
++
++ // Seal an eventual layer-1 sandbox and initialize the layer-2 sandbox with
++ // an adequate policy depending on the process type and command line
++ // arguments.
++ // Currently the layer-2 sandbox is composed of seccomp-bpf and address space
++ // limitations.
++ // This function should only be called without any thread running.
++ bool InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Stop |thread| in a way that can be trusted by the sandbox.
++ void StopThread(base::Thread* thread);
++
++ // Returns the status of the renderer, worker and ppapi sandbox. Can only
++ // be queried after going through PreinitializeSandbox(). This is a bitmask
++ // and uses the constants defined in "enum Status" above. Since the
++ // status needs to be provided before the sandboxes are actually started,
++ // this returns what will actually happen once InitializeSandbox()
++ // is called from inside these processes.
++ int GetStatus();
++
++ // Returns true if the current process is single-threaded or if the number
++ // of threads cannot be determined.
++ bool IsSingleThreaded() const;
++
++ // Returns true if we started Seccomp BPF.
++ bool seccomp_bpf_started() const;
++
++ // Check the policy and eventually start the seccomp-bpf sandbox. This should
++ // never be called with threads started. If we detect that threads have
++ // started we will crash.
++ bool StartSeccompBPF(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Limit the address space of the current process (and its children) to make
++ // some vulnerabilities harder to exploit. Writes the errno due to setrlimit
++ // (including 0 if no error) into |error|.
++ bool LimitAddressSpace(int* error);
++
++ // Returns a file descriptor to proc. The file descriptor is no longer valid
++ // after the sandbox has been sealed.
++ int proc_fd() const {
++ DCHECK_NE(-1, proc_fd_);
++ return proc_fd_;
++ }
++
++#if BUILDFLAG(USING_SANITIZER)
++ __sanitizer_sandbox_arguments* sanitizer_args() const {
++ return sanitizer_args_.get();
++ };
++#endif
++
++ // A BrokerProcess is a helper that is started before the sandbox is engaged,
++ // typically from a pre-sandbox hook, that will serve requests to access
++ // files over an IPC channel. The client of this runs from a SIGSYS handler
++ // triggered by the seccomp-bpf sandbox.
++ // |client_sandbox_policy| is the policy being run by the client, and is
++ // used to derive the equivalent broker-side policy.
++ // |broker_side_hook| is an alternate pre-sandbox hook to be run before the
++ // broker itself gets sandboxed, to which the broker side policy and
++ // |options| are passed.
++ // Crashes the process if the broker can not be started since continuation
++ // is impossible (and presumably unsafe).
++ // This should never be destroyed, as after the sandbox is started it is
++ // vital to the process.
++#if 0
++ void StartBrokerProcess(
++ const sandbox::syscall_broker::BrokerCommandSet& allowed_command_set,
++ std::vector<sandbox::syscall_broker::BrokerFilePermission> permissions,
++ PreSandboxHook broker_side_hook,
++ const Options& options);
++
++ sandbox::syscall_broker::BrokerProcess* broker_process() const {
++ return broker_process_;
++ }
++#endif
++
++ private:
++ friend struct base::DefaultSingletonTraits<SandboxLinux>;
++
++ SandboxLinux();
++ ~SandboxLinux();
++
++ // We must have been pre_initialized_ before using these.
++ bool seccomp_bpf_supported() const;
++ bool seccomp_bpf_with_tsync_supported() const;
++
++ // Returns true if it can be determined that the current process has open
++ // directories that are not managed by the SandboxLinux class. This would
++ // be a vulnerability as it would allow to bypass the setuid sandbox.
++ bool HasOpenDirectories() const;
++
++ // The last part of the initialization is to make sure any temporary "hole"
++ // in the sandbox is closed. For now, this consists of closing proc_fd_.
++ void SealSandbox();
++
++ // GetStatus() makes promises as to how the sandbox will behave. This
++ // checks that no promises have been broken.
++ void CheckForBrokenPromises(sandbox::mojom::Sandbox sandbox_type);
++
++ // Stop |thread| and make sure it does not appear in /proc/self/tasks/
++ // anymore.
++ void StopThreadAndEnsureNotCounted(base::Thread* thread) const;
++
++ // A file descriptor to /proc. It's dangerous to have it around as it could
++ // allow for sandbox bypasses. It needs to be closed before we consider
++ // ourselves sandboxed.
++ int proc_fd_;
++
++ bool seccomp_bpf_started_;
++ // The value returned by GetStatus(). Gets computed once and then cached.
++ int sandbox_status_flags_;
++ // Did PreinitializeSandbox() run?
++ bool pre_initialized_;
++ bool seccomp_bpf_supported_; // Accurate if pre_initialized_.
++ bool seccomp_bpf_with_tsync_supported_; // Accurate if pre_initialized_.
++ bool yama_is_enforcing_; // Accurate if pre_initialized_.
++ bool initialize_sandbox_ran_; // InitializeSandbox() was called.
++#if BUILDFLAG(USING_SANITIZER)
++ std::unique_ptr<__sanitizer_sandbox_arguments> sanitizer_args_;
++#endif
++ sandbox::syscall_broker::BrokerProcess* broker_process_; // Leaked as global.
++};
++
++} // namespace policy
++} // namespace sandbox
++
++#endif // SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
diff --git a/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc b/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc
new file mode 100644
index 0000000000..fe81da56c1
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc
@@ -0,0 +1,401 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/openbsd/sandbox_openbsd.cc.orig 2025-05-24 17:57:53.564715573 +0000
++++ sandbox/policy/openbsd/sandbox_openbsd.cc
+@@ -0,0 +1,392 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "sandbox/policy/openbsd/sandbox_openbsd.h"
++
++#include <dirent.h>
++#include <fcntl.h>
++#include <stdint.h>
++#include <sys/resource.h>
++#include <sys/stat.h>
++#include <sys/time.h>
++#include <sys/types.h>
++#include <unistd.h>
++#include <util.h>
++
++#include <limits>
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/command_line.h"
++#include "base/debug/stack_trace.h"
++#include "base/feature_list.h"
++#include "base/files/file_path.h"
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/logging.h"
++#include "base/memory/singleton.h"
++#include "base/path_service.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/strings/string_number_conversions.h"
++#include "base/system/sys_info.h"
++#include "base/threading/thread.h"
++#include "base/time/time.h"
++#include "build/build_config.h"
++#include "crypto/crypto_buildflags.h"
++#include "ppapi/buildflags/buildflags.h"
++#include "sandbox/constants.h"
++#include "sandbox/linux/services/credentials.h"
++#include "sandbox/linux/services/namespace_sandbox.h"
++#include "sandbox/linux/services/proc_util.h"
++#include "sandbox/linux/services/resource_limits.h"
++#include "sandbox/linux/services/thread_helpers.h"
++#include "sandbox/linux/syscall_broker/broker_command.h"
++#include "sandbox/linux/syscall_broker/broker_process.h"
++#include "sandbox/policy/sandbox.h"
++#include "sandbox/policy/sandbox_type.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "sandbox/policy/switches.h"
++#include "sandbox/sandbox_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++#if BUILDFLAG(USE_NSS_CERTS)
++#include "crypto/nss_util.h"
++#endif
++
++#include "third_party/boringssl/src/include/openssl/crypto.h"
++
++#include <fontconfig/fontconfig.h>
++#include "ui/gfx/linux/fontconfig_util.h"
++
++#define MAXTOKENS 3
++
++#define _UNVEIL_MAIN "@PKG_SYSCONFBASE@/chromium/unveil.main";
++#define _UNVEIL_GPU "@PKG_SYSCONFBASE@/chromium/unveil.gpu";
++#define _UNVEIL_UTILITY_NETWORK "@PKG_SYSCONFBASE@/chromium/unveil.utility_network";
++#define _UNVEIL_UTILITY_AUDIO "@PKG_SYSCONFBASE@/chromium/unveil.utility_audio";
++#define _UNVEIL_UTILITY_VIDEO "@PKG_SYSCONFBASE@/chromium/unveil.utility_video";
++
++namespace sandbox {
++namespace policy {
++
++SandboxLinux::SandboxLinux()
++ : unveil_initialized_(false),
++ sandbox_status_flags_(kInvalid),
++ pre_initialized_(false),
++ initialize_sandbox_ran_(false),
++ broker_process_(nullptr) {
++}
++
++SandboxLinux::~SandboxLinux() {
++ if (pre_initialized_) {
++ CHECK(initialize_sandbox_ran_);
++ }
++}
++
++SandboxLinux* SandboxLinux::GetInstance() {
++ SandboxLinux* instance = base::Singleton<SandboxLinux>::get();
++ CHECK(instance);
++ return instance;
++}
++
++void SandboxLinux::StopThread(base::Thread* thread) {
++ DCHECK(thread);
++ thread->Stop();
++}
++
++void SandboxLinux::PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type) {
++ CHECK(!pre_initialized_);
++#if BUILDFLAG(USING_SANITIZER)
++ // Sanitizers need to open some resources before the sandbox is enabled.
++ // This should not fork, not launch threads, not open a directory.
++ __sanitizer_sandbox_on_notify(sanitizer_args());
++ sanitizer_args_.reset();
++#endif
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ base::SysInfo::AmountOfPhysicalMemory();
++ base::SysInfo::NumberOfProcessors();
++ base::SysInfo::CPUModelName();
++
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ {
++#if BUILDFLAG(USE_NSS_CERTS)
++ // The main process has to initialize the ~/.pki dir which won't work
++ // after unveil(2).
++ crypto::EnsureNSSInit();
++#endif
++ CRYPTO_pre_sandbox_init();
++
++ base::FilePath cache_directory, local_directory;
++
++ base::PathService::Get(base::DIR_CACHE, &cache_directory);
++ base::PathService::Get(base::DIR_HOME, &local_directory);
++
++ cache_directory = cache_directory.AppendASCII("chromium");
++ local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications");
++
++ if (!base::CreateDirectory(cache_directory)) {
++ LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory.";
++ }
++
++ if (!base::CreateDirectory(local_directory)) {
++ LOG(ERROR) << "Failed to create " << local_directory.value() << " directory.";
++ }
++
++ break;
++ }
++ case sandbox::mojom::Sandbox::kRenderer:
++ {
++ FcConfig* config = gfx::GetGlobalFontConfig();
++ DCHECK(config);
++ break;
++ }
++ default:
++ break;
++ }
++
++ pre_initialized_ = true;
++}
++
++bool SandboxLinux::SetPledge(const char *pstring, const char *ppath) {
++ FILE *fp;
++ char *s = NULL;
++ size_t len = 0;
++ ssize_t read;
++
++ if (pstring != NULL) {
++ if (pledge(pstring, NULL) == -1)
++ goto err;
++ VLOG(5) << "pledge " << pstring;
++ } else if (ppath != NULL) {
++ fp = fopen(ppath, "r");
++ if (fp != NULL) {
++ while ((read = getline(&s, &len, fp)) != -1 ) {
++ if (s[strlen(s)-1] == '\n')
++ s[strlen(s)-1] = '\0';
++ if (pledge(s, NULL) == -1)
++ goto err;
++ VLOG(5) << "pledge " << s;
++ }
++ fclose(fp);
++ } else {
++ LOG(ERROR) << "fopen(" << ppath << ") failed, errno: " << errno;
++ return false;
++ }
++ }
++ return true;
++err:
++ LOG(ERROR) << "pledge() failed, errno: " << errno;
++ return false;
++}
++
++bool SandboxLinux::SetUnveil(const std::string process_type, sandbox::mojom::Sandbox sandbox_type) {
++ FILE *fp;
++ char *s = NULL, *cp = NULL, *home = NULL, **ap, *tokens[MAXTOKENS];
++ char path[PATH_MAX];
++ const char *ufile;
++ size_t len = 0, lineno = 0;
++
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ ufile = _UNVEIL_MAIN;
++ break;
++ case sandbox::mojom::Sandbox::kGpu:
++ case sandbox::mojom::Sandbox::kOnDeviceModelExecution:
++ ufile = _UNVEIL_GPU;
++ break;
++ case sandbox::mojom::Sandbox::kNetwork:
++ ufile = _UNVEIL_UTILITY_NETWORK;
++ break;
++ case sandbox::mojom::Sandbox::kAudio:
++ ufile = _UNVEIL_UTILITY_AUDIO;
++ break;
++ case sandbox::mojom::Sandbox::kVideoCapture:
++ ufile = _UNVEIL_UTILITY_VIDEO;
++ break;
++ default:
++ unveil("/dev/null", "r");
++ goto done;
++ }
++
++ fp = fopen(ufile, "r");
++ if (fp != NULL) {
++ while (!feof(fp)) {
++ if ((s = fparseln(fp, &len, &lineno, NULL,
++ FPARSELN_UNESCCOMM | FPARSELN_UNESCCONT)) == NULL) {
++ if (ferror(fp)) {
++ LOG(ERROR) << "ferror(), errno: " << errno;
++ _exit(1);
++ } else {
++ continue;
++ }
++ }
++ cp = s;
++ cp += strspn(cp, " \t\n"); /* eat whitespace */
++ if (cp[0] == '\0')
++ continue;
++
++ for (ap = tokens; ap < &tokens[MAXTOKENS - 1] &&
++ (*ap = strsep(&cp, " \t")) != NULL;) {
++ if (**ap != '\0')
++ ap++;
++ }
++ *ap = NULL;
++
++ if (tokens[1] == NULL) {
++ LOG(ERROR) << ufile << ": line " << lineno << ": must supply value to " << s;
++ _exit(1);
++ }
++
++ if (tokens[0][0] == '~') {
++ if ((home = getenv("HOME")) == NULL || *home == '\0') {
++ LOG(ERROR) << "failed to get home";
++ _exit(1);
++ }
++ memmove(tokens[0], tokens[0] + 1, strlen(tokens[0]));
++ strncpy(path, home, sizeof(path) - 1);
++ path[sizeof(path) - 1] = '\0';
++ strncat(path, tokens[0], sizeof(path) - 1 - strlen(path));
++ } else {
++ strncpy(path, tokens[0], sizeof(path) - 1);
++ path[sizeof(path) - 1] = '\0';
++ }
++
++ if (unveil(path, tokens[1]) == -1) {
++ LOG(ERROR) << "failed unveiling " << path << " with permissions " << tokens[1];
++ _exit(1);
++ } else {
++ VLOG(5) << "unveiling " << path << " with permissions " << tokens[1];
++ }
++ }
++ fclose(fp);
++ } else {
++ LOG(ERROR) << "failed to open " << ufile << " errno: " << errno;
++ _exit(1);
++ }
++
++done:
++ unveil_initialized_ = true;
++
++ return true;
++}
++
++bool SandboxLinux::unveil_initialized() const {
++ return unveil_initialized_;
++}
++
++bool SandboxLinux::InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ SandboxLinux::PreSandboxHook hook,
++ const Options& options) {
++ DCHECK(!initialize_sandbox_ran_);
++ initialize_sandbox_ran_ = true;
++
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ const std::string process_type =
++ command_line->GetSwitchValueASCII(switches::kProcessType);
++
++ if (command_line->HasSwitch(switches::kNoSandbox))
++ return true;
++
++ VLOG(1) << "SandboxLinux::InitializeSandbox: process_type="
++ << process_type << " sandbox_type=" << sandbox_type;
++
++ // Only one thread is running, pre-initialize if not already done.
++ if (!pre_initialized_)
++ PreinitializeSandbox(sandbox_type);
++
++ // Attempt to limit the future size of the address space of the process.
++ int error = 0;
++ const bool limited_as = LimitAddressSpace(&error);
++ if (error) {
++ // Restore errno. Internally to |LimitAddressSpace|, the errno due to
++ // setrlimit may be lost.
++ errno = error;
++ PCHECK(limited_as);
++ }
++
++ if (hook)
++ CHECK(std::move(hook).Run(options));
++
++ if (!command_line->HasSwitch(switches::kDisableUnveil))
++ SetUnveil(process_type, sandbox_type);
++
++ switch(sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ SetPledge(NULL, "@PKG_SYSCONFBASE@/chromium/pledge.main");
++ break;
++ case sandbox::mojom::Sandbox::kRenderer:
++ // prot_exec needed by v8
++ // flock needed by sqlite3 locking
++ SetPledge("stdio rpath flock prot_exec recvfd sendfd ps", NULL);
++ break;
++ case sandbox::mojom::Sandbox::kGpu:
++ case sandbox::mojom::Sandbox::kOnDeviceModelExecution:
++ SetPledge("stdio drm rpath flock cpath wpath prot_exec recvfd sendfd tmppath", NULL);
++ break;
++#if BUILDFLAG(ENABLE_PPAPI)
++ case sandbox::mojom::Sandbox::kPpapi:
++ // prot_exec needed by v8
++ SetPledge("stdio rpath prot_exec recvfd sendfd", NULL);
++ break;
++#endif
++ case sandbox::mojom::Sandbox::kAudio:
++ SetPledge(NULL, "@PKG_SYSCONFBASE@/chromium/pledge.utility_audio");
++ break;
++ case sandbox::mojom::Sandbox::kNetwork:
++ SetPledge(NULL, "@PKG_SYSCONFBASE@/chromium/pledge.utility_network");
++ break;
++ case sandbox::mojom::Sandbox::kVideoCapture:
++ SetPledge(NULL, "@PKG_SYSCONFBASE@/chromium/pledge.utility_video");
++ break;
++ case sandbox::mojom::Sandbox::kUtility:
++ case sandbox::mojom::Sandbox::kService:
++ SetPledge("stdio rpath cpath wpath fattr flock sendfd recvfd prot_exec", NULL);
++ break;
++ default:
++ LOG(ERROR) << "non-pledge()'d process: " << sandbox_type;
++ break;
++ }
++
++ return true;
++}
++
++bool SandboxLinux::LimitAddressSpace(int* error) {
++#if !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) && \
++ !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
++ if (SandboxTypeFromCommandLine(*command_line) == sandbox::mojom::Sandbox::kNoSandbox) {
++ return false;
++ }
++
++ // Unfortunately, it does not appear possible to set RLIMIT_AS such that it
++ // will both (a) be high enough to support V8's and WebAssembly's address
++ // space requirements while also (b) being low enough to mitigate exploits
++ // using integer overflows that require large allocations, heap spray, or
++ // other memory-hungry attack modes.
++
++ *error = sandbox::ResourceLimits::Lower(
++ RLIMIT_DATA, static_cast<rlim_t>(sandbox::kDataSizeLimit));
++
++ // Cache the resource limit before turning on the sandbox.
++ base::SysInfo::AmountOfVirtualMemory();
++ base::SysInfo::MaxSharedMemorySize();
++
++ return *error == 0;
++#else
++ base::SysInfo::AmountOfVirtualMemory();
++ return false;
++#endif // !defined(ADDRESS_SANITIZER) && !defined(MEMORY_SANITIZER) &&
++ // !defined(THREAD_SANITIZER) && !defined(LEAK_SANITIZER)
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h b/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
new file mode 100644
index 0000000000..45d41ca14f
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
@@ -0,0 +1,289 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/openbsd/sandbox_openbsd.h.orig 2025-05-24 17:57:53.564869801 +0000
++++ sandbox/policy/openbsd/sandbox_openbsd.h
+@@ -0,0 +1,280 @@
++// Copyright (c) 2012 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++#ifndef SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++#define SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
++
++#include <memory>
++#include <string>
++#include <vector>
++
++#include "base/logging.h"
++#include "base/posix/global_descriptors.h"
++#include "sandbox/policy/export.h"
++#include "sandbox/policy/linux/sandbox_seccomp_bpf_linux.h"
++#include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "base/sanitizer_buildflags.h"
++
++#if BUILDFLAG(USING_SANITIZER)
++#include <sanitizer/common_interface_defs.h>
++#endif
++
++namespace base {
++template <typename T>
++struct DefaultSingletonTraits;
++class Thread;
++} // namespace base
++
++namespace sandbox {
++namespace syscall_broker {
++class BrokerProcess;
++} // namespace syscall_broker
++} // namespace sandbox
++
++namespace sandbox {
++namespace policy {
++
++// A singleton class to represent and change our sandboxing state for the
++// three main Linux sandboxes.
++// The sandboxing model allows using two layers of sandboxing. The first layer
++// can be implemented either with unprivileged namespaces or with the setuid
++// sandbox. This class provides a way to engage the namespace sandbox, but does
++// not deal with the legacy setuid sandbox directly.
++// The second layer is mainly based on seccomp-bpf and is engaged with
++// InitializeSandbox(). InitializeSandbox() is also responsible for "sealing"
++// the first layer of sandboxing. That is, InitializeSandbox must always be
++// called to have any meaningful sandboxing at all.
++class SANDBOX_POLICY_EXPORT SandboxLinux {
++ public:
++ // This is a list of sandbox IPC methods which the renderer may send to the
++ // sandbox host. See
++ // https://chromium.googlesource.com/chromium/src/+/master/docs/linux_sandbox_ipc.md
++ // This isn't the full list, values < 32 are reserved for methods called from
++ // Skia, and values < 64 are reserved for libc_interceptor.cc.
++ enum LinuxSandboxIPCMethods {
++ DEPRECATED_METHOD_GET_FALLBACK_FONT_FOR_CHAR = 64,
++ DEPRECATED_METHOD_GET_CHILD_WITH_INODE,
++ DEPRECATED_METHOD_GET_STYLE_FOR_STRIKE,
++ METHOD_MAKE_SHARED_MEMORY_SEGMENT,
++ DEPRECATED_METHOD_MATCH_WITH_FALLBACK,
++ };
++
++ // These form a bitmask which describes the conditions of the Linux sandbox.
++ // Note: this doesn't strictly give you the current status, it states
++ // what will be enabled when the relevant processes are initialized.
++ enum Status {
++ // SUID sandbox active.
++ kSUID = 1 << 0,
++
++ // Sandbox is using a new PID namespace.
++ kPIDNS = 1 << 1,
++
++ // Sandbox is using a new network namespace.
++ kNetNS = 1 << 2,
++
++ // seccomp-bpf sandbox active.
++ kSeccompBPF = 1 << 3,
++
++ // The Yama LSM module is present and enforcing.
++ kYama = 1 << 4,
++
++ // seccomp-bpf sandbox is active and the kernel supports TSYNC.
++ kSeccompTSYNC = 1 << 5,
++
++ // User namespace sandbox active.
++ kUserNS = 1 << 6,
++
++ // A flag that denotes an invalid sandbox status.
++ kInvalid = 1 << 31,
++ };
++
++ // SandboxLinux Options are a superset of SandboxSecompBPF Options.
++ struct Options : public SandboxSeccompBPF::Options {
++ // When running with a zygote, the namespace sandbox will have already
++ // been engaged prior to initializing SandboxLinux itself, and need not
++ // be done so again. Set to true to indicate that there isn't a zygote
++ // for this process and the step is to be performed here explicitly.
++ bool engage_namespace_sandbox = false;
++
++ // Allow starting the sandbox with multiple threads already running. This
++ // will enable TSYNC for seccomp-BPF, which syncs the seccomp-BPF policy
++ // across all running threads.
++ bool allow_threads_during_sandbox_init = false;
++
++ // Enables the CHECK for open directories. The open directory check is only
++ // useful for the chroot jail (from the semantic layer of the sandbox), and
++ // can safely be disabled if we are only enabling the seccomp-BPF layer.
++ bool check_for_open_directories = true;
++ };
++
++ // Callers can provide this hook to run code right before the policy
++ // is passed to the BPF compiler and the sandbox is engaged. If
++ // pre_sandbox_hook() returns true, the sandbox will be engaged
++ // afterwards, otherwise the process is terminated.
++ using PreSandboxHook = base::OnceCallback<bool(Options)>;
++
++ // Get our singleton instance.
++ static SandboxLinux* GetInstance();
++
++ SandboxLinux(const SandboxLinux&) = delete;
++ SandboxLinux& operator=(const SandboxLinux&) = delete;
++
++ bool SetPledge(const char *pstring, const char *ppath);
++ bool SetUnveil(const std::string process_type, sandbox::mojom::Sandbox sandbox_type);
++
++ // Do some initialization that can only be done before any of the sandboxes
++ // are enabled. If using the setuid sandbox, this should be called manually
++ // before the setuid sandbox is engaged.
++ // Security: When this runs, it is imperative that either InitializeSandbox()
++ // runs as well or that all file descriptors returned in
++ // GetFileDescriptorsToClose() get closed.
++ // Otherwise file descriptors that bypass the security of the setuid sandbox
++ // would be kept open. One must be particularly careful if a process performs
++ // a fork().
++ void PreinitializeSandbox(sandbox::mojom::Sandbox sandbox_type);
++
++ // Check that the current process is the init process of a new PID
++ // namespace and then proceed to drop access to the file system by using
++ // a new unprivileged namespace. This is a layer-1 sandbox.
++ // In order for this sandbox to be effective, it must be "sealed" by calling
++ // InitializeSandbox().
++ void EngageNamespaceSandbox(bool from_zygote);
++
++ // Return a list of file descriptors to close if PreinitializeSandbox() ran
++ // but InitializeSandbox() won't. Avoid using.
++ // TODO(jln): get rid of this hack.
++ std::vector<int> GetFileDescriptorsToClose();
++
++ // Seal an eventual layer-1 sandbox and initialize the layer-2 sandbox with
++ // an adequate policy depending on the process type and command line
++ // arguments.
++ // Currently the layer-2 sandbox is composed of seccomp-bpf and address space
++ // limitations.
++ // This function should only be called without any thread running.
++ bool InitializeSandbox(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Stop |thread| in a way that can be trusted by the sandbox.
++ void StopThread(base::Thread* thread);
++
++ // Returns the status of the renderer, worker and ppapi sandbox. Can only
++ // be queried after going through PreinitializeSandbox(). This is a bitmask
++ // and uses the constants defined in "enum Status" above. Since the
++ // status needs to be provided before the sandboxes are actually started,
++ // this returns what will actually happen once InitializeSandbox()
++ // is called from inside these processes.
++ int GetStatus();
++
++ // Returns true if the current process is single-threaded or if the number
++ // of threads cannot be determined.
++ bool IsSingleThreaded() const;
++
++ // Returns true if we started Seccomp BPF.
++ bool seccomp_bpf_started() const;
++
++ // Returns true if unveil(2) is used.
++ bool unveil_initialized() const;
++
++ // Check the policy and eventually start the seccomp-bpf sandbox. This should
++ // never be called with threads started. If we detect that threads have
++ // started we will crash.
++ bool StartSeccompBPF(sandbox::mojom::Sandbox sandbox_type,
++ PreSandboxHook hook,
++ const Options& options);
++
++ // Limit the address space of the current process (and its children) to make
++ // some vulnerabilities harder to exploit. Writes the errno due to setrlimit
++ // (including 0 if no error) into |error|.
++ bool LimitAddressSpace(int* error);
++
++ // Returns a file descriptor to proc. The file descriptor is no longer valid
++ // after the sandbox has been sealed.
++ int proc_fd() const {
++ DCHECK_NE(-1, proc_fd_);
++ return proc_fd_;
++ }
++
++#if BUILDFLAG(USING_SANITIZER)
++ __sanitizer_sandbox_arguments* sanitizer_args() const {
++ return sanitizer_args_.get();
++ };
++#endif
++
++ // A BrokerProcess is a helper that is started before the sandbox is engaged,
++ // typically from a pre-sandbox hook, that will serve requests to access
++ // files over an IPC channel. The client of this runs from a SIGSYS handler
++ // triggered by the seccomp-bpf sandbox.
++ // |client_sandbox_policy| is the policy being run by the client, and is
++ // used to derive the equivalent broker-side policy.
++ // |broker_side_hook| is an alternate pre-sandbox hook to be run before the
++ // broker itself gets sandboxed, to which the broker side policy and
++ // |options| are passed.
++ // Crashes the process if the broker can not be started since continuation
++ // is impossible (and presumably unsafe).
++ // This should never be destroyed, as after the sandbox is started it is
++ // vital to the process.
++#if 0
++ void StartBrokerProcess(
++ const sandbox::syscall_broker::BrokerCommandSet& allowed_command_set,
++ std::vector<sandbox::syscall_broker::BrokerFilePermission> permissions,
++ PreSandboxHook broker_side_hook,
++ const Options& options);
++
++ sandbox::syscall_broker::BrokerProcess* broker_process() const {
++ return broker_process_;
++ }
++#endif
++
++ private:
++ friend struct base::DefaultSingletonTraits<SandboxLinux>;
++
++ SandboxLinux();
++ ~SandboxLinux();
++
++ // We must have been pre_initialized_ before using these.
++ bool seccomp_bpf_supported() const;
++ bool seccomp_bpf_with_tsync_supported() const;
++
++ // Returns true if it can be determined that the current process has open
++ // directories that are not managed by the SandboxLinux class. This would
++ // be a vulnerability as it would allow to bypass the setuid sandbox.
++ bool HasOpenDirectories() const;
++
++ // The last part of the initialization is to make sure any temporary "hole"
++ // in the sandbox is closed. For now, this consists of closing proc_fd_.
++ void SealSandbox();
++
++ // GetStatus() makes promises as to how the sandbox will behave. This
++ // checks that no promises have been broken.
++ void CheckForBrokenPromises(sandbox::mojom::Sandbox sandbox_type);
++
++ // Stop |thread| and make sure it does not appear in /proc/self/tasks/
++ // anymore.
++ void StopThreadAndEnsureNotCounted(base::Thread* thread) const;
++
++ // A file descriptor to /proc. It's dangerous to have it around as it could
++ // allow for sandbox bypasses. It needs to be closed before we consider
++ // ourselves sandboxed.
++ int proc_fd_;
++
++ bool seccomp_bpf_started_;
++ bool unveil_initialized_;
++ // The value returned by GetStatus(). Gets computed once and then cached.
++ int sandbox_status_flags_;
++ // Did PreinitializeSandbox() run?
++ bool pre_initialized_;
++ bool seccomp_bpf_supported_; // Accurate if pre_initialized_.
++ bool seccomp_bpf_with_tsync_supported_; // Accurate if pre_initialized_.
++ bool yama_is_enforcing_; // Accurate if pre_initialized_.
++ bool initialize_sandbox_ran_; // InitializeSandbox() was called.
++#if BUILDFLAG(USING_SANITIZER)
++ std::unique_ptr<__sanitizer_sandbox_arguments> sanitizer_args_;
++#endif
++ sandbox::syscall_broker::BrokerProcess* broker_process_; // Leaked as global.
++};
++
++} // namespace policy
++} // namespace sandbox
++
++#endif // SANDBOX_POLICY_LINUX_SANDBOX_OPENBSD_H_
diff --git a/electron34/patches/patch-sandbox_policy_sandbox.cc b/electron34/patches/patch-sandbox_policy_sandbox.cc
new file mode 100644
index 0000000000..12ca9b5ffc
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_sandbox.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/sandbox.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/sandbox.cc
+@@ -18,6 +18,10 @@
+ #include "sandbox/policy/linux/sandbox_linux.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif // BUILDFLAG(IS_BSD)
++
+ #if BUILDFLAG(IS_MAC)
+ #include "sandbox/mac/seatbelt.h"
+ #endif // BUILDFLAG(IS_MAC)
+@@ -32,7 +36,7 @@
+ namespace sandbox {
+ namespace policy {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool Sandbox::Initialize(sandbox::mojom::Sandbox sandbox_type,
+ SandboxLinux::PreSandboxHook hook,
+ const SandboxLinux::Options& options) {
diff --git a/electron34/patches/patch-sandbox_policy_sandbox.h b/electron34/patches/patch-sandbox_policy_sandbox.h
new file mode 100644
index 0000000000..4a1f8d7402
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_sandbox.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/sandbox.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/sandbox.h
+@@ -12,6 +12,14 @@
+ #include "sandbox/policy/linux/sandbox_linux.h"
+ #endif
+
++#if BUILDFLAG(IS_OPENBSD)
++#include "sandbox/policy/openbsd/sandbox_openbsd.h"
++#elif BUILDFLAG(IS_NETBSD)
++#include "sandbox/policy/netbsd/sandbox_netbsd.h"
++#elif BUILDFLAG(IS_FREEBSD)
++#include "sandbox/policy/freebsd/sandbox_freebsd.h"
++#endif
++
+ namespace sandbox {
+ namespace mojom {
+ enum class Sandbox;
+@@ -32,7 +40,7 @@ namespace policy {
+
+ class SANDBOX_POLICY_EXPORT Sandbox {
+ public:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static bool Initialize(sandbox::mojom::Sandbox sandbox_type,
+ SandboxLinux::PreSandboxHook hook,
+ const SandboxLinux::Options& options);
diff --git a/electron34/patches/patch-sandbox_policy_sandbox__type.cc b/electron34/patches/patch-sandbox_policy_sandbox__type.cc
new file mode 100644
index 0000000000..0f745b49aa
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_sandbox__type.cc
@@ -0,0 +1,138 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/sandbox_type.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/sandbox_type.cc
+@@ -76,7 +76,7 @@ void SetCommandLineFlagsForSandboxType(b
+ #endif
+ case Sandbox::kPrintCompositor:
+ case Sandbox::kAudio:
+-#if BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ case Sandbox::kVideoCapture:
+ #endif
+ #if BUILDFLAG(IS_WIN)
+@@ -87,10 +87,10 @@ void SetCommandLineFlagsForSandboxType(b
+ case Sandbox::kMediaFoundationCdm:
+ case Sandbox::kWindowsSystemProxyResolver:
+ #endif // BUILDFLAG(IS_WIN)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ case Sandbox::kHardwareVideoDecoding:
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kHardwareVideoEncoding:
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -108,10 +108,10 @@ void SetCommandLineFlagsForSandboxType(b
+ case Sandbox::kScreenAI:
+ #endif
+ case Sandbox::kSpeechRecognition:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case Sandbox::kVideoEffects:
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case Sandbox::kOnDeviceTranslation:
+ #endif
+ DCHECK(command_line->GetSwitchValueASCII(switches::kProcessType) ==
+@@ -121,7 +121,7 @@ void SetCommandLineFlagsForSandboxType(b
+ switches::kServiceSandboxType,
+ StringFromUtilitySandboxType(sandbox_type));
+ break;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kZygoteIntermediateSandbox:
+ break;
+ #endif
+@@ -161,7 +161,7 @@ sandbox::mojom::Sandbox SandboxTypeFromC
+ return Sandbox::kUtility;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Intermediate process gains a sandbox later.
+ if (process_type == switches::kZygoteProcessType)
+ return Sandbox::kZygoteIntermediateSandbox;
+@@ -207,7 +207,7 @@ std::string StringFromUtilitySandboxType
+ return switches::kUtilitySandbox;
+ case Sandbox::kAudio:
+ return switches::kAudioSandbox;
+-#if BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ case Sandbox::kVideoCapture:
+ return switches::kVideoCaptureSandbox;
+ #endif
+@@ -221,11 +221,11 @@ std::string StringFromUtilitySandboxType
+ case Sandbox::kScreenAI:
+ return switches::kScreenAISandbox;
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case Sandbox::kVideoEffects:
+ return switches::kVideoEffectsSandbox;
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ case Sandbox::kOnDeviceTranslation:
+ return switches::kOnDeviceTranslationSandbox;
+ #endif
+@@ -245,11 +245,11 @@ std::string StringFromUtilitySandboxType
+ case Sandbox::kMirroring:
+ return switches::kMirroringSandbox;
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ case Sandbox::kHardwareVideoDecoding:
+ return switches::kHardwareVideoDecodingSandbox;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kHardwareVideoEncoding:
+ return switches::kHardwareVideoEncodingSandbox;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -268,7 +268,7 @@ std::string StringFromUtilitySandboxType
+ // The following are not utility processes so should not occur.
+ case Sandbox::kRenderer:
+ case Sandbox::kGpu:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kZygoteIntermediateSandbox:
+ #endif
+ NOTREACHED();
+@@ -339,25 +339,25 @@ sandbox::mojom::Sandbox UtilitySandboxTy
+ if (sandbox_string == switches::kScreenAISandbox)
+ return Sandbox::kScreenAI;
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (sandbox_string == switches::kVideoEffectsSandbox) {
+ return Sandbox::kVideoEffects;
+ }
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ if (sandbox_string == switches::kOnDeviceTranslationSandbox) {
+ return Sandbox::kOnDeviceTranslation;
+ }
+ #endif
+-#if BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ if (sandbox_string == switches::kVideoCaptureSandbox)
+ return Sandbox::kVideoCapture;
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ if (sandbox_string == switches::kHardwareVideoDecodingSandbox)
+ return Sandbox::kHardwareVideoDecoding;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (sandbox_string == switches::kHardwareVideoEncodingSandbox)
+ return Sandbox::kHardwareVideoEncoding;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-sandbox_policy_switches.cc b/electron34/patches/patch-sandbox_policy_switches.cc
new file mode 100644
index 0000000000..7da31d6629
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_switches.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/switches.cc
+@@ -55,10 +55,10 @@ const char kWindowsSystemProxyResolverSa
+ const char kMirroringSandbox[] = "mirroring";
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ const char kHardwareVideoDecodingSandbox[] = "hardware_video_decoding";
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kHardwareVideoEncodingSandbox[] = "hardware_video_encoding";
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -71,7 +71,7 @@ const char kLibassistantSandbox[] = "lib
+ #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ const char kOnDeviceTranslationSandbox[] = "on_device_translation";
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
+@@ -102,7 +102,9 @@ const char kGpuSandboxFailuresFatal[] =
+ // Meant to be used as a browser-level switch for testing purposes only.
+ const char kNoSandbox[] = "no-sandbox";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++const char kDisableUnveil[] = "disable-unveil";
++
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Instructs the zygote to launch without a sandbox. Processes forked from this
+ // type of zygote will apply their own custom sandboxes later.
+ const char kNoZygoteSandbox[] = "no-zygote-sandbox";
diff --git a/electron34/patches/patch-sandbox_policy_switches.h b/electron34/patches/patch-sandbox_policy_switches.h
new file mode 100644
index 0000000000..5e12eb7387
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_switches.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/switches.h
+@@ -58,10 +58,10 @@ SANDBOX_POLICY_EXPORT extern const char
+ SANDBOX_POLICY_EXPORT extern const char kMirroringSandbox[];
+ #endif // BUILDFLAG(IS_MAC)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ SANDBOX_POLICY_EXPORT extern const char kHardwareVideoDecodingSandbox[];
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SANDBOX_POLICY_EXPORT extern const char kHardwareVideoEncodingSandbox[];
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+@@ -74,7 +74,7 @@ SANDBOX_POLICY_EXPORT extern const char
+ #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ SANDBOX_POLICY_EXPORT extern const char kOnDeviceTranslationSandbox[];
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
+
+@@ -87,7 +87,8 @@ SANDBOX_POLICY_EXPORT extern const char
+ SANDBOX_POLICY_EXPORT extern const char kGpuSandboxAllowSysVShm[];
+ SANDBOX_POLICY_EXPORT extern const char kGpuSandboxFailuresFatal[];
+ SANDBOX_POLICY_EXPORT extern const char kNoSandbox[];
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++SANDBOX_POLICY_EXPORT extern const char kDisableUnveil[];
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SANDBOX_POLICY_EXPORT extern const char kNoZygoteSandbox[];
+ #endif
+ #if BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-sandbox_policy_win_sandbox__win.cc b/electron34/patches/patch-sandbox_policy_win_sandbox__win.cc
new file mode 100644
index 0000000000..bd1c108214
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_win_sandbox__win.cc
@@ -0,0 +1,80 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/win/sandbox_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/win/sandbox_win.cc
+@@ -619,11 +619,9 @@ base::win::ScopedHandle CreateUnsandboxe
+ // command line flag.
+ ResultCode LaunchWithoutSandbox(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ base::LaunchOptions options,
+ SandboxDelegate* delegate,
+ base::Process* process) {
+- base::LaunchOptions options;
+- options.handles_to_inherit = handles_to_inherit;
+ // Network process runs in a job even when unsandboxed. This is to ensure it
+ // does not outlive the browser, which could happen if there is a lot of I/O
+ // on process shutdown, in which case TerminateProcess can fail. See
+@@ -920,7 +918,7 @@ bool SandboxWin::InitTargetServices(Targ
+ // static
+ ResultCode SandboxWin::GeneratePolicyForSandboxedProcess(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ SandboxDelegate* delegate,
+ TargetPolicy* policy) {
+ const base::CommandLine& launcher_process_command_line =
+@@ -934,7 +932,7 @@ ResultCode SandboxWin::GeneratePolicyFor
+ }
+
+ // Add any handles to be inherited to the policy.
+- for (HANDLE handle : handles_to_inherit)
++ for (HANDLE handle : options->handles_to_inherit)
+ policy->AddHandleToShare(handle);
+
+ if (!policy->GetConfig()->IsConfigured()) {
+@@ -949,6 +947,13 @@ ResultCode SandboxWin::GeneratePolicyFor
+ // have no effect. These calls can fail with SBOX_ERROR_BAD_PARAMS.
+ policy->SetStdoutHandle(GetStdHandle(STD_OUTPUT_HANDLE));
+ policy->SetStderrHandle(GetStdHandle(STD_ERROR_HANDLE));
++#else
++ if (options->stdout_handle != nullptr && options->stdout_handle != INVALID_HANDLE_VALUE) {
++ policy->SetStdoutHandle(options->stdout_handle);
++ }
++ if (options->stderr_handle != nullptr && options->stderr_handle != INVALID_HANDLE_VALUE) {
++ policy->SetStderrHandle(options->stderr_handle);
++ }
+ #endif
+
+ if (!delegate->PreSpawnTarget(policy))
+@@ -960,7 +965,7 @@ ResultCode SandboxWin::GeneratePolicyFor
+ // static
+ ResultCode SandboxWin::StartSandboxedProcess(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ SandboxDelegate* delegate,
+ StartSandboxedProcessCallback result_callback) {
+ SandboxLaunchTimer timer;
+@@ -970,7 +975,7 @@ ResultCode SandboxWin::StartSandboxedPro
+ *base::CommandLine::ForCurrentProcess())) {
+ base::Process process;
+ ResultCode result =
+- LaunchWithoutSandbox(cmd_line, handles_to_inherit, delegate, &process);
++ LaunchWithoutSandbox(cmd_line, *options, delegate, &process);
+ DWORD last_error = GetLastError();
+ std::move(result_callback).Run(std::move(process), last_error, result);
+ return SBOX_ALL_OK;
+@@ -980,7 +985,7 @@ ResultCode SandboxWin::StartSandboxedPro
+ timer.OnPolicyCreated();
+
+ ResultCode result = GeneratePolicyForSandboxedProcess(
+- cmd_line, handles_to_inherit, delegate, policy.get());
++ cmd_line, options, delegate, policy.get());
+ if (SBOX_ALL_OK != result) {
+ DWORD last_error = GetLastError();
+ std::move(result_callback).Run(base::Process(), last_error, result);
diff --git a/electron34/patches/patch-sandbox_policy_win_sandbox__win.h b/electron34/patches/patch-sandbox_policy_win_sandbox__win.h
new file mode 100644
index 0000000000..971549d0d6
--- /dev/null
+++ b/electron34/patches/patch-sandbox_policy_win_sandbox__win.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- sandbox/policy/win/sandbox_win.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ sandbox/policy/win/sandbox_win.h
+@@ -92,7 +92,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
+ // any other error.
+ static ResultCode StartSandboxedProcess(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ SandboxDelegate* delegate,
+ StartSandboxedProcessCallback result_callback);
+
+@@ -105,7 +105,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
+ // of sandbox::ResultCode for any other error while constructing the policy.
+ static ResultCode GeneratePolicyForSandboxedProcess(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ SandboxDelegate* delegate,
+ TargetPolicy* policy);
+
diff --git a/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.cc b/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..1c27545aaa
--- /dev/null
+++ b/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.cc
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/audio/audio_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/audio/audio_sandbox_hook_linux.cc
+@@ -143,6 +143,7 @@ void AddPulseAudioFilePermissions(
+ }
+ #endif
+
++#if !BUILDFLAG(IS_BSD)
+ std::vector<BrokerFilePermission> GetAudioFilePermissions() {
+ std::vector<BrokerFilePermission> permissions{
+ BrokerFilePermission::ReadOnly("/dev/urandom"),
+@@ -171,10 +172,12 @@ void LoadAudioLibraries() {
+ }
+ }
+ }
++#endif
+
+ } // namespace
+
+ bool AudioPreSandboxHook(sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ LoadAudioLibraries();
+ auto* instance = sandbox::policy::SandboxLinux::GetInstance();
+ instance->StartBrokerProcess(MakeBrokerCommandSet({
+@@ -192,6 +195,7 @@ bool AudioPreSandboxHook(sandbox::policy
+ // TODO(crbug.com/40579955) enable namespace sandbox. Currently, if
+ // enabled, connect() on pulse native socket fails with ENOENT (called from
+ // pa_context_connect).
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.h b/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.h
new file mode 100644
index 0000000000..cb21830dde
--- /dev/null
+++ b/electron34/patches/patch-services_audio_audio__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/audio/audio_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/audio/audio_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef SERVICES_AUDIO_AUDIO_SANDBOX_HOOK_LINUX_H_
+ #define SERVICES_AUDIO_AUDIO_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace audio {
+
diff --git a/electron34/patches/patch-services_device_BUILD.gn b/electron34/patches/patch-services_device_BUILD.gn
new file mode 100644
index 0000000000..92ed8fd4ae
--- /dev/null
+++ b/electron34/patches/patch-services_device_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/BUILD.gn
+@@ -15,7 +15,7 @@ if (is_android) {
+ }
+
+ is_serial_enabled_platform =
+- is_win || ((is_linux || is_chromeos) && use_udev) || is_mac
++ is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac
+
+ source_set("lib") {
+ # This should be visible only to embedders of the Device Service, and the
diff --git a/electron34/patches/patch-services_device_geolocation_location__provider__manager.cc b/electron34/patches/patch-services_device_geolocation_location__provider__manager.cc
new file mode 100644
index 0000000000..33eaf2c7f5
--- /dev/null
+++ b/electron34/patches/patch-services_device_geolocation_location__provider__manager.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/geolocation/location_provider_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/geolocation/location_provider_manager.cc
+@@ -87,7 +87,7 @@ LocationProviderManager::LocationProvide
+ #if BUILDFLAG(IS_ANDROID)
+ // On Android, default to using the platform location provider.
+ provider_manager_mode_ = kPlatformOnly;
+-#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Ash / Lacros / Linux, default to using the network location provider.
+ provider_manager_mode_ = kNetworkOnly;
+ #else
diff --git a/electron34/patches/patch-services_device_hid_BUILD.gn b/electron34/patches/patch-services_device_hid_BUILD.gn
new file mode 100644
index 0000000000..fef8348fb7
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_BUILD.gn
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/hid/BUILD.gn
+@@ -36,7 +36,40 @@ source_set("hid") {
+ "//services/device/public/mojom",
+ ]
+
+- if ((is_linux || is_chromeos) && use_udev) {
++ if (is_openbsd) {
++ sources += [
++ "hid_connection_fido.cc",
++ "hid_connection_fido.h",
++ "hid_service_fido.cc",
++ "hid_service_fido.h",
++ ]
++ libs = ["fido2", "cbor", "usbhid", "crypto", "util"]
++ }
++
++ if (is_freebsd) {
++ sources += [
++ "hid_connection_freebsd.cc",
++ "hid_connection_freebsd.h",
++ "hid_service_freebsd.cc",
++ "hid_service_freebsd.h",
++ ]
++ }
++
++ if (is_netbsd) {
++ sources += [
++ "hid_service_netbsd.cc",
++ "hid_service_netbsd.h",
++ ]
++ }
++
++ if (is_netbsd) {
++ sources += [
++ "hid_service_fuchsia.cc",
++ "hid_service_fuchsia.h",
++ ]
++ }
++
++ if ((is_linux || is_chromeos) && !is_bsd && use_udev) {
+ sources += [
+ "hid_connection_linux.cc",
+ "hid_connection_linux.h",
diff --git a/electron34/patches/patch-services_device_hid_hid__connection__fido.cc b/electron34/patches/patch-services_device_hid_hid__connection__fido.cc
new file mode 100644
index 0000000000..e68d842fe7
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__connection__fido.cc
@@ -0,0 +1,225 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_connection_fido.cc.orig 2025-05-24 17:57:53.566533035 +0000
++++ services/device/hid/hid_connection_fido.cc
+@@ -0,0 +1,216 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/hid/hid_connection_fido.h"
++
++#include <errno.h>
++#include <sys/ioctl.h>
++
++#include <memory>
++#include <string>
++#include <utility>
++
++#include "base/files/file_descriptor_watcher_posix.h"
++#include "base/memory/ref_counted_memory.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/threading/scoped_blocking_call.h"
++#include "components/device_event_log/device_event_log.h"
++#include "services/device/hid/hid_service.h"
++
++namespace device {
++
++class HidConnectionFido::BlockingTaskRunnerHelper {
++ public:
++ BlockingTaskRunnerHelper(base::ScopedFD fd,
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::WeakPtr<HidConnectionFido> connection)
++ : fd_(std::move(fd)),
++ connection_(connection),
++ origin_task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++ // Report buffers must always have room for the report ID.
++ report_buffer_size_ = device_info->max_input_report_size() + 1;
++ has_report_id_ = device_info->has_report_id();
++ }
++
++ BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete;
++ BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete;
++
++ ~BlockingTaskRunnerHelper() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ }
++
++ // Starts the FileDescriptorWatcher that reads input events from the device.
++ // Must be called on a thread that has a base::MessageLoopForIO.
++ void Start() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ file_watcher_ = base::FileDescriptorWatcher::WatchReadable(
++ fd_.get(), base::BindRepeating(
++ &BlockingTaskRunnerHelper::OnFileCanReadWithoutBlocking,
++ base::Unretained(this)));
++ }
++
++ void Write(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++
++ auto data = buffer->data();
++ size_t size = buffer->size();
++ // if report id is 0, it shouldn't be included
++ if (data[0] == 0) {
++ data++;
++ size--;
++ }
++
++ ssize_t result =
++ HANDLE_EINTR(write(fd_.get(), data, size));
++ if (result < 0) {
++ HID_PLOG(EVENT) << "Write failed";
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), false));
++ } else {
++ if (static_cast<size_t>(result) != size) {
++ HID_LOG(EVENT) << "Incomplete HID write: " << result
++ << " != " << buffer->size();
++ }
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), true));
++ }
++ }
++
++ void GetFeatureReport(uint8_t report_id,
++ scoped_refptr<base::RefCountedBytes> buffer,
++ ReadCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ HID_PLOG(EVENT) << "GendFeatureReport not implemented on OpenBSD";
++ origin_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(std::move(callback), false, nullptr, 0));
++ }
++
++ void SendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ HID_PLOG(EVENT) << "SendFeatureReport not implemented on OpenBSD";
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), false));
++ }
++
++ private:
++ void OnFileCanReadWithoutBlocking() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ auto buffer =
++ base::MakeRefCounted<base::RefCountedBytes>(report_buffer_size_);
++ uint8_t* data = buffer->as_vector().data();
++ size_t length = report_buffer_size_;
++ if (!has_report_id_) {
++ // Fido will not prefix the buffer with a report ID if report IDs are not
++ // used by the device. Prefix the buffer with 0.
++ *data++ = 0;
++ length--;
++ }
++
++ ssize_t bytes_read = HANDLE_EINTR(read(fd_.get(), data, length));
++ if (bytes_read < 0) {
++ if (errno != EAGAIN) {
++ HID_PLOG(EVENT) << "Read failed";
++ // This assumes that the error is unrecoverable and disables reading
++ // from the device until it has been re-opened.
++ // TODO(reillyg): Investigate starting and stopping the file descriptor
++ // watcher in response to pending read requests so that per-request
++ // errors can be returned to the client.
++ file_watcher_.reset();
++ }
++ return;
++ }
++ if (!has_report_id_) {
++ // Behave as if the byte prefixed above as the the report ID was read.
++ bytes_read++;
++ }
++
++ origin_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&HidConnectionFido::ProcessInputReport,
++ connection_, buffer, bytes_read));
++ }
++
++ SEQUENCE_CHECKER(sequence_checker_);
++ base::ScopedFD fd_;
++ size_t report_buffer_size_;
++ bool has_report_id_;
++ base::WeakPtr<HidConnectionFido> connection_;
++ const scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
++ std::unique_ptr<base::FileDescriptorWatcher::Controller> file_watcher_;
++};
++
++HidConnectionFido::HidConnectionFido(
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::ScopedFD fd,
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
++ bool allow_protected_reports,
++ bool allow_fido_reports)
++ : HidConnection(device_info, allow_protected_reports, allow_fido_reports),
++ helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner)),
++ blocking_task_runner_(std::move(blocking_task_runner)) {
++ helper_.reset(new BlockingTaskRunnerHelper(std::move(fd), device_info,
++ weak_factory_.GetWeakPtr()));
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start,
++ base::Unretained(helper_.get())));
++}
++
++HidConnectionFido::~HidConnectionFido() {}
++
++void HidConnectionFido::PlatformClose() {
++ // By closing the device on the blocking task runner 1) the requirement that
++ // base::ScopedFD is destroyed on a thread where I/O is allowed is satisfied
++ // and 2) any tasks posted to this task runner that refer to this file will
++ // complete before it is closed.
++ helper_.reset();
++}
++
++void HidConnectionFido::PlatformWrite(
++ scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ // Fido expects the first byte of the buffer to always be a report ID so the
++ // buffer can be used directly.
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Write,
++ base::Unretained(helper_.get()), buffer,
++ std::move(callback)));
++}
++
++void HidConnectionFido::PlatformGetFeatureReport(uint8_t report_id,
++ ReadCallback callback) {
++ // The first byte of the destination buffer is the report ID being requested
++ // and is overwritten by the feature report.
++ DCHECK_GT(device_info()->max_feature_report_size(), 0u);
++ auto buffer = base::MakeRefCounted<base::RefCountedBytes>(
++ device_info()->max_feature_report_size() + 1);
++ buffer->as_vector().data()[0] = report_id;
++
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::GetFeatureReport,
++ base::Unretained(helper_.get()), report_id,
++ buffer, std::move(callback)));
++}
++
++void HidConnectionFido::PlatformSendFeatureReport(
++ scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ // Fido expects the first byte of the buffer to always be a report ID so the
++ // buffer can be used directly.
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::SendFeatureReport,
++ base::Unretained(helper_.get()), buffer,
++ std::move(callback)));
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_hid_hid__connection__fido.h b/electron34/patches/patch-services_device_hid_hid__connection__fido.h
new file mode 100644
index 0000000000..f863e212e2
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__connection__fido.h
@@ -0,0 +1,69 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_connection_fido.h.orig 2025-05-24 17:57:53.566676020 +0000
++++ services/device/hid/hid_connection_fido.h
+@@ -0,0 +1,60 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef SERVICES_DEVICE_HID_HID_CONNECTION_LINUX_H_
++#define SERVICES_DEVICE_HID_HID_CONNECTION_LINUX_H_
++
++#include <stddef.h>
++#include <stdint.h>
++
++#include "base/files/scoped_file.h"
++#include "base/memory/weak_ptr.h"
++#include "base/task/sequenced_task_runner.h"
++#include "services/device/hid/hid_connection.h"
++
++namespace base {
++class SequencedTaskRunner;
++}
++
++namespace device {
++
++class HidConnectionFido : public HidConnection {
++ public:
++ HidConnectionFido(
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::ScopedFD fd,
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
++ bool allow_protected_reports,
++ bool allow_fido_reports);
++ HidConnectionFido(HidConnectionFido&) = delete;
++ HidConnectionFido& operator=(HidConnectionFido&) = delete;
++
++ private:
++ friend class base::RefCountedThreadSafe<HidConnectionFido>;
++ class BlockingTaskRunnerHelper;
++
++ ~HidConnectionFido() override;
++
++ // HidConnection implementation.
++ void PlatformClose() override;
++ void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) override;
++ void PlatformGetFeatureReport(uint8_t report_id,
++ ReadCallback callback) override;
++ void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) override;
++
++ // |helper_| lives on the sequence to which |blocking_task_runner_| posts
++ // tasks so all calls must be posted there including this object's
++ // destruction.
++ std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_;
++
++ const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
++
++ base::WeakPtrFactory<HidConnectionFido> weak_factory_{this};
++};
++
++} // namespace device
++
++#endif // SERVICES_DEVICE_HID_HID_CONNECTION_LINUX_H_
diff --git a/electron34/patches/patch-services_device_hid_hid__connection__freebsd.cc b/electron34/patches/patch-services_device_hid_hid__connection__freebsd.cc
new file mode 100644
index 0000000000..078797d790
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__connection__freebsd.cc
@@ -0,0 +1,249 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_connection_freebsd.cc.orig 2025-05-24 17:57:53.566807644 +0000
++++ services/device/hid/hid_connection_freebsd.cc
+@@ -0,0 +1,240 @@
++// Copyright (c) 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/hid/hid_connection_freebsd.h"
++
++#include <dev/usb/usbhid.h>
++#include <dev/usb/usb_ioctl.h>
++
++#include "base/files/file_descriptor_watcher_posix.h"
++#include "base/location.h"
++#include "base/numerics/safe_math.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/strings/stringprintf.h"
++#include "base/task/single_thread_task_runner.h"
++#include "base/threading/scoped_blocking_call.h"
++#include "base/threading/thread_restrictions.h"
++#include "components/device_event_log/device_event_log.h"
++#include "services/device/hid/hid_service.h"
++
++namespace device {
++
++class HidConnectionFreeBSD::BlockingTaskRunnerHelper {
++ public:
++ BlockingTaskRunnerHelper(base::ScopedFD fd,
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::WeakPtr<HidConnectionFreeBSD> connection)
++ : fd_(std::move(fd)),
++ connection_(connection),
++ origin_task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++ // Report buffers must always have room for the report ID.
++ report_buffer_size_ = device_info->max_input_report_size() + 1;
++ has_report_id_ = device_info->has_report_id();
++ }
++
++ BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete;
++ BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete;
++
++ ~BlockingTaskRunnerHelper() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); }
++
++ // Starts the FileDescriptorWatcher that reads input events from the device.
++ // Must be called on a thread that has a base::MessageLoopForIO.
++ void Start() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::AssertBlockingAllowed();
++
++ file_watcher_ = base::FileDescriptorWatcher::WatchReadable(
++ fd_.get(), base::BindRepeating(&BlockingTaskRunnerHelper::OnFileCanReadWithoutBlocking,
++ base::Unretained(this)));
++ }
++
++ void Write(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++
++ auto data = buffer->as_vector().data();
++ size_t size = buffer->size();
++ // if report id is 0, it shouldn't be included
++ if (data[0] == 0) {
++ data++;
++ size--;
++ }
++
++ ssize_t result = HANDLE_EINTR(write(fd_.get(), data, size));
++ if (result < 0) {
++ HID_PLOG(EVENT) << "Write failed";
++ origin_task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), false));
++ } else {
++ if (static_cast<size_t>(result) != size)
++ HID_LOG(EVENT) << "Incomplete HID write: " << result << " != " << size;
++ origin_task_runner_->PostTask(FROM_HERE, base::BindOnce(std::move(callback), true));
++ }
++ }
++
++ void GetFeatureReport(uint8_t report_id,
++ scoped_refptr<base::RefCountedBytes> buffer,
++ ReadCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ struct usb_gen_descriptor ugd;
++ ugd.ugd_report_type = UHID_FEATURE_REPORT;
++ ugd.ugd_data = buffer->as_vector().data();
++ ugd.ugd_maxlen = buffer->size();
++ int result = HANDLE_EINTR(
++ ioctl(fd_.get(), USB_GET_REPORT, &ugd));
++ if (result < 0) {
++ HID_PLOG(EVENT) << "Failed to get feature report";
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), false, nullptr, 0));
++ } else if (result == 0) {
++ HID_LOG(EVENT) << "Get feature result too short.";
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), false, nullptr, 0));
++ } else {
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), true, buffer, result));
++ }
++ }
++
++ void SendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ struct usb_gen_descriptor ugd;
++ ugd.ugd_report_type = UHID_FEATURE_REPORT;
++ ugd.ugd_data = buffer->as_vector().data();
++ ugd.ugd_maxlen = buffer->size();
++ // FreeBSD does not require report id if it's not used
++ if (buffer->data()[0] == 0) {
++ ugd.ugd_data = buffer->as_vector().data() + 1;
++ ugd.ugd_maxlen = buffer->size() - 1;
++ } else {
++ ugd.ugd_data = buffer->as_vector().data();
++ ugd.ugd_maxlen = buffer->size();
++ }
++ int result = HANDLE_EINTR(
++ ioctl(fd_.get(), USB_SET_REPORT, &ugd));
++ if (result < 0) {
++ HID_PLOG(EVENT) << "Failed to send feature report";
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), false));
++ } else {
++ origin_task_runner_->PostTask(FROM_HERE,
++ base::BindOnce(std::move(callback), true));
++ }
++ }
++
++ private:
++ void OnFileCanReadWithoutBlocking() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ scoped_refptr<base::RefCountedBytes> buffer(new base::RefCountedBytes(report_buffer_size_));
++ unsigned char* data = buffer->as_vector().data();
++ size_t length = report_buffer_size_;
++ if (!has_report_id_) {
++ // FreeBSD will not prefix the buffer with a report ID if report IDs are not
++ // used by the device. Prefix the buffer with 0.
++ *data++ = 0;
++ length--;
++ }
++
++ ssize_t bytes_read = HANDLE_EINTR(read(fd_.get(), data, length));
++ if (bytes_read < 0) {
++ if (errno != EAGAIN) {
++ HID_PLOG(EVENT) << "Read failed";
++ // This assumes that the error is unrecoverable and disables reading
++ // from the device until it has been re-opened.
++ // TODO(reillyg): Investigate starting and stopping the file descriptor
++ // watcher in response to pending read requests so that per-request
++ // errors can be returned to the client.
++ file_watcher_.reset();
++ }
++ return;
++ }
++ if (!has_report_id_) {
++ // Behave as if the byte prefixed above as the the report ID was read.
++ bytes_read++;
++ }
++
++ origin_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&HidConnectionFreeBSD::ProcessInputReport,
++ connection_, buffer, bytes_read));
++ }
++
++ SEQUENCE_CHECKER(sequence_checker_);
++ base::ScopedFD fd_;
++ size_t report_buffer_size_;
++ bool has_report_id_;
++ base::WeakPtr<HidConnectionFreeBSD> connection_;
++ const scoped_refptr<base::SequencedTaskRunner> origin_task_runner_;
++ std::unique_ptr<base::FileDescriptorWatcher::Controller> file_watcher_;
++};
++
++HidConnectionFreeBSD::HidConnectionFreeBSD(
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::ScopedFD fd,
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
++ bool allow_protected_reports,
++ bool allow_fido_reports)
++ : HidConnection(device_info, allow_protected_reports, allow_fido_reports),
++ helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner)),
++ blocking_task_runner_(std::move(blocking_task_runner)) {
++ helper_.reset(new BlockingTaskRunnerHelper(std::move(fd), device_info,
++ weak_factory_.GetWeakPtr()));
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start,
++ base::Unretained(helper_.get())));
++}
++
++HidConnectionFreeBSD::~HidConnectionFreeBSD() {}
++
++void HidConnectionFreeBSD::PlatformClose() {
++ // By closing the device on the blocking task runner 1) the requirement that
++ // base::ScopedFD is destroyed on a thread where I/O is allowed is satisfied
++ // and 2) any tasks posted to this task runner that refer to this file will
++ // complete before it is closed.
++ blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release());
++}
++
++void HidConnectionFreeBSD::PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++
++ blocking_task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&BlockingTaskRunnerHelper::Write, base::Unretained(helper_.get()),
++ buffer, std::move(callback)));
++}
++
++void HidConnectionFreeBSD::PlatformGetFeatureReport(uint8_t report_id,
++ ReadCallback callback) {
++ // The first byte of the destination buffer is the report ID being requested
++ // and is overwritten by the feature report.
++ DCHECK_GT(device_info()->max_feature_report_size(), 0u);
++ scoped_refptr<base::RefCountedBytes> buffer(
++ new base::RefCountedBytes(device_info()->max_feature_report_size() + 1));
++ if (report_id != 0)
++ buffer->as_vector().data()[0] = report_id;
++
++ blocking_task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&BlockingTaskRunnerHelper::GetFeatureReport,
++ base::Unretained(helper_.get()), report_id,
++ buffer, std::move(callback)));
++}
++
++void HidConnectionFreeBSD::PlatformSendFeatureReport(
++ scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) {
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ blocking_task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&BlockingTaskRunnerHelper::SendFeatureReport,
++ base::Unretained(helper_.get()), buffer, std::move(callback)));
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_hid_hid__connection__freebsd.h b/electron34/patches/patch-services_device_hid_hid__connection__freebsd.h
new file mode 100644
index 0000000000..c30238e90d
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__connection__freebsd.h
@@ -0,0 +1,76 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_connection_freebsd.h.orig 2025-05-24 17:57:53.566953996 +0000
++++ services/device/hid/hid_connection_freebsd.h
+@@ -0,0 +1,67 @@
++// Copyright (c) 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef DEVICE_HID_HID_CONNECTION_FREEBSD_H_
++#define DEVICE_HID_HID_CONNECTION_FREEBSD_H_
++
++#include <stddef.h>
++#include <stdint.h>
++
++#include "base/files/scoped_file.h"
++#include "base/memory/weak_ptr.h"
++#include "base/memory/ref_counted_memory.h"
++#include "base/task/sequenced_task_runner.h"
++#include "services/device/hid/hid_connection.h"
++
++namespace base {
++class SequencedTaskRunner;
++}
++
++namespace net {
++class IOBuffer;
++}
++
++namespace device {
++
++class HidConnectionFreeBSD : public HidConnection {
++ public:
++ HidConnectionFreeBSD(
++ scoped_refptr<HidDeviceInfo> device_info,
++ base::ScopedFD fd,
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner,
++ bool allow_protected_reports,
++ bool allow_fido_reports);
++
++ private:
++ friend class base::RefCountedThreadSafe<HidConnectionFreeBSD>;
++ class BlockingTaskRunnerHelper;
++
++ HidConnectionFreeBSD(const HidConnectionFreeBSD&) = delete;
++ HidConnectionFreeBSD& operator=(const HidConnectionFreeBSD&) = delete;
++
++ ~HidConnectionFreeBSD() override;
++
++ // HidConnection implementation.
++ void PlatformClose() override;
++ void PlatformWrite(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) override;
++ void PlatformGetFeatureReport(uint8_t report_id,
++ ReadCallback callback) override;
++ void PlatformSendFeatureReport(scoped_refptr<base::RefCountedBytes> buffer,
++ WriteCallback callback) override;
++
++ // |helper_| lives on the sequence to which |blocking_task_runner_| posts
++ // tasks so all calls must be posted there including this object's
++ // destruction.
++ std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_;
++
++ const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
++ const scoped_refptr<base::SequencedTaskRunner> task_runner_;
++
++ base::WeakPtrFactory<HidConnectionFreeBSD> weak_factory_{this};
++};
++
++} // namespace device
++
++#endif // DEVICE_HID_HID_CONNECTION_FREEBSD_H_
diff --git a/electron34/patches/patch-services_device_hid_hid__service.cc b/electron34/patches/patch-services_device_hid_hid__service.cc
new file mode 100644
index 0000000000..2142aae21f
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/hid/hid_service.cc
+@@ -20,12 +20,18 @@
+
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(USE_UDEV)
+ #include "services/device/hid/hid_service_linux.h"
++#elif BUILDFLAG(IS_OPENBSD)
++#include "services/device/hid/hid_service_fido.h"
++#elif BUILDFLAG(IS_FREEBSD)
++#include "services/device/hid/hid_service_freebsd.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "services/device/hid/hid_service_mac.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "services/device/hid/hid_service_win.h"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include "services/device/hid/hid_service_fuchsia.h"
++#elif BUILDFLAG(IS_NETBSD)
++#include "services/device/hid/hid_service_netbsd.h"
+ #endif
+
+ namespace device {
+@@ -68,12 +74,18 @@ constexpr base::TaskTraits HidService::k
+ std::unique_ptr<HidService> HidService::Create() {
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(USE_UDEV)
+ return std::make_unique<HidServiceLinux>();
++#elif BUILDFLAG(IS_OPENBSD)
++ return std::make_unique<HidServiceFido>();
++#elif BUILDFLAG(IS_FREEBSD)
++ return std::make_unique<HidServiceFreeBSD>();
+ #elif BUILDFLAG(IS_MAC)
+ return std::make_unique<HidServiceMac>();
+ #elif BUILDFLAG(IS_WIN)
+ return std::make_unique<HidServiceWin>();
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return std::make_unique<HidServiceFuchsia>();
++#elif BUILDFLAG(IS_NETBSD)
++ return std::make_unique<HidServiceNetBSD>();
+ #else
+ return nullptr;
+ #endif
diff --git a/electron34/patches/patch-services_device_hid_hid__service__fido.cc b/electron34/patches/patch-services_device_hid_hid__service__fido.cc
new file mode 100644
index 0000000000..82715519c6
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__fido.cc
@@ -0,0 +1,405 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_fido.cc.orig 2025-05-24 17:57:53.567220058 +0000
++++ services/device/hid/hid_service_fido.cc
+@@ -0,0 +1,396 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/hid/hid_service_fido.h"
++
++#include <fcntl.h>
++#include <poll.h>
++#include <stdint.h>
++
++#include <dlfcn.h>
++#include <fido.h>
++
++#include <limits>
++#include <memory>
++#include <string>
++#include <utility>
++
++#include "base/files/file.h"
++#include "base/files/file_path.h"
++#include "base/files/file_util.h"
++#include "base/files/scoped_file.h"
++#include "base/location.h"
++#include "base/sequence_checker.h"
++#include "base/strings/string_number_conversions.h"
++#include "base/strings/string_split.h"
++#include "base/strings/string_util.h"
++#include "base/task/sequenced_task_runner.h"
++#include "base/task/thread_pool.h"
++#include "base/threading/scoped_blocking_call.h"
++#include "build/build_config.h"
++#include "build/chromeos_buildflags.h"
++#include "components/device_event_log/device_event_log.h"
++#include "device/udev_linux/scoped_udev.h"
++#include "device/udev_linux/udev_watcher.h"
++#include "services/device/hid/hid_connection_fido.h"
++
++namespace device {
++
++namespace {
++
++bool terrible_ping_kludge(int fd, const std::string &path) {
++ u_char data[256];
++ int i, n;
++ struct pollfd pfd;
++
++ for (i = 0; i < 4; i++) {
++ memset(data, 0, sizeof(data));
++ /* broadcast channel ID */
++ data[1] = 0xff;
++ data[2] = 0xff;
++ data[3] = 0xff;
++ data[4] = 0xff;
++ /* Ping command */
++ data[5] = 0x81;
++ /* One byte ping only, Vasili */
++ data[6] = 0;
++ data[7] = 1;
++ HID_LOG(EVENT) << "send ping " << i << " " << path;
++ if (write(fd, data, 64) == -1) {
++ HID_PLOG(ERROR) << "write " << path;
++ return false;
++ }
++ HID_LOG(EVENT) << "wait reply " << path;
++ memset(&pfd, 0, sizeof(pfd));
++ pfd.fd = fd;
++ pfd.events = POLLIN;
++ if ((n = poll(&pfd, 1, 100)) == -1) {
++ HID_PLOG(EVENT) << "poll " << path;
++ return false;
++ } else if (n == 0) {
++ HID_LOG(EVENT) << "timed out " << path;
++ continue;
++ }
++ if (read(fd, data, 64) == -1) {
++ HID_PLOG(ERROR) << "read " << path;
++ return false;
++ }
++ /*
++ * Ping isn't always supported on the broadcast channel,
++ * so we might get an error, but we don't care - we're
++ * synched now.
++ */
++ HID_LOG(EVENT) << "got reply " << path;
++ return true;
++ }
++ HID_LOG(ERROR) << "no response " << path;
++ return false;
++}
++
++// HID report descriptor for U2F interface. Copied from:
++// https://chromium.googlesource.com/chromiumos/platform2/+/c6c7e4e54fce11932fedaa3ea10236bf75d85a2b%5E%21/u2fd/u2fhid.cc
++// Apparently Chromium wants to see these bytes, but OpenBSD fido(4)
++// devices prohibit USB_GET_REPORT_DESC ioctl that could be used to
++// get the bytes from the USB device.
++constexpr uint8_t kU2fReportDesc[] = {
++ 0x06, 0xD0, 0xF1, /* Usage Page (FIDO Alliance), FIDO_USAGE_PAGE */
++ 0x09, 0x01, /* Usage (U2F HID Auth. Device) FIDO_USAGE_U2FHID */
++ 0xA1, 0x01, /* Collection (Application), HID_APPLICATION */
++ 0x09, 0x20, /* Usage (Input Report Data), FIDO_USAGE_DATA_IN */
++ 0x15, 0x00, /* Logical Minimum (0) */
++ 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
++ 0x75, 0x08, /* Report Size (8) */
++ 0x95, 0x40, /* Report Count (64), HID_INPUT_REPORT_BYTES */
++ 0x81, 0x02, /* Input (Data, Var, Abs), Usage */
++ 0x09, 0x21, /* Usage (Output Report Data), FIDO_USAGE_DATA_OUT */
++ 0x15, 0x00, /* Logical Minimum (0) */
++ 0x26, 0xFF, 0x00, /* Logical Maximum (255) */
++ 0x75, 0x08, /* Report Size (8) */
++ 0x95, 0x40, /* Report Count (64), HID_OUTPUT_REPORT_BYTES */
++ 0x91, 0x02, /* Output (Data, Var, Abs), Usage */
++ 0xC0 /* End Collection */
++};
++
++} // namespace
++
++struct HidServiceFido::ConnectParams {
++ ConnectParams(scoped_refptr<HidDeviceInfo> device_info,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback)
++ : device_info(std::move(device_info)),
++ allow_protected_reports(allow_protected_reports),
++ allow_fido_reports(allow_fido_reports),
++ callback(std::move(callback)),
++ task_runner(base::SequencedTaskRunner::GetCurrentDefault()),
++ blocking_task_runner(
++ base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)) {}
++ ~ConnectParams() {}
++
++ scoped_refptr<HidDeviceInfo> device_info;
++ bool allow_protected_reports;
++ bool allow_fido_reports;
++ ConnectCallback callback;
++ scoped_refptr<base::SequencedTaskRunner> task_runner;
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner;
++ base::ScopedFD fd;
++};
++
++class HidServiceFido::BlockingTaskRunnerHelper : public UdevWatcher::Observer {
++ public:
++ BlockingTaskRunnerHelper(base::WeakPtr<HidServiceFido> service)
++ : service_(std::move(service)),
++ task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++ }
++
++ BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete;
++ BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete;
++
++ ~BlockingTaskRunnerHelper() override {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ }
++
++ void Start() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ void *library = dlopen("libudev.so", RTLD_NOW | RTLD_LOCAL);
++ if (library) {
++ dlclose(library);
++ watcher_ = UdevWatcher::StartWatching(this);
++ watcher_->EnumerateExistingDevices();
++ } else {
++ HID_LOG(ERROR) << "No udev available, failling back to single enumeration";
++ WalkFidoDevices(nullptr);
++ }
++
++ task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&HidServiceFido::FirstEnumerationComplete, service_));
++ }
++
++ private:
++ void WalkFidoDevices(const char *name) {
++ fido_dev_info_t *devlist = NULL;
++ fido_dev_t *dev = NULL;
++ size_t devlist_len = 0, i;
++ const char *path;
++ int r;
++ const int MAX_FIDO_DEVICES = 256;
++
++ if ((devlist = fido_dev_info_new(MAX_FIDO_DEVICES)) == NULL) {
++ HID_LOG(ERROR) << "fido_dev_info_new failed";
++ goto out;
++ }
++ if ((r = fido_dev_info_manifest(devlist, MAX_FIDO_DEVICES, &devlist_len)) !=
++ FIDO_OK) {
++ HID_LOG(ERROR) << "fido_dev_info_manifest: " << fido_strerr(r);
++ goto out;
++ }
++
++ HID_LOG(EVENT) << "fido_dev_info_manifest found " << devlist_len
++ << " device(s)";
++
++ for (i = 0; i < devlist_len; i++) {
++ const fido_dev_info_t *di = fido_dev_info_ptr(devlist, i);
++
++ if (di == NULL) {
++ HID_LOG(ERROR) << "fido_dev_info_ptr " << i << " failed";
++ continue;
++ }
++
++ if ((path = fido_dev_info_path(di)) == NULL) {
++ HID_LOG(ERROR) << "fido_dev_info_path " << i << " failed";
++ continue;
++ }
++
++ if (name != nullptr && !strcmp(path, name)) {
++ HID_LOG(EVENT) << "hotplug device " << i << ": " << path;
++ OnFidoDeviceAdded(di);
++ break;
++ }
++
++ HID_LOG(EVENT) << "trying device " << i << ": " << path;
++ if ((dev = fido_dev_new()) == NULL) {
++ HID_LOG(ERROR) << "fido_dev_new failed";
++ continue;
++ }
++
++ if ((r = fido_dev_open(dev, path)) != FIDO_OK) {
++ HID_LOG(ERROR) << "fido_dev_open failed " << path;
++ fido_dev_free(&dev);
++ continue;
++ }
++
++ fido_dev_close(dev);
++ fido_dev_free(&dev);
++
++ OnFidoDeviceAdded(di);
++ }
++ out:
++ if (devlist != NULL)
++ fido_dev_info_free(&devlist, MAX_FIDO_DEVICES);
++ }
++
++ void OnFidoDeviceAdded(const fido_dev_info_t *di) {
++ auto null_as_empty = [](const char *r) -> std::string {
++ return (r != nullptr) ? r : "";
++ };
++ std::string device_node(null_as_empty(fido_dev_info_path(di)));
++ std::vector<uint8_t> report_descriptor(
++ kU2fReportDesc, kU2fReportDesc + sizeof(kU2fReportDesc));
++
++ auto device_info = base::MakeRefCounted<HidDeviceInfo>(
++ device_node, /*physical_device_id*/"", fido_dev_info_vendor(di),
++ fido_dev_info_product(di), null_as_empty(fido_dev_info_product_string(di)),
++ null_as_empty(fido_dev_info_manufacturer_string(di)),
++ device::mojom::HidBusType::kHIDBusTypeUSB, report_descriptor,
++ device_node);
++
++ task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&HidServiceFido::AddDevice, service_, device_info));
++ }
++
++ // UdevWatcher::Observer
++ void OnDeviceAdded(ScopedUdevDevicePtr device) override {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++
++ const char* subsystem = udev_device_get_subsystem(device.get());
++ if (!subsystem || strcmp(subsystem, "fido") != 0)
++ return;
++
++ const char* device_path = udev_device_get_syspath(device.get());
++ if (!device_path)
++ return;
++
++ WalkFidoDevices(device_path);
++ }
++
++ void OnDeviceRemoved(ScopedUdevDevicePtr device) override {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++
++ const char* device_path = udev_device_get_syspath(device.get());
++ if (device_path) {
++ task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&HidServiceFido::RemoveDevice, service_,
++ std::string(device_path)));
++ }
++ }
++
++ void OnDeviceChanged(ScopedUdevDevicePtr) override {}
++
++ SEQUENCE_CHECKER(sequence_checker_);
++ std::unique_ptr<UdevWatcher> watcher_;
++
++ // This weak pointer is only valid when checked on this task runner.
++ base::WeakPtr<HidServiceFido> service_;
++ scoped_refptr<base::SequencedTaskRunner> task_runner_;
++};
++
++HidServiceFido::HidServiceFido()
++ : blocking_task_runner_(
++ base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)),
++ helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)) {
++ // We need to properly initialize |blocking_task_helper_| here because we need
++ // |weak_factory_| to be created first.
++ helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr()));
++ blocking_task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&BlockingTaskRunnerHelper::Start,
++ base::Unretained(helper_.get())));
++}
++
++HidServiceFido::~HidServiceFido() = default;
++
++base::WeakPtr<HidService> HidServiceFido::GetWeakPtr() {
++ return weak_factory_.GetWeakPtr();
++}
++
++void HidServiceFido::Connect(const std::string& device_guid,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ const auto& map_entry = devices().find(device_guid);
++ if (map_entry == devices().end()) {
++ base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
++ FROM_HERE, base::BindOnce(std::move(callback), nullptr));
++ return;
++ }
++ scoped_refptr<HidDeviceInfo> device_info = map_entry->second;
++
++ auto params =
++ std::make_unique<ConnectParams>(device_info, allow_protected_reports,
++ allow_fido_reports, std::move(callback));
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
++ params->blocking_task_runner;
++ blocking_task_runner->PostTask(
++ FROM_HERE, base::BindOnce(&HidServiceFido::OpenOnBlockingThread,
++ std::move(params)));
++}
++
++// static
++void HidServiceFido::OpenOnBlockingThread(
++ std::unique_ptr<ConnectParams> params) {
++ base::ScopedBlockingCall scoped_blocking_call(FROM_HERE,
++ base::BlockingType::MAY_BLOCK);
++ scoped_refptr<base::SequencedTaskRunner> task_runner = params->task_runner;
++
++ base::FilePath device_path(params->device_info->device_node());
++ base::File device_file;
++ int flags =
++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE;
++ device_file.Initialize(device_path, flags);
++ if (!device_file.IsValid()) {
++ base::File::Error file_error = device_file.error_details();
++
++ if (file_error == base::File::FILE_ERROR_ACCESS_DENIED) {
++ HID_LOG(EVENT)
++ << "Access denied opening device read-write, trying read-only.";
++ flags = base::File::FLAG_OPEN | base::File::FLAG_READ;
++ device_file.Initialize(device_path, flags);
++ }
++ }
++ if (!device_file.IsValid()) {
++ HID_LOG(EVENT) << "Failed to open '" << params->device_info->device_node()
++ << "': "
++ << base::File::ErrorToString(device_file.error_details());
++ task_runner->PostTask(FROM_HERE,
++ base::BindOnce(std::move(params->callback), nullptr));
++ return;
++ }
++ if (!terrible_ping_kludge(device_file.GetPlatformFile(), params->device_info->device_node())) {
++ HID_LOG(EVENT) << "Failed to ping " << params->device_info->device_node();
++ task_runner->PostTask(FROM_HERE, base::BindOnce(std::move(params->callback), nullptr));
++ return;
++ }
++ params->fd.reset(device_file.TakePlatformFile());
++
++ task_runner->PostTask(FROM_HERE, base::BindOnce(&HidServiceFido::FinishOpen,
++ std::move(params)));
++}
++
++// static
++void HidServiceFido::FinishOpen(std::unique_ptr<ConnectParams> params) {
++ DCHECK(params->fd.is_valid());
++
++ if (!base::SetNonBlocking(params->fd.get())) {
++ HID_PLOG(DEBUG) << "Failed to set the non-blocking flag on the device fd";
++ std::move(params->callback).Run(nullptr);
++ return;
++ }
++
++ std::move(params->callback)
++ .Run(base::MakeRefCounted<HidConnectionFido>(
++ std::move(params->device_info), std::move(params->fd),
++ std::move(params->blocking_task_runner),
++ params->allow_protected_reports, params->allow_fido_reports));
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_hid_hid__service__fido.h b/electron34/patches/patch-services_device_hid_hid__service__fido.h
new file mode 100644
index 0000000000..5a3138a191
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__fido.h
@@ -0,0 +1,74 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_fido.h.orig 2025-05-24 17:57:53.567379826 +0000
++++ services/device/hid/hid_service_fido.h
+@@ -0,0 +1,65 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef SERVICES_DEVICE_HID_HID_SERVICE_LINUX_H_
++#define SERVICES_DEVICE_HID_HID_SERVICE_LINUX_H_
++
++#include <memory>
++
++#include "base/compiler_specific.h"
++#include "base/files/scoped_file.h"
++#include "base/memory/weak_ptr.h"
++#include "base/task/sequenced_task_runner.h"
++#include "build/build_config.h"
++#include "build/chromeos_buildflags.h"
++#include "services/device/hid/hid_device_info.h"
++#include "services/device/hid/hid_service.h"
++
++namespace device {
++
++class HidServiceFido : public HidService {
++ public:
++ HidServiceFido();
++ HidServiceFido(HidServiceFido&) = delete;
++ HidServiceFido& operator=(HidServiceFido&) = delete;
++ ~HidServiceFido() override;
++
++ // HidService:
++ void Connect(const std::string& device_id,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback) override;
++ base::WeakPtr<HidService> GetWeakPtr() override;
++
++ private:
++ struct ConnectParams;
++ class BlockingTaskRunnerHelper;
++
++// These functions implement the process of locating, requesting access to and
++// opening a device. Because this operation crosses multiple threads these
++// functions are static and the necessary parameters are passed as a single
++// struct.
++#if BUILDFLAG(IS_CHROMEOS_ASH)
++ static void OnPathOpenComplete(std::unique_ptr<ConnectParams> params,
++ base::ScopedFD fd);
++ static void OnPathOpenError(const std::string& device_path,
++ ConnectCallback callback,
++ const std::string& error_name,
++ const std::string& error_message);
++#else
++ static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params);
++#endif
++ static void FinishOpen(std::unique_ptr<ConnectParams> params);
++
++ const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
++
++ // |helper_| lives on the sequence |blocking_task_runner_| posts to and holds
++ // a weak reference back to the service that owns it.
++ std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_;
++ base::WeakPtrFactory<HidServiceFido> weak_factory_{this};
++};
++
++} // namespace device
++
++#endif // SERVICES_DEVICE_HID_HID_SERVICE_LINUX_H_
diff --git a/electron34/patches/patch-services_device_hid_hid__service__freebsd.cc b/electron34/patches/patch-services_device_hid_hid__service__freebsd.cc
new file mode 100644
index 0000000000..446b562cc9
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__freebsd.cc
@@ -0,0 +1,404 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_freebsd.cc.orig 2025-05-24 17:57:53.567510357 +0000
++++ services/device/hid/hid_service_freebsd.cc
+@@ -0,0 +1,395 @@
++// Copyright 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/hid/hid_service_freebsd.h"
++
++#include <dev/usb/usb_ioctl.h>
++#include <stdint.h>
++#include <sys/socket.h>
++#include <sys/un.h>
++
++#include <set>
++#include <string>
++#include <vector>
++
++#include "base/files/file_descriptor_watcher_posix.h"
++#include "base/files/file_enumerator.h"
++#include "base/files/file_util.h"
++#include "base/files/file.h"
++#include "base/location.h"
++#include "base/logging.h"
++#include "base/posix/eintr_wrapper.h"
++#include "base/stl_util.h"
++#include "base/strings/pattern.h"
++#include "base/strings/stringprintf.h"
++#include "base/strings/sys_string_conversions.h"
++#include "base/strings/string_util.h"
++#include "base/strings/string_split.h"
++#include "base/task/single_thread_task_runner.h"
++#include "base/task/thread_pool.h"
++#include "base/threading/scoped_blocking_call.h"
++#include "base/threading/thread_restrictions.h"
++#include "components/device_event_log/device_event_log.h"
++#include "services/device/hid/hid_connection_freebsd.h"
++
++const int kMaxPermissionChecks = 5;
++
++namespace device {
++
++struct HidServiceFreeBSD::ConnectParams {
++ ConnectParams(scoped_refptr<HidDeviceInfo> device_info,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback)
++ : device_info(std::move(device_info)),
++ allow_protected_reports(allow_protected_reports),
++ allow_fido_reports(allow_fido_reports),
++ callback(std::move(callback)),
++ task_runner(base::SequencedTaskRunner::GetCurrentDefault()),
++ blocking_task_runner(
++ base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)) {}
++ ~ConnectParams() {}
++
++ scoped_refptr<HidDeviceInfo> device_info;
++ bool allow_protected_reports;
++ bool allow_fido_reports;
++ ConnectCallback callback;
++ scoped_refptr<base::SequencedTaskRunner> task_runner;
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner;
++ base::ScopedFD fd;
++};
++
++class HidServiceFreeBSD::BlockingTaskRunnerHelper {
++ public:
++ BlockingTaskRunnerHelper(base::WeakPtr<HidServiceFreeBSD> service)
++ : service_(std::move(service)),
++ task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
++ DETACH_FROM_SEQUENCE(sequence_checker_);
++
++ timer_.reset(new base::RepeatingTimer());
++ devd_buffer_ = new net::IOBufferWithSize(1024);
++ }
++
++ BlockingTaskRunnerHelper(const BlockingTaskRunnerHelper&) = delete;
++ BlockingTaskRunnerHelper& operator=(const BlockingTaskRunnerHelper&) = delete;
++
++ ~BlockingTaskRunnerHelper() {
++ }
++
++ void Start() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ const base::FilePath kDevRoot("/dev");
++ const std::string kUHIDPattern("/dev/uhid*");
++
++ base::FileEnumerator enumerator(kDevRoot, false, base::FileEnumerator::FILES);
++ do {
++ const base::FilePath next_device_path(enumerator.Next());
++ const std::string next_device = next_device_path.value();
++ if (next_device.empty())
++ break;
++
++ if (base::MatchPattern(next_device, kUHIDPattern))
++ OnDeviceAdded(next_device.substr(5));
++ } while (true);
++
++ SetupDevdMonitor();
++
++ task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&HidServiceFreeBSD::FirstEnumerationComplete, service_));
++ }
++
++ bool HaveReadWritePermissions(std::string device_id) {
++ std::string device_node = "/dev/" + device_id;
++ base::AssertBlockingAllowed();
++
++ base::FilePath device_path(device_node);
++ base::File device_file;
++ int flags =
++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE;
++ device_file.Initialize(device_path, flags);
++ if (!device_file.IsValid())
++ return false;
++
++ return true;
++ }
++
++ void OnDeviceAdded(std::string device_id) {
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ std::string device_node = "/dev/" + device_id;
++ uint16_t vendor_id = 0xffff;
++ uint16_t product_id = 0xffff;
++ std::string product_name = "";
++ std::string serial_number = "";
++
++ std::vector<uint8_t> report_descriptor;
++
++ base::AssertBlockingAllowed();
++
++ base::FilePath device_path(device_node);
++ base::File device_file;
++ int flags =
++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE;
++ device_file.Initialize(device_path, flags);
++ if (!device_file.IsValid()) {
++ HID_LOG(ERROR) << "Failed to open '" << device_node
++ << "': "
++ << base::File::ErrorToString(device_file.error_details());
++ return;
++ }
++
++ base::ScopedFD fd;
++ fd.reset(device_file.TakePlatformFile());
++
++ struct usb_gen_descriptor ugd;
++ ugd.ugd_data = NULL;
++ ugd.ugd_maxlen = 0xffff;
++ int result = HANDLE_EINTR(
++ ioctl(fd.get(), USB_GET_REPORT_DESC, &ugd));
++
++ if (result < 0) {
++ HID_LOG(ERROR) << "Failed to get report descriptor size";
++ return;
++ }
++
++ report_descriptor.resize(ugd.ugd_actlen);
++
++ ugd.ugd_data = report_descriptor.data();
++ ugd.ugd_maxlen = ugd.ugd_actlen;
++ result = HANDLE_EINTR(
++ ioctl(fd.get(), USB_GET_REPORT_DESC, &ugd));
++
++ if (result < 0) {
++ HID_LOG(ERROR) << "Failed to get report descriptor";
++ return;
++ }
++
++ scoped_refptr<HidDeviceInfo> device_info(new HidDeviceInfo(
++ device_id,
++ /*physical_device_id*/"",
++ vendor_id,
++ product_id,
++ product_name,
++ serial_number,
++ device::mojom::HidBusType::kHIDBusTypeUSB,
++ report_descriptor,
++ device_node));
++
++ task_runner_->PostTask(FROM_HERE, base::BindOnce(&HidServiceFreeBSD::AddDevice,
++ service_, device_info));
++ }
++
++ void OnDeviceRemoved(std::string device_id) {
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ task_runner_->PostTask(
++ FROM_HERE, base::BindOnce(&HidServiceFreeBSD::RemoveDevice, service_,
++ device_id));
++ }
++
++ private:
++
++ void CheckPendingPermissionChange() {
++ base::AssertBlockingAllowed();
++ std::map<std::string, int>::iterator it;
++ for (it = permissions_checks_attempts_.begin(); it != permissions_checks_attempts_.end();) {
++ std::string device_name = it->first;
++ bool keep = true;
++ if (HaveReadWritePermissions(device_name)) {
++ OnDeviceAdded(device_name);
++ keep = false;
++ }
++ else if (it->second-- <= 0) {
++ HID_LOG(ERROR) << "Still don't have write permissions to '" << device_name
++ << "' after " << kMaxPermissionChecks << " attempts";
++ keep = false;
++ }
++
++ if (keep)
++ ++it;
++ else
++ permissions_checks_attempts_.erase(it++);
++ }
++
++ if (permissions_checks_attempts_.empty())
++ timer_->Stop();
++ }
++
++ void SetupDevdMonitor() {
++ base::AssertBlockingAllowed();
++
++ int devd_fd = socket(AF_UNIX, SOCK_SEQPACKET, 0);
++ if (devd_fd < 0)
++ return;
++
++ struct sockaddr_un sa;
++
++ sa.sun_family = AF_UNIX;
++ strlcpy(sa.sun_path, "@VARBASE@/run/devd.seqpacket.pipe", sizeof(sa.sun_path));
++ if (connect(devd_fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
++ close(devd_fd);
++ return;
++ }
++
++ devd_fd_.reset(devd_fd);
++ file_watcher_ = base::FileDescriptorWatcher::WatchReadable(
++ devd_fd_.get(), base::BindRepeating(&BlockingTaskRunnerHelper::OnDevdMessageCanBeRead,
++ base::Unretained(this)));
++ }
++
++ void OnDevdMessageCanBeRead() {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ ssize_t bytes_read = HANDLE_EINTR(recv(devd_fd_.get(), devd_buffer_->data(),
++ devd_buffer_->size() - 1, MSG_WAITALL));
++ if (bytes_read < 0) {
++ if (errno != EAGAIN) {
++ HID_LOG(ERROR) << "Read failed";
++ file_watcher_.reset();
++ }
++ return;
++ }
++
++ devd_buffer_->data()[bytes_read] = 0;
++ char *data = devd_buffer_->data();
++ // It may take some time for devd to change permissions
++ // on /dev/uhidX node. So do not fail immediately if
++ // open fail. Retry each second for kMaxPermissionChecks
++ // times before giving up entirely
++ if (base::StartsWith(data, "+uhid", base::CompareCase::SENSITIVE)) {
++ std::vector<std::string> parts = base::SplitString(
++ data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
++ if (!parts.empty()) {
++ std::string device_name = parts[0].substr(1); // skip '+'
++ if (HaveReadWritePermissions(device_name))
++ OnDeviceAdded(parts[0].substr(1));
++ else {
++ // Do not re-add to checks
++ if (permissions_checks_attempts_.find(device_name) == permissions_checks_attempts_.end()) {
++ permissions_checks_attempts_.insert(std::pair<std::string, int>(device_name, kMaxPermissionChecks));
++ timer_->Start(FROM_HERE, base::Seconds(1),
++ this, &BlockingTaskRunnerHelper::CheckPendingPermissionChange);
++ }
++ }
++ }
++ }
++
++ if (base::StartsWith(data, "-uhid", base::CompareCase::SENSITIVE)) {
++ std::vector<std::string> parts = base::SplitString(
++ data, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
++ if (!parts.empty()) {
++ std::string device_name = parts[0].substr(1); // skip '-'
++ auto it = permissions_checks_attempts_.find(device_name);
++ if (it != permissions_checks_attempts_.end()) {
++ permissions_checks_attempts_.erase(it);
++ if (permissions_checks_attempts_.empty())
++ timer_->Stop();
++ }
++ OnDeviceRemoved(parts[0].substr(1));
++ }
++ }
++ }
++
++ SEQUENCE_CHECKER(sequence_checker_);
++
++ // This weak pointer is only valid when checked on this task runner.
++ base::WeakPtr<HidServiceFreeBSD> service_;
++ scoped_refptr<base::SequencedTaskRunner> task_runner_;
++ std::unique_ptr<base::FileDescriptorWatcher::Controller> file_watcher_;
++ std::unique_ptr<base::RepeatingTimer> timer_;
++ base::ScopedFD devd_fd_;
++ scoped_refptr<net::IOBufferWithSize> devd_buffer_;
++ std::map<std::string, int> permissions_checks_attempts_;
++};
++
++HidServiceFreeBSD::HidServiceFreeBSD()
++ : blocking_task_runner_(
++ base::ThreadPool::CreateSequencedTaskRunner(kBlockingTaskTraits)),
++ helper_(nullptr, base::OnTaskRunnerDeleter(blocking_task_runner_)) {
++ helper_.reset(new BlockingTaskRunnerHelper(weak_factory_.GetWeakPtr()));
++ blocking_task_runner_->PostTask(
++ FROM_HERE,
++ base::BindOnce(&BlockingTaskRunnerHelper::Start, base::Unretained(helper_.get())));
++}
++
++HidServiceFreeBSD::~HidServiceFreeBSD() {
++ blocking_task_runner_->DeleteSoon(FROM_HERE, helper_.release());
++}
++
++base::WeakPtr<HidService> HidServiceFreeBSD::GetWeakPtr() {
++ return weak_factory_.GetWeakPtr();
++}
++
++// static
++void HidServiceFreeBSD::OpenOnBlockingThread(
++ std::unique_ptr<ConnectParams> params) {
++ base::ScopedBlockingCall scoped_blocking_call(
++ FROM_HERE, base::BlockingType::MAY_BLOCK);
++ scoped_refptr<base::SequencedTaskRunner> task_runner = params->task_runner;
++
++ base::FilePath device_path(params->device_info->device_node());
++ base::File device_file;
++ int flags =
++ base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE;
++ device_file.Initialize(device_path, flags);
++ if (!device_file.IsValid()) {
++ HID_LOG(EVENT) << "Failed to open '" << params->device_info->device_node()
++ << "': "
++ << base::File::ErrorToString(device_file.error_details());
++ task_runner->PostTask(FROM_HERE,
++ base::BindOnce(std::move(params->callback), nullptr));
++ return;
++ }
++ params->fd.reset(device_file.TakePlatformFile());
++ task_runner->PostTask(FROM_HERE, base::BindOnce(&HidServiceFreeBSD::FinishOpen,
++ std::move(params)));
++}
++
++void HidServiceFreeBSD::Connect(const std::string& device_guid,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback) {
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++
++ const auto& map_entry = devices().find(device_guid);
++ if (map_entry == devices().end()) {
++ base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
++ FROM_HERE, base::BindOnce(std::move(callback), nullptr));
++ return;
++ }
++
++ scoped_refptr<HidDeviceInfo> device_info = map_entry->second;
++
++ auto params = std::make_unique<ConnectParams>(device_info,
++ allow_protected_reports,
++ allow_fido_reports,
++ std::move(callback));
++ scoped_refptr<base::SequencedTaskRunner> blocking_task_runner =
++ params->blocking_task_runner;
++
++ blocking_task_runner->PostTask(
++ FROM_HERE, base::BindOnce(&HidServiceFreeBSD::OpenOnBlockingThread,
++ std::move(params)));
++}
++
++// static
++void HidServiceFreeBSD::FinishOpen(std::unique_ptr<ConnectParams> params) {
++ DCHECK(params->fd.is_valid());
++
++ if (!base::SetNonBlocking(params->fd.get())) {
++ HID_PLOG(ERROR) << "Failed to set the non-blocking flag on the device fd";
++ std::move(params->callback).Run(nullptr);
++ }
++
++ std::move(params->callback).Run(base::MakeRefCounted<HidConnectionFreeBSD>(
++ std::move(params->device_info),
++ std::move(params->fd),
++ std::move(params->blocking_task_runner),
++ params->allow_protected_reports,
++ params->allow_fido_reports
++ ));
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_hid_hid__service__freebsd.h b/electron34/patches/patch-services_device_hid_hid__service__freebsd.h
new file mode 100644
index 0000000000..0526bd5ac3
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__freebsd.h
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_freebsd.h.orig 2025-05-24 17:57:53.567665877 +0000
++++ services/device/hid/hid_service_freebsd.h
+@@ -0,0 +1,49 @@
++// Copyright 2014 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef DEVICE_HID_HID_SERVICE_FREEBSD_H_
++#define DEVICE_HID_HID_SERVICE_FREEBSD_H_
++
++#include <string>
++
++#include "base/memory/ref_counted.h"
++#include "base/memory/weak_ptr.h"
++#include "base/timer/timer.h"
++#include "services/device/hid/hid_service.h"
++#include "net/base/io_buffer.h"
++
++namespace device {
++
++class HidServiceFreeBSD : public HidService {
++ public:
++ HidServiceFreeBSD();
++
++ HidServiceFreeBSD(const HidServiceFreeBSD&) = delete;
++ HidServiceFreeBSD& operator=(const HidServiceFreeBSD&) = delete;
++
++ ~HidServiceFreeBSD() override;
++
++ void Connect(const std::string& device_guid,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback connect) override;
++ base::WeakPtr<HidService> GetWeakPtr() override;
++
++ private:
++ struct ConnectParams;
++ class BlockingTaskRunnerHelper;
++
++ static void OpenOnBlockingThread(std::unique_ptr<ConnectParams> params);
++ static void FinishOpen(std::unique_ptr<ConnectParams> params);
++
++ const scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
++ // |helper_| lives on the sequence |blocking_task_runner_| posts to and holds
++ // a weak reference back to the service that owns it.
++ std::unique_ptr<BlockingTaskRunnerHelper, base::OnTaskRunnerDeleter> helper_;
++ base::WeakPtrFactory<HidServiceFreeBSD> weak_factory_{this};
++};
++
++} // namespace device
++
++#endif // DEVICE_HID_HID_SERVICE_FREEBSD_H_
diff --git a/electron34/patches/patch-services_device_hid_hid__service__netbsd.cc b/electron34/patches/patch-services_device_hid_hid__service__netbsd.cc
new file mode 100644
index 0000000000..e0eb00ce69
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__netbsd.cc
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_netbsd.cc.orig 2025-05-24 17:57:53.567797330 +0000
++++ services/device/hid/hid_service_netbsd.cc
+@@ -0,0 +1,27 @@
++// Copyright 2022 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/hid/hid_service_netbsd.h"
++
++#include "base/notreached.h"
++#include "services/device/hid/hid_connection.h"
++
++namespace device {
++
++HidServiceNetBSD::HidServiceNetBSD() = default;
++HidServiceNetBSD::~HidServiceNetBSD() = default;
++
++void HidServiceNetBSD::Connect(const std::string& device_id,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback) {
++ NOTIMPLEMENTED_LOG_ONCE();
++ std::move(callback).Run(nullptr);
++}
++
++base::WeakPtr<HidService> HidServiceNetBSD::GetWeakPtr() {
++ return weak_factory_.GetWeakPtr();
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_hid_hid__service__netbsd.h b/electron34/patches/patch-services_device_hid_hid__service__netbsd.h
new file mode 100644
index 0000000000..efa1f7d09a
--- /dev/null
+++ b/electron34/patches/patch-services_device_hid_hid__service__netbsd.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/hid/hid_service_netbsd.h.orig 2025-05-24 17:57:53.567919015 +0000
++++ services/device/hid/hid_service_netbsd.h
+@@ -0,0 +1,33 @@
++// Copyright 2022 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef SERVICES_DEVICE_HID_HID_SERVICE_NETBSD_H_
++#define SERVICES_DEVICE_HID_HID_SERVICE_NETBSD_H_
++
++#include "services/device/hid/hid_service.h"
++
++namespace device {
++
++class HidServiceNetBSD : public HidService {
++ public:
++ HidServiceNetBSD();
++ ~HidServiceNetBSD() override;
++
++ HidServiceNetBSD(const HidServiceNetBSD&) = delete;
++ HidServiceNetBSD& operator=(const HidServiceNetBSD&) = delete;
++
++ private:
++ // HidService implementation.
++ void Connect(const std::string& device_id,
++ bool allow_protected_reports,
++ bool allow_fido_reports,
++ ConnectCallback callback) override;
++ base::WeakPtr<HidService> GetWeakPtr() override;
++
++ base::WeakPtrFactory<HidServiceNetBSD> weak_factory_{this};
++};
++
++} // namespace device
++
++#endif // SERVICES_DEVICE_HID_HID_SERVICE_NETBSD_H_
diff --git a/electron34/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h b/electron34/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h
new file mode 100644
index 0000000000..64e5fdb748
--- /dev/null
+++ b/electron34/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/public/cpp/generic_sensor/sensor_reading.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/public/cpp/generic_sensor/sensor_reading.h
+@@ -8,6 +8,8 @@
+ #include <stddef.h>
+ #include <stdint.h>
+
++#include <cstdint>
++
+ #include <type_traits>
+
+ namespace device {
diff --git a/electron34/patches/patch-services_device_public_mojom_BUILD.gn b/electron34/patches/patch-services_device_public_mojom_BUILD.gn
new file mode 100644
index 0000000000..a45b60edfa
--- /dev/null
+++ b/electron34/patches/patch-services_device_public_mojom_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/public/mojom/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/public/mojom/BUILD.gn
+@@ -98,7 +98,7 @@ mojom("device_service") {
+ enable_js_fuzzing = false
+
+ enabled_features = []
+- if ((is_linux || is_chromeos) && use_udev) {
++ if ((is_linux || is_chromeos) && !is_bsd && use_udev) {
+ enabled_features += [ "enable_input_device_manager" ]
+ }
+
diff --git a/electron34/patches/patch-services_device_serial_BUILD.gn b/electron34/patches/patch-services_device_serial_BUILD.gn
new file mode 100644
index 0000000000..a095f2c155
--- /dev/null
+++ b/electron34/patches/patch-services_device_serial_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/serial/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/serial/BUILD.gn
+@@ -5,7 +5,7 @@
+ import("//build/config/chromeos/ui_mode.gni")
+ import("//build/config/features.gni")
+
+-if (is_win || ((is_linux || is_chromeos) && use_udev) || is_mac) {
++if (is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac) {
+ config("platform_support") {
+ visibility = [ ":serial" ]
+ if (is_win) {
diff --git a/electron34/patches/patch-services_device_serial_serial__device__enumerator.cc b/electron34/patches/patch-services_device_serial_serial__device__enumerator.cc
new file mode 100644
index 0000000000..20da17d344
--- /dev/null
+++ b/electron34/patches/patch-services_device_serial_serial__device__enumerator.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/serial/serial_device_enumerator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/serial/serial_device_enumerator.cc
+@@ -13,7 +13,7 @@
+ #include "build/build_config.h"
+ #include "components/device_event_log/device_event_log.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "services/device/serial/serial_device_enumerator_linux.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "services/device/serial/serial_device_enumerator_mac.h"
+@@ -26,7 +26,7 @@ namespace device {
+ // static
+ std::unique_ptr<SerialDeviceEnumerator> SerialDeviceEnumerator::Create(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return SerialDeviceEnumeratorLinux::Create();
+ #elif BUILDFLAG(IS_MAC)
+ return std::make_unique<SerialDeviceEnumeratorMac>();
diff --git a/electron34/patches/patch-services_device_serial_serial__io__handler__posix.cc b/electron34/patches/patch-services_device_serial_serial__io__handler__posix.cc
new file mode 100644
index 0000000000..4e8efaf3b8
--- /dev/null
+++ b/electron34/patches/patch-services_device_serial_serial__io__handler__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/serial/serial_io_handler_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/serial/serial_io_handler_posix.cc
+@@ -73,7 +73,7 @@ bool BitrateToSpeedConstant(int bitrate,
+ BITRATE_TO_SPEED_CASE(9600)
+ BITRATE_TO_SPEED_CASE(19200)
+ BITRATE_TO_SPEED_CASE(38400)
+-#if !BUILDFLAG(IS_MAC)
++#if !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ BITRATE_TO_SPEED_CASE(57600)
+ BITRATE_TO_SPEED_CASE(115200)
+ BITRATE_TO_SPEED_CASE(230400)
diff --git a/electron34/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc b/electron34/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc
new file mode 100644
index 0000000000..6aa89b9c08
--- /dev/null
+++ b/electron34/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/time_zone_monitor/time_zone_monitor_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/time_zone_monitor/time_zone_monitor_linux.cc
+@@ -136,7 +136,11 @@ class TimeZoneMonitorLinuxImpl
+ // false positives are harmless, assuming the false positive rate is
+ // reasonable.
+ const char* const kFilesToWatch[] = {
++#if BUILDFLAG(IS_BSD)
++ "@PKG_SYSCONFBASE@/localtime",
++#else
+ "/etc/localtime", "/etc/timezone", "/etc/TZ",
++#endif
+ };
+ for (size_t index = 0; index < std::size(kFilesToWatch); ++index) {
+ file_path_watchers_.push_back(std::make_unique<base::FilePathWatcher>());
diff --git a/electron34/patches/patch-services_device_usb_BUILD.gn b/electron34/patches/patch-services_device_usb_BUILD.gn
new file mode 100644
index 0000000000..d6f84e9b45
--- /dev/null
+++ b/electron34/patches/patch-services_device_usb_BUILD.gn
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/usb/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/usb/BUILD.gn
+@@ -91,7 +91,7 @@ static_library("usb") {
+ deps += [ "//third_party/re2" ]
+ }
+
+- if (is_mac) {
++ if (is_mac || is_openbsd) {
+ # These sources and deps are required for libusb.
+ # TODO(crbug.com/40136337) Remove these sources.
+ sources += [
+@@ -114,6 +114,13 @@ static_library("usb") {
+ deps += [ "//third_party/libusb" ]
+ }
+
++ if (is_freebsd || is_netbsd) {
++ sources += [
++ "usb_service_fake.cc",
++ "usb_service_fake.h",
++ ]
++ }
++
+ if (is_linux || is_chromeos) {
+ sources += [
+ "usb_device_linux.cc",
+@@ -135,7 +142,7 @@ static_library("usb") {
+ deps += [ "//device/udev_linux" ]
+ }
+
+- if (is_android || is_chromeos || is_linux) {
++ if (is_android || is_chromeos || is_linux && !is_bsd) {
+ sources += [
+ "usb_device_handle_usbfs.cc",
+ "usb_device_handle_usbfs.h",
diff --git a/electron34/patches/patch-services_device_usb_usb__service.cc b/electron34/patches/patch-services_device_usb_usb__service.cc
new file mode 100644
index 0000000000..a0c279fb1c
--- /dev/null
+++ b/electron34/patches/patch-services_device_usb_usb__service.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/usb/usb_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/usb/usb_service.cc
+@@ -21,12 +21,16 @@
+
+ #if BUILDFLAG(IS_ANDROID)
+ #include "services/device/usb/usb_service_android.h"
+-#elif defined(USE_UDEV)
++#elif defined(USE_UDEV) && !BUILDFLAG(IS_BSD)
+ #include "services/device/usb/usb_service_linux.h"
+ #elif BUILDFLAG(IS_MAC)
+ #include "services/device/usb/usb_service_impl.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "services/device/usb/usb_service_win.h"
++#elif BUILDFLAG(IS_OPENBSD)
++#include "services/device/usb/usb_service_impl.h"
++#elif BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
++#include "services/device/usb/usb_service_fake.h"
+ #endif
+
+ namespace device {
+@@ -49,12 +53,14 @@ constexpr base::TaskTraits UsbService::k
+ std::unique_ptr<UsbService> UsbService::Create() {
+ #if BUILDFLAG(IS_ANDROID)
+ return base::WrapUnique(new UsbServiceAndroid());
+-#elif defined(USE_UDEV)
++#elif defined(USE_UDEV) && !BUILDFLAG(IS_BSD)
+ return base::WrapUnique(new UsbServiceLinux());
+ #elif BUILDFLAG(IS_WIN)
+ return base::WrapUnique(new UsbServiceWin());
+ #elif BUILDFLAG(IS_MAC)
+ return base::WrapUnique(new UsbServiceImpl());
++#elif BUILDFLAG(IS_BSD)
++ return base::WrapUnique(new UsbServiceImpl());
+ #else
+ return nullptr;
+ #endif
diff --git a/electron34/patches/patch-services_device_usb_usb__service__fake.cc b/electron34/patches/patch-services_device_usb_usb__service__fake.cc
new file mode 100644
index 0000000000..8349a86b4b
--- /dev/null
+++ b/electron34/patches/patch-services_device_usb_usb__service__fake.cc
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/usb/usb_service_fake.cc.orig 2025-05-24 17:57:53.569031167 +0000
++++ services/device/usb/usb_service_fake.cc
+@@ -0,0 +1,49 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/device/usb/usb_service_fake.h"
++
++#include <stdint.h>
++
++#include <list>
++#include <memory>
++#include <set>
++#include <utility>
++
++#include "base/barrier_closure.h"
++#include "base/containers/contains.h"
++#include "base/location.h"
++#include "base/memory/ref_counted_memory.h"
++#include "base/memory/weak_ptr.h"
++#include "base/strings/string_number_conversions.h"
++#include "base/strings/utf_string_conversions.h"
++#include "base/task/sequenced_task_runner.h"
++#include "base/task/single_thread_task_runner.h"
++#include "base/task/thread_pool.h"
++#include "base/threading/scoped_blocking_call.h"
++#include "build/build_config.h"
++#include "components/device_event_log/device_event_log.h"
++#include "services/device/usb/usb_device_handle.h"
++#include "services/device/usb/usb_error.h"
++#include "services/device/usb/webusb_descriptors.h"
++
++namespace device {
++
++UsbServiceImpl::UsbServiceImpl()
++ : task_runner_(base::SequencedTaskRunner::GetCurrentDefault()) {
++ NOTIMPLEMENTED();
++}
++
++UsbServiceImpl::~UsbServiceImpl() {
++ NOTIMPLEMENTED();
++ NotifyWillDestroyUsbService();
++}
++
++void UsbServiceImpl::GetDevices(GetDevicesCallback callback) {
++ NOTIMPLEMENTED();
++ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++ UsbService::GetDevices(std::move(callback));
++}
++
++} // namespace device
diff --git a/electron34/patches/patch-services_device_usb_usb__service__fake.h b/electron34/patches/patch-services_device_usb_usb__service__fake.h
new file mode 100644
index 0000000000..26f1685b92
--- /dev/null
+++ b/electron34/patches/patch-services_device_usb_usb__service__fake.h
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/usb/usb_service_fake.h.orig 2025-05-24 17:57:53.569163442 +0000
++++ services/device/usb/usb_service_fake.h
+@@ -0,0 +1,48 @@
++// Copyright 2015 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
++#define SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
++
++#include "services/device/usb/usb_service.h"
++
++#include <stddef.h>
++
++#include <map>
++#include <set>
++#include <string>
++#include <vector>
++
++#include "base/containers/queue.h"
++#include "base/memory/weak_ptr.h"
++#include "build/build_config.h"
++#include "services/device/usb/usb_context.h"
++#include "services/device/usb/usb_device_impl.h"
++#include "third_party/abseil-cpp/absl/types/optional.h"
++
++namespace device {
++
++class UsbDeviceImpl;
++
++class UsbServiceImpl final : public UsbService {
++ public:
++ UsbServiceImpl();
++
++ UsbServiceImpl(const UsbServiceImpl&) = delete;
++ UsbServiceImpl& operator=(const UsbServiceImpl&) = delete;
++
++ ~UsbServiceImpl() override;
++
++ private:
++ // device::UsbService implementation
++ void GetDevices(GetDevicesCallback callback) override;
++
++ void OnUsbContext(scoped_refptr<UsbContext> context);
++
++ scoped_refptr<base::SequencedTaskRunner> task_runner_;
++};
++
++} // namespace device
++
++#endif // SERVICES_DEVICE_USB_USB_SERVICE_IMPL_H_
diff --git a/electron34/patches/patch-services_device_usb_usb__service__impl.cc b/electron34/patches/patch-services_device_usb_usb__service__impl.cc
new file mode 100644
index 0000000000..c73aec1443
--- /dev/null
+++ b/electron34/patches/patch-services_device_usb_usb__service__impl.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/device/usb/usb_service_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/device/usb/usb_service_impl.cc
+@@ -203,7 +203,7 @@ void UsbServiceImpl::GetDevices(GetDevic
+ return;
+ }
+
+- if (enumeration_in_progress_) {
++ if (enumeration_in_progress_ || !enumeration_ready_) {
+ pending_enumeration_callbacks_.push_back(std::move(callback));
+ return;
+ }
diff --git a/electron34/patches/patch-services_network_BUILD.gn b/electron34/patches/patch-services_network_BUILD.gn
new file mode 100644
index 0000000000..5f46f310d9
--- /dev/null
+++ b/electron34/patches/patch-services_network_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/BUILD.gn
+@@ -401,7 +401,6 @@ if (is_linux || is_chromeos) {
+ ]
+ deps = [
+ "//base:base",
+- "//sandbox/linux:sandbox_services",
+ "//sandbox/policy:policy",
+ ]
+ configs += [ "//build/config/compiler:wexit_time_destructors" ]
diff --git a/electron34/patches/patch-services_network_network__context.cc b/electron34/patches/patch-services_network_network__context.cc
new file mode 100644
index 0000000000..4edfba6b36
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__context.cc
@@ -0,0 +1,176 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_context.cc
+@@ -158,6 +158,11 @@
+ #include "services/network/web_transport.h"
+ #include "url/gurl.h"
+
++// Electron
++#include "net/cert/caching_cert_verifier.h"
++#include "net/cert/cert_verify_proc.h"
++#include "net/cert/multi_threaded_cert_verifier.h"
++
+ #if BUILDFLAG(IS_CT_SUPPORTED)
+ // gn check does not account for BUILDFLAG(). So, for iOS builds, it will
+ // complain about a missing dependency on the target exposing this header. Add a
+@@ -606,6 +611,99 @@ void RecordHSTSPreconnectUpgradeReason(H
+
+ } // namespace
+
++class RemoteCertVerifier : public net::CertVerifier {
++ public:
++ class Request : public net::CertVerifier::Request {
++ public:
++ Request() {}
++ ~Request() override = default;
++ void OnRemoteResponse(
++ const RequestParams& params,
++ net::CertVerifyResult* verify_result,
++ int error_from_upstream,
++ net::CompletionOnceCallback callback,
++ int error_from_client,
++ const net::CertVerifyResult& verify_result_from_client) {
++ if (error_from_client == net::ERR_ABORTED) {
++ // use the default
++ std::move(callback).Run(error_from_upstream);
++ } else {
++ // use the override
++ verify_result->Reset();
++ verify_result->verified_cert = verify_result_from_client.verified_cert;
++ std::move(callback).Run(error_from_client);
++ }
++ }
++ base::WeakPtr<Request> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
++ private:
++ base::WeakPtrFactory<Request> weak_factory_{this};
++ };
++
++ RemoteCertVerifier(std::unique_ptr<net::CertVerifier> upstream): upstream_(std::move(upstream)) {
++ }
++ ~RemoteCertVerifier() override = default;
++
++ void Bind(
++ mojo::PendingRemote<mojom::CertVerifierClient> client_info) {
++ client_.reset();
++ if (client_info.is_valid()) {
++ client_.Bind(std::move(client_info));
++ }
++ }
++
++ // CertVerifier implementation
++ int Verify(const RequestParams& params,
++ net::CertVerifyResult* verify_result,
++ net::CompletionOnceCallback callback,
++ std::unique_ptr<CertVerifier::Request>* out_req,
++ const net::NetLogWithSource& net_log) override {
++ out_req->reset();
++
++ net::CompletionOnceCallback callback2 = base::BindOnce(
++ &RemoteCertVerifier::OnRequestFinished, base::Unretained(this),
++ params, std::move(callback), verify_result, out_req);
++ return upstream_->Verify(params, verify_result, std::move(callback2), out_req, net_log);
++ }
++
++
++ void SetConfig(const Config& config) override {
++ upstream_->SetConfig(config);
++ }
++
++ void AddObserver(CertVerifier::Observer* observer) override {
++ upstream_->AddObserver(observer);
++ }
++
++ void RemoveObserver(CertVerifier::Observer* observer) override {
++ upstream_->RemoveObserver(observer);
++ }
++
++ void OnRequestFinished(const RequestParams& params,
++ net::CompletionOnceCallback callback,
++ net::CertVerifyResult* verify_result,
++ std::unique_ptr<CertVerifier::Request>* out_req,
++ int error) {
++ if (client_.is_bound()) {
++ // We take a weak pointer to the request because deletion of the request
++ // is what signals cancellation. Thus if the request is cancelled, the
++ // callback won't be called, thus avoiding UAF, because |verify_result|
++ // is freed when the request is cancelled.
++ *out_req = std::make_unique<Request>();
++ base::WeakPtr<Request> weak_req = static_cast<Request*>(out_req->get())->GetWeakPtr();
++ client_->Verify(error, *verify_result, params.certificate(),
++ params.hostname(), params.flags(), params.ocsp_response(),
++ base::BindOnce(&Request::OnRemoteResponse,
++ weak_req, params, verify_result, error, std::move(callback)));
++ } else {
++ std::move(callback).Run(error);
++ }
++ }
++
++ private:
++ std::unique_ptr<net::CertVerifier> upstream_;
++ mojo::Remote<mojom::CertVerifierClient> client_;
++};
++
+ constexpr uint32_t NetworkContext::kMaxOutstandingRequestsPerProcess;
+
+ NetworkContext::NetworkContextHttpAuthPreferences::
+@@ -615,7 +713,7 @@ NetworkContext::NetworkContextHttpAuthPr
+ NetworkContext::NetworkContextHttpAuthPreferences::
+ ~NetworkContextHttpAuthPreferences() = default;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool NetworkContext::NetworkContextHttpAuthPreferences::AllowGssapiLibraryLoad()
+ const {
+ if (network_service_) {
+@@ -1003,6 +1101,13 @@ void NetworkContext::SetClient(
+ client_.Bind(std::move(client));
+ }
+
++void NetworkContext::SetCertVerifierClient(
++ mojo::PendingRemote<mojom::CertVerifierClient> client) {
++ if (remote_cert_verifier_) {
++ remote_cert_verifier_->Bind(std::move(client));
++ }
++}
++
+ void NetworkContext::CreateURLLoaderFactory(
+ mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
+ mojom::URLLoaderFactoryParamsPtr params) {
+@@ -1691,6 +1796,13 @@ void NetworkContext::SetNetworkCondition
+ std::move(network_conditions));
+ }
+
++void NetworkContext::SetUserAgent(const std::string& new_user_agent) {
++ // This may only be called on NetworkContexts created with a constructor that
++ // calls ApplyContextParamsToBuilder.
++ DCHECK(user_agent_settings_);
++ user_agent_settings_->set_user_agent(new_user_agent);
++}
++
+ void NetworkContext::SetAcceptLanguage(const std::string& new_accept_language) {
+ // This may only be called on NetworkContexts created with the constructor
+ // that calls MakeURLRequestContext().
+@@ -2499,7 +2611,7 @@ void NetworkContext::OnHttpAuthDynamicPa
+ http_auth_dynamic_network_service_params->android_negotiate_account_type);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ http_auth_merged_preferences_.set_allow_gssapi_library_load(
+ http_auth_dynamic_network_service_params->allow_gssapi_library_load);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+@@ -2572,6 +2684,9 @@ URLRequestContextOwner NetworkContext::M
+ std::move(cert_verifier));
+ cert_verifier = std::move(cert_verifier_with_trust_anchors);
+ #endif // BUILDFLAG(IS_CHROMEOS)
++ auto remote_cert_verifier = std::make_unique<RemoteCertVerifier>(std::move(cert_verifier));
++ remote_cert_verifier_ = remote_cert_verifier.get();
++ cert_verifier = std::make_unique<net::CachingCertVerifier>(std::move(remote_cert_verifier));
+ }
+
+ builder.SetCertVerifier(IgnoreErrorsCertVerifier::MaybeWrapCertVerifier(
diff --git a/electron34/patches/patch-services_network_network__context.h b/electron34/patches/patch-services_network_network__context.h
new file mode 100644
index 0000000000..d50b5d898e
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__context.h
@@ -0,0 +1,51 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_context.h
+@@ -114,6 +114,7 @@ class URLMatcher;
+ }
+
+ namespace network {
++class RemoteCertVerifier;
+ class CookieManager;
+ class HostResolver;
+ class MdnsResponderManager;
+@@ -245,6 +246,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ void CreateURLLoaderFactory(
+ mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
+ mojom::URLLoaderFactoryParamsPtr params) override;
++ void SetCertVerifierClient(
++ mojo::PendingRemote<mojom::CertVerifierClient> client) override;
+ void ResetURLLoaderFactories() override;
+ void GetViaObliviousHttp(
+ mojom::ObliviousHttpRequestPtr request,
+@@ -313,6 +316,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ void CloseIdleConnections(CloseIdleConnectionsCallback callback) override;
+ void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
+ mojom::NetworkConditionsPtr conditions) override;
++ void SetUserAgent(const std::string& new_user_agent) override;
+ void SetAcceptLanguage(const std::string& new_accept_language) override;
+ void SetEnableReferrers(bool enable_referrers) override;
+ #if BUILDFLAG(IS_CT_SUPPORTED)
+@@ -698,7 +702,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ public:
+ explicit NetworkContextHttpAuthPreferences(NetworkService* network_service);
+ ~NetworkContextHttpAuthPreferences() override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool AllowGssapiLibraryLoad() const override;
+ #endif // BUILDFLAG(IS_LINUX)
+ private:
+@@ -932,6 +936,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ std::vector<base::OnceClosure> dismount_closures_;
+ #endif // BUILDFLAG(IS_DIRECTORY_TRANSFER_REQUIRED)
+
++ raw_ptr<RemoteCertVerifier> remote_cert_verifier_ = nullptr;
++
+ // Created on-demand. Null if unused.
+ std::unique_ptr<HostResolver> internal_host_resolver_;
+ std::set<std::unique_ptr<HostResolver>, base::UniquePtrComparator>
diff --git a/electron34/patches/patch-services_network_network__sandbox__hook__linux.cc b/electron34/patches/patch-services_network_network__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..993b5086b2
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__sandbox__hook__linux.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_sandbox_hook_linux.cc
+@@ -15,11 +15,14 @@
+ #include "sandbox/linux/syscall_broker/broker_file_permission.h"
+ #include "sandbox/policy/features.h"
+
++#if !BUILDFLAG(IS_BSD)
+ using sandbox::syscall_broker::BrokerFilePermission;
+ using sandbox::syscall_broker::MakeBrokerCommandSet;
++#endif
+
+ namespace network {
+
++#if !BUILDFLAG(IS_BSD)
+ sandbox::syscall_broker::BrokerCommandSet GetNetworkBrokerCommandSet() {
+ return MakeBrokerCommandSet({
+ sandbox::syscall_broker::COMMAND_ACCESS,
+@@ -103,9 +106,11 @@ void LoadNetworkLibraries() {
+ }
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS)
++#endif
+
+ bool NetworkPreSandboxHook(std::vector<std::string> network_context_parent_dirs,
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_CHROMEOS)
+ LoadNetworkLibraries();
+ #endif
+@@ -118,6 +123,7 @@ bool NetworkPreSandboxHook(std::vector<s
+ GetNetworkBrokerCommandSet(),
+ GetNetworkFilePermissions(std::move(network_context_parent_dirs)),
+ options);
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-services_network_network__sandbox__hook__linux.h b/electron34/patches/patch-services_network_network__sandbox__hook__linux.h
new file mode 100644
index 0000000000..468e1c7e44
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__sandbox__hook__linux.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_sandbox_hook_linux.h
+@@ -6,7 +6,11 @@
+ #define SERVICES_NETWORK_NETWORK_SANDBOX_HOOK_LINUX_H_
+
+ #include "base/component_export.h"
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace network {
+
diff --git a/electron34/patches/patch-services_network_network__service.cc b/electron34/patches/patch-services_network_network__service.cc
new file mode 100644
index 0000000000..7071112284
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__service.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_service.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_service.cc
+@@ -99,7 +99,7 @@
+ #include "third_party/boringssl/src/include/openssl/cpu.h"
+ #endif
+
+-#if (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || \
++#if ((BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)) || BUILDFLAG(IS_BSD)) || \
+ BUILDFLAG(IS_CHROMEOS_LACROS)
+
+ #include "components/os_crypt/sync/key_storage_config_linux.h"
+@@ -977,7 +977,7 @@ void NetworkService::SetExplicitlyAllowe
+ net::SetExplicitlyAllowedPorts(ports);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NetworkService::SetGssapiLibraryLoadObserver(
+ mojo::PendingRemote<mojom::GssapiLibraryLoadObserver>
+ gssapi_library_load_observer) {
+@@ -1059,7 +1059,7 @@ NetworkService::CreateHttpAuthHandlerFac
+ );
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NetworkService::OnBeforeGssapiLibraryLoad() {
+ if (gssapi_library_load_observer_.is_bound()) {
+ gssapi_library_load_observer_->OnBeforeGssapiLibraryLoad();
diff --git a/electron34/patches/patch-services_network_network__service.h b/electron34/patches/patch-services_network_network__service.h
new file mode 100644
index 0000000000..1bd6361683
--- /dev/null
+++ b/electron34/patches/patch-services_network_network__service.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/network_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/network_service.h
+@@ -238,7 +238,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ const std::vector<ContentSettingPatternSource>& settings) override;
+
+ void SetExplicitlyAllowedPorts(const std::vector<uint16_t>& ports) override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void SetGssapiLibraryLoadObserver(
+ mojo::PendingRemote<mojom::GssapiLibraryLoadObserver>
+ gssapi_library_load_observer) override;
+@@ -264,7 +264,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ std::unique_ptr<net::HttpAuthHandlerFactory> CreateHttpAuthHandlerFactory(
+ NetworkContext* network_context);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This is called just before a GSSAPI library may be loaded.
+ void OnBeforeGssapiLibraryLoad();
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -498,7 +498,7 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ // leaking stale listeners between tests.
+ std::unique_ptr<net::NetworkChangeNotifier> mock_network_change_notifier_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ mojo::Remote<mojom::GssapiLibraryLoadObserver> gssapi_library_load_observer_;
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/electron34/patches/patch-services_network_public_cpp_BUILD.gn b/electron34/patches/patch-services_network_public_cpp_BUILD.gn
new file mode 100644
index 0000000000..b5f3f61eeb
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_BUILD.gn
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/BUILD.gn
+@@ -504,7 +504,7 @@ component("cpp_base") {
+ sources += [ "transferable_directory_fuchsia.cc" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ sources += [
+ "network_interface_change_listener_mojom_traits.cc",
+ "network_interface_change_listener_mojom_traits.h",
+@@ -615,7 +615,7 @@ source_set("tests") {
+ "x_frame_options_parser_unittest.cc",
+ ]
+
+- if (is_linux) {
++ if ((is_linux) && !is_bsd) {
+ sources += [ "network_interface_change_listener_mojom_traits_unittest.cc" ]
+ }
+
diff --git a/electron34/patches/patch-services_network_public_cpp_features.cc b/electron34/patches/patch-services_network_public_cpp_features.cc
new file mode 100644
index 0000000000..b165030b37
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_features.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/features.cc
+@@ -126,7 +126,7 @@ BASE_FEATURE(kSplitAuthCacheByNetworkIso
+ BASE_FEATURE(kDnsOverHttpsUpgrade,
+ "DnsOverHttpsUpgrade",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-services_network_public_cpp_resource__request.cc b/electron34/patches/patch-services_network_public_cpp_resource__request.cc
new file mode 100644
index 0000000000..a3ad69854f
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_resource__request.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/resource_request.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/resource_request.cc
+@@ -155,6 +155,7 @@ ResourceRequest::TrustedParams& Resource
+ allow_cookies_from_browser = other.allow_cookies_from_browser;
+ include_request_cookies_with_response =
+ other.include_request_cookies_with_response;
++ report_raw_headers = other.report_raw_headers;
+ cookie_observer =
+ Clone(&const_cast<mojo::PendingRemote<mojom::CookieAccessObserver>&>(
+ other.cookie_observer));
+@@ -185,6 +186,7 @@ bool ResourceRequest::TrustedParams::Equ
+ const TrustedParams& other) const {
+ return isolation_info.IsEqualForTesting(other.isolation_info) &&
+ disable_secure_dns == other.disable_secure_dns &&
++ report_raw_headers == other.report_raw_headers &&
+ has_user_activation == other.has_user_activation &&
+ allow_cookies_from_browser == other.allow_cookies_from_browser &&
+ include_request_cookies_with_response ==
diff --git a/electron34/patches/patch-services_network_public_cpp_resource__request.h b/electron34/patches/patch-services_network_public_cpp_resource__request.h
new file mode 100644
index 0000000000..47a24651ec
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_resource__request.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/resource_request.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/resource_request.h
+@@ -74,6 +74,7 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE
+ bool has_user_activation = false;
+ bool allow_cookies_from_browser = false;
+ bool include_request_cookies_with_response = false;
++ bool report_raw_headers = false;
+ mojo::PendingRemote<mojom::CookieAccessObserver> cookie_observer;
+ mojo::PendingRemote<mojom::TrustTokenAccessObserver> trust_token_observer;
+ mojo::PendingRemote<mojom::URLLoaderNetworkServiceObserver>
diff --git a/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc b/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc
new file mode 100644
index 0000000000..1f9ef323ba
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/url_request_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/url_request_mojom_traits.cc
+@@ -94,6 +94,7 @@ bool StructTraits<network::mojom::Truste
+ out->allow_cookies_from_browser = data.allow_cookies_from_browser();
+ out->include_request_cookies_with_response =
+ data.include_request_cookies_with_response();
++ out->report_raw_headers = data.report_raw_headers();
+ out->cookie_observer = data.TakeCookieObserver<
+ mojo::PendingRemote<network::mojom::CookieAccessObserver>>();
+ out->trust_token_observer = data.TakeTrustTokenObserver<
diff --git a/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.h b/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.h
new file mode 100644
index 0000000000..df4e7ed846
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_cpp_url__request__mojom__traits.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/cpp/url_request_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/cpp/url_request_mojom_traits.h
+@@ -76,6 +76,10 @@ struct COMPONENT_EXPORT(NETWORK_CPP_BASE
+ const network::ResourceRequest::TrustedParams& trusted_params) {
+ return trusted_params.include_request_cookies_with_response;
+ }
++ static bool report_raw_headers(
++ const network::ResourceRequest::TrustedParams& trusted_params) {
++ return trusted_params.report_raw_headers;
++ }
+ static mojo::PendingRemote<network::mojom::CookieAccessObserver>
+ cookie_observer(
+ const network::ResourceRequest::TrustedParams& trusted_params) {
diff --git a/electron34/patches/patch-services_network_public_mojom_BUILD.gn b/electron34/patches/patch-services_network_public_mojom_BUILD.gn
new file mode 100644
index 0000000000..fb14e4d79a
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_mojom_BUILD.gn
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/mojom/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/mojom/BUILD.gn
+@@ -538,11 +538,11 @@ mojom("url_loader_base") {
+ }
+
+ enabled_features = []
+- if (is_android || is_chromeos || is_linux) {
++ if (!is_bsd && (is_android || is_chromeos || is_linux)) {
+ enabled_features += [ "network_change_notifier_in_browser" ]
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ # TODO(crbug.com/40263697): Remove this once is_linux in the mojom IDL does
+ # not include lacros.
+ enabled_features += [ "use_network_interface_change_listener" ]
+@@ -1564,7 +1564,7 @@ mojom("mojom") {
+ }
+ }
+
+- if (is_linux) {
++ if (is_linux && !is_bsd) {
+ # TODO(crbug.com/40263697): Remove this once is_linux in the mojom IDL does
+ # not include lacros.
+ enabled_features += [ "use_network_interface_change_listener" ]
diff --git a/electron34/patches/patch-services_network_public_mojom_network__context.mojom b/electron34/patches/patch-services_network_public_mojom_network__context.mojom
new file mode 100644
index 0000000000..09dcc6003b
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_mojom_network__context.mojom
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/mojom/network_context.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/mojom/network_context.mojom
+@@ -304,6 +304,16 @@ struct SocketBrokerRemotes {
+ pending_remote<SocketBroker> server;
+ };
+
++interface CertVerifierClient {
++ Verify(
++ int32 default_error,
++ CertVerifyResult default_result,
++ X509Certificate certificate,
++ string hostname,
++ int32 flags,
++ string? ocsp_response
++ ) => (int32 error_code, CertVerifyResult result);
++};
+
+ // Parameters for constructing a network context.
+ struct NetworkContextParams {
+@@ -917,6 +927,9 @@ interface NetworkContext {
+ // Sets a client for this network context.
+ SetClient(pending_remote<NetworkContextClient> client);
+
++ // Sets a certificate verifier client for this network context.
++ SetCertVerifierClient(pending_remote<CertVerifierClient>? client);
++
+ // Creates a new URLLoaderFactory with the given |params|.
+ CreateURLLoaderFactory(pending_receiver<URLLoaderFactory> url_loader_factory,
+ URLLoaderFactoryParams params);
+@@ -1215,6 +1228,9 @@ interface NetworkContext {
+ SetNetworkConditions(mojo_base.mojom.UnguessableToken throttling_profile_id,
+ NetworkConditions? conditions);
+
++ // Updates the user agent to be used for requests.
++ SetUserAgent(string new_user_agent);
++
+ // Updates the Accept-Language header to be used for requests.
+ SetAcceptLanguage(string new_accept_language);
+
diff --git a/electron34/patches/patch-services_network_public_mojom_url__request.mojom b/electron34/patches/patch-services_network_public_mojom_url__request.mojom
new file mode 100644
index 0000000000..6453304adb
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_mojom_url__request.mojom
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/mojom/url_request.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/mojom/url_request.mojom
+@@ -81,6 +81,9 @@ struct TrustedUrlRequestParams {
+ // client which should not be able to see them.
+ bool include_request_cookies_with_response = false;
+
++ // [Electron] Whether to provide unfiltered response headers.
++ bool report_raw_headers;
++
+ // Observer which should be notified when this URLRequest reads or writes
+ // a cookie. If this is set to non-null, the observer passed to
+ // URLLoaderFactory will be ignored.
diff --git a/electron34/patches/patch-services_network_public_mojom_url__response__head.mojom b/electron34/patches/patch-services_network_public_mojom_url__response__head.mojom
new file mode 100644
index 0000000000..8ca21f19a3
--- /dev/null
+++ b/electron34/patches/patch-services_network_public_mojom_url__response__head.mojom
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/public/mojom/url_response_head.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/public/mojom/url_response_head.mojom
+@@ -13,6 +13,7 @@ import "services/network/public/mojom/at
+ import "services/network/public/mojom/fetch_api.mojom";
+ import "services/network/public/mojom/http_request_headers.mojom";
+ import "services/network/public/mojom/ip_address_space.mojom";
++import "services/network/public/mojom/http_raw_headers.mojom";
+ import "services/network/public/mojom/ip_endpoint.mojom";
+ import "services/network/public/mojom/load_timing_info.mojom";
+ import "services/network/public/mojom/network_param.mojom";
+@@ -49,6 +50,9 @@ struct URLResponseHead {
+ // The response headers or NULL if the URL type does not support headers.
+ HttpResponseHeaders headers;
+
++ // Actual response headers, as obtained from the network stack.
++ array<HttpRawHeaderPair> raw_response_headers;
++
+ // The mime type of the response. This may be a derived value.
+ string mime_type;
+
diff --git a/electron34/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h b/electron34/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h
new file mode 100644
index 0000000000..74a32ba01f
--- /dev/null
+++ b/electron34/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/shared_dictionary/shared_dictionary_writer_in_memory.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/shared_dictionary/shared_dictionary_writer_in_memory.h
+@@ -9,6 +9,8 @@
+ #include <string>
+ #include <vector>
+
++#include <vector>
++
+ #include "base/component_export.h"
+ #include "base/functional/callback.h"
+ #include "crypto/secure_hash.h"
diff --git a/electron34/patches/patch-services_network_test_test__network__context.h b/electron34/patches/patch-services_network_test_test__network__context.h
new file mode 100644
index 0000000000..8ad05d2144
--- /dev/null
+++ b/electron34/patches/patch-services_network_test_test__network__context.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/test/test_network_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/test/test_network_context.h
+@@ -63,6 +63,8 @@ class TestNetworkContext : public mojom:
+ void CreateURLLoaderFactory(
+ mojo::PendingReceiver<mojom::URLLoaderFactory> receiver,
+ mojom::URLLoaderFactoryParamsPtr params) override {}
++ void SetCertVerifierClient(
++ mojo::PendingRemote<mojom::CertVerifierClient> client) override {}
+ void GetCookieManager(
+ mojo::PendingReceiver<mojom::CookieManager> cookie_manager) override {}
+ void GetRestrictedCookieManager(
+@@ -153,6 +155,7 @@ class TestNetworkContext : public mojom:
+ void CloseIdleConnections(CloseIdleConnectionsCallback callback) override {}
+ void SetNetworkConditions(const base::UnguessableToken& throttling_profile_id,
+ mojom::NetworkConditionsPtr conditions) override {}
++ void SetUserAgent(const std::string& new_user_agent) override {}
+ void SetAcceptLanguage(const std::string& new_accept_language) override {}
+ void SetEnableReferrers(bool enable_referrers) override {}
+ #if BUILDFLAG(IS_CT_SUPPORTED)
diff --git a/electron34/patches/patch-services_network_url__loader.cc b/electron34/patches/patch-services_network_url__loader.cc
new file mode 100644
index 0000000000..3b60dbdac1
--- /dev/null
+++ b/electron34/patches/patch-services_network_url__loader.cc
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/url_loader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/url_loader.cc
+@@ -601,6 +601,9 @@ URLLoader::URLLoader(
+ mojo::SimpleWatcher::ArmingPolicy::MANUAL,
+ base::SequencedTaskRunner::GetCurrentDefault()),
+ per_factory_orb_state_(context.GetMutableOrbState()),
++ report_raw_headers_(
++ request.trusted_params &&
++ request.trusted_params->report_raw_headers),
+ devtools_request_id_(request.devtools_request_id),
+ request_mode_(request.mode),
+ request_credentials_mode_(request.credentials_mode),
+@@ -874,7 +877,7 @@ void URLLoader::ConfigureRequest(
+ &URLLoader::IsSharedDictionaryReadAllowed, base::Unretained(this)));
+ }
+
+- if (devtools_request_id()) {
++ if (devtools_request_id() || report_raw_headers_) {
+ url_request_->SetResponseHeadersCallback(base::BindRepeating(
+ &URLLoader::SetRawResponseHeaders, base::Unretained(this)));
+ }
+@@ -1852,6 +1855,19 @@ void URLLoader::OnResponseStarted(net::U
+ }
+
+ response_ = BuildResponseHead();
++ if (raw_response_headers_ && report_raw_headers_) {
++ std::vector<network::mojom::HttpRawHeaderPairPtr> header_array;
++ size_t iterator = 0;
++ std::string name, value;
++ while (raw_response_headers_->EnumerateHeaderLines(&iterator, &name, &value)) {
++ network::mojom::HttpRawHeaderPairPtr pair =
++ network::mojom::HttpRawHeaderPair::New();
++ pair->key = name;
++ pair->value = value;
++ header_array.push_back(std::move(pair));
++ }
++ response_->raw_response_headers = std::move(header_array);
++ }
+ DispatchOnRawResponse();
+
+ // Parse and remove the Trust Tokens response headers, if any are expected,
diff --git a/electron34/patches/patch-services_network_url__loader.h b/electron34/patches/patch-services_network_url__loader.h
new file mode 100644
index 0000000000..e023e34137
--- /dev/null
+++ b/electron34/patches/patch-services_network_url__loader.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/network/url_loader.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/network/url_loader.h
+@@ -708,6 +708,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE)
+ std::unique_ptr<ResourceScheduler::ScheduledResourceRequest>
+ resource_scheduler_request_handle_;
+
++ // Whether client requested raw headers.
++ bool report_raw_headers_ = false;
+ bool enable_reporting_raw_headers_ = false;
+ bool seen_raw_request_headers_ = false;
+ // Used for metrics.
diff --git a/electron34/patches/patch-services_on__device__model_on__device__model__service.h b/electron34/patches/patch-services_on__device__model_on__device__model__service.h
new file mode 100644
index 0000000000..7f61bddd3d
--- /dev/null
+++ b/electron34/patches/patch-services_on__device__model_on__device__model__service.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/on_device_model/on_device_model_service.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/on_device_model/on_device_model_service.h
+@@ -31,6 +31,10 @@ class OnDeviceModelInternalImpl;
+ class TsHolder;
+ }
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ namespace on_device_model {
+
+ class COMPONENT_EXPORT(ON_DEVICE_MODEL) OnDeviceModelService
+@@ -44,7 +48,7 @@ class COMPONENT_EXPORT(ON_DEVICE_MODEL)
+ // Must be called in the service's process after the run loop finished.
+ [[nodiscard]] static bool Shutdown();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static void AddSandboxLinuxOptions(
+ sandbox::policy::SandboxLinux::Options& options);
+ #endif
diff --git a/electron34/patches/patch-services_on__device__model_pre__sandbox__init.cc b/electron34/patches/patch-services_on__device__model_pre__sandbox__init.cc
new file mode 100644
index 0000000000..bae5528738
--- /dev/null
+++ b/electron34/patches/patch-services_on__device__model_pre__sandbox__init.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/on_device_model/pre_sandbox_init.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/on_device_model/pre_sandbox_init.cc
+@@ -14,7 +14,7 @@
+ #include "services/on_device_model/ml/chrome_ml.h" // nogncheck
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "gpu/config/gpu_info_collector.h" // nogncheck
+ #include "third_party/dawn/include/dawn/dawn_proc.h" // nogncheck
+ #include "third_party/dawn/include/dawn/native/DawnNative.h" // nogncheck
+@@ -25,7 +25,7 @@ namespace on_device_model {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ constexpr uint32_t kVendorIdAMD = 0x1002;
+ constexpr uint32_t kVendorIdIntel = 0x8086;
+ constexpr uint32_t kVendorIdNVIDIA = 0x10DE;
+@@ -74,7 +74,7 @@ bool OnDeviceModelService::PreSandboxIni
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Warm any relevant drivers before attempting to bring up the sandbox. For
+ // good measure we initialize a device instance for any adapter with an
+ // appropriate backend on top of any integrated or discrete GPU.
+@@ -102,7 +102,7 @@ bool OnDeviceModelService::PreSandboxIni
+ return true;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ void OnDeviceModelService::AddSandboxLinuxOptions(
+ sandbox::policy::SandboxLinux::Options& options) {
diff --git a/electron34/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc b/electron34/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc
new file mode 100644
index 0000000000..9162fd342f
--- /dev/null
+++ b/electron34/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/resource_coordinator/memory_instrumentation/queued_request_dispatcher.cc
+@@ -54,7 +54,7 @@ uint32_t CalculatePrivateFootprintKb(con
+ uint32_t shared_resident_kb) {
+ DCHECK(os_dump.platform_private_footprint);
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ uint64_t rss_anon_bytes = os_dump.platform_private_footprint->rss_anon_bytes;
+ uint64_t vm_swap_bytes = os_dump.platform_private_footprint->vm_swap_bytes;
+ return (rss_anon_bytes + vm_swap_bytes) / 1024;
+@@ -83,7 +83,7 @@ memory_instrumentation::mojom::OSMemDump
+ os_dump->is_peak_rss_resettable = internal_os_dump.is_peak_rss_resettable;
+ os_dump->private_footprint_kb =
+ CalculatePrivateFootprintKb(internal_os_dump, shared_resident_kb);
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ os_dump->private_footprint_swap_kb =
+ internal_os_dump.platform_private_footprint->vm_swap_bytes / 1024;
+ #endif
+@@ -219,7 +219,7 @@ void QueuedRequestDispatcher::SetUpAndDi
+
+ // On most platforms each process can dump data about their own process
+ // so ask each process to do so Linux is special see below.
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ request->pending_responses.insert({client_info.pid, ResponseType::kOSDump});
+ client->RequestOSMemoryDump(request->memory_map_option(),
+ {base::kNullProcessId},
+@@ -234,7 +234,7 @@ void QueuedRequestDispatcher::SetUpAndDi
+
+ // In some cases, OS stats can only be dumped from a privileged process to
+ // get around to sandboxing/selinux restrictions (see crbug.com/461788).
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::vector<base::ProcessId> pids;
+ mojom::ClientProcess* browser_client = nullptr;
+ base::ProcessId browser_client_pid = base::kNullProcessId;
+@@ -280,7 +280,7 @@ void QueuedRequestDispatcher::SetUpAndDi
+ const OsCallback& os_callback) {
+ // On Linux, OS stats can only be dumped from a privileged process to
+ // get around to sandboxing/selinux restrictions (see crbug.com/461788).
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojom::ClientProcess* browser_client = nullptr;
+ base::ProcessId browser_client_pid = 0;
+ for (const auto& client_info : clients) {
+@@ -330,7 +330,7 @@ QueuedRequestDispatcher::FinalizeVmRegio
+ // each client process provides 1 OS dump, % the case where the client is
+ // disconnected mid dump.
+ OSMemDumpMap& extra_os_dumps = response.second.os_dumps;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (auto& kv : extra_os_dumps) {
+ auto pid = kv.first == base::kNullProcessId ? original_pid : kv.first;
+ DCHECK(results.find(pid) == results.end());
+@@ -391,7 +391,7 @@ void QueuedRequestDispatcher::Finalize(Q
+ // crash). In the latter case (OS_LINUX) we expect the full map to come
+ // from the browser process response.
+ OSMemDumpMap& extra_os_dumps = response.second.os_dumps;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ for (const auto& kv : extra_os_dumps) {
+ auto pid = kv.first == base::kNullProcessId ? original_pid : kv.first;
+ DCHECK_EQ(pid_to_os_dump[pid], nullptr);
diff --git a/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn
new file mode 100644
index 0000000000..790e62fb46
--- /dev/null
+++ b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/resource_coordinator/public/cpp/memory_instrumentation/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/resource_coordinator/public/cpp/memory_instrumentation/BUILD.gn
+@@ -29,10 +29,14 @@ component("memory_instrumentation") {
+ sources += [ "os_metrics_win.cc" ]
+ }
+
+- if (is_android || is_linux || is_chromeos) {
++ if ((is_android || is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "os_metrics_linux.cc" ]
+ }
+
++ if (is_bsd) {
++ sources += [ "os_metrics_bsd.cc" ]
++ }
++
+ if (is_fuchsia) {
+ sources += [ "os_metrics_fuchsia.cc" ]
+ }
diff --git a/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h
new file mode 100644
index 0000000000..e33eb5d382
--- /dev/null
+++ b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h
+@@ -53,7 +53,7 @@ class COMPONENT_EXPORT(
+ mojom::RawOSMemDump*);
+ static std::vector<mojom::VmRegionPtr> GetProcessMemoryMaps(base::ProcessId);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ static void SetProcSmapsForTesting(FILE*);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
+ // BUILDFLAG(IS_ANDROID)
+@@ -70,7 +70,7 @@ class COMPONENT_EXPORT(
+ static std::vector<mojom::VmRegionPtr> GetProcessModules(base::ProcessId);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // Provides information on the dump state of resident pages. These values are
+ // written to logs. New enum values can be added, but existing enums must
+ // never be renumbered or deleted and reused.
diff --git a/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc
new file mode 100644
index 0000000000..5ea67703c2
--- /dev/null
+++ b/electron34/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_bsd.cc.orig 2025-05-24 17:57:53.573809543 +0000
++++ services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics_bsd.cc
+@@ -0,0 +1,66 @@
++// Copyright 2022 The Chromium Authors. All rights reserved.
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "services/resource_coordinator/public/cpp/memory_instrumentation/os_metrics.h"
++
++#include "base/memory/page_size.h"
++#include "base/process/process.h"
++#include "base/process/process_handle.h"
++
++#include <sys/sysctl.h>
++
++#include <vector>
++
++#if BUILDFLAG(IS_OPENBSD) || BUILDFLAG(IS_NETBSD)
++#define vm_rssize info.p_vm_rssize
++#elif BUILDFLAG(IS_FREEBSD)
++#include <sys/user.h>
++#define vm_rssize info.ki_rssize
++#endif
++
++namespace memory_instrumentation {
++
++// static
++bool OSMetrics::FillOSMemoryDump(base::ProcessId pid,
++ mojom::RawOSMemDump* dump) {
++ base::Process process = pid == base::kNullProcessId
++ ? base::Process::Current()
++ : base::Process::Open(pid);
++ const size_t kPageSize = base::GetPageSize();
++#if BUILDFLAG(IS_NETBSD)
++ struct kinfo_proc2 info;
++ size_t length = sizeof(struct kinfo_proc2);
++#else
++ struct kinfo_proc info;
++ size_t length = sizeof(struct kinfo_proc);
++#endif
++#if BUILDFLAG(IS_OPENBSD)
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process.Handle(),
++ static_cast<int>(length), 1 };
++#elif BUILDFLAG(IS_FREEBSD)
++ int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, process.Handle() };
++#elif BUILDFLAG(IS_NETBSD)
++ int mib[] = { CTL_KERN, KERN_PROC2, KERN_PROC_PID, process.Handle(),
++ sizeof(struct kinfo_proc2), 1 };
++#endif
++
++ if (sysctl(mib, std::size(mib), &info, &length, NULL, 0) < 0)
++ return false;
++
++ dump->resident_set_kb = (vm_rssize * kPageSize) / 1024;
++ dump->platform_private_footprint->rss_anon_bytes =
++ vm_rssize * kPageSize;
++ dump->platform_private_footprint->vm_swap_bytes = 0;
++
++ return true;
++}
++
++// static
++std::vector<mojom::VmRegionPtr> OSMetrics::GetProcessMemoryMaps(
++ base::ProcessId) {
++ NOTIMPLEMENTED();
++ return std::vector<mojom::VmRegionPtr>();
++}
++
++} // namespace memory_instrumentation
diff --git a/electron34/patches/patch-services_screen__ai_public_cpp_utilities.cc b/electron34/patches/patch-services_screen__ai_public_cpp_utilities.cc
new file mode 100644
index 0000000000..781fb4c2da
--- /dev/null
+++ b/electron34/patches/patch-services_screen__ai_public_cpp_utilities.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/screen_ai/public/cpp/utilities.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/screen_ai/public/cpp/utilities.cc
+@@ -18,7 +18,7 @@ namespace screen_ai {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ constexpr char kBinaryPathSwitch[] = "screen-ai-binary";
+ #endif
+
+@@ -39,7 +39,7 @@ constexpr char kScreenAIDlcRootPath[] =
+ #endif
+
+ #if BUILDFLAG(ENABLE_SCREEN_AI_BROWSERTESTS)
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ constexpr base::FilePath::CharType kScreenAIResourcePathForTests[] =
+ FILE_PATH_LITERAL("third_party/screen-ai/linux/resources");
+ #elif BUILDFLAG(IS_MAC)
+@@ -128,7 +128,7 @@ base::FilePath GetComponentBinaryPathFor
+
+ const char* GetBinaryPathSwitch() {
+ // This is only used on Linux and ChromeOS.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return kBinaryPathSwitch;
+ #else
+ return nullptr;
diff --git a/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc b/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..a70f7021c0
--- /dev/null
+++ b/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.cc
+@@ -53,6 +53,7 @@ bool ScreenAIPreSandboxHook(base::FilePa
+ }
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ auto* instance = sandbox::policy::SandboxLinux::GetInstance();
+
+ std::vector<BrokerFilePermission> permissions{
+@@ -75,6 +76,7 @@ bool ScreenAIPreSandboxHook(base::FilePa
+ sandbox::syscall_broker::COMMAND_OPEN}),
+ permissions, options);
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h b/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h
new file mode 100644
index 0000000000..f13c110ac2
--- /dev/null
+++ b/electron34/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/screen_ai/sandbox/screen_ai_sandbox_hook_linux.h
+@@ -6,7 +6,13 @@
+ #define SERVICES_SCREEN_AI_SANDBOX_SCREEN_AI_SANDBOX_HOOK_LINUX_H_
+
+ #include "base/files/file_path.h"
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace screen_ai {
+
diff --git a/electron34/patches/patch-services_service__manager_BUILD.gn b/electron34/patches/patch-services_service__manager_BUILD.gn
new file mode 100644
index 0000000000..d286b55189
--- /dev/null
+++ b/electron34/patches/patch-services_service__manager_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/service_manager/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/service_manager/BUILD.gn
+@@ -66,7 +66,7 @@ source_set("service_manager") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ deps += [ "//sandbox/linux:sandbox_services" ]
+ }
+ }
diff --git a/electron34/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn b/electron34/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn
new file mode 100644
index 0000000000..ae1b337134
--- /dev/null
+++ b/electron34/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/service_manager/public/cpp/service_executable/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/service_manager/public/cpp/service_executable/BUILD.gn
+@@ -22,7 +22,7 @@ source_set("support") {
+ "//services/service_manager/public/mojom",
+ ]
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ deps += [
+ "//sandbox/linux:sandbox",
+ "//sandbox/linux:sandbox_services",
diff --git a/electron34/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc b/electron34/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc
new file mode 100644
index 0000000000..a50f8aa159
--- /dev/null
+++ b/electron34/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/tracing/public/cpp/stack_sampling/tracing_sampler_profiler.cc
+@@ -38,7 +38,7 @@
+ #include "third_party/perfetto/protos/perfetto/trace/track_event/process_descriptor.pbzero.h"
+ #include "third_party/perfetto/protos/perfetto/trace/track_event/thread_descriptor.pbzero.h"
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_BSD)
+ #include "base/profiler/thread_delegate_posix.h"
+ #define INITIALIZE_THREAD_DELEGATE_POSIX 1
+ #else // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_NACL) && !BUILDFLAG(IS_APPLE)
diff --git a/electron34/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom b/electron34/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom
new file mode 100644
index 0000000000..f5c06b0a4e
--- /dev/null
+++ b/electron34/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/video_capture/public/mojom/video_capture_service.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/video_capture/public/mojom/video_capture_service.mojom
+@@ -25,10 +25,10 @@ interface AcceleratorFactory {
+ pending_receiver<chromeos_camera.mojom.MjpegDecodeAccelerator> jda);
+ };
+
+-[EnableIf=is_fuchsia]
++[EnableIf=is_openbsd]
+ const sandbox.mojom.Sandbox kVideoCaptureSandbox
+ = sandbox.mojom.Sandbox.kVideoCapture;
+-[EnableIfNot=is_fuchsia]
++[EnableIfNot=is_openbsd]
+ const sandbox.mojom.Sandbox kVideoCaptureSandbox
+ = sandbox.mojom.Sandbox.kNoSandbox;
+
diff --git a/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.cc b/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..4848a89d04
--- /dev/null
+++ b/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/video_effects/video_effects_sandbox_hook_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/video_effects/video_effects_sandbox_hook_linux.cc
+@@ -6,7 +6,13 @@
+
+ #include <dlfcn.h>
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+ #include "services/on_device_model/ml/chrome_ml.h"
+
+ namespace video_effects {
+@@ -29,8 +35,10 @@ bool VideoEffectsPreSandboxHook(
+ DVLOG(1) << "Successfully opened Chrome ML shared library.";
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ auto* instance = sandbox::policy::SandboxLinux::GetInstance();
+ instance->EngageNamespaceSandboxIfPossible();
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.h b/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.h
new file mode 100644
index 0000000000..67380fa356
--- /dev/null
+++ b/electron34/patches/patch-services_video__effects_video__effects__sandbox__hook__linux.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/video_effects/video_effects_sandbox_hook_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/video_effects/video_effects_sandbox_hook_linux.h
+@@ -5,7 +5,13 @@
+ #ifndef SERVICES_VIDEO_EFFECTS_VIDEO_EFFECTS_SANDBOX_HOOK_LINUX_H_
+ #define SERVICES_VIDEO_EFFECTS_VIDEO_EFFECTS_SANDBOX_HOOK_LINUX_H_
+
++#include "build/build_config.h"
++
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#else
+ #include "sandbox/policy/linux/sandbox_linux.h"
++#endif
+
+ namespace video_effects {
+
diff --git a/electron34/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom b/electron34/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom
new file mode 100644
index 0000000000..26114119bf
--- /dev/null
+++ b/electron34/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/viz/privileged/mojom/compositing/display_private.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/viz/privileged/mojom/compositing/display_private.mojom
+@@ -117,7 +117,6 @@ interface DisplayClient {
+
+ // Creates a LayeredWindowUpdater implementation to draw into a layered
+ // window.
+- [EnableIf=is_win]
+ CreateLayeredWindowUpdater(pending_receiver<LayeredWindowUpdater> receiver);
+
+ // Sends the created child window to the browser process so that it can be
diff --git a/electron34/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom b/electron34/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom
new file mode 100644
index 0000000000..4a9a27b284
--- /dev/null
+++ b/electron34/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/viz/privileged/mojom/compositing/frame_sink_manager.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/viz/privileged/mojom/compositing/frame_sink_manager.mojom
+@@ -39,6 +39,7 @@ struct RootCompositorFrameSinkParams {
+ bool send_swap_size_notifications = false;
+ // Disables begin frame rate limiting for the display compositor.
+ bool disable_frame_rate_limit = false;
++ bool offscreen = false;
+
+ // Whether to create a surface control input receiver on Viz.
+ [EnableIf=is_android]
diff --git a/electron34/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom b/electron34/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom
new file mode 100644
index 0000000000..67a470deda
--- /dev/null
+++ b/electron34/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- services/viz/privileged/mojom/compositing/layered_window_updater.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ services/viz/privileged/mojom/compositing/layered_window_updater.mojom
+@@ -26,5 +26,5 @@ interface LayeredWindowUpdater {
+ // Draws to the HWND by copying pixels from shared memory. Callback must be
+ // called after draw operation is complete to signal shared memory can be
+ // modified.
+- Draw() => ();
++ Draw(gfx.mojom.Rect damage_rect) => ();
+ };
diff --git a/electron34/patches/patch-skia_ext_SkMemory__new__handler.cpp b/electron34/patches/patch-skia_ext_SkMemory__new__handler.cpp
new file mode 100644
index 0000000000..2530a1fa6e
--- /dev/null
+++ b/electron34/patches/patch-skia_ext_SkMemory__new__handler.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- skia/ext/SkMemory_new_handler.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ skia/ext/SkMemory_new_handler.cpp
+@@ -19,7 +19,7 @@
+ #include <windows.h>
+ #elif BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
+-#else
++#elif !BUILDFLAG(IS_BSD)
+ #include <malloc.h>
+ #endif
+
+@@ -105,7 +105,7 @@ static void* malloc_nothrow(size_t size,
+ // TODO(b.kelemen): we should always use UncheckedMalloc but currently it
+ // doesn't work as intended everywhere.
+ void* result;
+-#if BUILDFLAG(IS_IOS)
++#if BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ result = malloc(size);
+ #else
+ // It's the responsibility of the caller to check the return value.
diff --git a/electron34/patches/patch-skia_ext_font__utils.cc b/electron34/patches/patch-skia_ext_font__utils.cc
new file mode 100644
index 0000000000..a257ad1612
--- /dev/null
+++ b/electron34/patches/patch-skia_ext_font__utils.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- skia/ext/font_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ skia/ext/font_utils.cc
+@@ -19,7 +19,7 @@
+ #include "third_party/skia/include/ports/SkFontMgr_mac_ct.h"
+ #endif
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "third_party/skia/include/ports/SkFontConfigInterface.h"
+ #include "third_party/skia/include/ports/SkFontMgr_FontConfigInterface.h"
+ #endif
+@@ -60,7 +60,7 @@ static sk_sp<SkFontMgr> fontmgr_factory(
+ return SkFontMgr_New_Android(nullptr);
+ #elif BUILDFLAG(IS_APPLE)
+ return SkFontMgr_New_CoreText(nullptr);
+-#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ sk_sp<SkFontConfigInterface> fci(SkFontConfigInterface::RefGlobal());
+ return fci ? SkFontMgr_New_FCI(std::move(fci)) : nullptr;
+ #elif BUILDFLAG(IS_FUCHSIA)
diff --git a/electron34/patches/patch-skia_ext_platform__canvas.h b/electron34/patches/patch-skia_ext_platform__canvas.h
new file mode 100644
index 0000000000..f6c3d3615d
--- /dev/null
+++ b/electron34/patches/patch-skia_ext_platform__canvas.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- skia/ext/platform_canvas.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ skia/ext/platform_canvas.h
+@@ -58,7 +58,7 @@ SK_API HDC GetNativeDrawingContext(SkCan
+
+ #elif defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) || \
+ defined(__sun) || defined(ANDROID) || defined(__APPLE__) || \
+- defined(__Fuchsia__)
++ defined(__Fuchsia__) || defined(__NetBSD__)
+ // Construct a canvas from the given memory region. The memory is not cleared
+ // first. @data must be, at least, @height * StrideForWidth(@width) bytes.
+ SK_API std::unique_ptr<SkCanvas> CreatePlatformCanvasWithPixels(
diff --git a/electron34/patches/patch-skia_ext_skcolorspace__trfn.cc b/electron34/patches/patch-skia_ext_skcolorspace__trfn.cc
new file mode 100644
index 0000000000..fe75389391
--- /dev/null
+++ b/electron34/patches/patch-skia_ext_skcolorspace__trfn.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- skia/ext/skcolorspace_trfn.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ skia/ext/skcolorspace_trfn.cc
+@@ -7,6 +7,8 @@
+ #pragma allow_unsafe_buffers
+ #endif
+
++#include <cmath>
++
+ #include "skia/ext/skcolorspace_trfn.h"
+
+ #include <cmath>
diff --git a/electron34/patches/patch-third__party_.gitignore b/electron34/patches/patch-third__party_.gitignore
new file mode 100644
index 0000000000..234d20ac0c
--- /dev/null
+++ b/electron34/patches/patch-third__party_.gitignore
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/.gitignore.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/.gitignore
+@@ -45,7 +45,9 @@
+ /devserver
+ /directxsdk
+ /edk2
++/electron_nodeXXX
+ /elfutils/src
++/engflow-reclient-configsXXX/
+ /espresso/lib/
+ /eyesfree/src
+ /fast_float/src
+@@ -92,6 +94,7 @@
+ /mocha
+ /mockito/src
+ /nacl_sdk_binaries/
++/nanXXX
+ /ninja
+ /node/*.tar.gz
+ /node/linux/
+@@ -136,7 +139,7 @@
+ /spirv-cross/src
+ /spirv-headers/src
+ /spirv-tools/src
+-/src
++/squirrel.macXXX
+ /subresource-filter-ruleset/data/*
+ /swift-format
+ /swift-toolchain
diff --git a/electron34/patches/patch-third__party_abseil-cpp_absl_base_config.h b/electron34/patches/patch-third__party_abseil-cpp_absl_base_config.h
new file mode 100644
index 0000000000..1f2246a0f9
--- /dev/null
+++ b/electron34/patches/patch-third__party_abseil-cpp_absl_base_config.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/abseil-cpp/absl/base/config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/abseil-cpp/absl/base/config.h
+@@ -412,7 +412,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMES
+ #ifdef ABSL_HAVE_SCHED_YIELD
+ #error ABSL_HAVE_SCHED_YIELD cannot be directly set
+ #elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \
+- defined(__VXWORKS__)
++ defined(__VXWORKS__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__)
+ #define ABSL_HAVE_SCHED_YIELD 1
+ #endif
+
+@@ -427,7 +428,8 @@ static_assert(ABSL_INTERNAL_INLINE_NAMES
+ // platforms.
+ #ifdef ABSL_HAVE_SEMAPHORE_H
+ #error ABSL_HAVE_SEMAPHORE_H cannot be directly set
+-#elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__)
++#elif defined(__linux__) || defined(__ros__) || defined(__VXWORKS__) || \
++ defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #define ABSL_HAVE_SEMAPHORE_H 1
+ #endif
+
diff --git a/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc b/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc
new file mode 100644
index 0000000000..356c973e51
--- /dev/null
+++ b/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/abseil-cpp/absl/base/internal/raw_logging.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/abseil-cpp/absl/base/internal/raw_logging.cc
+@@ -44,7 +44,7 @@
+ #if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \
+ defined(__hexagon__) || defined(__Fuchsia__) || \
+ defined(__native_client__) || defined(__OpenBSD__) || \
+- defined(__EMSCRIPTEN__) || defined(__ASYLO__)
++ defined(__EMSCRIPTEN__) || defined(__ASYLO__) || defined(__NetBSD__)
+
+ #include <unistd.h>
+
diff --git a/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc b/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc
new file mode 100644
index 0000000000..28569d3c0e
--- /dev/null
+++ b/electron34/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/abseil-cpp/absl/base/internal/sysinfo.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/abseil-cpp/absl/base/internal/sysinfo.cc
+@@ -30,7 +30,7 @@
+ #include <sys/syscall.h>
+ #endif
+
+-#if defined(__APPLE__) || defined(__FreeBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__)
+ #include <sys/sysctl.h>
+ #endif
+
+@@ -198,6 +198,7 @@ static double GetNominalCPUFrequency() {
+
+ #else
+
++#if !defined(__OpenBSD__) && !defined(__FreeBSD__)
+ // Helper function for reading a long from a file. Returns true if successful
+ // and the memory location pointed to by value is set to the value read.
+ static bool ReadLongFromFile(const char *file, long *value) {
+@@ -230,6 +231,7 @@ static bool ReadLongFromFile(const char
+ }
+ return ret;
+ }
++#endif
+
+ #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY)
+
+@@ -329,9 +331,11 @@ static double GetNominalCPUFrequency() {
+ // a new mode (turbo mode). Essentially, those frequencies cannot
+ // always be relied upon. The same reasons apply to /proc/cpuinfo as
+ // well.
++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation
+ if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/tsc_freq_khz", &freq)) {
+ return freq * 1e3; // Value is kHz.
+ }
++#endif
+
+ #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY)
+ // On these platforms, the TSC frequency is the nominal CPU
+@@ -350,10 +354,12 @@ static double GetNominalCPUFrequency() {
+ // If CPU scaling is in effect, we want to use the *maximum*
+ // frequency, not whatever CPU speed some random processor happens
+ // to be using now.
++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) // pledge violation
+ if (ReadLongFromFile("/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq",
+ &freq)) {
+ return freq * 1e3; // Value is kHz.
+ }
++#endif
+
+ return 1.0;
+ #endif // !ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY
+@@ -465,6 +471,12 @@ pid_t GetTID() {
+ return reinterpret_cast<pid_t>(thread);
+ }
+
++#elif defined(__OpenBSD__)
++
++pid_t GetTID() {
++ return getthrid();
++}
++
+ #elif defined(__Fuchsia__)
+
+ pid_t GetTID() {
diff --git a/electron34/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h b/electron34/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h
new file mode 100644
index 0000000000..ccff6787d3
--- /dev/null
+++ b/electron34/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/abseil-cpp/absl/debugging/internal/elf_mem_image.h
+@@ -35,7 +35,8 @@
+ #if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \
+ !defined(__native_client__) && !defined(__asmjs__) && \
+ !defined(__wasm__) && !defined(__HAIKU__) && !defined(__sun) && \
+- !defined(__VXWORKS__) && !defined(__hexagon__) && !defined(__XTENSA__)
++ !defined(__VXWORKS__) && !defined(__hexagon__) && !defined(__XTENSA__) && \
++ !defined(__FreeBSD__) && !defined(__NetBSD__)
+ #define ABSL_HAVE_ELF_MEM_IMAGE 1
+ #endif
+
diff --git a/electron34/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc b/electron34/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc
new file mode 100644
index 0000000000..470a455a33
--- /dev/null
+++ b/electron34/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/abseil-cpp/absl/time/internal/cctz/src/time_zone_format.cc
+@@ -19,7 +19,8 @@
+ #endif
+
+ #if defined(HAS_STRPTIME) && HAS_STRPTIME
+-#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) && !defined(__OpenBSD__)
++#if !defined(_XOPEN_SOURCE) && !defined(__FreeBSD__) && !defined(__OpenBSD__) && \
++ !defined(__NetBSD__)
+ #define _XOPEN_SOURCE 500 // Exposes definitions for SUSv2 (UNIX 98).
+ #endif
+ #endif
diff --git a/electron34/patches/patch-third__party_afl_src_afl-fuzz.c b/electron34/patches/patch-third__party_afl_src_afl-fuzz.c
new file mode 100644
index 0000000000..eade9f42e9
--- /dev/null
+++ b/electron34/patches/patch-third__party_afl_src_afl-fuzz.c
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/afl/src/afl-fuzz.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/afl/src/afl-fuzz.c
+@@ -58,7 +58,8 @@
+ #include <sys/ioctl.h>
+ #include <sys/file.h>
+
+-#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || \
++ defined (__NetBSD__)
+ # include <sys/sysctl.h>
+ #endif /* __APPLE__ || __FreeBSD__ || __OpenBSD__ */
+
+@@ -3531,7 +3532,8 @@ static double get_runnable_processes(voi
+
+ static double res;
+
+-#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || \
++ defined (__NetBSD__)
+
+ /* I don't see any portable sysctl or so that would quickly give us the
+ number of runnable processes; the 1-minute load average can be a
+@@ -7347,7 +7349,8 @@ static void get_core_count(void) {
+
+ u32 cur_runnable = 0;
+
+-#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || \
++ defined (__NetBSD__)
+
+ size_t s = sizeof(cpu_core_count);
+
+@@ -7392,7 +7395,8 @@ static void get_core_count(void) {
+
+ cur_runnable = (u32)get_runnable_processes();
+
+-#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__)
++#if defined(__APPLE__) || defined(__FreeBSD__) || defined (__OpenBSD__) || \
++ defined (__NetBSD__)
+
+ /* Add ourselves, since the 1-minute average doesn't include that yet. */
+
diff --git a/electron34/patches/patch-third__party_angle_BUILD.gn b/electron34/patches/patch-third__party_angle_BUILD.gn
new file mode 100644
index 0000000000..ad0c48e66a
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_BUILD.gn
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/BUILD.gn
+@@ -358,7 +358,6 @@ config("extra_warnings") {
+ "-Wtautological-type-limit-compare",
+ "-Wundefined-reinterpret-cast",
+ "-Wunneeded-internal-declaration",
+- "-Wunused-but-set-variable",
+ "-Wsuggest-destructor-override",
+ "-Wsuggest-override",
+
+@@ -535,7 +534,7 @@ template("angle_common_lib") {
+ all_dependent_configs = [ ":angle_disable_pool_alloc" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ libs = [ "dl" ]
+ }
+
+@@ -690,6 +689,9 @@ angle_static_library("angle_gpu_info_uti
+ "Xi",
+ "Xext",
+ ]
++ if (is_bsd) {
++ libs += [ "GL" ]
++ }
+ }
+
+ if (angle_use_wayland && angle_has_build) {
diff --git a/electron34/patches/patch-third__party_angle_src_common_platform.h b/electron34/patches/patch-third__party_angle_src_common_platform.h
new file mode 100644
index 0000000000..e161aa0a77
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_common_platform.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/common/platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/common/platform.h
+@@ -26,8 +26,19 @@
+ #elif defined(__linux__) || defined(EMSCRIPTEN)
+ # define ANGLE_PLATFORM_LINUX 1
+ # define ANGLE_PLATFORM_POSIX 1
+-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
+- defined(__DragonFly__) || defined(__sun) || defined(__GLIBC__) || defined(__GNU__) || \
++#elif defined(__OpenBSD__)
++# define ANGLE_PLATFORM_OPENBSD 1
++# define ANGLE_PLATFORM_POSIX 1
++# define ANGLE_PLATFORM_BSD 1
++#elif defined(__NetBSD__)
++# define ANGLE_PLATFORM_NETBSD 1
++# define ANGLE_PLATFORM_POSIX 1
++# define ANGLE_PLATFORM_BSD 1
++#elif defined(__FreeBSD__)
++# define ANGLE_PLATFORM_FREEBSD 1
++# define ANGLE_PLATFORM_POSIX 1
++# define ANGLE_PLATFORM_BSD 1
++#elif defined(__DragonFly__) || defined(__sun) || defined(__GLIBC__) || defined(__GNU__) || \
+ defined(__QNX__) || defined(__Fuchsia__) || defined(__HAIKU__)
+ # define ANGLE_PLATFORM_POSIX 1
+ #else
diff --git a/electron34/patches/patch-third__party_angle_src_common_platform__helpers.h b/electron34/patches/patch-third__party_angle_src_common_platform__helpers.h
new file mode 100644
index 0000000000..eeb35b0f49
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_common_platform__helpers.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/common/platform_helpers.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/common/platform_helpers.h
+@@ -62,7 +62,7 @@ inline constexpr bool IsIOS()
+
+ inline constexpr bool IsLinux()
+ {
+-#if defined(ANGLE_PLATFORM_LINUX)
++#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-third__party_angle_src_common_system__utils.cpp b/electron34/patches/patch-third__party_angle_src_common_system__utils.cpp
new file mode 100644
index 0000000000..2d7e90ebad
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_common_system__utils.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/common/system_utils.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/common/system_utils.cpp
+@@ -25,7 +25,7 @@ namespace angle
+ {
+ std::string GetExecutableName()
+ {
+-#if defined(ANGLE_PLATFORM_ANDROID) && __ANDROID_API__ >= 21
++#if (defined(ANGLE_PLATFORM_ANDROID) && __ANDROID_API__ >= 21) || defined(ANGLE_PLATFORM_BSD)
+ // Support for "getprogname" function in bionic was introduced in L (API level 21)
+ const char *executableName = getprogname();
+ return (executableName) ? std::string(executableName) : "ANGLE";
diff --git a/electron34/patches/patch-third__party_angle_src_common_system__utils__linux.cpp b/electron34/patches/patch-third__party_angle_src_common_system__utils__linux.cpp
new file mode 100644
index 0000000000..9e9dc10899
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_common_system__utils__linux.cpp
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/common/system_utils_linux.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/common/system_utils_linux.cpp
+@@ -15,8 +15,15 @@
+
+ #include <array>
+
++#if ANGLE_PLATFORM_OPENBSD
++#include <pthread_np.h>
++#elif ANGLE_PLATFORM_NETBSD
++#include <pthread.h>
++#endif
++
+ namespace angle
+ {
++#if ANGLE_PLATFORM_LINUX
+ std::string GetExecutablePath()
+ {
+ // We cannot use lstat to get the size of /proc/self/exe as it always returns 0
+@@ -32,6 +39,7 @@ std::string GetExecutablePath()
+ path[result] = '\0';
+ return path;
+ }
++#endif
+
+ std::string GetExecutableDirectory()
+ {
+@@ -56,6 +64,12 @@ void SetCurrentThreadName(const char *na
+ {
+ // There's a 15-character (16 including '\0') limit. If the name is too big (and ERANGE is
+ // returned), just ignore the name.
++#if ANGLE_PLATFORM_OPENBSD
++ pthread_set_name_np(pthread_self(), name);
++#elif ANGLE_PLATFORM_NETBSD
++ pthread_setname_np(pthread_self(), "%s", (void *)name);
++#else
+ pthread_setname_np(pthread_self(), name);
++#endif
+ }
+ } // namespace angle
diff --git a/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
new file mode 100644
index 0000000000..eab3b0e8e1
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/gpu_info_util/SystemInfo_internal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/gpu_info_util/SystemInfo_internal.h
+@@ -15,6 +15,13 @@
+ namespace angle
+ {
+
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++bool CollectMesaCardInfo(std::vector<GPUDeviceInfo> *devices);
++#if defined(__FreeBSD__)
++bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices);
++#endif
++#endif
++
+ // Defined in SystemInfo_libpci when GPU_INFO_USE_LIBPCI is defined.
+ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices);
+ // Defined in SystemInfo_x11 when GPU_INFO_USE_X11 is defined.
diff --git a/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
new file mode 100644
index 0000000000..b95439b05d
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/gpu_info_util/SystemInfo_libpci.cpp
+@@ -12,6 +12,11 @@
+ #include <pci/pci.h>
+ #include <unistd.h>
+
++#if defined(__FreeBSD__)
++#include <fcntl.h>
++#include <sys/pciio.h>
++#endif
++
+ #include "common/angleutils.h"
+ #include "common/debug.h"
+
+@@ -86,6 +91,75 @@ struct LibPCI : private angle::NonCopyab
+
+ } // anonymous namespace
+
++#if defined(__FreeBSD__)
++// Adds an entry per PCI GPU found and fills the device and vendor ID.
++bool GetPCIDevicesFreeBSD(std::vector<GPUDeviceInfo> *devices)
++{
++ int fd;
++ struct pci_conf_io conf;
++ struct pci_conf *matches;
++ uint32_t offset = 0;
++
++ fd = open("/dev/pci", O_RDONLY);
++ if (fd < 0)
++ return false;
++
++ matches = new struct pci_conf[32];
++ conf.generation = 0;
++ do {
++ conf.pat_buf_len = 0;
++ conf.num_patterns = 0;
++ conf.patterns = NULL;
++ conf.match_buf_len = 32 * sizeof(struct pci_conf);
++ conf.num_matches = 32;
++ conf.matches = matches;
++ conf.offset = offset;
++ conf.status = PCI_GETCONF_ERROR;
++ if (ioctl(fd, PCIOCGETCONF, &conf) < 0) {
++ if (errno == ENODEV)
++ break;
++ }
++ /* PCI_GETCONF_LIST_CHANGED would require us to start over. */
++ if (conf.status == PCI_GETCONF_ERROR || conf.status == PCI_GETCONF_LIST_CHANGED) {
++ break;
++ }
++
++ for (unsigned int i = 0; i < conf.num_matches; i++) {
++ uint16_t device_class = (matches[i].pc_class << 8) | matches[i].pc_subclass;
++
++ // Skip non-GPU devices
++ switch (device_class)
++ {
++ case PCI_CLASS_DISPLAY_VGA:
++ case PCI_CLASS_DISPLAY_XGA:
++ case PCI_CLASS_DISPLAY_3D:
++ break;
++ default:
++ continue;
++ }
++
++ // Skip unknown devices
++ if (matches[i].pc_vendor == 0 || matches[i].pc_device == 0) {
++ continue;
++ }
++
++ GPUDeviceInfo info;
++ info.vendorId = matches[i].pc_vendor;
++ info.deviceId = matches[i].pc_device;
++
++ devices->push_back(info);
++ }
++ offset += conf.num_matches;
++ } while (conf.status == PCI_GETCONF_MORE_DEVS);
++
++ delete[] matches;
++
++ close(fd);
++
++ return true;
++}
++#endif
++
+ // Adds an entry per PCI GPU found and fills the device and vendor ID.
+ bool GetPCIDevicesWithLibPCI(std::vector<GPUDeviceInfo> *devices)
+ {
diff --git a/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
new file mode 100644
index 0000000000..f31cee8d82
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/gpu_info_util/SystemInfo_linux.cpp
+@@ -71,6 +71,24 @@ bool GetPCIDevicesWithLibPCI(std::vector
+
+ bool GetSystemInfo(SystemInfo *info)
+ {
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++ if (!CollectMesaCardInfo(&(info->gpus)))
++ {
++#if defined(__FreeBSD__)
++ if (!GetPCIDevicesFreeBSD(&(info->gpus)))
++ {
++#endif
++#if defined(ANGLE_USE_VULKAN_SYSTEM_INFO)
++ // Try vulkan backend to get GPU info
++ return GetSystemInfoVulkan(info);
++#else
++ return false;
++#endif
++#if defined(__FreeBSD__)
++ }
++#endif
++ }
++#else
+ if (!GetPCIDevicesWithLibPCI(&(info->gpus)))
+ {
+ #if defined(ANGLE_USE_VULKAN_SYSTEM_INFO)
+@@ -85,6 +103,7 @@ bool GetSystemInfo(SystemInfo *info)
+ {
+ return false;
+ }
++#endif
+
+ GetDualGPUInfo(info);
+
diff --git a/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
new file mode 100644
index 0000000000..c173a31d35
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
@@ -0,0 +1,67 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/gpu_info_util/SystemInfo_x11.cpp
+@@ -8,6 +8,10 @@
+
+ #include "gpu_info_util/SystemInfo_internal.h"
+
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#include <GL/glx.h>
++#include <GL/glxext.h>
++#endif
+ #include <X11/Xlib.h>
+
+ #include "common/debug.h"
+@@ -18,9 +22,47 @@
+ # error SystemInfo_x11.cpp compiled without GPU_INFO_USE_X11
+ #endif
+
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
++#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
++#endif
++
+ namespace angle
+ {
+
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++bool CollectMesaCardInfo(std::vector<GPUDeviceInfo> *devices)
++{
++ unsigned int vid[3], did[3];
++
++ Display *display = XOpenDisplay(NULL);
++ if (!display) {
++ return false;
++ }
++
++ PFNGLXQUERYRENDERERINTEGERMESAPROC queryInteger =
++ (PFNGLXQUERYRENDERERINTEGERMESAPROC) glXGetProcAddressARB((const GLubyte *)
++ "glXQueryRendererIntegerMESA");
++
++ if (!queryInteger)
++ return false;
++
++ bool vendor_ret =
++ queryInteger(display, 0, 0, GLX_RENDERER_VENDOR_ID_MESA, vid);
++ bool device_ret =
++ queryInteger(display, 0, 0, GLX_RENDERER_DEVICE_ID_MESA, did);
++
++ if (vendor_ret && device_ret) {
++ GPUDeviceInfo info;
++ info.vendorId = vid[0];
++ info.deviceId = did[0];
++ devices->push_back(info);
++ }
++
++ return true;
++}
++#endif
++
+ bool GetNvidiaDriverVersionWithXNVCtrl(std::string *version)
+ {
+ *version = "";
diff --git a/electron34/patches/patch-third__party_angle_src_libANGLE_Display.cpp b/electron34/patches/patch-third__party_angle_src_libANGLE_Display.cpp
new file mode 100644
index 0000000000..bc294e842a
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_libANGLE_Display.cpp
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/libANGLE/Display.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/libANGLE/Display.cpp
+@@ -58,7 +58,7 @@
+ # include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
+ # elif ANGLE_ENABLE_CGL
+ # include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+-# elif defined(ANGLE_PLATFORM_LINUX)
++# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ # include "libANGLE/renderer/gl/egl/DisplayEGL.h"
+ # if defined(ANGLE_USE_X11)
+ # include "libANGLE/renderer/gl/glx/DisplayGLX_api.h"
+@@ -410,7 +410,7 @@ rx::DisplayImpl *CreateDisplayFromAttrib
+ impl = new rx::DisplayCGL(state);
+ break;
+
+-# elif defined(ANGLE_PLATFORM_LINUX)
++# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ # if defined(ANGLE_USE_GBM)
+ if (platformType == 0)
+ {
+@@ -456,7 +456,7 @@ rx::DisplayImpl *CreateDisplayFromAttrib
+ #if defined(ANGLE_ENABLE_OPENGL)
+ # if defined(ANGLE_PLATFORM_WINDOWS)
+ impl = new rx::DisplayWGL(state);
+-# elif defined(ANGLE_PLATFORM_LINUX)
++# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ # if defined(ANGLE_USE_GBM)
+ if (platformType == 0)
+ {
+@@ -507,7 +507,7 @@ rx::DisplayImpl *CreateDisplayFromAttrib
+ impl = rx::CreateVulkanWin32Display(state);
+ }
+ break;
+-# elif defined(ANGLE_PLATFORM_LINUX)
++# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ # if defined(ANGLE_USE_GBM)
+ if (platformType == EGL_PLATFORM_GBM_KHR && rx::IsVulkanGbmDisplayAvailable())
+ {
+@@ -2079,7 +2079,7 @@ static ClientExtensions GenerateClientEx
+ extensions.platformWaylandEXT = true;
+ #endif
+
+-#if defined(ANGLE_PLATFORM_LINUX) && (defined(ANGLE_ENABLE_OPENGL) || defined(ANGLE_ENABLE_VULKAN))
++#if (defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)) && (defined(ANGLE_ENABLE_OPENGL) || defined(ANGLE_ENABLE_VULKAN))
+ extensions.platformSurfacelessMESA = true;
+ #endif
+
+@@ -2125,7 +2125,7 @@ static ClientExtensions GenerateClientEx
+ extensions.x11Visual = true;
+ #endif
+
+-#if defined(ANGLE_PLATFORM_LINUX)
++#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ extensions.platformANGLEDeviceTypeEGLANGLE = true;
+ #endif
+
diff --git a/electron34/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp b/electron34/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp
new file mode 100644
index 0000000000..61c87d4a16
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/libANGLE/formatutils.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/libANGLE/formatutils.cpp
+@@ -1470,7 +1470,7 @@ static InternalFormatInfoMap BuildIntern
+ AddYUVFormat(&map, GL_G8_B8R8_2PLANE_420_UNORM_ANGLE, true, 8, 8, 8, 0, 0, GL_G8_B8R8_2PLANE_420_UNORM_ANGLE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, NeverSupported, NeverSupported);
+ AddYUVFormat(&map, GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE, true, 8, 8, 8, 0, 0, GL_G8_B8_R8_3PLANE_420_UNORM_ANGLE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, RequireExt<&Extensions::yuvInternalFormatANGLE>, NeverSupported, NeverSupported);
+
+-#if defined(ANGLE_PLATFORM_LINUX)
++#if defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ // From GL_OES_required_internalformat
+ // The |shared| bit shouldn't be 2. But given this hits assertion when bits
+ // are checked, it's fine to have this bit set as 2 as a workaround.
diff --git a/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp b/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp
new file mode 100644
index 0000000000..43e2c7296f
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/libANGLE/renderer/gl/glx/FunctionsGLX.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/libANGLE/renderer/gl/glx/FunctionsGLX.cpp
+@@ -144,10 +144,10 @@ bool FunctionsGLX::initialize(Display *x
+ // which a GLXWindow was ever created.
+ if (!sLibHandle)
+ {
+- sLibHandle = dlopen("libGL.so.1", RTLD_NOW);
++ sLibHandle = dlopen("libGL.so", RTLD_NOW);
+ if (!sLibHandle)
+ {
+- *errorString = std::string("Could not dlopen libGL.so.1: ") + dlerror();
++ *errorString = std::string("Could not dlopen libGL.so: ") + dlerror();
+ return false;
+ }
+ }
diff --git a/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h b/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h
new file mode 100644
index 0000000000..4ece2e1016
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/src/libANGLE/renderer/vulkan/DisplayVk_api.h
+@@ -23,7 +23,7 @@ bool IsVulkanWin32DisplayAvailable();
+ DisplayImpl *CreateVulkanWin32Display(const egl::DisplayState &state);
+ #endif // defined(ANGLE_PLATFORM_WINDOWS)
+
+-#if defined(ANGLE_PLATFORM_LINUX)
++#if defined(ANGLE_PLATFORM_POSIX)
+ bool IsVulkanWaylandDisplayAvailable();
+ DisplayImpl *CreateVulkanWaylandDisplay(const egl::DisplayState &state);
+
diff --git a/electron34/patches/patch-third__party_angle_util_BUILD.gn b/electron34/patches/patch-third__party_angle_util_BUILD.gn
new file mode 100644
index 0000000000..dd4ea01fdb
--- /dev/null
+++ b/electron34/patches/patch-third__party_angle_util_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/angle/util/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/angle/util/BUILD.gn
+@@ -311,7 +311,7 @@ foreach(is_shared_library,
+ ]
+ libs = []
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ libs += [
+ "rt",
+ "dl",
diff --git a/electron34/patches/patch-third__party_blink_common_features.cc b/electron34/patches/patch-third__party_blink_common_features.cc
new file mode 100644
index 0000000000..6b7b58fa17
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_common_features.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/common/features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/common/features.cc
+@@ -2754,6 +2754,12 @@ BASE_FEATURE(kWebAppManifestLockScreen,
+ "WebAppManifestLockScreen",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
++// Allow denormals in AudioWorklet and ScriptProcessorNode, to enable strict
++// JavaScript denormal compliance. See https://crbug.com/382005099.
++BASE_FEATURE(kWebAudioAllowDenormalInProcessing,
++ "WebAudioAllowDenormalInProcessing",
++ base::FEATURE_DISABLED_BY_DEFAULT);
++
+ // Parameters can be used to control to which latency hints the feature is
+ // applied.
+ BASE_FEATURE_PARAM(bool,
diff --git a/electron34/patches/patch-third__party_blink_common_permissions_permission__utils.cc b/electron34/patches/patch-third__party_blink_common_permissions_permission__utils.cc
new file mode 100644
index 0000000000..c7ea55bf4a
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_common_permissions_permission__utils.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/common/permissions/permission_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/common/permissions/permission_utils.cc
+@@ -99,6 +99,8 @@ std::string GetPermissionString(Permissi
+ return "AutomaticFullscreen";
+ case PermissionType::WEB_APP_INSTALLATION:
+ return "WebAppInstallation";
++ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
++ return "DeprecatedSyncClipboardRead";
+ case PermissionType::NUM:
+ NOTREACHED();
+ }
+@@ -171,6 +173,7 @@ PermissionTypeToPermissionsPolicyFeature
+ case PermissionType::NOTIFICATIONS:
+ case PermissionType::KEYBOARD_LOCK:
+ case PermissionType::POINTER_LOCK:
++ case PermissionType::DEPRECATED_SYNC_CLIPBOARD_READ:
+ return std::nullopt;
+
+ case PermissionType::NUM:
diff --git a/electron34/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc b/electron34/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc
new file mode 100644
index 0000000000..cfdea8ffa5
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/common/renderer_preferences/renderer_preferences_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/common/renderer_preferences/renderer_preferences_mojom_traits.cc
+@@ -73,7 +73,7 @@ bool StructTraits<blink::mojom::Renderer
+
+ out->send_subresource_notification = data.send_subresource_notification();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!data.ReadSystemFontFamilyName(&out->system_font_family_name))
+ return false;
+ #endif
diff --git a/electron34/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc b/electron34/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc
new file mode 100644
index 0000000000..556ed5fd7b
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/common/web_preferences/web_preferences_mojom_traits.cc
+@@ -147,6 +147,19 @@ bool StructTraits<blink::mojom::WebPrefe
+ out->v8_cache_options = data.v8_cache_options();
+ out->record_whole_document = data.record_whole_document();
+ out->stylus_handwriting_enabled = data.stylus_handwriting_enabled();
++ // Begin Electron-specific WebPreferences.
++ out->context_isolation = data.context_isolation();
++ out->is_webview = data.is_webview();
++ out->hidden_page = data.hidden_page();
++ out->offscreen = data.offscreen();
++ out->node_integration = data.node_integration();
++ out->node_integration_in_worker = data.node_integration_in_worker();
++ out->node_integration_in_sub_frames = data.node_integration_in_sub_frames();
++ out->enable_spellcheck = data.enable_spellcheck();
++ out->enable_plugins = data.enable_plugins();
++ out->enable_websql = data.enable_websql();
++ out->webview_tag = data.webview_tag();
++ // End Electron-specific WebPreferences.
+ out->cookie_enabled = data.cookie_enabled();
+ out->accelerated_video_decode_enabled =
+ data.accelerated_video_decode_enabled();
diff --git a/electron34/patches/patch-third__party_blink_public_common_features.h b/electron34/patches/patch-third__party_blink_public_common_features.h
new file mode 100644
index 0000000000..b8ec989490
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_features.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/features.h
+@@ -1791,6 +1791,7 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE
+ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kWebAppEnableUrlHandlers);
+ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kWebAppManifestLockScreen);
+
++BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kWebAudioAllowDenormalInProcessing);
+ // Parameters are used to control to which latency hints the feature is applied
+ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE_PARAM(
+ bool,
diff --git a/electron34/patches/patch-third__party_blink_public_common_permissions_permission__utils.h b/electron34/patches/patch-third__party_blink_public_common_permissions_permission__utils.h
new file mode 100644
index 0000000000..5d1e6e3392
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_permissions_permission__utils.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/permissions/permission_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/permissions/permission_utils.h
+@@ -64,6 +64,7 @@ enum class PermissionType {
+ AUTOMATIC_FULLSCREEN = 40,
+ HAND_TRACKING = 41,
+ WEB_APP_INSTALLATION = 42,
++ DEPRECATED_SYNC_CLIPBOARD_READ = 43,
+
+ // Always keep this at the end.
+ NUM,
diff --git a/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h b/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h
new file mode 100644
index 0000000000..514daea24d
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/renderer_preferences/renderer_preferences.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/renderer_preferences/renderer_preferences.h
+@@ -68,7 +68,7 @@ struct BLINK_COMMON_EXPORT RendererPrefe
+ UserAgentOverride user_agent_override;
+ std::string accept_languages;
+ bool send_subresource_notification{false};
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::string system_font_family_name;
+ #endif
+ #if BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h b/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h
new file mode 100644
index 0000000000..29354777d1
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/renderer_preferences/renderer_preferences_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/renderer_preferences/renderer_preferences_mojom_traits.h
+@@ -173,7 +173,7 @@ struct BLINK_COMMON_EXPORT
+ return data.send_subresource_notification;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static const std::string& system_font_family_name(
+ const ::blink::RendererPreferences& data) {
+ return data.system_font_family_name;
diff --git a/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h b/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h
new file mode 100644
index 0000000000..7efdb2861f
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/web_preferences/web_preferences.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/web_preferences/web_preferences.h
+@@ -9,6 +9,7 @@
+ #include <string>
+ #include <vector>
+
++#include "base/files/file_path.h"
+ #include "build/build_config.h"
+ #include "net/nqe/effective_connection_type.h"
+ #include "third_party/blink/public/common/common_export.h"
+@@ -442,6 +443,20 @@ struct BLINK_COMMON_EXPORT WebPreference
+ // when feature DynamicSafeAreaInsets is enabled.
+ bool dynamic_safe_area_insets_enabled = false;
+
++ // Begin Electron-specific WebPreferences.
++ bool context_isolation = false;
++ bool is_webview = false;
++ bool hidden_page = false;
++ bool offscreen = false;
++ bool node_integration = false;
++ bool node_integration_in_worker = false;
++ bool node_integration_in_sub_frames = false;
++ bool enable_spellcheck = false;
++ bool enable_plugins = false;
++ bool enable_websql = false;
++ bool webview_tag = false;
++ // End Electron-specific WebPreferences.
++
+ // We try to keep the default values the same as the default values in
+ // chrome, except for the cases where it would require lots of extra work for
+ // the embedder to use the same default value.
diff --git a/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h b/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h
new file mode 100644
index 0000000000..e7699f9cb8
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h
@@ -0,0 +1,69 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/common/web_preferences/web_preferences_mojom_traits.h
+@@ -6,6 +6,7 @@
+ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_WEB_PREFERENCES_WEB_PREFERENCES_MOJOM_TRAITS_H_
+
+ #include "build/build_config.h"
++#include "mojo/public/cpp/base/file_path_mojom_traits.h"
+ #include "mojo/public/cpp/bindings/struct_traits.h"
+ #include "net/nqe/effective_connection_type.h"
+ #include "third_party/blink/public/common/common_export.h"
+@@ -434,6 +435,52 @@ struct BLINK_COMMON_EXPORT StructTraits<
+ return r.stylus_handwriting_enabled;
+ }
+
++ // Begin Electron-specific WebPreferences.
++ static bool context_isolation(const blink::web_pref::WebPreferences& r) {
++ return r.context_isolation;
++ }
++
++ static int is_webview(const blink::web_pref::WebPreferences& r) {
++ return r.is_webview;
++ }
++
++ static bool hidden_page(const blink::web_pref::WebPreferences& r) {
++ return r.hidden_page;
++ }
++
++ static bool offscreen(const blink::web_pref::WebPreferences& r) {
++ return r.offscreen;
++ }
++
++ static bool node_integration(const blink::web_pref::WebPreferences& r) {
++ return r.node_integration;
++ }
++
++ static bool node_integration_in_worker(const blink::web_pref::WebPreferences& r) {
++ return r.node_integration_in_worker;
++ }
++
++ static bool node_integration_in_sub_frames(const blink::web_pref::WebPreferences& r) {
++ return r.node_integration_in_sub_frames;
++ }
++
++ static bool enable_spellcheck(const blink::web_pref::WebPreferences& r) {
++ return r.enable_spellcheck;
++ }
++
++ static bool enable_plugins(const blink::web_pref::WebPreferences& r) {
++ return r.enable_plugins;
++ }
++
++ static bool enable_websql(const blink::web_pref::WebPreferences& r) {
++ return r.enable_websql;
++ }
++
++ static bool webview_tag(const blink::web_pref::WebPreferences& r) {
++ return r.webview_tag;
++ }
++ // End Electron-specific WebPreferences.
++
+ static bool cookie_enabled(const blink::web_pref::WebPreferences& r) {
+ return r.cookie_enabled;
+ }
diff --git a/electron34/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom b/electron34/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom
new file mode 100644
index 0000000000..f024b80656
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/mojom/dom_storage/storage_area.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/mojom/dom_storage/storage_area.mojom
+@@ -50,7 +50,8 @@ struct KeyValue {
+ interface StorageArea {
+ // The quota for each storage area.
+ // This value is enforced in renderer processes and the browser process.
+- const uint32 kPerStorageAreaQuota = 10485760; // 10 MiB
++ // Electron's dom_storage_limits.patch increased this value from 10MiB to 100MiB
++ const uint32 kPerStorageAreaQuota = 104857600; // 100 MiB
+
+ // In the browser process we allow some overage to
+ // accommodate concurrent writes from different renderers
diff --git a/electron34/patches/patch-third__party_blink_public_mojom_page_page.mojom b/electron34/patches/patch-third__party_blink_public_mojom_page_page.mojom
new file mode 100644
index 0000000000..5cdeae83e2
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_mojom_page_page.mojom
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/mojom/page/page.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/mojom/page/page.mojom
+@@ -173,4 +173,7 @@ interface PageBroadcast {
+ // 2. The ColorProvider associated with the WebContents changes as a result
+ // of theme changes.
+ UpdateColorProviders(ColorProviderColorMaps color_provider_colors);
++
++ // Whether to enable the Renderer scheduler background throttling.
++ SetSchedulerThrottling(bool allowed);
+ };
diff --git a/electron34/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom b/electron34/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom
new file mode 100644
index 0000000000..f9f60a3fca
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/mojom/webpreferences/web_preferences.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/mojom/webpreferences/web_preferences.mojom
+@@ -9,6 +9,7 @@ import "third_party/blink/public/mojom/c
+ import "third_party/blink/public/mojom/v8_cache_options.mojom";
+ import "url/mojom/url.mojom";
+ import "mojo/public/mojom/base/string16.mojom";
++import "mojo/public/mojom/base/file_path.mojom";
+
+ enum PointerType {
+ kPointerNone = 1, // 1 << 0
+@@ -217,6 +218,19 @@ struct WebPreferences {
+ // If true, stylus handwriting recognition to text input will be available in
+ // editable input fields which are non-password type.
+ bool stylus_handwriting_enabled;
++ // Begin Electron-specific WebPreferences.
++ bool context_isolation;
++ bool is_webview;
++ bool hidden_page;
++ bool offscreen;
++ bool node_integration;
++ bool node_integration_in_worker;
++ bool node_integration_in_sub_frames;
++ bool enable_spellcheck;
++ bool enable_plugins;
++ bool enable_websql;
++ bool webview_tag;
++ // End Electron-specific WebPreferences.
+
+ // This flags corresponds to a Page's Settings' setCookieEnabled state. It
+ // only controls whether or not the "document.cookie" field is properly
diff --git a/electron34/patches/patch-third__party_blink_public_platform_platform.h b/electron34/patches/patch-third__party_blink_public_platform_platform.h
new file mode 100644
index 0000000000..b02bfe54d4
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_platform_platform.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/platform/platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/platform/platform.h
+@@ -374,7 +374,7 @@ class BLINK_PLATFORM_EXPORT Platform {
+ return nullptr;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // This is called after the thread is created, so the embedder
+ // can initiate an IPC to change its thread type (on Linux we can't
+ // increase the nice value, so we need to ask the browser process). This
+@@ -664,6 +664,9 @@ class BLINK_PLATFORM_EXPORT Platform {
+ virtual void DidStartWorkerThread() {}
+ virtual void WillStopWorkerThread() {}
+ virtual void WorkerContextCreated(const v8::Local<v8::Context>& worker) {}
++ virtual void WorkerScriptReadyForEvaluation(
++ const v8::Local<v8::Context>& worker) {}
++ virtual void WorkerContextWillDestroy(const v8::Local<v8::Context>& worker) {}
+ virtual bool AllowScriptExtensionForServiceWorker(
+ const WebSecurityOrigin& script_origin) {
+ return false;
diff --git a/electron34/patches/patch-third__party_blink_public_platform_web__content__settings__client.h b/electron34/patches/patch-third__party_blink_public_platform_web__content__settings__client.h
new file mode 100644
index 0000000000..46fab73025
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_platform_web__content__settings__client.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/platform/web_content_settings_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/platform/web_content_settings_client.h
+@@ -55,6 +55,9 @@ class WebContentSettingsClient {
+ // Controls whether access to write the clipboard is allowed for this frame.
+ virtual bool AllowWriteToClipboard() { return false; }
+
++ // Controls whether synchronous access to read the clipboard is allowed for this frame.
++ virtual bool AllowReadFromClipboardSync() { return false; }
++
+ // Controls whether to enable MutationEvents for this frame.
+ // The common use case of this method is actually to selectively disable
+ // MutationEvents, but it's been named for consistency with the rest of the
diff --git a/electron34/patches/patch-third__party_blink_public_platform_web__vector.h b/electron34/patches/patch-third__party_blink_public_platform_web__vector.h
new file mode 100644
index 0000000000..0d519b3621
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_platform_web__vector.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/platform/web_vector.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/platform/web_vector.h
+@@ -91,7 +91,7 @@ class WebVector {
+ // The vector can be populated using reserve() and emplace_back().
+ WebVector() = default;
+
+-#if defined(ARCH_CPU_64_BITS)
++#if defined(ARCH_CPU_64_BITS) || defined(__OpenBSD__)
+ // Create a vector with |size| default-constructed elements. We define
+ // a constructor with size_t otherwise we'd have a duplicate define.
+ explicit WebVector(size_t size) : data_(size) {}
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__blob.h b/electron34/patches/patch-third__party_blink_public_web_web__blob.h
new file mode 100644
index 0000000000..c4a8c2b1b2
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__blob.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_blob.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_blob.h
+@@ -67,6 +67,7 @@ class BLINK_EXPORT WebBlob {
+ void Reset();
+ void Assign(const WebBlob&);
+ WebString Uuid();
++ std::string Path();
+
+ bool IsNull() const { return private_.IsNull(); }
+
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__document__loader.h b/electron34/patches/patch-third__party_blink_public_web_web__document__loader.h
new file mode 100644
index 0000000000..c5bc25982b
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__document__loader.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_document_loader.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_document_loader.h
+@@ -38,6 +38,7 @@
+ #include "third_party/blink/public/platform/cross_variant_mojo_util.h"
+ #include "third_party/blink/public/platform/web_archive_info.h"
+ #include "third_party/blink/public/platform/web_common.h"
++#include "third_party/blink/public/platform/web_loader_freeze_mode.h"
+ #include "third_party/blink/public/platform/web_source_location.h"
+ #include "third_party/blink/public/web/web_navigation_type.h"
+
+@@ -63,6 +64,8 @@ class BLINK_EXPORT WebDocumentLoader {
+ virtual std::unique_ptr<ExtraData> Clone() = 0;
+ };
+
++ virtual void SetDefersLoading(WebLoaderFreezeMode) = 0;
++
+ static bool WillLoadUrlAsEmpty(const WebURL&);
+
+ // Returns the http referrer of original request which initited this load.
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__local__frame.h b/electron34/patches/patch-third__party_blink_public_web_web__local__frame.h
new file mode 100644
index 0000000000..73bf59f464
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__local__frame.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_local_frame.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_local_frame.h
+@@ -455,6 +455,7 @@ class BLINK_EXPORT WebLocalFrame : publi
+ mojom::EvaluationTiming,
+ mojom::LoadEventBlockingOption,
+ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified,
+ BackForwardCacheAware,
+ mojom::WantResultOption,
+ mojom::PromiseResultOption) = 0;
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__local__frame__client.h b/electron34/patches/patch-third__party_blink_public_web_web__local__frame__client.h
new file mode 100644
index 0000000000..8541e2baa0
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__local__frame__client.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_local_frame_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_local_frame_client.h
+@@ -665,6 +665,9 @@ class BLINK_EXPORT WebLocalFrameClient {
+ virtual void DidCreateScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) {}
+
++ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>,
++ int32_t world_id) {}
++
+ // WebKit is about to release its reference to a v8 context for a frame.
+ virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) {}
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__message__port__converter.h b/electron34/patches/patch-third__party_blink_public_web_web__message__port__converter.h
new file mode 100644
index 0000000000..73a7925657
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__message__port__converter.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_message_port_converter.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_message_port_converter.h
+@@ -13,6 +13,7 @@
+ namespace v8 {
+ class Isolate;
+ class Value;
++class Context;
+ } // namespace v8
+
+ namespace blink {
+@@ -25,6 +26,9 @@ class BLINK_EXPORT WebMessagePortConvert
+ // neutered, it will return nullopt.
+ static std::optional<MessagePortChannel>
+ DisentangleAndExtractMessagePortChannel(v8::Isolate*, v8::Local<v8::Value>);
++
++ BLINK_EXPORT static v8::Local<v8::Value>
++ EntangleAndInjectMessagePortChannel(v8::Local<v8::Context>, MessagePortChannel);
+ };
+
+ } // namespace blink
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__script__execution__callback.h b/electron34/patches/patch-third__party_blink_public_web_web__script__execution__callback.h
new file mode 100644
index 0000000000..38c66fbefa
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__script__execution__callback.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_script_execution_callback.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_script_execution_callback.h
+@@ -14,8 +14,17 @@ class TimeTicks;
+ class Value;
+ }
+
++namespace v8 {
++class Value;
++template <class T>
++class Local;
++}
++
+ namespace blink {
+
++template <typename T>
++class WebVector;
++
+ // Non-nullopt `base::Value` is passed to the callback if
+ // -`WantResultOption::kWantResult` or
+ // `WantResultOption::kWantResultDateAndRegexpAllowed` is used,
+@@ -43,6 +52,9 @@ namespace blink {
+ using WebScriptExecutionCallback =
+ base::OnceCallback<void(std::optional<base::Value>, base::TimeTicks)>;
+
++using WebScriptExecutionCallbackUnmodified =
++ base::OnceCallback<void(const WebVector<v8::Local<v8::Value>>&)>;
++
+ } // namespace blink
+
+ #endif // THIRD_PARTY_BLINK_PUBLIC_WEB_WEB_SCRIPT_EXECUTION_CALLBACK_H_
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__view.h b/electron34/patches/patch-third__party_blink_public_web_web__view.h
new file mode 100644
index 0000000000..9167077ceb
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__view.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_view.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_view.h
+@@ -371,6 +371,7 @@ class BLINK_EXPORT WebView {
+ // Scheduling -----------------------------------------------------------
+
+ virtual PageScheduler* Scheduler() const = 0;
++ virtual void SetSchedulerThrottling(bool allowed) {}
+
+ // Visibility -----------------------------------------------------------
+
diff --git a/electron34/patches/patch-third__party_blink_public_web_web__window__features.h b/electron34/patches/patch-third__party_blink_public_web_web__window__features.h
new file mode 100644
index 0000000000..26ca1f1984
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_public_web_web__window__features.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/public/web/web_window_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/public/web/web_window_features.h
+@@ -35,6 +35,7 @@
+
+ #include "third_party/blink/public/platform/web_string.h"
+ #include "third_party/blink/public/platform/web_vector.h"
++#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+
+ namespace blink {
+
+@@ -74,6 +75,8 @@ struct WebWindowFeatures {
+ // TODO(apaseltiner): Investigate moving this field to a non-public struct
+ // since it is only needed within //third_party/blink.
+ std::optional<WebVector<WebString>> attribution_srcs;
++
++ String raw_features;
+ };
+
+ } // namespace blink
diff --git a/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc
new file mode 100644
index 0000000000..c90fcaff63
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/bindings/core/v8/local_window_proxy.cc
+@@ -217,6 +217,7 @@ void LocalWindowProxy::Initialize() {
+ }
+
+ InstallConditionalFeatures();
++ GetFrame()->Client()->DidInstallConditionalFeatures(context, world_->GetWorldId());
+
+ if (World().IsMainWorld()) {
+ probe::DidCreateMainWorldContext(GetFrame());
diff --git a/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc
new file mode 100644
index 0000000000..e6f19855b5
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/bindings/core/v8/v8_initializer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+@@ -648,7 +648,9 @@ bool WasmJSPromiseIntegrationEnabledCall
+ execution_context);
+ }
+
+-v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
++}
++
++v8::MaybeLocal<v8::Promise> V8Initializer::HostImportModuleDynamically(
+ v8::Local<v8::Context> context,
+ v8::Local<v8::Data> v8_host_defined_options,
+ v8::Local<v8::Value> v8_referrer_resource_url,
+@@ -726,7 +728,7 @@ v8::MaybeLocal<v8::Promise> HostImportMo
+ }
+
+ // https://html.spec.whatwg.org/C/#hostgetimportmetaproperties
+-void HostGetImportMetaProperties(v8::Local<v8::Context> context,
++void V8Initializer::HostGetImportMetaProperties(v8::Local<v8::Context> context,
+ v8::Local<v8::Module> module,
+ v8::Local<v8::Object> meta) {
+ v8::Isolate* isolate = context->GetIsolate();
+@@ -769,9 +771,6 @@ std::ostream& operator<<(std::ostream& o
+ return os;
+ }
+
+-} // namespace
+-
+-// static
+ void V8Initializer::InitializeV8Common(v8::Isolate* isolate) {
+ // Set up garbage collection before setting up anything else as V8 may trigger
+ // GCs during Blink setup.
+@@ -791,9 +790,9 @@ void V8Initializer::InitializeV8Common(v
+ isolate->SetWasmJSPIEnabledCallback(WasmJSPromiseIntegrationEnabledCallback);
+ isolate->SetSharedArrayBufferConstructorEnabledCallback(
+ SharedArrayBufferConstructorEnabledCallback);
+- isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically);
++ isolate->SetHostImportModuleDynamicallyCallback(V8Initializer::HostImportModuleDynamically);
+ isolate->SetHostInitializeImportMetaObjectCallback(
+- HostGetImportMetaProperties);
++ V8Initializer::HostGetImportMetaProperties);
+ isolate->SetMetricsRecorder(std::make_shared<V8MetricsRecorder>(isolate));
+
+ #if BUILDFLAG(IS_WIN)
diff --git a/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h
new file mode 100644
index 0000000000..3b091c0c8a
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/bindings/core/v8/v8_initializer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/bindings/core/v8/v8_initializer.h
+@@ -85,6 +85,17 @@ class CORE_EXPORT V8Initializer {
+ static void PromiseRejectHandlerInMainThread(v8::PromiseRejectMessage data);
+ static void ExceptionPropagationCallback(v8::ExceptionPropagationMessage);
+
++ static v8::MaybeLocal<v8::Promise> HostImportModuleDynamically(
++ v8::Local<v8::Context> context,
++ v8::Local<v8::Data> v8_host_defined_options,
++ v8::Local<v8::Value> v8_referrer_resource_url,
++ v8::Local<v8::String> v8_specifier,
++ v8::Local<v8::FixedArray> v8_import_assertions);
++
++ static void HostGetImportMetaProperties(v8::Local<v8::Context> context,
++ v8::Local<v8::Module> module,
++ v8::Local<v8::Object> meta);
++
+ static void WasmAsyncResolvePromiseCallback(
+ v8::Isolate* isolate,
+ v8::Local<v8::Context> context,
diff --git a/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc
new file mode 100644
index 0000000000..de002c4580
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/bindings/core/v8/worker_or_worklet_script_controller.cc
+@@ -302,6 +302,7 @@ void WorkerOrWorkletScriptController::Pr
+ V8PerContextData* per_context_data = script_state_->PerContextData();
+ std::ignore =
+ per_context_data->ConstructorForType(global_scope_->GetWrapperTypeInfo());
++ Platform::Current()->WorkerScriptReadyForEvaluation(script_state_->GetContext());
+ // Inform V8 that origin trial information is now connected with the context,
+ // and V8 can extend the context with origin trial features.
+ isolate_->InstallConditionalFeatures(script_state_->GetContext());
diff --git a/electron34/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py b/electron34/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py
new file mode 100644
index 0000000000..7241c4778c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/bindings/scripts/bind_gen/style_format.py
+@@ -30,7 +30,7 @@ def init(root_src_dir, enable_style_form
+
+ # Determine //buildtools/<platform>/ directory
+ new_path_platform_suffix = ""
+- if sys.platform.startswith("linux"):
++ if sys.platform.startswith(("linux","openbsd","freebsd","netbsd")):
+ platform = "linux64"
+ exe_suffix = ""
+ elif sys.platform.startswith("darwin"):
diff --git a/electron34/patches/patch-third__party_blink_renderer_build_scripts_gperf.py b/electron34/patches/patch-third__party_blink_renderer_build_scripts_gperf.py
new file mode 100644
index 0000000000..f4be68a030
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_build_scripts_gperf.py
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/build/scripts/gperf.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/build/scripts/gperf.py
+@@ -28,24 +28,6 @@ def generate_gperf(gperf_path, gperf_inp
+ stdout=subprocess.PIPE,
+ universal_newlines=True)
+ gperf_output = gperf.communicate(gperf_input)[0]
+- # Massage gperf output to be more palatable for modern compilers.
+- # TODO(thakis): Upstream these to gperf so we don't need massaging.
+- # `register` is deprecated in C++11 and removed in C++17, so remove
+- # it from gperf's output.
+- # https://savannah.gnu.org/bugs/index.php?53028
+- gperf_output = re.sub(r'\bregister ', '', gperf_output)
+- # -Wimplicit-fallthrough needs an explicit fallthrough statement,
+- # so replace gperf's /*FALLTHROUGH*/ comment with the statement.
+- # https://savannah.gnu.org/bugs/index.php?53029
+- gperf_output = gperf_output.replace('/*FALLTHROUGH*/',
+- ' [[fallthrough]];')
+- # -Wpointer-to-int-cast warns about casting pointers to smaller ints
+- # Replace {(int)(long)&(foo), bar} with
+- # {static_cast<int>(reinterpret_cast<uintptr_t>(&(foo)), bar}
+- gperf_output = re.sub(
+- r'\(int\)\(long\)(.*?),',
+- r'static_cast<int>(reinterpret_cast<uintptr_t>(\1)),',
+- gperf_output)
+ script = 'third_party/blink/renderer/build/scripts/gperf.py'
+ return '// Generated by %s\n' % script + gperf_output
+ except OSError:
diff --git a/electron34/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py b/electron34/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py
new file mode 100644
index 0000000000..0d3be2e058
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/build/scripts/run_with_pythonpath.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/build/scripts/run_with_pythonpath.py
+@@ -22,6 +22,7 @@ def main():
+ existing_pp = (
+ os.pathsep + env['PYTHONPATH']) if 'PYTHONPATH' in env else ''
+ env['PYTHONPATH'] = os.pathsep.join(python_paths) + existing_pp
++ env['LD_LIBRARY_PATH'] = "@WRKSRC@/out/Release"
+ sys.exit(subprocess.call([sys.executable] + args, env=env))
+
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc b/electron34/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc
new file mode 100644
index 0000000000..44a949d969
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/controller/blink_initializer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/controller/blink_initializer.cc
+@@ -82,12 +82,12 @@
+ #include "third_party/blink/renderer/controller/private_memory_footprint_provider.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/renderer/controller/memory_usage_monitor_posix.h"
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/renderer/controller/highest_pmf_reporter.h"
+ #include "third_party/blink/renderer/controller/user_level_memory_pressure_signal_generator.h"
+ #endif
+@@ -256,7 +256,7 @@ void BlinkInitializer::RegisterInterface
+ main_thread_task_runner);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ binders.Add<mojom::blink::MemoryUsageMonitorLinux>(
+ ConvertToBaseRepeatingCallback(
+ CrossThreadBindRepeating(&MemoryUsageMonitorPosix::Bind)),
+@@ -303,7 +303,7 @@ void BlinkInitializer::RegisterMemoryWat
+ #endif
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Start reporting the highest private memory footprint after the first
+ // navigation.
+ HighestPmfReporter::Initialize(main_thread_task_runner);
diff --git a/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc b/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc
new file mode 100644
index 0000000000..2ab1b25fdc
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/controller/memory_usage_monitor_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/controller/memory_usage_monitor_posix.cc
+@@ -128,15 +128,17 @@ void MemoryUsageMonitorPosix::ResetFileD
+
+ void MemoryUsageMonitorPosix::SetProcFiles(base::File statm_file,
+ base::File status_file) {
++#if !BUILDFLAG(IS_BSD)
+ DCHECK(statm_file.IsValid());
+ DCHECK(status_file.IsValid());
+ DCHECK_EQ(-1, statm_fd_.get());
+ DCHECK_EQ(-1, status_fd_.get());
+ statm_fd_.reset(statm_file.TakePlatformFile());
+ status_fd_.reset(status_file.TakePlatformFile());
++#endif
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // static
+ void MemoryUsageMonitorPosix::Bind(
+ mojo::PendingReceiver<mojom::blink::MemoryUsageMonitorLinux> receiver) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h b/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h
new file mode 100644
index 0000000000..bf7671360c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/controller/memory_usage_monitor_posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/controller/memory_usage_monitor_posix.h
+@@ -13,7 +13,7 @@
+ #include "third_party/blink/renderer/controller/controller_export.h"
+ #include "third_party/blink/renderer/controller/memory_usage_monitor.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/public/mojom/memory_usage_monitor_linux.mojom-blink.h"
+ #endif
+
+@@ -22,7 +22,7 @@ namespace blink {
+ // MemoryUsageMonitor implementation for Android and Linux.
+ class CONTROLLER_EXPORT MemoryUsageMonitorPosix
+ : public MemoryUsageMonitor
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ public mojom::blink::MemoryUsageMonitorLinux
+ #endif
+@@ -30,7 +30,7 @@ class CONTROLLER_EXPORT MemoryUsageMonit
+ public:
+ MemoryUsageMonitorPosix() = default;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static void Bind(
+ mojo::PendingReceiver<mojom::blink::MemoryUsageMonitorLinux> receiver);
+ #endif
+@@ -48,7 +48,7 @@ class CONTROLLER_EXPORT MemoryUsageMonit
+ uint64_t* vm_size,
+ uint64_t* vm_hwm_size);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // mojom::MemoryUsageMonitorLinux implementations:
+ void SetProcFiles(base::File statm_file, base::File status_file) override;
+ #endif
+@@ -66,7 +66,7 @@ class CONTROLLER_EXPORT MemoryUsageMonit
+ base::ScopedFD statm_fd_;
+ base::ScopedFD status_fd_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ mojo::Receiver<mojom::blink::MemoryUsageMonitorLinux> receiver_{this};
+ #endif
+ };
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_BUILD.gn b/electron34/patches/patch-third__party_blink_renderer_core_BUILD.gn
new file mode 100644
index 0000000000..f9d9557b3a
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/BUILD.gn
+@@ -408,6 +408,7 @@ component("core") {
+ "//ui/gfx/geometry",
+ "//ui/gfx/geometry:geometry_skia",
+ "//ui/strings",
++ "//electron/build/config:generate_mas_config",
+ ]
+
+ if (is_mac) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.cc b/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.cc
new file mode 100644
index 0000000000..29679225b4
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.cc
@@ -0,0 +1,111 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/animation/animation.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/animation/animation.cc
+@@ -1269,14 +1269,7 @@ void Animation::setEffect(AnimationEffec
+ ResolveTimelineOffsets(timeline_ ? timeline_->GetTimelineRange()
+ : TimelineRange());
+
+- SetOutdated();
+-
+- // 7. Run the procedure to update an animation’s finished state for animation
+- // with the did seek flag set to false (continuous), and the synchronously
+- // notify flag set to false (async).
+- UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
+-
+- SetCompositorPending(CompositorPendingReason::kPendingEffectChange);
++ EffectInvalidated();
+
+ // Notify of a potential state change.
+ NotifyProbe();
+@@ -2373,6 +2366,26 @@ void Animation::StartAnimationOnComposit
+ timeline()->IsMonotonicallyIncreasing(), boundary_aligned);
+ }
+
++Animation::NativePaintWorkletReasons Animation::GetNativePaintWorkletReasons() {
++ if (native_paint_worklet_reasons_) {
++ return native_paint_worklet_reasons_.value();
++ }
++ NativePaintWorkletReasons reasons = kNoPaintWorklet;
++ if (KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(effect())) {
++ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled() &&
++ keyframe_effect->Affects(
++ PropertyHandle(GetCSSPropertyBackgroundColor()))) {
++ reasons |= kBackgroundColorPaintWorklet;
++ }
++ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled() &&
++ keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath()))) {
++ reasons |= kClipPathPaintWorklet;
++ }
++ }
++ native_paint_worklet_reasons_ = reasons;
++ return reasons;
++}
++
+ // TODO(crbug.com/960944): Rename to SetPendingCommit. This method handles both
+ // composited and non-composited animations. The use of 'compositor' in the name
+ // is confusing.
+@@ -2831,7 +2844,7 @@ bool Animation::Update(TimingUpdateReaso
+ // After updating the animation time if the animation is no longer current
+ // blink will no longer composite the element (see
+ // CompositingReasonFinder::RequiresCompositingFor*Animation).
+- if (!content_->IsCurrent()) {
++ if (!content_->IsCurrent() && HasActiveAnimationsOnCompositor()) {
+ SetCompositorPending(CompositorPendingReason::kPendingCancel);
+ }
+ }
+@@ -2872,6 +2885,9 @@ void Animation::UpdateIfNecessary() {
+ }
+
+ void Animation::EffectInvalidated() {
++ prior_native_paint_worklet_reasons_ = native_paint_worklet_reasons_;
++ native_paint_worklet_reasons_ = std::nullopt;
++
+ SetOutdated();
+ UpdateFinishedState(UpdateType::kContinuous, NotificationType::kAsync);
+ // FIXME: Needs to consider groups when added.
+@@ -3379,15 +3395,22 @@ bool Animation::IsInDisplayLockedSubtree
+ }
+
+ void Animation::UpdateCompositedPaintStatus() {
+- if (!NativePaintImageGenerator::NativePaintWorkletAnimationsEnabled()) {
+- return;
++ if (GetNativePaintWorkletReasons() == Animation::kNoPaintWorklet) {
++ if (!prior_native_paint_worklet_reasons_ ||
++ prior_native_paint_worklet_reasons_ == Animation::kNoPaintWorklet) {
++ return;
++ }
+ }
+
++ prior_native_paint_worklet_reasons_ = GetNativePaintWorkletReasons();
++
+ KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(content_.Get());
+ if (!keyframe_effect) {
+ return;
+ }
+
++ // TODO(crbug.com/383562308): If the target changed since the last update, we
++ // need to trigger an update for the previous and current target.
+ Element* target = keyframe_effect->EffectTarget();
+ if (!target) {
+ return;
+@@ -3396,14 +3419,7 @@ void Animation::UpdateCompositedPaintSta
+ ElementAnimations* element_animations = target->GetElementAnimations();
+ DCHECK(element_animations);
+
+- if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
+- element_animations->RecalcCompositedStatus(target,
+- GetCSSPropertyBackgroundColor());
+- }
+- if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
+- element_animations->RecalcCompositedStatus(target,
+- GetCSSPropertyClipPath());
+- }
++ element_animations->RecalcCompositedStatus(target);
+ }
+
+ void Animation::Trace(Visitor* visitor) const {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.h b/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.h
new file mode 100644
index 0000000000..e0d4f68e43
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_animation_animation.h
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/animation/animation.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/animation/animation.h
+@@ -393,6 +393,15 @@ class CORE_EXPORT Animation : public Eve
+ start_time_ = start_time;
+ }
+
++ enum NativePaintWorkletProperties {
++ kNoPaintWorklet = 0,
++ kBackgroundColorPaintWorklet = 1,
++ kClipPathPaintWorklet = 2
++ };
++
++ using NativePaintWorkletReasons = uint32_t;
++ NativePaintWorkletReasons GetNativePaintWorkletReasons();
++
+ protected:
+ DispatchEventResult DispatchEventInternal(Event&) override;
+ void AddedEventListener(const AtomicString& event_type,
+@@ -583,6 +592,13 @@ class CORE_EXPORT Animation : public Eve
+
+ Member<Event> pending_remove_event_;
+
++ // Cache whether animation can potentially have native paint worklets.
++ // In the event of the keyframes changing, we need a new evaluation, of
++ // the composited status for native paint worklet eligible properties.
++ // A change in the playState can also necessitate a composited style update.
++ std::optional<NativePaintWorkletReasons> native_paint_worklet_reasons_;
++ std::optional<NativePaintWorkletReasons> prior_native_paint_worklet_reasons_;
++
+ // TODO(crbug.com/960944): Consider reintroducing kPause and cleanup use of
+ // mutually exclusive pending_play_ and pending_pause_ flags.
+ enum class CompositorAction { kNone, kStart, kCancel };
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.cc b/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.cc
new file mode 100644
index 0000000000..99a104b073
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.cc
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/animation/element_animations.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/animation/element_animations.cc
+@@ -97,43 +97,59 @@ void ElementAnimations::RecalcComposited
+ Element& element,
+ AnimationEffect* effect) {
+ if (KeyframeEffect* keyframe_effect = DynamicTo<KeyframeEffect>(effect)) {
+- if (CompositedBackgroundColorStatus() ==
+- ElementAnimations::CompositedPaintStatus::kComposited &&
+- keyframe_effect->Affects(
+- PropertyHandle(GetCSSPropertyBackgroundColor())) &&
+- element.GetLayoutObject()) {
+- SetCompositedBackgroundColorStatus(
+- ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
+- element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+- }
+-
+- if (CompositedClipPathStatus() ==
+- ElementAnimations::CompositedPaintStatus::kComposited &&
+- keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath())) &&
+- element.GetLayoutObject()) {
+- SetCompositedClipPathStatus(
+- ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
+- element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+- // For clip paths, we also need to update the paint properties to switch
+- // from path based to mask based clip.
+- element.GetLayoutObject()->SetNeedsPaintPropertyUpdate();
++ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
++ if (CompositedBackgroundColorStatus() ==
++ ElementAnimations::CompositedPaintStatus::kComposited &&
++ keyframe_effect->Affects(
++ PropertyHandle(GetCSSPropertyBackgroundColor())) &&
++ element.GetLayoutObject()) {
++ SetCompositedBackgroundColorStatus(
++ ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
++ element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
++ }
++ }
++
++ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
++ if (CompositedClipPathStatus() ==
++ ElementAnimations::CompositedPaintStatus::kComposited &&
++ keyframe_effect->Affects(PropertyHandle(GetCSSPropertyClipPath())) &&
++ element.GetLayoutObject()) {
++ SetCompositedClipPathStatus(
++ ElementAnimations::CompositedPaintStatus::kNeedsRepaint);
++ element.GetLayoutObject()->SetShouldDoFullPaintInvalidation();
++ // For clip paths, we also need to update the paint properties to switch
++ // from path based to mask based clip.
++ element.GetLayoutObject()->SetNeedsPaintPropertyUpdate();
++ }
+ }
+ }
+ }
+
+-void ElementAnimations::RecalcCompositedStatus(Element* element,
+- const CSSProperty& property) {
+- ElementAnimations::CompositedPaintStatus status =
+- HasAnimationForProperty(property)
+- ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
+- : ElementAnimations::CompositedPaintStatus::kNoAnimation;
++void ElementAnimations::RecalcCompositedStatus(Element* element) {
++ Animation::NativePaintWorkletReasons reasons = Animation::kNoPaintWorklet;
++ for (auto& entry : Animations()) {
++ if (entry.key->CalculateAnimationPlayState() ==
++ V8AnimationPlayState::Enum::kIdle) {
++ continue;
++ }
++ reasons |= entry.key->GetNativePaintWorkletReasons();
++ }
+
+- if (property.PropertyID() == CSSPropertyID::kBackgroundColor) {
++ if (RuntimeEnabledFeatures::CompositeBGColorAnimationEnabled()) {
++ ElementAnimations::CompositedPaintStatus status =
++ reasons & Animation::kBackgroundColorPaintWorklet
++ ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
++ : ElementAnimations::CompositedPaintStatus::kNoAnimation;
+ if (SetCompositedBackgroundColorStatus(status) &&
+ element->GetLayoutObject()) {
+ element->GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+ }
+- } else if (property.PropertyID() == CSSPropertyID::kClipPath) {
++ }
++ if (RuntimeEnabledFeatures::CompositeClipPathAnimationEnabled()) {
++ ElementAnimations::CompositedPaintStatus status =
++ reasons & Animation::kClipPathPaintWorklet
++ ? ElementAnimations::CompositedPaintStatus::kNeedsRepaint
++ : ElementAnimations::CompositedPaintStatus::kNoAnimation;
+ if (SetCompositedClipPathStatus(status) && element->GetLayoutObject()) {
+ element->GetLayoutObject()->SetShouldDoFullPaintInvalidation();
+ // For clip paths, we also need to update the paint properties to switch
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.h b/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.h
new file mode 100644
index 0000000000..05f41cdc75
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_animation_element__animations.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/animation/element_animations.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/animation/element_animations.h
+@@ -120,7 +120,7 @@ class CORE_EXPORT ElementAnimations fina
+
+ void RecalcCompositedStatusForKeyframeChange(Element& element,
+ AnimationEffect* effect);
+- void RecalcCompositedStatus(Element* element, const CSSProperty& property);
++ void RecalcCompositedStatus(Element* element);
+
+ // TODO(crbug.com/1301961): Consider converting to an array or flat map of
+ // fields for paint properties that can be composited.
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc b/electron34/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc
new file mode 100644
index 0000000000..2fd65eeb66
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc
@@ -0,0 +1,51 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/css/font_face_set_document.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/css/font_face_set_document.cc
+@@ -27,6 +27,7 @@
+
+ #include "base/metrics/histogram_functions.h"
+ #include "third_party/blink/public/common/features.h"
++#include "third_party/blink/public/common/metrics/document_update_reason.h"
+ #include "third_party/blink/renderer/bindings/core/v8/dictionary.h"
+ #include "third_party/blink/renderer/core/css/css_font_face.h"
+ #include "third_party/blink/renderer/core/css/css_font_selector.h"
+@@ -141,21 +142,27 @@ FontFaceSetDocument::CSSConnectedFontFac
+ }
+
+ void FontFaceSetDocument::FireDoneEventIfPossible() {
+- if (should_fire_loading_event_) {
++ Document* d = GetDocument();
++ if (!d || !d->View()) {
+ return;
+ }
++
+ if (!ShouldSignalReady()) {
+ return;
+ }
+- Document* d = GetDocument();
+- if (!d) {
++
++ // FireDoneEventIfPossible gets scheduled via PostTask at the end of a
++ // successful style+layout update. An invalidation may have occurred in
++ // the interim, so update style and layout synchronously here.
++ d->UpdateStyleAndLayout(DocumentUpdateReason::kUnknown);
++
++ // These values can change during style+layout update, so check them
++ // *after* the call to UpdateStyleAndLayout.
++ if (should_fire_loading_event_) {
+ return;
+ }
+
+- // If the layout was invalidated in between when we thought layout
+- // was updated and when we're ready to fire the event, just wait
+- // until after the next layout before firing events.
+- if (!d->View() || d->View()->NeedsLayout()) {
++ if (!ShouldSignalReady()) {
+ return;
+ }
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_editing_build.gni b/electron34/patches/patch-third__party_blink_renderer_core_editing_build.gni
new file mode 100644
index 0000000000..f638d2a107
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_editing_build.gni
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/editing/build.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/editing/build.gni
+@@ -358,10 +358,14 @@ blink_core_sources_editing = [
+ if (is_mac) {
+ blink_core_sources_editing += [
+ "commands/smart_replace_cf.cc",
+- "kill_ring_mac.mm",
+ "substring_util.h",
+ "substring_util.mm",
+ ]
++ if (is_mas_build) {
++ blink_core_sources_editing += [ "kill_ring_mac.mm" ]
++ } else {
++ blink_core_sources_editing += [ "kill_ring_none.cc" ]
++ }
+ } else {
+ blink_core_sources_editing += [ "kill_ring_none.cc" ]
+ }
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_editing_commands_clipboard__commands.cc b/electron34/patches/patch-third__party_blink_renderer_core_editing_commands_clipboard__commands.cc
new file mode 100644
index 0000000000..69380abfad
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_editing_commands_clipboard__commands.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/editing/commands/clipboard_commands.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/editing/commands/clipboard_commands.cc
+@@ -121,7 +121,7 @@ bool ClipboardCommands::CanReadClipboard
+ return true;
+ }
+ return frame.GetContentSettingsClient() &&
+- frame.GetContentSettingsClient()->AllowReadFromClipboard();
++ frame.GetContentSettingsClient()->AllowReadFromClipboardSync();
+ }
+
+ bool ClipboardCommands::CanWriteClipboard(LocalFrame& frame,
+@@ -300,7 +300,7 @@ bool ClipboardCommands::PasteSupported(L
+ return true;
+ }
+ return frame->GetContentSettingsClient() &&
+- frame->GetContentSettingsClient()->AllowReadFromClipboard();
++ frame->GetContentSettingsClient()->AllowReadFromClipboardSync();
+ }
+
+ bool ClipboardCommands::ExecuteCopy(LocalFrame& frame,
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc b/electron34/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc
new file mode 100644
index 0000000000..ca1b0b83ba
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/editing/editing_behavior.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/editing/editing_behavior.cc
+@@ -304,7 +304,7 @@ bool EditingBehavior::ShouldInsertCharac
+ // unexpected behaviour
+ if (ch < ' ')
+ return false;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // According to XKB map no keyboard combinations with ctrl key are mapped to
+ // printable characters, however we need the filter as the DomKey/text could
+ // contain printable characters.
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc b/electron34/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc
new file mode 100644
index 0000000000..e400f75988
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/execution_context/navigator_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/execution_context/navigator_base.cc
+@@ -31,7 +31,7 @@ String GetReducedNavigatorPlatform() {
+ return "Win32";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return "";
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return "Linux x86_64";
+ #elif BUILDFLAG(IS_IOS)
+ return "iPhone";
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc
new file mode 100644
index 0000000000..5889b2d281
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/exported/web_blob.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/exported/web_blob.cc
+@@ -41,6 +41,7 @@
+ #include "third_party/blink/renderer/core/execution_context/execution_context.h"
+ #include "third_party/blink/renderer/core/fileapi/blob.h"
+ #include "third_party/blink/renderer/core/fileapi/file_backed_blob_factory_dispatcher.h"
++#include "third_party/blink/renderer/core/fileapi/file.h"
+ #include "third_party/blink/renderer/platform/blob/blob_data.h"
+ #include "third_party/blink/renderer/platform/file_metadata.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+@@ -84,6 +85,14 @@ WebString WebBlob::Uuid() {
+ return private_->Uuid();
+ }
+
++std::string WebBlob::Path() {
++ if (!private_.Get())
++ return "";
++ if (private_->IsFile() && private_->HasBackingFile())
++ return To<File>(private_.Get())->GetPath().Utf8();
++ return "";
++}
++
+ v8::Local<v8::Value> WebBlob::ToV8Value(v8::Isolate* isolate) {
+ if (!private_.Get())
+ return v8::Local<v8::Value>();
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc
new file mode 100644
index 0000000000..cf3f5025d5
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/exported/web_message_port_converter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/exported/web_message_port_converter.cc
+@@ -6,6 +6,7 @@
+
+ #include "third_party/blink/public/common/messaging/message_port_channel.h"
+ #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
++#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
+ #include "third_party/blink/renderer/bindings/core/v8/v8_message_port.h"
+ #include "third_party/blink/renderer/core/messaging/message_port.h"
+
+@@ -21,4 +22,15 @@ WebMessagePortConverter::DisentangleAndE
+ return port->Disentangle();
+ }
+
++v8::Local<v8::Value>
++WebMessagePortConverter::EntangleAndInjectMessagePortChannel(
++ v8::Local<v8::Context> context,
++ MessagePortChannel port_channel) {
++ auto* execution_context = ToExecutionContext(context);
++ CHECK(execution_context);
++ auto* port = MakeGarbageCollected<MessagePort>(*execution_context);
++ port->Entangle(std::move(port_channel));
++ return port->ToV8(context->GetIsolate(), context->Global());
++}
++
+ } // namespace blink
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
new file mode 100644
index 0000000000..9cef3c4fc6
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
@@ -0,0 +1,77 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/exported/web_view_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/exported/web_view_impl.cc
+@@ -169,6 +169,7 @@
+ #include "third_party/blink/renderer/core/view_transition/view_transition_supplement.h"
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+ #include "third_party/blink/renderer/platform/fonts/generic_font_family_settings.h"
++#include "third_party/blink/renderer/platform/graphics/color.h"
+ #include "third_party/blink/renderer/platform/graphics/image.h"
+ #include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
+ #include "third_party/blink/renderer/platform/graphics/paint/paint_record_builder.h"
+@@ -431,7 +432,7 @@ SkFontHinting RendererPreferencesToSkiaH
+ const blink::RendererPreferences& prefs) {
+ // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ if (!prefs.should_antialias_text) {
+ // When anti-aliasing is off, GTK maps all non-zero hinting settings to
+ // 'Normal' hinting so we do the same. Otherwise, folks who have 'Slight'
+@@ -1854,6 +1855,7 @@ void WebView::ApplyWebPreferences(const
+ #if BUILDFLAG(IS_MAC)
+ web_view_impl->SetMaximumLegibleScale(
+ prefs.default_maximum_page_scale_factor);
++ SetUseExternalPopupMenus(!prefs.offscreen);
+ #endif
+
+ #if BUILDFLAG(IS_WIN)
+@@ -2456,6 +2458,10 @@ void WebViewImpl::SetPageLifecycleStateI
+ TRACE_EVENT2("navigation", "WebViewImpl::SetPageLifecycleStateInternal",
+ "old_state", old_state, "new_state", new_state);
+
++ // If backgroundThrottling is disabled, the page is always visible.
++ if (!scheduler_throttling_allowed_)
++ new_state->visibility = mojom::blink::PageVisibilityState::kVisible;
++
+ bool storing_in_bfcache = new_state->is_in_back_forward_cache &&
+ !old_state->is_in_back_forward_cache;
+ bool restoring_from_bfcache = !new_state->is_in_back_forward_cache &&
+@@ -3420,7 +3426,7 @@ void WebViewImpl::UpdateFontRenderingFro
+ renderer_preferences_.use_subpixel_positioning);
+ // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)) && \
+ !BUILDFLAG(IS_ANDROID)
+ if (!renderer_preferences_.system_font_family_name.empty()) {
+ WebFontRenderStyle::SetSystemFontFamily(blink::WebString::FromUTF8(
+@@ -3988,10 +3994,23 @@ PageScheduler* WebViewImpl::Scheduler()
+ return GetPage()->GetPageScheduler();
+ }
+
++void WebViewImpl::SetSchedulerThrottling(bool allowed) {
++ DCHECK(GetPage());
++ scheduler_throttling_allowed_ = allowed;
++ GetPage()->GetPageScheduler()->SetPageVisible(!allowed || GetVisibilityState() == mojom::blink::PageVisibilityState::kVisible);
++}
++
+ void WebViewImpl::SetVisibilityState(
+ mojom::blink::PageVisibilityState visibility_state,
+ bool is_initial_state) {
+ DCHECK(GetPage());
++
++ if (!scheduler_throttling_allowed_) {
++ GetPage()->SetVisibilityState(mojom::blink::PageVisibilityState::kVisible, is_initial_state);
++ GetPage()->GetPageScheduler()->SetPageVisible(true);
++ return;
++ }
++
+ GetPage()->SetVisibilityState(visibility_state, is_initial_state);
+ // Do not throttle if the page should be painting.
+ bool is_visible =
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h
new file mode 100644
index 0000000000..1a37f9ca33
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/exported/web_view_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/exported/web_view_impl.h
+@@ -448,6 +448,7 @@ class CORE_EXPORT WebViewImpl final : pu
+ LocalDOMWindow* PagePopupWindow() const;
+
+ PageScheduler* Scheduler() const override;
++ void SetSchedulerThrottling(bool allowed) override;
+ void SetVisibilityState(mojom::blink::PageVisibilityState visibility_state,
+ bool is_initial_state) override;
+ mojom::blink::PageVisibilityState GetVisibilityState() override;
+@@ -936,6 +937,8 @@ class CORE_EXPORT WebViewImpl final : pu
+ // If true, we send IPC messages when |preferred_size_| changes.
+ bool send_preferred_size_changes_ = false;
+
++ bool scheduler_throttling_allowed_ = true;
++
+ // Whether the preferred size may have changed and |UpdatePreferredSize| needs
+ // to be called.
+ bool needs_preferred_size_update_ = true;
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_frame.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_frame.cc
new file mode 100644
index 0000000000..0a7c04ec32
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_frame.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/frame.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/frame.cc
+@@ -135,14 +135,6 @@ bool Frame::Detach(FrameDetachType type)
+
+ DCHECK(!IsDetached());
+
+- // TODO(dcheng): FocusController::FrameDetached() *should* fire JS events,
+- // hence the above check for `client_` being null. However, when this was
+- // previously placed before the `FrameDetached()` call, nothing crashes, which
+- // is suspicious. Investigate if we really don't need to fire JS events--and
+- // if we don't, move `forbid_scripts` up to be instantiated sooner and
+- // simplify this code.
+- ScriptForbiddenScope forbid_scripts;
+-
+ if (type == FrameDetachType::kRemove) {
+ if (provisional_frame_) {
+ provisional_frame_->Detach(FrameDetachType::kRemove);
+@@ -166,6 +158,14 @@ bool Frame::Detach(FrameDetachType type)
+ GetWindowProxyManager()->ClearForSwap();
+ }
+
++ // TODO(dcheng): FocusController::FrameDetached() *should* fire JS events,
++ // hence the above check for `client_` being null. However, when this was
++ // previously placed before the `FrameDetached()` call, nothing crashes, which
++ // is suspicious. Investigate if we really don't need to fire JS events--and
++ // if we don't, move `forbid_scripts` up to be instantiated sooner and
++ // simplify this code.
++ ScriptForbiddenScope forbid_scripts;
++
+ // After this, we must no longer talk to the client since this clears
+ // its owning reference back to our owning LocalFrame.
+ client_->Detached(type);
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc
new file mode 100644
index 0000000000..fbb4bc9632
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_dom_window.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_dom_window.cc
+@@ -2235,6 +2235,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isol
+ WebWindowFeatures window_features =
+ GetWindowFeaturesFromString(features, entered_window);
+
++ window_features.raw_features = features;
++
+ if (window_features.is_partitioned_popin) {
+ UseCounter::Count(*entered_window,
+ WebFeature::kPartitionedPopin_OpenAttempt);
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc
new file mode 100644
index 0000000000..5c68bf118b
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame.cc
+@@ -746,10 +746,6 @@ bool LocalFrame::DetachImpl(FrameDetachT
+ }
+ DCHECK(!view_ || !view_->IsAttached());
+
+- // This is the earliest that scripting can be disabled:
+- // - FrameLoader::Detach() can fire XHR abort events
+- // - Document::Shutdown() can dispose plugins which can run script.
+- ScriptForbiddenScope forbid_script;
+ if (!Client())
+ return false;
+
+@@ -801,6 +797,11 @@ bool LocalFrame::DetachImpl(FrameDetachT
+ DCHECK(!view_->IsAttached());
+ Client()->WillBeDetached();
+
++ // This is the earliest that scripting can be disabled:
++ // - FrameLoader::Detach() can fire XHR abort events
++ // - Document::Shutdown() can dispose plugins which can run script.
++ ScriptForbiddenScope forbid_script;
++
+ // TODO(crbug.com/729196): Trace why LocalFrameView::DetachFromLayout crashes.
+ CHECK(!view_->IsAttached());
+ SetView(nullptr);
+@@ -3135,6 +3136,7 @@ void LocalFrame::RequestExecuteScript(
+ mojom::blink::EvaluationTiming evaluation_timing,
+ mojom::blink::LoadEventBlockingOption blocking_option,
+ WebScriptExecutionCallback callback,
++ WebScriptExecutionCallbackUnmodified raw_callback,
+ BackForwardCacheAware back_forward_cache_aware,
+ mojom::blink::WantResultOption want_result_option,
+ mojom::blink::PromiseResultOption promise_behavior) {
+@@ -3167,7 +3169,7 @@ void LocalFrame::RequestExecuteScript(
+ PausableScriptExecutor::CreateAndRun(
+ script_state, std::move(script_sources), execute_script_policy,
+ user_gesture, evaluation_timing, blocking_option, want_result_option,
+- promise_behavior, std::move(callback));
++ promise_behavior, std::move(callback), std::move(raw_callback));
+ }
+
+ void LocalFrame::SetEvictCachedSessionStorageOnFreezeOrUnload() {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.h b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.h
new file mode 100644
index 0000000000..9264ca7e16
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame.h
+@@ -824,6 +824,7 @@ class CORE_EXPORT LocalFrame final
+ mojom::blink::EvaluationTiming,
+ mojom::blink::LoadEventBlockingOption,
+ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified,
+ BackForwardCacheAware back_forward_cache_aware,
+ mojom::blink::WantResultOption,
+ mojom::blink::PromiseResultOption);
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h
new file mode 100644
index 0000000000..4948f8f17d
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame_client.h
+@@ -301,6 +301,8 @@ class CORE_EXPORT LocalFrameClient : pub
+
+ virtual void DidCreateScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) = 0;
++ virtual void DidInstallConditionalFeatures(v8::Local<v8::Context>,
++ int32_t world_id) = 0;
+ virtual void WillReleaseScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) = 0;
+ virtual bool AllowScriptExtensions() = 0;
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc
new file mode 100644
index 0000000000..107eaa08ca
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame_client_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame_client_impl.cc
+@@ -294,6 +294,13 @@ void LocalFrameClientImpl::DidCreateScri
+ web_frame_->Client()->DidCreateScriptContext(context, world_id);
+ }
+
++void LocalFrameClientImpl::DidInstallConditionalFeatures(
++ v8::Local<v8::Context> context,
++ int32_t world_id) {
++ if (web_frame_->Client())
++ web_frame_->Client()->DidInstallConditionalFeatures(context, world_id);
++}
++
+ void LocalFrameClientImpl::WillReleaseScriptContext(
+ v8::Local<v8::Context> context,
+ int32_t world_id) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h
new file mode 100644
index 0000000000..220f32e42a
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame_client_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame_client_impl.h
+@@ -83,6 +83,8 @@ class CORE_EXPORT LocalFrameClientImpl f
+
+ void DidCreateScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) override;
++ void DidInstallConditionalFeatures(v8::Local<v8::Context>,
++ int32_t world_id) override;
+ void WillReleaseScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) override;
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc
new file mode 100644
index 0000000000..7778b6649e
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
+@@ -964,6 +964,7 @@ void LocalFrameMojoHandler::JavaScriptEx
+ std::move(callback).Run(value ? std::move(*value) : base::Value());
+ },
+ std::move(callback)),
++ base::NullCallback(),
+ BackForwardCacheAware::kAllow,
+ wants_result
+ ? mojom::blink::WantResultOption::kWantResultDateAndRegExpAllowed
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc
new file mode 100644
index 0000000000..4d74f0b4a3
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc
@@ -0,0 +1,69 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/pausable_script_executor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/pausable_script_executor.cc
+@@ -246,7 +246,7 @@ void PausableScriptExecutor::CreateAndRu
+ script_state, mojom::blink::UserActivationOption::kDoNotActivate,
+ mojom::blink::LoadEventBlockingOption::kDoNotBlock,
+ want_result_option, mojom::blink::PromiseResultOption::kDoNotWait,
+- std::move(callback),
++ std::move(callback), base::NullCallback(),
+ MakeGarbageCollected<V8FunctionExecutor>(
+ script_state->GetIsolate(), function, receiver, argc, argv));
+ executor->Run();
+@@ -261,10 +261,11 @@ void PausableScriptExecutor::CreateAndRu
+ mojom::blink::LoadEventBlockingOption blocking_option,
+ mojom::blink::WantResultOption want_result_option,
+ mojom::blink::PromiseResultOption promise_result_option,
+- WebScriptExecutionCallback callback) {
++ WebScriptExecutionCallback callback,
++ WebScriptExecutionCallbackUnmodified raw_callback) {
+ auto* executor = MakeGarbageCollected<PausableScriptExecutor>(
+ script_state, user_activation_option, blocking_option, want_result_option,
+- promise_result_option, std::move(callback),
++ promise_result_option, std::move(callback), std::move(raw_callback),
+ MakeGarbageCollected<WebScriptExecutor>(std::move(sources),
+ execute_script_policy));
+ switch (evaluation_timing) {
+@@ -286,6 +287,14 @@ void PausableScriptExecutor::ContextDest
+ ScriptState::Scope script_scope(script_state_);
+ std::move(callback_).Run({}, {});
+ }
++ if (raw_callback_) {
++ // Though the context is (about to be) destroyed, the callback is invoked
++ // with a vector of v8::Local<>s, which implies that creating v8::Locals
++ // is permitted. Ensure a valid scope is present for the callback.
++ // See https://crbug.com/840719.
++ ScriptState::Scope script_scope(script_state_);
++ std::move(raw_callback_).Run(Vector<v8::Local<v8::Value>>());
++ }
+ Dispose();
+ }
+
+@@ -296,10 +305,12 @@ PausableScriptExecutor::PausableScriptEx
+ mojom::blink::WantResultOption want_result_option,
+ mojom::blink::PromiseResultOption promise_result_option,
+ WebScriptExecutionCallback callback,
++ WebScriptExecutionCallbackUnmodified raw_callback,
+ Executor* executor)
+ : ExecutionContextLifecycleObserver(ExecutionContext::From(script_state)),
+ script_state_(script_state),
+ callback_(std::move(callback)),
++ raw_callback_(std::move(raw_callback)),
+ user_activation_option_(user_activation_option),
+ blocking_option_(blocking_option),
+ want_result_option_(want_result_option),
+@@ -423,6 +434,9 @@ void PausableScriptExecutor::HandleResul
+ std::move(callback_).Run(std::move(value), start_time_);
+ }
+
++ if (raw_callback_)
++ std::move(raw_callback_).Run(results);
++
+ Dispose();
+ }
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h b/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h
new file mode 100644
index 0000000000..b6446a6536
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/pausable_script_executor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/pausable_script_executor.h
+@@ -48,7 +48,8 @@ class CORE_EXPORT PausableScriptExecutor
+ mojom::blink::LoadEventBlockingOption,
+ mojom::blink::WantResultOption,
+ mojom::blink::PromiseResultOption,
+- WebScriptExecutionCallback);
++ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified);
+
+ class Executor : public GarbageCollected<Executor> {
+ public:
+@@ -65,6 +66,7 @@ class CORE_EXPORT PausableScriptExecutor
+ mojom::blink::WantResultOption,
+ mojom::blink::PromiseResultOption,
+ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified,
+ Executor*);
+ ~PausableScriptExecutor() override;
+
+@@ -83,6 +85,7 @@ class CORE_EXPORT PausableScriptExecutor
+
+ Member<ScriptState> script_state_;
+ WebScriptExecutionCallback callback_;
++ WebScriptExecutionCallbackUnmodified raw_callback_;
+ base::TimeTicks start_time_;
+ const mojom::blink::UserActivationOption user_activation_option_;
+ const mojom::blink::LoadEventBlockingOption blocking_option_;
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc
new file mode 100644
index 0000000000..e8aeefee1f
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/web_frame_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/web_frame_test.cc
+@@ -291,6 +291,7 @@ void ExecuteScriptsInMainWorld(
+ DOMWrapperWorld::kMainWorldId, sources, user_gesture,
+ mojom::blink::EvaluationTiming::kSynchronous,
+ mojom::blink::LoadEventBlockingOption::kDoNotBlock, std::move(callback),
++ base::NullCallback(),
+ BackForwardCacheAware::kAllow,
+ mojom::blink::WantResultOption::kWantResult, wait_for_promise);
+ }
+@@ -6474,7 +6475,7 @@ TEST_F(WebFrameTest, DISABLED_PositionFo
+ }
+
+ #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/1090246): Fix these tests on Fuchsia and re-enable.
+ // TODO(crbug.com/1317375): Build these tests on all platforms.
+ #define MAYBE_SelectRangeStaysHorizontallyAlignedWhenMoved \
+@@ -6883,7 +6884,7 @@ TEST_F(CompositedSelectionBoundsTest, La
+ TEST_F(CompositedSelectionBoundsTest, LargeSelectionNoScroll) {
+ RunTest("composited_selection_bounds_large_selection_noscroll.html");
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if !BUILDFLAG(IS_ANDROID)
+ TEST_F(CompositedSelectionBoundsTest, Input) {
+ web_view_helper_.GetWebView()->GetSettings()->SetDefaultFontSize(16);
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc
new file mode 100644
index 0000000000..664741e388
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/web_local_frame_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+@@ -1096,14 +1096,15 @@ void WebLocalFrameImpl::RequestExecuteSc
+ mojom::blink::EvaluationTiming evaluation_timing,
+ mojom::blink::LoadEventBlockingOption blocking_option,
+ WebScriptExecutionCallback callback,
++ WebScriptExecutionCallbackUnmodified raw_callback,
+ BackForwardCacheAware back_forward_cache_aware,
+ mojom::blink::WantResultOption want_result_option,
+ mojom::blink::PromiseResultOption promise_behavior) {
+ DCHECK(GetFrame());
+ GetFrame()->RequestExecuteScript(
+ world_id, sources, user_gesture, evaluation_timing, blocking_option,
+- std::move(callback), back_forward_cache_aware, want_result_option,
+- promise_behavior);
++ std::move(callback), std::move(raw_callback), back_forward_cache_aware,
++ want_result_option, promise_behavior);
+ }
+
+ bool WebLocalFrameImpl::IsInspectorConnected() {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h
new file mode 100644
index 0000000000..7fabb583e7
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/frame/web_local_frame_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/frame/web_local_frame_impl.h
+@@ -196,6 +196,7 @@ class CORE_EXPORT WebLocalFrameImpl fina
+ mojom::blink::EvaluationTiming,
+ mojom::blink::LoadEventBlockingOption,
+ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified,
+ BackForwardCacheAware back_forward_cache_aware,
+ mojom::blink::WantResultOption,
+ mojom::blink::PromiseResultOption) override;
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc b/electron34/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc
new file mode 100644
index 0000000000..c45350dcb4
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/fullscreen/fullscreen.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/fullscreen/fullscreen.cc
+@@ -110,7 +110,7 @@ void FullscreenElementChanged(Document&
+ // is the iframe element for the out-of-process frame that contains the
+ // fullscreen element. Hence, it must match :-webkit-full-screen-ancestor.
+ if (new_request_type & FullscreenRequestType::kForCrossProcessDescendant) {
+- DCHECK(IsA<HTMLIFrameElement>(new_element));
++ // DCHECK(IsA<HTMLIFrameElement>(new_element));
+ new_element->SetContainsFullScreenElement(true);
+ }
+ new_element->SetContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc b/electron34/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc
new file mode 100644
index 0000000000..458dd9b602
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc
+@@ -55,7 +55,7 @@ constexpr base::TimeDelta kEncodeRowSlac
+
+ /* The value is based on user statistics on Nov 2017. */
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN))
++ BUILDFLAG(IS_WIN)) || BUILDFLAG(IS_BSD)
+ const double kIdleTaskStartTimeoutDelayMs = 1000.0;
+ #else
+ const double kIdleTaskStartTimeoutDelayMs = 4000.0; // For ChromeOS, Mobile
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc b/electron34/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc
new file mode 100644
index 0000000000..f87937610e
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/inspector/inspector_memory_agent.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/inspector/inspector_memory_agent.cc
+@@ -192,7 +192,7 @@ InspectorMemoryAgent::GetSamplingProfile
+
+ Vector<String> InspectorMemoryAgent::Symbolize(
+ const WebVector<const void*>& addresses) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // TODO(alph): Move symbolization to the client.
+ Vector<const void*> addresses_to_symbolize;
+ for (const void* address : addresses) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc b/electron34/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc
new file mode 100644
index 0000000000..2245b59e63
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/layout/layout_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/layout/layout_view.cc
+@@ -73,7 +73,7 @@
+ #include "ui/display/screen_info.h"
+ #include "ui/gfx/geometry/quad_f.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+ #endif
+
+@@ -769,7 +769,7 @@ void LayoutView::LayoutRoot() {
+ intrinsic_logical_widths_ = LogicalWidth();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The font code in FontPlatformData does not have a direct connection to the
+ // document, the frame or anything from which we could retrieve the device
+ // scale factor. After using zoom for DSF, the GraphicsContext does only ever
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc b/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc
new file mode 100644
index 0000000000..d581ce216c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/loader/document_loader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/loader/document_loader.cc
+@@ -2308,6 +2308,10 @@ Frame* DocumentLoader::CalculateOwnerFra
+ scoped_refptr<SecurityOrigin> DocumentLoader::CalculateOrigin(
+ Document* owner_document) {
+ scoped_refptr<SecurityOrigin> origin;
++ bool is_standard = false;
++ std::string protocol = url_.Protocol().Ascii();
++ is_standard = url::IsStandard(
++ protocol.data(), url::Component(0, static_cast<int>(protocol.size())));
+ StringBuilder debug_info_builder;
+ // Whether the origin is newly created within this call, instead of copied
+ // from an existing document's origin or from `origin_to_commit_`. If this is
+@@ -2361,6 +2365,10 @@ scoped_refptr<SecurityOrigin> DocumentLo
+ // the end of this function.
+ origin = origin_to_commit_;
+ debug_info_builder.Append("use_origin_to_commit");
++ } else if (!SecurityOrigin::ShouldUseInnerURL(url_) &&
++ !is_standard) {
++ debug_info_builder.Append("use_url_with_non_standard_scheme");
++ origin = SecurityOrigin::Create(url_);
+ } else {
+ debug_info_builder.Append("use_url_with_precursor");
+ // Otherwise, create an origin that propagates precursor information
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.h b/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.h
new file mode 100644
index 0000000000..94b560ea58
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_loader_document__loader.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/loader/document_loader.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/loader/document_loader.h
+@@ -325,7 +325,7 @@ class CORE_EXPORT DocumentLoader : publi
+ std::optional<scheduler::TaskAttributionId>
+ soft_navigation_heuristics_task_id);
+
+- void SetDefersLoading(LoaderFreezeMode);
++ void SetDefersLoading(LoaderFreezeMode) override;
+
+ DocumentLoadTiming& GetTiming() { return document_load_timing_; }
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h b/electron34/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h
new file mode 100644
index 0000000000..91f7e12cc7
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/loader/empty_clients.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/loader/empty_clients.h
+@@ -415,6 +415,8 @@ class CORE_EXPORT EmptyLocalFrameClient
+
+ void DidCreateScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) override {}
++ void DidInstallConditionalFeatures(v8::Local<v8::Context>,
++ int32_t world_id) override {}
+ void WillReleaseScriptContext(v8::Local<v8::Context>,
+ int32_t world_id) override {}
+ bool AllowScriptExtensions() override { return false; }
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_origin__trials_origin__trial__context.cc b/electron34/patches/patch-third__party_blink_renderer_core_origin__trials_origin__trial__context.cc
new file mode 100644
index 0000000000..ad8baee483
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_origin__trials_origin__trial__context.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/origin_trials/origin_trial_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/origin_trials/origin_trial_context.cc
+@@ -551,7 +551,7 @@ bool OriginTrialContext::CanEnableTrialF
+ }
+
+ if (trial_name == "TranslationAPI") {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(features::kEnableTranslationAPI);
+ #else
+ return false;
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc
new file mode 100644
index 0000000000..11a47897d8
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/paint/paint_layer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/paint/paint_layer.cc
+@@ -120,7 +120,7 @@ namespace blink {
+
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ struct SameSizeAsPaintLayer : GarbageCollected<PaintLayer>, DisplayItemClient {
+ // The bit fields may fit into the machine word of DisplayItemClient which
+ // has only 8-bit data.
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder.cc b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder.cc
new file mode 100644
index 0000000000..ac00b40132
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder.cc
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/paint/paint_property_tree_builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/paint/paint_property_tree_builder.cc
+@@ -1834,32 +1834,25 @@ void FragmentPaintPropertyTreeBuilder::U
+ properties_->ViewTransitionEffect()
+ ->SelfOrAncestorParticipatesInViewTransition();
+
+- const bool is_view_transition_element =
++ const bool needs_view_transition_effect =
+ full_context_.direct_compositing_reasons &
+ CompositingReason::kViewTransitionElement;
+
+- const bool needs_view_transition_effect =
+- is_view_transition_element ||
+- (object_.IsLayoutView() && !IsInLocalSubframe(object_) &&
+- !object_.GetDocument().IsSVGDocument());
+-
+ if (needs_view_transition_effect) {
+ auto* transition =
+ ViewTransitionUtils::GetTransition(object_.GetDocument());
+- DCHECK(!is_view_transition_element || transition);
++ DCHECK(transition);
+
+ EffectPaintPropertyNode::State state;
++ state.direct_compositing_reasons =
++ CompositingReason::kViewTransitionElement;
+ state.local_transform_space = context_.current.transform;
+ state.output_clip = context_.current.clip;
+ state.compositor_element_id = CompositorElementIdFromUniqueObjectId(
+ object_.UniqueId(),
+ CompositorElementIdNamespace::kViewTransitionElement);
+- if (is_view_transition_element) {
+- state.direct_compositing_reasons =
+- CompositingReason::kViewTransitionElement;
+- state.view_transition_element_resource_id =
+- transition->GetSnapshotId(object_);
+- }
++ state.view_transition_element_resource_id =
++ transition->GetSnapshotId(object_);
+
+ // The value isn't set on the root, since clipping rules are different for
+ // the root view transition element.
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.cc b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.cc
new file mode 100644
index 0000000000..ea601bb636
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.cc
@@ -0,0 +1,146 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/paint/paint_property_tree_builder_test.cc
+@@ -77,17 +77,6 @@ const ScrollPaintPropertyNode* PaintProp
+ return document->GetLayoutView()->FirstFragment().PaintProperties()->Scroll();
+ }
+
+-const EffectPaintPropertyNode* PaintPropertyTreeBuilderTest::DocEffect(
+- const Document* document) {
+- if (!document) {
+- document = &GetDocument();
+- }
+- return document->GetLayoutView()
+- ->FirstFragment()
+- .PaintProperties()
+- ->ViewTransitionEffect();
+-}
+-
+ const ObjectPaintProperties*
+ PaintPropertyTreeBuilderTest::PaintPropertiesForElement(const char* name) {
+ return GetDocument()
+@@ -1058,7 +1047,8 @@ TEST_P(PaintPropertyTreeBuilderTest, Eff
+ PaintPropertiesForElement("groupWithOpacity");
+ EXPECT_EQ(0.6f, group_with_opacity_properties->Effect()->Opacity());
+ EXPECT_EQ(svg_clip, group_with_opacity_properties->Effect()->OutputClip());
+- EXPECT_EQ(DocEffect(), group_with_opacity_properties->Effect()->Parent());
++ EXPECT_EQ(&EffectPaintPropertyNode::Root(),
++ group_with_opacity_properties->Effect()->Parent());
+
+ EXPECT_EQ(nullptr, PaintPropertiesForElement("rectWithoutOpacity"));
+
+@@ -4762,7 +4752,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Ref
+ filter_properties->PaintOffsetTranslation()->Parent());
+ EXPECT_EQ(gfx::Vector2dF(8, 8),
+ filter_properties->PaintOffsetTranslation()->Get2dTranslation());
+- EXPECT_EQ(filter_properties->Filter()->Parent(), DocEffect());
++ EXPECT_TRUE(filter_properties->Filter()->Parent()->IsRoot());
+ EXPECT_EQ(filter_properties->PaintOffsetTranslation(),
+ &filter_properties->Filter()->LocalTransformSpace());
+ EXPECT_EQ(DocContentClip(), filter_properties->Filter()->OutputClip());
+@@ -4775,7 +4765,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Sim
+ const ObjectPaintProperties* filter_properties =
+ GetLayoutObjectByElementId("filter")->FirstFragment().PaintProperties();
+ EXPECT_FALSE(filter_properties->PaintOffsetTranslation());
+- EXPECT_EQ(filter_properties->Filter()->Parent(), DocEffect());
++ EXPECT_TRUE(filter_properties->Filter()->Parent()->IsRoot());
+ EXPECT_FALSE(filter_properties->PixelMovingFilterClipExpander());
+ EXPECT_EQ(DocScrollTranslation(),
+ &filter_properties->Filter()->LocalTransformSpace());
+@@ -4792,7 +4782,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Pix
+
+ auto* filter = filter_properties->Filter();
+ ASSERT_TRUE(filter);
+- EXPECT_EQ(filter->Parent(), DocEffect());
++ EXPECT_TRUE(filter->Parent()->IsRoot());
+ EXPECT_TRUE(filter->HasFilterThatMovesPixels());
+ EXPECT_EQ(DocScrollTranslation(), &filter->LocalTransformSpace());
+ EXPECT_EQ(DocContentClip(), filter->OutputClip());
+@@ -4847,7 +4837,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Fil
+ GetLayoutObjectByElementId("clip")->FirstFragment().PaintProperties();
+ const ObjectPaintProperties* filter_properties =
+ GetLayoutObjectByElementId("filter")->FirstFragment().PaintProperties();
+- EXPECT_TRUE(DocEffect());
++ EXPECT_TRUE(filter_properties->Filter()->Parent()->IsRoot());
+ EXPECT_EQ(clip_properties->OverflowClip(),
+ filter_properties->Filter()->OutputClip());
+ EXPECT_EQ(DocScrollTranslation(),
+@@ -5089,7 +5079,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Mas
+
+ EXPECT_EQ(properties->Effect(),
+ &target->FirstFragment().LocalBorderBoxProperties().Effect());
+- EXPECT_TRUE(DocEffect());
++ EXPECT_TRUE(properties->Effect()->Parent()->IsRoot());
+ EXPECT_EQ(SkBlendMode::kSrcOver, properties->Effect()->BlendMode());
+ EXPECT_EQ(mask_clip->Parent(), properties->Effect()->OutputClip());
+
+@@ -5118,7 +5108,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Mas
+
+ EXPECT_EQ(properties->Effect(),
+ &target->FirstFragment().LocalBorderBoxProperties().Effect());
+- EXPECT_TRUE(DocEffect());
++ EXPECT_TRUE(properties->Effect()->Parent()->IsRoot());
+ EXPECT_EQ(SkBlendMode::kSrcOver, properties->Effect()->BlendMode());
+ EXPECT_EQ(mask_clip->Parent(), properties->Effect()->OutputClip());
+
+@@ -5172,7 +5162,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Mas
+
+ EXPECT_EQ(target_properties->Effect(),
+ &target->FirstFragment().LocalBorderBoxProperties().Effect());
+- EXPECT_TRUE(DocEffect());
++ EXPECT_TRUE(target_properties->Effect()->Parent()->IsRoot());
+ EXPECT_EQ(SkBlendMode::kSrcOver, target_properties->Effect()->BlendMode());
+ EXPECT_EQ(nullptr, target_properties->Effect()->OutputClip());
+
+@@ -5215,7 +5205,7 @@ TEST_P(PaintPropertyTreeBuilderTest, Mas
+
+ EXPECT_EQ(properties->Effect(),
+ &target->FirstFragment().LocalBorderBoxProperties().Effect());
+- EXPECT_TRUE(DocEffect());
++ EXPECT_TRUE(properties->Effect()->Parent()->IsRoot());
+ EXPECT_EQ(SkBlendMode::kSrcOver, properties->Effect()->BlendMode());
+ EXPECT_EQ(mask_clip->Parent(), properties->Effect()->OutputClip());
+
+@@ -5316,7 +5306,8 @@ TEST_P(PaintPropertyTreeBuilderTest, SVG
+ ASSERT_TRUE(svg_root_properties->Effect());
+ EXPECT_EQ(SkBlendMode::kSrcOver, svg_root_properties->Effect()->BlendMode());
+
+- EXPECT_EQ(DocEffect(), svg_root_properties->Effect()->Parent());
++ EXPECT_EQ(&EffectPaintPropertyNode::Root(),
++ svg_root_properties->Effect()->Parent());
+ EXPECT_EQ(svg_root_properties->Effect(), rect_properties->Effect()->Parent());
+ }
+
+@@ -5338,7 +5329,8 @@ TEST_P(PaintPropertyTreeBuilderTest, SVG
+ ASSERT_TRUE(svg_root_properties->Effect());
+ EXPECT_EQ(SkBlendMode::kMultiply, svg_root_properties->Effect()->BlendMode());
+
+- EXPECT_EQ(DocEffect(), html_properties->Effect()->Parent());
++ EXPECT_EQ(&EffectPaintPropertyNode::Root(),
++ html_properties->Effect()->Parent());
+ EXPECT_EQ(html_properties->Effect(), svg_root_properties->Effect()->Parent());
+ }
+
+@@ -6454,7 +6446,7 @@ TEST_P(PaintPropertyTreeBuilderTest, SVG
+
+ const auto* effect = properties->Effect();
+ ASSERT_NE(nullptr, effect);
+- EXPECT_EQ(DocEffect(), effect->Parent());
++ EXPECT_EQ(&EffectPaintPropertyNode::Root(), effect->Parent());
+ EXPECT_EQ(transform, &effect->LocalTransformSpace());
+ EXPECT_EQ(clip_path_clip, effect->OutputClip());
+ EXPECT_EQ(SkBlendMode::kSrcOver, effect->BlendMode());
+@@ -6492,7 +6484,7 @@ TEST_P(PaintPropertyTreeBuilderTest, SVG
+ const auto* effect = properties->Effect();
+ ASSERT_NE(nullptr, effect);
+ EXPECT_TRUE(effect->HasDirectCompositingReasons());
+- EXPECT_EQ(DocEffect(), effect->Parent());
++ EXPECT_EQ(&EffectPaintPropertyNode::Root(), effect->Parent());
+ EXPECT_EQ(transform, &effect->LocalTransformSpace());
+ EXPECT_EQ(clip_path_clip, effect->OutputClip());
+ EXPECT_EQ(SkBlendMode::kSrcOver, effect->BlendMode());
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.h b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.h
new file mode 100644
index 0000000000..68237d2cc9
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_paint_paint__property__tree__builder__test.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/paint/paint_property_tree_builder_test.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/paint/paint_property_tree_builder_test.h
+@@ -34,7 +34,6 @@ class PaintPropertyTreeBuilderTest : pub
+ const Document* = nullptr);
+ const ClipPaintPropertyNode* DocContentClip(const Document* = nullptr);
+ const ScrollPaintPropertyNode* DocScroll(const Document* = nullptr);
+- const EffectPaintPropertyNode* DocEffect(const Document* = nullptr);
+
+ // Return the local border box's paint offset. For more details, see
+ // ObjectPaintProperties::localBorderBoxProperties().
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc b/electron34/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc
new file mode 100644
index 0000000000..e7190b7c70
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/scheduler_integration_tests/virtual_time_test.cc
+@@ -63,6 +63,7 @@ class VirtualTimeTest : public SimTest {
+ mojom::blink::LoadEventBlockingOption::kDoNotBlock,
+ WTF::BindOnce(&ScriptExecutionCallbackHelper::Completed,
+ base::Unretained(&callback_helper)),
++ base::NullCallback(),
+ BackForwardCacheAware::kAllow,
+ mojom::blink::WantResultOption::kWantResult,
+ mojom::blink::PromiseResultOption::kDoNotWait);
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc b/electron34/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc
new file mode 100644
index 0000000000..cb987dc3c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
+@@ -148,7 +148,7 @@ bool ScrollbarThemeAura::SupportsDragSna
+ // is true for at least GTK and QT apps).
+ // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
+@@ -423,7 +423,7 @@ bool ScrollbarThemeAura::ShouldCenterOnT
+ const WebMouseEvent& event) const {
+ // TODO(crbug.com/1052397): Revisit once build flag switch of lacros-chrome is
+ // complete.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ if (event.button == WebPointerProperties::Button::kMiddle)
+ return true;
+ #endif
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_view__transition_view__transition__test.cc b/electron34/patches/patch-third__party_blink_renderer_core_view__transition_view__transition__test.cc
new file mode 100644
index 0000000000..6432e049cf
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_view__transition_view__transition__test.cc
@@ -0,0 +1,125 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/view_transition/view_transition_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/view_transition/view_transition_test.cc
+@@ -22,6 +22,7 @@
+ #include "third_party/blink/renderer/core/dom/dom_token_list.h"
+ #include "third_party/blink/renderer/core/dom/element.h"
+ #include "third_party/blink/renderer/core/dom/node_computed_style.h"
++#include "third_party/blink/renderer/core/dom/layout_tree_builder_traversal.h"
+ #include "third_party/blink/renderer/core/dom/pseudo_element.h"
+ #include "third_party/blink/renderer/core/frame/frame_test_helpers.h"
+ #include "third_party/blink/renderer/core/html/html_element.h"
+@@ -32,7 +33,6 @@
+ #include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
+ #include "third_party/blink/renderer/core/navigation_api/navigation_api.h"
+ #include "third_party/blink/renderer/core/navigation_api/navigation_history_entry.h"
+-#include "third_party/blink/renderer/core/paint/paint_and_raster_invalidation_test.h"
+ #include "third_party/blink/renderer/core/paint/paint_layer.h"
+ #include "third_party/blink/renderer/core/style/computed_style_constants.h"
+ #include "third_party/blink/renderer/core/testing/core_unit_test_helper.h"
+@@ -706,100 +706,6 @@ TEST_P(ViewTransitionTest, ViewTransitio
+ UpdateAllLifecyclePhasesAndFinishDirectives();
+ }
+
+-namespace {
+-void AssertOnlyViewTransitionElementsInvalidated(
+- PaintArtifactCompositor* compositor) {
+- const char kViewTransition[] = "view-transition";
+- const char kLayoutViewTransition[] = "ViewTransition";
+- compositor->ForAllContentLayersForTesting(
+- [&](ContentLayerClientImpl* client) {
+- if (::testing::Matcher<std::string>(
+- ::testing::ContainsRegex(kViewTransition))
+- .Matches(client->Layer().DebugName())) {
+- return;
+- }
+- if (::testing::Matcher<std::string>(
+- ::testing::ContainsRegex(kLayoutViewTransition))
+- .Matches(client->Layer().DebugName())) {
+- return;
+- }
+- auto* tracking = client->GetRasterInvalidator().GetTracking();
+- EXPECT_FALSE(tracking->HasInvalidations())
+- << client->Layer().DebugName();
+- for (const auto& invalidation : tracking->Invalidations()) {
+- LOG(ERROR) << "Invalidation " << invalidation;
+- }
+- });
+-}
+-} // namespace
+-
+-TEST_P(ViewTransitionTest, NoInvalidationOnRoot) {
+- SetHtmlInnerHTML(R"HTML(
+- <style>
+- /* TODO(crbug.com/1336462): html.css is parsed before runtime flags are enabled */
+- html { view-transition-name: root; backgrond: grey; }
+- #element {
+- width: 100px;
+- height: 100px;
+- view-transition-name: shared;
+- will-change: transform;
+- }
+- </style>
+-
+- <div id=element></div>
+- <div>test</div>
+- )HTML");
+-
+- // Run all lifecycle phases to ensure paint is clean.
+- UpdateAllLifecyclePhasesForTest();
+-
+- GetDocument().View()->SetTracksRasterInvalidations(true);
+-
+- ScriptState* script_state = GetScriptState();
+- ScriptState::Scope scope(script_state);
+-
+- auto start_setup_lambda =
+- [](const v8::FunctionCallbackInfo<v8::Value>& info) {};
+-
+- // This callback sets the elements for the start phase of the transition.
+- auto start_setup_callback =
+- v8::Function::New(script_state->GetContext(), start_setup_lambda, {})
+- .ToLocalChecked();
+-
+- auto* compositor = GetLocalFrameView()->GetPaintArtifactCompositor();
+- auto* transition = ViewTransitionSupplement::startViewTransition(
+- script_state, GetDocument(),
+- V8ViewTransitionCallback::Create(start_setup_callback),
+- ASSERT_NO_EXCEPTION);
+-
+- UpdateAllLifecyclePhasesForTest();
+- {
+- SCOPED_TRACE("old dom capture");
+- AssertOnlyViewTransitionElementsInvalidated(compositor);
+- }
+-
+- // Finish the prepare phase, mutate the DOM and start the animation.
+- UpdateAllLifecyclePhasesAndFinishDirectives();
+- test::RunPendingTasks();
+- EXPECT_EQ(GetState(transition), State::kAnimating);
+-
+- // The start phase should generate pseudo elements for rendering new live
+- // content.
+- UpdateAllLifecyclePhasesAndFinishDirectives();
+- {
+- SCOPED_TRACE("animation started");
+- AssertOnlyViewTransitionElementsInvalidated(compositor);
+- }
+-
+- // Finish the animations which should remove the pseudo element tree.
+- FinishTransition();
+- UpdateAllLifecyclePhasesAndFinishDirectives();
+- {
+- SCOPED_TRACE("transition finished");
+- AssertOnlyViewTransitionElementsInvalidated(compositor);
+- }
+-}
+-
+ TEST_P(ViewTransitionTest, InspectorStyleResolver) {
+ SetHtmlInnerHTML(R"HTML(
+ <style>
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc b/electron34/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc
new file mode 100644
index 0000000000..21519cbb40
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/workers/worker_thread.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/workers/worker_thread.cc
+@@ -762,6 +762,12 @@ void WorkerThread::PrepareForShutdownOnW
+ }
+ pause_handle_.reset();
+
++ {
++ v8::HandleScope handle_scope(GetIsolate());
++ Platform::Current()->WorkerContextWillDestroy(
++ GlobalScope()->ScriptController()->GetContext());
++ }
++
+ if (WorkerThreadDebugger* debugger = WorkerThreadDebugger::From(GetIsolate()))
+ debugger->WorkerThreadDestroyed(this);
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h b/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h
new file mode 100644
index 0000000000..b28e75f7d8
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/xml/xslt_processor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/xml/xslt_processor.h
+@@ -77,7 +77,11 @@ class XSLTProcessor final : public Scrip
+
+ void reset();
+
++#if (LIBXML_VERSION >= 21200)
+ static void ParseErrorFunc(void* user_data, const xmlError*);
++#else
++ static void ParseErrorFunc(void* user_data, xmlError*);
++#endif
+ static void GenericErrorFunc(void* user_data, const char* msg, ...);
+
+ // Only for libXSLT callbacks
diff --git a/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc b/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc
new file mode 100644
index 0000000000..c54ffdf58d
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/core/xml/xslt_processor_libxslt.cc
+@@ -71,7 +71,11 @@ void XSLTProcessor::GenericErrorFunc(voi
+ // It would be nice to do something with this error message.
+ }
+
++#if (LIBXML_VERSION >= 21200)
+ void XSLTProcessor::ParseErrorFunc(void* user_data, const xmlError* error) {
++#else
++void XSLTProcessor::ParseErrorFunc(void* user_data, xmlError* error) {
++#endif
+ FrameConsole* console = static_cast<FrameConsole*>(user_data);
+ if (!console)
+ return;
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc b/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc
new file mode 100644
index 0000000000..ba92b0273c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/media/audio/audio_device_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/media/audio/audio_device_factory.cc
+@@ -35,7 +35,7 @@ namespace {
+ AudioDeviceFactory* g_factory_override = nullptr;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Due to driver deadlock issues on Windows (http://crbug/422522) there is a
+ // chance device authorization response is never received from the browser side.
+ // In this case we will time out, to avoid renderer hang forever waiting for
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc b/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc
new file mode 100644
index 0000000000..a719b3208b
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_manager_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_manager_test.cc
+@@ -873,7 +873,7 @@ TEST_F(AudioRendererMixerManagerTest, Mi
+ mixer->get_output_params_for_testing().sample_rate());
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Use 10 ms buffer (441 frames per buffer).
+ EXPECT_EQ(output_sample_rate / 100,
+ mixer->get_output_params_for_testing().frames_per_buffer());
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_rtc__data__channel.cc b/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_rtc__data__channel.cc
new file mode 100644
index 0000000000..5f17456706
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_rtc__data__channel.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/peerconnection/rtc_data_channel.cc
+@@ -542,6 +542,7 @@ void RTCDataChannel::send(Blob* data, Ex
+ pending_messages_.push_back(message);
+ }
+
++#undef close
+ void RTCDataChannel::close() {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (state_ == webrtc::DataChannelInterface::kClosing ||
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc b/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc
new file mode 100644
index 0000000000..9c2d0bdc0d
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc
+@@ -304,7 +304,7 @@ TEST_F(WebRtcAudioRendererTest, DISABLED
+ SetupRenderer(kDefaultOutputDeviceId);
+ renderer_proxy_->Start();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_APPLE) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ static const int kExpectedBufferSize = kHardwareSampleRate / 100;
+ #elif BUILDFLAG(IS_ANDROID)
+ static const int kExpectedBufferSize = 2 * kHardwareSampleRate / 100;
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__global__scope.cc b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__global__scope.cc
new file mode 100644
index 0000000000..e573d4c960
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__global__scope.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webaudio/audio_worklet_global_scope.cc
+@@ -23,6 +23,7 @@
+ #include "third_party/blink/renderer/modules/webaudio/audio_worklet_processor.h"
+ #include "third_party/blink/renderer/modules/webaudio/audio_worklet_processor_definition.h"
+ #include "third_party/blink/renderer/modules/webaudio/cross_thread_audio_worklet_processor_info.h"
++#include "third_party/blink/renderer/platform/audio/denormal_disabler.h"
+ #include "third_party/blink/renderer/platform/bindings/callback_method_retriever.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+
+@@ -34,6 +35,9 @@ AudioWorkletGlobalScope::AudioWorkletGlo
+ : WorkletGlobalScope(std::move(creation_params),
+ thread->GetWorkerReportingProxy(),
+ thread) {
++ // Disable denormals for performance.
++ DenormalModifier::DisableDenormals();
++
+ // Audio is prone to jank introduced by e.g. the garbage collector. Workers
+ // are generally put in a background mode (as they are non-visible). Audio is
+ // an exception here, requiring low-latency behavior similar to any visible
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.cc b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.cc
new file mode 100644
index 0000000000..ced99d1bd7
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.cc
@@ -0,0 +1,52 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webaudio/audio_worklet_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webaudio/audio_worklet_handler.cc
+@@ -29,6 +29,7 @@
+ #include "third_party/blink/renderer/modules/webaudio/cross_thread_audio_worklet_processor_info.h"
+ #include "third_party/blink/renderer/platform/audio/audio_bus.h"
+ #include "third_party/blink/renderer/platform/audio/audio_utilities.h"
++#include "third_party/blink/renderer/platform/audio/denormal_disabler.h"
+ #include "third_party/blink/renderer/platform/bindings/exception_messages.h"
+ #include "third_party/blink/renderer/platform/heap/persistent.h"
+ #include "third_party/blink/renderer/platform/instrumentation/tracing/trace_event.h"
+@@ -52,7 +53,9 @@ AudioWorkletHandler::AudioWorkletHandler
+ const AudioWorkletNodeOptions* options)
+ : AudioHandler(kNodeTypeAudioWorklet, node, sample_rate),
+ name_(name),
+- param_handler_map_(param_handler_map) {
++ param_handler_map_(param_handler_map),
++ allow_denormal_in_processing_(base::FeatureList::IsEnabled(
++ features::kWebAudioAllowDenormalInProcessing)) {
+ DCHECK(IsMainThread());
+
+ for (const auto& param_name : param_handler_map_.Keys()) {
+@@ -112,7 +115,7 @@ scoped_refptr<AudioWorkletHandler> Audio
+ param_handler_map, options));
+ }
+
+-void AudioWorkletHandler::Process(uint32_t frames_to_process) {
++void AudioWorkletHandler::ProcessInternal(uint32_t frames_to_process) {
+ DCHECK(Context()->IsAudioThread());
+
+ TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("webaudio.audionode"),
+@@ -175,6 +178,15 @@ void AudioWorkletHandler::Process(uint32
+ }
+ }
+
++void AudioWorkletHandler::Process(uint32_t frames_to_process) {
++ if (allow_denormal_in_processing_) {
++ DenormalEnabler denormal_enabler;
++ ProcessInternal(frames_to_process);
++ } else {
++ ProcessInternal(frames_to_process);
++ }
++}
++
+ void AudioWorkletHandler::CheckNumberOfChannelsForInput(AudioNodeInput* input) {
+ DCHECK(Context()->IsAudioThread());
+ Context()->AssertGraphOwner();
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.h b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.h
new file mode 100644
index 0000000000..1cbfd28e52
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__handler.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webaudio/audio_worklet_handler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webaudio/audio_worklet_handler.h
+@@ -68,6 +68,10 @@ class AudioWorkletHandler final : public
+ HashMap<String, scoped_refptr<AudioParamHandler>> param_handler_map,
+ const AudioWorkletNodeOptions*);
+
++ // Used to avoid code duplication when using scoped objects that affect
++ // `Process`.
++ void ProcessInternal(uint32_t frames_to_process);
++
+ String name_;
+
+ double tail_time_ = std::numeric_limits<double>::infinity();
+@@ -102,6 +106,9 @@ class AudioWorkletHandler final : public
+ // when a processor stops invoking the user-defined `process()` callback.
+ bool is_processor_active_ = true;
+
++ // Cached feature flag value
++ const bool allow_denormal_in_processing_;
++
+ base::WeakPtrFactory<AudioWorkletHandler> weak_ptr_factory_{this};
+ };
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc
new file mode 100644
index 0000000000..5f69c7e24b
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
+@@ -469,7 +469,7 @@ class AudioWorkletThreadPriorityTest
+
+ // TODO(crbug.com/1022888): The worklet thread priority is always NORMAL
+ // on OS_LINUX and OS_CHROMEOS regardless of the thread priority setting.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (expected_priority == base::ThreadPriorityForTest::kRealtimeAudio ||
+ expected_priority == base::ThreadPriorityForTest::kDisplay) {
+ EXPECT_EQ(actual_priority, base::ThreadPriorityForTest::kNormal);
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_script__processor__handler.h b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_script__processor__handler.h
new file mode 100644
index 0000000000..82e0f1febe
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webaudio_script__processor__handler.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webaudio/script_processor_handler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webaudio/script_processor_handler.h
+@@ -65,6 +65,7 @@ class ScriptProcessorHandler final : pub
+ uint32_t number_of_output_channels,
+ const HeapVector<Member<AudioBuffer>>& input_buffers,
+ const HeapVector<Member<AudioBuffer>>& output_buffers);
++
+ double TailTime() const override;
+ double LatencyTime() const override;
+ bool RequiresTailProcessing() const final;
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc b/electron34/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc
new file mode 100644
index 0000000000..bd06f376ef
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+@@ -1432,12 +1432,6 @@ void WebGLRenderingContextBase::Initiali
+ ->GetCapabilities()
+ .mesa_framebuffer_flip_y;
+
+- // If WebGL 2, the PRIMITIVE_RESTART_FIXED_INDEX should be always enabled.
+- // See the section <Primitive Restart is Always Enabled> in WebGL 2 spec:
+- // https://www.khronos.org/registry/webgl/specs/latest/2.0/#4.1.4
+- if (IsWebGL2())
+- ContextGL()->Enable(GL_PRIMITIVE_RESTART_FIXED_INDEX);
+-
+ // This ensures that the context has a valid "lastFlushID" and won't be
+ // mistakenly identified as the "least recently used" context.
+ ContextGL()->Flush();
+@@ -6315,7 +6309,7 @@ void WebGLRenderingContextBase::TexImage
+ constexpr bool kAllowZeroCopyImages = true;
+ #endif
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/1175907): Only TexImage2D seems to work with the GPU path on
+ // Android M -- appears to work fine on R, but to avoid regressions in <video>
+ // limit to TexImage2D only for now. Fails conformance test on Nexus 5X:
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc b/electron34/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc
new file mode 100644
index 0000000000..bd09fec11a
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/webgpu/gpu_queue.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/webgpu/gpu_queue.cc
+@@ -788,7 +788,7 @@ bool GPUQueue::CopyFromCanvasSourceImage
+ // on linux platform.
+ // TODO(crbug.com/1424119): using a webgpu mailbox texture on the OpenGLES
+ // backend is failing for unknown reasons.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool forceReadback = true;
+ #elif BUILDFLAG(IS_ANDROID)
+ // TODO(crbug.com/dawn/1969): Some Android devices don't fail to copy from
diff --git a/electron34/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc b/electron34/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc
new file mode 100644
index 0000000000..57730561b5
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
+@@ -104,6 +104,17 @@ enum WebSocketOpCode {
+ kOpCodeBinary = 0x2,
+ };
+
++// When enabled, a page can be aggressively throttled even if it uses a
++// WebSocket. Aggressive throttling does not affect the execution of WebSocket
++// event handlers, so there is little reason to disable it on pages using a
++// WebSocket.
++//
++// TODO(crbug.com/1121725): Cleanup this feature in June 2021, when it becomes
++// enabled by default on Stable.
++BASE_FEATURE(kAllowAggressiveThrottlingWithWebSocket,
++ "AllowAggressiveThrottlingWithWebSocket",
++ base::FEATURE_ENABLED_BY_DEFAULT);
++
+ } // namespace
+
+ WebSocketChannelImpl::MessageDataDeleter::MessageDataDeleter(
+@@ -297,7 +308,10 @@ bool WebSocketChannelImpl::Connect(const
+ // even if the `WebSocketChannel` is closed.
+ feature_handle_for_scheduler_ = scheduler->RegisterFeature(
+ SchedulingPolicy::Feature::kWebSocket,
+- SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});
++ base::FeatureList::IsEnabled(kAllowAggressiveThrottlingWithWebSocket)
++ ? SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()}
++ : SchedulingPolicy{SchedulingPolicy::DisableAggressiveThrottling(),
++ SchedulingPolicy::DisableBackForwardCache()});
+ scheduler->RegisterStickyFeature(
+ SchedulingPolicy::Feature::kWebSocketSticky,
+ SchedulingPolicy{SchedulingPolicy::DisableBackForwardCache()});
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_BUILD.gn b/electron34/patches/patch-third__party_blink_renderer_platform_BUILD.gn
new file mode 100644
index 0000000000..70023c7a27
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_BUILD.gn
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/BUILD.gn
+@@ -2029,7 +2029,7 @@ static_library("test_support") {
+ ]
+
+ # fuzzed_data_provider may not work with a custom toolchain.
+- if (custom_toolchain == "" && is_clang) {
++ if ((custom_toolchain == "" && is_clang) && !is_bsd) {
+ sources += [
+ "testing/fuzzed_data_provider.cc",
+ "testing/fuzzed_data_provider.h",
+@@ -2142,6 +2142,7 @@ source_set("blink_platform_unittests_sou
+ "animation/timing_function_test.cc",
+ "audio/audio_destination_test.cc",
+ "audio/audio_frame_stats_accumulator_test.cc",
++ "audio/denormal_disabler_test.cc",
+ "audio/push_pull_fifo_multithread_test.cc",
+ "audio/push_pull_fifo_test.cc",
+ "audio/vector_math_test.cc",
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler.h b/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler.h
new file mode 100644
index 0000000000..d09aaa61c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler.h
@@ -0,0 +1,190 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/audio/denormal_disabler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/audio/denormal_disabler.h
+@@ -52,64 +52,69 @@ namespace blink {
+ #endif
+
+ #if defined(HAVE_DENORMAL)
+-class DenormalDisabler {
+- DISALLOW_NEW();
+-
++class DenormalModifier {
+ public:
+- DenormalDisabler() { DisableDenormals(); }
+-
+- ~DenormalDisabler() { RestoreState(); }
+-
+- // This is a nop if we can flush denormals to zero in hardware.
+- static inline float FlushDenormalFloatToZero(float f) { return f; }
+-
+- private:
+- unsigned saved_csr_ = 0;
++ virtual ~DenormalModifier() = default;
+
+ #if defined(COMPILER_GCC) && defined(ARCH_CPU_X86_FAMILY)
+- inline void DisableDenormals() {
+- saved_csr_ = GetCSR();
+- SetCSR(saved_csr_ | 0x8040);
++ public:
++ static void DisableDenormals() {
++ unsigned old_csr = GetCsr();
++ SetCsr(old_csr | 0x8040);
+ }
+
+- inline void RestoreState() { SetCSR(saved_csr_); }
++ static void EnableDenormals() {
++ unsigned old_csr = GetCsr();
++ SetCsr(old_csr & (~0x8040));
++ }
+
+- inline int GetCSR() {
++ protected:
++ static inline unsigned GetCsr() {
+ int result;
+ asm volatile("stmxcsr %0" : "=m"(result));
+ return result;
+ }
+
+- inline void SetCSR(int a) {
++ static inline void SetCsr(int a) {
+ int temp = a;
+ asm volatile("ldmxcsr %0" : : "m"(temp));
+ }
+
+ #elif BUILDFLAG(IS_WIN) && defined(COMPILER_MSVC)
+- inline void DisableDenormals() {
+- // Save the current state, and set mode to flush denormals.
+- //
+- // http://stackoverflow.com/questions/637175/possible-bug-in-controlfp-s-may-not-restore-control-word-correctly
+- _controlfp_s(&saved_csr_, 0, 0);
+- unsigned unused;
+- _controlfp_s(&unused, _DN_FLUSH, _MCW_DN);
++ public:
++ static void DisableDenormals() { SetCsr(_DN_FLUSH); }
++
++ static void EnableDenormals() { SetCsr(_DN_SAVE); }
++
++ protected:
++ static inline unsigned GetCsr() {
++ unsigned result;
++ _controlfp_s(&result, 0, 0);
++ return result;
+ }
+
+- inline void RestoreState() {
++ static inline void SetCsr(unsigned a) {
++ // http://stackoverflow.com/questions/637175/possible-bug-in-controlfp-s-may-not-restore-control-word-correctly
+ unsigned unused;
+- _controlfp_s(&unused, saved_csr_, _MCW_DN);
++ _controlfp_s(&unused, a, _MCW_DN);
+ }
++
+ #elif defined(ARCH_CPU_ARM_FAMILY)
+- inline void DisableDenormals() {
+- saved_csr_ = GetStatusWord();
++ public:
++ static void DisableDenormals() {
++ unsigned old_csr = GetCsr();
+ // Bit 24 is the flush-to-zero mode control bit. Setting it to 1 flushes
+ // denormals to 0.
+- SetStatusWord(saved_csr_ | (1 << 24));
++ SetCsr(old_csr | (1 << 24));
+ }
+
+- inline void RestoreState() { SetStatusWord(saved_csr_); }
++ static void EnableDenormals() {
++ unsigned old_csr = GetCsr();
++ SetCsr(old_csr & (~(1 << 24)));
++ }
+
+- inline int GetStatusWord() {
++ protected:
++ static inline unsigned GetCsr() {
+ int result;
+ #if defined(ARCH_CPU_ARM64)
+ asm volatile("mrs %x[result], FPCR" : [result] "=r"(result));
+@@ -119,7 +124,7 @@ class DenormalDisabler {
+ return result;
+ }
+
+- inline void SetStatusWord(int a) {
++ static inline void SetCsr(int a) {
+ #if defined(ARCH_CPU_ARM64)
+ asm volatile("msr FPCR, %x[src]" : : [src] "r"(a));
+ #else
+@@ -130,13 +135,53 @@ class DenormalDisabler {
+ #endif
+ };
+
++class DenormalDisabler final : public DenormalModifier {
++ DISALLOW_NEW();
++
++ public:
++ DenormalDisabler() {
++ // Save the current state, and set mode to flush denormals.
++ saved_csr_ = GetCsr();
++ DisableDenormals();
++ }
++ ~DenormalDisabler() final { SetCsr(saved_csr_); }
++
++ // This is a nop if we can flush denormals to zero in hardware.
++ static inline float FlushDenormalFloatToZero(float f) { return f; }
++
++ private:
++ unsigned saved_csr_ = 0;
++};
++
++class DenormalEnabler final : public DenormalModifier {
++ DISALLOW_NEW();
++
++ public:
++ DenormalEnabler() {
++ saved_csr_ = GetCsr();
++ EnableDenormals();
++ }
++ ~DenormalEnabler() final { SetCsr(saved_csr_); }
++
++ private:
++ unsigned saved_csr_ = 0;
++};
++
+ #else
+ // FIXME: add implementations for other architectures and compilers
+-class DenormalDisabler {
++class DenormalModifier final {
++ public:
++ virtual ~DenormalModifier() = default;
++ static void DisableDenormals() {}
++ static void EnableDenormals() {}
++};
++
++class DenormalDisabler final {
+ STACK_ALLOCATED();
+
+ public:
+- DenormalDisabler() {}
++ DenormalDisabler() = default;
++ ~DenormalDisabler() = default;
+
+ // Assume the worst case that other architectures and compilers
+ // need to flush denormals to zero manually.
+@@ -145,6 +190,14 @@ class DenormalDisabler {
+ }
+ };
+
++class DenormalEnabler final {
++ STACK_ALLOCATED();
++
++ public:
++ DenormalEnabler() = default;
++ ~DenormalEnabler() = default;
++};
++
+ #endif
+
+ } // namespace blink
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler__test.cc b/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler__test.cc
new file mode 100644
index 0000000000..44c287efdc
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_audio_denormal__disabler__test.cc
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/audio/denormal_disabler_test.cc.orig 2025-05-24 17:57:53.599172464 +0000
++++ third_party/blink/renderer/platform/audio/denormal_disabler_test.cc
+@@ -0,0 +1,51 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "third_party/blink/renderer/platform/audio/denormal_disabler.h"
++
++#include "testing/gtest/include/gtest/gtest.h"
++
++namespace blink {
++
++namespace {
++
++bool DenormalsAreFlushedToZero() {
++ volatile double denorm = 2.225e-308;
++ return !((denorm / 2.0) > 0.0);
++}
++
++TEST(DenormalDisablerTest, DisableScoped) {
++ const bool already_flushed = DenormalsAreFlushedToZero();
++ if (!already_flushed) {
++ DenormalDisabler scoped_disabler;
++ EXPECT_TRUE(DenormalsAreFlushedToZero());
++ }
++}
++
++TEST(DenormalDisablerTest, EnableScoped) {
++ const bool already_flushed = DenormalsAreFlushedToZero();
++ if (!already_flushed) {
++ DenormalDisabler scoped_disabler;
++ EXPECT_TRUE(DenormalsAreFlushedToZero());
++ {
++ DenormalEnabler scoped_enabler;
++ EXPECT_FALSE(DenormalsAreFlushedToZero());
++ }
++ EXPECT_TRUE(DenormalsAreFlushedToZero());
++ }
++}
++
++TEST(DenormalDisablerTest, ModifyUnscoped) {
++ const bool already_flushed = DenormalsAreFlushedToZero();
++ if (!already_flushed) {
++ DenormalModifier::DisableDenormals();
++ EXPECT_TRUE(DenormalsAreFlushedToZero());
++ DenormalModifier::EnableDenormals();
++ EXPECT_FALSE(DenormalsAreFlushedToZero());
++ }
++}
++
++} // namespace
++
++} // namespace blink
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc b/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc
new file mode 100644
index 0000000000..659a136425
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/bindings/script_state.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/bindings/script_state.cc
+@@ -13,6 +13,10 @@ namespace blink {
+
+ ScriptState::CreateCallback ScriptState::s_create_callback_ = nullptr;
+
++int const ScriptState::kScriptStateTag = 0x6e6f64;
++void* const ScriptState::kScriptStateTagPtr = const_cast<void*>(
++ static_cast<const void*>(&ScriptState::kScriptStateTag));
++
+ // static
+ void ScriptState::SetCreateCallback(CreateCallback create_callback) {
+ DCHECK(create_callback);
+@@ -37,6 +41,8 @@ ScriptState::ScriptState(v8::Local<v8::C
+ DCHECK(world_);
+ context_.SetWeak(this, &OnV8ContextCollectedCallback);
+ context->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex, this);
++ context->SetAlignedPointerInEmbedderData(
++ kV8ContextPerContextDataTagIndex, ScriptState::kScriptStateTagPtr);
+ RendererResourceCoordinator::Get()->OnScriptStateCreated(this,
+ execution_context);
+ }
+@@ -79,6 +85,8 @@ void ScriptState::DissociateContext() {
+ // Cut the reference from V8 context to ScriptState.
+ GetContext()->SetAlignedPointerInEmbedderData(kV8ContextPerContextDataIndex,
+ nullptr);
++ GetContext()->SetAlignedPointerInEmbedderData(
++ kV8ContextPerContextDataTagIndex, nullptr);
+ reference_from_v8_context_.Clear();
+
+ // Cut the reference from ScriptState to V8 context.
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h b/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h
new file mode 100644
index 0000000000..f29bbe60d9
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/bindings/script_state.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/bindings/script_state.h
+@@ -185,7 +185,12 @@ class PLATFORM_EXPORT ScriptState : publ
+ v8::Local<v8::Context> context) {
+ DCHECK(!context.IsEmpty());
+ if (context->GetNumberOfEmbedderDataFields() <=
+- kV8ContextPerContextDataIndex) {
++ kV8ContextPerContextDataTagIndex) {
++ return nullptr;
++ }
++ if (context->GetAlignedPointerFromEmbedderData(
++ kV8ContextPerContextDataTagIndex) !=
++ ScriptState::kScriptStateTagPtr) {
+ return nullptr;
+ }
+ ScriptState* script_state =
+@@ -263,6 +268,8 @@ class PLATFORM_EXPORT ScriptState : publ
+ static void SetCreateCallback(CreateCallback);
+ friend class ScriptStateImpl;
+
++ static void* const kScriptStateTagPtr;
++ static int const kScriptStateTag;
+ static constexpr int kV8ContextPerContextDataIndex =
+ static_cast<int>(gin::kPerContextDataStartIndex) +
+ static_cast<int>(gin::kEmbedderBlink);
+@@ -271,6 +278,10 @@ class PLATFORM_EXPORT ScriptState : publ
+ // internals.idl.
+ String last_compiled_script_file_name_;
+ bool last_compiled_script_used_code_cache_ = false;
++
++ static constexpr int kV8ContextPerContextDataTagIndex =
++ static_cast<int>(gin::kPerContextDataStartIndex) +
++ static_cast<int>(gin::kEmbedderBlinkTag);
+ };
+
+ // ScriptStateProtectingContext keeps the context associated with the
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc
new file mode 100644
index 0000000000..40732092cc
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_cache.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_cache.cc
+@@ -81,7 +81,7 @@ extern const char kNotoColorEmojiCompat[
+
+ SkFontMgr* FontCache::static_font_manager_ = nullptr;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ float FontCache::device_scale_factor_ = 1.0;
+ #endif
+
+@@ -132,7 +132,7 @@ const FontPlatformData* FontCache::Syste
+ const FontDescription& font_description) {
+ const AtomicString& family = FontCache::SystemFontFamily();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ if (family.empty() || family == font_family_names::kSystemUi)
+ return nullptr;
+ #else
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h
new file mode 100644
index 0000000000..900d115c0c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_cache.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_cache.h
+@@ -55,7 +55,7 @@
+ #include "third_party/skia/include/core/SkFontMgr.h"
+ #include "third_party/skia/include/core/SkRefCnt.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/gfx/font_fallback_linux.h"
+ #endif
+
+@@ -167,7 +167,7 @@ class PLATFORM_EXPORT FontCache final {
+
+ static void MaybePreloadSystemFonts();
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // These are needed for calling QueryRenderStyleForStrike, since
+ // gfx::GetFontRenderParams makes distinctions based on DSF.
+ static float DeviceScaleFactor() { return device_scale_factor_; }
+@@ -243,7 +243,7 @@ class PLATFORM_EXPORT FontCache final {
+ const char* locale_family_name);
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static bool GetFontForCharacter(UChar32,
+ const char* preferred_locale,
+ gfx::FallbackFontData*);
+@@ -316,7 +316,7 @@ class PLATFORM_EXPORT FontCache final {
+ const FontFaceCreationParams&,
+ std::string& name);
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static AtomicString GetFamilyNameForCharacter(SkFontMgr*,
+ UChar32,
+ const FontDescription&,
+@@ -353,7 +353,7 @@ class PLATFORM_EXPORT FontCache final {
+ bool is_test_font_mgr_ = false;
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static float device_scale_factor_;
+ #endif
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc
new file mode 100644
index 0000000000..97123005f6
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_description.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_description.cc
+@@ -44,7 +44,7 @@
+ #include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
+ #include "third_party/blink/renderer/platform/wtf/text/string_hasher.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+ #endif
+
+@@ -282,7 +282,7 @@ FontCacheKey FontDescription::CacheKey(
+ static_cast<unsigned>(fields_.orientation_) << 1 | // bit 2-3
+ static_cast<unsigned>(fields_.subpixel_text_position_); // bit 1
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ float device_scale_factor_for_key = FontCache::DeviceScaleFactor();
+ #else
+ float device_scale_factor_for_key = 1.0f;
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc
new file mode 100644
index 0000000000..cc7eed17f5
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_metrics.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_metrics.cc
+@@ -39,7 +39,7 @@
+ namespace blink {
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // This is the largest VDMX table which we'll try to load and parse.
+ static const size_t kMaxVDMXTableSize = 1024 * 1024; // 1 MB
+ #endif
+@@ -67,7 +67,7 @@ void FontMetrics::AscentDescentWithHacks
+ bool is_vdmx_valid = false;
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Manually digging up VDMX metrics is only applicable when bytecode hinting
+ // using FreeType. With DirectWrite or CoreText, no bytecode hinting is ever
+ // done. This code should be pushed into FreeType (hinted font metrics).
+@@ -111,7 +111,7 @@ void FontMetrics::AscentDescentWithHacks
+ descent = SkScalarRoundToScalar(metrics.fDescent);
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // When subpixel positioning is enabled, if the descent is rounded down,
+ // the descent part of the glyph may be truncated when displayed in a
+ // 'overflow: hidden' container. To avoid that, borrow 1 unit from the
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc
new file mode 100644
index 0000000000..65df0af5a9
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_platform_data.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_platform_data.cc
+@@ -54,7 +54,7 @@
+ namespace blink {
+ namespace {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Getting the system font render style takes a significant amount of time on
+ // Linux because looking up fonts using fontconfig can be very slow. We fetch
+ // the render style for each font family and text size, while it's very
+@@ -133,7 +133,7 @@ FontPlatformData::FontPlatformData(sk_sp
+ style_ = WebFontRenderStyle::GetDefault();
+ #if !BUILDFLAG(IS_WIN)
+ WebFontRenderStyle system_style;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool override_font_name_and_size =
+ base::FeatureList::IsEnabled(kOptimizeLinuxFonts);
+ #else
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc
new file mode 100644
index 0000000000..f14b1bfb00
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/font_unique_name_lookup.cc
+@@ -9,7 +9,7 @@
+ #if BUILDFLAG(IS_ANDROID)
+ #include "third_party/blink/public/mojom/font_unique_name_lookup/font_unique_name_lookup.mojom-blink.h"
+ #include "third_party/blink/renderer/platform/fonts/android/font_unique_name_lookup_android.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/blink/renderer/platform/fonts/linux/font_unique_name_lookup_linux.h"
+ #elif BUILDFLAG(IS_WIN)
+ #include "third_party/blink/renderer/platform/fonts/win/font_unique_name_lookup_win.h"
+@@ -24,7 +24,7 @@ std::unique_ptr<FontUniqueNameLookup>
+ FontUniqueNameLookup::GetPlatformUniqueNameLookup() {
+ #if BUILDFLAG(IS_ANDROID)
+ return std::make_unique<FontUniqueNameLookupAndroid>();
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return std::make_unique<FontUniqueNameLookupLinux>();
+ #elif BUILDFLAG(IS_WIN)
+ return std::make_unique<FontUniqueNameLookupWin>();
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc
new file mode 100644
index 0000000000..2cccc0cc19
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
+@@ -65,7 +65,7 @@ AtomicString ToAtomicString(const SkStri
+ return AtomicString::FromUTF8(str.c_str(), str.size());
+ }
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // This function is called on android or when we are emulating android fonts on
+ // linux and the embedder has overriden the default fontManager with
+ // WebFontRendering::setSkiaFontMgr.
+@@ -246,7 +246,7 @@ const FontPlatformData* FontCache::Creat
+ std::string name;
+
+ sk_sp<SkTypeface> typeface;
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool noto_color_emoji_from_gmscore = false;
+ #if BUILDFLAG(IS_ANDROID)
+ // Use the unique local matching pathway for fetching Noto Color Emoji Compat
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc
new file mode 100644
index 0000000000..80602038ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/graphics/begin_frame_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/graphics/begin_frame_provider.cc
+@@ -71,8 +71,12 @@ void BeginFrameProvider::CreateComposito
+
+ // Once we are using RAF, this thread is driving user interactive display
+ // updates. Update priority accordingly.
++ // pledge(2)
++ // stop this baloney
++#if !defined(OS_OPENBSD)
+ base::PlatformThread::SetCurrentThreadType(
+ base::ThreadType::kDisplayCritical);
++#endif
+
+ mojo::Remote<mojom::blink::EmbeddedFrameSinkProvider> provider;
+ Platform::Current()->GetBrowserInterfaceBroker()->GetInterface(
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.cc b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.cc
new file mode 100644
index 0000000000..01de0fc51c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.cc
+@@ -1524,15 +1524,6 @@ void PaintArtifactCompositor::ShowDebugD
+ }
+ #endif
+
+-void PaintArtifactCompositor::ForAllContentLayersForTesting(
+- base::FunctionRef<void(ContentLayerClientImpl*)> func) const {
+- for (auto& pending_layer : pending_layers_) {
+- if (auto* client = pending_layer.GetContentLayerClient()) {
+- func(client);
+- }
+- }
+-}
+-
+ ContentLayerClientImpl* PaintArtifactCompositor::ContentLayerClientForTesting(
+ wtf_size_t i) const {
+ for (auto& pending_layer : pending_layers_) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.h b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.h
new file mode 100644
index 0000000000..511e180e2f
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_compositing_paint__artifact__compositor.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/graphics/compositing/paint_artifact_compositor.h
+@@ -231,8 +231,6 @@ class PLATFORM_EXPORT PaintArtifactCompo
+ void ShowDebugData();
+ #endif
+
+- void ForAllContentLayersForTesting(
+- base::FunctionRef<void(ContentLayerClientImpl*)> func) const;
+ // Returns the ith ContentLayerClientImpl for testing.
+ ContentLayerClientImpl* ContentLayerClientForTesting(wtf_size_t i) const;
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_graphics_gpu_image__layer__bridge.cc b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_gpu_image__layer__bridge.cc
new file mode 100644
index 0000000000..2ec70e4abc
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_gpu_image__layer__bridge.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/graphics/gpu/image_layer_bridge.cc
+@@ -49,7 +49,7 @@ scoped_refptr<StaticBitmapImage> MakeAcc
+ const auto paint_image = source->PaintImageForCurrentFrame();
+ const auto image_info = paint_image.GetSkImageInfo().makeWH(
+ source->Size().width(), source->Size().height());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(b/330865436): On Linux, CanvasResourceProvider doesn't always check
+ // for SCANOUT support correctly on X11 and it's never supported in
+ // practice. Therefore, don't include it until this flow is reworked.
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc
new file mode 100644
index 0000000000..99d52e8904
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/graphics/video_frame_submitter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/graphics/video_frame_submitter.cc
+@@ -438,7 +438,7 @@ void VideoFrameSubmitter::OnBeginFrame(
+ auto& details = timing_details.find(frame_token)->value;
+ auto& feedback = details.presentation_feedback;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO: On Linux failure flag is unreliable, and perfectly rendered frames
+ // are reported as failures all the time.
+ bool presentation_failure = false;
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc b/electron34/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc
new file mode 100644
index 0000000000..47f64af25e
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/instrumentation/partition_alloc_memory_dump_provider.cc
+@@ -14,7 +14,9 @@
+
+ namespace blink {
+
++#if !BUILDFLAG(IS_BSD)
+ const char kPartitionAllocDumpName[] = "partition_alloc";
++#endif
+
+ PartitionAllocMemoryDumpProvider* PartitionAllocMemoryDumpProvider::Instance() {
+ DEFINE_STATIC_LOCAL(PartitionAllocMemoryDumpProvider, instance, ());
+@@ -24,6 +26,7 @@ PartitionAllocMemoryDumpProvider* Partit
+ bool PartitionAllocMemoryDumpProvider::OnMemoryDump(
+ const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* memory_dump) {
++#if !BUILDFLAG(IS_BSD)
+ using base::trace_event::MemoryDumpLevelOfDetail;
+
+ MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail;
+@@ -49,6 +52,7 @@ bool PartitionAllocMemoryDumpProvider::O
+ "size", "bytes", partition_stats_dumper.total_active_bytes());
+ memory_dump->AddOwnershipEdge(allocated_objects_dump->guid(),
+ partitions_dump->guid());
++#endif
+
+ return true;
+ }
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc b/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc
new file mode 100644
index 0000000000..1a52188537
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc
@@ -0,0 +1,56 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/media/multi_buffer_data_source.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/media/multi_buffer_data_source.cc
+@@ -13,8 +13,10 @@
+ #include "base/functional/callback_helpers.h"
+ #include "base/location.h"
+ #include "base/memory/raw_ptr.h"
++#include "base/no_destructor.h"
+ #include "base/numerics/safe_conversions.h"
+ #include "base/task/single_thread_task_runner.h"
++#include "base/strings/string_util.h"
+ #include "media/base/media_log.h"
+ #include "net/base/net_errors.h"
+ #include "third_party/blink/renderer/platform/media/buffered_data_source_host_impl.h"
+@@ -63,8 +65,20 @@ const int kUpdateBufferSizeFrequency = 3
+ // How long to we delay a seek after a read?
+ constexpr base::TimeDelta kSeekDelay = base::Milliseconds(20);
+
++std::vector<std::string>* GetStreamingSchemes() {
++ static base::NoDestructor<std::vector<std::string>> streaming_schemes({
++ url::kHttpsScheme,
++ url::kHttpScheme
++ });
++ return streaming_schemes.get();
++}
++
+ } // namespace
+
++void AddStreamingScheme(const char* new_scheme) {
++ GetStreamingSchemes()->push_back(new_scheme);
++}
++
+ class MultiBufferDataSource::ReadOperation {
+ public:
+ ReadOperation() = delete;
+@@ -156,7 +170,14 @@ bool MultiBufferDataSource::media_has_pl
+
+ bool MultiBufferDataSource::AssumeFullyBuffered() const {
+ DCHECK(url_data_);
+- return !url_data_->url().ProtocolIsInHTTPFamily();
++
++ const std::string scheme = url_data_->url().Protocol().Ascii();
++ for (const std::string& streaming_scheme : *GetStreamingSchemes()) {
++ if (base::EqualsCaseInsensitiveASCII(scheme, streaming_scheme)) {
++ return false;
++ }
++ }
++ return true;
+ }
+
+ void MultiBufferDataSource::SetReader(
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h b/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h
new file mode 100644
index 0000000000..c6598c6020
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/media/multi_buffer_data_source.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/media/multi_buffer_data_source.h
+@@ -17,6 +17,7 @@
+ #include "media/base/data_source.h"
+ #include "media/base/ranges.h"
+ #include "media/base/tuneable.h"
++#include "third_party/blink/public/platform/web_common.h"
+ #include "third_party/blink/renderer/platform/media/url_index.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/vector.h"
+@@ -34,6 +35,8 @@ namespace blink {
+ class BufferedDataSourceHost;
+ class MultiBufferReader;
+
++void BLINK_PLATFORM_EXPORT AddStreamingScheme(const char* new_scheme);
++
+ // A data source capable of loading URLs and buffering the data using an
+ // in-memory sliding window.
+ //
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc b/electron34/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc
new file mode 100644
index 0000000000..6ac5cd59ce
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc
+@@ -317,12 +317,12 @@ SupportedFormats GetSupportedFormatsInte
+ supported_formats.profiles.push_back(profile.profile);
+ supported_formats.sdp_formats.push_back(std::move(*format));
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_WIN)
+ const bool kShouldAddH264Cbp =
+ base::FeatureList::IsEnabled(kMediaFoundationH264CbpEncoding) &&
+ profile.profile == media::VideoCodecProfile::H264PROFILE_BASELINE;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const bool kShouldAddH264Cbp =
+ profile.profile == media::VideoCodecProfile::H264PROFILE_BASELINE;
+ #endif
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5 b/electron34/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
new file mode 100644
index 0000000000..ddbf711b89
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
@@ -0,0 +1,89 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/runtime_enabled_features.json5.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/runtime_enabled_features.json5
+@@ -389,7 +389,7 @@
+ name: "AppTitle",
+ status: "experimental",
+ origin_trial_feature_name: "AppTitle",
+- origin_trial_os: ["win", "mac", "linux", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "chromeos", "openbsd", "freebsd", "netbsd"],
+ base_feature: "WebAppEnableAppTitle",
+ },
+ {
+@@ -1564,7 +1564,7 @@
+ name: "DocumentIsolationPolicy",
+ status: "experimental",
+ origin_trial_feature_name: "DocumentIsolationPolicy",
+- origin_trial_os: ["win", "mac", "linux", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "chromeos", "openbsd", "freebsd", "netbsd"],
+ base_feature: "none",
+ },
+ {
+@@ -1858,7 +1858,7 @@
+ base_feature: "none",
+ public: true,
+ origin_trial_feature_name: "FedCmMultipleIdentityProviders",
+- origin_trial_os: ["win", "mac", "linux", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "chromeos", "openbsd", "freebsd", "netbsd"],
+ origin_trial_allows_third_party: true,
+ },
+ {
+@@ -1997,7 +1997,7 @@
+ depends_on: ["FileSystemAccess"],
+ status: "experimental",
+ origin_trial_feature_name: "FileSystemObserver",
+- origin_trial_os: ["win", "mac", "linux", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "chromeos", "openbsd", "freebsd", "netbsd"],
+ },
+ {
+ // The unobserve function of the FileSystemObserver.
+@@ -3249,7 +3249,7 @@
+ // Tracking bug for the implementation: https://crbug.com/1462930
+ name: "PermissionElement",
+ origin_trial_feature_name: "PermissionElement",
+- origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos", "openbsd", "freebsd", "netbsd"],
+ status: {"Android": "", "default": "experimental"},
+ public: true,
+ base_feature_status: "enabled",
+@@ -3386,7 +3386,7 @@
+ {
+ name: "PrivateNetworkAccessPermissionPrompt",
+ origin_trial_feature_name: "PrivateNetworkAccessPermissionPrompt",
+- origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos", "openbsd", "freebsd", "netbsd"],
+ status: "stable",
+ public: true,
+ base_feature: "none",
+@@ -4439,7 +4439,7 @@
+ name: "UnrestrictedSharedArrayBuffer",
+ base_feature: "none",
+ origin_trial_feature_name: "UnrestrictedSharedArrayBuffer",
+- origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "fuchsia", "chromeos", "openbsd", "freebsd", "netbsd"],
+ },
+ // Enables using policy-controlled feature "usb-unrestricted" to allow
+ // isolated context to access protected USB interface classes and to
+@@ -4618,7 +4618,7 @@
+ {
+ name: "WebAppScopeExtensions",
+ origin_trial_feature_name: "WebAppScopeExtensions",
+- origin_trial_os: ["win", "mac", "linux", "chromeos"],
++ origin_trial_os: ["win", "mac", "linux", "chromeos", "openbsd", "freebsd", "netbsd"],
+ status: "experimental",
+ base_feature: "none",
+ },
+@@ -4657,7 +4657,7 @@
+ status: "experimental",
+ base_feature: "none",
+ origin_trial_feature_name: "WebAppUrlHandling",
+- origin_trial_os: ["win", "mac", "linux"],
++ origin_trial_os: ["win", "mac", "linux", "openbsd", "freebsd", "netbsd"],
+ },
+ {
+ // WebAssembly JS Promise Integration,
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc b/electron34/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc
new file mode 100644
index 0000000000..6c812538cf
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/scheduler/common/thread.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/scheduler/common/thread.cc
+@@ -87,7 +87,7 @@ void Thread::CreateAndSetCompositorThrea
+ "Compositor");
+ }));
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_OPENBSD)
+ compositor_thread->GetTaskRunner()->PostTaskAndReplyWithResult(
+ FROM_HERE, base::BindOnce(&base::PlatformThread::CurrentId),
+ base::BindOnce([](base::PlatformThreadId compositor_thread_id) {
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc b/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc
new file mode 100644
index 0000000000..285e0449b0
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/widget/compositing/blink_categorized_worker_pool_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/widget/compositing/blink_categorized_worker_pool_delegate.cc
+@@ -27,7 +27,7 @@ BlinkCategorizedWorkerPoolDelegate& Blin
+
+ void BlinkCategorizedWorkerPoolDelegate::NotifyThreadWillRun(
+ base::PlatformThreadId tid) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ scoped_refptr<base::TaskRunner> task_runner =
+ Thread::MainThread()->GetTaskRunner(MainThreadTaskRunnerRestricted());
+ task_runner->PostTask(FROM_HERE, base::BindOnce(
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc b/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc
new file mode 100644
index 0000000000..9e1596919c
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
+@@ -387,9 +387,13 @@ void LayerTreeView::DidFailToInitializeL
+ // unable to be killed after Chrome is closed.
+ // https://issues.chromium.org/336164423
+ if (!Platform::Current()->IsGpuRemoteDisconnected()) {
+- layer_tree_host_->GetTaskRunnerProvider()->MainThreadTaskRunner()->PostTask(
++ // CompositingModeFallbackToSoftware IPC will disable GPU compositing in
++ // RenderThread. Post task with delay to give time to receive this IPC and
++ // prevent infinite loop of retries for software renderers.
++ // https://issues.chromium.org/345275130
++ layer_tree_host_->GetTaskRunnerProvider()->MainThreadTaskRunner()->PostDelayedTask(
+ FROM_HERE, base::BindOnce(&LayerTreeView::RequestNewLayerTreeFrameSink,
+- weak_factory_.GetWeakPtr()));
++ weak_factory_.GetWeakPtr()), base::Milliseconds(10));
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h
new file mode 100644
index 0000000000..b6b881023e
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/wtf/container_annotations.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/wtf/container_annotations.h
+@@ -12,7 +12,7 @@
+ // TODO(ochang): Remove the ARCH_CPU_X86_64 condition to enable this for X86
+ // once the crashes there have been fixed: http://crbug.com/461406
+ #if defined(ADDRESS_SANITIZER) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(ARCH_CPU_X86_64)
+
+ // Annotations require buffers to begin on an 8-byte boundary. See
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h
new file mode 100644
index 0000000000..e0306bc690
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/wtf/math_extras.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/wtf/math_extras.h
+@@ -128,6 +128,10 @@ constexpr float Grad2turn(float g) {
+ return g * (1.0f / 400.0f);
+ }
+
++#if defined(OS_FREEBSD)
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Winvalid-constexpr"
++#endif
+ constexpr double RoundHalfTowardsPositiveInfinity(double value) {
+ return std::floor(value + 0.5);
+ }
+@@ -135,6 +139,9 @@ constexpr double RoundHalfTowardsPositiv
+ constexpr float RoundHalfTowardsPositiveInfinity(float value) {
+ return std::floor(value + 0.5f);
+ }
++#if defined(OS_FREEBSD)
++#pragma clang diagnostic pop
++#endif
+
+ // ClampTo() is implemented by templated helper classes (to allow for partial
+ // template specialization) as well as several helper functions.
diff --git a/electron34/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc
new file mode 100644
index 0000000000..4c567be50d
--- /dev/null
+++ b/electron34/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc
@@ -0,0 +1,82 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/blink/renderer/platform/wtf/stack_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/blink/renderer/platform/wtf/stack_util.cc
+@@ -23,6 +23,13 @@
+ extern "C" void* __libc_stack_end; // NOLINT
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <sys/signal.h>
++#if !BUILDFLAG(IS_NETBSD)
++#include <pthread_np.h>
++#endif
++#endif
++
+ namespace WTF {
+
+ size_t GetUnderestimatedStackSize() {
+@@ -35,7 +42,8 @@ size_t GetUnderestimatedStackSize() {
+ // correctly for the main thread.
+
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_FUCHSIA) || \
++ BUILDFLAG(IS_NETBSD)
+ // pthread_getattr_np() can fail if the thread is not invoked by
+ // pthread_create() (e.g., the main thread of blink_unittests).
+ // If so, a conservative size estimate is returned.
+@@ -56,7 +64,7 @@ size_t GetUnderestimatedStackSize() {
+ pthread_attr_destroy(&attr);
+ return size;
+ }
+-#if BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ pthread_attr_destroy(&attr);
+ #endif
+
+@@ -67,6 +75,8 @@ size_t GetUnderestimatedStackSize() {
+ // low as 512k.
+ //
+ return 512 * 1024;
++#elif BUILDFLAG(IS_OPENBSD)
++ return 512 * 1024;
+ #elif BUILDFLAG(IS_APPLE)
+ // pthread_get_stacksize_np() returns too low a value for the main thread on
+ // OSX 10.9,
+@@ -103,7 +113,7 @@ size_t GetUnderestimatedStackSize() {
+
+ void* GetStackStart() {
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_NETBSD)
+ pthread_attr_t attr;
+ int error;
+ #if BUILDFLAG(IS_FREEBSD)
+@@ -120,7 +130,7 @@ void* GetStackStart() {
+ pthread_attr_destroy(&attr);
+ return reinterpret_cast<uint8_t*>(base) + size;
+ }
+-#if BUILDFLAG(IS_FREEBSD)
++#if BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ pthread_attr_destroy(&attr);
+ #endif
+ #if defined(__GLIBC__)
+@@ -152,6 +162,13 @@ void* GetStackStart() {
+ ::GetCurrentThreadStackLimits(&lowLimit, &highLimit);
+ return reinterpret_cast<void*>(highLimit);
+ #endif
++#elif BUILDFLAG(IS_OPENBSD)
++ stack_t ss;
++ void *base;
++ int error = pthread_stackseg_np(pthread_self(), &ss);
++ CHECK(!error);
++ base = (void*)((size_t) ss.ss_sp - ss.ss_size);
++ return reinterpret_cast<uint8_t*>(base) + ss.ss_size;
+ #else
+ #error Unsupported getStackStart on this platform.
+ #endif
diff --git a/electron34/patches/patch-third__party_boringssl_BUILD.gn b/electron34/patches/patch-third__party_boringssl_BUILD.gn
new file mode 100644
index 0000000000..58e534e80b
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_BUILD.gn
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/BUILD.gn
+@@ -48,6 +48,21 @@ all_sources = bcm_internal_headers + bcm
+ crypto_sources + ssl_internal_headers + ssl_sources + pki_sources
+ all_headers = crypto_headers + ssl_headers + pki_headers + pki_internal_headers
+
++if (is_electron_build) {
++ # Needed to build a nodejs-compatible boringssl.
++ all_sources += [
++ "decrepit/evp/evp_do_all.c",
++ "decrepit/xts/xts.c",
++ ]
++
++ all_sources += [
++ "decrepit/blowfish/blowfish.c",
++ "decrepit/cfb/cfb.c",
++ "decrepit/ripemd/internal.h",
++ "decrepit/ripemd/ripemd.c",
++ ]
++}
++
+ if (enable_rust) {
+ rust_bindgen_generator("raw_bssl_sys_bindings") {
+ output_name = "bindgen"
diff --git a/electron34/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c b/electron34/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c
new file mode 100644
index 0000000000..4cf5a2407e
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/crypto/cipher_extra/cipher_extra.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/crypto/cipher_extra/cipher_extra.c
+@@ -73,6 +73,7 @@ static const struct {
+ const EVP_CIPHER *(*func)(void);
+ } kCiphers[] = {
+ {NID_aes_128_cbc, "aes-128-cbc", EVP_aes_128_cbc},
++ {NID_aes_128_cfb128, "aes-128-cfb", EVP_aes_128_cfb128},
+ {NID_aes_128_ctr, "aes-128-ctr", EVP_aes_128_ctr},
+ {NID_aes_128_ecb, "aes-128-ecb", EVP_aes_128_ecb},
+ {NID_aes_128_gcm, "aes-128-gcm", EVP_aes_128_gcm},
+@@ -83,17 +84,23 @@ static const struct {
+ {NID_aes_192_gcm, "aes-192-gcm", EVP_aes_192_gcm},
+ {NID_aes_192_ofb128, "aes-192-ofb", EVP_aes_192_ofb},
+ {NID_aes_256_cbc, "aes-256-cbc", EVP_aes_256_cbc},
++ {NID_aes_256_cfb128, "aes-256-cfb", EVP_aes_256_cfb128},
+ {NID_aes_256_ctr, "aes-256-ctr", EVP_aes_256_ctr},
+ {NID_aes_256_ecb, "aes-256-ecb", EVP_aes_256_ecb},
+ {NID_aes_256_gcm, "aes-256-gcm", EVP_aes_256_gcm},
+ {NID_aes_256_ofb128, "aes-256-ofb", EVP_aes_256_ofb},
++ {NID_bf_cbc, "bf-cbc", EVP_bf_cbc},
++ {NID_bf_cfb64, "bf-cfb", EVP_bf_cfb},
++ {NID_bf_ecb, "bf-ecb", EVP_bf_ecb},
+ {NID_des_cbc, "des-cbc", EVP_des_cbc},
+ {NID_des_ecb, "des-ecb", EVP_des_ecb},
+ {NID_des_ede_cbc, "des-ede-cbc", EVP_des_ede_cbc},
+ {NID_des_ede_ecb, "des-ede", EVP_des_ede},
++ {NID_des_ede3_ecb, "des-ede3", EVP_des_ede3},
+ {NID_des_ede3_cbc, "des-ede3-cbc", EVP_des_ede3_cbc},
+ {NID_rc2_cbc, "rc2-cbc", EVP_rc2_cbc},
+ {NID_rc4, "rc4", EVP_rc4},
++ {NID_rc2_40_cbc, "rc2-40-cbc", EVP_rc2_40_cbc}
+ };
+
+ const EVP_CIPHER *EVP_get_cipherbynid(int nid) {
diff --git a/electron34/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c b/electron34/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c
new file mode 100644
index 0000000000..e00ed2f670
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/crypto/digest_extra/digest_extra.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/crypto/digest_extra/digest_extra.c
+@@ -87,6 +87,7 @@ static const struct nid_to_digest nid_to
+ {NID_sha512, EVP_sha512, SN_sha512, LN_sha512},
+ {NID_sha512_256, EVP_sha512_256, SN_sha512_256, LN_sha512_256},
+ {NID_md5_sha1, EVP_md5_sha1, SN_md5_sha1, LN_md5_sha1},
++ {NID_ripemd160, EVP_ripemd160, SN_ripemd160, LN_ripemd160},
+ // As a remnant of signing |EVP_MD|s, OpenSSL returned the corresponding
+ // hash function when given a signature OID. To avoid unintended lax parsing
+ // of hash OIDs, this is no longer supported for lookup by OID or NID.
diff --git a/electron34/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c.inc b/electron34/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c.inc
new file mode 100644
index 0000000000..369b4a4134
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c.inc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/crypto/fipsmodule/digest/digests.c.inc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/crypto/fipsmodule/digest/digests.c.inc
+@@ -60,6 +60,7 @@
+ #include <string.h>
+
+ #include <openssl/nid.h>
++#include <openssl/ripemd.h>
+
+ #include "internal.h"
+ #include "../delocate.h"
+@@ -215,4 +216,27 @@ DEFINE_METHOD_FUNCTION(EVP_MD, EVP_sha51
+ out->ctx_size = sizeof(SHA512_CTX);
+ }
+
++static void ripemd160_init(EVP_MD_CTX *ctx) {
++ CHECK(RIPEMD160_Init(ctx->md_data));
++}
++
++static void ripemd160_update(EVP_MD_CTX *ctx, const void *data, size_t count) {
++ CHECK(RIPEMD160_Update(ctx->md_data, data, count));
++}
++
++static void ripemd160_final(EVP_MD_CTX *ctx, uint8_t *md) {
++ CHECK(RIPEMD160_Final(md, ctx->md_data));
++}
++
++DEFINE_METHOD_FUNCTION(EVP_MD, EVP_ripemd160) {
++ out->type = NID_ripemd160;
++ out->md_size = RIPEMD160_DIGEST_LENGTH;
++ out->flags = 0;
++ out->init = ripemd160_init;
++ out->update = ripemd160_update;
++ out->final = ripemd160_final;
++ out->block_size = 64;
++ out->ctx_size = sizeof(RIPEMD160_CTX);
++}
++
+ #undef CHECK
diff --git a/electron34/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c b/electron34/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c
new file mode 100644
index 0000000000..fc19b8689b
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c
@@ -0,0 +1,74 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/decrepit/evp/evp_do_all.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/decrepit/evp/evp_do_all.c
+@@ -20,8 +20,10 @@ void EVP_CIPHER_do_all_sorted(void (*cal
+ const char *unused, void *arg),
+ void *arg) {
+ callback(EVP_aes_128_cbc(), "AES-128-CBC", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "AES-128-CFB", NULL, arg);
+ callback(EVP_aes_192_cbc(), "AES-192-CBC", NULL, arg);
+ callback(EVP_aes_256_cbc(), "AES-256-CBC", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "AES-256-CFB", NULL, arg);
+ callback(EVP_aes_128_ctr(), "AES-128-CTR", NULL, arg);
+ callback(EVP_aes_192_ctr(), "AES-192-CTR", NULL, arg);
+ callback(EVP_aes_256_ctr(), "AES-256-CTR", NULL, arg);
+@@ -34,9 +36,13 @@ void EVP_CIPHER_do_all_sorted(void (*cal
+ callback(EVP_aes_128_gcm(), "AES-128-GCM", NULL, arg);
+ callback(EVP_aes_192_gcm(), "AES-192-GCM", NULL, arg);
+ callback(EVP_aes_256_gcm(), "AES-256-GCM", NULL, arg);
++ callback(EVP_bf_cbc(), "BF-CBC", NULL, arg);
++ callback(EVP_bf_cfb(), "BF-CFB", NULL, arg);
++ callback(EVP_bf_ecb(), "BF-ECB", NULL, arg);
+ callback(EVP_des_cbc(), "DES-CBC", NULL, arg);
+ callback(EVP_des_ecb(), "DES-ECB", NULL, arg);
+ callback(EVP_des_ede(), "DES-EDE", NULL, arg);
++ callback(EVP_des_ede3(), "DES-EDE3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "DES-EDE-CBC", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "DES-EDE3-CBC", NULL, arg);
+ callback(EVP_rc2_cbc(), "RC2-CBC", NULL, arg);
+@@ -44,8 +50,10 @@ void EVP_CIPHER_do_all_sorted(void (*cal
+
+ // OpenSSL returns everything twice, the second time in lower case.
+ callback(EVP_aes_128_cbc(), "aes-128-cbc", NULL, arg);
++ callback(EVP_aes_128_cfb128(), "aes-128-cfb", NULL, arg);
+ callback(EVP_aes_192_cbc(), "aes-192-cbc", NULL, arg);
+ callback(EVP_aes_256_cbc(), "aes-256-cbc", NULL, arg);
++ callback(EVP_aes_256_cfb128(), "aes-256-cfb", NULL, arg);
+ callback(EVP_aes_128_ctr(), "aes-128-ctr", NULL, arg);
+ callback(EVP_aes_192_ctr(), "aes-192-ctr", NULL, arg);
+ callback(EVP_aes_256_ctr(), "aes-256-ctr", NULL, arg);
+@@ -58,9 +66,13 @@ void EVP_CIPHER_do_all_sorted(void (*cal
+ callback(EVP_aes_128_gcm(), "aes-128-gcm", NULL, arg);
+ callback(EVP_aes_192_gcm(), "aes-192-gcm", NULL, arg);
+ callback(EVP_aes_256_gcm(), "aes-256-gcm", NULL, arg);
++ callback(EVP_bf_cbc(), "bf-cbc", NULL, arg);
++ callback(EVP_bf_cfb(), "bf-cfb", NULL, arg);
++ callback(EVP_bf_ecb(), "bf-ecb", NULL, arg);
+ callback(EVP_des_cbc(), "des-cbc", NULL, arg);
+ callback(EVP_des_ecb(), "des-ecb", NULL, arg);
+ callback(EVP_des_ede(), "des-ede", NULL, arg);
++ callback(EVP_des_ede3(), "des-ede3", NULL, arg);
+ callback(EVP_des_ede_cbc(), "des-ede-cbc", NULL, arg);
+ callback(EVP_des_ede3_cbc(), "des-ede3-cbc", NULL, arg);
+ callback(EVP_rc2_cbc(), "rc2-cbc", NULL, arg);
+@@ -79,6 +91,7 @@ void EVP_MD_do_all_sorted(void (*callbac
+ callback(EVP_sha384(), "SHA384", NULL, arg);
+ callback(EVP_sha512(), "SHA512", NULL, arg);
+ callback(EVP_sha512_256(), "SHA512-256", NULL, arg);
++ callback(EVP_ripemd160(), "ripemd160", NULL, arg);
+
+ callback(EVP_md4(), "md4", NULL, arg);
+ callback(EVP_md5(), "md5", NULL, arg);
+@@ -88,6 +101,7 @@ void EVP_MD_do_all_sorted(void (*callbac
+ callback(EVP_sha384(), "sha384", NULL, arg);
+ callback(EVP_sha512(), "sha512", NULL, arg);
+ callback(EVP_sha512_256(), "sha512-256", NULL, arg);
++ callback(EVP_ripemd160(), "ripemd160", NULL, arg);
+ }
+
+ void EVP_MD_do_all(void (*callback)(const EVP_MD *cipher, const char *name,
diff --git a/electron34/patches/patch-third__party_boringssl_src_include_openssl_cipher.h b/electron34/patches/patch-third__party_boringssl_src_include_openssl_cipher.h
new file mode 100644
index 0000000000..fe46bfbc32
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_include_openssl_cipher.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/include/openssl/cipher.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/include/openssl/cipher.h
+@@ -476,6 +476,7 @@ OPENSSL_EXPORT const EVP_CIPHER *EVP_des
+
+ // EVP_aes_128_cfb128 is only available in decrepit.
+ OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_128_cfb128(void);
++OPENSSL_EXPORT const EVP_CIPHER *EVP_aes_256_cfb128(void);
+
+ // EVP_aes_128_cfb is an alias for |EVP_aes_128_cfb128| and is only available in
+ // decrepit.
diff --git a/electron34/patches/patch-third__party_boringssl_src_include_openssl_digest.h b/electron34/patches/patch-third__party_boringssl_src_include_openssl_digest.h
new file mode 100644
index 0000000000..83f53773e8
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_include_openssl_digest.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/include/openssl/digest.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/include/openssl/digest.h
+@@ -90,6 +90,9 @@ OPENSSL_EXPORT const EVP_MD *EVP_blake2b
+ // MD5 and SHA-1, as used in TLS 1.1 and below.
+ OPENSSL_EXPORT const EVP_MD *EVP_md5_sha1(void);
+
++// EVP_ripemd160 is in decrepit and not available by default.
++OPENSSL_EXPORT const EVP_MD *EVP_ripemd160(void);
++
+ // EVP_get_digestbynid returns an |EVP_MD| for the given NID, or NULL if no
+ // such digest is known.
+ OPENSSL_EXPORT const EVP_MD *EVP_get_digestbynid(int nid);
diff --git a/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc b/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc
new file mode 100644
index 0000000000..e918984c2d
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/ssl/ssl_buffer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/ssl/ssl_buffer.cc
+@@ -235,7 +235,6 @@ int ssl_handle_open_record(SSL *ssl, boo
+ return 1;
+
+ case ssl_open_record_close_notify:
+- ssl->s3->rwstate = SSL_ERROR_ZERO_RETURN;
+ return 0;
+
+ case ssl_open_record_error:
diff --git a/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc b/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc
new file mode 100644
index 0000000000..97ea4ef469
--- /dev/null
+++ b/electron34/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/boringssl/src/ssl/ssl_lib.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/boringssl/src/ssl/ssl_lib.cc
+@@ -1339,7 +1339,7 @@ int SSL_get_error(const SSL *ssl, int re
+ }
+
+ if (ret_code == 0) {
+- if (ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN) {
++ if (ssl->s3->read_shutdown == ssl_shutdown_close_notify) {
+ return SSL_ERROR_ZERO_RETURN;
+ }
+ // An EOF was observed which violates the protocol, and the underlying
+@@ -2711,13 +2711,7 @@ void *SSL_CTX_get_ex_data(const SSL_CTX
+ return CRYPTO_get_ex_data(&ctx->ex_data, idx);
+ }
+
+-int SSL_want(const SSL *ssl) {
+- // Historically, OpenSSL did not track |SSL_ERROR_ZERO_RETURN| as an |rwstate|
+- // value. We do, but map it back to |SSL_ERROR_NONE| to preserve the original
+- // behavior.
+- return ssl->s3->rwstate == SSL_ERROR_ZERO_RETURN ? SSL_ERROR_NONE
+- : ssl->s3->rwstate;
+-}
++int SSL_want(const SSL *ssl) { return ssl->s3->rwstate; }
+
+ void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx,
+ RSA *(*cb)(SSL *ssl, int is_export,
diff --git a/electron34/patches/patch-third__party_brotli_common_platform.h b/electron34/patches/patch-third__party_brotli_common_platform.h
new file mode 100644
index 0000000000..e8742785fc
--- /dev/null
+++ b/electron34/patches/patch-third__party_brotli_common_platform.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/brotli/common/platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/brotli/common/platform.h
+@@ -28,7 +28,7 @@
+ #include <brotli/port.h>
+ #include <brotli/types.h>
+
+-#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__)
++#if defined(OS_LINUX) || defined(OS_CYGWIN) || defined(__EMSCRIPTEN__) || defined(OS_BSD)
+ #include <endian.h>
+ #elif defined(OS_FREEBSD)
+ #include <machine/endian.h>
diff --git a/electron34/patches/patch-third__party_cpuinfo_cpuinfo.gni b/electron34/patches/patch-third__party_cpuinfo_cpuinfo.gni
new file mode 100644
index 0000000000..93f0c05b62
--- /dev/null
+++ b/electron34/patches/patch-third__party_cpuinfo_cpuinfo.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/cpuinfo/cpuinfo.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/cpuinfo/cpuinfo.gni
+@@ -8,7 +8,7 @@ use_cpuinfo =
+ current_cpu != "s390" && current_cpu != "s390x" &&
+ current_cpu != "riscv64" &&
+ # cpuinfo is not supported on fuchsia.
+- !is_fuchsia &&
++ !is_fuchsia && !is_bsd &&
+ # There's a few arm architectures that are not supported by cpuinfo,
+ # especially amongst ChromeOS devices.
+ # See //third_party/cpuinfo/src/src/arm/linux/cp.h.
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni b/electron34/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni
new file mode 100644
index 0000000000..234c3c3aa6
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/build/crashpad_buildconfig.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/build/crashpad_buildconfig.gni
+@@ -61,7 +61,7 @@ if (crashpad_is_in_chromium) {
+ crashpad_is_ios = is_ios
+ crashpad_is_apple = is_apple
+ crashpad_is_win = is_win
+- crashpad_is_linux = is_linux || is_chromeos
++ crashpad_is_linux = (is_linux || is_chromeos) && !is_bsd
+ crashpad_is_android = is_android
+ crashpad_is_fuchsia = is_fuchsia
+
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn b/electron34/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn
new file mode 100644
index 0000000000..cc5688882b
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/client/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/client/BUILD.gn
+@@ -137,6 +137,13 @@ static_library("common") {
+ if (crashpad_is_win) {
+ sources += [ "crash_report_database_win.cc" ]
+ }
++
++ if (crashpad_is_posix) {
++ sources += [
++ "crashpad_client_posix.cc",
++ ]
++ }
++
+ if (crashpad_is_linux || crashpad_is_android || crashpad_is_fuchsia) {
+ sources += [
+ "crash_report_database_generic.cc",
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc b/electron34/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc
new file mode 100644
index 0000000000..ee87b8164f
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/client/crashpad_client_posix.cc.orig 2025-05-24 17:57:53.605397877 +0000
++++ third_party/crashpad/crashpad/client/crashpad_client_posix.cc
+@@ -0,0 +1,40 @@
++// Copyright 2017 The Crashpad Authors. All rights reserved.
++//
++// Licensed under the Apache License, Version 2.0 (the "License");
++// you may not use this file except in compliance with the License.
++// You may obtain a copy of the License at
++//
++// http://www.apache.org/licenses/LICENSE-2.0
++//
++// Unless required by applicable law or agreed to in writing, software
++// distributed under the License is distributed on an "AS IS" BASIS,
++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++// See the License for the specific language governing permissions and
++// limitations under the License.
++
++#include "client/crashpad_client.h"
++
++#include "base/logging.h"
++#include "base/notreached.h"
++
++namespace crashpad {
++
++CrashpadClient::CrashpadClient() {}
++
++CrashpadClient::~CrashpadClient() {}
++
++bool CrashpadClient::StartHandler(
++ const base::FilePath& handler,
++ const base::FilePath& database,
++ const base::FilePath& metrics_dir,
++ const std::string& url,
++ const std::map<std::string, std::string>& annotations,
++ const std::vector<std::string>& arguments,
++ bool restartable,
++ bool asynchronous_start,
++ const std::vector<base::FilePath>& attachments) {
++ NOTREACHED(); // TODO(scottmg): https://crashpad.chromium.org/bug/196
++ return false;
++}
++
++} // namespace crashpad
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc b/electron34/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc
new file mode 100644
index 0000000000..a7175e1b4e
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/minidump/minidump_misc_info_writer.cc
+@@ -159,6 +159,12 @@ std::string MinidumpMiscInfoDebugBuildSt
+ static constexpr char kOS[] = "win";
+ #elif BUILDFLAG(IS_FUCHSIA)
+ static constexpr char kOS[] = "fuchsia";
++#elif defined(OS_OPENBSD)
++ static constexpr char kOS[] = "openbsd";
++#elif defined(OS_FREEBSD)
++ static constexpr char kOS[] = "freebsd";
++#elif defined(OS_NETBSD)
++ static constexpr char kOS[] = "netbsd";
+ #else
+ #error define kOS for this operating system
+ #endif
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h
new file mode 100644
index 0000000000..219f3c18f2
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/misc/address_types.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/misc/address_types.h
+@@ -25,7 +25,7 @@
+ #include <mach/mach_types.h>
+ #elif BUILDFLAG(IS_WIN)
+ #include "util/win/address_types.h"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "util/linux/address_types.h"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include <zircon/types.h>
+@@ -55,7 +55,7 @@ using VMSize = mach_vm_size_t;
+ using VMAddress = WinVMAddress;
+ using VMSize = WinVMSize;
+
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+
+ using VMAddress = LinuxVMAddress;
+ using VMSize = LinuxVMSize;
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h
new file mode 100644
index 0000000000..e46fa1a138
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/misc/capture_context.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/misc/capture_context.h
+@@ -21,7 +21,8 @@
+ #include <mach/mach.h>
+ #elif BUILDFLAG(IS_WIN)
+ #include <windows.h>
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
++ BUILDFLAG(IS_FREEBSD) || BUILDFLAG(IS_NETBSD)
+ #include <ucontext.h>
+ #endif // BUILDFLAG(IS_APPLE)
+
+@@ -35,7 +36,8 @@ using NativeCPUContext = arm_unified_thr
+ #endif
+ #elif BUILDFLAG(IS_WIN)
+ using NativeCPUContext = CONTEXT;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || \
++ BUILDFLAG(IS_BSD)
+ using NativeCPUContext = ucontext_t;
+ #endif // BUILDFLAG(IS_APPLE)
+
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc
new file mode 100644
index 0000000000..e14a6540ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/misc/metrics.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/misc/metrics.cc
+@@ -25,7 +25,7 @@
+ #define METRICS_OS_NAME "Win"
+ #elif BUILDFLAG(IS_ANDROID)
+ #define METRICS_OS_NAME "Android"
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #define METRICS_OS_NAME "Linux"
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #define METRICS_OS_NAME "Fuchsia"
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc
new file mode 100644
index 0000000000..de90defa68
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/misc/uuid.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/misc/uuid.cc
+@@ -110,7 +110,7 @@ bool UUID::InitializeWithNew() {
+ InitializeFromBytes(uuid);
+ return true;
+ #elif BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Linux, Android, and Fuchsia do not provide a UUID generator in a
+ // widely-available system library. On Linux and Android, uuid_generate()
+ // from libuuid is not available everywhere.
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc
new file mode 100644
index 0000000000..10b4752daa
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/posix/close_multiple.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/posix/close_multiple.cc
+@@ -73,7 +73,7 @@ void CloseNowOrOnExec(int fd, bool ebadf
+ // This is an advantage over looping over all possible file descriptors, because
+ // no attempt needs to be made to close file descriptors that are not open.
+ bool CloseMultipleNowOrOnExecUsingFDDir(int min_fd, int preserve_fd) {
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ static constexpr char kFDDir[] = "/dev/fd";
+ #elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
+ static constexpr char kFDDir[] = "/proc/self/fd";
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc
new file mode 100644
index 0000000000..aedce6dfe5
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/posix/drop_privileges.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/posix/drop_privileges.cc
+@@ -25,7 +25,7 @@ void DropPrivileges() {
+ gid_t gid = getgid();
+ uid_t uid = getuid();
+
+-#if BUILDFLAG(IS_APPLE)
++#if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_BSD)
+ // Based on the POSIX.1-2008 2013 edition documentation for setreuid() and
+ // setregid(), setreuid() and setregid() alone should be sufficient to drop
+ // privileges. The standard specifies that the saved ID should be set to the
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc
new file mode 100644
index 0000000000..1b4f972dc4
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/posix/signals.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/posix/signals.cc
+@@ -51,7 +51,7 @@ constexpr int kCrashSignals[] = {
+ #if defined(SIGEMT)
+ SIGEMT,
+ #endif // defined(SIGEMT)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SIGXCPU,
+ SIGXFSZ,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+@@ -91,7 +91,7 @@ constexpr int kTerminateSignals[] = {
+ SIGXCPU,
+ SIGXFSZ,
+ #endif // BUILDFLAG(IS_APPLE)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ SIGIO,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+ };
+@@ -251,8 +251,12 @@ bool Signals::WillSignalReraiseAutonomou
+ // remains. See 10.12.3 xnu-3789.41.3/bsd/kern/kern_sig.c
+ // psignal_internal().
+ (code > 0 &&
++#if defined(SI_ASYNCIO)
+ code != SI_ASYNCIO &&
++#endif
++#if defined(SI_MESGQ)
+ code != SI_MESGQ &&
++#endif
+ code != SI_QUEUE &&
+ code != SI_TIMER &&
+ code != SI_USER &&
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc
new file mode 100644
index 0000000000..38a5bbd92b
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/posix/symbolic_constants_posix.cc
+@@ -68,7 +68,7 @@ constexpr const char* kSignalNames[] = {
+ "INFO",
+ "USR1",
+ "USR2",
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #if defined(ARCH_CPU_MIPS_FAMILY)
+ "HUP",
+ "INT",
+@@ -139,7 +139,7 @@ constexpr const char* kSignalNames[] = {
+ #endif // defined(ARCH_CPU_MIPS_FAMILY)
+ #endif
+ };
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ // NSIG is 64 to account for real-time signals.
+ static_assert(std::size(kSignalNames) == 32, "kSignalNames length");
+ #else
diff --git a/electron34/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc b/electron34/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc
new file mode 100644
index 0000000000..1e7013e4f6
--- /dev/null
+++ b/electron34/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crashpad/crashpad/util/win/exception_handler_server.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crashpad/crashpad/util/win/exception_handler_server.cc
+@@ -448,9 +448,16 @@ bool ExceptionHandlerServer::ServiceClie
+ DWORD real_pid = 0;
+ if (get_named_pipe_client_process_id(service_context.pipe(), &real_pid) &&
+ message.registration.client_process_id != real_pid) {
++ // Electron: When both browser process and renderer process are connecting
++ // to the pipe, the API may return the PID of browser process as real_pid,
++ // which is different from the PID of renderer process.
++ //
++ // I don't understand why Chromium does not have this issue.
++#if 0
+ LOG(ERROR) << "forged client pid, real pid: " << real_pid
+ << ", got: " << message.registration.client_process_id;
+ return false;
++#endif
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_crc32c_BUILD.gn b/electron34/patches/patch-third__party_crc32c_BUILD.gn
new file mode 100644
index 0000000000..5ee495c3c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_crc32c_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/crc32c/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/crc32c/BUILD.gn
+@@ -46,7 +46,7 @@ config("crc32c_config") {
+ }
+
+ # Android added <sys/auxv.h> in API level 18.
+- if (is_linux || is_chromeos || is_android) {
++ if (is_linux || is_chromeos || is_android && !is_bsd) {
+ defines += [
+ "HAVE_STRONG_GETAUXVAL=1",
+ "HAVE_WEAK_GETAUXVAL=1",
diff --git a/electron34/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h b/electron34/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h
new file mode 100644
index 0000000000..22e384825f
--- /dev/null
+++ b/electron34/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/dawn/include/dawn/native/VulkanBackend.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/dawn/include/dawn/native/VulkanBackend.h
+@@ -83,7 +83,8 @@ struct ExternalImageExportInfoVk : Exter
+ };
+
+ // Can't use DAWN_PLATFORM_IS(LINUX) since header included in both Dawn and Chrome
+-#if defined(__linux__) || defined(__Fuchsia__)
++#if defined(__linux__) || defined(__Fuchsia__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__)
+
+ // Common properties of external images represented by FDs. On successful import the file
+ // descriptor's ownership is transferred to the Dawn implementation and they shouldn't be
diff --git a/electron34/patches/patch-third__party_dawn_src_dawn_common_Platform.h b/electron34/patches/patch-third__party_dawn_src_dawn_common_Platform.h
new file mode 100644
index 0000000000..658f25c312
--- /dev/null
+++ b/electron34/patches/patch-third__party_dawn_src_dawn_common_Platform.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/dawn/src/dawn/common/Platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/dawn/src/dawn/common/Platform.h
+@@ -59,6 +59,11 @@
+ #error "Unsupported Windows platform."
+ #endif
+
++#elif defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++#define DAWN_PLATFORM_IS_LINUX 1
++#define DAWN_PLATFORM_IS_BSD 1
++#define DAWN_PLATFORM_IS_POSIX 1
++
+ #elif defined(__linux__)
+ #define DAWN_PLATFORM_IS_LINUX 1
+ #define DAWN_PLATFORM_IS_POSIX 1
diff --git a/electron34/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp b/electron34/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp
new file mode 100644
index 0000000000..8a3cbc2647
--- /dev/null
+++ b/electron34/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/dawn/src/dawn/native/vulkan/BackendVk.cpp
+@@ -56,7 +56,7 @@ constexpr char kSwiftshaderLibName[] = "
+ #endif
+
+ #if DAWN_PLATFORM_IS(LINUX)
+-#if DAWN_PLATFORM_IS(ANDROID)
++#if DAWN_PLATFORM_IS(ANDROID) || DAWN_PLATFORM_IS(BSD)
+ constexpr char kVulkanLibName[] = "libvulkan.so";
+ #else
+ constexpr char kVulkanLibName[] = "libvulkan.so.1";
diff --git a/electron34/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts b/electron34/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts
new file mode 100644
index 0000000000..865c93fde5
--- /dev/null
+++ b/electron34/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/devtools-frontend/src/front_end/entrypoints/main/MainImpl.ts.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/devtools-frontend/src/front_end/entrypoints/main/MainImpl.ts
+@@ -772,6 +772,8 @@ export class MainImpl {
+ globalThis.Main = globalThis.Main || {};
+ // @ts-ignore Exported for Tests.js
+ globalThis.Main.Main = MainImpl;
++// @ts-ignore Exported for Electron
++globalThis.EUI = UI || {};
+
+ export class ZoomActionDelegate implements UI.ActionRegistration.ActionDelegate {
+ handleAction(_context: UI.Context.Context, actionId: string): boolean {
diff --git a/electron34/patches/patch-third__party_electron__node_BUILD.gn b/electron34/patches/patch-third__party_electron__node_BUILD.gn
new file mode 100644
index 0000000000..8f0286a5c5
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_BUILD.gn
@@ -0,0 +1,426 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/BUILD.gn
+@@ -1,14 +1,406 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++import("//v8/gni/v8.gni")
++import("//electron/js2c_toolchain.gni")
++import("electron_node.gni")
+
+-import("unofficial.gni")
++declare_args() {
++ # Enable the V8 inspector protocol for use with node.
++ node_enable_inspector = true
+
+-node_gn_build("node") {
++ # Build node with SSL support.
++ # The variable is called "openssl" for parity with node's GYP build.
++ node_use_openssl = true
++
++ # Use the specified path to system CA (PEM format) in addition to
++ # the BoringSSL supplied CA store or compiled-in Mozilla CA copy.
++ node_openssl_system_ca_path = ""
++
++ # Initialize v8 platform during node.js startup.
++ # NB. this must be turned off in Electron, because Electron initializes the
++ # v8 platform itself.
++ node_use_v8_platform = false
++
++ # Build with DTrace support.
++ node_use_dtrace = false
++
++ # Build with ETW support.
++ node_use_etw = false
++
++ # Build JavaScript in lib/ with DCHECK macros.
++ node_debug_lib = false
++
++ # Custom build tag.
++ node_tag = ""
++
++ # V8 options to pass, see `node --v8-options` for examples
++ node_v8_options = ""
++
++ # Provide a custom URL prefix for the `process.release` properties
++ # `sourceUrl` and `headersUrl`. When compiling a release build, this will
++ # default to https://nodejs.org/download/release/')
++ node_release_urlbase = ""
++
++ # Allows downstream packagers (eg. Linux distributions) to build Electron against system shared libraries.
++ use_system_cares = true
++ use_system_nghttp2 = true
++ use_system_llhttp = false
++ use_system_histogram = false
++}
++
++if (is_linux) {
++ import("//build/config/linux/pkg_config.gni")
++ if (use_system_cares) {
++ pkg_config("cares") {
++ packages = [ "libcares" ]
++ }
++ }
++ if (use_system_nghttp2) {
++ pkg_config("nghttp2") {
++ packages = [ "libnghttp2" ]
++ }
++ }
++}
++
++assert(!node_use_dtrace, "node_use_dtrace not supported in GN")
++assert(!node_use_etw, "node_use_etw not supported in GN")
++
++assert(!node_enable_inspector || node_use_openssl,
++ "node_enable_inspector requires node_use_openssl")
++
++config("node_internals") {
++ defines = [ "NODE_WANT_INTERNALS=1" ]
++}
++
++node_files = read_file("filenames.json", "json")
++library_files = node_files.library_files
++fs_files = node_files.fs_files
++original_fs_files = []
++foreach(file, fs_files) {
++ original_fs_files += [string_replace(string_replace(string_replace(file, "internal/fs/", "internal/original-fs/"), "lib/fs.js", "lib/original-fs.js"), "lib/fs/", "lib/original-fs/")]
++}
++
++copy("node_js2c_inputs") {
++ sources = library_files
++ outputs = [
++ "$target_gen_dir/js2c_inputs/{{source_target_relative}}",
++ ]
++}
++
++action("node_js2c_original_fs") {
++ script = "tools/generate_original_fs.py"
++ inputs = fs_files
++ outputs = []
++ foreach(file, fs_files + original_fs_files) {
++ outputs += ["$target_gen_dir/js2c_inputs/$file"]
++ }
++
++ args = [rebase_path("$target_gen_dir/js2c_inputs")] + fs_files
++}
++
++action("node_js2c_exec") {
++ deps = [
++ "//electron:generate_config_gypi",
++ ":node_js2c_original_fs",
++ ":node_js2c_inputs",
++ ":node_js2c($electron_js2c_toolchain)"
++ ]
++ config_gypi = [ "$root_gen_dir/config.gypi" ]
++ inputs = library_files + get_target_outputs(":node_js2c_original_fs") + config_gypi
++ outputs = [
++ "$target_gen_dir/node_javascript.cc",
++ ]
++
++ script = "//electron/build/run-in-dir.py"
++ out_dir = get_label_info(":anything($electron_js2c_toolchain)", "root_out_dir")
++ args = [ rebase_path("$target_gen_dir/js2c_inputs"), rebase_path("$out_dir/node_js2c") ] +
++ rebase_path(outputs) + library_files + fs_files + original_fs_files + rebase_path(config_gypi)
++}
++
++config("node_features") {
++ defines = []
++ if (node_enable_inspector) {
++ defines += [ "HAVE_INSPECTOR=1" ]
++ } else {
++ defines += [ "HAVE_INSPECTOR=0" ]
++ }
++ if (node_use_openssl) {
++ defines += [ "HAVE_OPENSSL=1" ]
++ } else {
++ defines += [ "HAVE_OPENSSL=0" ]
++ }
++ if (v8_enable_i18n_support) {
++ defines += [ "NODE_HAVE_I18N_SUPPORT=1" ]
++ } else {
++ defines += [ "NODE_HAVE_I18N_SUPPORT=0" ]
++ }
++ if (node_use_v8_platform) {
++ defines += [ "NODE_USE_V8_PLATFORM=1" ]
++ } else {
++ defines += [ "NODE_USE_V8_PLATFORM=0" ]
++ }
++}
++
++config("node_lib_config") {
++ include_dirs = [ "src" ]
++
++ cflags = [
++ "-Wno-shadow",
++ # FIXME(deepak1556): include paths should be corrected,
++ # refer https://docs.google.com/presentation/d/1oxNHaVjA9Gn_rTzX6HIpJHP7nXRua_0URXxxJ3oYRq0/edit#slide=id.g71ecd450e_2_702
++ "-Wno-microsoft-include",
++ ]
++
++ configs = [ ":node_features" ]
++
++ if (is_debug) {
++ defines = [ "DEBUG" ]
++ }
++}
++
++config("node_internal_config") {
++ visibility = [
++ ":*",
++ "src/inspector:*",
++ ]
++ defines = [
++ "NODE_WANT_INTERNALS=1",
++ "NODE_IMPLEMENTATION",
++ ]
++ if (node_module_version != "") {
++ defines += [ "NODE_EMBEDDER_MODULE_VERSION=" + node_module_version ]
++ }
++ if (is_component_build) {
++ defines += [
++ "NODE_SHARED_MODE",
++ ]
++ }
++
++ if (target_cpu == "x86") {
++ node_arch = "ia32"
++ } else {
++ node_arch = target_cpu
++ }
++ defines += [ "NODE_ARCH=\"$node_arch\"" ]
++
++ if (target_os == "win") {
++ node_platform = "win32"
++ } else if (target_os == "mac") {
++ node_platform = "darwin"
++ } else {
++ node_platform = target_os
++ }
++ defines += [ "NODE_PLATFORM=\"$node_platform\"" ]
++
++ if (is_win) {
++ defines += [
++ "NOMINMAX",
++ "_UNICODE=1",
++ ]
++ } else {
++ defines += [ "__POSIX__" ]
++ }
++
++ if (node_tag != "") {
++ defines += [ "NODE_TAG=\"$node_tag\"" ]
++ }
++ if (node_v8_options != "") {
++ defines += [ "NODE_V8_OPTIONS=\"$node_v8_options\"" ]
++ }
++ if (node_release_urlbase != "") {
++ defines += [ "NODE_RELEASE_URLBASE=\"$node_release_urlbase\"" ]
++ }
++
++ if (node_use_openssl) {
++ defines += [
++ "NODE_OPENSSL_SYSTEM_CERT_PATH=\"$node_openssl_system_ca_path\"",
++ "EVP_CTRL_CCM_SET_TAG=EVP_CTRL_GCM_SET_TAG",
++ ]
++ }
++}
++
++executable("overlapped-checker") {
++ sources = []
++ if (is_win) {
++ sources += [ "test/overlapped-checker/main_win.c" ]
++ } else {
++ sources += [ "test/overlapped-checker/main_unix.c" ]
++ }
++}
++
++if (current_toolchain == electron_js2c_toolchain) {
++ executable("node_js2c") {
++ defines = []
++ sources = [
++ "tools/js2c.cc",
++ "tools/executable_wrapper.h",
++ "src/embedded_data.cc",
++ "src/embedded_data.h",
++ ]
++ include_dirs = [ "tools", "src" ]
++ deps = [
++ "deps/simdutf($electron_js2c_toolchain)",
++ "deps/uv($electron_js2c_toolchain)",
++ "//v8"
++ ]
++
++ if (!is_win) {
++ defines += [ "NODE_JS2C_USE_STRING_LITERALS" ]
++ }
++ if (is_debug) {
++ cflags_cc = [ "-g", "-O0" ]
++ defines += [ "DEBUG" ]
++ }
++ }
++}
++
++component("node_lib") {
++ deps = [
++ ":node_js2c_exec",
++ "deps/googletest:gtest",
++ "deps/ada",
++ "deps/simdutf",
++ "deps/uvwasi",
++ "//third_party/zlib",
++ "//third_party/brotli:dec",
++ "//third_party/brotli:enc",
++ "//v8:v8_libplatform",
++ ]
++ if (use_system_cares) {
++ configs += [ ":cares" ]
++ } else {
++ deps += [ "deps/cares" ]
++ }
++ if (use_system_nghttp2) {
++ configs += [ ":nghttp2" ]
++ } else {
++ deps += [ "deps/nghttp2" ]
++ }
++ public_deps = [
++ "deps/uv",
++ "//electron:electron_js2c",
++ "//v8",
++ ]
++ configs += [ ":node_internal_config" ]
++ public_configs = [ ":node_lib_config" ]
++ include_dirs = [
++ "src",
++ "deps/postject"
++ ]
++ libs = []
++ if (use_system_llhttp) {
++ libs += [ "llhttp" ]
++ } else {
++ deps += [ "deps/llhttp" ]
++ }
++ if (use_system_histogram) {
++ libs += [ "hdr_histogram" ]
++ include_dirs += [ "/usr/include/hdr" ]
++ } else {
++ deps += [ "deps/histogram" ]
++ }
++ frameworks = []
++ cflags_cc = [
++ "-Wno-deprecated-declarations",
++ "-Wno-implicit-fallthrough",
++ "-Wno-return-type",
++ "-Wno-sometimes-uninitialized",
++ "-Wno-string-plus-int",
++ "-Wno-unused-function",
++ "-Wno-unreachable-code-return",
++ "-Wno-unused-label",
++ "-Wno-unused-private-field",
++ "-Wno-unused-variable",
++ ]
++
++ if (v8_enable_i18n_support) {
++ deps += [ "//third_party/icu" ]
++ }
++
++ sources = node_files.node_sources
++ sources += [
++ "$root_gen_dir/electron_natives.cc",
++ "$target_gen_dir/node_javascript.cc",
++ "src/node_snapshot_stub.cc",
++ ]
++
++ if (is_win) {
++ libs += [ "psapi.lib" ]
++ }
++ if (is_mac) {
++ frameworks += [ "CoreFoundation.framework" ]
++ }
++
++ if (node_enable_inspector) {
++ sources += [
++ "src/inspector_agent.cc",
++ "src/inspector_agent.h",
++ "src/inspector_io.cc",
++ "src/inspector_io.h",
++ "src/inspector_js_api.cc",
++ "src/inspector_profiler.cc",
++ "src/inspector_socket.cc",
++ "src/inspector_socket.h",
++ "src/inspector_socket_server.cc",
++ "src/inspector_socket_server.h",
++ ]
++ deps += [ "src/inspector" ]
++ }
++
++ if (node_use_openssl) {
++ deps += [ "//third_party/boringssl" ]
++ sources += [
++ "src/crypto/crypto_aes.cc",
++ "src/crypto/crypto_aes.h",
++ "src/crypto/crypto_bio.cc",
++ "src/crypto/crypto_bio.h",
++ "src/crypto/crypto_cipher.cc",
++ "src/crypto/crypto_cipher.h",
++ "src/crypto/crypto_clienthello-inl.h",
++ "src/crypto/crypto_clienthello.cc",
++ "src/crypto/crypto_clienthello.h",
++ "src/crypto/crypto_common.cc",
++ "src/crypto/crypto_common.h",
++ "src/crypto/crypto_context.cc",
++ "src/crypto/crypto_context.h",
++ "src/crypto/crypto_dh.cc",
++ "src/crypto/crypto_dh.h",
++ "src/crypto/crypto_dsa.cc",
++ "src/crypto/crypto_dsa.h",
++ "src/crypto/crypto_ec.cc",
++ "src/crypto/crypto_ec.h",
++ "src/crypto/crypto_groups.h",
++ "src/crypto/crypto_hash.cc",
++ "src/crypto/crypto_hash.h",
++ "src/crypto/crypto_hkdf.cc",
++ "src/crypto/crypto_hkdf.h",
++ "src/crypto/crypto_hmac.cc",
++ "src/crypto/crypto_hmac.h",
++ "src/crypto/crypto_keygen.cc",
++ "src/crypto/crypto_keygen.h",
++ "src/crypto/crypto_keys.cc",
++ "src/crypto/crypto_keys.h",
++ "src/crypto/crypto_pbkdf2.cc",
++ "src/crypto/crypto_pbkdf2.h",
++ "src/crypto/crypto_random.cc",
++ "src/crypto/crypto_random.h",
++ "src/crypto/crypto_rsa.cc",
++ "src/crypto/crypto_rsa.h",
++ "src/crypto/crypto_scrypt.cc",
++ "src/crypto/crypto_scrypt.h",
++ "src/crypto/crypto_sig.cc",
++ "src/crypto/crypto_sig.h",
++ "src/crypto/crypto_spkac.cc",
++ "src/crypto/crypto_spkac.h",
++ "src/crypto/crypto_timing.cc",
++ "src/crypto/crypto_timing.h",
++ "src/crypto/crypto_tls.cc",
++ "src/crypto/crypto_tls.h",
++ "src/crypto/crypto_util.cc",
++ "src/crypto/crypto_util.h",
++ "src/crypto/crypto_x509.cc",
++ "src/crypto/crypto_x509.h",
++ "src/node_crypto.cc",
++ "src/node_crypto.h",
++ ]
++ cflags_cc += [ "-Wno-sign-compare" ]
++ }
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_common.gypi b/electron34/patches/patch-third__party_electron__node_common.gypi
new file mode 100644
index 0000000000..9879f2c432
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_common.gypi
@@ -0,0 +1,102 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/common.gypi.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/common.gypi
+@@ -86,8 +86,27 @@
+ 'v8_use_perfetto': 0,
+ 'tsan%': 0,
+
++ 'using_electron_config_gypi%': 0,
++
+ ##### end V8 defaults #####
+
++ # When building native modules using 'npm install' with the system npm,
++ # node-gyp uses the `process.config` of the system npm to fill config.gypi.
++ # If the system npm is not as recent as Electron's node headers, which is
++ # likely, these variables will be missing from that config.gypi, and as a
++ # result, node-gyp will fail when building the native module with an error
++ # like:
++ #
++ # gyp: name 'enable_lto' is not defined while evaluating condition
++ # 'enable_lto=="true"' in binding.gyp while trying to load binding.gyp
++ #
++ # We set default values here to avoid that error message, even though these
++ # aren't technically accurate, because most native modules don't depend on
++ # these values being accurate.
++ 'build_v8_with_gn': 'false',
++ 'enable_lto%': 'false',
++ 'llvm_version': '0.0',
++
+ 'conditions': [
+ ['OS == "win"', {
+ 'os_posix': 0,
+@@ -106,6 +125,7 @@
+ 'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
+ }],
+ ['OS=="mac"', {
++ 'clang%': 1,
+ 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
+ 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
+ }],
+@@ -268,6 +288,7 @@
+ # Defines these mostly for node-gyp to pickup.
+ 'defines': [
+ '_GLIBCXX_USE_CXX11_ABI=1',
++ 'ELECTRON_ENSURE_CONFIG_GYPI',
+ ],
+
+ # Forcibly disable -Werror. We support a wide range of compilers, it's
+@@ -285,7 +306,7 @@
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': [
+ '/Zc:__cplusplus',
+- '-std:c++17'
++ '-std:c++20'
+ ],
+ 'BufferSecurityCheck': 'true',
+ 'DebugInformationFormat': 1, # /Z7 embed info in .obj files
+@@ -397,6 +418,11 @@
+ }],
+ ],
+ }],
++ ['using_electron_config_gypi == 1', {
++ 'defines': [
++ 'USING_ELECTRON_CONFIG_GYPI',
++ ],
++ }],
+ # The defines bellow must include all things from the external_v8_defines
+ # list in v8/BUILD.gn.
+ ['v8_enable_v8_checks == 1', {
+@@ -454,6 +480,10 @@
+ '_HAS_EXCEPTIONS=0',
+ 'BUILDING_V8_SHARED=1',
+ 'BUILDING_UV_SHARED=1',
++ # Stop <windows.h> from defining macros that conflict with
++ # std::min() and std::max(). We don't use <windows.h> (much)
++ # but we still inherit it from uv.h.
++ 'NOMINMAX',
+ ],
+ }],
+ [ 'OS in "linux freebsd openbsd solaris aix os400"', {
+@@ -462,7 +492,7 @@
+ }],
+ [ 'OS in "linux freebsd openbsd solaris android aix os400 cloudabi"', {
+ 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
+- 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++17' ],
++ 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++20' ],
+ 'defines': [ '__STDC_FORMAT_MACROS' ],
+ 'ldflags': [ '-rdynamic' ],
+ 'target_conditions': [
+@@ -633,7 +663,7 @@
+ ['clang==1', {
+ 'xcode_settings': {
+ 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
+- 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++17', # -std=gnu++17
++ 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++20', # -std=gnu++20
+ 'CLANG_CXX_LIBRARY': 'libc++',
+ },
+ }],
diff --git a/electron34/patches/patch-third__party_electron__node_configure.py b/electron34/patches/patch-third__party_electron__node_configure.py
new file mode 100644
index 0000000000..4682658f87
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_configure.py
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/configure.py.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/configure.py
+@@ -1595,6 +1595,7 @@ def configure_library(lib, output, pkgna
+
+
+ def configure_v8(o):
++ o['variables']['using_electron_config_gypi'] = 1
+ o['variables']['v8_enable_webassembly'] = 0 if options.v8_lite_mode else 1
+ o['variables']['v8_enable_javascript_promise_hooks'] = 1
+ o['variables']['v8_enable_lite_mode'] = 1 if options.v8_lite_mode else 0
diff --git a/electron34/patches/patch-third__party_electron__node_deps_ada_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_ada_BUILD.gn
new file mode 100644
index 0000000000..830da30ea7
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_ada_BUILD.gn
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/ada/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/ada/BUILD.gn
+@@ -1,14 +1,12 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
++import("//v8/gni/v8.gni")
+
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("ada_config") {
++ include_dirs = [ "." ]
++}
+
+-import("unofficial.gni")
++static_library("ada") {
++ include_dirs = [ "." ]
++ sources = [ "ada.cpp" ]
+
+-ada_gn_build("ada") {
++ public_configs = [ ":ada_config" ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_brotli_unofficial.gni b/electron34/patches/patch-third__party_electron__node_deps_brotli_unofficial.gni
new file mode 100644
index 0000000000..bf0861d9a8
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_brotli_unofficial.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/brotli/unofficial.gni.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/brotli/unofficial.gni
+@@ -25,7 +25,7 @@ template("brotli_gn_build") {
+ } else if (target_os == "freebsd") {
+ defines = [ "OS_FREEBSD" ]
+ }
+- if (!is_win) {
++ if (is_linux) {
+ libs = [ "m" ]
+ }
+ if (is_clang || !is_win) {
diff --git a/electron34/patches/patch-third__party_electron__node_deps_cares_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
new file mode 100644
index 0000000000..e53be6a487
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
@@ -0,0 +1,218 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/cares/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/cares/BUILD.gn
+@@ -1,14 +1,198 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("cares_config") {
++ include_dirs = [
++ "include",
++ "src/lib",
++ "src/lib/include",
++ ]
++}
++static_library("cares") {
++ defines = [ "CARES_STATICLIB" ]
++ include_dirs = [ "include" ]
++ public_configs = [ ":cares_config" ]
++
++ libs = []
++ cflags_c = [
++ "-Wno-logical-not-parentheses",
++ "-Wno-implicit-fallthrough",
++ "-Wno-sign-compare",
++ ]
++
++ sources = [
++ "include/ares.h",
++ "include/ares_build.h",
++ "include/ares_dns.h",
++ "include/ares_dns_record.h",
++ "include/ares_nameser.h",
++ "include/ares_version.h",
++ "src/lib/ares_addrinfo2hostent.c",
++ "src/lib/ares_addrinfo_localhost.c",
++ "src/lib/ares_android.c",
++ "src/lib/ares_android.h",
++ "src/lib/ares_cancel.c",
++ "src/lib/ares_close_sockets.c",
++ "src/lib/ares_conn.c",
++ "src/lib/ares_conn.h",
++ "src/lib/ares_cookie.c",
++ "src/lib/ares_data.c",
++ "src/lib/ares_data.h",
++ "src/lib/ares_destroy.c",
++ "src/lib/ares_free_hostent.c",
++ "src/lib/ares_free_string.c",
++ "src/lib/ares_freeaddrinfo.c",
++ "src/lib/ares_getaddrinfo.c",
++ "src/lib/ares_getenv.c",
++ "src/lib/ares_getenv.h",
++ "src/lib/ares_gethostbyaddr.c",
++ "src/lib/ares_gethostbyname.c",
++ "src/lib/ares_getnameinfo.c",
++ "src/lib/ares_hosts_file.c",
++ "src/lib/ares_inet_net_pton.h",
++ "src/lib/ares_init.c",
++ "src/lib/ares_ipv6.h",
++ "src/lib/ares_library_init.c",
++ "src/lib/ares_metrics.c",
++ "src/lib/ares_options.c",
++ "src/lib/ares_parse_into_addrinfo.c",
++ "src/lib/ares_private.h",
++ "src/lib/ares_process.c",
++ "src/lib/ares_qcache.c",
++ "src/lib/ares_query.c",
++ "src/lib/ares_search.c",
++ "src/lib/ares_send.c",
++ "src/lib/ares_set_socket_functions.c",
++ "src/lib/ares_setup.h",
++ "src/lib/ares_socket.c",
++ "src/lib/ares_socket.h",
++ "src/lib/ares_sortaddrinfo.c",
++ "src/lib/ares_strerror.c",
++ "src/lib/ares_sysconfig.c",
++ "src/lib/ares_sysconfig_files.c",
++ "src/lib/ares_timeout.c",
++ "src/lib/ares_update_servers.c",
++ "src/lib/ares_version.c",
++ "src/lib/dsa/ares_array.c",
++ "src/lib/dsa/ares_htable.c",
++ "src/lib/dsa/ares_htable.h",
++ "src/lib/dsa/ares_htable_asvp.c",
++ "src/lib/dsa/ares_htable_dict.c",
++ "src/lib/dsa/ares_htable_strvp.c",
++ "src/lib/dsa/ares_htable_szvp.c",
++ "src/lib/dsa/ares_htable_vpstr.c",
++ "src/lib/dsa/ares_htable_vpvp.c",
++ "src/lib/dsa/ares_llist.c",
++ "src/lib/dsa/ares_slist.c",
++ "src/lib/dsa/ares_slist.h",
++ "src/lib/event/ares_event.h",
++ "src/lib/event/ares_event_configchg.c",
++ "src/lib/event/ares_event_epoll.c",
++ "src/lib/event/ares_event_kqueue.c",
++ "src/lib/event/ares_event_poll.c",
++ "src/lib/event/ares_event_select.c",
++ "src/lib/event/ares_event_thread.c",
++ "src/lib/event/ares_event_wake_pipe.c",
++ "src/lib/event/ares_event_win32.c",
++ "src/lib/event/ares_event_win32.h",
++ "src/lib/include/ares_array.h",
++ "src/lib/include/ares_buf.h",
++ "src/lib/include/ares_htable_asvp.h",
++ "src/lib/include/ares_htable_dict.h",
++ "src/lib/include/ares_htable_strvp.h",
++ "src/lib/include/ares_htable_szvp.h",
++ "src/lib/include/ares_htable_vpstr.h",
++ "src/lib/include/ares_htable_vpvp.h",
++ "src/lib/include/ares_llist.h",
++ "src/lib/include/ares_mem.h",
++ "src/lib/include/ares_str.h",
++ "src/lib/inet_net_pton.c",
++ "src/lib/inet_ntop.c",
++ "src/lib/legacy/ares_create_query.c",
++ "src/lib/legacy/ares_expand_name.c",
++ "src/lib/legacy/ares_expand_string.c",
++ "src/lib/legacy/ares_fds.c",
++ "src/lib/legacy/ares_getsock.c",
++ "src/lib/legacy/ares_parse_a_reply.c",
++ "src/lib/legacy/ares_parse_aaaa_reply.c",
++ "src/lib/legacy/ares_parse_caa_reply.c",
++ "src/lib/legacy/ares_parse_mx_reply.c",
++ "src/lib/legacy/ares_parse_naptr_reply.c",
++ "src/lib/legacy/ares_parse_ns_reply.c",
++ "src/lib/legacy/ares_parse_ptr_reply.c",
++ "src/lib/legacy/ares_parse_soa_reply.c",
++ "src/lib/legacy/ares_parse_srv_reply.c",
++ "src/lib/legacy/ares_parse_txt_reply.c",
++ "src/lib/legacy/ares_parse_uri_reply.c",
++ "src/lib/record/ares_dns_mapping.c",
++ "src/lib/record/ares_dns_multistring.c",
++ "src/lib/record/ares_dns_multistring.h",
++ "src/lib/record/ares_dns_name.c",
++ "src/lib/record/ares_dns_parse.c",
++ "src/lib/record/ares_dns_private.h",
++ "src/lib/record/ares_dns_record.c",
++ "src/lib/record/ares_dns_write.c",
++ "src/lib/str/ares_buf.c",
++ "src/lib/str/ares_str.c",
++ "src/lib/str/ares_strsplit.c",
++ "src/lib/str/ares_strsplit.h",
++ "src/lib/util/ares_iface_ips.c",
++ "src/lib/util/ares_iface_ips.h",
++ "src/lib/util/ares_math.c",
++ "src/lib/util/ares_math.h",
++ "src/lib/util/ares_rand.c",
++ "src/lib/util/ares_rand.h",
++ "src/lib/util/ares_threads.c",
++ "src/lib/util/ares_threads.h",
++ "src/lib/util/ares_time.h",
++ "src/lib/util/ares_timeval.c",
++ "src/lib/util/ares_uri.c",
++ "src/lib/util/ares_uri.h",
++ ]
++
++ if (!is_win) {
++ defines += [
++ "_DARWIN_USE_64_BIT_INODE=1",
++ "_LARGEFILE_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ "_GNU_SOURCE",
++ ]
++ }
++
++ if (is_win) {
++ defines += [ "CARES_PULL_WS2TCPIP_H=1" ]
++ include_dirs += [ "config/win32" ]
++ sources += [
++ "src/lib/ares_sysconfig_win.c",
++ "src/lib/config-win32.h",
++ "src/lib/windows_port.c",
++ ]
++ libs += [
++ "ws2_32.lib",
++ "iphlpapi.lib",
++ ]
++ } else {
++ defines += [ "HAVE_CONFIG_H" ]
++ }
++
++ if (is_linux && !is_bsd) {
++ include_dirs += [ "config/linux" ]
++ sources += [ "config/linux/ares_config.h" ]
++ }
++
++ if (is_freebsd) {
++ include_dirs += [ "config/freebsd" ]
++ sources += [ "config/freebsd/ares_config.h" ]
++ }
+
+-import("unofficial.gni")
++ if (is_netbsd) {
++ include_dirs += [ "config/netbsd" ]
++ sources += [ "config/netbsd/ares_config.h" ]
++ }
+
+-cares_gn_build("cares") {
++ if (is_mac) {
++ include_dirs += [ "config/darwin" ]
++ sources += [
++ "config/darwin/ares_config.h",
++ "src/lib/ares_sysconfig_mac.c",
++ "src/lib/thirdparty/apple/dnsinfo.h",
++ ]
++ }
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn
new file mode 100644
index 0000000000..1a3f1b1398
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn
@@ -0,0 +1,84 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/googletest/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/googletest/BUILD.gn
+@@ -1,14 +1,64 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("gtest_config") {
++ include_dirs = [ "include" ]
++ defines = [ "UNIT_TEST" ]
++}
++
++static_library("gtest") {
++ include_dirs = [
++ "include",
++ "." # src
++ ]
++
++ public_configs = [ ":gtest_config" ]
+
+-import("unofficial.gni")
++ cflags_cc = [
++ "-Wno-c++98-compat-extra-semi",
++ "-Wno-unused-const-variable",
++ "-Wno-unreachable-code-return",
++ ]
++
++ defines = [
++ "GTEST_HAS_POSIX_RE=0",
++ "GTEST_LANG_CXX11=1",
++ ]
++
++ sources = [
++ "include/gtest/gtest_pred_impl.h",
++ "include/gtest/gtest_prod.h",
++ "include/gtest/gtest-death-test.h",
++ "include/gtest/gtest-matchers.h",
++ "include/gtest/gtest-message.h",
++ "include/gtest/gtest-param-test.h",
++ "include/gtest/gtest-printers.h",
++ "include/gtest/gtest-spi.h",
++ "include/gtest/gtest-test-part.h",
++ "include/gtest/gtest-typed-test.h",
++ "include/gtest/gtest.h",
++ "include/gtest/internal/gtest-death-test-internal.h",
++ "include/gtest/internal/gtest-filepath.h",
++ "include/gtest/internal/gtest-internal.h",
++ "include/gtest/internal/gtest-param-util.h",
++ "include/gtest/internal/gtest-port-arch.h",
++ "include/gtest/internal/gtest-port.h",
++ "include/gtest/internal/gtest-string.h",
++ "include/gtest/internal/gtest-type-util.h",
++ "include/gtest/internal/custom/gtest-port.h",
++ "include/gtest/internal/custom/gtest-printers.h",
++ "include/gtest/internal/custom/gtest.h",
++ "src/gtest-all.cc",
++ "src/gtest-death-test.cc",
++ "src/gtest-filepath.cc",
++ "src/gtest-internal-inl.h",
++ "src/gtest-matchers.cc",
++ "src/gtest-port.cc",
++ "src/gtest-printers.cc",
++ "src/gtest-test-part.cc",
++ "src/gtest-typed-test.cc",
++ "src/gtest.cc",
++ ]
++}
+
+-googletest_gn_build("googletest") {
++static_library("gtest_main") {
++ deps = [ ":gtest" ]
++ sources = [ "src/gtest_main.cc" ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn
new file mode 100644
index 0000000000..5996f750b1
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/histogram/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/histogram/BUILD.gn
+@@ -1,14 +1,19 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
++config("histogram_config") {
++ include_dirs = [ "include" ]
+
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++ cflags = [
++ "-Wno-implicit-function-declaration",
++ "-Wno-incompatible-pointer-types",
++ "-Wno-unused-function",
++ "-Wno-atomic-alignment",
++ ]
++}
+
+-import("unofficial.gni")
++static_library("histogram") {
++ public_configs = [ ":histogram_config" ]
+
+-histogram_gn_build("histogram") {
++ sources = [
++ "src/hdr_histogram.c",
++ "src/hdr_histogram.h",
++ ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h b/electron34/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h
new file mode 100644
index 0000000000..135407f873
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/histogram/src/hdr_atomic.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/histogram/src/hdr_atomic.h
+@@ -14,6 +14,13 @@
+ #include <intrin.h>
+ #include <stdbool.h>
+
++#if !defined(_ReadBarrier) || !defined(_WriteBarrier)
++
++#define _ReadBarrier() __asm__ __volatile__("" ::: "memory")
++#define _WriteBarrier() __asm__ __volatile__("" ::: "memory")
++
++#endif
++
+ static void __inline * hdr_atomic_load_pointer(void** pointer)
+ {
+ _ReadBarrier();
diff --git a/electron34/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn
new file mode 100644
index 0000000000..eac2e7bbd3
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/llhttp/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/llhttp/BUILD.gn
+@@ -1,14 +1,15 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
+-
+-import("unofficial.gni")
++config("llhttp_config") {
++ include_dirs = [ "include" ]
++ cflags = [ "-Wno-unreachable-code" ]
++}
+
+-llhttp_gn_build("llhttp") {
++static_library("llhttp") {
++ include_dirs = [ "include" ]
++ public_configs = [ ":llhttp_config" ]
++ cflags_c = [ "-Wno-implicit-fallthrough" ]
++ sources = [
++ "src/api.c",
++ "src/http.c",
++ "src/llhttp.c",
++ ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn
new file mode 100644
index 0000000000..9b0fd292f6
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/nghttp2/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/nghttp2/BUILD.gn
+@@ -1,14 +1,51 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("nghttp2_config") {
++ defines = [ "NGHTTP2_STATICLIB" ]
++ include_dirs = [ "lib/includes" ]
++}
++static_library("nghttp2") {
++ public_configs = [ ":nghttp2_config" ]
++ defines = [
++ "_U_",
++ "BUILDING_NGHTTP2",
++ "NGHTTP2_STATICLIB",
++ "HAVE_CONFIG_H",
++ ]
++ include_dirs = [ "lib/includes" ]
+
+-import("unofficial.gni")
++ cflags_c = [
++ "-Wno-implicit-function-declaration",
++ "-Wno-implicit-fallthrough",
++ "-Wno-string-plus-int",
++ "-Wno-unreachable-code-return",
++ "-Wno-unused-but-set-variable",
++ ]
+
+-nghttp2_gn_build("nghttp2") {
++ sources = [
++ "lib/nghttp2_buf.c",
++ "lib/nghttp2_callbacks.c",
++ "lib/nghttp2_debug.c",
++ "lib/nghttp2_extpri.c",
++ "lib/nghttp2_frame.c",
++ "lib/nghttp2_hd.c",
++ "lib/nghttp2_hd_huffman.c",
++ "lib/nghttp2_hd_huffman_data.c",
++ "lib/nghttp2_helper.c",
++ "lib/nghttp2_http.c",
++ "lib/nghttp2_map.c",
++ "lib/nghttp2_mem.c",
++ "lib/nghttp2_alpn.c",
++ "lib/nghttp2_option.c",
++ "lib/nghttp2_outbound_item.c",
++ "lib/nghttp2_pq.c",
++ "lib/nghttp2_priority_spec.c",
++ "lib/nghttp2_queue.c",
++ "lib/nghttp2_ratelim.c",
++ "lib/nghttp2_rcbuf.c",
++ "lib/nghttp2_session.c",
++ "lib/nghttp2_stream.c",
++ "lib/nghttp2_submit.c",
++ "lib/nghttp2_time.c",
++ "lib/nghttp2_version.c",
++ "lib/sfparse.c",
++ ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn
new file mode 100644
index 0000000000..9ea4d4d145
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/simdjson/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/simdjson/BUILD.gn
+@@ -1,14 +0,0 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
+-
+-import("unofficial.gni")
+-
+-simdjson_gn_build("simdjson") {
+-}
diff --git a/electron34/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn
new file mode 100644
index 0000000000..edf87c7371
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/simdutf/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/simdutf/BUILD.gn
+@@ -1,14 +1,21 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
++config("simdutf_config") {
++ include_dirs = [ "." ]
++}
+
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++static_library("simdutf") {
++ include_dirs = [ "." ]
++ sources = [
++ "simdutf.cpp",
++ ]
+
+-import("unofficial.gni")
++ public_configs = [ ":simdutf_config" ]
+
+-simdutf_gn_build("simdutf") {
++ cflags_cc = [
++ "-Wno-ambiguous-reversed-operator",
++ "-Wno-c++98-compat-extra-semi",
++ "-Wno-unreachable-code",
++ "-Wno-unreachable-code-break",
++ "-Wno-unused-const-variable",
++ "-Wno-unused-function",
++ ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
new file mode 100644
index 0000000000..a9823fa3c9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
@@ -0,0 +1,234 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/BUILD.gn
+@@ -1,14 +1,214 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("libuv_config") {
++ include_dirs = [ "include" ]
+
+-import("unofficial.gni")
++ defines = []
+
+-uv_gn_build("uv") {
++ if (is_linux && !is_bsd) {
++ defines += [ "_POSIX_C_SOURCE=200112" ]
++ }
++ if (!is_win) {
++ defines += [
++ "_LARGEFILE_SOURCE",
++ "_FILE_OFFSET_BITS=64",
++ ]
++ }
++ if (is_mac) {
++ defines += [ "_DARWIN_USE_64_BIT_INODE=1" ]
++ }
++}
++
++static_library("uv") {
++ include_dirs = [
++ "include",
++ "src",
++ ]
++
++ public_configs = [ ":libuv_config" ]
++
++ ldflags = []
++
++ defines = []
++
++ # This only has an effect on Windows, where it will cause libuv's symbols to be exported in node.lib
++ defines += [ "BUILDING_UV_SHARED=1" ]
++
++ cflags_c = [
++ "-Wno-incompatible-pointer-types",
++ "-Wno-bitwise-op-parentheses",
++ "-Wno-implicit-fallthrough",
++ "-Wno-implicit-function-declaration",
++ "-Wno-missing-braces",
++ "-Wno-sign-compare",
++ "-Wno-sometimes-uninitialized",
++ "-Wno-string-conversion",
++ "-Wno-switch",
++ "-Wno-unused-function",
++ "-Wno-unused-result",
++ "-Wno-unused-variable",
++ "-Wno-unreachable-code",
++ "-Wno-unreachable-code-return",
++ "-Wno-unused-but-set-variable",
++ "-Wno-shadow",
++ ]
++
++ libs = []
++
++ sources = [
++ "include/uv.h",
++ "include/uv/tree.h",
++ "include/uv/errno.h",
++ "include/uv/threadpool.h",
++ "include/uv/version.h",
++ "src/fs-poll.c",
++ "src/heap-inl.h",
++ "src/idna.c",
++ "src/idna.h",
++ "src/inet.c",
++ "src/queue.h",
++ "src/random.c",
++ "src/strscpy.c",
++ "src/strscpy.h",
++ "src/strtok.c",
++ "src/strtok.h",
++ "src/thread-common.c",
++ "src/threadpool.c",
++ "src/timer.c",
++ "src/uv-data-getter-setters.c",
++ "src/uv-common.c",
++ "src/uv-common.h",
++ "src/version.c",
++ ]
++
++ if (is_win) {
++ defines += [ "_GNU_SOURCE" ]
++ sources += [
++ "include/uv/win.h",
++ "src/win/async.c",
++ "src/win/atomicops-inl.h",
++ "src/win/core.c",
++ "src/win/detect-wakeup.c",
++ "src/win/dl.c",
++ "src/win/error.c",
++ "src/win/fs.c",
++ "src/win/fs-event.c",
++ "src/win/getaddrinfo.c",
++ "src/win/getnameinfo.c",
++ "src/win/handle.c",
++ "src/win/handle-inl.h",
++ "src/win/internal.h",
++ "src/win/loop-watcher.c",
++ "src/win/pipe.c",
++ "src/win/thread.c",
++ "src/win/poll.c",
++ "src/win/process.c",
++ "src/win/process-stdio.c",
++ "src/win/req-inl.h",
++ "src/win/signal.c",
++ "src/win/snprintf.c",
++ "src/win/stream.c",
++ "src/win/stream-inl.h",
++ "src/win/tcp.c",
++ "src/win/tty.c",
++ "src/win/udp.c",
++ "src/win/util.c",
++ "src/win/winapi.c",
++ "src/win/winapi.h",
++ "src/win/winsock.c",
++ "src/win/winsock.h",
++ ]
++
++ libs += [
++ "advapi32.lib",
++ "iphlpapi.lib",
++ "psapi.lib",
++ "shell32.lib",
++ "user32.lib",
++ "userenv.lib",
++ "ws2_32.lib",
++ ]
++ } else {
++ sources += [
++ "include/uv/unix.h",
++ "include/uv/linux.h",
++ "include/uv/sunos.h",
++ "include/uv/darwin.h",
++ "include/uv/bsd.h",
++ "include/uv/aix.h",
++ "src/unix/async.c",
++ "src/unix/core.c",
++ "src/unix/dl.c",
++ "src/unix/fs.c",
++ "src/unix/getaddrinfo.c",
++ "src/unix/getnameinfo.c",
++ "src/unix/internal.h",
++ "src/unix/loop.c",
++ "src/unix/loop-watcher.c",
++ "src/unix/pipe.c",
++ "src/unix/poll.c",
++ "src/unix/process.c",
++ "src/unix/random-devurandom.c",
++ "src/unix/signal.c",
++ "src/unix/stream.c",
++ "src/unix/tcp.c",
++ "src/unix/thread.c",
++ "src/unix/tty.c",
++ "src/unix/udp.c",
++ ]
++ libs += [ "m" ]
++ ldflags += [ "-pthread" ]
++ }
++ if (is_mac || (is_linux && !is_bsd)) {
++ sources += [ "src/unix/proctitle.c" ]
++ }
++ if (is_mac) {
++ sources += [
++ "src/unix/darwin-proctitle.c",
++ "src/unix/darwin.c",
++ "src/unix/fsevents.c",
++ "src/unix/random-getentropy.c",
++ ]
++ defines += [
++ "_DARWIN_USE_64_BIT_INODE=1",
++ "_DARWIN_UNLIMITED_SELECT=1",
++ ]
++ }
++ if (is_linux && !is_bsd) {
++ defines += [ "_GNU_SOURCE" ]
++ sources += [
++ "src/unix/linux.c",
++ "src/unix/procfs-exepath.c",
++ "src/unix/random-getrandom.c",
++ "src/unix/random-sysctl-linux.c",
++ ]
++ libs += [
++ "dl",
++ "rt",
++ ]
++ }
++ if (is_mac) { # is_bsd
++ sources += [
++ "src/unix/bsd-ifaddrs.c",
++ "src/unix/kqueue.c",
++ ]
++ }
++ if (is_bsd) {
++ sources += [
++ "src/unix/bsd-ifaddrs.c",
++ "src/unix/bsd-proctitle.c",
++ "src/unix/kqueue.c",
++ "src/unix/posix-hrtime.c",
++ "src/unix/random-getrandom.c",
++ ]
++ }
++ if (is_freebsd) {
++ sources += [
++ "src/unix/freebsd.c",
++ ]
++ }
++ if (is_netbsd) {
++ sources += [
++ "src/unix/netbsd.c",
++ ]
++ libs += [ "kvm" ]
++ }
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst b/electron34/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst
new file mode 100644
index 0000000000..c43f630fcb
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/docs/src/loop.rst.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/docs/src/loop.rst
+@@ -73,7 +73,15 @@ API
+
+ This option is necessary to use :c:func:`uv_metrics_idle_time`.
+
++ - UV_LOOP_INTERRUPT_ON_IO_CHANGE: Interrupt the loop whenever a new IO
++ event has been added or changed.
++
++ This option is usually when implementing event loop integration, to make
++ the polling of backend fd interrupt to recognize the changes of IO events.
++
+ .. versionchanged:: 1.39.0 added the UV_METRICS_IDLE_TIME option.
++ .. versionchanged:: 1.43.0 added the UV_LOOP_INTERRUPT_ON_IO_CHANGE option.
++
+
+ .. c:function:: int uv_loop_close(uv_loop_t* loop)
+
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv.h b/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv.h
new file mode 100644
index 0000000000..bec3404319
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/include/uv.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/include/uv.h
+@@ -155,7 +155,6 @@ struct uv__queue {
+ XX(EFTYPE, "inappropriate file type or format") \
+ XX(EILSEQ, "illegal byte sequence") \
+ XX(ESOCKTNOSUPPORT, "socket type not supported") \
+- XX(ENODATA, "no data available") \
+ XX(EUNATCH, "protocol driver not attached") \
+
+ #define UV_HANDLE_TYPE_MAP(XX) \
+@@ -260,7 +259,8 @@ typedef struct uv_metrics_s uv_metrics_t
+
+ typedef enum {
+ UV_LOOP_BLOCK_SIGNAL = 0,
+- UV_METRICS_IDLE_TIME
++ UV_METRICS_IDLE_TIME,
++ UV_LOOP_INTERRUPT_ON_IO_CHANGE
+ } uv_loop_option;
+
+ typedef enum {
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h b/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h
new file mode 100644
index 0000000000..8e34ae1999
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/include/uv/errno.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/include/uv/errno.h
+@@ -456,18 +456,6 @@
+ # define UV__ESOCKTNOSUPPORT (-4025)
+ #endif
+
+-/* FreeBSD defines ENODATA in /usr/include/c++/v1/errno.h which is only visible
+- * if C++ is being used. Define it directly to avoid problems when integrating
+- * libuv in a C++ project.
+- */
+-#if defined(ENODATA) && !defined(_WIN32)
+-# define UV__ENODATA UV__ERR(ENODATA)
+-#elif defined(__FreeBSD__)
+-# define UV__ENODATA (-9919)
+-#else
+-# define UV__ENODATA (-4024)
+-#endif
+-
+ #if defined(EUNATCH) && !defined(_WIN32)
+ # define UV__EUNATCH UV__ERR(EUNATCH)
+ #else
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c
new file mode 100644
index 0000000000..e4d0f713c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/unix/async.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/unix/async.c
+@@ -38,7 +38,6 @@
+ #include <sys/eventfd.h>
+ #endif
+
+-static void uv__async_send(uv_loop_t* loop);
+ static int uv__async_start(uv_loop_t* loop);
+ static void uv__cpu_relax(void);
+
+@@ -78,7 +77,7 @@ int uv_async_send(uv_async_t* handle) {
+
+ /* Wake up the other thread's event loop. */
+ if (atomic_exchange(pending, 1) == 0)
+- uv__async_send(handle->loop);
++ uv__loop_interrupt(handle->loop);
+
+ /* Set the loop to not-busy. */
+ atomic_fetch_add(busy, -1);
+@@ -178,39 +177,6 @@ static void uv__async_io(uv_loop_t* loop
+ }
+
+
+-static void uv__async_send(uv_loop_t* loop) {
+- const void* buf;
+- ssize_t len;
+- int fd;
+- int r;
+-
+- buf = "";
+- len = 1;
+- fd = loop->async_wfd;
+-
+-#if defined(__linux__)
+- if (fd == -1) {
+- static const uint64_t val = 1;
+- buf = &val;
+- len = sizeof(val);
+- fd = loop->async_io_watcher.fd; /* eventfd */
+- }
+-#endif
+-
+- do
+- r = write(fd, buf, len);
+- while (r == -1 && errno == EINTR);
+-
+- if (r == len)
+- return;
+-
+- if (r == -1)
+- if (errno == EAGAIN || errno == EWOULDBLOCK)
+- return;
+-
+- abort();
+-}
+-
+
+ static int uv__async_start(uv_loop_t* loop) {
+ int pipefd[2];
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c
new file mode 100644
index 0000000000..bd2a0afe16
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/unix/core.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/unix/core.c
+@@ -926,6 +926,9 @@ void uv__io_start(uv_loop_t* loop, uv__i
+ loop->watchers[w->fd] = w;
+ loop->nfds++;
+ }
++
++ if (uv__get_internal_fields(loop)->flags & UV_LOOP_INTERRUPT_ON_IO_CHANGE)
++ uv__loop_interrupt(loop);
+ }
+
+
+@@ -957,6 +960,9 @@ void uv__io_stop(uv_loop_t* loop, uv__io
+ }
+ else if (uv__queue_empty(&w->watcher_queue))
+ uv__queue_insert_tail(&loop->watcher_queue, &w->watcher_queue);
++
++ if (uv__get_internal_fields(loop)->flags & UV_LOOP_INTERRUPT_ON_IO_CHANGE)
++ uv__loop_interrupt(loop);
+ }
+
+
+@@ -973,6 +979,9 @@ void uv__io_close(uv_loop_t* loop, uv__i
+ void uv__io_feed(uv_loop_t* loop, uv__io_t* w) {
+ if (uv__queue_empty(&w->pending_queue))
+ uv__queue_insert_tail(&loop->pending_queue, &w->pending_queue);
++
++ if (uv__get_internal_fields(loop)->flags & UV_LOOP_INTERRUPT_ON_IO_CHANGE)
++ uv__loop_interrupt(loop);
+ }
+
+
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c
new file mode 100644
index 0000000000..be70b21c0b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/unix/loop.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/unix/loop.c
+@@ -217,6 +217,11 @@ int uv__loop_configure(uv_loop_t* loop,
+ return 0;
+ }
+
++ if (option == UV_LOOP_INTERRUPT_ON_IO_CHANGE) {
++ lfields->flags |= UV_LOOP_INTERRUPT_ON_IO_CHANGE;
++ return 0;
++ }
++
+ if (option != UV_LOOP_BLOCK_SIGNAL)
+ return UV_ENOSYS;
+
+@@ -226,3 +231,40 @@ int uv__loop_configure(uv_loop_t* loop,
+ loop->flags |= UV_LOOP_BLOCK_SIGPROF;
+ return 0;
+ }
++
++
++void uv__loop_interrupt(uv_loop_t* loop) {
++ const void* buf;
++ ssize_t len;
++ int fd;
++ int r;
++
++ buf = "";
++ len = 1;
++ fd = loop->async_wfd;
++
++#if defined(__linux__)
++ if (fd == -1) {
++ static const uint64_t val = 1;
++ buf = &val;
++ len = sizeof(val);
++ fd = loop->async_io_watcher.fd; /* eventfd */
++ }
++#endif
++
++ do
++ r = write(fd, buf, len);
++ while (r == -1 && errno == EINTR);
++
++ if (r == len)
++ return;
++
++ if (!uv_loop_alive(loop))
++ return;
++
++ if (r == -1)
++ if (errno == EAGAIN || errno == EWOULDBLOCK)
++ return;
++
++ abort();
++}
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c
new file mode 100644
index 0000000000..c943c1224f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/unix/pipe.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/unix/pipe.c
+@@ -186,9 +186,13 @@ int uv_pipe_open(uv_pipe_t* handle, uv_f
+ if (mode == -1)
+ return UV__ERR(errno); /* according to docs, must be EBADF */
+
++ /* If ioctl(FIONBIO) reports ENOTTY, try fcntl(F_GETFL) + fcntl(F_SETFL).
++ * Workaround for e.g. kqueue fds not supporting ioctls.
++ */
+ err = uv__nonblock(fd, 1);
+- if (err)
+- return err;
++ if (err == UV_ENOTTY)
++ if (uv__nonblock == uv__nonblock_ioctl)
++ err = uv__nonblock_fcntl(fd, 1);
+
+ #if defined(__APPLE__)
+ err = uv__stream_try_select((uv_stream_t*) handle, &fd);
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h b/electron34/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h
new file mode 100644
index 0000000000..04c09d778f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/uv-common.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/uv-common.h
+@@ -144,6 +144,8 @@ int uv__loop_configure(uv_loop_t* loop,
+
+ void uv__loop_close(uv_loop_t* loop);
+
++void uv__loop_interrupt(uv_loop_t* loop);
++
+ int uv__read_start(uv_stream_t* stream,
+ uv_alloc_cb alloc_cb,
+ uv_read_cb read_cb);
+@@ -280,6 +282,10 @@ void uv__threadpool_cleanup(void);
+ if (((h)->flags & UV_HANDLE_ACTIVE) != 0) break; \
+ (h)->flags |= UV_HANDLE_ACTIVE; \
+ if (((h)->flags & UV_HANDLE_REF) != 0) uv__active_handle_add(h); \
++ int loop_flags = uv__get_internal_fields((h)->loop)->flags; \
++ if (loop_flags & UV_LOOP_INTERRUPT_ON_IO_CHANGE) { \
++ uv__loop_interrupt((h)->loop); \
++ } \
+ } \
+ while (0)
+
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_core.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_core.c
new file mode 100644
index 0000000000..63504e2ddb
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_core.c
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/win/core.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/win/core.c
+@@ -384,10 +384,20 @@ int uv__loop_configure(uv_loop_t* loop,
+ return 0;
+ }
+
++ if (option == UV_LOOP_INTERRUPT_ON_IO_CHANGE) {
++ lfields->flags |= UV_LOOP_INTERRUPT_ON_IO_CHANGE;
++ return 0;
++ }
++
+ return UV_ENOSYS;
+ }
+
+
++void uv__loop_interrupt(uv_loop_t* loop) {
++ PostQueuedCompletionStatus(loop->iocp, 0, 0, NULL);
++}
++
++
+ int uv_backend_fd(const uv_loop_t* loop) {
+ return -1;
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_process.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_process.c
new file mode 100644
index 0000000000..c6e492df99
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_process.c
@@ -0,0 +1,70 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/win/process.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/win/process.c
+@@ -105,6 +105,21 @@ static void uv__init_global_job_handle(v
+ &info,
+ sizeof info))
+ uv_fatal_error(GetLastError(), "SetInformationJobObject");
++
++
++ if (!AssignProcessToJobObject(uv_global_job_handle_, GetCurrentProcess())) {
++ /* Make sure this handle is functional. The Windows kernel has a bug that
++ * if the first use of AssignProcessToJobObject is for a Windows Store
++ * program, subsequent attempts to use the handle with fail with
++ * INVALID_PARAMETER (87). This is possibly because all uses of the handle
++ * must be for the same Terminal Services session. We can ensure it is tied
++ * to our current session now by adding ourself to it. We could remove
++ * ourself afterwards, but there doesn't seem to be a reason to.
++ */
++ DWORD err = GetLastError();
++ if (err != ERROR_ACCESS_DENIED)
++ uv_fatal_error(err, "AssignProcessToJobObject");
++ }
+ }
+
+
+@@ -1102,6 +1117,7 @@ int uv_spawn(uv_loop_t* loop,
+ * breakaway.
+ */
+ process_flags |= DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP;
++ process_flags |= CREATE_SUSPENDED;
+ }
+
+ if (!CreateProcessW(application_path,
+@@ -1119,11 +1135,6 @@ int uv_spawn(uv_loop_t* loop,
+ goto done;
+ }
+
+- /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */
+-
+- process->process_handle = info.hProcess;
+- process->pid = info.dwProcessId;
+-
+ /* If the process isn't spawned as detached, assign to the global job object
+ * so windows will kill it when the parent process dies. */
+ if (!(options->flags & UV_PROCESS_DETACHED)) {
+@@ -1146,6 +1157,19 @@ int uv_spawn(uv_loop_t* loop,
+ }
+ }
+
++ if (process_flags & CREATE_SUSPENDED) {
++ if (ResumeThread(info.hThread) == ((DWORD)-1)) {
++ err = GetLastError();
++ TerminateProcess(info.hProcess, 1);
++ goto done;
++ }
++ }
++
++ /* Spawn succeeded. Beyond this point, failure is reported asynchronously. */
++
++ process->process_handle = info.hProcess;
++ process->pid = info.dwProcessId;
++
+ /* Set IPC pid to all IPC pipes. */
+ for (i = 0; i < options->stdio_count; i++) {
+ const uv_stdio_container_t* fdopt = &options->stdio[i];
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_util.c b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_util.c
new file mode 100644
index 0000000000..c3dc75707f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_src_win_util.c
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/src/win/util.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/src/win/util.c
+@@ -1685,10 +1685,17 @@ int uv_os_uname(uv_utsname_t* buffer) {
+ #ifdef _MSC_VER
+ #pragma warning(suppress : 4996)
+ #endif
++ #ifdef __clang__
++ #pragma clang diagnostic push
++ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
++ #endif
+ if (GetVersionExW(&os_info) == 0) {
+ r = uv_translate_sys_error(GetLastError());
+ goto error;
+ }
++ #ifdef __clang__
++ #pragma clang diagnostic pop
++ #endif
+ }
+
+ /* Populate the version field. */
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c b/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c
new file mode 100644
index 0000000000..689e21c727
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c
@@ -0,0 +1,227 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/test/test-embed.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/test/test-embed.c
+@@ -25,54 +25,184 @@
+ #include <stdlib.h>
+ #include <errno.h>
+
+-#if !defined(_WIN32) && !defined(_AIX)
+-#include <poll.h>
++#ifndef HAVE_EPOLL
++# if defined(__linux__)
++# define HAVE_EPOLL 1
++# endif
+ #endif
+
+-static uv_async_t async;
+-static uv_barrier_t barrier;
++#if defined(HAVE_EPOLL)
++# include <sys/epoll.h>
++#endif
+
++#if !defined(_WIN32)
++# include <sys/types.h>
++# include <sys/time.h>
++#endif
+
+-static void thread_main(void* arg) {
+- ASSERT_LE(0, uv_barrier_wait(&barrier));
+- uv_sleep(250);
+- ASSERT_EQ(0, uv_async_send(&async));
++static uv_loop_t main_loop;
++static uv_loop_t external_loop;
++static uv_thread_t embed_thread;
++static uv_sem_t embed_sem;
++static uv_async_t embed_async;
++static uv_async_t main_async;
++static volatile int embed_closed;
++
++static uv_timer_t main_timer;
++static int main_timer_called;
++
++
++#if defined(_WIN32)
++static void embed_thread_poll_win(HANDLE iocp, int timeout) {
++ DWORD bytes;
++ ULONG_PTR key;
++ OVERLAPPED* overlapped;
++
++ GetQueuedCompletionStatus(iocp,
++ &bytes,
++ &key,
++ &overlapped,
++ timeout >= 0 ? timeout : INFINITE);
++
++ /* Give the event back so the loop can deal with it. */
++ if (overlapped != NULL)
++ PostQueuedCompletionStatus(iocp,
++ bytes,
++ key,
++ overlapped);
++}
++#else
++static void embed_thread_poll_unix(int fd, int timeout) {
++ int r;
++ do {
++#if defined(HAVE_EPOLL)
++ struct epoll_event ev;
++ r = epoll_wait(fd, &ev, 1, timeout);
++#else
++ struct timeval tv;
++ if (timeout >= 0) {
++ tv.tv_sec = timeout / 1000;
++ tv.tv_usec = (timeout % 1000) * 1000;
++ }
++ fd_set readset;
++ FD_ZERO(&readset);
++ FD_SET(fd, &readset);
++ r = select(fd + 1, &readset, NULL, NULL, timeout >= 0 ? &tv : NULL);
++#endif
++ } while (r == -1 && errno == EINTR);
+ }
++#endif /* !_WIN32 */
+
+
+-static void async_cb(uv_async_t* handle) {
+- uv_close((uv_handle_t*) handle, NULL);
+-}
++static void embed_thread_runner(void* arg) {
++ int timeout;
+
++ while (1) {
++ uv_sem_wait(&embed_sem);
++ if (embed_closed)
++ break;
+
+-TEST_IMPL(embed) {
+- uv_thread_t thread;
+- uv_loop_t* loop;
++ timeout = uv_backend_timeout(&main_loop);
+
+- loop = uv_default_loop();
+- ASSERT_EQ(0, uv_async_init(loop, &async, async_cb));
+- ASSERT_EQ(0, uv_barrier_init(&barrier, 2));
+- ASSERT_EQ(0, uv_thread_create(&thread, thread_main, NULL));
+- ASSERT_LE(0, uv_barrier_wait(&barrier));
+-
+- while (uv_loop_alive(loop)) {
+-#if defined(_WIN32) || defined(_AIX)
+- ASSERT_LE(0, uv_run(loop, UV_RUN_ONCE));
++#if defined(_WIN32)
++ embed_thread_poll_win(main_loop.iocp, timeout);
+ #else
+- int rc;
+- do {
+- struct pollfd p;
+- p.fd = uv_backend_fd(loop);
+- p.events = POLLIN;
+- p.revents = 0;
+- rc = poll(&p, 1, uv_backend_timeout(loop));
+- } while (rc == -1 && errno == EINTR);
+- ASSERT_LE(0, uv_run(loop, UV_RUN_NOWAIT));
++ embed_thread_poll_unix(uv_backend_fd(&main_loop), timeout);
+ #endif
++
++ uv_async_send(&embed_async);
+ }
++}
++
++
++static void embed_cb(uv_async_t* async) {
++ /* Run tasks in main loop */
++ uv_run(&main_loop, UV_RUN_NOWAIT);
++
++ /* Tell embed thread to continue polling */
++ uv_sem_post(&embed_sem);
++}
++
++
++static void main_timer_cb(uv_timer_t* timer) {
++ main_timer_called++;
++ embed_closed = 1;
++
++ uv_close((uv_handle_t*) &embed_async, NULL);
++ uv_close((uv_handle_t*) &main_async, NULL);
++}
++
++
++static void init_loops(void) {
++ ASSERT_EQ(0, uv_loop_init(&main_loop));
++ ASSERT_EQ(0, uv_loop_init(&external_loop));
++
++ main_timer_called = 0;
++ embed_closed = 0;
++
++ uv_async_init(&external_loop, &embed_async, embed_cb);
++
++ /* Create a dummy async for main loop otherwise backend timeout will
++ always be 0 */
++ uv_async_init(&main_loop, &main_async, embed_cb);
++
++ /* Start worker that will poll main loop and interrupt external loop */
++ uv_sem_init(&embed_sem, 0);
++ uv_thread_create(&embed_thread, embed_thread_runner, NULL);
++}
++
++
++static void run_loop(void) {
++ /* Run main loop for once to give things a chance to initialize */
++ embed_cb(&embed_async);
++
++ /* Run external loop */
++ uv_run(&external_loop, UV_RUN_DEFAULT);
++
++ uv_thread_join(&embed_thread);
++ uv_sem_destroy(&embed_sem);
++ uv_loop_close(&external_loop);
++ uv_loop_close(&main_loop);
++}
++
++
++TEST_IMPL(embed) {
++ init_loops();
++
++ /* Start timer in main loop */
++ uv_timer_init(&main_loop, &main_timer);
++ uv_timer_start(&main_timer, main_timer_cb, 250, 0);
++
++ run_loop();
++ ASSERT_EQ(main_timer_called, 1);
++
++ return 0;
++}
++
++
++static uv_timer_t external_timer;
++
++
++static void external_timer_cb(uv_timer_t* timer) {
++ /* Start timer in main loop */
++ uv_timer_init(&main_loop, &main_timer);
++ uv_timer_start(&main_timer, main_timer_cb, 250, 0);
++}
++
++
++TEST_IMPL(embed_with_external_timer) {
++ init_loops();
++
++ /* Interrupt embed polling when a handle is started */
++ ASSERT_EQ(0, uv_loop_configure(&main_loop, UV_LOOP_INTERRUPT_ON_IO_CHANGE));
++
++ /* Start timer in external loop, whose callback will not interrupt the
++ polling in embed thread */
++ uv_timer_init(&external_loop, &external_timer);
++ uv_timer_start(&external_timer, external_timer_cb, 100, 0);
+
+- ASSERT_EQ(0, uv_thread_join(&thread));
+- uv_barrier_destroy(&barrier);
++ run_loop();
++ ASSERT_EQ(main_timer_called, 1);
+
+ MAKE_VALGRIND_HAPPY(loop);
+ return 0;
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-list.h b/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-list.h
new file mode 100644
index 0000000000..f87321d96f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_test_test-list.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/test/test-list.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/test/test-list.h
+@@ -273,6 +273,7 @@ TEST_DECLARE (process_priority)
+ TEST_DECLARE (has_ref)
+ TEST_DECLARE (active)
+ TEST_DECLARE (embed)
++TEST_DECLARE (embed_with_external_timer)
+ TEST_DECLARE (async)
+ TEST_DECLARE (async_null_cb)
+ TEST_DECLARE (eintr_handling)
+@@ -894,6 +895,7 @@ TASK_LIST_START
+ TEST_ENTRY (active)
+
+ TEST_ENTRY (embed)
++ TEST_ENTRY (embed_with_external_timer)
+
+ TEST_ENTRY (async)
+ TEST_ENTRY (async_null_cb)
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uv_unofficial.gni b/electron34/patches/patch-third__party_electron__node_deps_uv_unofficial.gni
new file mode 100644
index 0000000000..aa74294700
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uv_unofficial.gni
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uv/unofficial.gni.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uv/unofficial.gni
+@@ -87,11 +87,11 @@ template("uv_gn_build") {
+ ]
+ }
+ if (is_posix) {
+- libs = [ "m" ]
+ ldflags = [ "-pthread" ]
+ }
+ if (is_linux) {
+- libs += [
++ libs = [
++ "m",
+ "dl",
+ "rt",
+ ]
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn b/electron34/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn
new file mode 100644
index 0000000000..9699632ad3
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn
@@ -0,0 +1,59 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uvwasi/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uvwasi/BUILD.gn
+@@ -1,14 +1,39 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++config("uvwasi_config") {
++ include_dirs = [ "include" ]
++}
++
++static_library("uvwasi") {
++ include_dirs = [
++ "include",
++ "src",
++ ]
++
++ defines = []
++ if (is_linux) {
++ defines += [
++ "_GNU_SOURCE",
++ "_POSIX_C_SOURCE=200112"
++ ]
++ }
++
++ deps = [ "../../deps/uv" ]
++
++ public_configs = [ ":uvwasi_config" ]
+
+-import("unofficial.gni")
++ cflags_c = []
++ if (!is_win) {
++ cflags_c += [ "-fvisibility=hidden" ]
++ }
+
+-uvwasi_gn_build("uvwasi") {
++ sources = [
++ "src/clocks.c",
++ "src/fd_table.c",
++ "src/path_resolver.c",
++ "src/poll_oneoff.c",
++ "src/sync_helpers.c",
++ "src/uv_mapping.c",
++ "src/uvwasi.c",
++ "src/wasi_rights.c",
++ "src/wasi_serdes.c"
++ ]
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_deps_uvwasi_src_uvwasi.c b/electron34/patches/patch-third__party_electron__node_deps_uvwasi_src_uvwasi.c
new file mode 100644
index 0000000000..fc23d37150
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_deps_uvwasi_src_uvwasi.c
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/deps/uvwasi/src/uvwasi.c.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/deps/uvwasi/src/uvwasi.c
+@@ -1,4 +1,8 @@
+ #include <stdlib.h>
++#if defined(__NetBSD__)
++// strnlen, telldir, seekdir
++#define _NETBSD_SOURCE
++#endif
+ #include <string.h>
+
+ #ifndef _WIN32
+@@ -803,7 +807,7 @@ uvwasi_errno_t uvwasi_fd_close(uvwasi_t*
+ uv_mutex_unlock(&wrap->mutex);
+ if (err != UVWASI_ESUCCESS) {
+ goto exit;
+- }
++ }
+ }
+
+ if (r != 0) {
+@@ -2793,7 +2797,7 @@ uvwasi_errno_t uvwasi_sock_shutdown(uvwa
+
+ uv_mutex_unlock(&wrap->mutex);
+
+- if (shutdown_data.status != 0)
++ if (shutdown_data.status != 0)
+ return uvwasi__translate_uv_error(shutdown_data.status);
+
+ return UVWASI_ESUCCESS;
diff --git a/electron34/patches/patch-third__party_electron__node_doc_api_cli.md b/electron34/patches/patch-third__party_electron__node_doc_api_cli.md
new file mode 100644
index 0000000000..2962285d40
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_doc_api_cli.md
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/doc/api/cli.md.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/doc/api/cli.md
+@@ -2920,7 +2920,6 @@ V8 options that are allowed are:
+ * `--disallow-code-generation-from-strings`
+ * `--enable-etw-stack-walking`
+ * `--expose-gc`
+-* `--huge-max-old-generation-size`
+ * `--interpreted-frames-native-stack`
+ * `--jitless`
+ * `--max-old-space-size`
diff --git a/electron34/patches/patch-third__party_electron__node_electron__node.gni b/electron34/patches/patch-third__party_electron__node_electron__node.gni
new file mode 100644
index 0000000000..bb1f06a127
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_electron__node.gni
@@ -0,0 +1,13 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/electron_node.gni.orig 2025-05-24 17:57:53.612207245 +0000
++++ third_party/electron_node/electron_node.gni
+@@ -0,0 +1,4 @@
++declare_args() {
++ # Allows embedders to override the NODE_MODULE_VERSION define
++ node_module_version = ""
++}
diff --git a/electron34/patches/patch-third__party_electron__node_filenames.json b/electron34/patches/patch-third__party_electron__node_filenames.json
new file mode 100644
index 0000000000..35acdbf505
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_filenames.json
@@ -0,0 +1,749 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/filenames.json.orig 2025-05-24 17:57:53.612337877 +0000
++++ third_party/electron_node/filenames.json
+@@ -0,0 +1,740 @@
++// This file is automatically generated by generate_gn_filenames_json.py
++// DO NOT EDIT
++{
++ "fs_files": [
++ "lib/internal/fs/cp/cp-sync.js",
++ "lib/internal/fs/cp/cp.js",
++ "lib/internal/fs/dir.js",
++ "lib/internal/fs/promises.js",
++ "lib/internal/fs/read/context.js",
++ "lib/internal/fs/recursive_watch.js",
++ "lib/internal/fs/rimraf.js",
++ "lib/internal/fs/streams.js",
++ "lib/internal/fs/sync_write_stream.js",
++ "lib/internal/fs/utils.js",
++ "lib/internal/fs/watchers.js",
++ "lib/fs.js",
++ "lib/fs/promises.js"
++ ],
++ "headers": [
++ {
++ "dest_dir": "include/node/",
++ "files": [
++ "src/js_native_api.h",
++ "src/js_native_api_types.h",
++ "src/node.h",
++ "src/node_api.h",
++ "src/node_api_types.h",
++ "src/node_buffer.h",
++ "src/node_object_wrap.h"
++ ]
++ },
++ {
++ "dest_dir": "include/node/./",
++ "files": [
++ "//v8/include/v8-array-buffer.h",
++ "//v8/include/v8-callbacks.h",
++ "//v8/include/v8-container.h",
++ "//v8/include/v8-context.h",
++ "//v8/include/v8-cppgc.h",
++ "//v8/include/v8-data.h",
++ "//v8/include/v8-date.h",
++ "//v8/include/v8-debug.h",
++ "//v8/include/v8-embedder-heap.h",
++ "//v8/include/v8-embedder-state-scope.h",
++ "//v8/include/v8-exception.h",
++ "//v8/include/v8-extension.h",
++ "//v8/include/v8-external.h",
++ "//v8/include/v8-forward.h",
++ "//v8/include/v8-function-callback.h",
++ "//v8/include/v8-function.h",
++ "//v8/include/v8-handle-base.h",
++ "//v8/include/v8-initialization.h",
++ "//v8/include/v8-internal.h",
++ "//v8/include/v8-isolate.h",
++ "//v8/include/v8-json.h",
++ "//v8/include/v8-local-handle.h",
++ "//v8/include/v8-locker.h",
++ "//v8/include/v8-maybe.h",
++ "//v8/include/v8-memory-span.h",
++ "//v8/include/v8-message.h",
++ "//v8/include/v8-microtask-queue.h",
++ "//v8/include/v8-microtask.h",
++ "//v8/include/v8-object.h",
++ "//v8/include/v8-persistent-handle.h",
++ "//v8/include/v8-platform.h",
++ "//v8/include/v8-primitive-object.h",
++ "//v8/include/v8-primitive.h",
++ "//v8/include/v8-profiler.h",
++ "//v8/include/v8-promise.h",
++ "//v8/include/v8-proxy.h",
++ "//v8/include/v8-regexp.h",
++ "//v8/include/v8-sandbox.h",
++ "//v8/include/v8-script.h",
++ "//v8/include/v8-snapshot.h",
++ "//v8/include/v8-source-location.h",
++ "//v8/include/v8-statistics.h",
++ "//v8/include/v8-template.h",
++ "//v8/include/v8-traced-handle.h",
++ "//v8/include/v8-typed-array.h",
++ "//v8/include/v8-unwinder.h",
++ "//v8/include/v8-value-serializer.h",
++ "//v8/include/v8-value.h",
++ "//v8/include/v8-version.h",
++ "//v8/include/v8-wasm.h",
++ "//v8/include/v8-weak-callback-info.h",
++ "//v8/include/v8.h",
++ "//v8/include/v8config.h",
++ "deps/uv/include/uv.h"
++ ]
++ },
++ {
++ "dest_dir": "include/node/libplatform/",
++ "files": [
++ "//v8/include/libplatform/libplatform-export.h",
++ "//v8/include/libplatform/libplatform.h",
++ "//v8/include/libplatform/v8-tracing.h"
++ ]
++ },
++ {
++ "dest_dir": "include/node/cppgc/",
++ "files": [
++ "//v8/include/cppgc/allocation.h",
++ "//v8/include/cppgc/common.h",
++ "//v8/include/cppgc/cross-thread-persistent.h",
++ "//v8/include/cppgc/custom-space.h",
++ "//v8/include/cppgc/default-platform.h",
++ "//v8/include/cppgc/ephemeron-pair.h",
++ "//v8/include/cppgc/explicit-management.h",
++ "//v8/include/cppgc/garbage-collected.h",
++ "//v8/include/cppgc/heap-consistency.h",
++ "//v8/include/cppgc/heap-handle.h",
++ "//v8/include/cppgc/heap-state.h",
++ "//v8/include/cppgc/heap-statistics.h",
++ "//v8/include/cppgc/heap.h",
++ "//v8/include/cppgc/liveness-broker.h",
++ "//v8/include/cppgc/macros.h",
++ "//v8/include/cppgc/member.h",
++ "//v8/include/cppgc/name-provider.h",
++ "//v8/include/cppgc/object-size-trait.h",
++ "//v8/include/cppgc/persistent.h",
++ "//v8/include/cppgc/platform.h",
++ "//v8/include/cppgc/prefinalizer.h",
++ "//v8/include/cppgc/process-heap-statistics.h",
++ "//v8/include/cppgc/sentinel-pointer.h",
++ "//v8/include/cppgc/source-location.h",
++ "//v8/include/cppgc/testing.h",
++ "//v8/include/cppgc/trace-trait.h",
++ "//v8/include/cppgc/type-traits.h",
++ "//v8/include/cppgc/visitor.h"
++ ]
++ },
++ {
++ "dest_dir": "include/node/cppgc/internal/",
++ "files": [
++ "//v8/include/cppgc/internal/api-constants.h",
++ "//v8/include/cppgc/internal/atomic-entry-flag.h",
++ "//v8/include/cppgc/internal/base-page-handle.h",
++ "//v8/include/cppgc/internal/caged-heap-local-data.h",
++ "//v8/include/cppgc/internal/caged-heap.h",
++ "//v8/include/cppgc/internal/compiler-specific.h",
++ "//v8/include/cppgc/internal/finalizer-trait.h",
++ "//v8/include/cppgc/internal/gc-info.h",
++ "//v8/include/cppgc/internal/logging.h",
++ "//v8/include/cppgc/internal/member-storage.h",
++ "//v8/include/cppgc/internal/name-trait.h",
++ "//v8/include/cppgc/internal/persistent-node.h",
++ "//v8/include/cppgc/internal/pointer-policies.h",
++ "//v8/include/cppgc/internal/write-barrier.h"
++ ]
++ },
++ {
++ "dest_dir": "include/node/uv/",
++ "files": [
++ "deps/uv/include/uv/aix.h",
++ "deps/uv/include/uv/bsd.h",
++ "deps/uv/include/uv/darwin.h",
++ "deps/uv/include/uv/errno.h",
++ "deps/uv/include/uv/linux.h",
++ "deps/uv/include/uv/os390.h",
++ "deps/uv/include/uv/posix.h",
++ "deps/uv/include/uv/sunos.h",
++ "deps/uv/include/uv/threadpool.h",
++ "deps/uv/include/uv/tree.h",
++ "deps/uv/include/uv/unix.h",
++ "deps/uv/include/uv/version.h",
++ "deps/uv/include/uv/win.h"
++ ]
++ }
++ ],
++ "library_files": [
++ "lib/_http_agent.js",
++ "lib/_http_client.js",
++ "lib/_http_common.js",
++ "lib/_http_incoming.js",
++ "lib/_http_outgoing.js",
++ "lib/_http_server.js",
++ "lib/_stream_duplex.js",
++ "lib/_stream_passthrough.js",
++ "lib/_stream_readable.js",
++ "lib/_stream_transform.js",
++ "lib/_stream_wrap.js",
++ "lib/_stream_writable.js",
++ "lib/_tls_common.js",
++ "lib/_tls_wrap.js",
++ "lib/assert.js",
++ "lib/assert/strict.js",
++ "lib/async_hooks.js",
++ "lib/buffer.js",
++ "lib/child_process.js",
++ "lib/cluster.js",
++ "lib/console.js",
++ "lib/constants.js",
++ "lib/crypto.js",
++ "lib/dgram.js",
++ "lib/diagnostics_channel.js",
++ "lib/dns.js",
++ "lib/dns/promises.js",
++ "lib/domain.js",
++ "lib/events.js",
++ "lib/http.js",
++ "lib/http2.js",
++ "lib/https.js",
++ "lib/inspector.js",
++ "lib/inspector/promises.js",
++ "lib/internal/abort_controller.js",
++ "lib/internal/assert.js",
++ "lib/internal/assert/assertion_error.js",
++ "lib/internal/assert/calltracker.js",
++ "lib/internal/assert/utils.js",
++ "lib/internal/async_hooks.js",
++ "lib/internal/blob.js",
++ "lib/internal/blocklist.js",
++ "lib/internal/bootstrap/node.js",
++ "lib/internal/bootstrap/realm.js",
++ "lib/internal/bootstrap/shadow_realm.js",
++ "lib/internal/bootstrap/switches/does_not_own_process_state.js",
++ "lib/internal/bootstrap/switches/does_own_process_state.js",
++ "lib/internal/bootstrap/switches/is_main_thread.js",
++ "lib/internal/bootstrap/switches/is_not_main_thread.js",
++ "lib/internal/bootstrap/web/exposed-wildcard.js",
++ "lib/internal/bootstrap/web/exposed-window-or-worker.js",
++ "lib/internal/buffer.js",
++ "lib/internal/child_process.js",
++ "lib/internal/child_process/serialization.js",
++ "lib/internal/cli_table.js",
++ "lib/internal/cluster/child.js",
++ "lib/internal/cluster/primary.js",
++ "lib/internal/cluster/round_robin_handle.js",
++ "lib/internal/cluster/shared_handle.js",
++ "lib/internal/cluster/utils.js",
++ "lib/internal/cluster/worker.js",
++ "lib/internal/console/constructor.js",
++ "lib/internal/console/global.js",
++ "lib/internal/constants.js",
++ "lib/internal/crypto/aes.js",
++ "lib/internal/crypto/certificate.js",
++ "lib/internal/crypto/cfrg.js",
++ "lib/internal/crypto/cipher.js",
++ "lib/internal/crypto/diffiehellman.js",
++ "lib/internal/crypto/ec.js",
++ "lib/internal/crypto/hash.js",
++ "lib/internal/crypto/hashnames.js",
++ "lib/internal/crypto/hkdf.js",
++ "lib/internal/crypto/keygen.js",
++ "lib/internal/crypto/keys.js",
++ "lib/internal/crypto/mac.js",
++ "lib/internal/crypto/pbkdf2.js",
++ "lib/internal/crypto/random.js",
++ "lib/internal/crypto/rsa.js",
++ "lib/internal/crypto/scrypt.js",
++ "lib/internal/crypto/sig.js",
++ "lib/internal/crypto/util.js",
++ "lib/internal/crypto/webcrypto.js",
++ "lib/internal/crypto/webidl.js",
++ "lib/internal/crypto/x509.js",
++ "lib/internal/debugger/inspect.js",
++ "lib/internal/debugger/inspect_client.js",
++ "lib/internal/debugger/inspect_repl.js",
++ "lib/internal/dgram.js",
++ "lib/internal/dns/callback_resolver.js",
++ "lib/internal/dns/promises.js",
++ "lib/internal/dns/utils.js",
++ "lib/internal/encoding.js",
++ "lib/internal/error_serdes.js",
++ "lib/internal/errors.js",
++ "lib/internal/event_target.js",
++ "lib/internal/events/abort_listener.js",
++ "lib/internal/events/symbols.js",
++ "lib/internal/file.js",
++ "lib/internal/fixed_queue.js",
++ "lib/internal/freelist.js",
++ "lib/internal/freeze_intrinsics.js",
++ "lib/internal/heap_utils.js",
++ "lib/internal/histogram.js",
++ "lib/internal/http.js",
++ "lib/internal/http2/compat.js",
++ "lib/internal/http2/core.js",
++ "lib/internal/http2/util.js",
++ "lib/internal/inspector_async_hook.js",
++ "lib/internal/inspector_network_tracking.js",
++ "lib/internal/js_stream_socket.js",
++ "lib/internal/legacy/processbinding.js",
++ "lib/internal/linkedlist.js",
++ "lib/internal/main/check_syntax.js",
++ "lib/internal/main/embedding.js",
++ "lib/internal/main/eval_stdin.js",
++ "lib/internal/main/eval_string.js",
++ "lib/internal/main/inspect.js",
++ "lib/internal/main/mksnapshot.js",
++ "lib/internal/main/print_help.js",
++ "lib/internal/main/prof_process.js",
++ "lib/internal/main/repl.js",
++ "lib/internal/main/run_main_module.js",
++ "lib/internal/main/test_runner.js",
++ "lib/internal/main/watch_mode.js",
++ "lib/internal/main/worker_thread.js",
++ "lib/internal/mime.js",
++ "lib/internal/modules/cjs/loader.js",
++ "lib/internal/modules/esm/assert.js",
++ "lib/internal/modules/esm/create_dynamic_module.js",
++ "lib/internal/modules/esm/fetch_module.js",
++ "lib/internal/modules/esm/formats.js",
++ "lib/internal/modules/esm/get_format.js",
++ "lib/internal/modules/esm/hooks.js",
++ "lib/internal/modules/esm/initialize_import_meta.js",
++ "lib/internal/modules/esm/load.js",
++ "lib/internal/modules/esm/loader.js",
++ "lib/internal/modules/esm/module_job.js",
++ "lib/internal/modules/esm/module_map.js",
++ "lib/internal/modules/esm/package_config.js",
++ "lib/internal/modules/esm/resolve.js",
++ "lib/internal/modules/esm/shared_constants.js",
++ "lib/internal/modules/esm/translators.js",
++ "lib/internal/modules/esm/utils.js",
++ "lib/internal/modules/esm/worker.js",
++ "lib/internal/modules/helpers.js",
++ "lib/internal/modules/package_json_reader.js",
++ "lib/internal/modules/run_main.js",
++ "lib/internal/navigator.js",
++ "lib/internal/net.js",
++ "lib/internal/options.js",
++ "lib/internal/per_context/domexception.js",
++ "lib/internal/per_context/messageport.js",
++ "lib/internal/per_context/primordials.js",
++ "lib/internal/perf/event_loop_delay.js",
++ "lib/internal/perf/event_loop_utilization.js",
++ "lib/internal/perf/nodetiming.js",
++ "lib/internal/perf/observe.js",
++ "lib/internal/perf/performance.js",
++ "lib/internal/perf/performance_entry.js",
++ "lib/internal/perf/resource_timing.js",
++ "lib/internal/perf/timerify.js",
++ "lib/internal/perf/usertiming.js",
++ "lib/internal/perf/utils.js",
++ "lib/internal/policy/manifest.js",
++ "lib/internal/policy/sri.js",
++ "lib/internal/priority_queue.js",
++ "lib/internal/process/execution.js",
++ "lib/internal/process/per_thread.js",
++ "lib/internal/process/permission.js",
++ "lib/internal/process/policy.js",
++ "lib/internal/process/pre_execution.js",
++ "lib/internal/process/promises.js",
++ "lib/internal/process/report.js",
++ "lib/internal/process/signal.js",
++ "lib/internal/process/task_queues.js",
++ "lib/internal/process/warning.js",
++ "lib/internal/process/worker_thread_only.js",
++ "lib/internal/promise_hooks.js",
++ "lib/internal/querystring.js",
++ "lib/internal/readline/callbacks.js",
++ "lib/internal/readline/emitKeypressEvents.js",
++ "lib/internal/readline/interface.js",
++ "lib/internal/readline/promises.js",
++ "lib/internal/readline/utils.js",
++ "lib/internal/repl.js",
++ "lib/internal/repl/await.js",
++ "lib/internal/repl/history.js",
++ "lib/internal/repl/utils.js",
++ "lib/internal/socket_list.js",
++ "lib/internal/socketaddress.js",
++ "lib/internal/source_map/prepare_stack_trace.js",
++ "lib/internal/source_map/source_map.js",
++ "lib/internal/source_map/source_map_cache.js",
++ "lib/internal/source_map/source_map_cache_map.js",
++ "lib/internal/stream_base_commons.js",
++ "lib/internal/streams/add-abort-signal.js",
++ "lib/internal/streams/compose.js",
++ "lib/internal/streams/destroy.js",
++ "lib/internal/streams/duplex.js",
++ "lib/internal/streams/duplexify.js",
++ "lib/internal/streams/duplexpair.js",
++ "lib/internal/streams/end-of-stream.js",
++ "lib/internal/streams/from.js",
++ "lib/internal/streams/lazy_transform.js",
++ "lib/internal/streams/legacy.js",
++ "lib/internal/streams/operators.js",
++ "lib/internal/streams/passthrough.js",
++ "lib/internal/streams/pipeline.js",
++ "lib/internal/streams/readable.js",
++ "lib/internal/streams/state.js",
++ "lib/internal/streams/transform.js",
++ "lib/internal/streams/utils.js",
++ "lib/internal/streams/writable.js",
++ "lib/internal/test/binding.js",
++ "lib/internal/test/transfer.js",
++ "lib/internal/test_runner/coverage.js",
++ "lib/internal/test_runner/harness.js",
++ "lib/internal/test_runner/mock/loader.js",
++ "lib/internal/test_runner/mock/mock.js",
++ "lib/internal/test_runner/mock/mock_timers.js",
++ "lib/internal/test_runner/reporter/dot.js",
++ "lib/internal/test_runner/reporter/junit.js",
++ "lib/internal/test_runner/reporter/lcov.js",
++ "lib/internal/test_runner/reporter/spec.js",
++ "lib/internal/test_runner/reporter/tap.js",
++ "lib/internal/test_runner/reporter/utils.js",
++ "lib/internal/test_runner/reporter/v8-serializer.js",
++ "lib/internal/test_runner/runner.js",
++ "lib/internal/test_runner/test.js",
++ "lib/internal/test_runner/tests_stream.js",
++ "lib/internal/test_runner/utils.js",
++ "lib/internal/timers.js",
++ "lib/internal/tls/secure-context.js",
++ "lib/internal/tls/secure-pair.js",
++ "lib/internal/trace_events_async_hooks.js",
++ "lib/internal/tty.js",
++ "lib/internal/url.js",
++ "lib/internal/util.js",
++ "lib/internal/util/colors.js",
++ "lib/internal/util/comparisons.js",
++ "lib/internal/util/debuglog.js",
++ "lib/internal/util/inspect.js",
++ "lib/internal/util/inspector.js",
++ "lib/internal/util/parse_args/parse_args.js",
++ "lib/internal/util/parse_args/utils.js",
++ "lib/internal/util/types.js",
++ "lib/internal/v8/startup_snapshot.js",
++ "lib/internal/v8_prof_polyfill.js",
++ "lib/internal/v8_prof_processor.js",
++ "lib/internal/validators.js",
++ "lib/internal/vm.js",
++ "lib/internal/vm/module.js",
++ "lib/internal/wasm_web_api.js",
++ "lib/internal/watch_mode/files_watcher.js",
++ "lib/internal/watchdog.js",
++ "lib/internal/webidl.js",
++ "lib/internal/webstreams/adapters.js",
++ "lib/internal/webstreams/compression.js",
++ "lib/internal/webstreams/encoding.js",
++ "lib/internal/webstreams/queuingstrategies.js",
++ "lib/internal/webstreams/readablestream.js",
++ "lib/internal/webstreams/transfer.js",
++ "lib/internal/webstreams/transformstream.js",
++ "lib/internal/webstreams/util.js",
++ "lib/internal/webstreams/writablestream.js",
++ "lib/internal/worker.js",
++ "lib/internal/worker/io.js",
++ "lib/internal/worker/js_transferable.js",
++ "lib/internal/worker/messaging.js",
++ "lib/module.js",
++ "lib/net.js",
++ "lib/os.js",
++ "lib/path.js",
++ "lib/path/posix.js",
++ "lib/path/win32.js",
++ "lib/perf_hooks.js",
++ "lib/process.js",
++ "lib/punycode.js",
++ "lib/querystring.js",
++ "lib/readline.js",
++ "lib/readline/promises.js",
++ "lib/repl.js",
++ "lib/sea.js",
++ "lib/stream.js",
++ "lib/stream/consumers.js",
++ "lib/stream/promises.js",
++ "lib/stream/web.js",
++ "lib/string_decoder.js",
++ "lib/sys.js",
++ "lib/test.js",
++ "lib/test/reporters.js",
++ "lib/timers.js",
++ "lib/timers/promises.js",
++ "lib/tls.js",
++ "lib/trace_events.js",
++ "lib/tty.js",
++ "lib/url.js",
++ "lib/util.js",
++ "lib/util/types.js",
++ "lib/v8.js",
++ "lib/vm.js",
++ "lib/wasi.js",
++ "lib/worker_threads.js",
++ "lib/zlib.js",
++ "deps/v8/tools/splaytree.mjs",
++ "deps/v8/tools/codemap.mjs",
++ "deps/v8/tools/consarray.mjs",
++ "deps/v8/tools/csvparser.mjs",
++ "deps/v8/tools/profile.mjs",
++ "deps/v8/tools/profile_view.mjs",
++ "deps/v8/tools/logreader.mjs",
++ "deps/v8/tools/arguments.mjs",
++ "deps/v8/tools/tickprocessor.mjs",
++ "deps/v8/tools/sourcemap.mjs",
++ "deps/v8/tools/tickprocessor-driver.mjs",
++ "deps/acorn/acorn/dist/acorn.js",
++ "deps/acorn/acorn-walk/dist/walk.js",
++ "deps/minimatch/index.js",
++ "deps/cjs-module-lexer/lexer.js",
++ "deps/cjs-module-lexer/dist/lexer.js",
++ "deps/undici/undici.js"
++ ],
++ "node_sources": [
++ "src/api/async_resource.cc",
++ "src/api/callback.cc",
++ "src/api/embed_helpers.cc",
++ "src/api/encoding.cc",
++ "src/api/environment.cc",
++ "src/api/exceptions.cc",
++ "src/api/hooks.cc",
++ "src/api/utils.cc",
++ "src/async_wrap.cc",
++ "src/base_object.cc",
++ "src/cares_wrap.cc",
++ "src/cleanup_queue.cc",
++ "src/connect_wrap.cc",
++ "src/connection_wrap.cc",
++ "src/dataqueue/queue.cc",
++ "src/debug_utils.cc",
++ "src/embedded_data.cc",
++ "src/encoding_binding.cc",
++ "src/env.cc",
++ "src/fs_event_wrap.cc",
++ "src/handle_wrap.cc",
++ "src/heap_utils.cc",
++ "src/histogram.cc",
++ "src/internal_only_v8.cc",
++ "src/js_native_api.h",
++ "src/js_native_api_types.h",
++ "src/js_native_api_v8.cc",
++ "src/js_native_api_v8.h",
++ "src/js_native_api_v8_internals.h",
++ "src/js_stream.cc",
++ "src/json_utils.cc",
++ "src/js_udp_wrap.cc",
++ "src/json_parser.h",
++ "src/json_parser.cc",
++ "src/module_wrap.cc",
++ "src/node.cc",
++ "src/node_api.cc",
++ "src/node_binding.cc",
++ "src/node_blob.cc",
++ "src/node_buffer.cc",
++ "src/node_builtins.cc",
++ "src/node_config.cc",
++ "src/node_constants.cc",
++ "src/node_contextify.cc",
++ "src/node_credentials.cc",
++ "src/node_dir.cc",
++ "src/node_dotenv.cc",
++ "src/node_env_var.cc",
++ "src/node_errors.cc",
++ "src/node_external_reference.cc",
++ "src/node_file.cc",
++ "src/node_http_parser.cc",
++ "src/node_http2.cc",
++ "src/node_i18n.cc",
++ "src/node_main_instance.cc",
++ "src/node_messaging.cc",
++ "src/node_metadata.cc",
++ "src/node_options.cc",
++ "src/node_os.cc",
++ "src/node_perf.cc",
++ "src/node_platform.cc",
++ "src/node_postmortem_metadata.cc",
++ "src/node_process_events.cc",
++ "src/node_process_methods.cc",
++ "src/node_process_object.cc",
++ "src/node_realm.cc",
++ "src/node_report.cc",
++ "src/node_report_module.cc",
++ "src/node_report_utils.cc",
++ "src/node_sea.cc",
++ "src/node_serdes.cc",
++ "src/node_shadow_realm.cc",
++ "src/node_snapshotable.cc",
++ "src/node_sockaddr.cc",
++ "src/node_stat_watcher.cc",
++ "src/node_symbols.cc",
++ "src/node_task_queue.cc",
++ "src/node_trace_events.cc",
++ "src/node_types.cc",
++ "src/node_url.cc",
++ "src/node_util.cc",
++ "src/node_v8.cc",
++ "src/node_wasi.cc",
++ "src/node_wasm_web_api.cc",
++ "src/node_watchdog.cc",
++ "src/node_worker.cc",
++ "src/node_zlib.cc",
++ "src/path.cc",
++ "src/permission/child_process_permission.cc",
++ "src/permission/fs_permission.cc",
++ "src/permission/inspector_permission.cc",
++ "src/permission/permission.cc",
++ "src/permission/wasi_permission.cc",
++ "src/permission/worker_permission.cc",
++ "src/pipe_wrap.cc",
++ "src/process_wrap.cc",
++ "src/signal_wrap.cc",
++ "src/spawn_sync.cc",
++ "src/stream_base.cc",
++ "src/stream_pipe.cc",
++ "src/stream_wrap.cc",
++ "src/string_bytes.cc",
++ "src/string_decoder.cc",
++ "src/tcp_wrap.cc",
++ "src/timers.cc",
++ "src/timer_wrap.cc",
++ "src/tracing/agent.cc",
++ "src/tracing/node_trace_buffer.cc",
++ "src/tracing/node_trace_writer.cc",
++ "src/tracing/trace_event.cc",
++ "src/tracing/traced_value.cc",
++ "src/tty_wrap.cc",
++ "src/udp_wrap.cc",
++ "src/util.cc",
++ "src/uv.cc",
++ "src/aliased_buffer.h",
++ "src/aliased_buffer-inl.h",
++ "src/aliased_struct.h",
++ "src/aliased_struct-inl.h",
++ "src/async_wrap.h",
++ "src/async_wrap-inl.h",
++ "src/base_object.h",
++ "src/base_object-inl.h",
++ "src/base_object_types.h",
++ "src/base64.h",
++ "src/base64-inl.h",
++ "src/blob_serializer_deserializer.h",
++ "src/blob_serializer_deserializer-inl.h",
++ "src/callback_queue.h",
++ "src/callback_queue-inl.h",
++ "src/cleanup_queue.h",
++ "src/cleanup_queue-inl.h",
++ "src/connect_wrap.h",
++ "src/connection_wrap.h",
++ "src/dataqueue/queue.h",
++ "src/debug_utils.h",
++ "src/debug_utils-inl.h",
++ "src/embedded_data.h",
++ "src/encoding_binding.h",
++ "src/env_properties.h",
++ "src/env.h",
++ "src/env-inl.h",
++ "src/handle_wrap.h",
++ "src/histogram.h",
++ "src/histogram-inl.h",
++ "src/js_stream.h",
++ "src/json_utils.h",
++ "src/large_pages/node_large_page.cc",
++ "src/large_pages/node_large_page.h",
++ "src/memory_tracker.h",
++ "src/memory_tracker-inl.h",
++ "src/module_wrap.h",
++ "src/node.h",
++ "src/node_api.h",
++ "src/node_api_types.h",
++ "src/node_binding.h",
++ "src/node_blob.h",
++ "src/node_buffer.h",
++ "src/node_builtins.h",
++ "src/node_constants.h",
++ "src/node_context_data.h",
++ "src/node_contextify.h",
++ "src/node_dir.h",
++ "src/node_dotenv.h",
++ "src/node_errors.h",
++ "src/node_exit_code.h",
++ "src/node_external_reference.h",
++ "src/node_file.h",
++ "src/node_file-inl.h",
++ "src/node_http_common.h",
++ "src/node_http_common-inl.h",
++ "src/node_http2.h",
++ "src/node_http2_state.h",
++ "src/node_i18n.h",
++ "src/node_internals.h",
++ "src/node_main_instance.h",
++ "src/node_mem.h",
++ "src/node_mem-inl.h",
++ "src/node_messaging.h",
++ "src/node_metadata.h",
++ "src/node_mutex.h",
++ "src/node_object_wrap.h",
++ "src/node_options.h",
++ "src/node_options-inl.h",
++ "src/node_perf.h",
++ "src/node_perf_common.h",
++ "src/node_platform.h",
++ "src/node_process.h",
++ "src/node_process-inl.h",
++ "src/node_realm.h",
++ "src/node_realm-inl.h",
++ "src/node_report.h",
++ "src/node_revert.h",
++ "src/node_root_certs.h",
++ "src/node_sea.h",
++ "src/node_shadow_realm.h",
++ "src/node_snapshotable.h",
++ "src/node_snapshot_builder.h",
++ "src/node_sockaddr.h",
++ "src/node_sockaddr-inl.h",
++ "src/node_stat_watcher.h",
++ "src/node_union_bytes.h",
++ "src/node_url.h",
++ "src/node_version.h",
++ "src/node_v8.h",
++ "src/node_v8_platform-inl.h",
++ "src/node_wasi.h",
++ "src/node_watchdog.h",
++ "src/node_worker.h",
++ "src/path.h",
++ "src/permission/child_process_permission.h",
++ "src/permission/fs_permission.h",
++ "src/permission/inspector_permission.h",
++ "src/permission/permission.h",
++ "src/permission/wasi_permission.h",
++ "src/permission/worker_permission.h",
++ "src/pipe_wrap.h",
++ "src/req_wrap.h",
++ "src/req_wrap-inl.h",
++ "src/spawn_sync.h",
++ "src/stream_base.h",
++ "src/stream_base-inl.h",
++ "src/stream_pipe.h",
++ "src/stream_wrap.h",
++ "src/string_bytes.h",
++ "src/string_decoder.h",
++ "src/string_decoder-inl.h",
++ "src/string_search.h",
++ "src/tcp_wrap.h",
++ "src/timers.h",
++ "src/tracing/agent.h",
++ "src/tracing/node_trace_buffer.h",
++ "src/tracing/node_trace_writer.h",
++ "src/tracing/trace_event.h",
++ "src/tracing/trace_event_common.h",
++ "src/tracing/traced_value.h",
++ "src/timer_wrap.h",
++ "src/timer_wrap-inl.h",
++ "src/tty_wrap.h",
++ "src/udp_wrap.h",
++ "src/util.h",
++ "src/util-inl.h",
++ "//v8/include/v8.h",
++ "deps/postject/postject-api.h"
++ ]
++}
diff --git a/electron34/patches/patch-third__party_electron__node_lib_.eslintrc.yaml b/electron34/patches/patch-third__party_electron__node_lib_.eslintrc.yaml
new file mode 100644
index 0000000000..6616997e79
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_.eslintrc.yaml
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/.eslintrc.yaml.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/.eslintrc.yaml
+@@ -30,10 +30,6 @@ rules:
+ message: Use `const { AbortController } = require('internal/abort_controller');` instead of the global.
+ - name: AbortSignal
+ message: Use `const { AbortSignal } = require('internal/abort_controller');` instead of the global.
+- # Atomics is not available in primordials because it can be
+- # disabled with --no-harmony-atomics CLI flag.
+- - name: Atomics
+- message: Use `const { Atomics } = globalThis;` instead of the global.
+ - name: Blob
+ message: Use `const { Blob } = require('buffer');` instead of the global.
+ - name: BroadcastChannel
diff --git a/electron34/patches/patch-third__party_electron__node_lib_child__process.js b/electron34/patches/patch-third__party_electron__node_lib_child__process.js
new file mode 100644
index 0000000000..fccf15bbc4
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_child__process.js
@@ -0,0 +1,55 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/child_process.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/child_process.js
+@@ -61,6 +61,7 @@ let debug = require('internal/util/debug
+ );
+ const { Buffer } = require('buffer');
+ const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
++const { getCrashdumpSignalFD, getCrashpadHandlerPID } = process._linkedBinding('electron_common_crashpad_support');
+
+ const {
+ AbortError,
+@@ -154,7 +155,6 @@ function fork(modulePath, args = [], opt
+ ArrayPrototypeSplice(execArgv, index - 1, 2);
+ }
+ }
+-
+ args = [...execArgv, modulePath, ...args];
+
+ if (typeof options.stdio === 'string') {
+@@ -618,6 +618,22 @@ function normalizeSpawnArguments(file, a
+ 'options.windowsVerbatimArguments');
+ }
+
++ const env = options.env || process.env;
++
++ if ((process.platform === 'linux') &&
++ ObjectPrototypeHasOwnProperty(env, 'ELECTRON_RUN_AS_NODE') &&
++ (file === process.execPath)) {
++ // On Linux, pass the file descriptor which crashpad handler process
++ // uses to monitor the child process and PID of the handler process.
++ // https://source.chromium.org/chromium/chromium/src/+/110.0.5415.0:components/crash/core/app/crashpad_linux.cc;l=199-206
++ const fd = getCrashdumpSignalFD();
++ const pid = getCrashpadHandlerPID();
++ if (fd !== -1 && pid !== -1) {
++ env.CRASHDUMP_SIGNAL_FD = fd;
++ env.CRASHPAD_HANDLER_PID = pid;
++ }
++ }
++
+ if (options.shell) {
+ validateArgumentNullCheck(options.shell, 'options.shell');
+ const command = ArrayPrototypeJoin([file, ...args], ' ');
+@@ -651,7 +667,6 @@ function normalizeSpawnArguments(file, a
+ ArrayPrototypeUnshift(args, file);
+ }
+
+- const env = options.env || process.env;
+ const envPairs = [];
+
+ // process.env.NODE_V8_COVERAGE always propagates, making it possible to
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_assert_utils.js b/electron34/patches/patch-third__party_electron__node_lib_internal_assert_utils.js
new file mode 100644
index 0000000000..01092a4686
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_assert_utils.js
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/assert/utils.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/assert/utils.js
+@@ -25,6 +25,7 @@ const AssertionError = require('internal
+ const { openSync, closeSync, readSync } = require('fs');
+ const { EOL } = require('internal/constants');
+ const { BuiltinModule } = require('internal/bootstrap/realm');
++const { getEmbedderOptions } = require('internal/options');
+ const { isError } = require('internal/util');
+
+ const errorCache = new SafeMap();
+@@ -167,8 +168,16 @@ function getErrMessage(message, fn) {
+ ErrorCaptureStackTrace(err, fn);
+ if (errorStackTraceLimitIsWritable) Error.stackTraceLimit = tmpLimit;
+
+- overrideStackTrace.set(err, (_, stack) => stack);
+- const call = err.stack[0];
++ let call;
++ if (getEmbedderOptions().hasPrepareStackTraceCallback) {
++ overrideStackTrace.set(err, (_, stack) => stack);
++ call = err.stack[0];
++ } else {
++ const tmpPrepare = Error.prepareStackTrace;
++ Error.prepareStackTrace = (_, stack) => stack;
++ call = err.stack[0];
++ Error.prepareStackTrace = tmpPrepare;
++ }
+
+ let filename = call.getFileName();
+ const line = call.getLineNumber() - 1;
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js b/electron34/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js
new file mode 100644
index 0000000000..812bd84089
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/bootstrap/node.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/bootstrap/node.js
+@@ -134,6 +134,10 @@ process.domain = null;
+ }
+ process._exiting = false;
+
++// NOTE: Electron deletes this references before user code runs so that
++// internalBinding is not leaked to user code.
++process.internalBinding = internalBinding;
++
+ // process.config is serialized config.gypi
+ const binding = internalBinding('builtins');
+
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_constants.js b/electron34/patches/patch-third__party_electron__node_lib_internal_constants.js
new file mode 100644
index 0000000000..685dd91298
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_constants.js
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/constants.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/constants.js
+@@ -5,12 +5,15 @@ const isWindows = process.platform === '
+ module.exports = {
+ // Alphabet chars.
+ CHAR_UPPERCASE_A: 65, /* A */
++ CHAR_UPPERCASE_B: 66, /* B */
+ CHAR_LOWERCASE_A: 97, /* a */
+ CHAR_UPPERCASE_Z: 90, /* Z */
+ CHAR_LOWERCASE_Z: 122, /* z */
+ CHAR_UPPERCASE_C: 67, /* C */
+ CHAR_LOWERCASE_B: 98, /* b */
++ CHAR_UPPERCASE_E: 69, /* E */
+ CHAR_LOWERCASE_E: 101, /* e */
++
+ CHAR_LOWERCASE_N: 110, /* n */
+
+ // Non-alphabetic chars.
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js b/electron34/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js
new file mode 100644
index 0000000000..adf22e5b5f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/fs/watchers.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/fs/watchers.js
+@@ -292,12 +292,13 @@ function emitCloseNT(self) {
+ }
+
+ // Legacy alias on the C++ wrapper object. This is not public API, so we may
+-// want to runtime-deprecate it at some point. There's no hurry, though.
+-ObjectDefineProperty(FSEvent.prototype, 'owner', {
+- __proto__: null,
+- get() { return this[owner_symbol]; },
+- set(v) { return this[owner_symbol] = v; },
+-});
++if (!'owner' in FSEvent.prototype) {
++ ObjectDefineProperty(FSEvent.prototype, 'owner', {
++ __proto__: null,
++ get() { return this[owner_symbol]; },
++ set(v) { return this[owner_symbol] = v; }
++ });
++}
+
+ let kResistStopPropagation;
+
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_http.js b/electron34/patches/patch-third__party_electron__node_lib_internal_http.js
new file mode 100644
index 0000000000..19f96611f2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_http.js
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/http.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/http.js
+@@ -8,8 +8,8 @@ const {
+ const { setUnrefTimeout } = require('internal/timers');
+ const { getCategoryEnabledBuffer, trace } = internalBinding('trace_events');
+ const {
+- CHAR_LOWERCASE_B,
+- CHAR_LOWERCASE_E,
++ CHAR_UPPERCASE_B,
++ CHAR_UPPERCASE_E,
+ } = require('internal/constants');
+
+ let utcCache;
+@@ -44,11 +44,13 @@ function isTraceHTTPEnabled() {
+ const traceEventCategory = 'node,node.http';
+
+ function traceBegin(...args) {
+- trace(CHAR_LOWERCASE_B, traceEventCategory, ...args);
++ // See v8/src/builtins/builtins-trace.cc - must be uppercase for perfetto
++ trace(CHAR_UPPERCASE_B, traceEventCategory, ...args);
+ }
+
+ function traceEnd(...args) {
+- trace(CHAR_LOWERCASE_E, traceEventCategory, ...args);
++ // See v8/src/builtins/builtins-trace.cc - must be uppercase for perfetto
++ trace(CHAR_UPPERCASE_E, traceEventCategory, ...args);
+ }
+
+ module.exports = {
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js b/electron34/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js
new file mode 100644
index 0000000000..cf71a55998
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/main/worker_thread.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/main/worker_thread.js
+@@ -117,7 +117,7 @@ port.on('message', (message) => {
+ require('internal/worker').assignEnvironmentData(environmentData);
+ setupMainThreadPort(mainThreadPort);
+
+- if (SharedArrayBuffer !== undefined && Atomics !== undefined) {
++ if (SharedArrayBuffer !== undefined) {
+ // The counter is only passed to the workers created by the main thread,
+ // not to workers created by other workers.
+ let cachedCwd = '';
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
new file mode 100644
index 0000000000..fd3cbed7f2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
@@ -0,0 +1,63 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/cjs/loader.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/cjs/loader.js
+@@ -141,7 +141,7 @@ const {
+ const assert = require('internal/assert');
+ const fs = require('fs');
+ const path = require('path');
+-const { internalModuleStat } = internalBinding('fs');
++const internalFsBinding = internalBinding('fs');
+ const { safeGetenv } = internalBinding('credentials');
+ const {
+ privateSymbols: {
+@@ -188,6 +188,13 @@ const {
+ CHAR_FORWARD_SLASH,
+ } = require('internal/constants');
+
++// Store the "global" variable from global scope into a local scope, so we can
++// still reference it from this file even after we deleted the "global" variable
++// from the global scope.
++const localGlobal = (typeof global !== 'undefined') ? global : undefined;
++// Do the same for "Buffer".
++const localBuffer = (typeof Buffer !== 'undefined') ? Buffer : undefined;
++
+ const {
+ isProxy,
+ } = require('internal/util/types');
+@@ -229,7 +236,7 @@ function stat(filename) {
+ const result = statCache.get(filename);
+ if (result !== undefined) { return result; }
+ }
+- const result = internalModuleStat(filename);
++ const result = internalFsBinding.internalModuleStat(filename);
+ if (statCache !== null && result >= 0) {
+ // Only set cache when `internalModuleStat(filename)` succeeds.
+ statCache.set(filename, result);
+@@ -1523,11 +1530,20 @@ Module.prototype._compile = function(con
+ this[kIsExecuting] = true;
+ if (this[kIsMainSymbol] && getOptionValue('--inspect-brk')) {
+ const { callAndPauseOnStart } = internalBinding('inspector');
++ // process._firstFileName is used by Embedders to tell node what
++ // the first "real" file is when they use themselves as the entry
++ // point
++ if (process._firstFileName) {
++ resolvedArgv = process._firstFileName;
++ delete process._firstFileName;
++ }
+ result = callAndPauseOnStart(compiledWrapper, thisValue, exports,
+- require, module, filename, dirname);
++ require, module, filename, dirname,
++ process, localGlobal, localBuffer);
+ } else {
+ result = ReflectApply(compiledWrapper, thisValue,
+- [exports, require, module, filename, dirname]);
++ [exports, require, module, filename, dirname,
++ process, localGlobal, localBuffer]);
+ }
+ this[kIsExecuting] = false;
+ if (requireDepth === 0) { statCache = null; }
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js
new file mode 100644
index 0000000000..51807a1965
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/esm/get_format.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/get_format.js
+@@ -32,6 +32,7 @@ const protocolHandlers = {
+ 'http:': getHttpProtocolModuleFormat,
+ 'https:': getHttpProtocolModuleFormat,
+ 'node:'() { return 'builtin'; },
++ 'electron:'() { return 'electron'; },
+ };
+
+ /**
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js
new file mode 100644
index 0000000000..83b4c58c09
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/esm/load.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/load.js
+@@ -12,7 +12,7 @@ const {
+ const { defaultGetFormat } = require('internal/modules/esm/get_format');
+ const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert');
+ const { getOptionValue } = require('internal/options');
+-const { readFileSync } = require('fs');
++const fs = require('fs');
+
+ // Do not eagerly grab .manifest, it may be in TDZ
+ const policy = getOptionValue('--experimental-policy') ?
+@@ -44,8 +44,7 @@ async function getSource(url, context) {
+ let responseURL = href;
+ let source;
+ if (protocol === 'file:') {
+- const { readFile: readFileAsync } = require('internal/fs/promises').exports;
+- source = await readFileAsync(url);
++ source = await fs.promises.readFile(url);
+ } else if (protocol === 'data:') {
+ const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
+ if (!match) {
+@@ -84,7 +83,7 @@ function getSourceSync(url, context) {
+ const responseURL = href;
+ let source;
+ if (protocol === 'file:') {
+- source = readFileSync(url);
++ source = fs.readFileSync(url);
+ } else if (protocol === 'data:') {
+ const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname);
+ if (!match) {
+@@ -135,7 +134,7 @@ async function defaultLoad(url, context
+ source = null;
+ format ??= 'builtin';
+ } else if (format !== 'commonjs' || defaultType === 'module') {
+- if (source == null) {
++ if (format !== 'electron' && source == null) {
+ ({ responseURL, source } = await getSource(urlInstance, context));
+ context = { __proto__: context, source };
+ }
+@@ -144,7 +143,7 @@ async function defaultLoad(url, context
+ // Now that we have the source for the module, run `defaultGetFormat` to detect its format.
+ format = await defaultGetFormat(urlInstance, context);
+
+- if (format === 'commonjs') {
++ if (format === 'electron' || format === 'commonjs') {
+ // For backward compatibility reasons, we need to discard the source in
+ // order for the CJS loader to re-fetch it.
+ source = null;
+@@ -226,6 +225,7 @@ function throwIfUnsupportedURLScheme(par
+ protocol !== 'file:' &&
+ protocol !== 'data:' &&
+ protocol !== 'node:' &&
++ protocol !== 'electron:' &&
+ (
+ !experimentalNetworkImports ||
+ (
+@@ -234,7 +234,7 @@ function throwIfUnsupportedURLScheme(par
+ )
+ )
+ ) {
+- const schemes = ['file', 'data', 'node'];
++ const schemes = ['file', 'data', 'node', 'electron'];
+ if (experimentalNetworkImports) {
+ ArrayPrototypePush(schemes, 'https', 'http');
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js
new file mode 100644
index 0000000000..6672e51f1a
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js
@@ -0,0 +1,189 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/esm/resolve.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/resolve.js
+@@ -24,7 +24,7 @@ const {
+ } = primordials;
+ const internalFS = require('internal/fs/utils');
+ const { BuiltinModule } = require('internal/bootstrap/realm');
+-const { realpathSync } = require('fs');
++const fs = require('fs');
+ const { getOptionValue } = require('internal/options');
+ // Do not eagerly grab .manifest, it may be in TDZ
+ const policy = getOptionValue('--experimental-policy') ?
+@@ -36,10 +36,9 @@ const preserveSymlinksMain = getOptionVa
+ const experimentalNetworkImports =
+ getOptionValue('--experimental-network-imports');
+ const inputTypeFlag = getOptionValue('--input-type');
+-const { URL, pathToFileURL, fileURLToPath, isURL } = require('internal/url');
++const { URL, pathToFileURL, fileURLToPath, isURL, toPathIfFileURL } = require('internal/url');
+ const { getCWDURL, setOwnProperty } = require('internal/util');
+ const { canParse: URLCanParse } = internalBinding('url');
+-const { legacyMainResolve: FSLegacyMainResolve } = internalBinding('fs');
+ const {
+ ERR_INPUT_TYPE_NOT_ALLOWED,
+ ERR_INVALID_ARG_TYPE,
+@@ -59,7 +58,7 @@ const { Module: CJSModule } = require('i
+ const { getPackageScopeConfig } = require('internal/modules/esm/package_config');
+ const { getConditionsSet } = require('internal/modules/esm/utils');
+ const packageJsonReader = require('internal/modules/package_json_reader');
+-const { internalModuleStat } = internalBinding('fs');
++const internalFsBinding = internalBinding('fs');
+
+ /**
+ * @typedef {import('internal/modules/esm/package_config.js').PackageConfig} PackageConfig
+@@ -162,34 +161,13 @@ function emitLegacyIndexDeprecation(url,
+
+ const realpathCache = new SafeMap();
+
+-const legacyMainResolveExtensions = [
+- '',
+- '.js',
+- '.json',
+- '.node',
+- '/index.js',
+- '/index.json',
+- '/index.node',
+- './index.js',
+- './index.json',
+- './index.node',
+-];
+-
+-const legacyMainResolveExtensionsIndexes = {
+- // 0-6: when packageConfig.main is defined
+- kResolvedByMain: 0,
+- kResolvedByMainJs: 1,
+- kResolvedByMainJson: 2,
+- kResolvedByMainNode: 3,
+- kResolvedByMainIndexJs: 4,
+- kResolvedByMainIndexJson: 5,
+- kResolvedByMainIndexNode: 6,
+- // 7-9: when packageConfig.main is NOT defined,
+- // or when the previous case didn't found the file
+- kResolvedByPackageAndJs: 7,
+- kResolvedByPackageAndJson: 8,
+- kResolvedByPackageAndNode: 9,
+-};
++/**
++ * @param {string | URL} url
++ * @returns {boolean}
++ */
++function fileExists(url) {
++ return internalFsBinding.internalModuleStat(toNamespacedPath(toPathIfFileURL(url))) === 0;
++}
+
+ /**
+ * Legacy CommonJS main resolution:
+@@ -204,22 +182,44 @@ const legacyMainResolveExtensionsIndexes
+ * @returns {URL}
+ */
+ function legacyMainResolve(packageJSONUrl, packageConfig, base) {
+- const packageJsonUrlString = packageJSONUrl.href;
+-
+- if (typeof packageJsonUrlString !== 'string') {
+- throw new ERR_INVALID_ARG_TYPE('packageJSONUrl', ['URL'], packageJSONUrl);
+- }
+-
+- const baseStringified = isURL(base) ? base.href : base;
+-
+- const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig.main, baseStringified);
+-
+- const baseUrl = resolvedOption <= legacyMainResolveExtensionsIndexes.kResolvedByMainIndexNode ? `./${packageConfig.main}` : '';
+- const resolvedUrl = new URL(baseUrl + legacyMainResolveExtensions[resolvedOption], packageJSONUrl);
+-
+- emitLegacyIndexDeprecation(resolvedUrl, packageJSONUrl, base, packageConfig.main);
+-
+- return resolvedUrl;
++ let guess;
++ if (packageConfig.main !== undefined) {
++ // Note: fs check redundances will be handled by Descriptor cache here.
++ if (fileExists(guess = new URL(`./${packageConfig.main}`,
++ packageJSONUrl))) {
++ return guess;
++ } else if (fileExists(guess = new URL(`./${packageConfig.main}.js`,
++ packageJSONUrl)));
++ else if (fileExists(guess = new URL(`./${packageConfig.main}.json`,
++ packageJSONUrl)));
++ else if (fileExists(guess = new URL(`./${packageConfig.main}.node`,
++ packageJSONUrl)));
++ else if (fileExists(guess = new URL(`./${packageConfig.main}/index.js`,
++ packageJSONUrl)));
++ else if (fileExists(guess = new URL(`./${packageConfig.main}/index.json`,
++ packageJSONUrl)));
++ else if (fileExists(guess = new URL(`./${packageConfig.main}/index.node`,
++ packageJSONUrl)));
++ else guess = undefined;
++ if (guess) {
++ emitLegacyIndexDeprecation(guess, packageJSONUrl, base,
++ packageConfig.main);
++ return guess;
++ }
++ // Fallthrough.
++ }
++ if (fileExists(guess = new URL('./index.js', packageJSONUrl)));
++ // So fs.
++ else if (fileExists(guess = new URL('./index.json', packageJSONUrl)));
++ else if (fileExists(guess = new URL('./index.node', packageJSONUrl)));
++ else guess = undefined;
++ if (guess) {
++ emitLegacyIndexDeprecation(guess, packageJSONUrl, base, packageConfig.main);
++ return guess;
++ }
++ // Not found.
++ throw new ERR_MODULE_NOT_FOUND(
++ fileURLToPath(new URL('.', packageJSONUrl)), fileURLToPath(base));
+ }
+
+ const encodedSepRegEx = /%2F|%5C/i;
+@@ -257,7 +257,7 @@ function finalizeResolution(resolved, ba
+ throw err;
+ }
+
+- const stats = internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
++ const stats = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeEndsWith(path, '/') ?
+ StringPrototypeSlice(path, -1) : path));
+
+ // Check for stats.isDirectory()
+@@ -285,7 +285,7 @@ function finalizeResolution(resolved, ba
+ }
+
+ if (!preserveSymlinks) {
+- const real = realpathSync(path, {
++ const real = fs.realpathSync(path, {
+ [internalFS.realpathCacheKey]: realpathCache,
+ });
+ const { search, hash } = resolved;
+@@ -760,6 +760,8 @@ function packageImportsResolve(name, bas
+ throw importNotDefined(name, packageJSONUrl, base);
+ }
+
++const electronTypes = ['electron', 'electron/main', 'electron/common', 'electron/renderer'];
++
+ /**
+ * Returns the package type for a given URL.
+ * @param {URL} url - The URL to get the package type for.
+@@ -820,6 +822,11 @@ function packageResolve(specifier, base,
+ return new URL('node:' + specifier);
+ }
+
++ const electronSpecifiers = new SafeSet(electronTypes);
++ if (electronSpecifiers.has(specifier)) {
++ return new URL('electron:electron');
++ }
++
+ const { packageName, packageSubpath, isScoped } =
+ parsePackageName(specifier, base);
+
+@@ -838,7 +845,7 @@ function packageResolve(specifier, base,
+ let packageJSONPath = fileURLToPath(packageJSONUrl);
+ let lastPath;
+ do {
+- const stat = internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
++ const stat = internalFsBinding.internalModuleStat(toNamespacedPath(StringPrototypeSlice(packageJSONPath, 0,
+ packageJSONPath.length - 13)));
+ // Check for !stat.isDirectory()
+ if (stat !== 1) {
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js
new file mode 100644
index 0000000000..68c15179fc
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js
@@ -0,0 +1,76 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/esm/translators.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/translators.js
+@@ -33,7 +33,7 @@ const {
+
+ const { BuiltinModule } = require('internal/bootstrap/realm');
+ const assert = require('internal/assert');
+-const { readFileSync } = require('fs');
++const fs = require('fs');
+ const { dirname, extname, isAbsolute } = require('path');
+ const {
+ loadBuiltinModule,
+@@ -226,7 +226,7 @@ function createCJSModuleWrap(url, source
+
+ const { exportNames, module } = cjsPreparseModuleExports(filename, source);
+ cjsCache.set(url, module);
+- const namesWithDefault = exportNames.has('default') ?
++ const namesWithDefault = filename === 'electron' ? ['default', ...Object.keys(module.exports)] : exportNames.has('default') ?
+ [...exportNames] : ['default', ...exportNames];
+
+ if (isMain) {
+@@ -248,8 +248,8 @@ function createCJSModuleWrap(url, source
+ ({ exports } = module);
+ }
+ for (const exportName of exportNames) {
+- if (!ObjectPrototypeHasOwnProperty(exports, exportName) ||
+- exportName === 'default') {
++ if (exportName === 'default' ||
++ !ObjectPrototypeHasOwnProperty(exports, exportName)) {
+ continue;
+ }
+ // We might trigger a getter -> dont fail.
+@@ -283,6 +283,10 @@ translators.set('require-commonjs', (url
+ return createCJSModuleWrap(url, source);
+ });
+
++translators.set('electron', () => {
++ return createCJSModuleWrap('electron', '');
++});
++
+ // Handle CommonJS modules referenced by `import` statements or expressions,
+ // or as the initial entry point when the ESM loader handles a CommonJS entry.
+ translators.set('commonjs', function commonjsStrategy(url, source, isMain) {
+@@ -300,7 +304,7 @@ translators.set('commonjs', function com
+
+ try {
+ // We still need to read the FS to detect the exports.
+- source ??= readFileSync(new URL(url), 'utf8');
++ source ??= fs.readFileSync(new URL(url), 'utf8');
+ } catch {
+ // Continue regardless of error.
+ }
+@@ -318,6 +322,9 @@ function cjsPreparseModuleExports(filena
+ if (module && module[kModuleExportNames] !== undefined) {
+ return { module, exportNames: module[kModuleExportNames] };
+ }
++ if (filename === 'electron') {
++ return { module, exportNames: new SafeSet(['default', ...Object.keys(module.exports)]) };
++ }
+ const loaded = Boolean(module);
+ if (!loaded) {
+ module = new CJSModule(filename);
+@@ -367,7 +374,7 @@ function cjsPreparseModuleExports(filena
+ isAbsolute(resolved)) {
+ // TODO: this should be calling the `load` hook chain to get the source
+ // (and fallback to reading the FS only if the source is nullish).
+- const source = readFileSync(resolved, 'utf-8');
++ const source = fs.readFileSync(resolved, 'utf-8');
+ const { exportNames: reexportNames } = cjsPreparseModuleExports(resolved, source);
+ for (const name of reexportNames) {
+ exportNames.add(name);
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js
new file mode 100644
index 0000000000..53a762bb30
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/esm/utils.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/utils.js
+@@ -30,7 +30,7 @@ const {
+ ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING,
+ ERR_INVALID_ARG_VALUE,
+ } = require('internal/errors').codes;
+-const { getOptionValue } = require('internal/options');
++const { getOptionValue, getEmbedderOptions } = require('internal/options');
+ const {
+ loadPreloadModules,
+ initializeFrozenIntrinsics,
+@@ -274,12 +274,13 @@ let _forceDefaultLoader = false;
+ * @param {boolean} [forceDefaultLoader=false] - A boolean indicating disabling custom loaders.
+ */
+ function initializeESM(forceDefaultLoader = false) {
++ const shouldSetOnIsolate = !getEmbedderOptions().shouldNotRegisterESMLoader;
+ _forceDefaultLoader = forceDefaultLoader;
+ initializeDefaultConditions();
+ // Setup per-realm callbacks that locate data or callbacks that we keep
+ // track of for different ESM modules.
+- setInitializeImportMetaObjectCallback(initializeImportMetaObject);
+- setImportModuleDynamicallyCallback(importModuleDynamicallyCallback);
++ setInitializeImportMetaObjectCallback(initializeImportMetaObject, shouldSetOnIsolate);
++ setImportModuleDynamicallyCallback(importModuleDynamicallyCallback, shouldSetOnIsolate);
+ }
+
+ /**
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js
new file mode 100644
index 0000000000..ef1c00e4ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/package_json_reader.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/package_json_reader.js
+@@ -12,7 +12,7 @@ const {
+ const {
+ ERR_INVALID_PACKAGE_CONFIG,
+ } = require('internal/errors').codes;
+-const { internalModuleReadJSON } = internalBinding('fs');
++const internalFsBinding = internalBinding('fs');
+ const { resolve, sep, toNamespacedPath } = require('path');
+ const permission = require('internal/process/permission');
+ const { kEmptyObject } = require('internal/util');
+@@ -53,7 +53,7 @@ function read(jsonPath, { base, specifie
+ const {
+ 0: string,
+ 1: containsKeys,
+- } = internalModuleReadJSON(
++ } = internalFsBinding.internalModuleReadJSON(
+ toNamespacedPath(jsonPath),
+ );
+ const result = {
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js
new file mode 100644
index 0000000000..c09cc3fdfa
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/modules/run_main.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/run_main.js
+@@ -2,6 +2,7 @@
+
+ const {
+ StringPrototypeEndsWith,
++ StringPrototypeStartsWith,
+ } = primordials;
+
+ const { getOptionValue } = require('internal/options');
+@@ -21,6 +22,13 @@ const {
+ * @param {string} main - Entry point path
+ */
+ function resolveMainPath(main) {
++ // For built-in modules used as the main entry point we _never_
++ // want to waste cycles resolving them to file paths on disk
++ // that actually might exist
++ if (typeof main === 'string' && StringPrototypeStartsWith(main, 'electron/js2c')) {
++ return main;
++ }
++
+ const defaultType = getOptionValue('--experimental-default-type');
+ /** @type {string} */
+ let mainPath;
+@@ -57,6 +65,13 @@ function resolveMainPath(main) {
+ * @param {string} mainPath - Absolute path to the main entry point
+ */
+ function shouldUseESMLoader(mainPath) {
++ // For built-in modules used as the main entry point we _never_
++ // want to waste cycles resolving them to file paths on disk
++ // that actually might exist
++ if (typeof mainPath === 'string' && StringPrototypeStartsWith(mainPath, 'electron/js2c')) {
++ return false;
++ }
++
+ if (getOptionValue('--experimental-default-type') === 'module') { return true; }
+
+ /**
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js b/electron34/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js
new file mode 100644
index 0000000000..8baa58c217
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/process/pre_execution.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/process/pre_execution.js
+@@ -245,12 +245,14 @@ function patchProcessObject(expandArgv1)
+ // the entry point.
+ if (expandArgv1 && process.argv[1] && process.argv[1][0] !== '-') {
+ // Expand process.argv[1] into a full path.
+- const path = require('path');
+- try {
+- mainEntry = path.resolve(process.argv[1]);
+- process.argv[1] = mainEntry;
+- } catch {
+- // Continue regardless of error.
++ if (!process.argv[1] || !process.argv[1].startsWith('electron/js2c')) {
++ const path = require('path');
++ try {
++ mainEntry = path.resolve(process.argv[1]);
++ process.argv[1] = mainEntry;
++ } catch {
++ // Continue regardless of error.
++ }
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_url.js b/electron34/patches/patch-third__party_electron__node_lib_internal_url.js
new file mode 100644
index 0000000000..8cce989c90
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_url.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/url.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/url.js
+@@ -1485,6 +1485,8 @@ function fileURLToPath(path, options = k
+ path = new URL(path);
+ else if (!isURL(path))
+ throw new ERR_INVALID_ARG_TYPE('path', ['string', 'URL'], path);
++ if (path.protocol === 'electron:')
++ return 'electron';
+ if (path.protocol !== 'file:')
+ throw new ERR_INVALID_URL_SCHEME('file');
+ return (windows ?? isWindows) ? getPathFromURLWin32(path) : getPathFromURLPosix(path);
diff --git a/electron34/patches/patch-third__party_electron__node_lib_internal_worker.js b/electron34/patches/patch-third__party_electron__node_lib_internal_worker.js
new file mode 100644
index 0000000000..65dcfac86c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_lib_internal_worker.js
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/lib/internal/worker.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/lib/internal/worker.js
+@@ -102,8 +102,7 @@ let cwdCounter;
+ const environmentData = new SafeMap();
+
+ // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
+-// Atomics can be disabled with --no-harmony-atomics.
+-if (isMainThread && SharedArrayBuffer !== undefined && Atomics !== undefined) {
++if (isMainThread && SharedArrayBuffer !== undefined) {
+ cwdCounter = new Uint32Array(new SharedArrayBuffer(4));
+ const originalChdir = process.chdir;
+ process.chdir = function(path) {
diff --git a/electron34/patches/patch-third__party_electron__node_node.gypi b/electron34/patches/patch-third__party_electron__node_node.gypi
new file mode 100644
index 0000000000..42434f796b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_node.gypi
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/node.gypi.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/node.gypi
+@@ -63,10 +63,6 @@
+ 'FD_SETSIZE=1024',
+ # we need to use node's preferred "win32" rather than gyp's preferred "win"
+ 'NODE_PLATFORM="win32"',
+- # Stop <windows.h> from defining macros that conflict with
+- # std::min() and std::max(). We don't use <windows.h> (much)
+- # but we still inherit it from uv.h.
+- 'NOMINMAX',
+ '_UNICODE=1',
+ ],
+ 'msvs_precompiled_header': 'tools/msvs/pch/node_pch.h',
diff --git a/electron34/patches/patch-third__party_electron__node_src_api_environment.cc b/electron34/patches/patch-third__party_electron__node_src_api_environment.cc
new file mode 100644
index 0000000000..7fee9376f2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_api_environment.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/api/environment.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/api/environment.cc
+@@ -101,6 +101,14 @@ MaybeLocal<Value> PrepareStackTraceCallb
+ return result;
+ }
+
++NodeArrayBufferAllocator::NodeArrayBufferAllocator() {
++ zero_fill_field_ = static_cast<uint32_t*>(allocator_->Allocate(sizeof(*zero_fill_field_)));
++}
++
++NodeArrayBufferAllocator::~NodeArrayBufferAllocator() {
++ allocator_->Free(zero_fill_field_, sizeof(*zero_fill_field_));
++}
++
+ void* NodeArrayBufferAllocator::Allocate(size_t size) {
+ void* ret;
+ if (zero_fill_field_ || per_process::cli_options->zero_fill_all_buffers)
+@@ -236,6 +244,9 @@ void SetIsolateErrorHandlers(v8::Isolate
+ auto* prepare_stack_trace_cb = s.prepare_stack_trace_callback ?
+ s.prepare_stack_trace_callback : PrepareStackTraceCallback;
+ isolate->SetPrepareStackTraceCallback(prepare_stack_trace_cb);
++ } else {
++ auto env = Environment::GetCurrent(isolate);
++ env->set_prepare_stack_trace_callback(Local<Function>());
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_base__object-inl.h b/electron34/patches/patch-third__party_electron__node_src_base__object-inl.h
new file mode 100644
index 0000000000..8a14dac4a6
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_base__object-inl.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/base_object-inl.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/base_object-inl.h
+@@ -132,19 +132,18 @@ v8::EmbedderGraph::Node::Detachedness Ba
+
+ template <int Field>
+ void BaseObject::InternalFieldGet(
+- v8::Local<v8::String> property,
+- const v8::PropertyCallbackInfo<v8::Value>& info) {
+- info.GetReturnValue().Set(
+- info.This()->GetInternalField(Field).As<v8::Value>());
++ const v8::FunctionCallbackInfo<v8::Value>& args) {
++ args.GetReturnValue().Set(
++ args.This()->GetInternalField(Field).As<v8::Value>());
+ }
+
+-template <int Field, bool (v8::Value::* typecheck)() const>
+-void BaseObject::InternalFieldSet(v8::Local<v8::String> property,
+- v8::Local<v8::Value> value,
+- const v8::PropertyCallbackInfo<void>& info) {
++template <int Field, bool (v8::Value::*typecheck)() const>
++void BaseObject::InternalFieldSet(
++ const v8::FunctionCallbackInfo<v8::Value>& args) {
++ v8::Local<v8::Value> value = args[0];
+ // This could be e.g. value->IsFunction().
+ CHECK(((*value)->*typecheck)());
+- info.This()->SetInternalField(Field, value);
++ args.This()->SetInternalField(Field, value);
+ }
+
+ bool BaseObject::has_pointer_data() const {
diff --git a/electron34/patches/patch-third__party_electron__node_src_base__object.h b/electron34/patches/patch-third__party_electron__node_src_base__object.h
new file mode 100644
index 0000000000..ed816eaad2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_base__object.h
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/base_object.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/base_object.h
+@@ -111,12 +111,9 @@ class BaseObject : public MemoryRetainer
+
+ // Setter/Getter pair for internal fields that can be passed to SetAccessor.
+ template <int Field>
+- static void InternalFieldGet(v8::Local<v8::String> property,
+- const v8::PropertyCallbackInfo<v8::Value>& info);
++ static void InternalFieldGet(const v8::FunctionCallbackInfo<v8::Value>& args);
+ template <int Field, bool (v8::Value::*typecheck)() const>
+- static void InternalFieldSet(v8::Local<v8::String> property,
+- v8::Local<v8::Value> value,
+- const v8::PropertyCallbackInfo<void>& info);
++ static void InternalFieldSet(const v8::FunctionCallbackInfo<v8::Value>& args);
+
+ // This is a bit of a hack. See the override in async_wrap.cc for details.
+ virtual bool IsDoneInitializing() const;
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc
new file mode 100644
index 0000000000..1c4980b0c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_cipher.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_cipher.cc
+@@ -1088,7 +1088,7 @@ void PublicKeyCipher::Cipher(const Funct
+ if (EVP_PKEY_decrypt_init(ctx.get()) <= 0) {
+ return ThrowCryptoError(env, ERR_get_error());
+ }
+-
++#ifndef OPENSSL_IS_BORINGSSL
+ int rsa_pkcs1_implicit_rejection =
+ EVP_PKEY_CTX_ctrl_str(ctx.get(), "rsa_pkcs1_implicit_rejection", "1");
+ // From the doc -2 means that the option is not supported.
+@@ -1104,6 +1104,7 @@ void PublicKeyCipher::Cipher(const Funct
+ "RSA_PKCS1_PADDING is no longer supported for private decryption,"
+ " this can be reverted with --security-revert=CVE-2023-46809");
+ }
++#endif
+ }
+
+ const EVP_MD* digest = nullptr;
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc
new file mode 100644
index 0000000000..8c96339561
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_common.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_common.cc
+@@ -158,7 +158,7 @@ const char* GetClientHelloALPN(const SSL
+ const unsigned char* buf;
+ size_t len;
+ size_t rem;
+-
++#ifndef OPENSSL_IS_BORINGSSL
+ if (!SSL_client_hello_get0_ext(
+ ssl.get(),
+ TLSEXT_TYPE_application_layer_protocol_negotiation,
+@@ -171,13 +171,15 @@ const char* GetClientHelloALPN(const SSL
+ len = (buf[0] << 8) | buf[1];
+ if (len + 2 != rem) return nullptr;
+ return reinterpret_cast<const char*>(buf + 3);
++#endif
++ return nullptr;
+ }
+
+ const char* GetClientHelloServerName(const SSLPointer& ssl) {
+ const unsigned char* buf;
+ size_t len;
+ size_t rem;
+-
++#ifndef OPENSSL_IS_BORINGSSL
+ if (!SSL_client_hello_get0_ext(
+ ssl.get(),
+ TLSEXT_TYPE_server_name,
+@@ -199,6 +201,8 @@ const char* GetClientHelloServerName(con
+ if (len + 2 > rem)
+ return nullptr;
+ return reinterpret_cast<const char*>(buf + 5);
++#endif
++ return nullptr;
+ }
+
+ const char* GetServerName(SSL* ssl) {
+@@ -1036,14 +1040,14 @@ MaybeLocal<Array> GetClientHelloCiphers(
+ Environment* env,
+ const SSLPointer& ssl) {
+ EscapableHandleScope scope(env->isolate());
+- const unsigned char* buf;
+- size_t len = SSL_client_hello_get0_ciphers(ssl.get(), &buf);
++ // const unsigned char* buf = nullptr;
++ size_t len = 0; // SSL_client_hello_get0_ciphers(ssl.get(), &buf);
+ size_t count = len / 2;
+ MaybeStackBuffer<Local<Value>, 16> ciphers(count);
+ int j = 0;
+ for (size_t n = 0; n < len; n += 2) {
+- const SSL_CIPHER* cipher = SSL_CIPHER_find(ssl.get(), buf);
+- buf += 2;
++ const SSL_CIPHER* cipher = nullptr; // SSL_CIPHER_find(ssl.get(), buf);
++ // buf += 2;
+ Local<Object> obj = Object::New(env->isolate());
+ if (!Set(env->context(),
+ obj,
+@@ -1096,8 +1100,11 @@ MaybeLocal<Object> GetEphemeralKey(Envir
+
+ EscapableHandleScope scope(env->isolate());
+ Local<Object> info = Object::New(env->isolate());
++#ifndef OPENSSL_IS_BORINGSSL
+ if (!SSL_get_peer_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info);
+-
++#else
++ if (!SSL_get_server_tmp_key(ssl.get(), &raw_key)) return scope.Escape(info);
++#endif
+ Local<Context> context = env->context();
+ crypto::EVPKeyPointer key(raw_key);
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc
new file mode 100644
index 0000000000..7d9b13e1aa
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_context.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_context.cc
+@@ -63,7 +63,7 @@ inline X509_STORE* GetOrCreateRootCertSt
+ // Caller responsible for BIO_free_all-ing the returned object.
+ BIOPointer LoadBIO(Environment* env, Local<Value> v) {
+ if (v->IsString() || v->IsArrayBufferView()) {
+- BIOPointer bio(BIO_new(BIO_s_secmem()));
++ BIOPointer bio(BIO_new(BIO_s_mem()));
+ if (!bio) return nullptr;
+ ByteSource bsrc = ByteSource::FromStringOrBuffer(env, v);
+ if (bsrc.size() > INT_MAX) return nullptr;
+@@ -883,10 +883,12 @@ void SecureContext::SetDHParam(const Fun
+ // If the user specified "auto" for dhparams, the JavaScript layer will pass
+ // true to this function instead of the original string. Any other string
+ // value will be interpreted as custom DH parameters below.
++#ifndef OPENSSL_IS_BORINGSSL
+ if (args[0]->IsTrue()) {
+ CHECK(SSL_CTX_set_dh_auto(sc->ctx_.get(), true));
+ return;
+ }
++#endif
+
+ DHPointer dh;
+ {
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc
new file mode 100644
index 0000000000..c213096128
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc
@@ -0,0 +1,82 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_dh.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_dh.cc
+@@ -154,13 +154,11 @@ bool DiffieHellman::Init(BignumPointer&&
+ bool DiffieHellman::Init(const char* p, int p_len, int g) {
+ dh_.reset(DH_new());
+ if (p_len <= 0) {
+- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
+- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
++ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
+ return false;
+ }
+ if (g <= 1) {
+- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
+- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
+ return false;
+ }
+ BignumPointer bn_p(
+@@ -176,20 +174,17 @@ bool DiffieHellman::Init(const char* p,
+ bool DiffieHellman::Init(const char* p, int p_len, const char* g, int g_len) {
+ dh_.reset(DH_new());
+ if (p_len <= 0) {
+- ERR_put_error(ERR_LIB_BN, BN_F_BN_GENERATE_PRIME_EX,
+- BN_R_BITS_TOO_SMALL, __FILE__, __LINE__);
++ OPENSSL_PUT_ERROR(BN, BN_R_BITS_TOO_SMALL);
+ return false;
+ }
+ if (g_len <= 0) {
+- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
+- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
+ return false;
+ }
+ BignumPointer bn_g(
+ BN_bin2bn(reinterpret_cast<const unsigned char*>(g), g_len, nullptr));
+ if (BN_is_zero(bn_g.get()) || BN_is_one(bn_g.get())) {
+- ERR_put_error(ERR_LIB_DH, DH_F_DH_BUILTIN_GENPARAMS,
+- DH_R_BAD_GENERATOR, __FILE__, __LINE__);
++ OPENSSL_PUT_ERROR(DH, DH_R_BAD_GENERATOR);
+ return false;
+ }
+ BignumPointer bn_p(
+@@ -219,8 +214,10 @@ typedef BignumPointer (*StandardizedGrou
+ inline StandardizedGroupInstantiator FindDiffieHellmanGroup(const char* name) {
+ #define V(n, p) \
+ if (StringEqualNoCase(name, n)) return InstantiateStandardizedGroup<p>
++#ifndef OPENSSL_IS_BORINGSSL
+ V("modp1", BN_get_rfc2409_prime_768);
+ V("modp2", BN_get_rfc2409_prime_1024);
++#endif
+ V("modp5", BN_get_rfc3526_prime_1536);
+ V("modp14", BN_get_rfc3526_prime_2048);
+ V("modp15", BN_get_rfc3526_prime_3072);
+@@ -565,9 +562,11 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(D
+ key_params = EVPKeyPointer(EVP_PKEY_new());
+ CHECK(key_params);
+ CHECK_EQ(EVP_PKEY_assign_DH(key_params.get(), dh.release()), 1);
+- } else if (int* prime_size = std::get_if<int>(¶ms->params.prime)) {
++ } else if (std::get_if<int>(¶ms->params.prime)) {
+ EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DH, nullptr));
+ EVP_PKEY* raw_params = nullptr;
++#ifndef OPENSSL_IS_BORINGSSL
++ int* prime_size = std::get_if<int>(¶ms->params.prime);
+ if (!param_ctx ||
+ EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
+ EVP_PKEY_CTX_set_dh_paramgen_prime_len(
+@@ -581,6 +580,9 @@ EVPKeyCtxPointer DhKeyGenTraits::Setup(D
+ }
+
+ key_params = EVPKeyPointer(raw_params);
++#else
++ return EVPKeyCtxPointer();
++#endif
+ } else {
+ UNREACHABLE();
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc
new file mode 100644
index 0000000000..7a97a76cc9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_dsa.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_dsa.cc
+@@ -40,7 +40,7 @@ namespace crypto {
+ EVPKeyCtxPointer DsaKeyGenTraits::Setup(DsaKeyPairGenConfig* params) {
+ EVPKeyCtxPointer param_ctx(EVP_PKEY_CTX_new_id(EVP_PKEY_DSA, nullptr));
+ EVP_PKEY* raw_params = nullptr;
+-
++#ifndef OPENSSL_IS_BORINGSSL
+ if (!param_ctx ||
+ EVP_PKEY_paramgen_init(param_ctx.get()) <= 0 ||
+ EVP_PKEY_CTX_set_dsa_paramgen_bits(
+@@ -55,7 +55,9 @@ EVPKeyCtxPointer DsaKeyGenTraits::Setup(
+ return EVPKeyCtxPointer();
+ }
+ }
+-
++#else
++ return EVPKeyCtxPointer();
++#endif
+ if (EVP_PKEY_paramgen(param_ctx.get(), &raw_params) <= 0)
+ return EVPKeyCtxPointer();
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc
new file mode 100644
index 0000000000..0bb72ae059
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_keys.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_keys.cc
+@@ -1239,6 +1239,7 @@ void KeyObjectHandle::GetAsymmetricKeyTy
+ }
+
+ bool KeyObjectHandle::CheckEcKeyData() const {
++#ifndef OPENSSL_IS_BORINGSSL
+ MarkPopErrorOnReturn mark_pop_error_on_return;
+
+ const ManagedEVPPKey& key = data_->GetAsymmetricKey();
+@@ -1257,6 +1258,9 @@ bool KeyObjectHandle::CheckEcKeyData() c
+ #else
+ return EVP_PKEY_public_check(ctx.get()) == 1;
+ #endif
++#else
++ return true;
++#endif
+ }
+
+ void KeyObjectHandle::CheckEcKeyData(const FunctionCallbackInfo<Value>& args) {
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc
new file mode 100644
index 0000000000..bd392d6a3b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_random.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_random.cc
+@@ -140,7 +140,7 @@ Maybe<bool> RandomPrimeTraits::Additiona
+
+ params->bits = bits;
+ params->safe = safe;
+- params->prime.reset(BN_secure_new());
++ params->prime.reset(BN_new());
+ if (!params->prime) {
+ THROW_ERR_CRYPTO_OPERATION_FAILED(env, "could not generate prime");
+ return Nothing<bool>();
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc
new file mode 100644
index 0000000000..3da8c587d6
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_rsa.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_rsa.cc
+@@ -616,10 +616,11 @@ Maybe<bool> GetRsaKeyDetail(
+ }
+
+ if (params->saltLength != nullptr) {
+- if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
+- ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
+- return Nothing<bool>();
+- }
++ // TODO(codebytere): Upstream a shim to BoringSSL?
++ // if (ASN1_INTEGER_get_int64(&salt_length, params->saltLength) != 1) {
++ // ThrowCryptoError(env, ERR_get_error(), "ASN1_INTEGER_get_in64 error");
++ // return Nothing<bool>();
++ // }
+ }
+
+ if (target
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc
new file mode 100644
index 0000000000..6cf3f9466d
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc
@@ -0,0 +1,130 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_util.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_util.cc
+@@ -348,10 +348,35 @@ ByteSource& ByteSource::operator=(ByteSo
+ return *this;
+ }
+
+-std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore() {
++std::unique_ptr<BackingStore> ByteSource::ReleaseToBackingStore(Environment* env) {
+ // It's ok for allocated_data_ to be nullptr but
+ // only if size_ is zero.
+ CHECK_IMPLIES(size_ > 0, allocated_data_ != nullptr);
++#if defined(V8_ENABLE_SANDBOX)
++ // When V8 sandboxed pointers are enabled, we have to copy into the memory
++ // cage. We still want to ensure we erase the data on free though, so
++ // provide a custom deleter that calls OPENSSL_cleanse.
++ if (!size())
++ return ArrayBuffer::NewBackingStore(env->isolate(), 0);
++ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
++ void* v8_data = allocator->Allocate(size());
++ CHECK(v8_data);
++ memcpy(v8_data, allocated_data_, size());
++ OPENSSL_clear_free(allocated_data_, size());
++ std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore(
++ v8_data,
++ size(),
++ [](void* data, size_t length, void*) {
++ OPENSSL_cleanse(data, length);
++ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
++ allocator->Free(data, length);
++ }, nullptr);
++ CHECK(ptr);
++ allocated_data_ = nullptr;
++ data_ = nullptr;
++ size_ = 0;
++ return ptr;
++#else
+ std::unique_ptr<BackingStore> ptr = ArrayBuffer::NewBackingStore(
+ allocated_data_,
+ size(),
+@@ -363,10 +388,11 @@ std::unique_ptr<BackingStore> ByteSource
+ data_ = nullptr;
+ size_ = 0;
+ return ptr;
++#endif // defined(V8_ENABLE_SANDBOX)
+ }
+
+ Local<ArrayBuffer> ByteSource::ToArrayBuffer(Environment* env) {
+- std::unique_ptr<BackingStore> store = ReleaseToBackingStore();
++ std::unique_ptr<BackingStore> store = ReleaseToBackingStore(env);
+ return ArrayBuffer::New(env->isolate(), std::move(store));
+ }
+
+@@ -518,24 +544,15 @@ Maybe<void> Decorate(Environment* env,
+ V(BIO) \
+ V(PKCS7) \
+ V(X509V3) \
+- V(PKCS12) \
+ V(RAND) \
+- V(DSO) \
+ V(ENGINE) \
+ V(OCSP) \
+ V(UI) \
+ V(COMP) \
+ V(ECDSA) \
+ V(ECDH) \
+- V(OSSL_STORE) \
+- V(FIPS) \
+- V(CMS) \
+- V(TS) \
+ V(HMAC) \
+- V(CT) \
+- V(ASYNC) \
+- V(KDF) \
+- V(SM2) \
++ V(HKDF) \
+ V(USER) \
+
+ #define V(name) case ERR_LIB_##name: lib = #name "_"; break;
+@@ -712,11 +729,21 @@ namespace {
+ // in which case this has the same semantics as
+ // using OPENSSL_malloc. However, if the secure heap is
+ // initialized, SecureBuffer will automatically use it.
++#if defined(V8_ENABLE_SANDBOX)
++// When V8 sandboxed pointers are enabled, the secure heap cannot be used as
++// all ArrayBuffers must be allocated inside the V8 memory cage.
++void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
++ CHECK(args[0]->IsUint32());
++ uint32_t len = args[0].As<Uint32>()->Value();
++ Local<ArrayBuffer> buffer = ArrayBuffer::New(args.GetIsolate(), len);
++ args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len));
++}
++#else
+ void SecureBuffer(const FunctionCallbackInfo<Value>& args) {
+ CHECK(args[0]->IsUint32());
+ Environment* env = Environment::GetCurrent(args);
+ uint32_t len = args[0].As<Uint32>()->Value();
+- void* data = OPENSSL_secure_zalloc(len);
++ void* data = OPENSSL_malloc(len);
+ if (data == nullptr) {
+ // There's no memory available for the allocation.
+ // Return nothing.
+@@ -727,18 +754,21 @@ void SecureBuffer(const FunctionCallback
+ data,
+ len,
+ [](void* data, size_t len, void* deleter_data) {
+- OPENSSL_secure_clear_free(data, len);
++ OPENSSL_clear_free(data, len);
+ },
+ data);
+ Local<ArrayBuffer> buffer = ArrayBuffer::New(env->isolate(), store);
+ args.GetReturnValue().Set(Uint8Array::New(buffer, 0, len));
+ }
++#endif // defined(V8_ENABLE_SANDBOX)
+
+ void SecureHeapUsed(const FunctionCallbackInfo<Value>& args) {
++#ifndef OPENSSL_IS_BORINGSSL
+ Environment* env = Environment::GetCurrent(args);
+ if (CRYPTO_secure_malloc_initialized())
+ args.GetReturnValue().Set(
+ BigInt::New(env->isolate(), CRYPTO_secure_used()));
++#endif
+ }
+ } // namespace
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.h b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.h
new file mode 100644
index 0000000000..70dd4b6ac9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_crypto_crypto__util.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/crypto/crypto_util.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/crypto/crypto_util.h
+@@ -285,7 +285,7 @@ class ByteSource {
+ // Creates a v8::BackingStore that takes over responsibility for
+ // any allocated data. The ByteSource will be reset with size = 0
+ // after being called.
+- std::unique_ptr<v8::BackingStore> ReleaseToBackingStore();
++ std::unique_ptr<v8::BackingStore> ReleaseToBackingStore(Environment* env);
+
+ v8::Local<v8::ArrayBuffer> ToArrayBuffer(Environment* env);
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_env-inl.h b/electron34/patches/patch-third__party_electron__node_src_env-inl.h
new file mode 100644
index 0000000000..5e51f95f87
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_env-inl.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/env-inl.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/env-inl.h
+@@ -62,31 +62,6 @@ inline uv_loop_t* IsolateData::event_loo
+ return event_loop_;
+ }
+
+-inline void IsolateData::SetCppgcReference(v8::Isolate* isolate,
+- v8::Local<v8::Object> object,
+- void* wrappable) {
+- v8::CppHeap* heap = isolate->GetCppHeap();
+- CHECK_NOT_NULL(heap);
+- v8::WrapperDescriptor descriptor = heap->wrapper_descriptor();
+- uint16_t required_size = std::max(descriptor.wrappable_instance_index,
+- descriptor.wrappable_type_index);
+- CHECK_GT(object->InternalFieldCount(), required_size);
+-
+- uint16_t* id_ptr = nullptr;
+- {
+- Mutex::ScopedLock lock(isolate_data_mutex_);
+- auto it =
+- wrapper_data_map_.find(descriptor.embedder_id_for_garbage_collected);
+- CHECK_NE(it, wrapper_data_map_.end());
+- id_ptr = &(it->second->cppgc_id);
+- }
+-
+- object->SetAlignedPointerInInternalField(descriptor.wrappable_type_index,
+- id_ptr);
+- object->SetAlignedPointerInInternalField(descriptor.wrappable_instance_index,
+- wrappable);
+-}
+-
+ inline uint16_t* IsolateData::embedder_id_for_cppgc() const {
+ return &(wrapper_data_->cppgc_id);
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_src_env.cc b/electron34/patches/patch-third__party_electron__node_src_env.cc
new file mode 100644
index 0000000000..55f9e390da
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_env.cc
@@ -0,0 +1,98 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/env.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/env.cc
+@@ -22,6 +22,7 @@
+ #include "util-inl.h"
+ #include "v8-cppgc.h"
+ #include "v8-profiler.h"
++#include "v8-sandbox.h" // v8::Object::Wrap(), v8::Object::Unwrap()
+
+ #include <algorithm>
+ #include <atomic>
+@@ -68,7 +69,6 @@ using v8::TryCatch;
+ using v8::Uint32;
+ using v8::Undefined;
+ using v8::Value;
+-using v8::WrapperDescriptor;
+ using worker::Worker;
+
+ int const ContextEmbedderTag::kNodeContextTag = 0x6e6f64;
+@@ -530,6 +530,14 @@ void IsolateData::CreateProperties() {
+ CreateEnvProxyTemplate(this);
+ }
+
++// Previously, the general convention of the wrappable layout for cppgc in
++// the ecosystem is:
++// [ 0 ] -> embedder id
++// [ 1 ] -> wrappable instance
++// Now V8 has deprecated this layout-based tracing enablement, embedders
++// should simply use v8::Object::Wrap() and v8::Object::Unwrap(). We preserve
++// this layout only to distinguish internally how the memory of a Node.js
++// wrapper is managed or whether a wrapper is managed by Node.js.
+ constexpr uint16_t kDefaultCppGCEmbedderID = 0x90de;
+ Mutex IsolateData::isolate_data_mutex_;
+ std::unordered_map<uint16_t, std::unique_ptr<PerIsolateWrapperData>>
+@@ -567,36 +575,16 @@ IsolateData::IsolateData(Isolate* isolat
+ v8::CppHeap* cpp_heap = isolate->GetCppHeap();
+
+ uint16_t cppgc_id = kDefaultCppGCEmbedderID;
+- if (cpp_heap != nullptr) {
+- // The general convention of the wrappable layout for cppgc in the
+- // ecosystem is:
+- // [ 0 ] -> embedder id
+- // [ 1 ] -> wrappable instance
+- // If the Isolate includes a CppHeap attached by another embedder,
+- // And if they also use the field 0 for the ID, we DCHECK that
+- // the layout matches our layout, and record the embedder ID for cppgc
+- // to avoid accidentally enabling cppgc on non-cppgc-managed wrappers .
+- v8::WrapperDescriptor descriptor = cpp_heap->wrapper_descriptor();
+- if (descriptor.wrappable_type_index == BaseObject::kEmbedderType) {
+- cppgc_id = descriptor.embedder_id_for_garbage_collected;
+- DCHECK_EQ(descriptor.wrappable_instance_index, BaseObject::kSlot);
+- }
+- // If the CppHeap uses the slot we use to put non-cppgc-traced BaseObject
+- // for embedder ID, V8 could accidentally enable cppgc on them. So
+- // safe guard against this.
+- DCHECK_NE(descriptor.wrappable_type_index, BaseObject::kSlot);
+- } else {
+- cpp_heap_ = CppHeap::Create(
+- platform,
+- CppHeapCreateParams{
+- {},
+- WrapperDescriptor(
+- BaseObject::kEmbedderType, BaseObject::kSlot, cppgc_id)});
+- isolate->AttachCppHeap(cpp_heap_.get());
+- }
+ // We do not care about overflow since we just want this to be different
+ // from the cppgc id.
+ uint16_t non_cppgc_id = cppgc_id + 1;
++ if (cpp_heap == nullptr) {
++ cpp_heap_ = CppHeap::Create(platform, v8::CppHeapCreateParams{{}});
++ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
++ // own it when we can keep the isolate registered/task runner discoverable
++ // during isolate disposal.
++ isolate->AttachCppHeap(cpp_heap_.get());
++ }
+
+ {
+ // GC could still be run after the IsolateData is destroyed, so we store
+@@ -628,11 +616,12 @@ IsolateData::~IsolateData() {
+ }
+ }
+
+-// Public API
++// Deprecated API, embedders should use v8::Object::Wrap() directly instead.
+ void SetCppgcReference(Isolate* isolate,
+ Local<Object> object,
+ void* wrappable) {
+- IsolateData::SetCppgcReference(isolate, object, wrappable);
++ v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(
++ isolate, object, wrappable);
+ }
+
+ void IsolateData::MemoryInfo(MemoryTracker* tracker) const {
diff --git a/electron34/patches/patch-third__party_electron__node_src_env.h b/electron34/patches/patch-third__party_electron__node_src_env.h
new file mode 100644
index 0000000000..7ed26fb6fd
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_env.h
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/env.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/env.h
+@@ -49,7 +49,7 @@
+ #include "uv.h"
+ #include "v8.h"
+
+-#if HAVE_OPENSSL
++#if HAVE_OPENSSL && OPENSSL_VERSION_MAJOR >= 3
+ #include <openssl/evp.h>
+ #endif
+
+@@ -174,10 +174,6 @@ class NODE_EXTERN_PRIVATE IsolateData :
+ uint16_t* embedder_id_for_cppgc() const;
+ uint16_t* embedder_id_for_non_cppgc() const;
+
+- static inline void SetCppgcReference(v8::Isolate* isolate,
+- v8::Local<v8::Object> object,
+- void* wrappable);
+-
+ inline uv_loop_t* event_loop() const;
+ inline MultiIsolatePlatform* platform() const;
+ inline const SnapshotData* snapshot_data() const;
+@@ -1051,7 +1047,7 @@ class Environment : public MemoryRetaine
+ kExitInfoFieldCount
+ };
+
+-#if HAVE_OPENSSL
++#if HAVE_OPENSSL// && !defined(OPENSSL_IS_BORINGSSL)
+ #if OPENSSL_VERSION_MAJOR >= 3
+ // We declare another alias here to avoid having to include crypto_util.h
+ using EVPMDPointer = DeleteFnPtr<EVP_MD, EVP_MD_free>;
diff --git a/electron34/patches/patch-third__party_electron__node_src_handle__wrap.cc b/electron34/patches/patch-third__party_electron__node_src_handle__wrap.cc
new file mode 100644
index 0000000000..5cf0ea0391
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_handle__wrap.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/handle_wrap.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/handle_wrap.cc
+@@ -148,6 +148,9 @@ void HandleWrap::OnClose(uv_handle_t* ha
+ wrap->OnClose();
+ wrap->handle_wrap_queue_.Remove();
+
++ if (env->isolate()->IsExecutionTerminating())
++ return;
++
+ if (!wrap->persistent().IsEmpty() &&
+ wrap->object()->Has(env->context(), env->handle_onclose_symbol())
+ .FromMaybe(false)) {
diff --git a/electron34/patches/patch-third__party_electron__node_src_histogram.cc b/electron34/patches/patch-third__party_electron__node_src_histogram.cc
new file mode 100644
index 0000000000..756e908705
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_histogram.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/histogram.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/histogram.cc
+@@ -193,7 +193,8 @@ void HistogramBase::FastRecord(Local<Val
+ const int64_t value,
+ FastApiCallbackOptions& options) {
+ if (value < 1) {
+- options.fallback = true;
++ Environment* env = Environment::GetCurrent(options.isolate);
++ THROW_ERR_OUT_OF_RANGE(env, "value is out of range");
+ return;
+ }
+ HistogramBase* histogram;
diff --git a/electron34/patches/patch-third__party_electron__node_src_inspector_BUILD.gn b/electron34/patches/patch-third__party_electron__node_src_inspector_BUILD.gn
new file mode 100644
index 0000000000..a6ddd13094
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_inspector_BUILD.gn
@@ -0,0 +1,228 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/inspector/BUILD.gn.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/inspector/BUILD.gn
+@@ -1,14 +1,208 @@
+-##############################################################################
+-# #
+-# DO NOT EDIT THIS FILE! #
+-# #
+-##############################################################################
+-
+-# This file is used by GN for building, which is NOT the build system used for
+-# building official binaries.
+-# Please modify the gyp files if you are making changes to build system.
++import("//v8/gni/v8.gni")
+
+-import("unofficial.gni")
++inspector_protocol_dir = "../../tools/inspector_protocol"
+
+-inspector_gn_build("inspector") {
++_protocol_generated = [
++ "protocol/Forward.h",
++ "protocol/Protocol.cpp",
++ "protocol/Protocol.h",
++ "protocol/NodeWorker.cpp",
++ "protocol/NodeWorker.h",
++ "protocol/NodeTracing.cpp",
++ "protocol/NodeTracing.h",
++ "protocol/NodeRuntime.cpp",
++ "protocol/NodeRuntime.h",
++ "protocol/Network.cpp",
++ "protocol/Network.h",
++]
++
++# These are from node_protocol_config.json
++# These convoluted path hacks are to work around the fact that node.js is very
++# confused about what paths are in its includes, without changing node at all.
++# Hopefully, keying everything in this file off the paths that are in
++# node_protocol_config.json will mean that the paths stay in sync.
++inspector_protocol_package = "src/node/inspector/protocol"
++inspector_protocol_output = "node/inspector/protocol"
++
++config("inspector_config") {
++ include_dirs = [
++ "$target_gen_dir",
++ "$target_gen_dir/src",
++ ]
++
++ configs = [ "../..:node_features" ]
++}
++
++source_set("inspector") {
++ sources = [
++ "main_thread_interface.cc",
++ "main_thread_interface.h",
++ "node_string.cc",
++ "node_string.h",
++ "runtime_agent.cc",
++ "runtime_agent.h",
++ "tracing_agent.cc",
++ "tracing_agent.h",
++ "worker_agent.cc",
++ "worker_agent.h",
++ "network_inspector.cc",
++ "network_inspector.h",
++ "network_agent.cc",
++ "network_agent.h",
++ "worker_inspector.cc",
++ "worker_inspector.h",
++ ]
++ sources += rebase_path(_protocol_generated,
++ ".",
++ "$target_gen_dir/$inspector_protocol_package/..")
++ include_dirs = [
++ "//v8/include",
++ "..",
++ ]
++ deps = [
++ ":protocol_generated_sources",
++ ":v8_inspector_compress_protocol_json",
++ "../../deps/uv",
++ "../../deps/simdutf",
++ "//third_party/icu:icuuc",
++ ]
++ configs += [
++ "../..:node_internal_config",
++ "../..:node_lib_config",
++ ]
++ public_configs = [ ":inspector_config" ]
++}
++
++# This based on the template from //v8/../inspector_protocol.gni
++action("protocol_generated_sources") {
++ # This is to ensure that the output directory exists--the code generator
++ # doesn't create it.
++ write_file("$target_gen_dir/$inspector_protocol_package/.dummy", "")
++ script = "$inspector_protocol_dir/code_generator.py"
++
++ inputs = [
++ "$target_gen_dir/node_protocol_config.json",
++ "$target_gen_dir/src/node_protocol.json",
++ "$inspector_protocol_dir/lib/base_string_adapter_cc.template",
++ "$inspector_protocol_dir/lib/base_string_adapter_h.template",
++ "$inspector_protocol_dir/lib/Allocator_h.template",
++ "$inspector_protocol_dir/lib/DispatcherBase_cpp.template",
++ "$inspector_protocol_dir/lib/DispatcherBase_h.template",
++ "$inspector_protocol_dir/lib/ErrorSupport_cpp.template",
++ "$inspector_protocol_dir/lib/ErrorSupport_h.template",
++ "$inspector_protocol_dir/lib/Forward_h.template",
++ "$inspector_protocol_dir/lib/FrontendChannel_h.template",
++ "$inspector_protocol_dir/lib/Maybe_h.template",
++ "$inspector_protocol_dir/lib/Object_cpp.template",
++ "$inspector_protocol_dir/lib/Object_h.template",
++ "$inspector_protocol_dir/lib/Parser_cpp.template",
++ "$inspector_protocol_dir/lib/Parser_h.template",
++ "$inspector_protocol_dir/lib/Protocol_cpp.template",
++ "$inspector_protocol_dir/lib/ValueConversions_h.template",
++ "$inspector_protocol_dir/lib/Values_cpp.template",
++ "$inspector_protocol_dir/lib/Values_h.template",
++ "$inspector_protocol_dir/templates/Exported_h.template",
++ "$inspector_protocol_dir/templates/Imported_h.template",
++ "$inspector_protocol_dir/templates/TypeBuilder_cpp.template",
++ "$inspector_protocol_dir/templates/TypeBuilder_h.template",
++ ]
++
++ deps = [
++ ":node_protocol_config",
++ ":node_protocol_json",
++ ]
++
++ args = [
++ "--jinja_dir",
++ rebase_path("//third_party/", root_build_dir), # jinja is in chromium's third_party
++ "--output_base",
++ rebase_path("$target_gen_dir/src", root_build_dir),
++ "--config",
++ rebase_path("$target_gen_dir/node_protocol_config.json", root_build_dir),
++ ]
++
++ outputs =
++ get_path_info(rebase_path(rebase_path(_protocol_generated,
++ ".",
++ "$inspector_protocol_output/.."),
++ ".",
++ "$target_gen_dir/src"),
++ "abspath")
++}
++
++template("generate_protocol_json") {
++ copy_target_name = target_name + "_copy"
++ copy(copy_target_name) {
++ sources = invoker.sources
++ outputs = [
++ "$target_gen_dir/{{source_file_part}}",
++ ]
++ }
++ copied_pdl = get_target_outputs(":$copy_target_name")
++ action(target_name) {
++ deps = [
++ ":$copy_target_name",
++ ]
++ sources = copied_pdl
++ outputs = invoker.outputs
++ script = "$inspector_protocol_dir/convert_protocol_to_json.py"
++ args = rebase_path(sources + outputs, root_build_dir)
++ }
++}
++
++copy("node_protocol_config") {
++ sources = [
++ "node_protocol_config.json",
++ ]
++ outputs = [
++ "$target_gen_dir/{{source_file_part}}",
++ ]
++}
++
++generate_protocol_json("node_protocol_json") {
++ sources = [
++ "node_protocol.pdl",
++ ]
++ outputs = [
++ "$target_gen_dir/src/node_protocol.json",
++ ]
++}
++
++generate_protocol_json("v8_protocol_json") {
++ sources = [
++ "//v8/include/js_protocol.pdl",
++ ]
++ outputs = [
++ "$target_gen_dir/js_protocol.json",
++ ]
++}
++
++action("concatenate_protocols") {
++ deps = [
++ ":node_protocol_json",
++ ":v8_protocol_json",
++ ]
++ inputs = [
++ "$target_gen_dir/js_protocol.json",
++ "$target_gen_dir/src/node_protocol.json",
++ ]
++ outputs = [
++ "$target_gen_dir/concatenated_protocol.json",
++ ]
++ script = "//v8/third_party/inspector_protocol/concatenate_protocols.py"
++ args = rebase_path(inputs + outputs, root_build_dir)
++}
++
++action("v8_inspector_compress_protocol_json") {
++ deps = [
++ ":concatenate_protocols",
++ ]
++ inputs = [
++ "$target_gen_dir/concatenated_protocol.json",
++ ]
++ outputs = [
++ "$target_gen_dir/v8_inspector_protocol_json.h",
++ ]
++ script = "../../tools/compress_json.py"
++ args = rebase_path(inputs + outputs, root_build_dir)
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_src_module__wrap.cc b/electron34/patches/patch-third__party_electron__node_src_module__wrap.cc
new file mode 100644
index 0000000000..b0bc26aeb9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_module__wrap.cc
@@ -0,0 +1,105 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/module_wrap.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/module_wrap.cc
+@@ -197,7 +197,8 @@ void ModuleWrap::New(const FunctionCallb
+ export_names[i] = export_name_val.As<String>();
+ }
+
+- module = Module::CreateSyntheticModule(isolate, url, export_names,
++ module = Module::CreateSyntheticModule(isolate, url,
++ v8::MemorySpan<const Local<String>>(export_names.begin(), export_names.end()),
+ SyntheticModuleEvaluationStepsCallback);
+ } else {
+ // When we are compiling for the default loader, this will be
+@@ -303,8 +304,7 @@ MaybeLocal<Module> ModuleWrap::CompileSo
+ bool* cache_rejected) {
+ Isolate* isolate = realm->isolate();
+ EscapableHandleScope scope(isolate);
+- ScriptOrigin origin(isolate,
+- url,
++ ScriptOrigin origin(url,
+ line_offset,
+ column_offset,
+ true, // is cross origin
+@@ -499,7 +499,6 @@ void ModuleWrap::Evaluate(const Function
+
+ ShouldNotAbortOnUncaughtScope no_abort_scope(realm->env());
+ TryCatchScope try_catch(realm->env());
+- Isolate::SafeForTerminationScope safe_for_termination(isolate);
+
+ bool timed_out = false;
+ bool received_signal = false;
+@@ -636,11 +635,10 @@ void ModuleWrap::EvaluateSync(const Func
+
+ if (module->IsGraphAsync()) {
+ CHECK(env->options()->print_required_tla);
+- auto stalled = module->GetStalledTopLevelAwaitMessage(isolate);
+- if (stalled.size() != 0) {
+- for (auto pair : stalled) {
+- Local<v8::Message> message = std::get<1>(pair);
+-
++ auto stalled_messages =
++ std::get<1>(module->GetStalledTopLevelAwaitMessages(isolate));
++ if (stalled_messages.size() != 0) {
++ for (auto& message : stalled_messages) {
+ std::string reason = "Error: unexpected top-level await at ";
+ std::string info =
+ FormatErrorMessage(isolate, context, "", message, true);
+@@ -770,7 +768,7 @@ MaybeLocal<Module> ModuleWrap::ResolveMo
+ return module->module_.Get(isolate);
+ }
+
+-static MaybeLocal<Promise> ImportModuleDynamically(
++MaybeLocal<Promise> ImportModuleDynamically(
+ Local<Context> context,
+ Local<v8::Data> host_defined_options,
+ Local<Value> resource_name,
+@@ -835,12 +833,13 @@ void ModuleWrap::SetImportModuleDynamica
+ Realm* realm = Realm::GetCurrent(args);
+ HandleScope handle_scope(isolate);
+
+- CHECK_EQ(args.Length(), 1);
++ CHECK_EQ(args.Length(), 2);
+ CHECK(args[0]->IsFunction());
+ Local<Function> import_callback = args[0].As<Function>();
+ realm->set_host_import_module_dynamically_callback(import_callback);
+
+- isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
++ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate))
++ isolate->SetHostImportModuleDynamicallyCallback(ImportModuleDynamically);
+ }
+
+ void ModuleWrap::HostInitializeImportMetaObjectCallback(
+@@ -882,13 +881,14 @@ void ModuleWrap::SetInitializeImportMeta
+ Realm* realm = Realm::GetCurrent(args);
+ Isolate* isolate = realm->isolate();
+
+- CHECK_EQ(args.Length(), 1);
++ CHECK_EQ(args.Length(), 2);
+ CHECK(args[0]->IsFunction());
+ Local<Function> import_meta_callback = args[0].As<Function>();
+ realm->set_host_initialize_import_meta_object_callback(import_meta_callback);
+
+- isolate->SetHostInitializeImportMetaObjectCallback(
+- HostInitializeImportMetaObjectCallback);
++ if (args[1]->IsBoolean() && args[1]->BooleanValue(isolate))
++ isolate->SetHostInitializeImportMetaObjectCallback(
++ HostInitializeImportMetaObjectCallback);
+ }
+
+ MaybeLocal<Value> ModuleWrap::SyntheticModuleEvaluationStepsCallback(
+@@ -1006,8 +1006,7 @@ void ModuleWrap::CreateRequiredModuleFac
+ ASSIGN_OR_RETURN_UNWRAP(&original, wrap);
+
+ // Use the same facade source and URL to hit the compilation cache.
+- ScriptOrigin origin(isolate,
+- env->required_module_facade_url_string(),
++ ScriptOrigin origin(env->required_module_facade_url_string(),
+ 0, // line offset
+ 0, // column offset
+ true, // is cross origin
diff --git a/electron34/patches/patch-third__party_electron__node_src_module__wrap.h b/electron34/patches/patch-third__party_electron__node_src_module__wrap.h
new file mode 100644
index 0000000000..41cfb3b1da
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_module__wrap.h
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/module_wrap.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/module_wrap.h
+@@ -8,6 +8,7 @@
+ #include <unordered_map>
+ #include <vector>
+ #include "base_object.h"
++#include "node.h"
+ #include "v8-script.h"
+
+ namespace node {
+@@ -33,7 +34,14 @@ enum HostDefinedOptions : int {
+ kLength = 9,
+ };
+
+-class ModuleWrap : public BaseObject {
++NODE_EXTERN v8::MaybeLocal<v8::Promise> ImportModuleDynamically(
++ v8::Local<v8::Context> context,
++ v8::Local<v8::Data> host_defined_options,
++ v8::Local<v8::Value> resource_name,
++ v8::Local<v8::String> specifier,
++ v8::Local<v8::FixedArray> import_assertions);
++
++class NODE_EXTERN ModuleWrap : public BaseObject {
+ public:
+ enum InternalFields {
+ kModuleSlot = BaseObject::kInternalFieldCount,
+@@ -90,6 +98,8 @@ class ModuleWrap : public BaseObject {
+ static void CreateRequiredModuleFacade(
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+
++ static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
++
+ private:
+ ModuleWrap(Realm* realm,
+ v8::Local<v8::Object> object,
+@@ -128,7 +138,6 @@ class ModuleWrap : public BaseObject {
+ v8::Local<v8::String> specifier,
+ v8::Local<v8::FixedArray> import_attributes,
+ v8::Local<v8::Module> referrer);
+- static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
+
+ v8::Global<v8::Module> module_;
+ std::unordered_map<std::string, v8::Global<v8::Object>> resolve_cache_;
diff --git a/electron34/patches/patch-third__party_electron__node_src_node.cc b/electron34/patches/patch-third__party_electron__node_src_node.cc
new file mode 100644
index 0000000000..037ab276f5
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node.cc
+@@ -790,12 +790,6 @@ static ExitCode ProcessGlobalArgsInterna
+ return ExitCode::kInvalidCommandLineArgument2;
+ }
+
+- // TODO(aduh95): remove this when the harmony-import-assertions flag
+- // is removed in V8.
+- if (std::find(v8_args.begin(), v8_args.end(),
+- "--no-harmony-import-assertions") == v8_args.end()) {
+- v8_args.emplace_back("--harmony-import-assertions");
+- }
+ // TODO(aduh95): remove this when the harmony-import-attributes flag
+ // is removed in V8.
+ if (std::find(v8_args.begin(),
diff --git a/electron34/patches/patch-third__party_electron__node_src_node.h b/electron34/patches/patch-third__party_electron__node_src_node.h
new file mode 100644
index 0000000000..232ac2f34a
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node.h
@@ -0,0 +1,54 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node.h
+@@ -22,6 +22,12 @@
+ #ifndef SRC_NODE_H_
+ #define SRC_NODE_H_
+
++#ifdef ELECTRON_ENSURE_CONFIG_GYPI
++#ifndef USING_ELECTRON_CONFIG_GYPI
++#error "It looks like you are building this native module without using the right config.gypi. This normally means that you need to update electron-rebuild (>=3.2.8) or node-gyp (>=9.0.0) if you're building modules directly."
++#endif
++#endif
++
+ #ifdef _WIN32
+ # ifndef BUILDING_NODE_EXTENSION
+ # define NODE_EXTERN __declspec(dllexport)
+@@ -1546,24 +1552,14 @@ void RegisterSignalHandler(int signal,
+ bool reset_handler = false);
+ #endif // _WIN32
+
+-// Configure the layout of the JavaScript object with a cppgc::GarbageCollected
+-// instance so that when the JavaScript object is reachable, the garbage
+-// collected instance would have its Trace() method invoked per the cppgc
+-// contract. To make it work, the process must have called
+-// cppgc::InitializeProcess() before, which is usually the case for addons
+-// loaded by the stand-alone Node.js executable. Embedders of Node.js can use
+-// either need to call it themselves or make sure that
+-// ProcessInitializationFlags::kNoInitializeCppgc is *not* set for cppgc to
+-// work.
+-// If the CppHeap is owned by Node.js, which is usually the case for addon,
+-// the object must be created with at least two internal fields available,
+-// and the first two internal fields would be configured by Node.js.
+-// This may be superseded by a V8 API in the future, see
+-// https://bugs.chromium.org/p/v8/issues/detail?id=13960. Until then this
+-// serves as a helper for Node.js isolates.
+-NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
+- v8::Local<v8::Object> object,
+- void* wrappable);
++// This is kept as a compatibility layer for addons to wrap cppgc-managed
++// objects on Node.js versions without v8::Object::Wrap(). Addons created to
++// work with only Node.js versions with v8::Object::Wrap() should use that
++// instead.
++NODE_DEPRECATED("Use v8::Object::Wrap()",
++ NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
++ v8::Local<v8::Object> object,
++ void* wrappable));
+
+ } // namespace node
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__binding.cc b/electron34/patches/patch-third__party_electron__node_src_node__binding.cc
new file mode 100644
index 0000000000..f48b0386ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__binding.cc
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_binding.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_binding.cc
+@@ -4,6 +4,7 @@
+ #include "node_builtins.h"
+ #include "node_errors.h"
+ #include "node_external_reference.h"
++#include "node_process.h"
+ #include "util.h"
+
+ #include <string>
+@@ -483,7 +484,12 @@ void DLOpen(const FunctionCallbackInfo<V
+ if (mp->nm_context_register_func == nullptr) {
+ if (env->force_context_aware()) {
+ dlib->Close();
+- THROW_ERR_NON_CONTEXT_AWARE_DISABLED(env);
++ char errmsg[1024];
++ snprintf(errmsg,
++ sizeof(errmsg),
++ "Loading non-context-aware native module in renderer: '%s'. See https://github.com/electron/electron/issues/18397.",
++ *filename);
++ env->ThrowError(errmsg);
+ return false;
+ }
+ }
+@@ -641,6 +647,10 @@ void GetInternalBinding(const FunctionCa
+ args.GetReturnValue().Set(exports);
+ }
+
++node_module* get_linked_module(const char* name) {
++ return FindModule(modlist_linked, name, NM_F_LINKED);
++}
++
+ void GetLinkedBinding(const FunctionCallbackInfo<Value>& args) {
+ Environment* env = Environment::GetCurrent(args);
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__binding.h b/electron34/patches/patch-third__party_electron__node_src_node__binding.h
new file mode 100644
index 0000000000..41cd113280
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__binding.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_binding.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_binding.h
+@@ -137,6 +137,8 @@ void GetInternalBinding(const v8::Functi
+ void GetLinkedBinding(const v8::FunctionCallbackInfo<v8::Value>& args);
+ void DLOpen(const v8::FunctionCallbackInfo<v8::Value>& args);
+
++NODE_EXTERN node_module* get_linked_module(const char *name);
++
+ } // namespace binding
+
+ } // namespace node
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__buffer.h b/electron34/patches/patch-third__party_electron__node_src_node__buffer.h
new file mode 100644
index 0000000000..0dc1f24ea7
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__buffer.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_buffer.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_buffer.h
+@@ -29,7 +29,7 @@ namespace node {
+
+ namespace Buffer {
+
+-static const size_t kMaxLength = v8::TypedArray::kMaxLength;
++static const size_t kMaxLength = v8::TypedArray::kMaxByteLength;
+
+ typedef void (*FreeCallback)(char* data, void* hint);
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__builtins.cc b/electron34/patches/patch-third__party_electron__node_src_node__builtins.cc
new file mode 100644
index 0000000000..80023064a8
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__builtins.cc
@@ -0,0 +1,73 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_builtins.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_builtins.cc
+@@ -11,7 +11,6 @@ namespace node {
+ namespace builtins {
+
+ using v8::Context;
+-using v8::DEFAULT;
+ using v8::EscapableHandleScope;
+ using v8::Function;
+ using v8::FunctionCallbackInfo;
+@@ -35,6 +34,7 @@ using v8::Value;
+ BuiltinLoader::BuiltinLoader()
+ : config_(GetConfig()), code_cache_(std::make_shared<BuiltinCodeCache>()) {
+ LoadJavaScriptSource();
++ LoadEmbedderJavaScriptSource();
+ #ifdef NODE_SHARED_BUILTIN_CJS_MODULE_LEXER_LEXER_PATH
+ AddExternalizedBuiltin(
+ "internal/deps/cjs-module-lexer/lexer",
+@@ -266,7 +266,7 @@ MaybeLocal<Function> BuiltinLoader::Look
+ std::string filename_s = std::string("node:") + id;
+ Local<String> filename =
+ OneByteString(isolate, filename_s.c_str(), filename_s.size());
+- ScriptOrigin origin(isolate, filename, 0, 0, true);
++ ScriptOrigin origin(filename, 0, 0, true);
+
+ BuiltinCodeCacheData cached_data{};
+ {
+@@ -719,7 +719,6 @@ void BuiltinLoader::CreatePerIsolateProp
+ nullptr,
+ Local<Value>(),
+ None,
+- DEFAULT,
+ SideEffectType::kHasNoSideEffect);
+
+ target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "builtinIds"),
+@@ -727,7 +726,6 @@ void BuiltinLoader::CreatePerIsolateProp
+ nullptr,
+ Local<Value>(),
+ None,
+- DEFAULT,
+ SideEffectType::kHasNoSideEffect);
+
+ target->SetNativeDataProperty(
+@@ -736,7 +734,6 @@ void BuiltinLoader::CreatePerIsolateProp
+ nullptr,
+ Local<Value>(),
+ None,
+- DEFAULT,
+ SideEffectType::kHasNoSideEffect);
+
+ target->SetNativeDataProperty(FIXED_ONE_BYTE_STRING(isolate, "natives"),
+@@ -744,7 +741,6 @@ void BuiltinLoader::CreatePerIsolateProp
+ nullptr,
+ Local<Value>(),
+ None,
+- DEFAULT,
+ SideEffectType::kHasNoSideEffect);
+
+ SetMethod(isolate, target, "getCacheUsage", BuiltinLoader::GetCacheUsage);
+@@ -773,6 +769,7 @@ void BuiltinLoader::RegisterExternalRefe
+ registry->Register(GetNatives);
+
+ RegisterExternalReferencesForInternalizedBuiltinCode(registry);
++ EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(registry);
+ }
+
+ } // namespace builtins
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__builtins.h b/electron34/patches/patch-third__party_electron__node_src_node__builtins.h
new file mode 100644
index 0000000000..7a36f336c5
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__builtins.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_builtins.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_builtins.h
+@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
+ // Generated by tools/js2c.cc as node_javascript.cc
+ void RegisterExternalReferencesForInternalizedBuiltinCode(
+ ExternalReferenceRegistry* registry);
++void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
++ ExternalReferenceRegistry* registry);
+
+ // Handles compilation and caching of built-in JavaScript modules and
+ // bootstrap scripts, whose source are bundled into the binary as static data.
+@@ -136,6 +138,7 @@ class NODE_EXTERN_PRIVATE BuiltinLoader
+
+ // Generated by tools/js2c.cc as node_javascript.cc
+ void LoadJavaScriptSource(); // Loads data into source_
++ void LoadEmbedderJavaScriptSource(); // Loads embedder data into source_
+ UnionBytes GetConfig(); // Return data for config.gypi
+
+ struct BuiltinCategories {
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__constants.cc b/electron34/patches/patch-third__party_electron__node_src_node__constants.cc
new file mode 100644
index 0000000000..a3a55faa15
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__constants.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_constants.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_constants.cc
+@@ -241,10 +241,6 @@ void DefineErrnoConstants(Local<Object>
+ NODE_DEFINE_CONSTANT(target, ENOBUFS);
+ #endif
+
+-#ifdef ENODATA
+- NODE_DEFINE_CONSTANT(target, ENODATA);
+-#endif
+-
+ #ifdef ENODEV
+ NODE_DEFINE_CONSTANT(target, ENODEV);
+ #endif
+@@ -281,14 +277,6 @@ void DefineErrnoConstants(Local<Object>
+ NODE_DEFINE_CONSTANT(target, ENOSPC);
+ #endif
+
+-#ifdef ENOSR
+- NODE_DEFINE_CONSTANT(target, ENOSR);
+-#endif
+-
+-#ifdef ENOSTR
+- NODE_DEFINE_CONSTANT(target, ENOSTR);
+-#endif
+-
+ #ifdef ENOSYS
+ NODE_DEFINE_CONSTANT(target, ENOSYS);
+ #endif
+@@ -369,10 +357,6 @@ void DefineErrnoConstants(Local<Object>
+ NODE_DEFINE_CONSTANT(target, ESTALE);
+ #endif
+
+-#ifdef ETIME
+- NODE_DEFINE_CONSTANT(target, ETIME);
+-#endif
+-
+ #ifdef ETIMEDOUT
+ NODE_DEFINE_CONSTANT(target, ETIMEDOUT);
+ #endif
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__contextify.cc b/electron34/patches/patch-third__party_electron__node_src_node__contextify.cc
new file mode 100644
index 0000000000..3be9f43d18
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__contextify.cc
@@ -0,0 +1,380 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_contextify.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_contextify.cc
+@@ -51,6 +51,7 @@ using v8::FunctionTemplate;
+ using v8::HandleScope;
+ using v8::IndexedPropertyHandlerConfiguration;
+ using v8::Int32;
++using v8::Intercepted;
+ using v8::Isolate;
+ using v8::Just;
+ using v8::Local;
+@@ -485,16 +486,20 @@ bool ContextifyContext::IsStillInitializ
+ }
+
+ // static
+-void ContextifyContext::PropertyGetterCallback(
+- Local<Name> property,
+- const PropertyCallbackInfo<Value>& args) {
++Intercepted ContextifyContext::PropertyGetterCallback(
++ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
++ Environment* env = Environment::GetCurrent(args);
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Local<Context> context = ctx->context();
+ Local<Object> sandbox = ctx->sandbox();
++
++ TryCatchScope try_catch(env);
+ MaybeLocal<Value> maybe_rv =
+ sandbox->GetRealNamedProperty(context, property);
+ if (maybe_rv.IsEmpty()) {
+@@ -504,22 +509,31 @@ void ContextifyContext::PropertyGetterCa
+
+ Local<Value> rv;
+ if (maybe_rv.ToLocal(&rv)) {
++ if (try_catch.HasCaught() &&
++ !try_catch.HasTerminated()) {
++ try_catch.ReThrow();
++ }
++
+ if (rv == sandbox)
+ rv = ctx->global_proxy();
+
+ args.GetReturnValue().Set(rv);
++ return Intercepted::kYes;
+ }
++ return Intercepted::kNo;
+ }
+
+ // static
+-void ContextifyContext::PropertySetterCallback(
++Intercepted ContextifyContext::PropertySetterCallback(
+ Local<Name> property,
+ Local<Value> value,
+- const PropertyCallbackInfo<Value>& args) {
++ const PropertyCallbackInfo<void>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Local<Context> context = ctx->context();
+ PropertyAttribute attributes = PropertyAttribute::None;
+@@ -537,8 +551,9 @@ void ContextifyContext::PropertySetterCa
+ (static_cast<int>(attributes) &
+ static_cast<int>(PropertyAttribute::ReadOnly));
+
+- if (read_only)
+- return;
++ if (read_only) {
++ return Intercepted::kNo;
++ }
+
+ // true for x = 5
+ // false for this.x = 5
+@@ -557,11 +572,16 @@ void ContextifyContext::PropertySetterCa
+
+ bool is_declared = is_declared_on_global_proxy || is_declared_on_sandbox;
+ if (!is_declared && args.ShouldThrowOnError() && is_contextual_store &&
+- !is_function)
+- return;
++ !is_function) {
++ return Intercepted::kNo;
++ }
+
+- if (!is_declared && property->IsSymbol()) return;
+- if (ctx->sandbox()->Set(context, property, value).IsNothing()) return;
++ if (!is_declared && property->IsSymbol()) {
++ return Intercepted::kNo;
++ }
++ if (ctx->sandbox()->Set(context, property, value).IsNothing()) {
++ return Intercepted::kNo;
++ }
+
+ Local<Value> desc;
+ if (is_declared_on_sandbox &&
+@@ -575,19 +595,23 @@ void ContextifyContext::PropertySetterCa
+ // We have to specify the return value for any contextual or get/set
+ // property
+ if (desc_obj->HasOwnProperty(context, env->get_string()).FromMaybe(false) ||
+- desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false))
++ desc_obj->HasOwnProperty(context, env->set_string()).FromMaybe(false)) {
+ args.GetReturnValue().Set(value);
++ return Intercepted::kYes;
++ }
+ }
++ return Intercepted::kNo;
+ }
+
+ // static
+-void ContextifyContext::PropertyDescriptorCallback(
+- Local<Name> property,
+- const PropertyCallbackInfo<Value>& args) {
++Intercepted ContextifyContext::PropertyDescriptorCallback(
++ Local<Name> property, const PropertyCallbackInfo<Value>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Local<Context> context = ctx->context();
+
+@@ -597,19 +621,23 @@ void ContextifyContext::PropertyDescript
+ Local<Value> desc;
+ if (sandbox->GetOwnPropertyDescriptor(context, property).ToLocal(&desc)) {
+ args.GetReturnValue().Set(desc);
++ return Intercepted::kYes;
+ }
+ }
++ return Intercepted::kNo;
+ }
+
+ // static
+-void ContextifyContext::PropertyDefinerCallback(
++Intercepted ContextifyContext::PropertyDefinerCallback(
+ Local<Name> property,
+ const PropertyDescriptor& desc,
+- const PropertyCallbackInfo<Value>& args) {
++ const PropertyCallbackInfo<void>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Local<Context> context = ctx->context();
+ Isolate* isolate = context->GetIsolate();
+@@ -628,7 +656,7 @@ void ContextifyContext::PropertyDefinerC
+ // If the property is set on the global as neither writable nor
+ // configurable, don't change it on the global or sandbox.
+ if (is_declared && read_only && dont_delete) {
+- return;
++ return Intercepted::kNo;
+ }
+
+ Local<Object> sandbox = ctx->sandbox();
+@@ -651,6 +679,9 @@ void ContextifyContext::PropertyDefinerC
+ desc.has_set() ? desc.set() : Undefined(isolate).As<Value>());
+
+ define_prop_on_sandbox(&desc_for_sandbox);
++ // TODO(https://github.com/nodejs/node/issues/52634): this should return
++ // kYes to behave according to the expected semantics.
++ return Intercepted::kNo;
+ } else {
+ Local<Value> value =
+ desc.has_value() ? desc.value() : Undefined(isolate).As<Value>();
+@@ -662,26 +693,32 @@ void ContextifyContext::PropertyDefinerC
+ PropertyDescriptor desc_for_sandbox(value);
+ define_prop_on_sandbox(&desc_for_sandbox);
+ }
++ // TODO(https://github.com/nodejs/node/issues/52634): this should return
++ // kYes to behave according to the expected semantics.
++ return Intercepted::kNo;
+ }
+ }
+
+ // static
+-void ContextifyContext::PropertyDeleterCallback(
+- Local<Name> property,
+- const PropertyCallbackInfo<Boolean>& args) {
++Intercepted ContextifyContext::PropertyDeleterCallback(
++ Local<Name> property, const PropertyCallbackInfo<Boolean>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), property);
+
+- if (success.FromMaybe(false))
+- return;
++ if (success.FromMaybe(false)) {
++ return Intercepted::kNo;
++ }
+
+ // Delete failed on the sandbox, intercept and do not delete on
+ // the global object.
+ args.GetReturnValue().Set(false);
++ return Intercepted::kYes;
+ }
+
+ // static
+@@ -701,76 +738,84 @@ void ContextifyContext::PropertyEnumerat
+ }
+
+ // static
+-void ContextifyContext::IndexedPropertyGetterCallback(
+- uint32_t index,
+- const PropertyCallbackInfo<Value>& args) {
++Intercepted ContextifyContext::IndexedPropertyGetterCallback(
++ uint32_t index, const PropertyCallbackInfo<Value>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+- ContextifyContext::PropertyGetterCallback(
++ return ContextifyContext::PropertyGetterCallback(
+ Uint32ToName(ctx->context(), index), args);
+ }
+
+-
+-void ContextifyContext::IndexedPropertySetterCallback(
++Intercepted ContextifyContext::IndexedPropertySetterCallback(
+ uint32_t index,
+ Local<Value> value,
+- const PropertyCallbackInfo<Value>& args) {
++ const PropertyCallbackInfo<void>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+- ContextifyContext::PropertySetterCallback(
++ return ContextifyContext::PropertySetterCallback(
+ Uint32ToName(ctx->context(), index), value, args);
+ }
+
+ // static
+-void ContextifyContext::IndexedPropertyDescriptorCallback(
+- uint32_t index,
+- const PropertyCallbackInfo<Value>& args) {
++Intercepted ContextifyContext::IndexedPropertyDescriptorCallback(
++ uint32_t index, const PropertyCallbackInfo<Value>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+- ContextifyContext::PropertyDescriptorCallback(
++ return ContextifyContext::PropertyDescriptorCallback(
+ Uint32ToName(ctx->context(), index), args);
+ }
+
+
+-void ContextifyContext::IndexedPropertyDefinerCallback(
++Intercepted ContextifyContext::IndexedPropertyDefinerCallback(
+ uint32_t index,
+ const PropertyDescriptor& desc,
+- const PropertyCallbackInfo<Value>& args) {
++ const PropertyCallbackInfo<void>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+- ContextifyContext::PropertyDefinerCallback(
++ return ContextifyContext::PropertyDefinerCallback(
+ Uint32ToName(ctx->context(), index), desc, args);
+ }
+
+ // static
+-void ContextifyContext::IndexedPropertyDeleterCallback(
+- uint32_t index,
+- const PropertyCallbackInfo<Boolean>& args) {
++Intercepted ContextifyContext::IndexedPropertyDeleterCallback(
++ uint32_t index, const PropertyCallbackInfo<Boolean>& args) {
+ ContextifyContext* ctx = ContextifyContext::Get(args);
+
+ // Still initializing
+- if (IsStillInitializing(ctx)) return;
++ if (IsStillInitializing(ctx)) {
++ return Intercepted::kNo;
++ }
+
+ Maybe<bool> success = ctx->sandbox()->Delete(ctx->context(), index);
+
+- if (success.FromMaybe(false))
+- return;
++ if (success.FromMaybe(false)) {
++ return Intercepted::kNo;
++ }
+
+ // Delete failed on the sandbox, intercept and do not delete on
+ // the global object.
+ args.GetReturnValue().Set(false);
++ return Intercepted::kYes;
+ }
+
+ void ContextifyScript::CreatePerIsolateProperties(
+@@ -870,8 +915,7 @@ void ContextifyScript::New(const Functio
+ host_defined_options->Set(
+ isolate, loader::HostDefinedOptions::kID, id_symbol);
+
+- ScriptOrigin origin(isolate,
+- filename,
++ ScriptOrigin origin(filename,
+ line_offset, // line offset
+ column_offset, // column offset
+ true, // is cross origin
+@@ -991,7 +1035,7 @@ MaybeLocal<Function> CompileFunction(Loc
+ Local<String> filename,
+ Local<String> content,
+ std::vector<Local<String>>* parameters) {
+- ScriptOrigin script_origin(context->GetIsolate(), filename, 0, 0, true);
++ ScriptOrigin script_origin(filename, 0, 0, true);
+ ScriptCompiler::Source script_source(content, script_origin);
+
+ return ScriptCompiler::CompileFunction(context,
+@@ -1101,7 +1145,6 @@ bool ContextifyScript::EvalMachine(Local
+ }
+
+ TryCatchScope try_catch(env);
+- Isolate::SafeForTerminationScope safe_for_termination(env->isolate());
+ ContextifyScript* wrapped_script;
+ ASSIGN_OR_RETURN_UNWRAP(&wrapped_script, args.This(), false);
+ Local<UnboundScript> unbound_script =
+@@ -1270,8 +1313,7 @@ void ContextifyContext::CompileFunction(
+ Local<PrimitiveArray> host_defined_options =
+ loader::ModuleWrap::GetHostDefinedOptions(isolate, id_symbol);
+
+- ScriptOrigin origin(isolate,
+- filename,
++ ScriptOrigin origin(filename,
+ line_offset, // line offset
+ column_offset, // column offset
+ true, // is cross origin
+@@ -1458,8 +1500,7 @@ static MaybeLocal<Function> CompileFunct
+ Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
+ Local<PrimitiveArray> hdo =
+ loader::ModuleWrap::GetHostDefinedOptions(isolate, symbol);
+- ScriptOrigin origin(isolate,
+- filename,
++ ScriptOrigin origin(filename,
+ 0, // line offset
+ 0, // column offset
+ true, // is cross origin
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__contextify.h b/electron34/patches/patch-third__party_electron__node_src_node__contextify.h
new file mode 100644
index 0000000000..946791fc2c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__contextify.h
@@ -0,0 +1,68 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_contextify.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_contextify.h
+@@ -100,42 +100,39 @@ class ContextifyContext : public BaseObj
+ const errors::TryCatchScope& try_catch);
+ static void WeakCallback(
+ const v8::WeakCallbackInfo<ContextifyContext>& data);
+- static void PropertyGetterCallback(
++ static v8::Intercepted PropertyGetterCallback(
+ v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void PropertySetterCallback(
++ static v8::Intercepted PropertySetterCallback(
+ v8::Local<v8::Name> property,
+ v8::Local<v8::Value> value,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void PropertyDescriptorCallback(
++ const v8::PropertyCallbackInfo<void>& args);
++ static v8::Intercepted PropertyDescriptorCallback(
+ v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void PropertyDefinerCallback(
++ static v8::Intercepted PropertyDefinerCallback(
+ v8::Local<v8::Name> property,
+ const v8::PropertyDescriptor& desc,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void PropertyDeleterCallback(
++ const v8::PropertyCallbackInfo<void>& args);
++ static v8::Intercepted PropertyDeleterCallback(
+ v8::Local<v8::Name> property,
+ const v8::PropertyCallbackInfo<v8::Boolean>& args);
+ static void PropertyEnumeratorCallback(
+ const v8::PropertyCallbackInfo<v8::Array>& args);
+- static void IndexedPropertyGetterCallback(
+- uint32_t index,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void IndexedPropertySetterCallback(
++ static v8::Intercepted IndexedPropertyGetterCallback(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
++ static v8::Intercepted IndexedPropertySetterCallback(
+ uint32_t index,
+ v8::Local<v8::Value> value,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void IndexedPropertyDescriptorCallback(
+- uint32_t index,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void IndexedPropertyDefinerCallback(
++ const v8::PropertyCallbackInfo<void>& args);
++ static v8::Intercepted IndexedPropertyDescriptorCallback(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& args);
++ static v8::Intercepted IndexedPropertyDefinerCallback(
+ uint32_t index,
+ const v8::PropertyDescriptor& desc,
+- const v8::PropertyCallbackInfo<v8::Value>& args);
+- static void IndexedPropertyDeleterCallback(
+- uint32_t index,
+- const v8::PropertyCallbackInfo<v8::Boolean>& args);
++ const v8::PropertyCallbackInfo<void>& args);
++ static v8::Intercepted IndexedPropertyDeleterCallback(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& args);
+
+ v8::Global<v8::Context> context_;
+ std::unique_ptr<v8::MicrotaskQueue> microtask_queue_;
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__env__var.cc b/electron34/patches/patch-third__party_electron__node_src_node__env__var.cc
new file mode 100644
index 0000000000..b560f439c4
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__env__var.cc
@@ -0,0 +1,153 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_env_var.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_env_var.cc
+@@ -16,6 +16,7 @@ using v8::DontEnum;
+ using v8::FunctionTemplate;
+ using v8::HandleScope;
+ using v8::Integer;
++using v8::Intercepted;
+ using v8::Isolate;
+ using v8::Just;
+ using v8::Local;
+@@ -336,24 +337,27 @@ Maybe<bool> KVStore::AssignToObject(v8::
+ return Just(true);
+ }
+
+-static void EnvGetter(Local<Name> property,
+- const PropertyCallbackInfo<Value>& info) {
++static Intercepted EnvGetter(Local<Name> property,
++ const PropertyCallbackInfo<Value>& info) {
+ Environment* env = Environment::GetCurrent(info);
+ CHECK(env->has_run_bootstrapping_code());
+ if (property->IsSymbol()) {
+- return info.GetReturnValue().SetUndefined();
++ info.GetReturnValue().SetUndefined();
++ return Intercepted::kYes;
+ }
+ CHECK(property->IsString());
+ MaybeLocal<String> value_string =
+ env->env_vars()->Get(env->isolate(), property.As<String>());
+ if (!value_string.IsEmpty()) {
+ info.GetReturnValue().Set(value_string.ToLocalChecked());
++ return Intercepted::kYes;
+ }
++ return Intercepted::kNo;
+ }
+
+-static void EnvSetter(Local<Name> property,
+- Local<Value> value,
+- const PropertyCallbackInfo<Value>& info) {
++static Intercepted EnvSetter(Local<Name> property,
++ Local<Value> value,
++ const PropertyCallbackInfo<void>& info) {
+ Environment* env = Environment::GetCurrent(info);
+ CHECK(env->has_run_bootstrapping_code());
+ // calling env->EmitProcessEnvWarning() sets a variable indicating that
+@@ -369,35 +373,40 @@ static void EnvSetter(Local<Name> proper
+ "the "
+ "value to a string before setting process.env with it.",
+ "DEP0104")
+- .IsNothing())
+- return;
++ .IsNothing()) {
++ return Intercepted::kNo;
++ }
+ }
+
+ Local<String> key;
+ Local<String> value_string;
+ if (!property->ToString(env->context()).ToLocal(&key) ||
+ !value->ToString(env->context()).ToLocal(&value_string)) {
+- return;
++ return Intercepted::kNo;
+ }
+
+ env->env_vars()->Set(env->isolate(), key, value_string);
+
+- // Whether it worked or not, always return value.
+- info.GetReturnValue().Set(value);
++ return Intercepted::kYes;
+ }
+
+-static void EnvQuery(Local<Name> property,
+- const PropertyCallbackInfo<Integer>& info) {
++static Intercepted EnvQuery(Local<Name> property,
++ const PropertyCallbackInfo<Integer>& info) {
+ Environment* env = Environment::GetCurrent(info);
+ CHECK(env->has_run_bootstrapping_code());
+ if (property->IsString()) {
+ int32_t rc = env->env_vars()->Query(env->isolate(), property.As<String>());
+- if (rc != -1) info.GetReturnValue().Set(rc);
++ if (rc != -1) {
++ // Return attributes for the property.
++ info.GetReturnValue().Set(v8::None);
++ return Intercepted::kYes;
++ }
+ }
++ return Intercepted::kNo;
+ }
+
+-static void EnvDeleter(Local<Name> property,
+- const PropertyCallbackInfo<Boolean>& info) {
++static Intercepted EnvDeleter(Local<Name> property,
++ const PropertyCallbackInfo<Boolean>& info) {
+ Environment* env = Environment::GetCurrent(info);
+ CHECK(env->has_run_bootstrapping_code());
+ if (property->IsString()) {
+@@ -407,6 +416,7 @@ static void EnvDeleter(Local<Name> prope
+ // process.env never has non-configurable properties, so always
+ // return true like the tc39 delete operator.
+ info.GetReturnValue().Set(true);
++ return Intercepted::kYes;
+ }
+
+ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
+@@ -417,9 +427,9 @@ static void EnvEnumerator(const Property
+ env->env_vars()->Enumerate(env->isolate()));
+ }
+
+-static void EnvDefiner(Local<Name> property,
+- const PropertyDescriptor& desc,
+- const PropertyCallbackInfo<Value>& info) {
++static Intercepted EnvDefiner(Local<Name> property,
++ const PropertyDescriptor& desc,
++ const PropertyCallbackInfo<void>& info) {
+ Environment* env = Environment::GetCurrent(info);
+ if (desc.has_value()) {
+ if (!desc.has_writable() ||
+@@ -430,6 +440,7 @@ static void EnvDefiner(Local<Name> prope
+ "configurable, writable,"
+ " and enumerable "
+ "data descriptor");
++ return Intercepted::kYes;
+ } else if (!desc.configurable() ||
+ !desc.enumerable() ||
+ !desc.writable()) {
+@@ -438,6 +449,7 @@ static void EnvDefiner(Local<Name> prope
+ "configurable, writable,"
+ " and enumerable "
+ "data descriptor");
++ return Intercepted::kYes;
+ } else {
+ return EnvSetter(property, desc.value(), info);
+ }
+@@ -447,12 +459,14 @@ static void EnvDefiner(Local<Name> prope
+ "'process.env' does not accept an"
+ " accessor(getter/setter)"
+ " descriptor");
++ return Intercepted::kYes;
+ } else {
+ THROW_ERR_INVALID_OBJECT_DEFINE_PROPERTY(env,
+ "'process.env' only accepts a "
+ "configurable, writable,"
+ " and enumerable "
+ "data descriptor");
++ return Intercepted::kYes;
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__errors.cc b/electron34/patches/patch-third__party_electron__node_src_node__errors.cc
new file mode 100644
index 0000000000..dcb5e701c0
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__errors.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_errors.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_errors.cc
+@@ -860,10 +860,6 @@ const char* errno_string(int errorno) {
+ ERRNO_CASE(ENOBUFS);
+ #endif
+
+-#ifdef ENODATA
+- ERRNO_CASE(ENODATA);
+-#endif
+-
+ #ifdef ENODEV
+ ERRNO_CASE(ENODEV);
+ #endif
+@@ -902,14 +898,6 @@ const char* errno_string(int errorno) {
+ ERRNO_CASE(ENOSPC);
+ #endif
+
+-#ifdef ENOSR
+- ERRNO_CASE(ENOSR);
+-#endif
+-
+-#ifdef ENOSTR
+- ERRNO_CASE(ENOSTR);
+-#endif
+-
+ #ifdef ENOSYS
+ ERRNO_CASE(ENOSYS);
+ #endif
+@@ -992,10 +980,6 @@ const char* errno_string(int errorno) {
+ ERRNO_CASE(ESTALE);
+ #endif
+
+-#ifdef ETIME
+- ERRNO_CASE(ETIME);
+-#endif
+-
+ #ifdef ETIMEDOUT
+ ERRNO_CASE(ETIMEDOUT);
+ #endif
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__errors.h b/electron34/patches/patch-third__party_electron__node_src_node__errors.h
new file mode 100644
index 0000000000..a33e17da9f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__errors.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_errors.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_errors.h
+@@ -235,7 +235,7 @@ inline v8::Local<v8::Object> ERR_BUFFER_
+ char message[128];
+ snprintf(message, sizeof(message),
+ "Cannot create a Buffer larger than 0x%zx bytes",
+- v8::TypedArray::kMaxLength);
++ v8::TypedArray::kMaxByteLength);
+ return ERR_BUFFER_TOO_LARGE(isolate, message);
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__external__reference.h b/electron34/patches/patch-third__party_electron__node_src_node__external__reference.h
new file mode 100644
index 0000000000..1eba27dfc8
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__external__reference.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_external_reference.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_external_reference.h
+@@ -64,20 +64,19 @@ class ExternalReferenceRegistry {
+ V(CFunctionWithBool) \
+ V(const v8::CFunctionInfo*) \
+ V(v8::FunctionCallback) \
+- V(v8::AccessorGetterCallback) \
+- V(v8::AccessorSetterCallback) \
+ V(v8::AccessorNameGetterCallback) \
+ V(v8::AccessorNameSetterCallback) \
+- V(v8::GenericNamedPropertyDefinerCallback) \
+- V(v8::GenericNamedPropertyDeleterCallback) \
+- V(v8::GenericNamedPropertyEnumeratorCallback) \
+- V(v8::GenericNamedPropertyQueryCallback) \
+- V(v8::GenericNamedPropertySetterCallback) \
+- V(v8::IndexedPropertySetterCallback) \
+- V(v8::IndexedPropertyDefinerCallback) \
+- V(v8::IndexedPropertyDeleterCallback) \
+- V(v8::IndexedPropertyQueryCallback) \
+- V(v8::IndexedPropertyDescriptorCallback) \
++ V(v8::NamedPropertyGetterCallback) \
++ V(v8::NamedPropertyDefinerCallback) \
++ V(v8::NamedPropertyDeleterCallback) \
++ V(v8::NamedPropertyEnumeratorCallback) \
++ V(v8::NamedPropertyQueryCallback) \
++ V(v8::NamedPropertySetterCallback) \
++ V(v8::IndexedPropertyGetterCallbackV2) \
++ V(v8::IndexedPropertySetterCallbackV2) \
++ V(v8::IndexedPropertyDefinerCallbackV2) \
++ V(v8::IndexedPropertyDeleterCallbackV2) \
++ V(v8::IndexedPropertyQueryCallbackV2) \
+ V(const v8::String::ExternalStringResourceBase*)
+
+ #define V(ExternalReferenceType) \
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__file.cc b/electron34/patches/patch-third__party_electron__node_src_node__file.cc
new file mode 100644
index 0000000000..3cf6ff38a9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__file.cc
@@ -0,0 +1,195 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_file.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_file.cc
+@@ -19,14 +19,11 @@
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
+ #include "node_file.h" // NOLINT(build/include_inline)
+-#include "ada.h"
+ #include "aliased_buffer-inl.h"
+ #include "memory_tracker-inl.h"
+ #include "node_buffer.h"
+-#include "node_errors.h"
+ #include "node_external_reference.h"
+ #include "node_file-inl.h"
+-#include "node_metadata.h"
+ #include "node_process-inl.h"
+ #include "node_stat_watcher.h"
+ #include "node_url.h"
+@@ -3127,135 +3124,6 @@ constexpr std::array<std::string_view, 1
+
+ } // namespace
+
+-void BindingData::LegacyMainResolve(const FunctionCallbackInfo<Value>& args) {
+- CHECK_GE(args.Length(), 1);
+- CHECK(args[0]->IsString());
+-
+- Environment* env = Environment::GetCurrent(args);
+- auto isolate = env->isolate();
+-
+- Utf8Value utf8_package_json_url(isolate, args[0]);
+- auto package_json_url =
+- ada::parse<ada::url_aggregator>(utf8_package_json_url.ToStringView());
+-
+- if (!package_json_url) {
+- THROW_ERR_INVALID_URL(isolate, "Invalid URL");
+- return;
+- }
+-
+- std::string package_initial_file = "";
+-
+- ada::result<ada::url_aggregator> file_path_url;
+- std::optional<std::string> initial_file_path;
+- std::string file_path;
+-
+- if (args.Length() >= 2 && args[1]->IsString()) {
+- auto package_config_main = Utf8Value(isolate, args[1]).ToString();
+-
+- file_path_url = ada::parse<ada::url_aggregator>(
+- std::string("./") + package_config_main, &package_json_url.value());
+-
+- if (!file_path_url) {
+- THROW_ERR_INVALID_URL(isolate, "Invalid URL");
+- return;
+- }
+-
+- initial_file_path = node::url::FileURLToPath(env, *file_path_url);
+- if (!initial_file_path.has_value()) {
+- return;
+- }
+-
+- node::url::FromNamespacedPath(&initial_file_path.value());
+-
+- package_initial_file = *initial_file_path;
+-
+- for (int i = 0; i < legacy_main_extensions_with_main_end; i++) {
+- file_path = *initial_file_path + std::string(legacy_main_extensions[i]);
+-
+- switch (FilePathIsFile(env, file_path)) {
+- case BindingData::FilePathIsFileReturnType::kIsFile:
+- return args.GetReturnValue().Set(i);
+- case BindingData::FilePathIsFileReturnType::kIsNotFile:
+- continue;
+- case BindingData::FilePathIsFileReturnType::
+- kThrowInsufficientPermissions:
+- // the default behavior when do not have permission is to return
+- // and exit the execution of the method as soon as possible
+- // the internal function will throw the exception
+- return;
+- default:
+- UNREACHABLE();
+- }
+- }
+- }
+-
+- file_path_url =
+- ada::parse<ada::url_aggregator>("./index", &package_json_url.value());
+-
+- if (!file_path_url) {
+- THROW_ERR_INVALID_URL(isolate, "Invalid URL");
+- return;
+- }
+-
+- initial_file_path = node::url::FileURLToPath(env, *file_path_url);
+- if (!initial_file_path.has_value()) {
+- return;
+- }
+-
+- node::url::FromNamespacedPath(&initial_file_path.value());
+-
+- for (int i = legacy_main_extensions_with_main_end;
+- i < legacy_main_extensions_package_fallback_end;
+- i++) {
+- file_path = *initial_file_path + std::string(legacy_main_extensions[i]);
+-
+- switch (FilePathIsFile(env, file_path)) {
+- case BindingData::FilePathIsFileReturnType::kIsFile:
+- return args.GetReturnValue().Set(i);
+- case BindingData::FilePathIsFileReturnType::kIsNotFile:
+- continue;
+- case BindingData::FilePathIsFileReturnType::kThrowInsufficientPermissions:
+- // the default behavior when do not have permission is to return
+- // and exit the execution of the method as soon as possible
+- // the internal function will throw the exception
+- return;
+- default:
+- UNREACHABLE();
+- }
+- }
+-
+- if (package_initial_file == "")
+- package_initial_file = *initial_file_path + ".js";
+-
+- std::optional<std::string> module_base;
+-
+- if (args.Length() >= 3 && args[2]->IsString()) {
+- Utf8Value utf8_base_path(isolate, args[2]);
+- auto base_url =
+- ada::parse<ada::url_aggregator>(utf8_base_path.ToStringView());
+-
+- if (!base_url) {
+- THROW_ERR_INVALID_URL(isolate, "Invalid URL");
+- return;
+- }
+-
+- module_base = node::url::FileURLToPath(env, *base_url);
+- if (!module_base.has_value()) {
+- return;
+- }
+- } else {
+- THROW_ERR_INVALID_ARG_TYPE(
+- isolate,
+- "The \"base\" argument must be of type string or an instance of URL.");
+- return;
+- }
+-
+- THROW_ERR_MODULE_NOT_FOUND(isolate,
+- "Cannot find package '%s' imported from %s",
+- package_initial_file,
+- *module_base);
+-}
+-
+ void BindingData::MemoryInfo(MemoryTracker* tracker) const {
+ tracker->TrackField("stats_field_array", stats_field_array);
+ tracker->TrackField("stats_field_bigint_array", stats_field_bigint_array);
+@@ -3355,19 +3223,6 @@ InternalFieldInfoBase* BindingData::Seri
+ return info;
+ }
+
+-void BindingData::CreatePerIsolateProperties(IsolateData* isolate_data,
+- Local<ObjectTemplate> target) {
+- Isolate* isolate = isolate_data->isolate();
+-
+- SetMethod(
+- isolate, target, "legacyMainResolve", BindingData::LegacyMainResolve);
+-}
+-
+-void BindingData::RegisterExternalReferences(
+- ExternalReferenceRegistry* registry) {
+- registry->Register(BindingData::LegacyMainResolve);
+-}
+-
+ static void CreatePerIsolateProperties(IsolateData* isolate_data,
+ Local<ObjectTemplate> target) {
+ Isolate* isolate = isolate_data->isolate();
+@@ -3422,7 +3277,6 @@ static void CreatePerIsolateProperties(I
+ SetMethod(isolate, target, "mkdtemp", Mkdtemp);
+
+ StatWatcher::CreatePerIsolateProperties(isolate_data, target);
+- BindingData::CreatePerIsolateProperties(isolate_data, target);
+
+ target->Set(
+ FIXED_ONE_BYTE_STRING(isolate, "kFsStatsFieldsNumber"),
+@@ -3495,7 +3349,6 @@ BindingData* FSReqBase::binding_data() {
+ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
+ registry->Register(Access);
+ StatWatcher::RegisterExternalReferences(registry);
+- BindingData::RegisterExternalReferences(registry);
+
+ registry->Register(GetFormatOfExtensionlessFile);
+ registry->Register(Close);
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__file.h b/electron34/patches/patch-third__party_electron__node_src_node__file.h
new file mode 100644
index 0000000000..8e7cf9adcb
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__file.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_file.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_file.h
+@@ -86,13 +86,6 @@ class BindingData : public SnapshotableO
+ SERIALIZABLE_OBJECT_METHODS()
+ SET_BINDING_ID(fs_binding_data)
+
+- static void LegacyMainResolve(
+- const v8::FunctionCallbackInfo<v8::Value>& args);
+-
+- static void CreatePerIsolateProperties(IsolateData* isolate_data,
+- v8::Local<v8::ObjectTemplate> ctor);
+- static void RegisterExternalReferences(ExternalReferenceRegistry* registry);
+-
+ void MemoryInfo(MemoryTracker* tracker) const override;
+ SET_SELF_SIZE(BindingData)
+ SET_MEMORY_INFO_NAME(BindingData)
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__i18n.cc b/electron34/patches/patch-third__party_electron__node_src_node__i18n.cc
new file mode 100644
index 0000000000..207c9517fa
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__i18n.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_i18n.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_i18n.cc
+@@ -103,7 +103,7 @@ namespace {
+
+ template <typename T>
+ MaybeLocal<Object> ToBufferEndian(Environment* env, MaybeStackBuffer<T>* buf) {
+- MaybeLocal<Object> ret = Buffer::New(env, buf);
++ MaybeLocal<Object> ret = Buffer::Copy(env, reinterpret_cast<char*>(buf->out()), buf->length() * sizeof(T));
+ if (ret.IsEmpty())
+ return ret;
+
+@@ -180,7 +180,7 @@ MaybeLocal<Object> TranscodeLatin1ToUcs2
+ return {};
+ }
+
+- return Buffer::New(env, &destbuf);
++ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(UChar));
+ }
+
+ MaybeLocal<Object> TranscodeFromUcs2(Environment* env,
+@@ -225,7 +225,7 @@ MaybeLocal<Object> TranscodeUcs2FromUtf8
+ return {};
+ }
+
+- return Buffer::New(env, &destbuf);
++ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(UChar));
+ }
+
+ MaybeLocal<Object> TranscodeUtf8FromUcs2(Environment* env,
+@@ -249,7 +249,7 @@ MaybeLocal<Object> TranscodeUtf8FromUcs2
+ return {};
+ }
+
+- return Buffer::New(env, &destbuf);
++ return Buffer::Copy(env, reinterpret_cast<char*>(destbuf.out()), destbuf.length() * sizeof(char));
+ }
+
+ constexpr const char* EncodingName(const enum encoding encoding) {
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__internals.h b/electron34/patches/patch-third__party_electron__node_src_node__internals.h
new file mode 100644
index 0000000000..d0d2712486
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__internals.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_internals.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_internals.h
+@@ -117,7 +117,9 @@ v8::Maybe<bool> InitializePrimordials(v8
+
+ class NodeArrayBufferAllocator : public ArrayBufferAllocator {
+ public:
+- inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
++ NodeArrayBufferAllocator();
++ ~NodeArrayBufferAllocator() override;
++ inline uint32_t* zero_fill_field() { return zero_fill_field_; }
+
+ void* Allocate(size_t size) override; // Defined in src/node.cc
+ void* AllocateUninitialized(size_t size) override;
+@@ -135,7 +137,7 @@ class NodeArrayBufferAllocator : public
+ }
+
+ private:
+- uint32_t zero_fill_field_ = 1; // Boolean but exposed as uint32 to JS land.
++ uint32_t* zero_fill_field_ = nullptr; // Boolean but exposed as uint32 to JS land.
+ std::atomic<size_t> total_mem_usage_ {0};
+
+ // Delegate to V8's allocator for compatibility with the V8 memory cage.
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__messaging.cc b/electron34/patches/patch-third__party_electron__node_src_node__messaging.cc
new file mode 100644
index 0000000000..2aab3e170e
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__messaging.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_messaging.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_messaging.cc
+@@ -907,7 +907,7 @@ Maybe<bool> MessagePort::PostMessage(Env
+ const TransferList& transfer_v) {
+ Isolate* isolate = env->isolate();
+ Local<Object> obj = object(isolate);
+-
++ TryCatchScope try_catch(env);
+ std::shared_ptr<Message> msg = std::make_shared<Message>();
+
+ // Per spec, we need to both check if transfer list has the source port, and
+@@ -915,6 +915,10 @@ Maybe<bool> MessagePort::PostMessage(Env
+
+ Maybe<bool> serialization_maybe =
+ msg->Serialize(env, context, message_v, transfer_v, obj);
++ if (try_catch.HasCaught() &&
++ !try_catch.HasTerminated()) {
++ try_catch.ReThrow();
++ }
+ if (data_ == nullptr) {
+ return serialization_maybe;
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__metadata.h b/electron34/patches/patch-third__party_electron__node_src_node__metadata.h
new file mode 100644
index 0000000000..a986e10290
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__metadata.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_metadata.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_metadata.h
+@@ -6,7 +6,7 @@
+ #include <string>
+ #include "node_version.h"
+
+-#if HAVE_OPENSSL
++#if 0
+ #include <openssl/crypto.h>
+ #if NODE_OPENSSL_HAS_QUIC
+ #include <openssl/quic.h>
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__options.cc b/electron34/patches/patch-third__party_electron__node_src_node__options.cc
new file mode 100644
index 0000000000..207fcefba9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__options.cc
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_options.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_options.cc
+@@ -6,7 +6,7 @@
+ #include "node_external_reference.h"
+ #include "node_internals.h"
+ #include "node_sea.h"
+-#if HAVE_OPENSSL
++#if HAVE_OPENSSL && !defined(OPENSSL_IS_BORINGSSL)
+ #include "openssl/opensslv.h"
+ #endif
+
+@@ -893,11 +893,6 @@ PerIsolateOptionsParser::PerIsolateOptio
+ "disallow eval and friends",
+ V8Option{},
+ kAllowedInEnvvar);
+- AddOption("--huge-max-old-generation-size",
+- "increase default maximum heap size on machines with 16GB memory "
+- "or more",
+- V8Option{},
+- kAllowedInEnvvar);
+ AddOption("--jitless",
+ "disable runtime allocation of executable memory",
+ V8Option{},
+@@ -1432,14 +1427,16 @@ void GetEmbedderOptions(const FunctionCa
+ }
+ Isolate* isolate = args.GetIsolate();
+
+- constexpr size_t kOptionsSize = 4;
++ constexpr size_t kOptionsSize = 5;
+ std::array<Local<Name>, kOptionsSize> names = {
++ FIXED_ONE_BYTE_STRING(env->isolate(), "hasPrepareStackTraceCallback"),
+ FIXED_ONE_BYTE_STRING(env->isolate(), "shouldNotRegisterESMLoader"),
+ FIXED_ONE_BYTE_STRING(env->isolate(), "noGlobalSearchPaths"),
+ FIXED_ONE_BYTE_STRING(env->isolate(), "noBrowserGlobals"),
+ FIXED_ONE_BYTE_STRING(env->isolate(), "hasEmbedderPreload")};
+
+ std::array<Local<Value>, kOptionsSize> values = {
++ Boolean::New(isolate, env->prepare_stack_trace_callback().IsEmpty()),
+ Boolean::New(isolate, env->should_not_register_esm_loader()),
+ Boolean::New(isolate, env->no_global_search_paths()),
+ Boolean::New(isolate, env->no_browser_globals()),
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__options.h b/electron34/patches/patch-third__party_electron__node_src_node__options.h
new file mode 100644
index 0000000000..b5799b5af2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__options.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_options.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_options.h
+@@ -11,7 +11,7 @@
+ #include "node_mutex.h"
+ #include "util.h"
+
+-#if HAVE_OPENSSL
++#if 0
+ #include "openssl/opensslv.h"
+ #endif
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__platform.cc b/electron34/patches/patch-third__party_electron__node_src_node__platform.cc
new file mode 100644
index 0000000000..9318877db7
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__platform.cc
@@ -0,0 +1,107 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_platform.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_platform.cc
+@@ -245,11 +245,13 @@ void PerIsolatePlatformData::FlushTasks(
+ platform_data->FlushForegroundTasksInternal();
+ }
+
+-void PerIsolatePlatformData::PostIdleTask(std::unique_ptr<v8::IdleTask> task) {
++void PerIsolatePlatformData::PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task,
++ const v8::SourceLocation& location) {
+ UNREACHABLE();
+ }
+
+-void PerIsolatePlatformData::PostTask(std::unique_ptr<Task> task) {
++void PerIsolatePlatformData::PostTaskImpl(std::unique_ptr<Task> task,
++ const v8::SourceLocation& location) {
+ if (flush_tasks_ == nullptr) {
+ // V8 may post tasks during Isolate disposal. In that case, the only
+ // sensible path forward is to discard the task.
+@@ -259,8 +261,10 @@ void PerIsolatePlatformData::PostTask(st
+ uv_async_send(flush_tasks_);
+ }
+
+-void PerIsolatePlatformData::PostDelayedTask(
+- std::unique_ptr<Task> task, double delay_in_seconds) {
++void PerIsolatePlatformData::PostDelayedTaskImpl(
++ std::unique_ptr<Task> task,
++ double delay_in_seconds,
++ const v8::SourceLocation& location) {
+ if (flush_tasks_ == nullptr) {
+ // V8 may post tasks during Isolate disposal. In that case, the only
+ // sensible path forward is to discard the task.
+@@ -274,13 +278,15 @@ void PerIsolatePlatformData::PostDelayed
+ uv_async_send(flush_tasks_);
+ }
+
+-void PerIsolatePlatformData::PostNonNestableTask(std::unique_ptr<Task> task) {
++void PerIsolatePlatformData::PostNonNestableTaskImpl(std::unique_ptr<Task> task,
++ const v8::SourceLocation& location) {
+ PostTask(std::move(task));
+ }
+
+-void PerIsolatePlatformData::PostNonNestableDelayedTask(
++void PerIsolatePlatformData::PostNonNestableDelayedTaskImpl(
+ std::unique_ptr<Task> task,
+- double delay_in_seconds) {
++ double delay_in_seconds,
++ const v8::SourceLocation& location) {
+ PostDelayedTask(std::move(task), delay_in_seconds);
+ }
+
+@@ -501,17 +507,22 @@ bool PerIsolatePlatformData::FlushForegr
+ return did_work;
+ }
+
+-void NodePlatform::CallOnWorkerThread(std::unique_ptr<Task> task) {
++void NodePlatform::PostTaskOnWorkerThreadImpl(
++ v8::TaskPriority priority,
++ std::unique_ptr<v8::Task> task,
++ const v8::SourceLocation& location) {
+ worker_thread_task_runner_->PostTask(std::move(task));
+ }
+
+-void NodePlatform::CallDelayedOnWorkerThread(std::unique_ptr<Task> task,
+- double delay_in_seconds) {
++void NodePlatform::PostDelayedTaskOnWorkerThreadImpl(
++ v8::TaskPriority priority,
++ std::unique_ptr<v8::Task> task,
++ double delay_in_seconds,
++ const v8::SourceLocation& location) {
+ worker_thread_task_runner_->PostDelayedTask(std::move(task),
+ delay_in_seconds);
+ }
+
+-
+ IsolatePlatformDelegate* NodePlatform::ForIsolate(Isolate* isolate) {
+ Mutex::ScopedLock lock(per_isolate_mutex_);
+ auto data = per_isolate_[isolate];
+@@ -533,8 +544,10 @@ bool NodePlatform::FlushForegroundTasks(
+ return per_isolate->FlushForegroundTasksInternal();
+ }
+
+-std::unique_ptr<v8::JobHandle> NodePlatform::CreateJob(
+- v8::TaskPriority priority, std::unique_ptr<v8::JobTask> job_task) {
++std::unique_ptr<v8::JobHandle> NodePlatform::CreateJobImpl(
++ v8::TaskPriority priority,
++ std::unique_ptr<v8::JobTask> job_task,
++ const v8::SourceLocation& location) {
+ return v8::platform::NewDefaultJobHandle(
+ this, priority, std::move(job_task), NumberOfWorkerThreads());
+ }
+@@ -543,8 +556,8 @@ bool NodePlatform::IdleTasksEnabled(Isol
+ return ForIsolate(isolate)->IdleTasksEnabled();
+ }
+
+-std::shared_ptr<v8::TaskRunner>
+-NodePlatform::GetForegroundTaskRunner(Isolate* isolate) {
++std::shared_ptr<v8::TaskRunner> NodePlatform::GetForegroundTaskRunner(
++ Isolate* isolate, v8::TaskPriority priority) {
+ return ForIsolate(isolate)->GetForegroundTaskRunner();
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__platform.h b/electron34/patches/patch-third__party_electron__node_src_node__platform.h
new file mode 100644
index 0000000000..2aef3ba079
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__platform.h
@@ -0,0 +1,75 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_platform.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_platform.h
+@@ -59,18 +59,21 @@ class PerIsolatePlatformData :
+ ~PerIsolatePlatformData() override;
+
+ std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner() override;
+- void PostTask(std::unique_ptr<v8::Task> task) override;
+- void PostIdleTask(std::unique_ptr<v8::IdleTask> task) override;
+- void PostDelayedTask(std::unique_ptr<v8::Task> task,
+- double delay_in_seconds) override;
++ void PostTaskImpl(std::unique_ptr<v8::Task> task, const v8::SourceLocation&) override;
++ void PostIdleTaskImpl(std::unique_ptr<v8::IdleTask> task, const v8::SourceLocation&) override;
++ void PostDelayedTaskImpl(std::unique_ptr<v8::Task> task,
++ double delay_in_seconds,
++ const v8::SourceLocation&) override;
+ bool IdleTasksEnabled() override { return false; }
+
+ // Non-nestable tasks are treated like regular tasks.
+ bool NonNestableTasksEnabled() const override { return true; }
+ bool NonNestableDelayedTasksEnabled() const override { return true; }
+- void PostNonNestableTask(std::unique_ptr<v8::Task> task) override;
+- void PostNonNestableDelayedTask(std::unique_ptr<v8::Task> task,
+- double delay_in_seconds) override;
++ void PostNonNestableTaskImpl(std::unique_ptr<v8::Task> task,
++ const v8::SourceLocation&) override;
++ void PostNonNestableDelayedTaskImpl(std::unique_ptr<v8::Task> task,
++ double delay_in_seconds,
++ const v8::SourceLocation&) override;
+
+ void AddShutdownCallback(void (*callback)(void*), void* data);
+ void Shutdown();
+@@ -147,17 +150,23 @@ class NodePlatform : public MultiIsolate
+
+ // v8::Platform implementation.
+ int NumberOfWorkerThreads() override;
+- void CallOnWorkerThread(std::unique_ptr<v8::Task> task) override;
+- void CallDelayedOnWorkerThread(std::unique_ptr<v8::Task> task,
+- double delay_in_seconds) override;
++ void PostTaskOnWorkerThreadImpl(v8::TaskPriority priority,
++ std::unique_ptr<v8::Task> task,
++ const v8::SourceLocation& location) override;
++ void PostDelayedTaskOnWorkerThreadImpl(
++ v8::TaskPriority priority,
++ std::unique_ptr<v8::Task> task,
++ double delay_in_seconds,
++ const v8::SourceLocation& location) override;
+ bool IdleTasksEnabled(v8::Isolate* isolate) override;
+ double MonotonicallyIncreasingTime() override;
+ double CurrentClockTimeMillis() override;
+ v8::TracingController* GetTracingController() override;
+ bool FlushForegroundTasks(v8::Isolate* isolate) override;
+- std::unique_ptr<v8::JobHandle> CreateJob(
++ std::unique_ptr<v8::JobHandle> CreateJobImpl(
+ v8::TaskPriority priority,
+- std::unique_ptr<v8::JobTask> job_task) override;
++ std::unique_ptr<v8::JobTask> job_task,
++ const v8::SourceLocation& location) override;
+
+ void RegisterIsolate(v8::Isolate* isolate, uv_loop_t* loop) override;
+ void RegisterIsolate(v8::Isolate* isolate,
+@@ -168,7 +177,7 @@ class NodePlatform : public MultiIsolate
+ void (*callback)(void*), void* data) override;
+
+ std::shared_ptr<v8::TaskRunner> GetForegroundTaskRunner(
+- v8::Isolate* isolate) override;
++ v8::Isolate* isolate, v8::TaskPriority priority) override;
+
+ Platform::StackTracePrinter GetStackTracePrinter() override;
+ v8::PageAllocator* GetPageAllocator() override;
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__process__object.cc b/electron34/patches/patch-third__party_electron__node_src_node__process__object.cc
new file mode 100644
index 0000000000..20148c131f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__process__object.cc
@@ -0,0 +1,72 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_process_object.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_process_object.cc
+@@ -13,7 +13,6 @@
+
+ namespace node {
+ using v8::Context;
+-using v8::DEFAULT;
+ using v8::EscapableHandleScope;
+ using v8::Function;
+ using v8::FunctionCallbackInfo;
+@@ -188,13 +187,12 @@ void PatchProcessObject(const FunctionCa
+
+ // process.title
+ CHECK(process
+- ->SetAccessor(
++ ->SetNativeDataProperty(
+ context,
+ FIXED_ONE_BYTE_STRING(isolate, "title"),
+ ProcessTitleGetter,
+ env->owns_process_state() ? ProcessTitleSetter : nullptr,
+ Local<Value>(),
+- DEFAULT,
+ None,
+ SideEffectType::kHasNoSideEffect)
+ .FromJust());
+@@ -213,9 +211,15 @@ void PatchProcessObject(const FunctionCa
+ READONLY_PROPERTY(process, "pid",
+ Integer::New(isolate, uv_os_getpid()));
+
+- CHECK(process->SetAccessor(context,
+- FIXED_ONE_BYTE_STRING(isolate, "ppid"),
+- GetParentProcessId).FromJust());
++ CHECK(process
++ ->SetNativeDataProperty(context,
++ FIXED_ONE_BYTE_STRING(isolate, "ppid"),
++ GetParentProcessId,
++ nullptr,
++ Local<Value>(),
++ None,
++ SideEffectType::kHasNoSideEffect)
++ .FromJust());
+
+ // --security-revert flags
+ #define V(code, _, __) \
+@@ -240,12 +244,15 @@ void PatchProcessObject(const FunctionCa
+
+ // process.debugPort
+ CHECK(process
+- ->SetAccessor(context,
+- FIXED_ONE_BYTE_STRING(isolate, "debugPort"),
+- DebugPortGetter,
+- env->owns_process_state() ? DebugPortSetter : nullptr,
+- Local<Value>())
+- .FromJust());
++ ->SetNativeDataProperty(
++ context,
++ FIXED_ONE_BYTE_STRING(isolate, "debugPort"),
++ DebugPortGetter,
++ env->owns_process_state() ? DebugPortSetter : nullptr,
++ Local<Value>(),
++ None,
++ SideEffectType::kHasNoSideEffect)
++ .FromJust());
+
+ // process.versions
+ Local<Object> versions = Object::New(isolate);
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__serdes.cc b/electron34/patches/patch-third__party_electron__node_src_node__serdes.cc
new file mode 100644
index 0000000000..2570b76cb3
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__serdes.cc
@@ -0,0 +1,87 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_serdes.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_serdes.cc
+@@ -29,6 +29,11 @@ using v8::ValueSerializer;
+
+ namespace serdes {
+
++v8::ArrayBuffer::Allocator* GetAllocator() {
++ static v8::ArrayBuffer::Allocator* allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
++ return allocator;
++}
++
+ class SerializerContext : public BaseObject,
+ public ValueSerializer::Delegate {
+ public:
+@@ -37,10 +42,15 @@ class SerializerContext : public BaseObj
+
+ ~SerializerContext() override = default;
+
++ // v8::ValueSerializer::Delegate
+ void ThrowDataCloneError(Local<String> message) override;
+ Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object) override;
+ Maybe<uint32_t> GetSharedArrayBufferId(
+ Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer) override;
++ void* ReallocateBufferMemory(void* old_buffer,
++ size_t old_length,
++ size_t* new_length) override;
++ void FreeBufferMemory(void* buffer) override;
+
+ static void SetTreatArrayBufferViewsAsHostObjects(
+ const FunctionCallbackInfo<Value>& args);
+@@ -61,6 +71,7 @@ class SerializerContext : public BaseObj
+
+ private:
+ ValueSerializer serializer_;
++ size_t last_length_ = 0;
+ };
+
+ class DeserializerContext : public BaseObject,
+@@ -144,6 +155,24 @@ Maybe<uint32_t> SerializerContext::GetSh
+ return id.ToLocalChecked()->Uint32Value(env()->context());
+ }
+
++void* SerializerContext::ReallocateBufferMemory(void* old_buffer,
++ size_t requested_size,
++ size_t* new_length) {
++ *new_length = std::max(static_cast<size_t>(4096), requested_size);
++ if (old_buffer) {
++ void* ret = GetAllocator()->Reallocate(old_buffer, last_length_, *new_length);
++ last_length_ = *new_length;
++ return ret;
++ } else {
++ last_length_ = *new_length;
++ return GetAllocator()->Allocate(*new_length);
++ }
++}
++
++void SerializerContext::FreeBufferMemory(void* buffer) {
++ GetAllocator()->Free(buffer, last_length_);
++}
++
+ Maybe<bool> SerializerContext::WriteHostObject(Isolate* isolate,
+ Local<Object> input) {
+ MaybeLocal<Value> ret;
+@@ -209,9 +238,14 @@ void SerializerContext::ReleaseBuffer(co
+ // Note: Both ValueSerializer and this Buffer::New() variant use malloc()
+ // as the underlying allocator.
+ std::pair<uint8_t*, size_t> ret = ctx->serializer_.Release();
+- auto buf = Buffer::New(ctx->env(),
+- reinterpret_cast<char*>(ret.first),
+- ret.second);
++ std::unique_ptr<v8::BackingStore> bs =
++ v8::ArrayBuffer::NewBackingStore(reinterpret_cast<char*>(ret.first), ret.second,
++ [](void* data, size_t length, void* deleter_data) {
++ if (data) GetAllocator()->Free(reinterpret_cast<char*>(data), length);
++ }, nullptr);
++ Local<ArrayBuffer> ab = v8::ArrayBuffer::New(ctx->env()->isolate(), std::move(bs));
++
++ auto buf = Buffer::New(ctx->env(), ab, 0, ret.second);
+
+ if (!buf.IsEmpty()) {
+ args.GetReturnValue().Set(buf.ToLocalChecked());
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__trace__events.cc b/electron34/patches/patch-third__party_electron__node_src_node__trace__events.cc
new file mode 100644
index 0000000000..0012cf2c4a
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__trace__events.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_trace_events.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_trace_events.cc
+@@ -132,12 +132,28 @@ static void GetCategoryEnabledBuffer(con
+ const uint8_t* enabled_pointer =
+ TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_name.out());
+ uint8_t* enabled_pointer_cast = const_cast<uint8_t*>(enabled_pointer);
++ uint8_t size = sizeof(*enabled_pointer_cast);
+
++#if defined(V8_ENABLE_SANDBOX)
++ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
++ void* v8_data = allocator->Allocate(size);
++ CHECK(v8_data);
++ memcpy(v8_data, enabled_pointer_cast, size);
++ std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore(
++ v8_data,
++ size,
++ [](void* data, size_t length, void*) {
++ std::unique_ptr<ArrayBuffer::Allocator> allocator(ArrayBuffer::Allocator::NewDefaultAllocator());
++ allocator->Free(data, length);
++ }, nullptr);
++#else
+ std::unique_ptr<BackingStore> bs = ArrayBuffer::NewBackingStore(
+ enabled_pointer_cast,
+- sizeof(*enabled_pointer_cast),
++ size,
+ [](void*, size_t, void*) {},
+ nullptr);
++#endif
++
+ auto ab = ArrayBuffer::New(isolate, std::move(bs));
+ v8::Local<Uint8Array> u8 = v8::Uint8Array::New(ab, 0, 1);
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_node__wasi.cc b/electron34/patches/patch-third__party_electron__node_src_node__wasi.cc
new file mode 100644
index 0000000000..2bac7b2979
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_node__wasi.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/node_wasi.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/node_wasi.cc
+@@ -248,17 +248,18 @@ R WASI::WasiFunction<FT, F, R, Args...>:
+ WASI* wasi = reinterpret_cast<WASI*>(BaseObject::FromJSObject(receiver));
+ if (UNLIKELY(wasi == nullptr)) return EinvalError<R>();
+
+- if (UNLIKELY(options.wasm_memory == nullptr || wasi->memory_.IsEmpty())) {
+- // fallback to slow path which to throw an error about missing memory.
+- options.fallback = true;
++ v8::Isolate* isolate = receiver->GetIsolate();
++ v8::HandleScope handle_scope(isolate);
++ if (wasi->memory_.IsEmpty()) {
++ THROW_ERR_WASI_NOT_STARTED(isolate);
+ return EinvalError<R>();
+ }
+- uint8_t* memory = nullptr;
+- CHECK(LIKELY(options.wasm_memory->getStorageIfAligned(&memory)));
++ Local<ArrayBuffer> ab = wasi->memory_.Get(isolate)->Buffer();
++ size_t mem_size = ab->ByteLength();
++ char* mem_data = static_cast<char*>(ab->Data());
++ CHECK_NOT_NULL(mem_data);
+
+- return F(*wasi,
+- {reinterpret_cast<char*>(memory), options.wasm_memory->length()},
+- args...);
++ return F(*wasi, {mem_data, mem_size}, args...);
+ }
+
+ namespace {
diff --git a/electron34/patches/patch-third__party_electron__node_src_stream__base.cc b/electron34/patches/patch-third__party_electron__node_src_stream__base.cc
new file mode 100644
index 0000000000..3b8e1b1a53
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_stream__base.cc
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/stream_base.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/stream_base.cc
+@@ -492,6 +492,29 @@ Local<Object> StreamBase::GetObject() {
+ return GetAsyncWrap()->object();
+ }
+
++void StreamBase::AddAccessor(v8::Isolate* isolate,
++ v8::Local<v8::Signature> signature,
++ enum v8::PropertyAttribute attributes,
++ v8::Local<v8::FunctionTemplate> t,
++ JSMethodFunction* getter,
++ JSMethodFunction* setter,
++ v8::Local<v8::String> string) {
++ Local<FunctionTemplate> getter_templ =
++ NewFunctionTemplate(isolate,
++ getter,
++ signature,
++ ConstructorBehavior::kThrow,
++ SideEffectType::kHasNoSideEffect);
++ Local<FunctionTemplate> setter_templ =
++ NewFunctionTemplate(isolate,
++ setter,
++ signature,
++ ConstructorBehavior::kThrow,
++ SideEffectType::kHasSideEffect);
++ t->PrototypeTemplate()->SetAccessorProperty(
++ string, getter_templ, setter_templ, attributes);
++}
++
+ void StreamBase::AddMethod(Isolate* isolate,
+ Local<Signature> signature,
+ enum PropertyAttribute attributes,
+@@ -561,11 +584,14 @@ void StreamBase::AddMethods(IsolateData*
+ JSMethod<&StreamBase::WriteString<LATIN1>>);
+ t->PrototypeTemplate()->Set(FIXED_ONE_BYTE_STRING(isolate, "isStreamBase"),
+ True(isolate));
+- t->PrototypeTemplate()->SetAccessor(
+- FIXED_ONE_BYTE_STRING(isolate, "onread"),
+- BaseObject::InternalFieldGet<StreamBase::kOnReadFunctionField>,
+- BaseObject::InternalFieldSet<StreamBase::kOnReadFunctionField,
+- &Value::IsFunction>);
++ AddAccessor(isolate,
++ sig,
++ static_cast<PropertyAttribute>(DontDelete | DontEnum),
++ t,
++ BaseObject::InternalFieldGet<StreamBase::kOnReadFunctionField>,
++ BaseObject::InternalFieldSet<StreamBase::kOnReadFunctionField,
++ &Value::IsFunction>,
++ FIXED_ONE_BYTE_STRING(isolate, "onread"));
+ }
+
+ void StreamBase::RegisterExternalReferences(
diff --git a/electron34/patches/patch-third__party_electron__node_src_stream__base.h b/electron34/patches/patch-third__party_electron__node_src_stream__base.h
new file mode 100644
index 0000000000..29832e7ae9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_stream__base.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/stream_base.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/stream_base.h
+@@ -413,6 +413,13 @@ class StreamBase : public StreamResource
+ EmitToJSStreamListener default_listener_;
+
+ void SetWriteResult(const StreamWriteResult& res);
++ static void AddAccessor(v8::Isolate* isolate,
++ v8::Local<v8::Signature> sig,
++ enum v8::PropertyAttribute attributes,
++ v8::Local<v8::FunctionTemplate> t,
++ JSMethodFunction* getter,
++ JSMethodFunction* setter,
++ v8::Local<v8::String> str);
+ static void AddMethod(v8::Isolate* isolate,
+ v8::Local<v8::Signature> sig,
+ enum v8::PropertyAttribute attributes,
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_agent.cc b/electron34/patches/patch-third__party_electron__node_src_tracing_agent.cc
new file mode 100644
index 0000000000..b0d5aa9940
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_agent.cc
@@ -0,0 +1,85 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/agent.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/agent.cc
+@@ -50,7 +50,9 @@ using v8::platform::tracing::TraceWriter
+ using std::string;
+
+ Agent::Agent() : tracing_controller_(new TracingController()) {
++#ifndef V8_USE_PERFETTO
+ tracing_controller_->Initialize(nullptr);
++#endif
+
+ CHECK_EQ(uv_loop_init(&tracing_loop_), 0);
+ CHECK_EQ(uv_async_init(&tracing_loop_,
+@@ -86,10 +88,14 @@ Agent::~Agent() {
+ void Agent::Start() {
+ if (started_)
+ return;
+-
++#ifdef V8_USE_PERFETTO
++ std::ostringstream perfetto_output;
++ tracing_controller_->InitializeForPerfetto(&perfetto_output);
++#else
+ NodeTraceBuffer* trace_buffer_ = new NodeTraceBuffer(
+ NodeTraceBuffer::kBufferChunks, this, &tracing_loop_);
+ tracing_controller_->Initialize(trace_buffer_);
++#endif
+
+ // This thread should be created *after* async handles are created
+ // (within NodeTraceWriter and NodeTraceBuffer constructors).
+@@ -143,8 +149,10 @@ void Agent::StopTracing() {
+ return;
+ // Perform final Flush on TraceBuffer. We don't want the tracing controller
+ // to flush the buffer again on destruction of the V8::Platform.
+- tracing_controller_->StopTracing();
++#ifndef V8_USE_PERFETTO
+ tracing_controller_->Initialize(nullptr);
++#endif
++ tracing_controller_->StopTracing();
+ started_ = false;
+
+ // Thread should finish when the tracing loop is stopped.
+@@ -202,6 +210,7 @@ std::string Agent::GetEnabledCategories(
+ return categories;
+ }
+
++#ifndef V8_USE_PERFETTO
+ void Agent::AppendTraceEvent(TraceObject* trace_event) {
+ for (const auto& id_writer : writers_)
+ id_writer.second->AppendTraceEvent(trace_event);
+@@ -211,18 +220,21 @@ void Agent::AddMetadataEvent(std::unique
+ Mutex::ScopedLock lock(metadata_events_mutex_);
+ metadata_events_.push_back(std::move(event));
+ }
++#endif
+
+ void Agent::Flush(bool blocking) {
++#ifndef V8_USE_PERFETTO
+ {
+ Mutex::ScopedLock lock(metadata_events_mutex_);
+ for (const auto& event : metadata_events_)
+ AppendTraceEvent(event.get());
+ }
+-
++#endif
+ for (const auto& id_writer : writers_)
+ id_writer.second->Flush(blocking);
+ }
+
++#ifndef V8_USE_PERFETTO
+ void TracingController::AddMetadataEvent(
+ const unsigned char* category_group_enabled,
+ const char* name,
+@@ -246,6 +258,6 @@ void TracingController::AddMetadataEvent
+ if (node_agent != nullptr)
+ node_agent->AddMetadataEvent(std::move(trace_event));
+ }
+-
++#endif
+ } // namespace tracing
+ } // namespace node
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_agent.h b/electron34/patches/patch-third__party_electron__node_src_tracing_agent.h
new file mode 100644
index 0000000000..af9dd3b87c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_agent.h
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/agent.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/agent.h
+@@ -27,7 +27,9 @@ class Agent;
+ class AsyncTraceWriter {
+ public:
+ virtual ~AsyncTraceWriter() = default;
++#ifndef V8_USE_PERFETTO
+ virtual void AppendTraceEvent(TraceObject* trace_event) = 0;
++#endif
+ virtual void Flush(bool blocking) = 0;
+ virtual void InitializeOnThread(uv_loop_t* loop) {}
+ };
+@@ -36,6 +38,7 @@ class TracingController : public v8::pla
+ public:
+ TracingController() : v8::platform::tracing::TracingController() {}
+
++#ifndef V8_USE_PERFETTO
+ int64_t CurrentTimestampMicroseconds() override {
+ return uv_hrtime() / 1000;
+ }
+@@ -48,6 +51,7 @@ class TracingController : public v8::pla
+ const uint64_t* arg_values,
+ std::unique_ptr<v8::ConvertableToTraceFormat>* convertable_values,
+ unsigned int flags);
++#endif
+ };
+
+ class AgentWriterHandle {
+@@ -108,11 +112,12 @@ class Agent {
+
+ // Returns a comma-separated list of enabled categories.
+ std::string GetEnabledCategories() const;
+-
++#ifndef V8_USE_PERFETTO
+ // Writes to all writers registered through AddClient().
+ void AppendTraceEvent(TraceObject* trace_event);
+
+ void AddMetadataEvent(std::unique_ptr<TraceObject> event);
++#endif
+ // Flushes all writers registered through AddClient().
+ void Flush(bool blocking);
+
+@@ -152,7 +157,9 @@ class Agent {
+ std::set<AsyncTraceWriter*> to_be_initialized_;
+
+ Mutex metadata_events_mutex_;
++#ifndef V8_USE_PERFETTO
+ std::list<std::unique_ptr<TraceObject>> metadata_events_;
++#endif
+ };
+
+ void AgentWriterHandle::reset() {
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc
new file mode 100644
index 0000000000..f7c10ec1ea
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/node_trace_buffer.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/node_trace_buffer.cc
+@@ -55,6 +55,7 @@ TraceObject* InternalTraceBuffer::GetEve
+ }
+
+ void InternalTraceBuffer::Flush(bool blocking) {
++#ifndef V8_USE_PERFETTO
+ {
+ Mutex::ScopedLock scoped_lock(mutex_);
+ if (total_chunks_ > 0) {
+@@ -75,6 +76,7 @@ void InternalTraceBuffer::Flush(bool blo
+ flushing_ = false;
+ }
+ }
++#endif
+ agent_->Flush(blocking);
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc
new file mode 100644
index 0000000000..e6f7a53283
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/node_trace_writer.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/node_trace_writer.cc
+@@ -95,7 +95,7 @@ void NodeTraceWriter::OpenNewFileForStre
+ fd_ = -1;
+ }
+ }
+-
++#ifndef V8_USE_PERFETTO
+ void NodeTraceWriter::AppendTraceEvent(TraceObject* trace_event) {
+ Mutex::ScopedLock scoped_lock(stream_mutex_);
+ // If this is the first trace event, open a new file for streaming.
+@@ -112,7 +112,7 @@ void NodeTraceWriter::AppendTraceEvent(T
+ ++total_traces_;
+ json_trace_writer_->AppendTraceEvent(trace_event);
+ }
+-
++#endif
+ void NodeTraceWriter::FlushPrivate() {
+ std::string str;
+ int highest_request_id;
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h
new file mode 100644
index 0000000000..34b01a7f4f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/node_trace_writer.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/node_trace_writer.h
+@@ -20,7 +20,9 @@ class NodeTraceWriter : public AsyncTrac
+ ~NodeTraceWriter() override;
+
+ void InitializeOnThread(uv_loop_t* loop) override;
++#ifndef V8_USE_PERFETTO
+ void AppendTraceEvent(TraceObject* trace_event) override;
++#endif
+ void Flush(bool blocking) override;
+
+ static const int kTracesPerFile = 1 << 19;
diff --git a/electron34/patches/patch-third__party_electron__node_src_tracing_trace__event.h b/electron34/patches/patch-third__party_electron__node_src_tracing_trace__event.h
new file mode 100644
index 0000000000..848bde83e0
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_src_tracing_trace__event.h
@@ -0,0 +1,118 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/src/tracing/trace_event.h.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/src/tracing/trace_event.h
+@@ -69,8 +69,16 @@ enum CategoryGroupEnabledFlags {
+ // for best performance when tracing is disabled.
+ // const uint8_t*
+ // TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(const char* category_group)
++#ifndef V8_USE_PERFETTO
+ #define TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED \
+ node::tracing::TraceEventHelper::GetCategoryGroupEnabled
++#else
++#define TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(category_group) \
++ ([](const char*) -> const uint8_t* { \
++ static uint8_t no = 0; \
++ return &no; \
++ })(category_group)
++#endif
+
+ // Get the number of times traces have been recorded. This is used to implement
+ // the TRACE_EVENT_IS_NEW_TRACE facility.
+@@ -114,10 +122,15 @@ enum CategoryGroupEnabledFlags {
+ // const uint8_t* category_group_enabled,
+ // const char* name,
+ // uint64_t id)
++#ifndef V8_USE_PERFETTO
+ #define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION \
+ if (auto controller = \
+ node::tracing::TraceEventHelper::GetTracingController()) \
+ controller->UpdateTraceEventDuration
++#else
++#define TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled, name, event_handle) \
++ (void)(category_group_enabled), (void)(name), (void)(event_handle)
++#endif
+
+ // Adds a metadata event to the trace log. The |AppendValueAsTraceFormat| method
+ // on the convertable value will be called at flush time.
+@@ -319,10 +332,13 @@ class TraceEventHelper {
+ static void SetAgent(Agent* agent);
+
+ static inline const uint8_t* GetCategoryGroupEnabled(const char* group) {
++#ifndef V8_USE_PERFETTO
+ v8::TracingController* controller = GetTracingController();
+ static const uint8_t disabled = 0;
+ if (UNLIKELY(controller == nullptr)) return &disabled;
+ return controller->GetCategoryGroupEnabled(group);
++#endif
++ return 0;
+ }
+ };
+
+@@ -460,6 +476,7 @@ static inline uint64_t AddTraceEventImpl
+ const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values, unsigned int flags) {
++#ifndef V8_USE_PERFETTO
+ std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertibles[2];
+ if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
+ arg_convertibles[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
+@@ -469,13 +486,14 @@ static inline uint64_t AddTraceEventImpl
+ arg_convertibles[1].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
+ static_cast<intptr_t>(arg_values[1])));
+ }
+- // DCHECK(num_args, 2);
+ v8::TracingController* controller =
+ node::tracing::TraceEventHelper::GetTracingController();
+ if (controller == nullptr) return 0;
+ return controller->AddTraceEvent(phase, category_group_enabled, name, scope, id,
+ bind_id, num_args, arg_names, arg_types,
+ arg_values, arg_convertibles, flags);
++#endif
++ return 0;
+ }
+
+ static V8_INLINE uint64_t AddTraceEventWithTimestampImpl(
+@@ -483,6 +501,7 @@ static V8_INLINE uint64_t AddTraceEventW
+ const char* scope, uint64_t id, uint64_t bind_id, int32_t num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values, unsigned int flags, int64_t timestamp) {
++#ifndef V8_USE_PERFETTO
+ std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertables[2];
+ if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
+ arg_convertables[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
+@@ -492,19 +511,21 @@ static V8_INLINE uint64_t AddTraceEventW
+ arg_convertables[1].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
+ static_cast<intptr_t>(arg_values[1])));
+ }
+- // DCHECK_LE(num_args, 2);
+ v8::TracingController* controller =
+ node::tracing::TraceEventHelper::GetTracingController();
+ if (controller == nullptr) return 0;
+ return controller->AddTraceEventWithTimestamp(
+ phase, category_group_enabled, name, scope, id, bind_id, num_args,
+ arg_names, arg_types, arg_values, arg_convertables, flags, timestamp);
++#endif
++ return 0;
+ }
+
+ static V8_INLINE void AddMetadataEventImpl(
+ const uint8_t* category_group_enabled, const char* name, int32_t num_args,
+ const char** arg_names, const uint8_t* arg_types,
+ const uint64_t* arg_values, unsigned int flags) {
++#ifndef V8_USE_PERFETTO
+ std::unique_ptr<v8::ConvertableToTraceFormat> arg_convertibles[2];
+ if (num_args > 0 && arg_types[0] == TRACE_VALUE_TYPE_CONVERTABLE) {
+ arg_convertibles[0].reset(reinterpret_cast<v8::ConvertableToTraceFormat*>(
+@@ -520,6 +541,7 @@ static V8_INLINE void AddMetadataEventIm
+ return agent->GetTracingController()->AddMetadataEvent(
+ category_group_enabled, name, num_args, arg_names, arg_types, arg_values,
+ arg_convertibles, flags);
++#endif
+ }
+
+ // Define SetTraceValue for each allowed type. It stores the type and
diff --git a/electron34/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc b/electron34/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc
new file mode 100644
index 0000000000..f923a14731
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/addons/cppgc-object/binding.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/addons/cppgc-object/binding.cc
+@@ -1,8 +1,10 @@
++#include <assert.h>
+ #include <cppgc/allocation.h>
+ #include <cppgc/garbage-collected.h>
+ #include <cppgc/heap.h>
+ #include <node.h>
+ #include <v8-cppgc.h>
++#include <v8-sandbox.h>
+ #include <v8.h>
+ #include <algorithm>
+
+@@ -15,8 +17,10 @@ class CppGCed : public cppgc::GarbageCol
+ static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::Local<v8::Object> js_object = args.This();
+- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>(
+- isolate->GetCppHeap()->GetAllocationHandle());
++ auto* heap = isolate->GetCppHeap();
++ assert(heap != nullptr);
++ CppGCed* gc_object =
++ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle());
+ node::SetCppgcReference(isolate, js_object, gc_object);
+ args.GetReturnValue().Set(js_object);
+ }
+@@ -24,12 +28,6 @@ class CppGCed : public cppgc::GarbageCol
+ static v8::Local<v8::Function> GetConstructor(
+ v8::Local<v8::Context> context) {
+ auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New);
+- auto ot = ft->InstanceTemplate();
+- v8::WrapperDescriptor descriptor =
+- context->GetIsolate()->GetCppHeap()->wrapper_descriptor();
+- uint16_t required_size = std::max(descriptor.wrappable_instance_index,
+- descriptor.wrappable_type_index);
+- ot->SetInternalFieldCount(required_size + 1);
+ return ft->GetFunction(context).ToLocalChecked();
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc b/electron34/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc
new file mode 100644
index 0000000000..3c0ffb06ab
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc
@@ -0,0 +1,72 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/cctest/test_cppgc.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/cctest/test_cppgc.cc
+@@ -3,16 +3,12 @@
+ #include <cppgc/heap.h>
+ #include <node.h>
+ #include <v8-cppgc.h>
++#include <v8-sandbox.h>
+ #include <v8.h>
+ #include "node_test_fixture.h"
+
+ // This tests that Node.js can work with an existing CppHeap.
+
+-// Mimic the Blink layout.
+-static int kWrappableTypeIndex = 0;
+-static int kWrappableInstanceIndex = 1;
+-static uint16_t kEmbedderID = 0x1;
+-
+ // Mimic a class that does not know about Node.js.
+ class CppGCed : public cppgc::GarbageCollected<CppGCed> {
+ public:
+@@ -23,12 +19,11 @@ class CppGCed : public cppgc::GarbageCol
+ static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ v8::Isolate* isolate = args.GetIsolate();
+ v8::Local<v8::Object> js_object = args.This();
+- CppGCed* gc_object = cppgc::MakeGarbageCollected<CppGCed>(
+- isolate->GetCppHeap()->GetAllocationHandle());
+- js_object->SetAlignedPointerInInternalField(kWrappableTypeIndex,
+- &kEmbedderID);
+- js_object->SetAlignedPointerInInternalField(kWrappableInstanceIndex,
+- gc_object);
++ auto* heap = isolate->GetCppHeap();
++ CHECK_NOT_NULL(heap);
++ CppGCed* gc_object =
++ cppgc::MakeGarbageCollected<CppGCed>(heap->GetAllocationHandle());
++ node::SetCppgcReference(isolate, js_object, gc_object);
+ kConstructCount++;
+ args.GetReturnValue().Set(js_object);
+ }
+@@ -36,8 +31,6 @@ class CppGCed : public cppgc::GarbageCol
+ static v8::Local<v8::Function> GetConstructor(
+ v8::Local<v8::Context> context) {
+ auto ft = v8::FunctionTemplate::New(context->GetIsolate(), New);
+- auto ot = ft->InstanceTemplate();
+- ot->SetInternalFieldCount(2);
+ return ft->GetFunction(context).ToLocalChecked();
+ }
+
+@@ -58,12 +51,12 @@ TEST_F(NodeZeroIsolateTestFixture, Exist
+
+ // Create and attach the CppHeap before we set up the IsolateData so that
+ // it recognizes the existing heap.
+- std::unique_ptr<v8::CppHeap> cpp_heap = v8::CppHeap::Create(
+- platform.get(),
+- v8::CppHeapCreateParams(
+- {},
+- v8::WrapperDescriptor(
+- kWrappableTypeIndex, kWrappableInstanceIndex, kEmbedderID)));
++ std::unique_ptr<v8::CppHeap> cpp_heap =
++ v8::CppHeap::Create(platform.get(), v8::CppHeapCreateParams{{}});
++
++ // TODO(joyeecheung): pass it into v8::Isolate::CreateParams and let V8
++ // own it when we can keep the isolate registered/task runner discoverable
++ // during isolate disposal.
+ isolate->AttachCppHeap(cpp_heap.get());
+
+ // Try creating Context + IsolateData + Environment.
diff --git a/electron34/patches/patch-third__party_electron__node_test_cctest_test__environment.cc b/electron34/patches/patch-third__party_electron__node_test_cctest_test__environment.cc
new file mode 100644
index 0000000000..61b266a7f8
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_cctest_test__environment.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/cctest/test_environment.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/cctest/test_environment.cc
+@@ -620,12 +620,9 @@ TEST_F(EnvironmentTest, SetImmediateMicr
+
+ #ifndef _WIN32 // No SIGINT on Windows.
+ TEST_F(NodeZeroIsolateTestFixture, CtrlCWithOnlySafeTerminationTest) {
+- // We need to go through the whole setup dance here because we want to
+- // set only_terminate_in_safe_scope.
+ // Allocate and initialize Isolate.
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = allocator.get();
+- create_params.only_terminate_in_safe_scope = true;
+ v8::Isolate* isolate = v8::Isolate::Allocate();
+ CHECK_NOT_NULL(isolate);
+ platform->RegisterIsolate(isolate, ¤t_loop);
diff --git a/electron34/patches/patch-third__party_electron__node_test_common_debugger.js b/electron34/patches/patch-third__party_electron__node_test_common_debugger.js
new file mode 100644
index 0000000000..d5dc02acab
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_common_debugger.js
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/common/debugger.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/common/debugger.js
+@@ -4,7 +4,7 @@ const spawn = require('child_process').s
+
+ const BREAK_MESSAGE = new RegExp('(?:' + [
+ 'assert', 'break', 'break on start', 'debugCommand',
+- 'exception', 'other', 'promiseRejection',
++ 'exception', 'other', 'promiseRejection', 'step',
+ ].join('|') + ') in', 'i');
+
+ let TIMEOUT = common.platformTimeout(5000);
+@@ -121,13 +121,13 @@ function startCLI(args, flags = [], spaw
+ get breakInfo() {
+ const output = this.output;
+ const breakMatch =
+- output.match(/break (?:on start )?in ([^\n]+):(\d+)\n/i);
++ output.match(/(step |break (?:on start )?)in ([^\n]+):(\d+)\n/i);
+
+ if (breakMatch === null) {
+ throw new Error(
+ `Could not find breakpoint info in ${JSON.stringify(output)}`);
+ }
+- return { filename: breakMatch[1], line: +breakMatch[2] };
++ return { filename: breakMatch[2], line: +breakMatch[3] };
+ },
+
+ ctrlC() {
diff --git a/electron34/patches/patch-third__party_electron__node_test_common_globals.js b/electron34/patches/patch-third__party_electron__node_test_common_globals.js
new file mode 100644
index 0000000000..c40ed5bbcd
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_common_globals.js
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/common/globals.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/common/globals.js
+@@ -63,6 +63,7 @@ const intrinsics = new Set([
+ 'SharedArrayBuffer',
+ 'Atomics',
+ 'WebAssembly',
++ 'Iterator',
+ ]);
+
+ if (global.gc) {
diff --git a/electron34/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js b/electron34/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js
new file mode 100644
index 0000000000..07399cfa04
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/es-module/test-cjs-legacyMainResolve.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/es-module/test-cjs-legacyMainResolve.js
+@@ -82,7 +82,7 @@ describe('legacyMainResolve', () => {
+ {},
+ ''
+ ),
+- { message: /instance of URL/, code: 'ERR_INVALID_ARG_TYPE' },
++ { message: 'Invalid URL', code: 'ERR_INVALID_URL' },
+ );
+ });
+
+@@ -129,7 +129,7 @@ describe('legacyMainResolve', () => {
+ );
+ assert.throws(
+ () => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl),
+- { message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' },
++ { code: 'ERR_INTERNAL_ASSERTION' },
+ );
+ });
+
+@@ -137,7 +137,7 @@ describe('legacyMainResolve', () => {
+ const packageJsonUrl = pathToFileURL('/c/file%20with%20percents/package.json');
+ assert.throws(
+ () => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl),
+- { message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' },
++ { code: 'ERR_INTERNAL_ASSERTION' },
+ );
+ });
+
+@@ -150,7 +150,7 @@ describe('legacyMainResolve', () => {
+ );
+ assert.throws(
+ () => legacyMainResolve(packageJsonUrl, { main: './index.node' }, packageJsonUrl),
+- { message: /index\.node/, code: 'ERR_MODULE_NOT_FOUND' },
++ { code: 'ERR_INTERNAL_ASSERTION' },
+ );
+ });
+
+@@ -163,7 +163,7 @@ describe('legacyMainResolve', () => {
+ );
+ assert.throws(
+ () => legacyMainResolve(packageJsonUrl, { main: null }, undefined),
+- { message: /"base" argument must be/, code: 'ERR_INVALID_ARG_TYPE' },
++ { message: 'The "path" argument must be of type string or an instance of URL. Received undefined', code: 'ERR_INVALID_ARG_TYPE' },
+ );
+ });
+ });
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_promise__unhandled__warn__with__error.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_promise__unhandled__warn__with__error.snapshot
new file mode 100644
index 0000000000..cf4b814b52
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_promise__unhandled__warn__with__error.snapshot
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/errors/promise_unhandled_warn_with_error.snapshot
+@@ -6,5 +6,5 @@
+ at *
+ at *
+ at *
+-(Use `node --trace-warnings ...` to show where the warning was created)
++(Use `* --trace-warnings ...` to show where the warning was created)
+ (node:*) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https:*nodejs.org*api*cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__error__with__getter__throw.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__error__with__getter__throw.snapshot
new file mode 100644
index 0000000000..15c9eb501c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__error__with__getter__throw.snapshot
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/errors/throw_error_with_getter_throw.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/errors/throw_error_with_getter_throw.snapshot
+@@ -3,6 +3,6 @@
+ throw { * eslint-disable-line no-throw-literal
+ ^
+ [object Object]
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__null.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__null.snapshot
new file mode 100644
index 0000000000..9268357609
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__null.snapshot
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/errors/throw_null.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/errors/throw_null.snapshot
+@@ -3,6 +3,6 @@
+ throw null;
+ ^
+ null
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__undefined.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__undefined.snapshot
new file mode 100644
index 0000000000..185df2dbde
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_errors_throw__undefined.snapshot
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/errors/throw_undefined.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/errors/throw_undefined.snapshot
+@@ -3,6 +3,6 @@
+ throw undefined;
+ ^
+ undefined
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_eval__messages.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_eval__messages.snapshot
new file mode 100644
index 0000000000..025f0b3c8b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_eval__messages.snapshot
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/eval/eval_messages.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/eval/eval_messages.snapshot
+@@ -62,7 +62,7 @@ Node.js *
+ var ______________________________________________; throw 10
+ ^
+ 10
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
+
+@@ -70,7 +70,7 @@ Node.js *
+ var ______________________________________________; throw 10
+ ^
+ 10
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
+ done
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_stdin__messages.snapshot b/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_stdin__messages.snapshot
new file mode 100644
index 0000000000..aa3fc07874
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_eval_stdin__messages.snapshot
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/eval/stdin_messages.snapshot.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/eval/stdin_messages.snapshot
+@@ -75,7 +75,7 @@ Node.js *
+ let ______________________________________________; throw 10
+ ^
+ 10
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
+
+@@ -83,7 +83,7 @@ Node.js *
+ let ______________________________________________; throw 10
+ ^
+ 10
+-(Use `node --trace-uncaught ...` to show where the exception was thrown)
++(Use `* --trace-uncaught ...` to show where the exception was thrown)
+
+ Node.js *
+ done
diff --git a/electron34/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js b/electron34/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js
new file mode 100644
index 0000000000..e387b18401
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/fixtures/test-runner/output/arbitrary-output-colored.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/fixtures/test-runner/output/arbitrary-output-colored.js
+@@ -7,6 +7,6 @@ const fixtures = require('../../../commo
+ (async function run() {
+ const test = fixtures.path('test-runner/output/arbitrary-output-colored-1.js');
+ const reset = fixtures.path('test-runner/output/reset-color-depth.js');
+- await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit' }), 'exit');
+- await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit' }), 'exit');
++ await once(spawn(process.execPath, ['-r', reset, '--test', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 }}), 'exit');
++ await once(spawn(process.execPath, ['-r', reset, '--test', '--test-reporter', 'tap', test], { stdio: 'inherit', env: { ELECTRON_RUN_AS_NODE: 1 } }), 'exit');
+ })().then(common.mustCall());
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_parallel.status b/electron34/patches/patch-third__party_electron__node_test_parallel_parallel.status
new file mode 100644
index 0000000000..bd2706f595
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_parallel.status
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/parallel.status.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/parallel.status
+@@ -5,6 +5,16 @@ prefix parallel
+ # sample-test : PASS,FLAKY
+
+ [true] # This section applies to all platforms
++# https://github.com/nodejs/node/pull/50327
++# Currently there's no reliable way to test it.
++test-diagnostics-channel-memory-leak: SKIP
++test-inspector-multisession-ws: PASS, FLAKY
++test-heapsnapshot-near-heap-limit-by-api-in-worker: PASS, FLAKY
++test-heapsnapshot-near-heap-limit-worker: PASS, FLAKY
++test-fetch: PASS, FLAKY
++test-cluster-bind-privileged-port: PASS, FLAKY
++test-cluster-shared-handle-bind-privileged-port: PASS, FLAKY
++test-debugger-random-port-with-inspect-port: PASS, FLAKY
+ # https://github.com/nodejs/node/issues/52273
+ test-net-write-fully-async-hex-string: PASS, FLAKY
+ # https://github.com/nodejs/node/issues/52273
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js
new file mode 100644
index 0000000000..91f004ffa3
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-buffer-tostring-range.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-buffer-tostring-range.js
+@@ -103,6 +103,8 @@ assert.throws(() => {
+ // Cannot test on 32bit machine as we are testing the case
+ // when start and end are above the threshold
+ common.skipIf32Bits();
++/* Disabled due to incompatiblity with v8 memory cage
+ const threshold = 0xFFFFFFFF;
+ const largeBuffer = Buffer.alloc(threshold);
+ largeBuffer.toString('utf8', threshold + 0xF, threshold + 0xFF);
++*/
+\ No newline at end of file
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-cli-node-options.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-cli-node-options.js
new file mode 100644
index 0000000000..de2c9f5c9c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-cli-node-options.js
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-cli-node-options.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-cli-node-options.js
+@@ -72,7 +72,6 @@ if (common.hasCrypto) {
+ expect('--abort_on-uncaught_exception', 'B\n');
+ expect('--disallow-code-generation-from-strings', 'B\n');
+ expect('--expose-gc', 'B\n');
+-expect('--huge-max-old-generation-size', 'B\n');
+ expect('--jitless', 'B\n');
+ expect('--max-old-space-size=0', 'B\n');
+ expect('--max-semi-space-size=0', 'B\n');
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js
new file mode 100644
index 0000000000..2f716280d0
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-async-sign-verify.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-async-sign-verify.js
+@@ -88,6 +88,7 @@ test('rsa_public.pem', 'rsa_private.pem'
+ // ED25519
+ test('ed25519_public.pem', 'ed25519_private.pem', undefined, true);
+ // ED448
++/*
+ test('ed448_public.pem', 'ed448_private.pem', undefined, true);
+
+ // ECDSA w/ der signature encoding
+@@ -109,6 +110,7 @@ test('dsa_public.pem', 'dsa_private.pem'
+ // DSA w/ ieee-p1363 signature encoding
+ test('dsa_public.pem', 'dsa_private.pem', 'sha256', false,
+ { dsaEncoding: 'ieee-p1363' });
++*/
+
+ // Test Parallel Execution w/ KeyObject is threadsafe in openssl3
+ {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js
new file mode 100644
index 0000000000..30af734547
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js
@@ -0,0 +1,139 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-authenticated.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-authenticated.js
+@@ -48,7 +48,9 @@ const errMessages = {
+ const ciphers = crypto.getCiphers();
+
+ const expectedWarnings = common.hasFipsCrypto ?
+- [] : [
++ [] : !ciphers.includes('aes-192-ccm') ? [
++ ['Use Cipheriv for counter mode of aes-192-gcm'],
++ ] : [
+ ['Use Cipheriv for counter mode of aes-192-gcm'],
+ ['Use Cipheriv for counter mode of aes-192-ccm'],
+ ['Use Cipheriv for counter mode of aes-192-ccm'],
+@@ -315,7 +317,9 @@ for (const test of TEST_CASES) {
+
+ // Test that create(De|C)ipher(iv)? throws if the mode is CCM and an invalid
+ // authentication tag length has been specified.
+-{
++if (!ciphers.includes('aes-256-ccm')) {
++ common.printSkipMessage(`unsupported aes-256-ccm test`);
++} else {
+ for (const authTagLength of [-1, true, false, NaN, 5.5]) {
+ assert.throws(() => {
+ crypto.createCipheriv('aes-256-ccm',
+@@ -403,6 +407,10 @@ for (const test of TEST_CASES) {
+ // authentication tag has been specified.
+ {
+ for (const mode of ['ccm', 'ocb']) {
++ if (!ciphers.includes(`aes-256-${mode}`)) {
++ common.printSkipMessage(`unsupported aes-256-${mode} test`);
++ continue;
++ }
+ assert.throws(() => {
+ crypto.createCipheriv(`aes-256-${mode}`,
+ 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
+@@ -437,7 +445,9 @@ for (const test of TEST_CASES) {
+ }
+
+ // Test that setAAD throws if an invalid plaintext length has been specified.
+-{
++if (!ciphers.includes('aes-256-ccm')) {
++ common.printSkipMessage(`unsupported aes-256-ccm test`);
++} else {
+ const cipher = crypto.createCipheriv('aes-256-ccm',
+ 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
+ 'qkuZpJWCewa6S',
+@@ -458,7 +468,9 @@ for (const test of TEST_CASES) {
+ }
+
+ // Test that setAAD and update throw if the plaintext is too long.
+-{
++if (!ciphers.includes('aes-256-ccm')) {
++ common.printSkipMessage(`unsupported aes-256-ccm test`);
++} else {
+ for (const ivLength of [13, 12]) {
+ const maxMessageSize = (1 << (8 * (15 - ivLength))) - 1;
+ const key = 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8';
+@@ -489,7 +501,9 @@ for (const test of TEST_CASES) {
+
+ // Test that setAAD throws if the mode is CCM and the plaintext length has not
+ // been specified.
+-{
++if (!ciphers.includes('aes-256-ccm')) {
++ common.printSkipMessage(`unsupported aes-256-ccm test`);
++} else {
+ assert.throws(() => {
+ const cipher = crypto.createCipheriv('aes-256-ccm',
+ 'FxLKsqdmv0E9xrQhp0b1ZgI0K7JFZJM8',
+@@ -514,7 +528,9 @@ for (const test of TEST_CASES) {
+ }
+
+ // Test that final() throws in CCM mode when no authentication tag is provided.
+-{
++if (!ciphers.includes('aes-128-ccm')) {
++ common.printSkipMessage(`unsupported aes-256-ccm test`);
++} else {
+ if (!common.hasFipsCrypto) {
+ const key = Buffer.from('1ed2233fa2223ef5d7df08546049406c', 'hex');
+ const iv = Buffer.from('7305220bca40d4c90e1791e9', 'hex');
+@@ -546,7 +562,9 @@ for (const test of TEST_CASES) {
+ }
+
+ // Test that an IV length of 11 does not overflow max_message_size_.
+-{
++if (!ciphers.includes('aes-128-ccm')) {
++ common.printSkipMessage(`unsupported aes-128-ccm test`);
++} else {
+ const key = 'x'.repeat(16);
+ const iv = Buffer.from('112233445566778899aabb', 'hex');
+ const options = { authTagLength: 8 };
+@@ -563,6 +581,10 @@ for (const test of TEST_CASES) {
+ const iv = Buffer.from('0123456789ab', 'utf8');
+
+ for (const mode of ['gcm', 'ocb']) {
++ if (!ciphers.includes(`aes-128-${mode}`)) {
++ common.printSkipMessage(`unsupported aes-128-${mode} test`);
++ continue;
++ }
+ for (const authTagLength of mode === 'gcm' ? [undefined, 8] : [8]) {
+ const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, {
+ authTagLength
+@@ -597,6 +619,10 @@ for (const test of TEST_CASES) {
+ const opts = { authTagLength: 8 };
+
+ for (const mode of ['gcm', 'ccm', 'ocb']) {
++ if (!ciphers.includes(`aes-128-${mode}`)) {
++ common.printSkipMessage(`unsupported aes-128-${mode} test`);
++ continue;
++ }
+ const cipher = crypto.createCipheriv(`aes-128-${mode}`, key, iv, opts);
+ const ciphertext = Buffer.concat([cipher.update(plain), cipher.final()]);
+ const tag = cipher.getAuthTag();
+@@ -619,7 +645,9 @@ for (const test of TEST_CASES) {
+ // Test chacha20-poly1305 rejects invalid IV lengths of 13, 14, 15, and 16 (a
+ // length of 17 or greater was already rejected).
+ // - https://www.openssl.org/news/secadv/20190306.txt
+-{
++if (!ciphers.includes('chacha20-poly1305')) {
++ common.printSkipMessage(`unsupported chacha20-poly1305 test`);
++} else {
+ // Valid extracted from TEST_CASES, check that it detects IV tampering.
+ const valid = {
+ algo: 'chacha20-poly1305',
+@@ -664,6 +692,9 @@ for (const test of TEST_CASES) {
+
+ {
+ // CCM cipher without data should not crash, see https://github.com/nodejs/node/issues/38035.
++ common.printSkipMessage(`unsupported aes-128-ccm test`);
++ return;
++
+ const algo = 'aes-128-ccm';
+ const key = Buffer.alloc(16);
+ const iv = Buffer.alloc(12);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js
new file mode 100644
index 0000000000..ea77f621fc
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-certificate.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-certificate.js
+@@ -40,8 +40,10 @@ function copyArrayBuffer(buf) {
+ }
+
+ function checkMethods(certificate) {
+-
++ /* spkacValid has a md5 based signature which is not allowed in boringssl
++ https://boringssl.googlesource.com/boringssl/+/33d7e32ce40c04e8f1b99c05964956fda187819f
+ assert.strictEqual(certificate.verifySpkac(spkacValid), true);
++ */
+ assert.strictEqual(certificate.verifySpkac(spkacFail), false);
+
+ assert.strictEqual(
+@@ -56,10 +58,12 @@ function checkMethods(certificate) {
+ );
+ assert.strictEqual(certificate.exportChallenge(spkacFail), '');
+
++ /* spkacValid has a md5 based signature which is not allowed in boringssl
+ const ab = copyArrayBuffer(spkacValid);
+ assert.strictEqual(certificate.verifySpkac(ab), true);
+ assert.strictEqual(certificate.verifySpkac(new Uint8Array(ab)), true);
+ assert.strictEqual(certificate.verifySpkac(new DataView(ab)), true);
++ */
+ }
+
+ {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js
new file mode 100644
index 0000000000..9d186f43ae
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js
@@ -0,0 +1,113 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-cipher-decipher.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-cipher-decipher.js
+@@ -22,7 +22,7 @@ common.expectWarning({
+ function testCipher1(key) {
+ // Test encryption and decryption
+ const plaintext = 'Keep this a secret? No! Tell everyone about node.js!';
+- const cipher = crypto.createCipher('aes192', key);
++ const cipher = crypto.createCipher('aes-192-cbc', key);
+
+ // Encrypt plaintext which is in utf8 format
+ // to a ciphertext which will be in hex
+@@ -30,7 +30,7 @@ function testCipher1(key) {
+ // Only use binary or hex, not base64.
+ ciph += cipher.final('hex');
+
+- const decipher = crypto.createDecipher('aes192', key);
++ const decipher = crypto.createDecipher('aes-192-cbc', key);
+ let txt = decipher.update(ciph, 'hex', 'utf8');
+ txt += decipher.final('utf8');
+
+@@ -40,11 +40,11 @@ function testCipher1(key) {
+ // NB: In real life, it's not guaranteed that you can get all of it
+ // in a single read() like this. But in this case, we know it's
+ // quite small, so there's no harm.
+- const cStream = crypto.createCipher('aes192', key);
++ const cStream = crypto.createCipher('aes-192-cbc', key);
+ cStream.end(plaintext);
+ ciph = cStream.read();
+
+- const dStream = crypto.createDecipher('aes192', key);
++ const dStream = crypto.createDecipher('aes-192-cbc', key);
+ dStream.end(ciph);
+ txt = dStream.read().toString('utf8');
+
+@@ -59,14 +59,14 @@ function testCipher2(key) {
+ '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' +
+ 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' +
+ 'jAfaFg**';
+- const cipher = crypto.createCipher('aes256', key);
++ const cipher = crypto.createCipher('aes-256-cbc', key);
+
+ // Encrypt plaintext which is in utf8 format to a ciphertext which will be in
+ // Base64.
+ let ciph = cipher.update(plaintext, 'utf8', 'base64');
+ ciph += cipher.final('base64');
+
+- const decipher = crypto.createDecipher('aes256', key);
++ const decipher = crypto.createDecipher('aes-256-cbc', key);
+ let txt = decipher.update(ciph, 'base64', 'utf8');
+ txt += decipher.final('utf8');
+
+@@ -170,7 +170,7 @@ testCipher2(Buffer.from('0123456789abcde
+ // Regression test for https://github.com/nodejs/node-v0.x-archive/issues/5482:
+ // string to Cipher#update() should not assert.
+ {
+- const c = crypto.createCipher('aes192', '0123456789abcdef');
++ const c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
+ c.update('update');
+ c.final();
+ }
+@@ -178,15 +178,15 @@ testCipher2(Buffer.from('0123456789abcde
+ // https://github.com/nodejs/node-v0.x-archive/issues/5655 regression tests,
+ // 'utf-8' and 'utf8' are identical.
+ {
+- let c = crypto.createCipher('aes192', '0123456789abcdef');
++ let c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
+ c.update('update', ''); // Defaults to "utf8".
+ c.final('utf-8'); // Should not throw.
+
+- c = crypto.createCipher('aes192', '0123456789abcdef');
++ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
+ c.update('update', 'utf8');
+ c.final('utf-8'); // Should not throw.
+
+- c = crypto.createCipher('aes192', '0123456789abcdef');
++ c = crypto.createCipher('aes-192-cbc', '0123456789abcdef');
+ c.update('update', 'utf-8');
+ c.final('utf8'); // Should not throw.
+ }
+@@ -195,23 +195,23 @@ testCipher2(Buffer.from('0123456789abcde
+ {
+ const key = '0123456789abcdef';
+ const plaintext = 'Top secret!!!';
+- const c = crypto.createCipher('aes192', key);
++ const c = crypto.createCipher('aes-192-cbc', key);
+ let ciph = c.update(plaintext, 'utf16le', 'base64');
+ ciph += c.final('base64');
+
+- let decipher = crypto.createDecipher('aes192', key);
++ let decipher = crypto.createDecipher('aes-192-cbc', key);
+
+ let txt;
+ txt = decipher.update(ciph, 'base64', 'ucs2');
+ txt += decipher.final('ucs2');
+ assert.strictEqual(txt, plaintext);
+
+- decipher = crypto.createDecipher('aes192', key);
++ decipher = crypto.createDecipher('aes-192-cbc', key);
+ txt = decipher.update(ciph, 'base64', 'ucs-2');
+ txt += decipher.final('ucs-2');
+ assert.strictEqual(txt, plaintext);
+
+- decipher = crypto.createDecipher('aes192', key);
++ decipher = crypto.createDecipher('aes-192-cbc', key);
+ txt = decipher.update(ciph, 'base64', 'utf-16le');
+ txt += decipher.final('utf-16le');
+ assert.strictEqual(txt, plaintext);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js
new file mode 100644
index 0000000000..0a31cebf05
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-cipheriv-decipheriv.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-cipheriv-decipheriv.js
+@@ -60,6 +60,10 @@ function testCipher2(key, iv) {
+
+
+ function testCipher3(key, iv) {
++ if (!crypto.getCiphers().includes('id-aes128-wrap')) {
++ common.printSkipMessage(`unsupported id-aes128-wrap test`);
++ return;
++ }
+ // Test encryption and decryption with explicit key and iv.
+ // AES Key Wrap test vector comes from RFC3394
+ const plaintext = Buffer.from('00112233445566778899AABBCCDDEEFF', 'hex');
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js
new file mode 100644
index 0000000000..08bfa0bbc7
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-classes.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-classes.js
+@@ -22,8 +22,8 @@ const TEST_CASES = {
+ };
+
+ if (!common.hasFipsCrypto) {
+- TEST_CASES.Cipher = ['aes192', 'secret'];
+- TEST_CASES.Decipher = ['aes192', 'secret'];
++ TEST_CASES.Cipher = ['aes-192-cbc', 'secret'];
++ TEST_CASES.Decipher = ['aes-192-cbc', 'secret'];
+ TEST_CASES.DiffieHellman = [common.hasOpenSSL3 ? 1024 : 256];
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js
new file mode 100644
index 0000000000..2065454aa9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-dh-curves.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-dh-curves.js
+@@ -16,7 +16,7 @@ const p = 'FFFFFFFFFFFFFFFFC90FDAA22168C
+ crypto.createDiffieHellman(p, 'hex');
+
+ // Confirm DH_check() results are exposed for optional examination.
+-const bad_dh = crypto.createDiffieHellman('02', 'hex');
++const bad_dh = crypto.createDiffieHellman('abcd', 'hex', 0);
+ assert.notStrictEqual(bad_dh.verifyError, 0);
+
+ const availableCurves = new Set(crypto.getCurves());
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
new file mode 100644
index 0000000000..7681b79234
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-dh-errors.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-dh-errors.js
+@@ -32,9 +32,9 @@ for (const bits of [-1, 0, 1]) {
+ });
+ } else {
+ assert.throws(() => crypto.createDiffieHellman(bits), {
+- code: 'ERR_OSSL_BN_BITS_TOO_SMALL',
++ code: /ERR_OSSL_BN_BITS_TOO_SMALL|ERR_OSSL_DH_MODULUS_TOO_LARGE/,
+ name: 'Error',
+- message: /bits too small/,
++ message: /bits too small|BITS_TOO_SMALL|MODULUS_TOO_LARGE/,
+ });
+ }
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js
new file mode 100644
index 0000000000..c411047bb2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js
@@ -0,0 +1,54 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-dh.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-dh.js
+@@ -55,18 +55,17 @@ const crypto = require('crypto');
+ let wrongBlockLength;
+ if (common.hasOpenSSL3) {
+ wrongBlockLength = {
+- message: 'error:1C80006B:Provider routines::wrong final block length',
+- code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
+- library: 'Provider routines',
+- reason: 'wrong final block length'
++ message: /error:1C80006B:Provider routines::wrong final block length|error:1e00007b:Cipher functions:OPENSSL_internal:WRONG_FINAL_BLOCK_LENGTH/,
++ code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/,
++ library: /digital envelope routines|Cipher functions/,
++ reason: /wrong final block length|WRONG_FINAL_BLOCK_LENGTH/
+ };
+ } else {
+ wrongBlockLength = {
+- message: 'error:0606506D:digital envelope' +
+- ' routines:EVP_DecryptFinal_ex:wrong final block length',
+- code: 'ERR_OSSL_EVP_WRONG_FINAL_BLOCK_LENGTH',
+- library: 'digital envelope routines',
+- reason: 'wrong final block length'
++ message: /error:0606506D:digital envelope routines:EVP_DecryptFinal_ex:wrong final block length|error:1e00007b:Cipher functions:OPENSSL_internal:WRONG_FINAL_BLOCK_LENGTH/,
++ code: /ERR_OSSL_(EVP_)?WRONG_FINAL_BLOCK_LENGTH/,
++ library: /digital envelope routines|Cipher functions/,
++ reason: /wrong final block length|WRONG_FINAL_BLOCK_LENGTH/
+ };
+ }
+
+@@ -100,10 +99,16 @@ const crypto = require('crypto');
+ // Through a fluke of history, g=0 defaults to DH_GENERATOR (2).
+ {
+ const g = 0;
+- crypto.createDiffieHellman('abcdef', g);
++ assert.throws(() => crypto.createDiffieHellman('abcdef', g), {
++ code: /INVALID_PARAMETERS/,
++ name: 'Error'
++ });
+ crypto.createDiffieHellman('abcdef', 'hex', g);
+ }
+
+ {
+- crypto.createDiffieHellman('abcdef', Buffer.from([2])); // OK
++ assert.throws(() => crypto.createDiffieHellman('abcdef', Buffer.from([2])), {
++ code: /INVALID_PARAMETERS/,
++ name: 'Error'
++ });
+ }
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js
new file mode 100644
index 0000000000..7d4957c24b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-getcipherinfo.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-getcipherinfo.js
+@@ -62,9 +62,13 @@ assert(getCipherInfo('aes-128-cbc', { iv
+
+ assert(!getCipherInfo('aes-128-ccm', { ivLength: 1 }));
+ assert(!getCipherInfo('aes-128-ccm', { ivLength: 14 }));
++/*
+ for (let n = 7; n <= 13; n++)
+ assert(getCipherInfo('aes-128-ccm', { ivLength: n }));
++*/
+
+ assert(!getCipherInfo('aes-128-ocb', { ivLength: 16 }));
++/*
+ for (let n = 1; n < 16; n++)
+ assert(getCipherInfo('aes-128-ocb', { ivLength: n }));
++*/
+\ No newline at end of file
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js
new file mode 100644
index 0000000000..88c6e7206f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-hash-stream-pipe.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-hash-stream-pipe.js
+@@ -30,11 +30,11 @@ const crypto = require('crypto');
+
+ const stream = require('stream');
+ const s = new stream.PassThrough();
+-const h = crypto.createHash('sha3-512');
+-const expect = '36a38a2a35e698974d4e5791a3f05b05' +
+- '198235381e864f91a0e8cd6a26b677ec' +
+- 'dcde8e2b069bd7355fabd68abd6fc801' +
+- '19659f25e92f8efc961ee3a7c815c758';
++const h = crypto.createHash('sha512');
++const expect = 'fba055c6fd0c5b6645407749ed7a8b41' +
++ 'b8f629f2163c3ca3701d864adabda1f8' +
++ '93c37bf82b22fdd151ba8e357f611da4' +
++ '88a74b6a5525dd9b69554c6ce5138ad7';
+
+ s.pipe(h).on('data', common.mustCall(function(c) {
+ assert.strictEqual(c, expect);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js
new file mode 100644
index 0000000000..984a51205b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-hash.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-hash.js
+@@ -183,6 +183,7 @@ assert.throws(
+
+ // Test XOF hash functions and the outputLength option.
+ {
++ /*
+ // Default outputLengths. Since OpenSSL 3.4 an outputLength is mandatory
+ if (!hasOpenSSL(3, 4)) {
+ assert.strictEqual(crypto.createHash('shake128').digest('hex'),
+@@ -239,6 +240,7 @@ assert.throws(
+ assert.strictEqual(superLongHash.length, 2 * 1024 * 1024);
+ assert.ok(superLongHash.endsWith('193414035ddba77bf7bba97981e656ec'));
+ assert.ok(superLongHash.startsWith('a2a28dbc49cfd6e5d6ceea3d03e77748'));
++ */
+
+ // Non-XOF hash functions should accept valid outputLength options as well.
+ assert.strictEqual(crypto.createHash('sha224', { outputLength: 28 })
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js
new file mode 100644
index 0000000000..32406910f9
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-hkdf.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-hkdf.js
+@@ -124,8 +124,6 @@ const algorithms = [
+ ['sha256', '', 'salt', '', 10],
+ ['sha512', 'secret', 'salt', '', 15],
+ ];
+-if (!common.hasOpenSSL3)
+- algorithms.push(['whirlpool', 'secret', '', 'info', 20]);
+
+ algorithms.forEach(([ hash, secret, salt, info, length ]) => {
+ {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js
new file mode 100644
index 0000000000..fd34c182c1
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-padding.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-padding.js
+@@ -87,10 +87,9 @@ assert.throws(function() {
+ code: 'ERR_OSSL_WRONG_FINAL_BLOCK_LENGTH',
+ reason: 'wrong final block length',
+ } : {
+- message: 'error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:' +
+- 'data not multiple of block length',
+- code: 'ERR_OSSL_EVP_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH',
+- reason: 'data not multiple of block length',
++ message: /error:0607F08A:digital envelope routines:EVP_EncryptFinal_ex:data not multiple of block length|error:1e00006a:Cipher functions:OPENSSL_internal:DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/,
++ code: /ERR_OSSL(_EVP)?_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/,
++ reason: /data not multiple of block length|DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH/,
+ }
+ );
+
+@@ -114,10 +113,9 @@ assert.throws(function() {
+ reason: 'bad decrypt',
+ code: 'ERR_OSSL_BAD_DECRYPT',
+ } : {
+- message: 'error:06065064:digital envelope routines:EVP_DecryptFinal_ex:' +
+- 'bad decrypt',
+- reason: 'bad decrypt',
+- code: 'ERR_OSSL_EVP_BAD_DECRYPT',
++ message: /error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt|error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT/,
++ reason: /bad decrypt|BAD_DECRYPT/,
++ code: /ERR_OSSL(_EVP)?_BAD_DECRYPT/,
+ });
+
+ // No-pad encrypted string should return the same:
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js
new file mode 100644
index 0000000000..3b0a3b762d
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-rsa-dsa.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-rsa-dsa.js
+@@ -28,12 +28,11 @@ const dsaPkcs8KeyPem = fixtures.readKey(
+ const ec = new TextEncoder();
+
+ const openssl1DecryptError = {
+- message: 'error:06065064:digital envelope routines:EVP_DecryptFinal_ex:' +
+- 'bad decrypt',
+- code: 'ERR_OSSL_EVP_BAD_DECRYPT',
+- reason: 'bad decrypt',
+- function: 'EVP_DecryptFinal_ex',
+- library: 'digital envelope routines',
++ message: /error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt|error:1e000065:Cipher functions:OPENSSL_internal:BAD_DECRYPT/,
++ code: /ERR_OSSL(_EVP)?_BAD_DECRYPT/,
++ reason: /bad decrypt|BAD_DECRYPT/,
++ function: /EVP_DecryptFinal_ex|OPENSSL_internal/,
++ library: /digital envelope routines|Cipher functions/,
+ };
+
+ const decryptError = common.hasOpenSSL3 ?
+@@ -222,7 +221,8 @@ function test_rsa(padding, encryptOaepHa
+ }, bufferToEncrypt);
+
+
+- if (padding === constants.RSA_PKCS1_PADDING) {
++ // BoringSSL does not support RSA_PKCS1_PADDING.
++ if (false) {
+ if (!process.config.variables.node_shared_openssl) {
+ assert.throws(() => {
+ crypto.privateDecrypt({
+@@ -466,7 +466,7 @@ assert.throws(() => {
+ assert.strictEqual(verify2.verify(publicKey, signature, 'hex'), true);
+ }
+
+-
++/*
+ //
+ // Test DSA signing and verification
+ //
+@@ -541,3 +541,4 @@ const input = 'I AM THE WALRUS';
+
+ assert.strictEqual(verify.verify(dsaPubPem, signature, 'hex'), true);
+ }
++*/
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js
new file mode 100644
index 0000000000..c7f8d22563
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-scrypt.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-scrypt.js
+@@ -178,7 +178,7 @@ for (const options of bad) {
+
+ for (const options of toobig) {
+ const expected = {
+- message: /Invalid scrypt params:.*memory limit exceeded/,
++ message: /Invalid scrypt params/,
+ code: 'ERR_CRYPTO_INVALID_SCRYPT_PARAMS',
+ };
+ assert.throws(() => crypto.scrypt('pass', 'salt', 1, options, () => {}),
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js
new file mode 100644
index 0000000000..f1e401bfb5
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js
@@ -0,0 +1,68 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-sign-verify.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-sign-verify.js
+@@ -28,6 +28,7 @@ const keySize = 2048;
+ 'instance when called without `new`');
+ }
+
++/*
+ // Test handling of exceptional conditions
+ {
+ const library = {
+@@ -68,6 +69,7 @@ const keySize = 2048;
+
+ delete Object.prototype.opensslErrorStack;
+ }
++*/
+
+ assert.throws(
+ () => crypto.createVerify('SHA256').verify({
+@@ -341,15 +343,17 @@ assert.throws(
+ padding: crypto.constants.RSA_PKCS1_OAEP_PADDING
+ });
+ }, common.hasOpenSSL3 ? {
+- code: 'ERR_OSSL_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
+- message: /illegal or unsupported padding mode/,
++ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
++ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
+ } : {
+- code: 'ERR_OSSL_RSA_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE',
+- message: /illegal or unsupported padding mode/,
++ code: /^ERR_OSSL_(RSA|EVP)_ILLEGAL_OR_UNSUPPORTED_PADDING_MODE$/,
++ message: /illegal or unsupported padding mode|ILLEGAL_OR_UNSUPPORTED_PADDING_MODE/,
++ /*
+ opensslErrorStack: [
+ 'error:06089093:digital envelope routines:EVP_PKEY_CTX_ctrl:' +
+ 'command not supported',
+ ],
++ */
+ });
+ }
+
+@@ -419,10 +423,12 @@ assert.throws(
+ public: fixtures.readKey('ed25519_public.pem', 'ascii'),
+ algo: null,
+ sigLen: 64 },
++ /*
+ { private: fixtures.readKey('ed448_private.pem', 'ascii'),
+ public: fixtures.readKey('ed448_public.pem', 'ascii'),
+ algo: null,
+ sigLen: 114 },
++ */
+ { private: fixtures.readKey('rsa_private_2048.pem', 'ascii'),
+ public: fixtures.readKey('rsa_public_2048.pem', 'ascii'),
+ algo: 'sha1',
+@@ -493,7 +499,7 @@ assert.throws(
+
+ {
+ const data = Buffer.from('Hello world');
+- const keys = [['ec-key.pem', 64], ['dsa_private_1025.pem', 40]];
++ const keys = [['ec-key.pem', 64]/*, ['dsa_private_1025.pem', 40]*/];
+
+ for (const [file, length] of keys) {
+ const privKey = fixtures.readKey(file);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js
new file mode 100644
index 0000000000..afc86ed5d2
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-stream.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-stream.js
+@@ -76,10 +76,10 @@ cipher.pipe(decipher)
+ library: 'Provider routines',
+ reason: 'bad decrypt',
+ } : {
+- message: /bad decrypt/,
+- function: 'EVP_DecryptFinal_ex',
+- library: 'digital envelope routines',
+- reason: 'bad decrypt',
++ message: /bad decrypt|BAD_DECRYPT/,
++ function: /EVP_DecryptFinal_ex|OPENSSL_internal/,
++ library: /digital envelope routines|Cipher functions/,
++ reason: /bad decrypt|BAD_DECRYPT/,
+ }));
+
+ cipher.end('Papaya!'); // Should not cause an unhandled exception.
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
new file mode 100644
index 0000000000..112c145cbf
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto-x509.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-x509.js
+@@ -323,6 +323,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ legacyObjectCheck.serialNumberPattern);
+ }
+
++/*
+ {
+ // This X.509 Certificate can be parsed by OpenSSL because it contains a
+ // structurally sound TBSCertificate structure. However, the SPKI field of the
+@@ -361,3 +362,4 @@ UcXd/5qu2GhokrKU2cPttU+XAN2Om6a0
+
+ assert.strictEqual(cert.checkIssued(cert), false);
+ }
++*/
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto.js
new file mode 100644
index 0000000000..a66daa9ad5
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-crypto.js
@@ -0,0 +1,94 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-crypto.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto.js
+@@ -67,7 +67,7 @@ assert.throws(() => {
+ // Throws general Error, so there is no opensslErrorStack property.
+ return err instanceof Error &&
+ err.name === 'Error' &&
+- /^Error: mac verify failure$/.test(err) &&
++ (/^Error: (mac verify failure|INCORRECT_PASSWORD)$/.test(err)) &&
+ !('opensslErrorStack' in err);
+ });
+
+@@ -77,7 +77,7 @@ assert.throws(() => {
+ // Throws general Error, so there is no opensslErrorStack property.
+ return err instanceof Error &&
+ err.name === 'Error' &&
+- /^Error: mac verify failure$/.test(err) &&
++ (/^Error: (mac verify failure|INCORRECT_PASSWORD)$/.test(err)) &&
+ !('opensslErrorStack' in err);
+ });
+
+@@ -87,7 +87,7 @@ assert.throws(() => {
+ // Throws general Error, so there is no opensslErrorStack property.
+ return err instanceof Error &&
+ err.name === 'Error' &&
+- /^Error: not enough data$/.test(err) &&
++ /^Error: (not enough data|BAD_PKCS12_DATA)$/.test(err) &&
+ !('opensslErrorStack' in err);
+ });
+
+@@ -150,8 +150,6 @@ assert(crypto.getHashes().includes('sha1
+ assert(crypto.getHashes().includes('sha256'));
+ assert(!crypto.getHashes().includes('SHA1'));
+ assert(!crypto.getHashes().includes('SHA256'));
+-assert(crypto.getHashes().includes('RSA-SHA1'));
+-assert(!crypto.getHashes().includes('rsa-sha1'));
+ validateList(crypto.getHashes());
+ // Make sure all of the hashes are supported by OpenSSL
+ for (const algo of crypto.getHashes())
+@@ -188,7 +186,7 @@ const encodingError = {
+ // hex input that's not a power of two should throw, not assert in C++ land.
+ ['createCipher', 'createDecipher'].forEach((funcName) => {
+ assert.throws(
+- () => crypto[funcName]('aes192', 'test').update('0', 'hex'),
++ () => crypto[funcName]('aes-192-cbc', 'test').update('0', 'hex'),
+ (error) => {
+ assert.ok(!('opensslErrorStack' in error));
+ if (common.hasFipsCrypto) {
+@@ -219,7 +217,7 @@ assert.throws(
+ return true;
+ }
+ );
+-
++/*
+ assert.throws(() => {
+ const priv = [
+ '-----BEGIN RSA PRIVATE KEY-----',
+@@ -232,6 +230,7 @@ assert.throws(() => {
+ ].join('\n');
+ crypto.createSign('SHA256').update('test').sign(priv);
+ }, (err) => {
++ console.log(err)
+ if (!common.hasOpenSSL3)
+ assert.ok(!('opensslErrorStack' in err));
+ assert.throws(() => { throw err; }, common.hasOpenSSL3 ? {
+@@ -240,10 +239,10 @@ assert.throws(() => {
+ library: 'rsa routines',
+ } : {
+ name: 'Error',
+- message: /routines:RSA_sign:digest too big for rsa key$/,
+- library: 'rsa routines',
+- function: 'RSA_sign',
+- reason: 'digest too big for rsa key',
++ message: /routines:RSA_sign:digest too big for rsa key$|routines:OPENSSL_internal:DIGEST_TOO_BIG_FOR_RSA_KEY$/,
++ library: /rsa routines|RSA routines/,
++ function: /RSA_sign|OPENSSL_internal/,
++ reason: /digest too big for rsa key|DIGEST_TOO_BIG_FOR_RSA_KEY/,
+ code: 'ERR_OSSL_RSA_DIGEST_TOO_BIG_FOR_RSA_KEY'
+ });
+ return true;
+@@ -276,7 +275,7 @@ if (!common.hasOpenSSL3) {
+ return true;
+ });
+ }
+-
++*/
+ // Make sure memory isn't released before being returned
+ console.log(crypto.randomBytes(16));
+
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs
new file mode 100644
index 0000000000..eb79ac9891
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-debugger-address.mjs.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-debugger-address.mjs
+@@ -56,6 +56,7 @@ function launchTarget(...args) {
+ const { childProc, host, port } = await launchTarget('--inspect=0', script);
+ target = childProc;
+ cli = startCLI([`${host || '127.0.0.1'}:${port}`]);
++ await new Promise(resolve => setTimeout(resolve, 1000));
+ await cli.waitForPrompt();
+ await cli.command('sb("alive.js", 3)');
+ await cli.waitFor(/break/);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js
new file mode 100644
index 0000000000..dda4ce6631
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-debugger-break.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-debugger-break.js
+@@ -27,7 +27,7 @@ const cli = startCLI(['--port=0', script
+
+ await cli.stepCommand('n');
+ assert.ok(
+- cli.output.includes(`break in ${script}:2`),
++ cli.output.includes(`step in ${script}:2`),
+ 'pauses in next line of the script');
+ assert.match(
+ cli.output,
+@@ -36,7 +36,7 @@ const cli = startCLI(['--port=0', script
+
+ await cli.stepCommand('next');
+ assert.ok(
+- cli.output.includes(`break in ${script}:3`),
++ cli.output.includes(`step in ${script}:3`),
+ 'pauses in next line of the script');
+ assert.match(
+ cli.output,
+@@ -89,7 +89,7 @@ const cli = startCLI(['--port=0', script
+ await cli.stepCommand('');
+ assert.match(
+ cli.output,
+- /break in node:timers/,
++ /step in node:timers/,
+ 'entered timers.js');
+
+ await cli.stepCommand('cont');
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js
new file mode 100644
index 0000000000..25f9a30611
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-debugger-random-port-with-inspect-port.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-debugger-random-port-with-inspect-port.js
+@@ -13,6 +13,7 @@ const script = fixtures.path('debugger',
+ const cli = startCLI(['--inspect-port=0', script]);
+
+ (async () => {
++ await new Promise(resolve => setTimeout(resolve, 1000));
+ await cli.waitForInitialBreak();
+ await cli.waitForPrompt();
+ assert.match(cli.output, /debug>/, 'prints a prompt');
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js
new file mode 100644
index 0000000000..87492e8a6c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-debugger-run-after-quit-restart.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-debugger-run-after-quit-restart.js
+@@ -25,7 +25,7 @@ const path = require('path');
+ .then(() => cli.stepCommand('n'))
+ .then(() => {
+ assert.ok(
+- cli.output.includes(`break in ${script}:2`),
++ cli.output.includes(`step in ${script}:2`),
+ 'steps to the 2nd line'
+ );
+ })
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js
new file mode 100644
index 0000000000..367b73ed19
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-fs-write.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-fs-write.js
+@@ -38,7 +38,7 @@ const constants = fs.constants;
+ const { externalizeString, isOneByteString } = global;
+
+ // Account for extra globals exposed by --expose_externalize_string.
+-common.allowGlobals(externalizeString, isOneByteString, global.x);
++common.allowGlobals(createExternalizableString, externalizeString, isOneByteString, global.x);
+
+ {
+ const expected = 'ümlaut sechzig'; // Must be a unique string.
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js
new file mode 100644
index 0000000000..29ff165bf3
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-https-agent-additional-options.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-https-agent-additional-options.js
+@@ -13,7 +13,7 @@ const options = {
+ cert: fixtures.readKey('agent1-cert.pem'),
+ ca: fixtures.readKey('ca1-cert.pem'),
+ minVersion: 'TLSv1.1',
+- ciphers: 'ALL@SECLEVEL=0'
++ // ciphers: 'ALL@SECLEVEL=0'
+ };
+
+ const server = https.Server(options, (req, res) => {
+@@ -28,7 +28,7 @@ function getBaseOptions(port) {
+ ca: options.ca,
+ rejectUnauthorized: true,
+ servername: 'agent1',
+- ciphers: 'ALL@SECLEVEL=0'
++ // ciphers: 'ALL@SECLEVEL=0'
+ };
+ }
+
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js
new file mode 100644
index 0000000000..f14a27223b
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-https-agent-session-eviction.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-https-agent-session-eviction.js
+@@ -14,7 +14,7 @@ const options = {
+ key: readKey('agent1-key.pem'),
+ cert: readKey('agent1-cert.pem'),
+ secureOptions: SSL_OP_NO_TICKET,
+- ciphers: 'RSA@SECLEVEL=0'
++ // ciphers: 'RSA@SECLEVEL=0'
+ };
+
+ // Create TLS1.2 server
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs
new file mode 100644
index 0000000000..c511649ffc
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-node-output-errors.mjs.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-node-output-errors.mjs
+@@ -3,6 +3,7 @@ import * as fixtures from '../common/fix
+ import * as snapshot from '../common/assertSnapshot.js';
+ import * as os from 'node:os';
+ import { describe, it } from 'node:test';
++import { basename } from 'node:path';
+ import { pathToFileURL } from 'node:url';
+
+ const skipForceColors =
+@@ -20,13 +21,15 @@ function replaceForceColorsStackTrace(st
+
+ describe('errors output', { concurrency: true }, () => {
+ function normalize(str) {
++ const baseName = basename(process.argv0 || 'node', '.exe');
+ return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
+ .replaceAll(pathToFileURL(process.cwd()).pathname, '')
+ .replaceAll('//', '*')
+ .replaceAll(/\/(\w)/g, '*$1')
+ .replaceAll('*test*', '*')
+ .replaceAll('*fixtures*errors*', '*')
+- .replaceAll('file:**', 'file:*/');
++ .replaceAll('file:**', 'file:*/')
++ .replaceAll(`${baseName} --`, '* --');
+ }
+
+ function normalizeNoNumbers(str) {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-eval.mjs b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-eval.mjs
new file mode 100644
index 0000000000..b4175389f8
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-eval.mjs
@@ -0,0 +1,37 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-node-output-eval.mjs.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-node-output-eval.mjs
+@@ -1,6 +1,7 @@
+ import '../common/index.mjs';
+ import * as fixtures from '../common/fixtures.mjs';
+ import * as snapshot from '../common/assertSnapshot.js';
++import { basename } from 'node:path';
+ import { describe, it } from 'node:test';
+
+ describe('eval output', { concurrency: true }, () => {
+@@ -14,13 +15,19 @@ describe('eval output', { concurrency: t
+ normalize,
+ snapshot.replaceWindowsLineEndings,
+ snapshot.replaceWindowsPaths,
+- snapshot.replaceNodeVersion
++ snapshot.replaceNodeVersion,
++ generalizeProcessName,
+ );
+
+ function removeStackTraces(output) {
+ return output.replaceAll(/^ *at .+$/gm, '');
+ }
+
++ function generalizeProcessName(output) {
++ const baseName = basename(process.argv0 || 'node', '.exe');
++ return output.replaceAll(`${baseName} --`, '* --');
++ }
++
+ const tests = [
+ { name: 'eval/eval_messages.js' },
+ { name: 'eval/stdin_messages.js' },
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs
new file mode 100644
index 0000000000..632c433800
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-node-output-v8-warning.mjs.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-node-output-v8-warning.mjs
+@@ -2,11 +2,18 @@ import '../common/index.mjs';
+ import * as fixtures from '../common/fixtures.mjs';
+ import * as snapshot from '../common/assertSnapshot.js';
+ import { describe, it } from 'node:test';
++import { basename } from 'node:path';
+
+ function replaceNodeVersion(str) {
+ return str.replaceAll(process.version, '*');
+ }
+
++function replaceExecName(str) {
++ // Copied from lib/internal/process/warning.js
++ const baseName = basename(process.argv0 || 'node', '.exe');
++ return str.replaceAll(`${baseName} --`, '* --');
++}
++
+ describe('v8 output', { concurrency: true }, () => {
+ function normalize(str) {
+ return str.replaceAll(snapshot.replaceWindowsPaths(process.cwd()), '')
+@@ -15,10 +22,10 @@ describe('v8 output', { concurrency: tru
+ .replaceAll('*test*', '*')
+ .replaceAll(/.*?\*fixtures\*v8\*/g, '(node:*) V8: *') // Replace entire path before fixtures/v8
+ .replaceAll('*fixtures*v8*', '*')
+- .replaceAll('node --', '* --');
+ }
++
+ const common = snapshot
+- .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion);
++ .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceNodeVersion, replaceExecName);
+ const defaultTransform = snapshot.transform(common, normalize);
+ const tests = [
+ { name: 'v8/v8_warning.js' },
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js
new file mode 100644
index 0000000000..949b3aac5c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-tls-getprotocol.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-tls-getprotocol.js
+@@ -27,7 +27,7 @@ const clientConfigs = [
+
+ const serverConfig = {
+ secureProtocol: 'TLS_method',
+- ciphers: 'RSA@SECLEVEL=0',
++ // ciphers: 'RSA@SECLEVEL=0',
+ key: fixtures.readKey('agent2-key.pem'),
+ cert: fixtures.readKey('agent2-cert.pem')
+ };
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js
new file mode 100644
index 0000000000..c5953b2fb6
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-tls-write-error.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-tls-write-error.js
+@@ -17,7 +17,7 @@ const server_cert = fixtures.readKey('ag
+ const opts = {
+ key: server_key,
+ cert: server_cert,
+- ciphers: 'ALL@SECLEVEL=0'
++ // ciphers: 'ALL@SECLEVEL=0'
+ };
+
+ const server = https.createServer(opts, (req, res) => {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js
new file mode 100644
index 0000000000..23be5a3812
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-v8-stats.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-v8-stats.js
+@@ -48,6 +48,10 @@ const expectedHeapSpaces = [
+ 'read_only_space',
+ 'shared_large_object_space',
+ 'shared_space',
++ 'shared_trusted_large_object_space',
++ 'shared_trusted_space',
++ 'trusted_large_object_space',
++ 'trusted_space'
+ ];
+ const heapSpaceStatistics = v8.getHeapSpaceStatistics();
+ const actualHeapSpaceNames = heapSpaceStatistics.map((s) => s.space_name);
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js
new file mode 100644
index 0000000000..ac8f200433
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-webcrypto-derivebits.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-webcrypto-derivebits.js
+@@ -101,6 +101,7 @@ const { subtle } = globalThis.crypto;
+ tests.then(common.mustCall());
+ }
+
++/*
+ // Test X25519 and X448 bit derivation
+ {
+ async function test(name) {
+@@ -126,3 +127,4 @@ const { subtle } = globalThis.crypto;
+ test('X25519').then(common.mustCall());
+ test('X448').then(common.mustCall());
+ }
++*/
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js
new file mode 100644
index 0000000000..a85babbc6a
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-webcrypto-derivekey.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-webcrypto-derivekey.js
+@@ -175,6 +175,7 @@ const { KeyObject } = require('crypto');
+ })().then(common.mustCall());
+ }
+
++/*
+ // Test X25519 and X448 key derivation
+ {
+ async function test(name) {
+@@ -209,3 +210,4 @@ const { KeyObject } = require('crypto');
+ test('X25519').then(common.mustCall());
+ test('X448').then(common.mustCall());
+ }
++*/
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js
new file mode 100644
index 0000000000..e511b8b571
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-webcrypto-sign-verify.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-webcrypto-sign-verify.js
+@@ -105,6 +105,7 @@ const { subtle } = globalThis.crypto;
+ test('hello world').then(common.mustCall());
+ }
+
++/*
+ // Test Sign/Verify Ed25519
+ {
+ async function test(data) {
+@@ -144,3 +145,4 @@ const { subtle } = globalThis.crypto;
+
+ test('hello world').then(common.mustCall());
+ }
++*/
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js
new file mode 100644
index 0000000000..1f485f4f9e
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-webcrypto-wrap-unwrap.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-webcrypto-wrap-unwrap.js
+@@ -18,14 +18,15 @@ const kWrappingData = {
+ wrap: { label: new Uint8Array(8) },
+ pair: true
+ },
+- 'AES-CTR': {
++ 'AES-CBC': {
+ generate: { length: 128 },
+- wrap: { counter: new Uint8Array(16), length: 64 },
++ wrap: { iv: new Uint8Array(16) },
+ pair: false
+ },
+- 'AES-CBC': {
++ /*
++ 'AES-CTR': {
+ generate: { length: 128 },
+- wrap: { iv: new Uint8Array(16) },
++ wrap: { counter: new Uint8Array(16), length: 64 },
+ pair: false
+ },
+ 'AES-GCM': {
+@@ -42,6 +43,7 @@ const kWrappingData = {
+ wrap: { },
+ pair: false
+ }
++ */
+ };
+
+ function generateWrappingKeys() {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js
new file mode 100644
index 0000000000..9810d3b1eb
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-worker-unsupported-things.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-worker-unsupported-things.js
+@@ -14,14 +14,16 @@ if (!process.env.HAS_STARTED_WORKER) {
+ } else {
+ {
+ const before = process.title;
+- process.title += ' in worker';
+- assert.strictEqual(process.title, before);
++ const after = before + ' in worker';
++ process.title = after;
++ assert.strictEqual(process.title, after);
+ }
+
+ {
+ const before = process.debugPort;
+- process.debugPort++;
+- assert.strictEqual(process.debugPort, before);
++ const after = before + 1;
++ process.debugPort = after;
++ assert.strictEqual(process.debugPort, after);
+ }
+
+ {
diff --git a/electron34/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js b/electron34/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js
new file mode 100644
index 0000000000..66718a178c
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/parallel/test-x509-escaping.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/parallel/test-x509-escaping.js
+@@ -447,7 +447,7 @@ const { hasOpenSSL3 } = common;
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }),
+ undefined);
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }),
+- servername);
++ undefined);
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }),
+ undefined);
+
+@@ -482,11 +482,11 @@ const { hasOpenSSL3 } = common;
+ assert.strictEqual(certX509.subjectAltName, 'IP Address:1.2.3.4');
+
+ // The newer X509Certificate API allows customizing this behavior:
+- assert.strictEqual(certX509.checkHost(servername), servername);
++ assert.strictEqual(certX509.checkHost(servername), undefined);
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'default' }),
+- servername);
++ undefined);
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'always' }),
+- servername);
++ undefined);
+ assert.strictEqual(certX509.checkHost(servername, { subject: 'never' }),
+ undefined);
+
diff --git a/electron34/patches/patch-third__party_electron__node_test_sequential_sequential.status b/electron34/patches/patch-third__party_electron__node_test_sequential_sequential.status
new file mode 100644
index 0000000000..ff83b23e49
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_sequential_sequential.status
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/sequential/sequential.status.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/sequential/sequential.status
+@@ -7,6 +7,18 @@ prefix sequential
+ [true] # This section applies to all platforms
+ # https://github.com/nodejs/node/issues/27611#issuecomment-613100468
+ test-cpu-prof-dir-worker: PASS, FLAKY
++test-cpu-prof-dir-and-name: PASS, FLAKY
++test-cpu-prof-drained: PASS, FLAKY
++test-cpu-prof-default: PASS, FLAKY
++test-cpu-prof-dir-absolute: PASS, FLAKY
++test-cpu-prof-dir-relative: PASS, FLAKY
++test-cpu-prof-exit: PASS, FLAKY
++test-cpu-prof-kill: PASS, FLAKY
++test-cpu-prof-name: PASS, FLAKY
++test-cpu-prof-worker-argv: PASS, FLAKY
++test-diagnostic-dir-cpu-prof: PASS, FLAKY
++test-worker-prof: PASS, FLAKY
++test-inspector-stop-profile-after-done: PASS, FLAKY
+ # https://github.com/nodejs/node/issues/44898
+ test-watch-mode: PASS, FLAKY
+ test-watch-mode-inspect: PASS, FLAKY
diff --git a/electron34/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js b/electron34/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js
new file mode 100644
index 0000000000..dc206a50c6
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/sequential/test-debugger-pid.js.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/sequential/test-debugger-pid.js
+@@ -20,6 +20,7 @@ const runTest = async () => {
+ await cli.command('sb("alive.js", 3)');
+ await cli.waitFor(/break/);
+ await cli.waitForPrompt();
++ await new Promise(resolve => setTimeout(resolve, 1000));
+ assert.match(
+ cli.output,
+ /> 3 {3}\+\+x;/,
diff --git a/electron34/patches/patch-third__party_electron__node_test_wpt_status_streams.json b/electron34/patches/patch-third__party_electron__node_test_wpt_status_streams.json
new file mode 100644
index 0000000000..3b09866f02
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_test_wpt_status_streams.json
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/test/wpt/status/streams.json.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/test/wpt/status/streams.json
+@@ -53,7 +53,9 @@
+ "fail": {
+ "expected": [
+ "Transferring [object TransformStream],[object ReadableStream] should fail",
+- "Transferring [object TransformStream],[object WritableStream] should fail"
++ "Transferring [object TransformStream],[object WritableStream] should fail",
++ "Transferring [object ReadableStream],[object TransformStream] should fail",
++ "Transferring [object WritableStream],[object TransformStream] should fail"
+ ]
+ }
+ },
diff --git a/electron34/patches/patch-third__party_electron__node_tools_generate__gn__filenames__json.py b/electron34/patches/patch-third__party_electron__node_tools_generate__gn__filenames__json.py
new file mode 100644
index 0000000000..8468ca0479
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_tools_generate__gn__filenames__json.py
@@ -0,0 +1,126 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/tools/generate_gn_filenames_json.py.orig 2025-05-24 17:57:53.635416417 +0000
++++ third_party/electron_node/tools/generate_gn_filenames_json.py
+@@ -0,0 +1,117 @@
++#!@PYTHONBIN@
++import json
++import os
++import sys
++
++import install
++
++from utils import SearchFiles
++
++def LoadPythonDictionary(path):
++ file_string = open(path).read()
++ try:
++ file_data = eval(file_string, {'__builtins__': None}, None)
++ except SyntaxError as e:
++ e.filename = path
++ raise
++ except Exception as e:
++ raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
++
++ assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
++
++ return file_data
++
++
++FILENAMES_JSON_HEADER = '''
++// This file is automatically generated by generate_gn_filenames_json.py
++// DO NOT EDIT
++'''.lstrip()
++
++SRC_DIR = os.path.abspath(os.path.join(__file__, '..', '..', '..', '..'))
++
++def get_out_dir():
++ out_dir = 'Testing'
++ override = os.environ.get('ELECTRON_OUT_DIR')
++ if override is not None:
++ out_dir = override
++ return os.path.join(SRC_DIR, 'out', out_dir)
++
++if __name__ == '__main__':
++ node_root_dir = os.path.dirname(os.path.dirname(__file__))
++ node_gyp_path = os.path.join(node_root_dir, 'node.gyp')
++ out = {}
++ node_gyp = LoadPythonDictionary(node_gyp_path)
++ node_lib_target = next(
++ t for t in node_gyp['targets']
++ if t['target_name'] == '<(node_lib_target_name)')
++ node_source_blocklist = {
++ '<@(library_files)',
++ '<@(deps_files)',
++ '<@(node_sources)',
++ 'common.gypi',
++ '<(SHARED_INTERMEDIATE_DIR)/node_javascript.cc',
++ }
++
++ def filter_v8_files(files):
++ v8_files = [f for f in files if f.startswith('deps/v8/')]
++ other_files = [f for f in files if not f.startswith('deps/v8/')]
++
++ for i, f in enumerate(v8_files):
++ if not f.startswith('deps/v8/tools'):
++ if f.endswith('js'):
++ v8_files[i] = f.replace('deps/v8/', '../../v8/', 1)
++ else:
++ v8_files[i] = f.replace('deps/v8/', '//v8/')
++
++ if any(f == '<@(node_builtin_shareable_builtins)' for f in other_files):
++ other_files.remove('<@(node_builtin_shareable_builtins)')
++ shared_builtins = ['deps/cjs-module-lexer/lexer.js', 'deps/cjs-module-lexer/dist/lexer.js', 'deps/undici/undici.js']
++ other_files.extend(shared_builtins)
++
++ return v8_files + other_files
++
++ def filter_fs_files(files):
++ return [f for f in files if f.startswith('lib/internal/fs/')] + ['lib/fs.js'] + ['lib/fs/promises.js']
++
++ lib_files = SearchFiles('lib', 'js')
++ out['library_files'] = filter_v8_files(lib_files)
++ out['library_files'] += filter_v8_files(node_gyp['variables']['deps_files'])
++ out['node_sources'] = node_gyp['variables']['node_sources']
++
++ out['fs_files'] = filter_fs_files(out['library_files'])
++ # fs files are handled separately
++ out['library_files'] = [f for f in out['library_files'] if f not in out['fs_files']]
++
++ blocklisted_sources = [
++ f for f in node_lib_target['sources']
++ if f not in node_source_blocklist]
++ out['node_sources'] += filter_v8_files(blocklisted_sources)
++
++ out['headers'] = []
++ def add_headers(options, files, dest_dir):
++ if 'src/node.h' in files:
++ files = [f for f in files if f.endswith('.h') and f != 'src/node_version.h']
++ elif any(f.startswith('../../v8/') for f in files):
++ files = [f.replace('../../v8/', '//v8/', 1) for f in files]
++ if files:
++ dir_index = next((i for i, d in enumerate(out['headers']) if d['dest_dir'] == dest_dir), -1)
++ if (dir_index != -1):
++ out['headers'][dir_index]['files'] += sorted(files)
++ else:
++ hs = {'files': sorted(files), 'dest_dir': dest_dir}
++ out['headers'].append(hs)
++
++ config_gypi_path = os.path.join(get_out_dir(), 'gen', 'config.gypi')
++ root_gen_dir = os.path.join(node_root_dir, 'out', 'Release', 'gen')
++
++ options = install.parse_options(['install', '--v8-dir', '../../v8', '--config-gypi-path', config_gypi_path, '--headers-only'])
++ options.variables['node_use_openssl'] = 'false'
++ options.variables['node_shared_libuv'] = 'false'
++ # We generate zlib headers in Electron's BUILD.gn.
++ options.variables['node_shared_zlib'] = ''
++
++ install.headers(options, add_headers)
++ with open(os.path.join(node_root_dir, 'filenames.json'), 'w') as f:
++ f.write(FILENAMES_JSON_HEADER)
++ f.write(json.dumps(out, sort_keys=True, indent=2, separators=(',', ': ')))
++ f.write('\n')
diff --git a/electron34/patches/patch-third__party_electron__node_tools_generate__original__fs.py b/electron34/patches/patch-third__party_electron__node_tools_generate__original__fs.py
new file mode 100644
index 0000000000..6115011d42
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_tools_generate__original__fs.py
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/tools/generate_original_fs.py.orig 2025-05-24 17:57:53.635556487 +0000
++++ third_party/electron_node/tools/generate_original_fs.py
+@@ -0,0 +1,18 @@
++import os
++import sys
++
++node_root_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
++out_dir = sys.argv[1]
++fs_files = sys.argv[2:]
++
++for fs_file in fs_files:
++ with open(os.path.join(node_root_dir, fs_file), 'r') as f:
++ contents = f.read()
++ original_fs_file = fs_file.replace('internal/fs/', 'internal/original-fs/').replace('lib/fs.js', 'lib/original-fs.js').replace('lib/fs/', 'lib/original-fs/')
++
++ with open(os.path.join(out_dir, fs_file), 'w') as original_f:
++ original_f.write(contents)
++
++ with open(os.path.join(out_dir, original_fs_file), 'w') as transformed_f:
++ transformed_contents = contents.replace('internal/fs/', 'internal/original-fs/').replace('require(\'fs', 'require(\'original-fs')
++ transformed_f.write(transformed_contents)
diff --git a/electron34/patches/patch-third__party_electron__node_tools_install.py b/electron34/patches/patch-third__party_electron__node_tools_install.py
new file mode 100644
index 0000000000..215efe4bfc
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_tools_install.py
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/tools/install.py.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/tools/install.py
+@@ -270,6 +270,7 @@ def headers(options, action):
+ 'include/v8-forward.h',
+ 'include/v8-function-callback.h',
+ 'include/v8-function.h',
++ 'include/v8-handle-base.h',
+ 'include/v8-initialization.h',
+ 'include/v8-internal.h',
+ 'include/v8-isolate.h',
+@@ -290,6 +291,8 @@ def headers(options, action):
+ 'include/v8-promise.h',
+ 'include/v8-proxy.h',
+ 'include/v8-regexp.h',
++ "include/v8-sandbox.h",
++ "include/v8-source-location.h",
+ 'include/v8-script.h',
+ 'include/v8-snapshot.h',
+ 'include/v8-statistics.h',
+@@ -396,7 +399,7 @@ def parse_options(args):
+ parser.add_argument('--build-dir', help='the location of built binaries',
+ default='out/Release')
+ parser.add_argument('--v8-dir', help='the location of V8',
+- default='deps/v8')
++ default='../../v8')
+ parser.add_argument('--config-gypi-path', help='the location of config.gypi',
+ default='config.gypi')
+ parser.add_argument('--is-win', help='build for Windows target',
diff --git a/electron34/patches/patch-third__party_electron__node_tools_js2c.cc b/electron34/patches/patch-third__party_electron__node_tools_js2c.cc
new file mode 100644
index 0000000000..e6dac4a56f
--- /dev/null
+++ b/electron34/patches/patch-third__party_electron__node_tools_js2c.cc
@@ -0,0 +1,155 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/electron_node/tools/js2c.cc.orig 2025-04-18 18:41:29.000000000 +0000
++++ third_party/electron_node/tools/js2c.cc
+@@ -30,6 +30,7 @@ namespace js2c {
+ int Main(int argc, char* argv[]);
+
+ static bool is_verbose = false;
++static bool only_js = false;
+
+ void Debug(const char* format, ...) {
+ va_list arguments;
+@@ -196,6 +197,7 @@ const char* kTemplate = R"(
+ #include "node_builtins.h"
+ #include "node_external_reference.h"
+ #include "node_internals.h"
++#include "node_threadsafe_cow-inl.h"
+
+ namespace node {
+
+@@ -211,7 +213,11 @@ const ThreadsafeCopyOnWrite<BuiltinSourc
+ } // anonymous namespace
+
+ void BuiltinLoader::LoadJavaScriptSource() {
+- source_ = global_source_map;
++ BuiltinSourceMap map = *source_.read();
++ BuiltinSourceMap new_map = *global_source_map.read();
++
++ map.merge(new_map);
++ source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
+ }
+
+ void RegisterExternalReferencesForInternalizedBuiltinCode(
+@@ -228,6 +234,45 @@ UnionBytes BuiltinLoader::GetConfig() {
+ } // namespace node
+ )";
+
++const char* kEmbedderTemplate = R"(
++#include "env-inl.h"
++#include "node_builtins.h"
++#include "node_external_reference.h"
++#include "node_internals.h"
++#include "node_threadsafe_cow-inl.h"
++
++namespace node {
++
++namespace builtins {
++
++%.*s
++namespace {
++const ThreadsafeCopyOnWrite<BuiltinSourceMap> global_source_map {
++ BuiltinSourceMap {
++%.*s
++ } // BuiltinSourceMap
++
++}; // ThreadsafeCopyOnWrite
++} // anonymous namespace
++
++void BuiltinLoader::LoadEmbedderJavaScriptSource() {
++ BuiltinSourceMap map = *source_.read();
++ BuiltinSourceMap new_map = *global_source_map.read();
++
++ map.merge(new_map);
++ source_ = ThreadsafeCopyOnWrite<BuiltinSourceMap>(map);
++}
++
++void EmbedderRegisterExternalReferencesForInternalizedBuiltinCode(
++ ExternalReferenceRegistry* registry) {
++%.*s
++}
++
++} // namespace builtins
++
++} // namespace node
++)";
++
+ Fragment Format(const Fragments& definitions,
+ const Fragments& initializers,
+ const Fragments& registrations) {
+@@ -237,13 +282,12 @@ Fragment Format(const Fragments& definit
+ size_t init_size = init_buf.size();
+ std::vector<char> reg_buf = Join(registrations, "\n");
+ size_t reg_size = reg_buf.size();
+-
+- size_t result_size =
+- def_size + init_size + reg_size + strlen(kTemplate) + 100;
++ size_t result_size = def_size + init_size + reg_size +
++ strlen(only_js ? kEmbedderTemplate: kTemplate) + 300;
+ std::vector<char> result(result_size, 0);
+ int r = snprintf(result.data(),
+ result_size,
+- kTemplate,
++ only_js ? kEmbedderTemplate: kTemplate,
+ static_cast<int>(def_buf.size()),
+ def_buf.data(),
+ static_cast<int>(init_buf.size()),
+@@ -834,12 +878,15 @@ int JS2C(const FileList& js_files,
+ }
+ }
+
++ if (!only_js) {
+ assert(FilenameIsConfigGypi(config));
+ // "config.gypi" -> config_raw.
+ int r = AddGypi("config", config, &definitions);
+ if (r != 0) {
+ return r;
+ }
++ }
++
+ Fragment out = Format(definitions, initializers, registrations);
+ return WriteIfChanged(out, dest);
+ }
+@@ -865,6 +912,8 @@ int Main(int argc, char* argv[]) {
+ std::string arg(argv[i]);
+ if (arg == "--verbose") {
+ is_verbose = true;
++ } else if (arg == "--only-js") {
++ only_js = true;
+ } else if (arg == "--root") {
+ if (i == argc - 1) {
+ fprintf(stderr, "--root must be followed by a path\n");
+@@ -913,6 +962,14 @@ int Main(int argc, char* argv[]) {
+ }
+ }
+
++ if (only_js) {
++ auto js_it = file_map.find(".js");
++
++ assert(file_map.size() == 1);
++ assert(js_it != file_map.end());
++
++ return JS2C(js_it->second, FileList(), std::string(), output);
++ } else {
+ // Should have exactly 3 types: `.js`, `.mjs` and `.gypi`.
+ assert(file_map.size() == 3);
+ auto gypi_it = file_map.find(".gypi");
+@@ -932,6 +989,7 @@ int Main(int argc, char* argv[]) {
+ std::sort(mjs_it->second.begin(), mjs_it->second.end());
+
+ return JS2C(js_it->second, mjs_it->second, gypi_it->second[0], output);
++ }
+ }
+ } // namespace js2c
+ } // namespace node
+@@ -940,4 +998,4 @@ NODE_MAIN(int argc, node::argv_type raw_
+ char** argv;
+ node::FixupMain(argc, raw_argv, &argv);
+ return node::js2c::Main(argc, argv);
+-}
++}
+\ No newline at end of file
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg
new file mode 100644
index 0000000000..e8af426bbc
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/chromium-browser-clang/rewrapper_mac.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/chromium-browser-clang/rewrapper_mac.cfg
+@@ -14,6 +14,5 @@
+
+ # This config is merged with Chromium config. See README.md.
+
+-inputs={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+-toolchain_inputs={linux_clang_base_path}/bin/clang
++toolchain_inputs={linux_clang_base_path}/bin/clang,{src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+ remote_wrapper={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg
new file mode 100644
index 0000000000..1b76470f24
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/chromium-browser-clang/rewrapper_windows.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/chromium-browser-clang/rewrapper_windows.cfg
+@@ -15,6 +15,5 @@
+ # This config is merged with Chromium config. See README.md.
+
+ server_address=pipe://reproxy.pipe
+-inputs={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+-toolchain_inputs={linux_clang_base_path}/bin/clang
++toolchain_inputs={linux_clang_base_path}/bin/clang,{src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
+ remote_wrapper={src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/clang_remote_wrapper
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py b/electron34/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py
new file mode 100644
index 0000000000..7ad9ec1b68
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py
@@ -0,0 +1,82 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/configure_reclient.py.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/configure_reclient.py
+@@ -21,6 +21,7 @@ import os
+ import re
+ import runpy
+ import shutil
++import stat
+ import string
+ import subprocess
+ import sys
+@@ -109,6 +110,8 @@ class ReclientConfigurator:
+ self.download_linux_clang_toolchain()
+ self.generate_clang_remote_wrapper()
+
++ self.generate_python_remote_wrapper()
++
+ # Reproxy config includes auth and network-related parameters.
+ self.generate_reproxy_cfg()
+ # Rewrapper configs describe how different tools should be run remotely.
+@@ -199,6 +202,32 @@ class ReclientConfigurator:
+ (f'{Paths.src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/'
+ 'clang_remote_wrapper'), clang_remote_wrapper)
+
++ FileUtils.chmod_x((f'{Paths.src_dir}/buildtools/reclient_cfgs/chromium-browser-clang/'
++ 'clang_remote_wrapper'))
++
++ @staticmethod
++ def generate_python_remote_wrapper():
++ # Load python remote wrapper template.
++ template_file = (f'{Paths.script_dir}/python/'
++ 'python_remote_wrapper.template')
++ python_remote_wrapper_template = FileUtils.read_text_file(template_file)
++
++ # Variables to set in the template.
++ template_vars = {
++ }
++
++ # Substitute variables into the template.
++ python_remote_wrapper = ShellTemplate(
++ python_remote_wrapper_template).substitute(template_vars)
++
++ # Write the python remote wrapper.
++ FileUtils.write_text_file(
++ (f'{Paths.src_dir}/buildtools/reclient_cfgs/python/'
++ 'python_remote_wrapper'), python_remote_wrapper)
++
++ FileUtils.chmod_x((f'{Paths.src_dir}/buildtools/reclient_cfgs/python/'
++ 'python_remote_wrapper'))
++
+ def generate_reproxy_cfg(self):
+ # Load Chromium config template and remove everything starting with $
+ # symbol on each line.
+@@ -268,6 +297,11 @@ class ReclientConfigurator:
+ f'{Paths.reclient_cfgs_dir}/{tool}/rewrapper_{host_os}.cfg',
+ rewrapper_cfg, source_cfg_paths)
+
++ # Write "large" configs to the expected location.
++ ReclientCfg.write_to_file(
++ f'{Paths.reclient_cfgs_dir}/{tool}/rewrapper_{host_os}_large.cfg',
++ rewrapper_cfg, source_cfg_paths)
++
+
+ class Paths:
+ script_dir = ''
+@@ -537,6 +571,11 @@ class FileUtils:
+ shutil.move(filepath_new, filepath)
+
+ @classmethod
++ def chmod_x(cls, filepath):
++ st = os.stat(filepath)
++ os.chmod(filepath, st.st_mode | stat.S_IEXEC)
++
++ @classmethod
+ def create_generated_header(cls, source_files):
+ if not isinstance(source_files, (list, tuple)):
+ source_files = (source_files, )
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_python_python__remote__wrapper.template b/electron34/patches/patch-third__party_engflow-reclient-configs_python_python__remote__wrapper.template
new file mode 100644
index 0000000000..53d2cb6ac1
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_python_python__remote__wrapper.template
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/python/python_remote_wrapper.template.orig 2025-05-24 17:57:53.636364664 +0000
++++ third_party/engflow-reclient-configs/python/python_remote_wrapper.template
+@@ -0,0 +1,29 @@
++#!@SH@
++# Copyright (c) 2023 Contributors to the reclient-configs project. All rights reserved.
++#
++# Licensed under the Apache License, Version 2.0 (the "License");
++# you may not use this file except in compliance with the License.
++# You may obtain a copy of the License at
++#
++# http://www.apache.org/licenses/LICENSE-2.0
++#
++# Unless required by applicable law or agreed to in writing, software
++# distributed under the License is distributed on an "AS IS" BASIS,
++# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
++# See the License for the specific language governing permissions and
++# limitations under the License.
++
++# AUTOGENERATED FILE - DO NOT EDIT
++# Generated by:
++# {configurator_dir}/configure_reclient.py
++# To edit update:
++# {configurator_dir}/python/python_remote_wrapper.template
++# And rerun configurator.
++
++# WARNING: This file is a part of reclient action inputs. Any modification will
++# invalidate remote cache.
++
++set -e
++
++# Launch
++"$1" "${@:2}"
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg
new file mode 100644
index 0000000000..a0c8d31979
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/python/rewrapper_linux.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/python/rewrapper_linux.cfg
+@@ -13,3 +13,6 @@
+ # limitations under the License.
+
+ # This config is merged with Chromium config. See README.md.
++
++toolchain_inputs=buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper={src_dir}/buildtools/reclient_cfgs/python/python_remote_wrapper
+\ No newline at end of file
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg
new file mode 100644
index 0000000000..2a0aaa72ed
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/python/rewrapper_mac.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/python/rewrapper_mac.cfg
+@@ -13,3 +13,6 @@
+ # limitations under the License.
+
+ # This config is merged with Chromium config. See README.md.
++
++toolchain_inputs=buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper={src_dir}/buildtools/reclient_cfgs/python/python_remote_wrapper
+\ No newline at end of file
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg
new file mode 100644
index 0000000000..e6b08026a9
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg
@@ -0,0 +1,14 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/python/rewrapper_windows.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/python/rewrapper_windows.cfg
+@@ -15,3 +15,5 @@
+ # This config is merged with Chromium config. See README.md.
+
+ server_address=pipe://reproxy.pipe
++toolchain_inputs={src_dir}/buildtools/reclient_cfgs/python/python_remote_wrapper
++remote_wrapper={src_dir}/buildtools/reclient_cfgs/python/python_remote_wrapper
diff --git a/electron34/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg b/electron34/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg
new file mode 100644
index 0000000000..c4ef76d990
--- /dev/null
+++ b/electron34/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg
@@ -0,0 +1,13 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/engflow-reclient-configs/reproxy.cfg.orig 2023-12-20 16:48:43.000000000 +0000
++++ third_party/engflow-reclient-configs/reproxy.cfg
+@@ -17,3 +17,4 @@
+ # Unset Chromium variables.
+ service=
+ automatic_auth=
++compression_threshold=
diff --git a/electron34/patches/patch-third__party_ffmpeg_BUILD.gn b/electron34/patches/patch-third__party_ffmpeg_BUILD.gn
new file mode 100644
index 0000000000..ecae2352d9
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_BUILD.gn
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/BUILD.gn
+@@ -350,7 +350,6 @@ target(link_target_type, "ffmpeg_interna
+ libs += [
+ "m",
+ "z",
+- "rt",
+ ]
+ }
+ if (is_component_ffmpeg) {
+@@ -448,7 +447,7 @@ if (is_component_ffmpeg) {
+
+ if (!is_component_build) {
+ if (is_mac) {
+- ldflags += [ "-Wl,-install_name,@rpath/libffmpeg.dylib" ]
++ ldflags += [ "-Wl,-install_name,@loader_path/libffmpeg.dylib" ]
+ } else if (is_linux) {
+ all_dependent_configs =
+ [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
diff --git a/electron34/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h b/electron34/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h
new file mode 100644
index 0000000000..4839c79b4d
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/libavcodec/x86/cabac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/libavcodec/x86/cabac.h
+@@ -31,7 +31,8 @@
+
+ #if (defined(__i386) && defined(__clang__) && (__clang_major__<2 || (__clang_major__==2 && __clang_minor__<10)))\
+ || ( !defined(__clang__) && defined(__llvm__) && __GNUC__==4 && __GNUC_MINOR__==2 && __GNUC_PATCHLEVEL__<=1)\
+- || (defined(__INTEL_COMPILER) && defined(_MSC_VER))
++ || (defined(__INTEL_COMPILER) && defined(_MSC_VER)) \
++ || ((defined(__FreeBSD__) || defined(__OpenBSD__)) && defined(__i386))
+ # define BROKEN_COMPILER 1
+ #else
+ # define BROKEN_COMPILER 0
diff --git a/electron34/patches/patch-third__party_ffmpeg_libavutil_cpu.c b/electron34/patches/patch-third__party_ffmpeg_libavutil_cpu.c
new file mode 100644
index 0000000000..b80d123569
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_libavutil_cpu.c
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/libavutil/cpu.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/libavutil/cpu.c
+@@ -38,10 +38,7 @@
+ #if HAVE_GETPROCESSAFFINITYMASK || HAVE_WINRT
+ #include <windows.h>
+ #endif
+-#if HAVE_SYSCTL
+-#if HAVE_SYS_PARAM_H
+-#include <sys/param.h>
+-#endif
++#if HAVE_SYSCTL && !defined(__OpenBSD__)
+ #include <sys/types.h>
+ #include <sys/sysctl.h>
+ #endif
diff --git a/electron34/patches/patch-third__party_ffmpeg_libavutil_mem.c b/electron34/patches/patch-third__party_ffmpeg_libavutil_mem.c
new file mode 100644
index 0000000000..baf6fbfe2c
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_libavutil_mem.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/libavutil/mem.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/libavutil/mem.c
+@@ -33,9 +33,6 @@
+ #include <stdlib.h>
+ #include <stdatomic.h>
+ #include <string.h>
+-#if HAVE_MALLOC_H
+-#include <malloc.h>
+-#endif
+
+ #include "attributes.h"
+ #include "avassert.h"
diff --git a/electron34/patches/patch-third__party_ffmpeg_libavutil_random__seed.c b/electron34/patches/patch-third__party_ffmpeg_libavutil_random__seed.c
new file mode 100644
index 0000000000..f455bbb2e1
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_libavutil_random__seed.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/libavutil/random_seed.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/libavutil/random_seed.c
+@@ -20,6 +20,10 @@
+
+ #include "config.h"
+
++#if defined(__NetBSD__)
++#define _NETBSD_SOURCE 1
++#endif
++
+ #if HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
+@@ -35,6 +39,11 @@
+ #elif CONFIG_OPENSSL
+ #include <openssl/rand.h>
+ #endif
++#if HAVE_ARC4RANDOM_BUF
++#undef __BSD_VISIBLE
++#define __BSD_VISIBLE 1
++#include <stdlib.h>
++#endif
+ #include <fcntl.h>
+ #include <math.h>
+ #include <time.h>
diff --git a/electron34/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm b/electron34/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm
new file mode 100644
index 0000000000..c8c604c66c
--- /dev/null
+++ b/electron34/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ffmpeg/libavutil/x86/x86inc.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ffmpeg/libavutil/x86/x86inc.asm
+@@ -46,6 +46,12 @@
+ %endif
+ %endif
+
++%if ARCH_X86_64
++ %define _CET_ENDBR endbr64
++%else
++ %define _CET_ENDBR
++%endif
++
+ %define WIN64 0
+ %define UNIX64 0
+ %if ARCH_X86_64
+@@ -861,6 +867,7 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle,
+ %endif
+ align function_align
+ %2:
++ _CET_ENDBR
+ RESET_MM_PERMUTATION ; needed for x86-64, also makes disassembly somewhat nicer
+ %xdefine rstk rsp ; copy of the original stack pointer, used when greater alignment than the known stack alignment is required
+ %assign stack_offset 0 ; stack pointer offset relative to the return address
diff --git a/electron34/patches/patch-third__party_fontconfig_include_config.h b/electron34/patches/patch-third__party_fontconfig_include_config.h
new file mode 100644
index 0000000000..15ec9bbd6f
--- /dev/null
+++ b/electron34/patches/patch-third__party_fontconfig_include_config.h
@@ -0,0 +1,55 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/fontconfig/include/config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/fontconfig/include/config.h
+@@ -13,7 +13,7 @@
+
+ #define FC_CACHEDIR "/var/cache/fontconfig"
+
+-#define FC_DEFAULT_FONTS "\t<dir>/usr/share/fonts</dir>\n\t<dir>/usr/local/share/fonts</dir>\n"
++#define FC_DEFAULT_FONTS "\t<dir>/usr/X11R6/lib/X11/fonts</dir>"
+
+ #define FC_FONTPATH ""
+
+@@ -66,7 +66,7 @@
+
+ #define HAVE_MMAP 1
+
+-#define HAVE_POSIX_FADVISE 1
++#define HAVE_POSIX_FADVISE 0
+
+ #define HAVE_PTHREAD 1
+
+@@ -74,10 +74,13 @@
+
+ #define HAVE_RANDOM 1
+
+-#define HAVE_RANDOM_R 1
++/* #undef HAVE_RANDOM_R */
+
+ #define HAVE_RAND_R 1
+
++/* Define to 1 if you have the `arc4_random' function. */
++#define HAVE_ARC4RANDOM 1
++
+ #define HAVE_READLINK 1
+
+ #define HAVE_STDATOMIC_PRIMITIVES 1
+@@ -92,11 +95,11 @@
+
+ #define HAVE_SYS_PARAM_H 1
+
+-#define HAVE_SYS_STATFS_H 1
++/* #undef HAVE_SYS_STATFS_H */
+
+ #define HAVE_SYS_STATVFS_H 1
+
+-#define HAVE_SYS_VFS_H 1
++/* #undef HAVE_SYS_VFS_H */
+
+ #define HAVE_UNISTD_H 1
+
diff --git a/electron34/patches/patch-third__party_fontconfig_src_src_fccompat.c b/electron34/patches/patch-third__party_fontconfig_src_src_fccompat.c
new file mode 100644
index 0000000000..9693c7d28a
--- /dev/null
+++ b/electron34/patches/patch-third__party_fontconfig_src_src_fccompat.c
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/fontconfig/src/src/fccompat.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/fontconfig/src/src/fccompat.c
+@@ -184,7 +184,9 @@ FcRandom(void)
+ {
+ int32_t result;
+
+-#if HAVE_RANDOM_R
++#if HAVE_ARC4RANDOM
++ result = arc4random() & 0x7fffffff;
++#elif HAVE_RANDOM_R
+ static struct random_data fcrandbuf;
+ static char statebuf[256];
+ static FcBool initialized = FcFalse;
diff --git a/electron34/patches/patch-third__party_ipcz_src_reference__drivers_random.cc b/electron34/patches/patch-third__party_ipcz_src_reference__drivers_random.cc
new file mode 100644
index 0000000000..7b24fa1bec
--- /dev/null
+++ b/electron34/patches/patch-third__party_ipcz_src_reference__drivers_random.cc
@@ -0,0 +1,55 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ipcz/src/reference_drivers/random.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ipcz/src/reference_drivers/random.cc
+@@ -14,7 +14,8 @@
+ #include <windows.h>
+ #elif BUILDFLAG(IS_FUCHSIA)
+ #include <zircon/syscalls.h>
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)) && \
++ !BUILDFLAG(IS_NETBSD)
+ #include <asm/unistd.h>
+ #include <sys/syscall.h>
+ #include <unistd.h>
+@@ -25,7 +26,7 @@
+ #include <nacl/nacl_random.h>
+ #endif
+
+-#if BUILDFLAG(IS_POSIX)
++#if BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_NETBSD)
+ #include <errno.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -55,7 +56,7 @@ decltype(&ProcessPrng) GetProcessPrng()
+ }
+ #endif
+
+-#if defined(OS_POSIX) && !BUILDFLAG(IS_MAC)
++#if (defined(OS_POSIX) && !BUILDFLAG(IS_MAC)) || BUILDFLAG(IS_NETBSD)
+ void RandomBytesFromDevUrandom(absl::Span<uint8_t> destination) {
+ static int urandom_fd = [] {
+ for (;;) {
+@@ -86,7 +87,8 @@ void RandomBytes(absl::Span<uint8_t> des
+ process_prng_fn(destination.data(), destination.size());
+ #elif BUILDFLAG(IS_FUCHSIA)
+ zx_cprng_draw(destination.data(), destination.size());
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#elif (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)) && \
++ !BUILDFLAG(IS_NETBSD)
+ while (!destination.empty()) {
+ ssize_t result =
+ syscall(__NR_getrandom, destination.data(), destination.size(), 0);
+@@ -102,7 +104,7 @@ void RandomBytes(absl::Span<uint8_t> des
+ #elif BUILDFLAG(IS_MAC)
+ const bool ok = getentropy(destination.data(), destination.size()) == 0;
+ ABSL_ASSERT(ok);
+-#elif BUILDFLAG(IS_IOS)
++#elif BUILDFLAG(IS_IOS) || BUILDFLAG(IS_NETBSD)
+ RandomBytesFromDevUrandom(destination);
+ #elif BUILDFLAG(IS_NACL)
+ while (!destination.empty()) {
diff --git a/electron34/patches/patch-third__party_ipcz_src_standalone_base_logging.cc b/electron34/patches/patch-third__party_ipcz_src_standalone_base_logging.cc
new file mode 100644
index 0000000000..339c904913
--- /dev/null
+++ b/electron34/patches/patch-third__party_ipcz_src_standalone_base_logging.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/ipcz/src/standalone/base/logging.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/ipcz/src/standalone/base/logging.cc
+@@ -50,6 +50,9 @@ LogMessage::LogMessage(const char* file,
+ #elif BUILDFLAG(IS_ANDROID)
+ stream_ << getpid() << ":" << gettid() << ":";
+ const char* trimmed_file = strrchr(file, '/') + 1;
++#elif BUILDFLAG(IS_BSD)
++ stream_ << getpid() << ":" << pthread_self() << ":";
++ const char* trimmed_file = strrchr(file, '/') + 1;
+ #elif BUILDFLAG(IS_WIN)
+ const char* trimmed_file = file;
+ stream_ << (::GetCurrentProcessId()) << ":" << ::GetCurrentThreadId() << ":";
diff --git a/electron34/patches/patch-third__party_leveldatabase_env__chromium.cc b/electron34/patches/patch-third__party_leveldatabase_env__chromium.cc
new file mode 100644
index 0000000000..da8ec3e614
--- /dev/null
+++ b/electron34/patches/patch-third__party_leveldatabase_env__chromium.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/leveldatabase/env_chromium.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/leveldatabase/env_chromium.cc
+@@ -329,7 +329,8 @@ ChromiumWritableFile::ChromiumWritableFi
+
+ Status ChromiumWritableFile::SyncParent() {
+ TRACE_EVENT0("leveldb", "SyncParent");
+-#if defined(OS_POSIX) || defined(OS_FUCHSIA)
++// pledge violation (directory passed as fd)
++#if (defined(OS_POSIX) || defined(OS_FUCHSIA)) && !defined(OS_OPENBSD)
+ FilePath path = FilePath::FromUTF8Unsafe(parent_dir_);
+ FileErrorOr<base::File> result = filesystem_->OpenFile(
+ path, base::File::FLAG_OPEN | base::File::FLAG_READ);
diff --git a/electron34/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c b/electron34/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c
new file mode 100644
index 0000000000..29ed7b0312
--- /dev/null
+++ b/electron34/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c
@@ -0,0 +1,56 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libaom/source/libaom/aom_ports/aarch64_cpudetect.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libaom/source/libaom/aom_ports/aarch64_cpudetect.c
+@@ -127,10 +127,46 @@ static int arm_get_cpu_caps(void) {
+ return flags;
+ }
+
+-#elif defined(__linux__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
++#elif defined(__OpenBSD__)
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
++#include <machine/armreg.h>
++
++static int arm_get_cpu_caps(void) {
++ int flags = 0;
++ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 };
++ uint64_t cpu_id = 0;
++ size_t len = sizeof(cpu_id);
++
++ flags |= HAS_NEON; // Neon is mandatory in Armv8.0-A.
++
++ if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) < 0)
++ return flags;
++
++ if (ID_AA64ISAR0_CRC32(cpu_id) >= ID_AA64ISAR0_CRC32_BASE)
++ flags |= HAS_ARM_CRC32;
++
++ return flags;
++}
++
++#elif defined(__linux__) || defined(__FreeBSD__) // end defined(AOM_USE_ANDROID_CPU_FEATURES)
+
+ #include <sys/auxv.h>
+
++#if defined(__FreeBSD__)
++static unsigned long getauxval(unsigned long type)
++{
++ /* Only AT_HWCAP* return unsigned long */
++ if (type != AT_HWCAP && type != AT_HWCAP2) {
++ return 0;
++ }
++
++ unsigned long ret = 0;
++ elf_aux_info(type, &ret, sizeof(ret));
++ return ret;
++}
++#endif
++
+ // Define hwcap values ourselves: building with an old auxv header where these
+ // hwcap values are not defined should not prevent features from being enabled.
+ #define AOM_AARCH64_HWCAP_CRC32 (1 << 7)
diff --git a/electron34/patches/patch-third__party_libc++_src_src_chrono.cpp b/electron34/patches/patch-third__party_libc++_src_src_chrono.cpp
new file mode 100644
index 0000000000..d8920a8699
--- /dev/null
+++ b/electron34/patches/patch-third__party_libc++_src_src_chrono.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libc++/src/src/chrono.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libc++/src/src/chrono.cpp
+@@ -34,7 +34,7 @@
+ // OpenBSD and GPU do not have a fully conformant suite of POSIX timers, but
+ // it does have clock_gettime and CLOCK_MONOTONIC which is all we need.
+ #if defined(__APPLE__) || defined(__gnu_hurd__) || defined(__OpenBSD__) || defined(__AMDGPU__) || \
+- defined(__NVPTX__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
++ defined(__NVPTX__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) || defined(__FreeBSD__) || defined(__NetBSD__)
+ # define _LIBCPP_HAS_CLOCK_GETTIME
+ #endif
+
diff --git a/electron34/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp b/electron34/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp
new file mode 100644
index 0000000000..8cd46d9fff
--- /dev/null
+++ b/electron34/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libc++/src/src/filesystem/filesystem_clock.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libc++/src/src/filesystem/filesystem_clock.cpp
+@@ -30,7 +30,7 @@
+ #endif
+
+ #if defined(__APPLE__) || defined(__gnu_hurd__) || defined(__AMDGPU__) || defined(__NVPTX__) || \
+- (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
++ (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ # define _LIBCPP_HAS_CLOCK_GETTIME
+ #endif
+
diff --git a/electron34/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h b/electron34/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h
new file mode 100644
index 0000000000..6ed111a3eb
--- /dev/null
+++ b/electron34/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libc++abi/src/src/cxa_guard_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libc++abi/src/src/cxa_guard_impl.h
+@@ -425,6 +425,17 @@ void PlatformFutexWake(int* addr) {
+ __tsan_release(addr);
+ futex(reinterpret_cast<volatile uint32_t*>(addr), WAKE, INT_MAX, NULL, NULL);
+ }
++/*#elif defined(__NetBSD__)
++void PlatformFutexWait(int* addr, int expect) {
++ constexpr int WAIT = 0;
++ syscall(SYS___futex, addr, WAIT, expect, NULL, NULL, 0, 0);
++ __tsan_acquire(addr);
++}
++void PlatformFutexWake(int* addr) {
++ constexpr int WAKE = 1;
++ __tsan_release(addr);
++ syscall(SYS___futex, addr, WAKE, INT_MAX, NULL, NULL, 0, 0);
++}*/
+ #elif defined(SYS_futex)
+ void PlatformFutexWait(int* addr, int expect) {
+ constexpr int WAIT = 0;
diff --git a/electron34/patches/patch-third__party_libdrm_src_xf86drmMode.c b/electron34/patches/patch-third__party_libdrm_src_xf86drmMode.c
new file mode 100644
index 0000000000..bc76c56416
--- /dev/null
+++ b/electron34/patches/patch-third__party_libdrm_src_xf86drmMode.c
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libdrm/src/xf86drmMode.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libdrm/src/xf86drmMode.c
+@@ -976,7 +976,7 @@ drm_public int drmCheckModesettingSuppor
+ }
+ #elif defined(__DragonFly__)
+ return 0;
+-#elif defined(__OpenBSD__)
++#elif defined(__OpenBSD__) || defined(__NetBSD__)
+ int fd;
+ struct drm_mode_card_res res;
+ drmModeResPtr r = 0;
+@@ -1129,7 +1129,11 @@ drm_public int drmModePageFlipTarget(int
+
+ drm_public int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id,
+ uint32_t fb_id, uint32_t flags,
++#if defined(__NetBSD__)
++ uint32_t crtc_x, uint32_t crtc_y,
++#else
+ int32_t crtc_x, int32_t crtc_y,
++#endif
+ uint32_t crtc_w, uint32_t crtc_h,
+ uint32_t src_x, uint32_t src_y,
+ uint32_t src_w, uint32_t src_h)
diff --git a/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h
new file mode 100644
index 0000000000..137f348892
--- /dev/null
+++ b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libphonenumber/dist/cpp/src/phonenumbers/base/memory/singleton.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libphonenumber/dist/cpp/src/phonenumbers/base/memory/singleton.h
+@@ -22,7 +22,8 @@
+ #elif (__cplusplus >= 201103L) && defined(I18N_PHONENUMBERS_USE_STDMUTEX)
+ // C++11 Lock implementation based on std::mutex.
+ #include "phonenumbers/base/memory/singleton_stdmutex.h"
+-#elif defined(__linux__) || defined(__APPLE__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD)
++#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD)
+ #include "phonenumbers/base/memory/singleton_posix.h"
+ #elif defined(WIN32)
+ #include "phonenumbers/base/memory/singleton_win32.h"
diff --git a/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h
new file mode 100644
index 0000000000..35d7374239
--- /dev/null
+++ b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libphonenumber/dist/cpp/src/phonenumbers/base/synchronization/lock.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libphonenumber/dist/cpp/src/phonenumbers/base/synchronization/lock.h
+@@ -22,7 +22,8 @@
+ #elif (__cplusplus >= 201103L) && defined(I18N_PHONENUMBERS_USE_STDMUTEX)
+ // C++11 Lock implementation based on std::mutex.
+ #include "phonenumbers/base/synchronization/lock_stdmutex.h"
+-#elif defined(__linux__) || defined(__APPLE__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD)
++#elif defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD)
+ #include "phonenumbers/base/synchronization/lock_posix.h"
+ #elif defined(WIN32)
+ #include "phonenumbers/base/synchronization/lock_win32.h"
diff --git a/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h
new file mode 100644
index 0000000000..da0d2d9ef4
--- /dev/null
+++ b/electron34/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libphonenumber/dist/cpp/src/phonenumbers/base/thread_checker.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libphonenumber/dist/cpp/src/phonenumbers/base/thread_checker.h
+@@ -22,8 +22,8 @@
+ // Note that I18N_PHONENUMBERS_NO_THREAD_SAFETY must be defined only to let the
+ // user of the library know that it can't be used in a thread-safe manner when
+ // it is not depending on Boost.
+-#if !defined(__linux__) && !defined(__APPLE__) && !defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD) && \
+- !defined(I18N_PHONENUMBERS_NO_THREAD_SAFETY) && \
++#if !defined(__linux__) && !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD) && \
++ !defined(__NetBSD__) && !defined(I18N_PHONENUMBERS_NO_THREAD_SAFETY) && \
+ !((__cplusplus >= 201103L) && defined(I18N_PHONENUMBERS_USE_STDMUTEX)) && \
+ !defined(WIN32)
+ #error Building without Boost, please provide \
+@@ -33,7 +33,8 @@
+ #endif
+
+ #if !defined(NDEBUG) && !defined(I18N_PHONENUMBERS_USE_BOOST) && \
+- (defined(__linux__) || defined(__APPLE__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD))
++ (defined(__linux__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__) || \
++ defined(__NetBSD__) || defined(I18N_PHONENUMBERS_HAVE_POSIX_THREAD))
+
+ #include <pthread.h>
+
diff --git a/electron34/patches/patch-third__party_libsync_src_include_sync_sync.h b/electron34/patches/patch-third__party_libsync_src_include_sync_sync.h
new file mode 100644
index 0000000000..8a3448e0b6
--- /dev/null
+++ b/electron34/patches/patch-third__party_libsync_src_include_sync_sync.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libsync/src/include/sync/sync.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libsync/src/include/sync/sync.h
+@@ -22,7 +22,9 @@
+ #include <sys/cdefs.h>
+ #include <stdint.h>
+
++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+ #include <linux/types.h>
++#endif
+
+ __BEGIN_DECLS
+
diff --git a/electron34/patches/patch-third__party_libsync_src_sync.c b/electron34/patches/patch-third__party_libsync_src_sync.c
new file mode 100644
index 0000000000..27a1634cab
--- /dev/null
+++ b/electron34/patches/patch-third__party_libsync_src_sync.c
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libsync/src/sync.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libsync/src/sync.c
+@@ -17,8 +17,8 @@
+ */
+
+ #include <fcntl.h>
+-#include <malloc.h>
+ #include <stdint.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
+ #include <poll.h>
+@@ -29,6 +29,12 @@
+
+ #include <sync/sync.h>
+
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++typedef __uint8_t __u8;
++typedef __uint32_t __u32;
++typedef __int32_t __s32;
++#define ETIME ETIMEDOUT
++#endif
+
+ struct sw_sync_create_fence_data {
+ __u32 value;
diff --git a/electron34/patches/patch-third__party_libusb_BUILD.gn b/electron34/patches/patch-third__party_libusb_BUILD.gn
new file mode 100644
index 0000000000..a53a7dfb3b
--- /dev/null
+++ b/electron34/patches/patch-third__party_libusb_BUILD.gn
@@ -0,0 +1,58 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libusb/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libusb/BUILD.gn
+@@ -3,7 +3,7 @@
+ # found in the LICENSE file.
+
+ # libusb is only used by //services/device/usb on macOS.
+-assert(is_mac)
++assert(is_mac || is_bsd)
+
+ import("//build/config/chromeos/ui_mode.gni")
+ import("//build/config/features.gni")
+@@ -103,7 +103,7 @@ static_library("libusb") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "src/libusb/os/linux_usbfs.c",
+ "src/libusb/os/linux_usbfs.h",
+@@ -114,11 +114,21 @@ static_library("libusb") {
+ ]
+ }
+
++ if (is_openbsd) {
++ sources += [
++ "src/libusb/os/openbsd_usb.c",
++ ]
++ defines += [
++ "OS_OPENBSD=1",
++ "_GNU_SOURCE=1",
++ ]
++ }
++
+ if (is_chromeos_ash) {
+ defines += [ "USBI_TIMERFD_AVAILABLE" ]
+ }
+
+- if (use_udev) {
++ if (use_udev && !is_bsd) {
+ sources += [ "src/libusb/os/linux_udev.cc" ]
+ defines += [
+ "HAVE_LIBUDEV=1",
+@@ -127,7 +137,7 @@ static_library("libusb") {
+ deps += [ "//build/linux/libudev" ]
+ }
+
+- if ((is_linux || is_chromeos) && !use_udev) {
++ if ((is_linux || is_chromeos) && !use_udev && !is_bsd) {
+ sources += [ "src/libusb/os/linux_netlink.c" ]
+ defines += [ "HAVE_LINUX_NETLINK_H" ]
+ }
diff --git a/electron34/patches/patch-third__party_libusb_src_libusb_core.c b/electron34/patches/patch-third__party_libusb_src_libusb_core.c
new file mode 100644
index 0000000000..3a65fcf8e3
--- /dev/null
+++ b/electron34/patches/patch-third__party_libusb_src_libusb_core.c
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libusb/src/libusb/core.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libusb/src/libusb/core.c
+@@ -448,7 +448,7 @@ libusb_free_device_list(list, 1);
+ * which grows when required. it can be freed once discovery has completed,
+ * eliminating the need for a list node in the libusb_device structure
+ * itself. */
+-#define DISCOVERED_DEVICES_SIZE_STEP 8
++#define DISCOVERED_DEVICES_SIZE_STEP 16
+
+ static struct discovered_devs *discovered_devs_alloc(void)
+ {
diff --git a/electron34/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c b/electron34/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c
new file mode 100644
index 0000000000..b21e9acf46
--- /dev/null
+++ b/electron34/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libusb/src/libusb/os/threads_posix.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libusb/src/libusb/os/threads_posix.c
+@@ -19,9 +19,11 @@
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+-#if defined(__linux__) || defined(__OpenBSD__)
++#if defined(__linux__)
+ # include <unistd.h>
+ # include <sys/syscall.h>
++#elif defined(__OpenBSD__)
++# include <unistd.h>
+ #elif defined(__APPLE__)
+ # include <mach/mach.h>
+ #elif defined(__CYGWIN__)
+@@ -65,7 +67,7 @@ int usbi_get_tid(void)
+ #elif defined(__OpenBSD__)
+ /* The following only works with OpenBSD > 5.1 as it requires
+ real thread support. For 5.1 and earlier, -1 is returned. */
+- ret = syscall(SYS_getthrid);
++ ret = getthrid();
+ #elif defined(__APPLE__)
+ ret = mach_thread_self();
+ mach_port_deallocate(mach_task_self(), ret);
diff --git a/electron34/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c b/electron34/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
new file mode 100644
index 0000000000..23c1f69a45
--- /dev/null
+++ b/electron34/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/libvpx/source/libvpx/vpx_ports/aarch64_cpudetect.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/libvpx/source/libvpx/vpx_ports/aarch64_cpudetect.c
+@@ -120,10 +120,24 @@ static int arm_get_cpu_caps(void) {
+ return flags;
+ }
+
+-#elif defined(__linux__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
++#elif defined(__linux__) || defined(__FreeBSD__) // end defined(VPX_USE_ANDROID_CPU_FEATURES)
+
+ #include <sys/auxv.h>
+
++#if defined(__FreeBSD__)
++static unsigned long getauxval(unsigned long type)
++{
++ /* Only AT_HWCAP* return unsigned long */
++ if (type != AT_HWCAP && type != AT_HWCAP2) {
++ return 0;
++ }
++
++ unsigned long ret = 0;
++ elf_aux_info(type, &ret, sizeof(ret));
++ return ret;
++}
++#endif
++
+ // Define hwcap values ourselves: building with an old auxv header where these
+ // hwcap values are not defined should not prevent features from being enabled.
+ #define VPX_AARCH64_HWCAP_ASIMDDP (1 << 20)
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S b/electron34/patches/patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S
new file mode 100644
index 0000000000..d5bd2ce793
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_arm64_7zAsm.S
@@ -0,0 +1,203 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/arm64/7zAsm.S.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/arm64/7zAsm.S
+@@ -1,194 +0,0 @@
+-// 7zAsm.S -- ASM macros for arm64
+-// 2021-04-25 : Igor Pavlov : Public domain
+-
+-#define r0 x0
+-#define r1 x1
+-#define r2 x2
+-#define r3 x3
+-#define r4 x4
+-#define r5 x5
+-#define r6 x6
+-#define r7 x7
+-#define r8 x8
+-#define r9 x9
+-#define r10 x10
+-#define r11 x11
+-#define r12 x12
+-#define r13 x13
+-#define r14 x14
+-#define r15 x15
+-#define r16 x16
+-#define r17 x17
+-#define r18 x18
+-#define r19 x19
+-#define r20 x20
+-#define r21 x21
+-#define r22 x22
+-#define r23 x23
+-#define r24 x24
+-#define r25 x25
+-#define r26 x26
+-#define r27 x27
+-#define r28 x28
+-#define r29 x29
+-#define r30 x30
+-
+-#define REG_ABI_PARAM_0 r0
+-#define REG_ABI_PARAM_1 r1
+-#define REG_ABI_PARAM_2 r2
+-
+-// The .note.gnu.property section is required because Chromium Android builds
+-// utilize the linker flag force-bti.
+-.pushsection .note.gnu.property, "a"
+-.balign 8
+-.long 4
+-.long 0x10
+-.long 0x5
+-.asciz "GNU"
+-.long 0xc0000000
+-.long 4
+-.long ((1 << 0 ) | (1 << 1))
+-.long 0
+-.popsection
+-
+-.macro p2_add reg:req, param:req
+- add \reg, \reg, \param
+-.endm
+-
+-.macro p2_sub reg:req, param:req
+- sub \reg, \reg, \param
+-.endm
+-
+-.macro p2_sub_s reg:req, param:req
+- subs \reg, \reg, \param
+-.endm
+-
+-.macro p2_and reg:req, param:req
+- and \reg, \reg, \param
+-.endm
+-
+-.macro xor reg:req, param:req
+- eor \reg, \reg, \param
+-.endm
+-
+-.macro or reg:req, param:req
+- orr \reg, \reg, \param
+-.endm
+-
+-.macro shl reg:req, param:req
+- lsl \reg, \reg, \param
+-.endm
+-
+-.macro shr reg:req, param:req
+- lsr \reg, \reg, \param
+-.endm
+-
+-.macro sar reg:req, param:req
+- asr \reg, \reg, \param
+-.endm
+-
+-.macro p1_neg reg:req
+- neg \reg, \reg
+-.endm
+-
+-.macro dec reg:req
+- sub \reg, \reg, 1
+-.endm
+-
+-.macro dec_s reg:req
+- subs \reg, \reg, 1
+-.endm
+-
+-.macro inc reg:req
+- add \reg, \reg, 1
+-.endm
+-
+-.macro inc_s reg:req
+- adds \reg, \reg, 1
+-.endm
+-
+-
+-.macro imul reg:req, param:req
+- mul \reg, \reg, \param
+-.endm
+-
+-/*
+-arm64 and arm use reverted c flag after subs/cmp instructions:
+- arm64-arm : x86
+- b.lo / b.cc : jb / jc
+- b.hs / b.cs : jae / jnc
+-*/
+-
+-.macro jmp lab:req
+- b \lab
+-.endm
+-
+-.macro je lab:req
+- b.eq \lab
+-.endm
+-
+-.macro jz lab:req
+- b.eq \lab
+-.endm
+-
+-.macro jnz lab:req
+- b.ne \lab
+-.endm
+-
+-.macro jne lab:req
+- b.ne \lab
+-.endm
+-
+-.macro jb lab:req
+- b.lo \lab
+-.endm
+-
+-.macro jbe lab:req
+- b.ls \lab
+-.endm
+-
+-.macro ja lab:req
+- b.hi \lab
+-.endm
+-
+-.macro jae lab:req
+- b.hs \lab
+-.endm
+-
+-
+-.macro cmove dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, eq
+-.endm
+-
+-.macro cmovne dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, ne
+-.endm
+-
+-.macro cmovs dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, mi
+-.endm
+-
+-.macro cmovns dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, pl
+-.endm
+-
+-.macro cmovb dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, lo
+-.endm
+-
+-.macro cmovae dest:req, srcTrue:req
+- csel \dest, \srcTrue, \dest, hs
+-.endm
+-
+-
+-.macro MY_ALIGN_16 macro
+- .p2align 4,, (1 << 4) - 1
+-.endm
+-
+-.macro MY_ALIGN_32 macro
+- .p2align 5,, (1 << 5) - 1
+-.endm
+-
+-.macro MY_ALIGN_64 macro
+- .p2align 6,, (1 << 6) - 1
+-.endm
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm
new file mode 100644
index 0000000000..5b756cb5b0
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zAsm.asm
@@ -0,0 +1,141 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/x86/7zAsm.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/x86/7zAsm.asm
+@@ -1,5 +1,5 @@
+ ; 7zAsm.asm -- ASM macros
+-; 2022-05-16 : Igor Pavlov : Public domain
++; 2023-12-08 : Igor Pavlov : Public domain
+
+
+ ; UASM can require these changes
+@@ -43,7 +43,7 @@ else
+ endif
+ endif
+
+-OPTION PROLOGUE:NONE
++OPTION PROLOGUE:NONE
+ OPTION EPILOGUE:NONE
+
+ MY_ASM_START macro
+@@ -52,7 +52,7 @@ MY_ASM_START macro
+ else
+ .386
+ .model flat
+- SEVENZ SEGMENT PARA PUBLIC 'CODE'
++ _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
+ endif
+ endm
+
+@@ -121,10 +121,29 @@ endif
+ x2_H equ DH
+ x3_H equ BH
+
++; r0_L equ AL
++; r1_L equ CL
++; r2_L equ DL
++; r3_L equ BL
++
++; r0_H equ AH
++; r1_H equ CH
++; r2_H equ DH
++; r3_H equ BH
++
++
+ ifdef x64
+ x5_L equ BPL
+ x6_L equ SIL
+ x7_L equ DIL
++ x8_L equ r8b
++ x9_L equ r9b
++ x10_L equ r10b
++ x11_L equ r11b
++ x12_L equ r12b
++ x13_L equ r13b
++ x14_L equ r14b
++ x15_L equ r15b
+
+ r0 equ RAX
+ r1 equ RCX
+@@ -153,6 +172,22 @@ else
+ r7 equ x7
+ endif
+
++ x0_R equ r0
++ x1_R equ r1
++ x2_R equ r2
++ x3_R equ r3
++ x4_R equ r4
++ x5_R equ r5
++ x6_R equ r6
++ x7_R equ r7
++ x8_R equ r8
++ x9_R equ r9
++ x10_R equ r10
++ x11_R equ r11
++ x12_R equ r12
++ x13_R equ r13
++ x14_R equ r14
++ x15_R equ r15
+
+ ifdef x64
+ ifdef ABI_LINUX
+@@ -200,6 +235,14 @@ REG_ABI_PARAM_0 equ REG_PARAM_0
+ REG_ABI_PARAM_1_x equ REG_PARAM_1_x
+ REG_ABI_PARAM_1 equ REG_PARAM_1
+
++MY_PUSH_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11 macro
++ MY_PUSH_4_REGS
++endm
++
++MY_POP_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11 macro
++ MY_POP_4_REGS
++endm
++
+ else
+ ; x64
+
+@@ -261,12 +304,25 @@ endm
+ endif ; IS_LINUX
+
+
+-MY_PUSH_PRESERVED_ABI_REGS macro
++MY_PUSH_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11 macro
+ if (IS_LINUX gt 0)
+ MY_PUSH_2_REGS
+ else
+ MY_PUSH_4_REGS
+ endif
++endm
++
++MY_POP_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11 macro
++ if (IS_LINUX gt 0)
++ MY_POP_2_REGS
++ else
++ MY_POP_4_REGS
++ endif
++endm
++
++
++MY_PUSH_PRESERVED_ABI_REGS macro
++ MY_PUSH_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11
+ push r12
+ push r13
+ push r14
+@@ -279,11 +335,7 @@ MY_POP_PRESERVED_ABI_REGS macro
+ pop r14
+ pop r13
+ pop r12
+- if (IS_LINUX gt 0)
+- MY_POP_2_REGS
+- else
+- MY_POP_4_REGS
+- endif
++ MY_POP_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11
+ endm
+
+ endif ; x64
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm
new file mode 100644
index 0000000000..d67c1e57e3
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_7zCrcOpt.asm
@@ -0,0 +1,189 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/x86/7zCrcOpt.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/x86/7zCrcOpt.asm
+@@ -1,180 +0,0 @@
+-; 7zCrcOpt.asm -- CRC32 calculation : optimized version
+-; 2021-02-07 : Igor Pavlov : Public domain
+-
+-include 7zAsm.asm
+-
+-MY_ASM_START
+-
+-rD equ r2
+-rN equ r7
+-rT equ r5
+-
+-ifdef x64
+- num_VAR equ r8
+- table_VAR equ r9
+-else
+- if (IS_CDECL gt 0)
+- crc_OFFS equ (REG_SIZE * 5)
+- data_OFFS equ (REG_SIZE + crc_OFFS)
+- size_OFFS equ (REG_SIZE + data_OFFS)
+- else
+- size_OFFS equ (REG_SIZE * 5)
+- endif
+- table_OFFS equ (REG_SIZE + size_OFFS)
+- num_VAR equ [r4 + size_OFFS]
+- table_VAR equ [r4 + table_OFFS]
+-endif
+-
+-SRCDAT equ rD + rN * 1 + 4 *
+-
+-CRC macro op:req, dest:req, src:req, t:req
+- op dest, DWORD PTR [rT + src * 4 + 0400h * t]
+-endm
+-
+-CRC_XOR macro dest:req, src:req, t:req
+- CRC xor, dest, src, t
+-endm
+-
+-CRC_MOV macro dest:req, src:req, t:req
+- CRC mov, dest, src, t
+-endm
+-
+-CRC1b macro
+- movzx x6, BYTE PTR [rD]
+- inc rD
+- movzx x3, x0_L
+- xor x6, x3
+- shr x0, 8
+- CRC xor, x0, r6, 0
+- dec rN
+-endm
+-
+-MY_PROLOG macro crc_end:req
+-
+- ifdef x64
+- if (IS_LINUX gt 0)
+- MY_PUSH_2_REGS
+- mov x0, REG_ABI_PARAM_0_x ; x0 = x7
+- mov rT, REG_ABI_PARAM_3 ; r5 = r1
+- mov rN, REG_ABI_PARAM_2 ; r7 = r2
+- mov rD, REG_ABI_PARAM_1 ; r2 = r6
+- else
+- MY_PUSH_4_REGS
+- mov x0, REG_ABI_PARAM_0_x ; x0 = x1
+- mov rT, REG_ABI_PARAM_3 ; r5 = r9
+- mov rN, REG_ABI_PARAM_2 ; r7 = r8
+- ; mov rD, REG_ABI_PARAM_1 ; r2 = r2
+- endif
+- else
+- MY_PUSH_4_REGS
+- if (IS_CDECL gt 0)
+- mov x0, [r4 + crc_OFFS]
+- mov rD, [r4 + data_OFFS]
+- else
+- mov x0, REG_ABI_PARAM_0_x
+- endif
+- mov rN, num_VAR
+- mov rT, table_VAR
+- endif
+-
+- test rN, rN
+- jz crc_end
+- @@:
+- test rD, 7
+- jz @F
+- CRC1b
+- jnz @B
+- @@:
+- cmp rN, 16
+- jb crc_end
+- add rN, rD
+- mov num_VAR, rN
+- sub rN, 8
+- and rN, NOT 7
+- sub rD, rN
+- xor x0, [SRCDAT 0]
+-endm
+-
+-MY_EPILOG macro crc_end:req
+- xor x0, [SRCDAT 0]
+- mov rD, rN
+- mov rN, num_VAR
+- sub rN, rD
+- crc_end:
+- test rN, rN
+- jz @F
+- CRC1b
+- jmp crc_end
+- @@:
+- if (IS_X64 gt 0) and (IS_LINUX gt 0)
+- MY_POP_2_REGS
+- else
+- MY_POP_4_REGS
+- endif
+-endm
+-
+-MY_PROC CrcUpdateT8, 4
+- MY_PROLOG crc_end_8
+- mov x1, [SRCDAT 1]
+- align 16
+- main_loop_8:
+- mov x6, [SRCDAT 2]
+- movzx x3, x1_L
+- CRC_XOR x6, r3, 3
+- movzx x3, x1_H
+- CRC_XOR x6, r3, 2
+- shr x1, 16
+- movzx x3, x1_L
+- movzx x1, x1_H
+- CRC_XOR x6, r3, 1
+- movzx x3, x0_L
+- CRC_XOR x6, r1, 0
+-
+- mov x1, [SRCDAT 3]
+- CRC_XOR x6, r3, 7
+- movzx x3, x0_H
+- shr x0, 16
+- CRC_XOR x6, r3, 6
+- movzx x3, x0_L
+- CRC_XOR x6, r3, 5
+- movzx x3, x0_H
+- CRC_MOV x0, r3, 4
+- xor x0, x6
+- add rD, 8
+- jnz main_loop_8
+-
+- MY_EPILOG crc_end_8
+-MY_ENDP
+-
+-MY_PROC CrcUpdateT4, 4
+- MY_PROLOG crc_end_4
+- align 16
+- main_loop_4:
+- movzx x1, x0_L
+- movzx x3, x0_H
+- shr x0, 16
+- movzx x6, x0_H
+- and x0, 0FFh
+- CRC_MOV x1, r1, 3
+- xor x1, [SRCDAT 1]
+- CRC_XOR x1, r3, 2
+- CRC_XOR x1, r6, 0
+- CRC_XOR x1, r0, 1
+-
+- movzx x0, x1_L
+- movzx x3, x1_H
+- shr x1, 16
+- movzx x6, x1_H
+- and x1, 0FFh
+- CRC_MOV x0, r0, 3
+- xor x0, [SRCDAT 2]
+- CRC_XOR x0, r3, 2
+- CRC_XOR x0, r6, 0
+- CRC_XOR x0, r1, 1
+- add rD, 8
+- jnz main_loop_4
+-
+- MY_EPILOG crc_end_4
+-MY_ENDP
+-
+-end
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm
new file mode 100644
index 0000000000..ad2965c04b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_LzmaDecOpt.asm
@@ -0,0 +1,81 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm
+@@ -1,5 +1,5 @@
+ ; LzmaDecOpt.asm -- ASM version of LzmaDec_DecodeReal_3() function
+-; 2021-02-23: Igor Pavlov : Public domain
++; 2024-06-18: Igor Pavlov : Public domain
+ ;
+ ; 3 - is the code compatibility version of LzmaDec_DecodeReal_*()
+ ; function for check at link time.
+@@ -17,11 +17,43 @@ include 7zAsm.asm
+
+ MY_ASM_START
+
+-LZMADEC SEGMENT ALIGN(64) 'CODE'
++; if Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT is defined, we use additional SEGMENT with 64-byte alignment.
++; if Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT is not defined, we use default SEGMENT (where default 16-byte alignment of segment is expected).
++; The performance is almost identical in our tests.
++; But the performance can depend from position of lzmadec code inside instruction cache
++; or micro-op cache line (depending from low address bits in 32-byte/64-byte cache lines).
++; And 64-byte alignment provides a more consistent speed regardless
++; of the code's position in the executable.
++; But also it's possible that code without Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT can be
++; slightly faster than 64-bytes aligned code in some cases, if offset of lzmadec
++; code in 64-byte block after compilation provides better speed by some reason.
++; Note that Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT adds an extra section to the ELF file.
++; If you don't want to get that extra section, do not define Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT.
++
++ifndef Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT
++if (IS_LINUX gt 0)
++ Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT equ 1
++else
++ Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT equ 1
++endif
++endif
+
++ifdef Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT
++; Make this deterministic
++; _TEXT$LZMADECOPT SEGMENT ALIGN(64) 'CODE'
++LZMADEC SEGMENT ALIGN(64) 'CODE'
+ MY_ALIGN macro num:req
+ align num
++ ; align 16
+ endm
++else
++MY_ALIGN macro num:req
++ ; We expect that ".text" is aligned for 16-bytes.
++ ; So we don't need large alignment inside out function.
++ align 16
++endm
++endif
++
+
+ MY_ALIGN_16 macro
+ MY_ALIGN 16
+@@ -610,7 +642,11 @@ PARAM_lzma equ REG_ABI_PARAM_0
+ PARAM_limit equ REG_ABI_PARAM_1
+ PARAM_bufLimit equ REG_ABI_PARAM_2
+
++ifdef Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT
+ ; MY_ALIGN_64
++else
++ MY_ALIGN_16
++endif
+ MY_PROC LzmaDec_DecodeReal_3, 3
+ MY_PUSH_PRESERVED_ABI_REGS
+
+@@ -1298,6 +1334,8 @@ fin:
+ MY_POP_PRESERVED_ABI_REGS
+ MY_ENDP
+
++ifdef Z7_LZMA_DEC_OPT_ASM_USE_SEGMENT
+ LZMADEC ENDS
++endif
+
+ end
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm
new file mode 100644
index 0000000000..717c55adfc
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_Sha256Opt.asm
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/x86/Sha256Opt.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/x86/Sha256Opt.asm
+@@ -1,5 +1,5 @@
+ ; Sha256Opt.asm -- SHA-256 optimized code for SHA-256 x86 hardware instructions
+-; 2022-04-17 : Igor Pavlov : Public domain
++; 2024-06-16 : Igor Pavlov : Public domain
+
+ include 7zAsm.asm
+
+@@ -20,7 +20,7 @@ endif
+ EXTRN K_CONST:xmmword
+ @
+
+-CONST SEGMENT
++CONST SEGMENT READONLY
+
+ align 16
+ Reverse_Endian_Mask db 3,2,1,0, 7,6,5,4, 11,10,9,8, 15,14,13,12
diff --git a/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm
new file mode 100644
index 0000000000..01dc094ef0
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_Asm_x86_XzCrc64Opt.asm
@@ -0,0 +1,681 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/Asm/x86/XzCrc64Opt.asm.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/Asm/x86/XzCrc64Opt.asm
+@@ -1,113 +1,231 @@
+ ; XzCrc64Opt.asm -- CRC64 calculation : optimized version
+-; 2021-02-06 : Igor Pavlov : Public domain
++; 2023-12-08 : Igor Pavlov : Public domain
+
+ include 7zAsm.asm
+
+ MY_ASM_START
+
++NUM_WORDS equ 3
++
++if (NUM_WORDS lt 1) or (NUM_WORDS gt 64)
++.err <num_words_IS_INCORRECT>
++endif
++
++NUM_SKIP_BYTES equ ((NUM_WORDS - 2) * 4)
++
++
++MOVZXLO macro dest:req, src:req
++ movzx dest, @CatStr(src, _L)
++endm
++
++MOVZXHI macro dest:req, src:req
++ movzx dest, @CatStr(src, _H)
++endm
++
++
+ ifdef x64
+
+-rD equ r9
++rD equ r11
+ rN equ r10
+-rT equ r5
+-num_VAR equ r8
++rT equ r9
+
+-SRCDAT4 equ dword ptr [rD + rN * 1]
++CRC_OP macro op:req, dest:req, src:req, t:req
++ op dest, QWORD PTR [rT + @CatStr(src, _R) * 8 + 0800h * (t)]
++endm
+
+ CRC_XOR macro dest:req, src:req, t:req
+- xor dest, QWORD PTR [rT + src * 8 + 0800h * t]
++ CRC_OP xor, dest, src, t
++endm
++
++CRC_MOV macro dest:req, src:req, t:req
++ CRC_OP mov, dest, src, t
+ endm
+
+ CRC1b macro
+- movzx x6, BYTE PTR [rD]
+- inc rD
+- movzx x3, x0_L
+- xor x6, x3
+- shr r0, 8
+- CRC_XOR r0, r6, 0
+- dec rN
++ movzx x6, BYTE PTR [rD]
++ inc rD
++ MOVZXLO x3, x0
++ xor x6, x3
++ shr r0, 8
++ CRC_XOR r0, x6, 0
++ dec rN
+ endm
+
+-MY_PROLOG macro crc_end:req
+- ifdef ABI_LINUX
+- MY_PUSH_2_REGS
+- else
+- MY_PUSH_4_REGS
+- endif
+- mov r0, REG_ABI_PARAM_0
+- mov rN, REG_ABI_PARAM_2
+- mov rT, REG_ABI_PARAM_3
+- mov rD, REG_ABI_PARAM_1
+- test rN, rN
+- jz crc_end
+- @@:
+- test rD, 3
+- jz @F
+- CRC1b
+- jnz @B
+- @@:
+- cmp rN, 8
+- jb crc_end
+- add rN, rD
+- mov num_VAR, rN
+- sub rN, 4
+- and rN, NOT 3
+- sub rD, rN
+- mov x1, SRCDAT4
+- xor r0, r1
+- add rN, 4
+-endm
+-
+-MY_EPILOG macro crc_end:req
+- sub rN, 4
+- mov x1, SRCDAT4
+- xor r0, r1
+- mov rD, rN
+- mov rN, num_VAR
+- sub rN, rD
+- crc_end:
+- test rN, rN
+- jz @F
+- CRC1b
+- jmp crc_end
+- @@:
+- ifdef ABI_LINUX
+- MY_POP_2_REGS
+- else
+- MY_POP_4_REGS
+- endif
++
++; ALIGN_MASK is 3 or 7 bytes alignment:
++ALIGN_MASK equ (7 - (NUM_WORDS and 1) * 4)
++
++if NUM_WORDS eq 1
++
++src_rN_offset equ 4
++; + 4 for prefetching next 4-bytes after current iteration
++NUM_BYTES_LIMIT equ (NUM_WORDS * 4 + 4)
++SRCDAT4 equ DWORD PTR [rN + rD * 1]
++
++XOR_NEXT macro
++ mov x1, [rD]
++ xor r0, r1
+ endm
+
+-MY_PROC XzCrc64UpdateT4, 4
+- MY_PROLOG crc_end_4
+- align 16
+- main_loop_4:
+- mov x1, SRCDAT4
+- movzx x2, x0_L
+- movzx x3, x0_H
+- shr r0, 16
+- movzx x6, x0_L
+- movzx x7, x0_H
+- shr r0, 16
+- CRC_XOR r1, r2, 3
+- CRC_XOR r0, r3, 2
+- CRC_XOR r1, r6, 1
+- CRC_XOR r0, r7, 0
+- xor r0, r1
++else ; NUM_WORDS > 1
+
+- add rD, 4
+- jnz main_loop_4
++src_rN_offset equ 8
++; + 8 for prefetching next 8-bytes after current iteration
++NUM_BYTES_LIMIT equ (NUM_WORDS * 4 + 8)
+
+- MY_EPILOG crc_end_4
++XOR_NEXT macro
++ xor r0, QWORD PTR [rD] ; 64-bit read, can be unaligned
++endm
++
++; 32-bit or 64-bit
++LOAD_SRC_MULT4 macro dest:req, word_index:req
++ mov dest, [rN + rD * 1 + 4 * (word_index) - src_rN_offset];
++endm
++
++endif
++
++
++
++MY_PROC @CatStr(XzCrc64UpdateT, %(NUM_WORDS * 4)), 4
++ MY_PUSH_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11
++
++ mov r0, REG_ABI_PARAM_0 ; r0 <- r1 / r7
++ mov rD, REG_ABI_PARAM_1 ; r11 <- r2 / r6
++ mov rN, REG_ABI_PARAM_2 ; r10 <- r8 / r2
++if (IS_LINUX gt 0)
++ mov rT, REG_ABI_PARAM_3 ; r9 <- r9 / r1
++endif
++
++ cmp rN, NUM_BYTES_LIMIT + ALIGN_MASK
++ jb crc_end
++@@:
++ test rD, ALIGN_MASK
++ jz @F
++ CRC1b
++ jmp @B
++@@:
++ XOR_NEXT
++ lea rN, [rD + rN * 1 - (NUM_BYTES_LIMIT - 1)]
++ sub rD, rN
++ add rN, src_rN_offset
++
++align 16
++@@:
++
++if NUM_WORDS eq 1
++
++ mov x1, x0
++ shr x1, 8
++ MOVZXLO x3, x1
++ MOVZXLO x2, x0
++ shr x1, 8
++ shr r0, 32
++ xor x0, SRCDAT4
++ CRC_XOR r0, x2, 3
++ CRC_XOR r0, x3, 2
++ MOVZXLO x2, x1
++ shr x1, 8
++ CRC_XOR r0, x2, 1
++ CRC_XOR r0, x1, 0
++
++else ; NUM_WORDS > 1
++
++if NUM_WORDS ne 2
++ k = 2
++ while k lt NUM_WORDS
++
++ LOAD_SRC_MULT4 x1, k
++ crc_op1 textequ <xor>
++
++ if k eq 2
++ if (NUM_WORDS and 1)
++ LOAD_SRC_MULT4 x7, NUM_WORDS ; aligned 32-bit
++ LOAD_SRC_MULT4 x6, NUM_WORDS + 1 ; aligned 32-bit
++ shl r6, 32
++ else
++ LOAD_SRC_MULT4 r6, NUM_WORDS ; aligned 64-bit
++ crc_op1 textequ <mov>
++ endif
++ endif
++ table = 4 * (NUM_WORDS - 1 - k)
++ MOVZXLO x3, x1
++ CRC_OP crc_op1, r7, x3, 3 + table
++ MOVZXHI x3, x1
++ shr x1, 16
++ CRC_XOR r6, x3, 2 + table
++ MOVZXLO x3, x1
++ shr x1, 8
++ CRC_XOR r7, x3, 1 + table
++ CRC_XOR r6, x1, 0 + table
++ k = k + 1
++ endm
++ crc_op2 textequ <xor>
++
++else ; NUM_WORDS == 2
++ LOAD_SRC_MULT4 r6, NUM_WORDS ; aligned 64-bit
++ crc_op2 textequ <mov>
++endif ; NUM_WORDS == 2
++
++ MOVZXHI x3, x0
++ MOVZXLO x2, x0
++ mov r1, r0
++ shr r1, 32
++ shr x0, 16
++ CRC_XOR r6, x2, NUM_SKIP_BYTES + 7
++ CRC_OP crc_op2, r7, x3, NUM_SKIP_BYTES + 6
++ MOVZXLO x2, x0
++ MOVZXHI x5, x1
++ MOVZXLO x3, x1
++ shr x0, 8
++ shr x1, 16
++ CRC_XOR r7, x2, NUM_SKIP_BYTES + 5
++ CRC_XOR r6, x3, NUM_SKIP_BYTES + 3
++ CRC_XOR r7, x0, NUM_SKIP_BYTES + 4
++ CRC_XOR r6, x5, NUM_SKIP_BYTES + 2
++ MOVZXLO x2, x1
++ shr x1, 8
++ CRC_XOR r7, x2, NUM_SKIP_BYTES + 1
++ CRC_MOV r0, x1, NUM_SKIP_BYTES + 0
++ xor r0, r6
++ xor r0, r7
++
++endif ; NUM_WORDS > 1
++ add rD, NUM_WORDS * 4
++ jnc @B
++
++ sub rN, src_rN_offset
++ add rD, rN
++ XOR_NEXT
++ add rN, NUM_BYTES_LIMIT - 1
++ sub rN, rD
++
++crc_end:
++ test rN, rN
++ jz func_end
++@@:
++ CRC1b
++ jnz @B
++func_end:
++ MY_POP_PRESERVED_ABI_REGS_UP_TO_INCLUDING_R11
+ MY_ENDP
+
++
++
+ else
++; ==================================================================
+ ; x86 (32-bit)
+
+-rD equ r1
+-rN equ r7
++rD equ r7
++rN equ r1
+ rT equ r5
+
++xA equ x6
++xA_R equ r6
++
++ifdef x64
++ num_VAR equ r8
++else
++
+ crc_OFFS equ (REG_SIZE * 5)
+
+ if (IS_CDECL gt 0) or (IS_LINUX gt 0)
+@@ -133,107 +251,273 @@ else
+ table_VAR equ [r4 + table_OFFS]
+ num_VAR equ table_VAR
+ endif
++endif ; x64
+
+-SRCDAT4 equ dword ptr [rD + rN * 1]
++SRCDAT4 equ DWORD PTR [rN + rD * 1]
++
++CRC_1 macro op:req, dest:req, src:req, t:req, word_index:req
++ op dest, DWORD PTR [rT + @CatStr(src, _R) * 8 + 0800h * (t) + (word_index) * 4]
++endm
+
+ CRC macro op0:req, op1:req, dest0:req, dest1:req, src:req, t:req
+- op0 dest0, DWORD PTR [rT + src * 8 + 0800h * t]
+- op1 dest1, DWORD PTR [rT + src * 8 + 0800h * t + 4]
++ CRC_1 op0, dest0, src, t, 0
++ CRC_1 op1, dest1, src, t, 1
+ endm
+
+ CRC_XOR macro dest0:req, dest1:req, src:req, t:req
+- CRC xor, xor, dest0, dest1, src, t
++ CRC xor, xor, dest0, dest1, src, t
+ endm
+
+
+ CRC1b macro
+- movzx x6, BYTE PTR [rD]
+- inc rD
+- movzx x3, x0_L
+- xor x6, x3
+- shrd r0, r2, 8
+- shr r2, 8
+- CRC_XOR r0, r2, r6, 0
+- dec rN
+-endm
+-
+-MY_PROLOG macro crc_end:req
+- MY_PUSH_4_REGS
+-
+- if (IS_CDECL gt 0) or (IS_LINUX gt 0)
+- proc_numParams = proc_numParams + 2 ; for ABI_LINUX
+- mov rN, [r4 + size_OFFS]
+- mov rD, [r4 + data_OFFS]
++ movzx xA, BYTE PTR [rD]
++ inc rD
++ MOVZXLO x3, x0
++ xor xA, x3
++ shrd x0, x2, 8
++ shr x2, 8
++ CRC_XOR x0, x2, xA, 0
++ dec rN
++endm
++
++
++MY_PROLOG_BASE macro
++ MY_PUSH_4_REGS
++ifdef x64
++ mov r0, REG_ABI_PARAM_0 ; r0 <- r1 / r7
++ mov rT, REG_ABI_PARAM_3 ; r5 <- r9 / r1
++ mov rN, REG_ABI_PARAM_2 ; r1 <- r8 / r2
++ mov rD, REG_ABI_PARAM_1 ; r7 <- r2 / r6
++ mov r2, r0
++ shr r2, 32
++ mov x0, x0
++else
++ if (IS_CDECL gt 0) or (IS_LINUX gt 0)
++ proc_numParams = proc_numParams + 2 ; for ABI_LINUX
++ mov rN, [r4 + size_OFFS]
++ mov rD, [r4 + data_OFFS]
++ else
++ mov rD, REG_ABI_PARAM_0 ; r7 <- r1 : (data)
++ mov rN, REG_ABI_PARAM_1 ; r1 <- r2 : (size)
++ endif
++ mov x0, [r4 + crc_OFFS]
++ mov x2, [r4 + crc_OFFS + 4]
++ mov rT, table_VAR
++endif
++endm
++
++
++MY_EPILOG_BASE macro crc_end:req, func_end:req
++crc_end:
++ test rN, rN
++ jz func_end
++@@:
++ CRC1b
++ jnz @B
++func_end:
++ifdef x64
++ shl r2, 32
++ xor r0, r2
++endif
++ MY_POP_4_REGS
++endm
++
++
++; ALIGN_MASK is 3 or 7 bytes alignment:
++ALIGN_MASK equ (7 - (NUM_WORDS and 1) * 4)
++
++if (NUM_WORDS eq 1)
++
++NUM_BYTES_LIMIT_T4 equ (NUM_WORDS * 4 + 4)
++
++MY_PROC @CatStr(XzCrc64UpdateT, %(NUM_WORDS * 4)), 5
++ MY_PROLOG_BASE
++
++ cmp rN, NUM_BYTES_LIMIT_T4 + ALIGN_MASK
++ jb crc_end_4
++@@:
++ test rD, ALIGN_MASK
++ jz @F
++ CRC1b
++ jmp @B
++@@:
++ xor x0, [rD]
++ lea rN, [rD + rN * 1 - (NUM_BYTES_LIMIT_T4 - 1)]
++ sub rD, rN
++ add rN, 4
++
++ MOVZXLO xA, x0
++align 16
++@@:
++ mov x3, SRCDAT4
++ xor x3, x2
++ shr x0, 8
++ CRC xor, mov, x3, x2, xA, 3
++ MOVZXLO xA, x0
++ shr x0, 8
++ ; MOVZXHI xA, x0
++ ; shr x0, 16
++ CRC_XOR x3, x2, xA, 2
++
++ MOVZXLO xA, x0
++ shr x0, 8
++ CRC_XOR x3, x2, xA, 1
++ CRC_XOR x3, x2, x0, 0
++ MOVZXLO xA, x3
++ mov x0, x3
++
++ add rD, 4
++ jnc @B
++
++ sub rN, 4
++ add rD, rN
++ xor x0, [rD]
++ add rN, NUM_BYTES_LIMIT_T4 - 1
++ sub rN, rD
++ MY_EPILOG_BASE crc_end_4, func_end_4
++MY_ENDP
++
++else ; NUM_WORDS > 1
++
++SHR_X macro x, imm
++ shr x, imm
++endm
++
++
++ITER_1 macro v0, v1, a, off
++ MOVZXLO xA, a
++ SHR_X a, 8
++ CRC_XOR v0, v1, xA, off
++endm
++
++
++ITER_4 macro v0, v1, a, off
++if 0 eq 0
++ ITER_1 v0, v1, a, off + 3
++ ITER_1 v0, v1, a, off + 2
++ ITER_1 v0, v1, a, off + 1
++ CRC_XOR v0, v1, a, off
++elseif 0 eq 0
++ MOVZXLO xA, a
++ CRC_XOR v0, v1, xA, off + 3
++ mov xA, a
++ ror a, 16 ; 32-bit ror
++ shr xA, 24
++ CRC_XOR v0, v1, xA, off
++ MOVZXLO xA, a
++ SHR_X a, 24
++ CRC_XOR v0, v1, xA, off + 1
++ CRC_XOR v0, v1, a, off + 2
++else
++ ; MOVZXHI provides smaller code, but MOVZX_HI_BYTE is not fast instruction
++ MOVZXLO xA, a
++ CRC_XOR v0, v1, xA, off + 3
++ MOVZXHI xA, a
++ SHR_X a, 16
++ CRC_XOR v0, v1, xA, off + 2
++ MOVZXLO xA, a
++ SHR_X a, 8
++ CRC_XOR v0, v1, xA, off + 1
++ CRC_XOR v0, v1, a, off
++endif
++endm
++
++
++
++ITER_1_PAIR macro v0, v1, a0, a1, off
++ ITER_1 v0, v1, a0, off + 4
++ ITER_1 v0, v1, a1, off
++endm
++
++src_rD_offset equ 8
++STEP_SIZE equ (NUM_WORDS * 4)
++
++ITER_12_NEXT macro op, index, v0, v1
++ op v0, DWORD PTR [rD + (index + 1) * STEP_SIZE - src_rD_offset]
++ op v1, DWORD PTR [rD + (index + 1) * STEP_SIZE + 4 - src_rD_offset]
++endm
++
++ITER_12 macro index, a0, a1, v0, v1
++
++ if NUM_SKIP_BYTES eq 0
++ ITER_12_NEXT mov, index, v0, v1
+ else
+- mov rN, r2
++ k = 0
++ while k lt NUM_SKIP_BYTES
++ movzx xA, BYTE PTR [rD + (index) * STEP_SIZE + k + 8 - src_rD_offset]
++ if k eq 0
++ CRC mov, mov, v0, v1, xA, NUM_SKIP_BYTES - 1 - k
++ else
++ CRC_XOR v0, v1, xA, NUM_SKIP_BYTES - 1 - k
++ endif
++ k = k + 1
++ endm
++ ITER_12_NEXT xor, index, v0, v1
+ endif
+
+- mov x0, [r4 + crc_OFFS]
+- mov x2, [r4 + crc_OFFS + 4]
+- mov rT, table_VAR
+- test rN, rN
+- jz crc_end
+- @@:
+- test rD, 3
+- jz @F
+- CRC1b
+- jnz @B
+- @@:
+- cmp rN, 8
+- jb crc_end
+- add rN, rD
+-
+- mov num_VAR, rN
+-
+- sub rN, 4
+- and rN, NOT 3
+- sub rD, rN
+- xor r0, SRCDAT4
+- add rN, 4
+-endm
+-
+-MY_EPILOG macro crc_end:req
+- sub rN, 4
+- xor r0, SRCDAT4
+-
+- mov rD, rN
+- mov rN, num_VAR
+- sub rN, rD
+- crc_end:
+- test rN, rN
+- jz @F
+- CRC1b
+- jmp crc_end
+- @@:
+- MY_POP_4_REGS
+-endm
+-
+-MY_PROC XzCrc64UpdateT4, 5
+- MY_PROLOG crc_end_4
+- movzx x6, x0_L
+- align 16
+- main_loop_4:
+- mov r3, SRCDAT4
+- xor r3, r2
+-
+- CRC xor, mov, r3, r2, r6, 3
+- movzx x6, x0_H
+- shr r0, 16
+- CRC_XOR r3, r2, r6, 2
+-
+- movzx x6, x0_L
+- movzx x0, x0_H
+- CRC_XOR r3, r2, r6, 1
+- CRC_XOR r3, r2, r0, 0
+- movzx x6, x3_L
+- mov r0, r3
++if 0 eq 0
++ ITER_4 v0, v1, a0, NUM_SKIP_BYTES + 4
++ ITER_4 v0, v1, a1, NUM_SKIP_BYTES
++else ; interleave version is faster/slower for different processors
++ ITER_1_PAIR v0, v1, a0, a1, NUM_SKIP_BYTES + 3
++ ITER_1_PAIR v0, v1, a0, a1, NUM_SKIP_BYTES + 2
++ ITER_1_PAIR v0, v1, a0, a1, NUM_SKIP_BYTES + 1
++ CRC_XOR v0, v1, a0, NUM_SKIP_BYTES + 4
++ CRC_XOR v0, v1, a1, NUM_SKIP_BYTES
++endif
++endm
+
+- add rD, 4
+- jnz main_loop_4
++; we use (UNROLL_CNT > 1) to reduce read ports pressure (num_VAR reads)
++UNROLL_CNT equ (2 * 1)
++NUM_BYTES_LIMIT equ (STEP_SIZE * UNROLL_CNT + 8)
++
++MY_PROC @CatStr(XzCrc64UpdateT, %(NUM_WORDS * 4)), 5
++ MY_PROLOG_BASE
++
++ cmp rN, NUM_BYTES_LIMIT + ALIGN_MASK
++ jb crc_end_12
++@@:
++ test rD, ALIGN_MASK
++ jz @F
++ CRC1b
++ jmp @B
++@@:
++ xor x0, [rD]
++ xor x2, [rD + 4]
++ add rD, src_rD_offset
++ lea rN, [rD + rN * 1 - (NUM_BYTES_LIMIT - 1)]
++ mov num_VAR, rN
++
++align 16
++@@:
++ i = 0
++ rept UNROLL_CNT
++ if (i and 1) eq 0
++ ITER_12 i, x0, x2, x1, x3
++ else
++ ITER_12 i, x1, x3, x0, x2
++ endif
++ i = i + 1
++ endm
++
++ if (UNROLL_CNT and 1)
++ mov x0, x1
++ mov x2, x3
++ endif
++ add rD, STEP_SIZE * UNROLL_CNT
++ cmp rD, num_VAR
++ jb @B
++
++ mov rN, num_VAR
++ add rN, NUM_BYTES_LIMIT - 1
++ sub rN, rD
++ sub rD, src_rD_offset
++ xor x0, [rD]
++ xor x2, [rD + 4]
+
+- MY_EPILOG crc_end_4
++ MY_EPILOG_BASE crc_end_12, func_end_12
+ MY_ENDP
+
++endif ; (NUM_WORDS > 1)
+ endif ; ! x64
+-
+ end
diff --git a/electron34/patches/patch-third__party_lzma__sdk_BUILD.gn b/electron34/patches/patch-third__party_lzma__sdk_BUILD.gn
new file mode 100644
index 0000000000..0289e78bde
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_BUILD.gn
@@ -0,0 +1,84 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/BUILD.gn
+@@ -36,13 +36,14 @@ config("lzma_sdk_config") {
+ # (otherwise -Wall will appear after this, and turn it back on).
+ config("lzma_build_config") {
+ defines = [
+- "_7ZIP_ST",
+- "_7Z_NO_METHODS_FILTERS",
++ "Z7_LZMA_PROB32",
++ "Z7_NO_METHODS_FILTERS",
++ "Z7_ST",
+ "_LZMA_PROB32",
+ ]
+
+ if (enable_lzma_opt) {
+- defines += [ "_LZMA_DEC_OPT" ]
++ defines += [ "Z7_LZMA_DEC_OPT" ]
+ }
+
+ cflags = []
+@@ -52,10 +53,6 @@ config("lzma_build_config") {
+ }
+
+ if (use_arm_neon_optimizations) {
+- if (is_fuchsia) {
+- defines += [ "ARMV8_OS_FUCHSIA" ]
+- }
+-
+ if (target_cpu == "arm" && arm_version >= 8) {
+ if (is_clang) {
+ cflags += [
+@@ -92,6 +89,7 @@ static_library("lzma_sdk") {
+ "C/7zFile.h",
+ "C/7zStream.c",
+ "C/7zTypes.h",
++ "C/7zWindows.h",
+ "C/Alloc.c",
+ "C/Alloc.h",
+ "C/Bcj2.c",
+@@ -118,14 +116,13 @@ static_library("lzma_sdk") {
+ "C/LzmaLib.c",
+ "C/LzmaLib.h",
+ "C/Precomp.h",
++ "C/RotateDefs.h",
+ ]
+
+ if (enable_lzma_opt) {
+ sources += [
+- "Asm/x86/7zCrcOpt.asm",
+ "Asm/x86/LzmaDecOpt.asm",
+ ]
+- sources -= [ "C/7zCrcOpt.c" ]
+ }
+
+ configs -= [ "//build/config/compiler:chromium_code" ]
+@@ -141,9 +138,9 @@ static_library("lzma_sdk") {
+ static_library("lzma_sdk_xz") {
+ sources = [
+ "C/BraIA64.c",
+- "C/RotateDefs.h",
+ "C/Sha256.c",
+ "C/Sha256.h",
++ "C/Sha256Opt.c",
+ "C/Xz.c",
+ "C/Xz.h",
+ "C/XzCrc64.c",
+@@ -153,11 +150,6 @@ static_library("lzma_sdk_xz") {
+ "C/XzIn.c",
+ ]
+
+- # TODO(crbug.com/1338627): Enable ARM optimizations
+- if (target_cpu == "x86" || target_cpu == "x64") {
+- sources += [ "C/Sha256Opt.c" ]
+- }
+-
+ if (enable_lzma_opt) {
+ sources += [
+ "Asm/x86/Sha256Opt.asm",
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7z.h b/electron34/patches/patch-third__party_lzma__sdk_C_7z.h
new file mode 100644
index 0000000000..653ee81c35
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7z.h
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7z.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7z.h
+@@ -1,8 +1,8 @@
+ /* 7z.h -- 7z interface
+-2018-07-02 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_H
+-#define __7Z_H
++#ifndef ZIP7_INC_7Z_H
++#define ZIP7_INC_7Z_H
+
+ #include "7zTypes.h"
+
+@@ -98,7 +98,7 @@ typedef struct
+ UInt64 SzAr_GetFolderUnpackSize(const CSzAr *p, UInt32 folderIndex);
+
+ SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex,
+- ILookInStream *stream, UInt64 startPos,
++ ILookInStreamPtr stream, UInt64 startPos,
+ Byte *outBuffer, size_t outSize,
+ ISzAllocPtr allocMain);
+
+@@ -174,7 +174,7 @@ UInt16 *SzArEx_GetFullNameUtf16_Back(con
+
+ SRes SzArEx_Extract(
+ const CSzArEx *db,
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ UInt32 fileIndex, /* index of file */
+ UInt32 *blockIndex, /* index of solid block */
+ Byte **outBuffer, /* pointer to pointer to output buffer (allocated with allocMain) */
+@@ -196,7 +196,7 @@ SZ_ERROR_INPUT_EOF
+ SZ_ERROR_FAIL
+ */
+
+-SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream,
++SRes SzArEx_Open(CSzArEx *p, ILookInStreamPtr inStream,
+ ISzAllocPtr allocMain, ISzAllocPtr allocTemp);
+
+ EXTERN_C_END
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.c
new file mode 100644
index 0000000000..1e60a3f92e
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.c
@@ -0,0 +1,128 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zAlloc.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zAlloc.c
+@@ -1,5 +1,5 @@
+-/* 7zAlloc.c -- Allocation functions
+-2017-04-03 : Igor Pavlov : Public domain */
++/* 7zAlloc.c -- Allocation functions for 7z processing
++2023-03-04 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -7,74 +7,83 @@
+
+ #include "7zAlloc.h"
+
+-/* #define _SZ_ALLOC_DEBUG */
+-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
++/* #define SZ_ALLOC_DEBUG */
++/* use SZ_ALLOC_DEBUG to debug alloc/free operations */
+
+-#ifdef _SZ_ALLOC_DEBUG
++#ifdef SZ_ALLOC_DEBUG
+
++/*
+ #ifdef _WIN32
+-#include <windows.h>
++#include "7zWindows.h"
+ #endif
++*/
+
+ #include <stdio.h>
+-int g_allocCount = 0;
+-int g_allocCountTemp = 0;
++static int g_allocCount = 0;
++static int g_allocCountTemp = 0;
+
++static void Print_Alloc(const char *s, size_t size, int *counter)
++{
++ const unsigned size2 = (unsigned)size;
++ fprintf(stderr, "\n%s count = %10d : %10u bytes; ", s, *counter, size2);
++ (*counter)++;
++}
++static void Print_Free(const char *s, int *counter)
++{
++ (*counter)--;
++ fprintf(stderr, "\n%s count = %10d", s, *counter);
++}
+ #endif
+
+ void *SzAlloc(ISzAllocPtr p, size_t size)
+ {
+- UNUSED_VAR(p);
++ UNUSED_VAR(p)
+ if (size == 0)
+ return 0;
+- #ifdef _SZ_ALLOC_DEBUG
+- fprintf(stderr, "\nAlloc %10u bytes; count = %10d", (unsigned)size, g_allocCount);
+- g_allocCount++;
++ #ifdef SZ_ALLOC_DEBUG
++ Print_Alloc("Alloc", size, &g_allocCount);
+ #endif
+ return malloc(size);
+ }
+
+ void SzFree(ISzAllocPtr p, void *address)
+ {
+- UNUSED_VAR(p);
+- #ifdef _SZ_ALLOC_DEBUG
+- if (address != 0)
+- {
+- g_allocCount--;
+- fprintf(stderr, "\nFree; count = %10d", g_allocCount);
+- }
++ UNUSED_VAR(p)
++ #ifdef SZ_ALLOC_DEBUG
++ if (address)
++ Print_Free("Free ", &g_allocCount);
+ #endif
+ free(address);
+ }
+
+ void *SzAllocTemp(ISzAllocPtr p, size_t size)
+ {
+- UNUSED_VAR(p);
++ UNUSED_VAR(p)
+ if (size == 0)
+ return 0;
+- #ifdef _SZ_ALLOC_DEBUG
+- fprintf(stderr, "\nAlloc_temp %10u bytes; count = %10d", (unsigned)size, g_allocCountTemp);
+- g_allocCountTemp++;
++ #ifdef SZ_ALLOC_DEBUG
++ Print_Alloc("Alloc_temp", size, &g_allocCountTemp);
++ /*
+ #ifdef _WIN32
+ return HeapAlloc(GetProcessHeap(), 0, size);
+ #endif
++ */
+ #endif
+ return malloc(size);
+ }
+
+ void SzFreeTemp(ISzAllocPtr p, void *address)
+ {
+- UNUSED_VAR(p);
+- #ifdef _SZ_ALLOC_DEBUG
+- if (address != 0)
+- {
+- g_allocCountTemp--;
+- fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp);
+- }
++ UNUSED_VAR(p)
++ #ifdef SZ_ALLOC_DEBUG
++ if (address)
++ Print_Free("Free_temp ", &g_allocCountTemp);
++ /*
+ #ifdef _WIN32
+ HeapFree(GetProcessHeap(), 0, address);
+ return;
+ #endif
++ */
+ #endif
+ free(address);
+ }
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.h
new file mode 100644
index 0000000000..fa08253db5
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zAlloc.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zAlloc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zAlloc.h
+@@ -1,8 +1,8 @@
+ /* 7zAlloc.h -- Allocation functions
+-2017-04-03 : Igor Pavlov : Public domain */
++2023-03-04 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_ALLOC_H
+-#define __7Z_ALLOC_H
++#ifndef ZIP7_INC_7Z_ALLOC_H
++#define ZIP7_INC_7Z_ALLOC_H
+
+ #include "7zTypes.h"
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zArcIn.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zArcIn.c
new file mode 100644
index 0000000000..2187394a36
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zArcIn.c
@@ -0,0 +1,1269 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zArcIn.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zArcIn.c
+@@ -1,5 +1,5 @@
+ /* 7zArcIn.c -- 7z Input functions
+-2021-02-09 : Igor Pavlov : Public domain */
++2023-09-07 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -10,10 +10,11 @@
+ #include "7zCrc.h"
+ #include "CpuArch.h"
+
+-#define MY_ALLOC(T, p, size, alloc) { \
+- if ((p = (T *)ISzAlloc_Alloc(alloc, (size) * sizeof(T))) == NULL) return SZ_ERROR_MEM; }
++#define MY_ALLOC(T, p, size, alloc) \
++ { if ((p = (T *)ISzAlloc_Alloc(alloc, (size) * sizeof(T))) == NULL) return SZ_ERROR_MEM; }
+
+-#define MY_ALLOC_ZE(T, p, size, alloc) { if ((size) == 0) p = NULL; else MY_ALLOC(T, p, size, alloc) }
++#define MY_ALLOC_ZE(T, p, size, alloc) \
++ { if ((size) == 0) p = NULL; else MY_ALLOC(T, p, size, alloc) }
+
+ #define MY_ALLOC_AND_CPY(to, size, from, alloc) \
+ { MY_ALLOC(Byte, to, size, alloc); memcpy(to, from, size); }
+@@ -58,7 +59,7 @@ enum EIdEnum
+
+ const Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C};
+
+-#define SzBitUi32s_Init(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
++#define SzBitUi32s_INIT(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
+
+ static SRes SzBitUi32s_Alloc(CSzBitUi32s *p, size_t num, ISzAllocPtr alloc)
+ {
+@@ -69,8 +70,8 @@ static SRes SzBitUi32s_Alloc(CSzBitUi32s
+ }
+ else
+ {
+- MY_ALLOC(Byte, p->Defs, (num + 7) >> 3, alloc);
+- MY_ALLOC(UInt32, p->Vals, num, alloc);
++ MY_ALLOC(Byte, p->Defs, (num + 7) >> 3, alloc)
++ MY_ALLOC(UInt32, p->Vals, num, alloc)
+ }
+ return SZ_OK;
+ }
+@@ -81,7 +82,7 @@ static void SzBitUi32s_Free(CSzBitUi32s
+ ISzAlloc_Free(alloc, p->Vals); p->Vals = NULL;
+ }
+
+-#define SzBitUi64s_Init(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
++#define SzBitUi64s_INIT(p) { (p)->Defs = NULL; (p)->Vals = NULL; }
+
+ static void SzBitUi64s_Free(CSzBitUi64s *p, ISzAllocPtr alloc)
+ {
+@@ -96,7 +97,7 @@ static void SzAr_Init(CSzAr *p)
+ p->NumFolders = 0;
+
+ p->PackPositions = NULL;
+- SzBitUi32s_Init(&p->FolderCRCs);
++ SzBitUi32s_INIT(&p->FolderCRCs)
+
+ p->FoCodersOffsets = NULL;
+ p->FoStartPackStreamIndex = NULL;
+@@ -142,11 +143,11 @@ void SzArEx_Init(CSzArEx *p)
+ p->FileNameOffsets = NULL;
+ p->FileNames = NULL;
+
+- SzBitUi32s_Init(&p->CRCs);
+- SzBitUi32s_Init(&p->Attribs);
+- // SzBitUi32s_Init(&p->Parents);
+- SzBitUi64s_Init(&p->MTime);
+- SzBitUi64s_Init(&p->CTime);
++ SzBitUi32s_INIT(&p->CRCs)
++ SzBitUi32s_INIT(&p->Attribs)
++ // SzBitUi32s_INIT(&p->Parents)
++ SzBitUi64s_INIT(&p->MTime)
++ SzBitUi64s_INIT(&p->CTime)
+ }
+
+ void SzArEx_Free(CSzArEx *p, ISzAllocPtr alloc)
+@@ -180,11 +181,20 @@ static int TestSignatureCandidate(const
+ return 1;
+ }
+
+-#define SzData_Clear(p) { (p)->Data = NULL; (p)->Size = 0; }
++#define SzData_CLEAR(p) { (p)->Data = NULL; (p)->Size = 0; }
++
++#define SZ_READ_BYTE_SD_NOCHECK(_sd_, dest) \
++ (_sd_)->Size--; dest = *(_sd_)->Data++;
++
++#define SZ_READ_BYTE_SD(_sd_, dest) \
++ if ((_sd_)->Size == 0) return SZ_ERROR_ARCHIVE; \
++ SZ_READ_BYTE_SD_NOCHECK(_sd_, dest)
+
+-#define SZ_READ_BYTE_SD(_sd_, dest) if ((_sd_)->Size == 0) return SZ_ERROR_ARCHIVE; (_sd_)->Size--; dest = *(_sd_)->Data++;
+ #define SZ_READ_BYTE(dest) SZ_READ_BYTE_SD(sd, dest)
+-#define SZ_READ_BYTE_2(dest) if (sd.Size == 0) return SZ_ERROR_ARCHIVE; sd.Size--; dest = *sd.Data++;
++
++#define SZ_READ_BYTE_2(dest) \
++ if (sd.Size == 0) return SZ_ERROR_ARCHIVE; \
++ sd.Size--; dest = *sd.Data++;
+
+ #define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data += (size_t)(size); }
+ #define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data += (size_t)(size); }
+@@ -192,25 +202,25 @@ static int TestSignatureCandidate(const
+ #define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \
+ dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4);
+
+-static MY_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value)
++static Z7_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value)
+ {
+ Byte firstByte, mask;
+ unsigned i;
+ UInt32 v;
+
+- SZ_READ_BYTE(firstByte);
++ SZ_READ_BYTE(firstByte)
+ if ((firstByte & 0x80) == 0)
+ {
+ *value = firstByte;
+ return SZ_OK;
+ }
+- SZ_READ_BYTE(v);
++ SZ_READ_BYTE(v)
+ if ((firstByte & 0x40) == 0)
+ {
+ *value = (((UInt32)firstByte & 0x3F) << 8) | v;
+ return SZ_OK;
+ }
+- SZ_READ_BYTE(mask);
++ SZ_READ_BYTE(mask)
+ *value = v | ((UInt32)mask << 8);
+ mask = 0x20;
+ for (i = 2; i < 8; i++)
+@@ -218,11 +228,11 @@ static MY_NO_INLINE SRes ReadNumber(CSzD
+ Byte b;
+ if ((firstByte & mask) == 0)
+ {
+- UInt64 highPart = (unsigned)firstByte & (unsigned)(mask - 1);
++ const UInt64 highPart = (unsigned)firstByte & (unsigned)(mask - 1);
+ *value |= (highPart << (8 * i));
+ return SZ_OK;
+ }
+- SZ_READ_BYTE(b);
++ SZ_READ_BYTE(b)
+ *value |= ((UInt64)b << (8 * i));
+ mask >>= 1;
+ }
+@@ -230,7 +240,7 @@ static MY_NO_INLINE SRes ReadNumber(CSzD
+ }
+
+
+-static MY_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value)
++static Z7_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value)
+ {
+ Byte firstByte;
+ UInt64 value64;
+@@ -244,7 +254,7 @@ static MY_NO_INLINE SRes SzReadNumber32(
+ sd->Size--;
+ return SZ_OK;
+ }
+- RINOK(ReadNumber(sd, &value64));
++ RINOK(ReadNumber(sd, &value64))
+ if (value64 >= (UInt32)0x80000000 - 1)
+ return SZ_ERROR_UNSUPPORTED;
+ if (value64 >= ((UInt64)(1) << ((sizeof(size_t) - 1) * 8 + 4)))
+@@ -258,10 +268,10 @@ static MY_NO_INLINE SRes SzReadNumber32(
+ static SRes SkipData(CSzData *sd)
+ {
+ UInt64 size;
+- RINOK(ReadNumber(sd, &size));
++ RINOK(ReadNumber(sd, &size))
+ if (size > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+- SKIP_DATA(sd, size);
++ SKIP_DATA(sd, size)
+ return SZ_OK;
+ }
+
+@@ -270,28 +280,28 @@ static SRes WaitId(CSzData *sd, UInt32 i
+ for (;;)
+ {
+ UInt64 type;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == id)
+ return SZ_OK;
+ if (type == k7zIdEnd)
+ return SZ_ERROR_ARCHIVE;
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+ }
+
+ static SRes RememberBitVector(CSzData *sd, UInt32 numItems, const Byte **v)
+ {
+- UInt32 numBytes = (numItems + 7) >> 3;
++ const UInt32 numBytes = (numItems + 7) >> 3;
+ if (numBytes > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+ *v = sd->Data;
+- SKIP_DATA(sd, numBytes);
++ SKIP_DATA(sd, numBytes)
+ return SZ_OK;
+ }
+
+ static UInt32 CountDefinedBits(const Byte *bits, UInt32 numItems)
+ {
+- Byte b = 0;
++ unsigned b = 0;
+ unsigned m = 0;
+ UInt32 sum = 0;
+ for (; numItems != 0; numItems--)
+@@ -302,53 +312,53 @@ static UInt32 CountDefinedBits(const Byt
+ m = 8;
+ }
+ m--;
+- sum += ((b >> m) & 1);
++ sum += (UInt32)((b >> m) & 1);
+ }
+ return sum;
+ }
+
+-static MY_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAllocPtr alloc)
++static Z7_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAllocPtr alloc)
+ {
+ Byte allAreDefined;
+ Byte *v2;
+- UInt32 numBytes = (numItems + 7) >> 3;
++ const UInt32 numBytes = (numItems + 7) >> 3;
+ *v = NULL;
+- SZ_READ_BYTE(allAreDefined);
++ SZ_READ_BYTE(allAreDefined)
+ if (numBytes == 0)
+ return SZ_OK;
+ if (allAreDefined == 0)
+ {
+ if (numBytes > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+- MY_ALLOC_AND_CPY(*v, numBytes, sd->Data, alloc);
+- SKIP_DATA(sd, numBytes);
++ MY_ALLOC_AND_CPY(*v, numBytes, sd->Data, alloc)
++ SKIP_DATA(sd, numBytes)
+ return SZ_OK;
+ }
+- MY_ALLOC(Byte, *v, numBytes, alloc);
++ MY_ALLOC(Byte, *v, numBytes, alloc)
+ v2 = *v;
+ memset(v2, 0xFF, (size_t)numBytes);
+ {
+- unsigned numBits = (unsigned)numItems & 7;
++ const unsigned numBits = (unsigned)numItems & 7;
+ if (numBits != 0)
+ v2[(size_t)numBytes - 1] = (Byte)((((UInt32)1 << numBits) - 1) << (8 - numBits));
+ }
+ return SZ_OK;
+ }
+
+-static MY_NO_INLINE SRes ReadUi32s(CSzData *sd2, UInt32 numItems, CSzBitUi32s *crcs, ISzAllocPtr alloc)
++static Z7_NO_INLINE SRes ReadUi32s(CSzData *sd2, UInt32 numItems, CSzBitUi32s *crcs, ISzAllocPtr alloc)
+ {
+ UInt32 i;
+ CSzData sd;
+ UInt32 *vals;
+ const Byte *defs;
+- MY_ALLOC_ZE(UInt32, crcs->Vals, numItems, alloc);
++ MY_ALLOC_ZE(UInt32, crcs->Vals, numItems, alloc)
+ sd = *sd2;
+ defs = crcs->Defs;
+ vals = crcs->Vals;
+ for (i = 0; i < numItems; i++)
+ if (SzBitArray_Check(defs, i))
+ {
+- SZ_READ_32(vals[i]);
++ SZ_READ_32(vals[i])
+ }
+ else
+ vals[i] = 0;
+@@ -359,7 +369,7 @@ static MY_NO_INLINE SRes ReadUi32s(CSzDa
+ static SRes ReadBitUi32s(CSzData *sd, UInt32 numItems, CSzBitUi32s *crcs, ISzAllocPtr alloc)
+ {
+ SzBitUi32s_Free(crcs, alloc);
+- RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc));
++ RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc))
+ return ReadUi32s(sd, numItems, crcs, alloc);
+ }
+
+@@ -367,36 +377,36 @@ static SRes SkipBitUi32s(CSzData *sd, UI
+ {
+ Byte allAreDefined;
+ UInt32 numDefined = numItems;
+- SZ_READ_BYTE(allAreDefined);
++ SZ_READ_BYTE(allAreDefined)
+ if (!allAreDefined)
+ {
+- size_t numBytes = (numItems + 7) >> 3;
++ const size_t numBytes = (numItems + 7) >> 3;
+ if (numBytes > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+ numDefined = CountDefinedBits(sd->Data, numItems);
+- SKIP_DATA(sd, numBytes);
++ SKIP_DATA(sd, numBytes)
+ }
+ if (numDefined > (sd->Size >> 2))
+ return SZ_ERROR_ARCHIVE;
+- SKIP_DATA(sd, (size_t)numDefined * 4);
++ SKIP_DATA(sd, (size_t)numDefined * 4)
+ return SZ_OK;
+ }
+
+ static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAllocPtr alloc)
+ {
+- RINOK(SzReadNumber32(sd, &p->NumPackStreams));
++ RINOK(SzReadNumber32(sd, &p->NumPackStreams))
+
+- RINOK(WaitId(sd, k7zIdSize));
+- MY_ALLOC(UInt64, p->PackPositions, (size_t)p->NumPackStreams + 1, alloc);
++ RINOK(WaitId(sd, k7zIdSize))
++ MY_ALLOC(UInt64, p->PackPositions, (size_t)p->NumPackStreams + 1, alloc)
+ {
+ UInt64 sum = 0;
+ UInt32 i;
+- UInt32 numPackStreams = p->NumPackStreams;
++ const UInt32 numPackStreams = p->NumPackStreams;
+ for (i = 0; i < numPackStreams; i++)
+ {
+ UInt64 packSize;
+ p->PackPositions[i] = sum;
+- RINOK(ReadNumber(sd, &packSize));
++ RINOK(ReadNumber(sd, &packSize))
+ sum += packSize;
+ if (sum < packSize)
+ return SZ_ERROR_ARCHIVE;
+@@ -407,16 +417,16 @@ static SRes ReadPackInfo(CSzAr *p, CSzDa
+ for (;;)
+ {
+ UInt64 type;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == k7zIdEnd)
+ return SZ_OK;
+ if (type == k7zIdCRC)
+ {
+ /* CRC of packed streams is unused now */
+- RINOK(SkipBitUi32s(sd, p->NumPackStreams));
++ RINOK(SkipBitUi32s(sd, p->NumPackStreams))
+ continue;
+ }
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+ }
+
+@@ -442,7 +452,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ f->NumPackStreams = 0;
+ f->UnpackStream = 0;
+
+- RINOK(SzReadNumber32(sd, &numCoders));
++ RINOK(SzReadNumber32(sd, &numCoders))
+ if (numCoders == 0 || numCoders > SZ_NUM_CODERS_IN_FOLDER_MAX)
+ return SZ_ERROR_UNSUPPORTED;
+
+@@ -453,7 +463,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ unsigned idSize, j;
+ UInt64 id;
+
+- SZ_READ_BYTE(mainByte);
++ SZ_READ_BYTE(mainByte)
+ if ((mainByte & 0xC0) != 0)
+ return SZ_ERROR_UNSUPPORTED;
+
+@@ -481,12 +491,12 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ {
+ UInt32 numStreams;
+
+- RINOK(SzReadNumber32(sd, &numStreams));
++ RINOK(SzReadNumber32(sd, &numStreams))
+ if (numStreams > k_NumCodersStreams_in_Folder_MAX)
+ return SZ_ERROR_UNSUPPORTED;
+ coder->NumStreams = (Byte)numStreams;
+
+- RINOK(SzReadNumber32(sd, &numStreams));
++ RINOK(SzReadNumber32(sd, &numStreams))
+ if (numStreams != 1)
+ return SZ_ERROR_UNSUPPORTED;
+ }
+@@ -499,7 +509,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ if ((mainByte & 0x20) != 0)
+ {
+ UInt32 propsSize = 0;
+- RINOK(SzReadNumber32(sd, &propsSize));
++ RINOK(SzReadNumber32(sd, &propsSize))
+ if (propsSize > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+ if (propsSize >= 0x80)
+@@ -549,12 +559,12 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ {
+ CSzBond *bp = f->Bonds + i;
+
+- RINOK(SzReadNumber32(sd, &bp->InIndex));
++ RINOK(SzReadNumber32(sd, &bp->InIndex))
+ if (bp->InIndex >= numInStreams || streamUsed[bp->InIndex])
+ return SZ_ERROR_ARCHIVE;
+ streamUsed[bp->InIndex] = True;
+
+- RINOK(SzReadNumber32(sd, &bp->OutIndex));
++ RINOK(SzReadNumber32(sd, &bp->OutIndex))
+ if (bp->OutIndex >= numCoders || coderUsed[bp->OutIndex])
+ return SZ_ERROR_ARCHIVE;
+ coderUsed[bp->OutIndex] = True;
+@@ -584,7 +594,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ for (i = 0; i < numPackStreams; i++)
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(sd, &index));
++ RINOK(SzReadNumber32(sd, &index))
+ if (index >= numInStreams || streamUsed[index])
+ return SZ_ERROR_ARCHIVE;
+ streamUsed[index] = True;
+@@ -598,7 +608,7 @@ SRes SzGetNextFolderItem(CSzFolder *f, C
+ }
+
+
+-static MY_NO_INLINE SRes SkipNumbers(CSzData *sd2, UInt32 num)
++static Z7_NO_INLINE SRes SkipNumbers(CSzData *sd2, UInt32 num)
+ {
+ CSzData sd;
+ sd = *sd2;
+@@ -606,7 +616,7 @@ static MY_NO_INLINE SRes SkipNumbers(CSz
+ {
+ Byte firstByte, mask;
+ unsigned i;
+- SZ_READ_BYTE_2(firstByte);
++ SZ_READ_BYTE_2(firstByte)
+ if ((firstByte & 0x80) == 0)
+ continue;
+ if ((firstByte & 0x40) == 0)
+@@ -622,7 +632,7 @@ static MY_NO_INLINE SRes SkipNumbers(CSz
+ mask >>= 1;
+ if (i > sd.Size)
+ return SZ_ERROR_ARCHIVE;
+- SKIP_DATA2(sd, i);
++ SKIP_DATA2(sd, i)
+ }
+ *sd2 = sd;
+ return SZ_OK;
+@@ -645,30 +655,30 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ const Byte *startBufPtr;
+ Byte external;
+
+- RINOK(WaitId(sd2, k7zIdFolder));
++ RINOK(WaitId(sd2, k7zIdFolder))
+
+- RINOK(SzReadNumber32(sd2, &numFolders));
++ RINOK(SzReadNumber32(sd2, &numFolders))
+ if (numFolders > numFoldersMax)
+ return SZ_ERROR_UNSUPPORTED;
+ p->NumFolders = numFolders;
+
+- SZ_READ_BYTE_SD(sd2, external);
++ SZ_READ_BYTE_SD(sd2, external)
+ if (external == 0)
+ sd = *sd2;
+ else
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(sd2, &index));
++ RINOK(SzReadNumber32(sd2, &index))
+ if (index >= numTempBufs)
+ return SZ_ERROR_ARCHIVE;
+ sd.Data = tempBufs[index].data;
+ sd.Size = tempBufs[index].size;
+ }
+
+- MY_ALLOC(size_t, p->FoCodersOffsets, (size_t)numFolders + 1, alloc);
+- MY_ALLOC(UInt32, p->FoStartPackStreamIndex, (size_t)numFolders + 1, alloc);
+- MY_ALLOC(UInt32, p->FoToCoderUnpackSizes, (size_t)numFolders + 1, alloc);
+- MY_ALLOC_ZE(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc);
++ MY_ALLOC(size_t, p->FoCodersOffsets, (size_t)numFolders + 1, alloc)
++ MY_ALLOC(UInt32, p->FoStartPackStreamIndex, (size_t)numFolders + 1, alloc)
++ MY_ALLOC(UInt32, p->FoToCoderUnpackSizes, (size_t)numFolders + 1, alloc)
++ MY_ALLOC_ZE(Byte, p->FoToMainUnpackSizeIndex, (size_t)numFolders, alloc)
+
+ startBufPtr = sd.Data;
+
+@@ -681,7 +691,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
+
+ p->FoCodersOffsets[fo] = (size_t)(sd.Data - startBufPtr);
+
+- RINOK(SzReadNumber32(&sd, &numCoders));
++ RINOK(SzReadNumber32(&sd, &numCoders))
+ if (numCoders == 0 || numCoders > k_Scan_NumCoders_MAX)
+ return SZ_ERROR_UNSUPPORTED;
+
+@@ -691,7 +701,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ unsigned idSize;
+ UInt32 coderInStreams;
+
+- SZ_READ_BYTE_2(mainByte);
++ SZ_READ_BYTE_2(mainByte)
+ if ((mainByte & 0xC0) != 0)
+ return SZ_ERROR_UNSUPPORTED;
+ idSize = (mainByte & 0xF);
+@@ -699,15 +709,15 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ return SZ_ERROR_UNSUPPORTED;
+ if (idSize > sd.Size)
+ return SZ_ERROR_ARCHIVE;
+- SKIP_DATA2(sd, idSize);
++ SKIP_DATA2(sd, idSize)
+
+ coderInStreams = 1;
+
+ if ((mainByte & 0x10) != 0)
+ {
+ UInt32 coderOutStreams;
+- RINOK(SzReadNumber32(&sd, &coderInStreams));
+- RINOK(SzReadNumber32(&sd, &coderOutStreams));
++ RINOK(SzReadNumber32(&sd, &coderInStreams))
++ RINOK(SzReadNumber32(&sd, &coderOutStreams))
+ if (coderInStreams > k_Scan_NumCodersStreams_in_Folder_MAX || coderOutStreams != 1)
+ return SZ_ERROR_UNSUPPORTED;
+ }
+@@ -717,10 +727,10 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ if ((mainByte & 0x20) != 0)
+ {
+ UInt32 propsSize;
+- RINOK(SzReadNumber32(&sd, &propsSize));
++ RINOK(SzReadNumber32(&sd, &propsSize))
+ if (propsSize > sd.Size)
+ return SZ_ERROR_ARCHIVE;
+- SKIP_DATA2(sd, propsSize);
++ SKIP_DATA2(sd, propsSize)
+ }
+ }
+
+@@ -734,7 +744,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ Byte coderUsed[k_Scan_NumCoders_MAX];
+
+ UInt32 i;
+- UInt32 numBonds = numCoders - 1;
++ const UInt32 numBonds = numCoders - 1;
+ if (numInStreams < numBonds)
+ return SZ_ERROR_ARCHIVE;
+
+@@ -750,12 +760,12 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ {
+ UInt32 index;
+
+- RINOK(SzReadNumber32(&sd, &index));
++ RINOK(SzReadNumber32(&sd, &index))
+ if (index >= numInStreams || streamUsed[index])
+ return SZ_ERROR_ARCHIVE;
+ streamUsed[index] = True;
+
+- RINOK(SzReadNumber32(&sd, &index));
++ RINOK(SzReadNumber32(&sd, &index))
+ if (index >= numCoders || coderUsed[index])
+ return SZ_ERROR_ARCHIVE;
+ coderUsed[index] = True;
+@@ -767,7 +777,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ for (i = 0; i < numPackStreams; i++)
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(&sd, &index));
++ RINOK(SzReadNumber32(&sd, &index))
+ if (index >= numInStreams || streamUsed[index])
+ return SZ_ERROR_ARCHIVE;
+ streamUsed[index] = True;
+@@ -802,7 +812,7 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ const size_t dataSize = (size_t)(sd.Data - startBufPtr);
+ p->FoStartPackStreamIndex[fo] = packStreamIndex;
+ p->FoCodersOffsets[fo] = dataSize;
+- MY_ALLOC_ZE_AND_CPY(p->CodersData, dataSize, startBufPtr, alloc);
++ MY_ALLOC_ZE_AND_CPY(p->CodersData, dataSize, startBufPtr, alloc)
+ }
+
+ if (external != 0)
+@@ -812,21 +822,21 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ sd = *sd2;
+ }
+
+- RINOK(WaitId(&sd, k7zIdCodersUnpackSize));
++ RINOK(WaitId(&sd, k7zIdCodersUnpackSize))
+
+- MY_ALLOC_ZE(UInt64, p->CoderUnpackSizes, (size_t)numCodersOutStreams, alloc);
++ MY_ALLOC_ZE(UInt64, p->CoderUnpackSizes, (size_t)numCodersOutStreams, alloc)
+ {
+ UInt32 i;
+ for (i = 0; i < numCodersOutStreams; i++)
+ {
+- RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i));
++ RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i))
+ }
+ }
+
+ for (;;)
+ {
+ UInt64 type;
+- RINOK(ReadID(&sd, &type));
++ RINOK(ReadID(&sd, &type))
+ if (type == k7zIdEnd)
+ {
+ *sd2 = sd;
+@@ -834,10 +844,10 @@ static SRes ReadUnpackInfo(CSzAr *p,
+ }
+ if (type == k7zIdCRC)
+ {
+- RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc));
++ RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc))
+ continue;
+ }
+- RINOK(SkipData(&sd));
++ RINOK(SkipData(&sd))
+ }
+ }
+
+@@ -862,13 +872,13 @@ static SRes ReadSubStreamsInfo(CSzAr *p,
+ {
+ UInt64 type = 0;
+ UInt32 numSubDigests = 0;
+- UInt32 numFolders = p->NumFolders;
++ const UInt32 numFolders = p->NumFolders;
+ UInt32 numUnpackStreams = numFolders;
+ UInt32 numUnpackSizesInData = 0;
+
+ for (;;)
+ {
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == k7zIdNumUnpackStream)
+ {
+ UInt32 i;
+@@ -878,7 +888,7 @@ static SRes ReadSubStreamsInfo(CSzAr *p,
+ for (i = 0; i < numFolders; i++)
+ {
+ UInt32 numStreams;
+- RINOK(SzReadNumber32(sd, &numStreams));
++ RINOK(SzReadNumber32(sd, &numStreams))
+ if (numUnpackStreams > numUnpackStreams + numStreams)
+ return SZ_ERROR_UNSUPPORTED;
+ numUnpackStreams += numStreams;
+@@ -892,7 +902,7 @@ static SRes ReadSubStreamsInfo(CSzAr *p,
+ }
+ if (type == k7zIdCRC || type == k7zIdSize || type == k7zIdEnd)
+ break;
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+
+ if (!ssi->sdNumSubStreams.Data)
+@@ -908,9 +918,9 @@ static SRes ReadSubStreamsInfo(CSzAr *p,
+ if (type == k7zIdSize)
+ {
+ ssi->sdSizes.Data = sd->Data;
+- RINOK(SkipNumbers(sd, numUnpackSizesInData));
++ RINOK(SkipNumbers(sd, numUnpackSizesInData))
+ ssi->sdSizes.Size = (size_t)(sd->Data - ssi->sdSizes.Data);
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+
+ for (;;)
+@@ -920,14 +930,14 @@ static SRes ReadSubStreamsInfo(CSzAr *p,
+ if (type == k7zIdCRC)
+ {
+ ssi->sdCRCs.Data = sd->Data;
+- RINOK(SkipBitUi32s(sd, numSubDigests));
++ RINOK(SkipBitUi32s(sd, numSubDigests))
+ ssi->sdCRCs.Size = (size_t)(sd->Data - ssi->sdCRCs.Data);
+ }
+ else
+ {
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+ }
+
+@@ -940,31 +950,31 @@ static SRes SzReadStreamsInfo(CSzAr *p,
+ {
+ UInt64 type;
+
+- SzData_Clear(&ssi->sdSizes);
+- SzData_Clear(&ssi->sdCRCs);
+- SzData_Clear(&ssi->sdNumSubStreams);
++ SzData_CLEAR(&ssi->sdSizes)
++ SzData_CLEAR(&ssi->sdCRCs)
++ SzData_CLEAR(&ssi->sdNumSubStreams)
+
+ *dataOffset = 0;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == k7zIdPackInfo)
+ {
+- RINOK(ReadNumber(sd, dataOffset));
++ RINOK(ReadNumber(sd, dataOffset))
+ if (*dataOffset > p->RangeLimit)
+ return SZ_ERROR_ARCHIVE;
+- RINOK(ReadPackInfo(p, sd, alloc));
++ RINOK(ReadPackInfo(p, sd, alloc))
+ if (p->PackPositions[p->NumPackStreams] > p->RangeLimit - *dataOffset)
+ return SZ_ERROR_ARCHIVE;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+ if (type == k7zIdUnpackInfo)
+ {
+- RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc));
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc))
++ RINOK(ReadID(sd, &type))
+ }
+ if (type == k7zIdSubStreamsInfo)
+ {
+- RINOK(ReadSubStreamsInfo(p, sd, ssi));
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadSubStreamsInfo(p, sd, ssi))
++ RINOK(ReadID(sd, &type))
+ }
+ else
+ {
+@@ -976,7 +986,7 @@ static SRes SzReadStreamsInfo(CSzAr *p,
+ }
+
+ static SRes SzReadAndDecodePackedStreams(
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ CSzData *sd,
+ CBuf *tempBufs,
+ UInt32 numFoldersMax,
+@@ -988,7 +998,7 @@ static SRes SzReadAndDecodePackedStreams
+ UInt32 fo;
+ CSubStreamInfo ssi;
+
+- RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp));
++ RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp))
+
+ dataStartPos += baseOffset;
+ if (p->NumFolders == 0)
+@@ -1000,7 +1010,7 @@ static SRes SzReadAndDecodePackedStreams
+ for (fo = 0; fo < p->NumFolders; fo++)
+ {
+ CBuf *tempBuf = tempBufs + fo;
+- UInt64 unpackSize = SzAr_GetFolderUnpackSize(p, fo);
++ const UInt64 unpackSize = SzAr_GetFolderUnpackSize(p, fo);
+ if ((size_t)unpackSize != unpackSize)
+ return SZ_ERROR_MEM;
+ if (!Buf_Create(tempBuf, (size_t)unpackSize, allocTemp))
+@@ -1010,8 +1020,8 @@ static SRes SzReadAndDecodePackedStreams
+ for (fo = 0; fo < p->NumFolders; fo++)
+ {
+ const CBuf *tempBuf = tempBufs + fo;
+- RINOK(LookInStream_SeekTo(inStream, dataStartPos));
+- RINOK(SzAr_DecodeFolder(p, fo, inStream, dataStartPos, tempBuf->data, tempBuf->size, allocTemp));
++ RINOK(LookInStream_SeekTo(inStream, dataStartPos))
++ RINOK(SzAr_DecodeFolder(p, fo, inStream, dataStartPos, tempBuf->data, tempBuf->size, allocTemp))
+ }
+
+ return SZ_OK;
+@@ -1046,7 +1056,7 @@ static SRes SzReadFileNames(const Byte *
+ return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
+ }
+
+-static MY_NO_INLINE SRes ReadTime(CSzBitUi64s *p, UInt32 num,
++static Z7_NO_INLINE SRes ReadTime(CSzBitUi64s *p, UInt32 num,
+ CSzData *sd2,
+ const CBuf *tempBufs, UInt32 numTempBufs,
+ ISzAllocPtr alloc)
+@@ -1057,22 +1067,22 @@ static MY_NO_INLINE SRes ReadTime(CSzBit
+ Byte *defs;
+ Byte external;
+
+- RINOK(ReadBitVector(sd2, num, &p->Defs, alloc));
++ RINOK(ReadBitVector(sd2, num, &p->Defs, alloc))
+
+- SZ_READ_BYTE_SD(sd2, external);
++ SZ_READ_BYTE_SD(sd2, external)
+ if (external == 0)
+ sd = *sd2;
+ else
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(sd2, &index));
++ RINOK(SzReadNumber32(sd2, &index))
+ if (index >= numTempBufs)
+ return SZ_ERROR_ARCHIVE;
+ sd.Data = tempBufs[index].data;
+ sd.Size = tempBufs[index].size;
+ }
+
+- MY_ALLOC_ZE(CNtfsFileTime, p->Vals, num, alloc);
++ MY_ALLOC_ZE(CNtfsFileTime, p->Vals, num, alloc)
+ vals = p->Vals;
+ defs = p->Defs;
+ for (i = 0; i < num; i++)
+@@ -1082,7 +1092,7 @@ static MY_NO_INLINE SRes ReadTime(CSzBit
+ return SZ_ERROR_ARCHIVE;
+ vals[i].Low = GetUi32(sd.Data);
+ vals[i].High = GetUi32(sd.Data + 4);
+- SKIP_DATA2(sd, 8);
++ SKIP_DATA2(sd, 8)
+ }
+ else
+ vals[i].High = vals[i].Low = 0;
+@@ -1100,7 +1110,7 @@ static MY_NO_INLINE SRes ReadTime(CSzBit
+ static SRes SzReadHeader2(
+ CSzArEx *p, /* allocMain */
+ CSzData *sd,
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ CBuf *tempBufs, UInt32 *numTempBufs,
+ ISzAllocPtr allocMain,
+ ISzAllocPtr allocTemp
+@@ -1111,26 +1121,26 @@ static SRes SzReadHeader2(
+ {
+ UInt64 type;
+
+- SzData_Clear(&ssi.sdSizes);
+- SzData_Clear(&ssi.sdCRCs);
+- SzData_Clear(&ssi.sdNumSubStreams);
++ SzData_CLEAR(&ssi.sdSizes)
++ SzData_CLEAR(&ssi.sdCRCs)
++ SzData_CLEAR(&ssi.sdNumSubStreams)
+
+ ssi.NumSubDigests = 0;
+ ssi.NumTotalSubStreams = 0;
+
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+
+ if (type == k7zIdArchiveProperties)
+ {
+ for (;;)
+ {
+ UInt64 type2;
+- RINOK(ReadID(sd, &type2));
++ RINOK(ReadID(sd, &type2))
+ if (type2 == k7zIdEnd)
+ break;
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+
+ if (type == k7zIdAdditionalStreamsInfo)
+@@ -1148,15 +1158,15 @@ static SRes SzReadHeader2(
+
+ if (res != SZ_OK)
+ return res;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+
+ if (type == k7zIdMainStreamsInfo)
+ {
+ RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs, *numTempBufs,
+- &p->dataPos, &ssi, allocMain));
++ &p->dataPos, &ssi, allocMain))
+ p->dataPos += p->startPosAfterHeader;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ }
+
+ if (type == k7zIdEnd)
+@@ -1174,23 +1184,23 @@ static SRes SzReadHeader2(
+ const Byte *emptyStreams = NULL;
+ const Byte *emptyFiles = NULL;
+
+- RINOK(SzReadNumber32(sd, &numFiles));
++ RINOK(SzReadNumber32(sd, &numFiles))
+ p->NumFiles = numFiles;
+
+ for (;;)
+ {
+ UInt64 type;
+ UInt64 size;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == k7zIdEnd)
+ break;
+- RINOK(ReadNumber(sd, &size));
++ RINOK(ReadNumber(sd, &size))
+ if (size > sd->Size)
+ return SZ_ERROR_ARCHIVE;
+
+ if (type >= ((UInt32)1 << 8))
+ {
+- SKIP_DATA(sd, size);
++ SKIP_DATA(sd, size)
+ }
+ else switch ((unsigned)type)
+ {
+@@ -1200,7 +1210,7 @@ static SRes SzReadHeader2(
+ const Byte *namesData;
+ Byte external;
+
+- SZ_READ_BYTE(external);
++ SZ_READ_BYTE(external)
+ if (external == 0)
+ {
+ namesSize = (size_t)size - 1;
+@@ -1209,7 +1219,7 @@ static SRes SzReadHeader2(
+ else
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(sd, &index));
++ RINOK(SzReadNumber32(sd, &index))
+ if (index >= *numTempBufs)
+ return SZ_ERROR_ARCHIVE;
+ namesData = (tempBufs)[index].data;
+@@ -1218,25 +1228,25 @@ static SRes SzReadHeader2(
+
+ if ((namesSize & 1) != 0)
+ return SZ_ERROR_ARCHIVE;
+- MY_ALLOC(size_t, p->FileNameOffsets, numFiles + 1, allocMain);
+- MY_ALLOC_ZE_AND_CPY(p->FileNames, namesSize, namesData, allocMain);
++ MY_ALLOC(size_t, p->FileNameOffsets, numFiles + 1, allocMain)
++ MY_ALLOC_ZE_AND_CPY(p->FileNames, namesSize, namesData, allocMain)
+ RINOK(SzReadFileNames(p->FileNames, namesSize, numFiles, p->FileNameOffsets))
+ if (external == 0)
+ {
+- SKIP_DATA(sd, namesSize);
++ SKIP_DATA(sd, namesSize)
+ }
+ break;
+ }
+ case k7zIdEmptyStream:
+ {
+- RINOK(RememberBitVector(sd, numFiles, &emptyStreams));
++ RINOK(RememberBitVector(sd, numFiles, &emptyStreams))
+ numEmptyStreams = CountDefinedBits(emptyStreams, numFiles);
+ emptyFiles = NULL;
+ break;
+ }
+ case k7zIdEmptyFile:
+ {
+- RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles));
++ RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles))
+ break;
+ }
+ case k7zIdWinAttrib:
+@@ -1245,22 +1255,22 @@ static SRes SzReadHeader2(
+ CSzData sdSwitch;
+ CSzData *sdPtr;
+ SzBitUi32s_Free(&p->Attribs, allocMain);
+- RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain));
++ RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain))
+
+- SZ_READ_BYTE(external);
++ SZ_READ_BYTE(external)
+ if (external == 0)
+ sdPtr = sd;
+ else
+ {
+ UInt32 index;
+- RINOK(SzReadNumber32(sd, &index));
++ RINOK(SzReadNumber32(sd, &index))
+ if (index >= *numTempBufs)
+ return SZ_ERROR_ARCHIVE;
+ sdSwitch.Data = (tempBufs)[index].data;
+ sdSwitch.Size = (tempBufs)[index].size;
+ sdPtr = &sdSwitch;
+ }
+- RINOK(ReadUi32s(sdPtr, numFiles, &p->Attribs, allocMain));
++ RINOK(ReadUi32s(sdPtr, numFiles, &p->Attribs, allocMain))
+ break;
+ }
+ /*
+@@ -1273,11 +1283,11 @@ static SRes SzReadHeader2(
+ break;
+ }
+ */
+- case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break;
+- case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break;
++ case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)) break;
++ case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)) break;
+ default:
+ {
+- SKIP_DATA(sd, size);
++ SKIP_DATA(sd, size)
+ }
+ }
+ }
+@@ -1288,10 +1298,10 @@ static SRes SzReadHeader2(
+ for (;;)
+ {
+ UInt64 type;
+- RINOK(ReadID(sd, &type));
++ RINOK(ReadID(sd, &type))
+ if (type == k7zIdEnd)
+ break;
+- RINOK(SkipData(sd));
++ RINOK(SkipData(sd))
+ }
+
+ {
+@@ -1303,40 +1313,37 @@ static SRes SzReadHeader2(
+ UInt64 unpackPos = 0;
+ const Byte *digestsDefs = NULL;
+ const Byte *digestsVals = NULL;
+- UInt32 digestsValsIndex = 0;
+- UInt32 digestIndex;
+- Byte allDigestsDefined = 0;
++ UInt32 digestIndex = 0;
+ Byte isDirMask = 0;
+ Byte crcMask = 0;
+ Byte mask = 0x80;
+
+- MY_ALLOC(UInt32, p->FolderToFile, p->db.NumFolders + 1, allocMain);
+- MY_ALLOC_ZE(UInt32, p->FileToFolder, p->NumFiles, allocMain);
+- MY_ALLOC(UInt64, p->UnpackPositions, p->NumFiles + 1, allocMain);
+- MY_ALLOC_ZE(Byte, p->IsDirs, (p->NumFiles + 7) >> 3, allocMain);
++ MY_ALLOC(UInt32, p->FolderToFile, p->db.NumFolders + 1, allocMain)
++ MY_ALLOC_ZE(UInt32, p->FileToFolder, p->NumFiles, allocMain)
++ MY_ALLOC(UInt64, p->UnpackPositions, p->NumFiles + 1, allocMain)
++ MY_ALLOC_ZE(Byte, p->IsDirs, (p->NumFiles + 7) >> 3, allocMain)
+
+- RINOK(SzBitUi32s_Alloc(&p->CRCs, p->NumFiles, allocMain));
++ RINOK(SzBitUi32s_Alloc(&p->CRCs, p->NumFiles, allocMain))
+
+ if (ssi.sdCRCs.Size != 0)
+ {
+- SZ_READ_BYTE_SD(&ssi.sdCRCs, allDigestsDefined);
++ Byte allDigestsDefined = 0;
++ SZ_READ_BYTE_SD_NOCHECK(&ssi.sdCRCs, allDigestsDefined)
+ if (allDigestsDefined)
+ digestsVals = ssi.sdCRCs.Data;
+ else
+ {
+- size_t numBytes = (ssi.NumSubDigests + 7) >> 3;
++ const size_t numBytes = (ssi.NumSubDigests + 7) >> 3;
+ digestsDefs = ssi.sdCRCs.Data;
+ digestsVals = digestsDefs + numBytes;
+ }
+ }
+
+- digestIndex = 0;
+-
+ for (i = 0; i < numFiles; i++, mask >>= 1)
+ {
+ if (mask == 0)
+ {
+- UInt32 byteIndex = (i - 1) >> 3;
++ const UInt32 byteIndex = (i - 1) >> 3;
+ p->IsDirs[byteIndex] = isDirMask;
+ p->CRCs.Defs[byteIndex] = crcMask;
+ isDirMask = 0;
+@@ -1374,18 +1381,17 @@ static SRes SzReadHeader2(
+ numSubStreams = 1;
+ if (ssi.sdNumSubStreams.Data)
+ {
+- RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams));
++ RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams))
+ }
+ remSubStreams = numSubStreams;
+ if (numSubStreams != 0)
+ break;
+ {
+- UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
++ const UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
+ unpackPos += folderUnpackSize;
+ if (unpackPos < folderUnpackSize)
+ return SZ_ERROR_ARCHIVE;
+ }
+-
+ folderIndex++;
+ }
+ }
+@@ -1397,47 +1403,44 @@ static SRes SzReadHeader2(
+
+ if (--remSubStreams == 0)
+ {
+- UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
+- UInt64 startFolderUnpackPos = p->UnpackPositions[p->FolderToFile[folderIndex]];
++ const UInt64 folderUnpackSize = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
++ const UInt64 startFolderUnpackPos = p->UnpackPositions[p->FolderToFile[folderIndex]];
+ if (folderUnpackSize < unpackPos - startFolderUnpackPos)
+ return SZ_ERROR_ARCHIVE;
+ unpackPos = startFolderUnpackPos + folderUnpackSize;
+ if (unpackPos < folderUnpackSize)
+ return SZ_ERROR_ARCHIVE;
+
+- if (numSubStreams == 1 && SzBitWithVals_Check(&p->db.FolderCRCs, i))
++ if (numSubStreams == 1 && SzBitWithVals_Check(&p->db.FolderCRCs, folderIndex))
+ {
+ p->CRCs.Vals[i] = p->db.FolderCRCs.Vals[folderIndex];
+ crcMask |= mask;
+ }
+- else if (allDigestsDefined || (digestsDefs && SzBitArray_Check(digestsDefs, digestIndex)))
+- {
+- p->CRCs.Vals[i] = GetUi32(digestsVals + (size_t)digestsValsIndex * 4);
+- digestsValsIndex++;
+- crcMask |= mask;
+- }
+-
+ folderIndex++;
+ }
+ else
+ {
+ UInt64 v;
+- RINOK(ReadNumber(&ssi.sdSizes, &v));
++ RINOK(ReadNumber(&ssi.sdSizes, &v))
+ unpackPos += v;
+ if (unpackPos < v)
+ return SZ_ERROR_ARCHIVE;
+- if (allDigestsDefined || (digestsDefs && SzBitArray_Check(digestsDefs, digestIndex)))
++ }
++ if ((crcMask & mask) == 0 && digestsVals)
++ {
++ if (!digestsDefs || SzBitArray_Check(digestsDefs, digestIndex))
+ {
+- p->CRCs.Vals[i] = GetUi32(digestsVals + (size_t)digestsValsIndex * 4);
+- digestsValsIndex++;
++ p->CRCs.Vals[i] = GetUi32(digestsVals);
++ digestsVals += 4;
+ crcMask |= mask;
+ }
++ digestIndex++;
+ }
+ }
+
+ if (mask != 0x80)
+ {
+- UInt32 byteIndex = (i - 1) >> 3;
++ const UInt32 byteIndex = (i - 1) >> 3;
+ p->IsDirs[byteIndex] = isDirMask;
+ p->CRCs.Defs[byteIndex] = crcMask;
+ }
+@@ -1454,7 +1457,7 @@ static SRes SzReadHeader2(
+ break;
+ if (!ssi.sdNumSubStreams.Data)
+ return SZ_ERROR_ARCHIVE;
+- RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams));
++ RINOK(SzReadNumber32(&ssi.sdNumSubStreams, &numSubStreams))
+ if (numSubStreams != 0)
+ return SZ_ERROR_ARCHIVE;
+ /*
+@@ -1479,7 +1482,7 @@ static SRes SzReadHeader2(
+ static SRes SzReadHeader(
+ CSzArEx *p,
+ CSzData *sd,
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ ISzAllocPtr allocMain,
+ ISzAllocPtr allocTemp)
+ {
+@@ -1498,7 +1501,7 @@ static SRes SzReadHeader(
+ for (i = 0; i < NUM_ADDITIONAL_STREAMS_MAX; i++)
+ Buf_Free(tempBufs + i, allocTemp);
+
+- RINOK(res);
++ RINOK(res)
+
+ if (sd->Size != 0)
+ return SZ_ERROR_FAIL;
+@@ -1508,7 +1511,7 @@ static SRes SzReadHeader(
+
+ static SRes SzArEx_Open2(
+ CSzArEx *p,
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ ISzAllocPtr allocMain,
+ ISzAllocPtr allocTemp)
+ {
+@@ -1521,9 +1524,9 @@ static SRes SzArEx_Open2(
+ SRes res;
+
+ startArcPos = 0;
+- RINOK(ILookInStream_Seek(inStream, &startArcPos, SZ_SEEK_CUR));
++ RINOK(ILookInStream_Seek(inStream, &startArcPos, SZ_SEEK_CUR))
+
+- RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize, SZ_ERROR_NO_ARCHIVE));
++ RINOK(LookInStream_Read2(inStream, header, k7zStartHeaderSize, SZ_ERROR_NO_ARCHIVE))
+
+ if (!TestSignatureCandidate(header))
+ return SZ_ERROR_NO_ARCHIVE;
+@@ -1552,14 +1555,14 @@ static SRes SzArEx_Open2(
+
+ {
+ Int64 pos = 0;
+- RINOK(ILookInStream_Seek(inStream, &pos, SZ_SEEK_END));
++ RINOK(ILookInStream_Seek(inStream, &pos, SZ_SEEK_END))
+ if ((UInt64)pos < (UInt64)startArcPos + nextHeaderOffset ||
+ (UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset ||
+ (UInt64)pos < (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset + nextHeaderSize)
+ return SZ_ERROR_INPUT_EOF;
+ }
+
+- RINOK(LookInStream_SeekTo(inStream, (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset));
++ RINOK(LookInStream_SeekTo(inStream, (UInt64)startArcPos + k7zStartHeaderSize + nextHeaderOffset))
+
+ if (!Buf_Create(&buf, nextHeaderSizeT, allocTemp))
+ return SZ_ERROR_MEM;
+@@ -1634,10 +1637,10 @@ static SRes SzArEx_Open2(
+ }
+
+
+-SRes SzArEx_Open(CSzArEx *p, ILookInStream *inStream,
++SRes SzArEx_Open(CSzArEx *p, ILookInStreamPtr inStream,
+ ISzAllocPtr allocMain, ISzAllocPtr allocTemp)
+ {
+- SRes res = SzArEx_Open2(p, inStream, allocMain, allocTemp);
++ const SRes res = SzArEx_Open2(p, inStream, allocMain, allocTemp);
+ if (res != SZ_OK)
+ SzArEx_Free(p, allocMain);
+ return res;
+@@ -1646,7 +1649,7 @@ SRes SzArEx_Open(CSzArEx *p, ILookInStre
+
+ SRes SzArEx_Extract(
+ const CSzArEx *p,
+- ILookInStream *inStream,
++ ILookInStreamPtr inStream,
+ UInt32 fileIndex,
+ UInt32 *blockIndex,
+ Byte **tempBuf,
+@@ -1656,7 +1659,7 @@ SRes SzArEx_Extract(
+ ISzAllocPtr allocMain,
+ ISzAllocPtr allocTemp)
+ {
+- UInt32 folderIndex = p->FileToFolder[fileIndex];
++ const UInt32 folderIndex = p->FileToFolder[fileIndex];
+ SRes res = SZ_OK;
+
+ *offset = 0;
+@@ -1673,13 +1676,13 @@ SRes SzArEx_Extract(
+
+ if (*tempBuf == NULL || *blockIndex != folderIndex)
+ {
+- UInt64 unpackSizeSpec = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
++ const UInt64 unpackSizeSpec = SzAr_GetFolderUnpackSize(&p->db, folderIndex);
+ /*
+ UInt64 unpackSizeSpec =
+ p->UnpackPositions[p->FolderToFile[(size_t)folderIndex + 1]] -
+ p->UnpackPositions[p->FolderToFile[folderIndex]];
+ */
+- size_t unpackSize = (size_t)unpackSizeSpec;
++ const size_t unpackSize = (size_t)unpackSizeSpec;
+
+ if (unpackSize != unpackSizeSpec)
+ return SZ_ERROR_MEM;
+@@ -1707,7 +1710,7 @@ SRes SzArEx_Extract(
+
+ if (res == SZ_OK)
+ {
+- UInt64 unpackPos = p->UnpackPositions[fileIndex];
++ const UInt64 unpackPos = p->UnpackPositions[fileIndex];
+ *offset = (size_t)(unpackPos - p->UnpackPositions[p->FolderToFile[folderIndex]]);
+ *outSizeProcessed = (size_t)(p->UnpackPositions[(size_t)fileIndex + 1] - unpackPos);
+ if (*offset + *outSizeProcessed > *outBufferSize)
+@@ -1723,8 +1726,8 @@ SRes SzArEx_Extract(
+
+ size_t SzArEx_GetFileNameUtf16(const CSzArEx *p, size_t fileIndex, UInt16 *dest)
+ {
+- size_t offs = p->FileNameOffsets[fileIndex];
+- size_t len = p->FileNameOffsets[fileIndex + 1] - offs;
++ const size_t offs = p->FileNameOffsets[fileIndex];
++ const size_t len = p->FileNameOffsets[fileIndex + 1] - offs;
+ if (dest != 0)
+ {
+ size_t i;
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zBuf.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zBuf.h
new file mode 100644
index 0000000000..36b84a1fac
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zBuf.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zBuf.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zBuf.h
+@@ -1,8 +1,8 @@
+ /* 7zBuf.h -- Byte Buffer
+-2017-04-03 : Igor Pavlov : Public domain */
++2023-03-04 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_BUF_H
+-#define __7Z_BUF_H
++#ifndef ZIP7_INC_7Z_BUF_H
++#define ZIP7_INC_7Z_BUF_H
+
+ #include "7zTypes.h"
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.c
new file mode 100644
index 0000000000..51e747ca97
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.c
@@ -0,0 +1,644 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zCrc.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zCrc.c
+@@ -1,182 +1,218 @@
+-/* 7zCrc.c -- CRC32 init
+-2021-04-01 : Igor Pavlov : Public domain */
++/* 7zCrc.c -- CRC32 calculation and init
++2024-03-01 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include "7zCrc.h"
+ #include "CpuArch.h"
+
+-#define kCrcPoly 0xEDB88320
++// for debug:
++// #define __ARM_FEATURE_CRC32 1
+
+-#ifdef MY_CPU_LE
+- #define CRC_NUM_TABLES 8
+-#else
+- #define CRC_NUM_TABLES 9
+-
+- #define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
+-
+- UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
+- UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
++#ifdef __ARM_FEATURE_CRC32
++// #pragma message("__ARM_FEATURE_CRC32")
++#define Z7_CRC_HW_FORCE
+ #endif
+
+-#ifndef MY_CPU_BE
+- UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
+- UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
++// #define Z7_CRC_DEBUG_BE
++#ifdef Z7_CRC_DEBUG_BE
++#undef MY_CPU_LE
++#define MY_CPU_BE
+ #endif
+
+-typedef UInt32 (MY_FAST_CALL *CRC_FUNC)(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-
+-extern
+-CRC_FUNC g_CrcUpdateT4;
+-CRC_FUNC g_CrcUpdateT4;
+-extern
+-CRC_FUNC g_CrcUpdateT8;
+-CRC_FUNC g_CrcUpdateT8;
+-extern
+-CRC_FUNC g_CrcUpdateT0_32;
+-CRC_FUNC g_CrcUpdateT0_32;
+-extern
+-CRC_FUNC g_CrcUpdateT0_64;
+-CRC_FUNC g_CrcUpdateT0_64;
+-extern
+-CRC_FUNC g_CrcUpdate;
+-CRC_FUNC g_CrcUpdate;
+-
+-UInt32 g_CrcTable[256 * CRC_NUM_TABLES];
++#ifdef Z7_CRC_HW_FORCE
++ #define Z7_CRC_NUM_TABLES_USE 1
++#else
++#ifdef Z7_CRC_NUM_TABLES
++ #define Z7_CRC_NUM_TABLES_USE Z7_CRC_NUM_TABLES
++#else
++ #define Z7_CRC_NUM_TABLES_USE 12
++#endif
++#endif
+
+-UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
+-{
+- return g_CrcUpdate(v, data, size, g_CrcTable);
+-}
++#if Z7_CRC_NUM_TABLES_USE < 1
++ #error Stop_Compiling_Bad_Z7_CRC_NUM_TABLES
++#endif
+
+-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
+-{
+- return g_CrcUpdate(CRC_INIT_VAL, data, size, g_CrcTable) ^ CRC_INIT_VAL;
+-}
++#if defined(MY_CPU_LE) || (Z7_CRC_NUM_TABLES_USE == 1)
++ #define Z7_CRC_NUM_TABLES_TOTAL Z7_CRC_NUM_TABLES_USE
++#else
++ #define Z7_CRC_NUM_TABLES_TOTAL (Z7_CRC_NUM_TABLES_USE + 1)
++#endif
+
+-#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++#ifndef Z7_CRC_HW_FORCE
+
+-UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const UInt32 *table)
++#if Z7_CRC_NUM_TABLES_USE == 1 \
++ || (!defined(MY_CPU_LE) && !defined(MY_CPU_BE))
++#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++#define Z7_CRC_UPDATE_T1_FUNC_NAME CrcUpdateGT1
++static UInt32 Z7_FASTCALL Z7_CRC_UPDATE_T1_FUNC_NAME(UInt32 v, const void *data, size_t size)
+ {
++ const UInt32 *table = g_CrcTable;
+ const Byte *p = (const Byte *)data;
+- const Byte *pEnd = p + size;
+- for (; p != pEnd; p++)
++ const Byte *lim = p + size;
++ for (; p != lim; p++)
+ v = CRC_UPDATE_BYTE_2(v, *p);
+ return v;
+ }
++#endif
+
+
++#if Z7_CRC_NUM_TABLES_USE != 1
++#ifndef MY_CPU_BE
++ #define FUNC_NAME_LE_2(s) CrcUpdateT ## s
++ #define FUNC_NAME_LE_1(s) FUNC_NAME_LE_2(s)
++ #define FUNC_NAME_LE FUNC_NAME_LE_1(Z7_CRC_NUM_TABLES_USE)
++ UInt32 Z7_FASTCALL FUNC_NAME_LE (UInt32 v, const void *data, size_t size, const UInt32 *table);
++#endif
++#ifndef MY_CPU_LE
++ #define FUNC_NAME_BE_2(s) CrcUpdateT1_BeT ## s
++ #define FUNC_NAME_BE_1(s) FUNC_NAME_BE_2(s)
++ #define FUNC_NAME_BE FUNC_NAME_BE_1(Z7_CRC_NUM_TABLES_USE)
++ UInt32 Z7_FASTCALL FUNC_NAME_BE (UInt32 v, const void *data, size_t size, const UInt32 *table);
++#endif
++#endif
++
++#endif // Z7_CRC_HW_FORCE
++
+ /* ---------- hardware CRC ---------- */
+
+ #ifdef MY_CPU_LE
+
+ #if defined(MY_CPU_ARM_OR_ARM64)
+-
+ // #pragma message("ARM*")
+
+- #if defined(_MSC_VER)
+- #if defined(MY_CPU_ARM64)
+- #if (_MSC_VER >= 1910)
+- // #define USE_ARM64_CRC
+- #endif
+- #endif
+- #elif (defined(__clang__) && (__clang_major__ >= 3)) \
+- || (defined(__GNUC__) && (__GNUC__ > 4))
++ #if (defined(__clang__) && (__clang_major__ >= 3)) \
++ || defined(__GNUC__) && (__GNUC__ >= 6) && defined(MY_CPU_ARM64) \
++ || defined(__GNUC__) && (__GNUC__ >= 8)
+ #if !defined(__ARM_FEATURE_CRC32)
+- // #define __ARM_FEATURE_CRC32 1
+- #if (!defined(__clang__) || (__clang_major__ > 3)) // fix these numbers
+- // #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
++// #pragma message("!defined(__ARM_FEATURE_CRC32)")
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++ #define __ARM_FEATURE_CRC32 1
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++ #define Z7_ARM_FEATURE_CRC32_WAS_SET
++ #if defined(__clang__)
++ #if defined(MY_CPU_ARM64)
++ #define ATTRIB_CRC __attribute__((__target__("crc")))
++ #else
++ #define ATTRIB_CRC __attribute__((__target__("armv8-a,crc")))
++ #endif
++ #else
++ #if defined(MY_CPU_ARM64)
++#if !defined(Z7_GCC_VERSION) || (Z7_GCC_VERSION >= 60000)
++ #define ATTRIB_CRC __attribute__((__target__("+crc")))
++#endif
++ #else
++#if !defined(Z7_GCC_VERSION) || (__GNUC__ >= 8)
++#if defined(__ARM_FP) && __GNUC__ >= 8
++// for -mfloat-abi=hard: similar to <arm_acle.h>
++ #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc+simd")))
++#else
++ #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
++#endif
++#endif
+ #endif
++ #endif
+ #endif
+ #if defined(__ARM_FEATURE_CRC32)
+- // #define USE_ARM64_CRC
+- // #include <arm_acle.h>
++ // #pragma message("<arm_acle.h>")
++/*
++arm_acle.h (GGC):
++ before Nov 17, 2017:
++#ifdef __ARM_FEATURE_CRC32
++
++ Nov 17, 2017: gcc10.0 (gcc 9.2.0) checked"
++#if __ARM_ARCH >= 8
++#pragma GCC target ("arch=armv8-a+crc")
++
++ Aug 22, 2019: GCC 8.4?, 9.2.1, 10.1:
++#ifdef __ARM_FEATURE_CRC32
++#ifdef __ARM_FP
++#pragma GCC target ("arch=armv8-a+crc+simd")
++#else
++#pragma GCC target ("arch=armv8-a+crc")
++#endif
++*/
++#if defined(__ARM_ARCH) && __ARM_ARCH < 8
++#if defined(Z7_GCC_VERSION) && (__GNUC__ == 8) && (Z7_GCC_VERSION < 80400) \
++ || defined(Z7_GCC_VERSION) && (__GNUC__ == 9) && (Z7_GCC_VERSION < 90201) \
++ || defined(Z7_GCC_VERSION) && (__GNUC__ == 10) && (Z7_GCC_VERSION < 100100)
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++// #pragma message("#define __ARM_ARCH 8")
++#undef __ARM_ARCH
++#define __ARM_ARCH 8
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++#endif
++#endif
++ #define Z7_CRC_HW_USE
++ #include <arm_acle.h>
+ #endif
++ #elif defined(_MSC_VER)
++ #if defined(MY_CPU_ARM64)
++ #if (_MSC_VER >= 1910)
++ #ifdef __clang__
++ // #define Z7_CRC_HW_USE
++ // #include <arm_acle.h>
++ #else
++ #define Z7_CRC_HW_USE
++ #include <intrin.h>
++ #endif
++ #endif
++ #endif
+ #endif
+
+-#else
+-
+-// no hardware CRC
+-
+-// #define USE_CRC_EMU
++#else // non-ARM*
+
+-#ifdef USE_CRC_EMU
+-
+-#pragma message("ARM64 CRC emulation")
+-
+-MY_FORCE_INLINE
+-UInt32 __crc32b(UInt32 v, UInt32 data)
+-{
+- const UInt32 *table = g_CrcTable;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data);
+- return v;
+-}
+-
+-MY_FORCE_INLINE
+-UInt32 __crc32w(UInt32 v, UInt32 data)
+-{
+- const UInt32 *table = g_CrcTable;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- return v;
+-}
++// #define Z7_CRC_HW_USE // for debug : we can test HW-branch of code
++#ifdef Z7_CRC_HW_USE
++#include "7zCrcEmu.h"
++#endif
+
+-MY_FORCE_INLINE
+-UInt32 __crc32d(UInt32 v, UInt64 data)
+-{
+- const UInt32 *table = g_CrcTable;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- v = CRC_UPDATE_BYTE_2(v, (Byte)data); data >>= 8;
+- return v;
+-}
++#endif // non-ARM*
+
+-#endif // USE_CRC_EMU
+
+-#endif // defined(MY_CPU_ARM64) && defined(MY_CPU_LE)
+
++#if defined(Z7_CRC_HW_USE)
+
++// #pragma message("USE ARM HW CRC")
+
+-#if defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
++#ifdef MY_CPU_64BIT
++ #define CRC_HW_WORD_TYPE UInt64
++ #define CRC_HW_WORD_FUNC __crc32d
++#else
++ #define CRC_HW_WORD_TYPE UInt32
++ #define CRC_HW_WORD_FUNC __crc32w
++#endif
+
+-#define T0_32_UNROLL_BYTES (4 * 4)
+-#define T0_64_UNROLL_BYTES (4 * 8)
++#define CRC_HW_UNROLL_BYTES (sizeof(CRC_HW_WORD_TYPE) * 4)
+
+-#ifndef ATTRIB_CRC
+-#define ATTRIB_CRC
++#ifdef ATTRIB_CRC
++ ATTRIB_CRC
+ #endif
+-// #pragma message("USE ARM HW CRC")
+-
+-ATTRIB_CRC
+-UInt32 MY_FAST_CALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-ATTRIB_CRC
+-UInt32 MY_FAST_CALL CrcUpdateT0_32(UInt32 v, const void *data, size_t size, const UInt32 *table)
++Z7_NO_INLINE
++#ifdef Z7_CRC_HW_FORCE
++ UInt32 Z7_FASTCALL CrcUpdate
++#else
++ static UInt32 Z7_FASTCALL CrcUpdate_HW
++#endif
++ (UInt32 v, const void *data, size_t size)
+ {
+ const Byte *p = (const Byte *)data;
+- UNUSED_VAR(table);
+-
+- for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_32_UNROLL_BYTES - 1)) != 0; size--)
++ for (; size != 0 && ((unsigned)(ptrdiff_t)p & (CRC_HW_UNROLL_BYTES - 1)) != 0; size--)
+ v = __crc32b(v, *p++);
+-
+- if (size >= T0_32_UNROLL_BYTES)
++ if (size >= CRC_HW_UNROLL_BYTES)
+ {
+ const Byte *lim = p + size;
+- size &= (T0_32_UNROLL_BYTES - 1);
++ size &= CRC_HW_UNROLL_BYTES - 1;
+ lim -= size;
+ do
+ {
+- v = __crc32w(v, *(const UInt32 *)(const void *)(p));
+- v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
+- v = __crc32w(v, *(const UInt32 *)(const void *)(p));
+- v = __crc32w(v, *(const UInt32 *)(const void *)(p + 4)); p += 2 * 4;
++ v = CRC_HW_WORD_FUNC(v, *(const CRC_HW_WORD_TYPE *)(const void *)(p));
++ v = CRC_HW_WORD_FUNC(v, *(const CRC_HW_WORD_TYPE *)(const void *)(p + sizeof(CRC_HW_WORD_TYPE)));
++ p += 2 * sizeof(CRC_HW_WORD_TYPE);
++ v = CRC_HW_WORD_FUNC(v, *(const CRC_HW_WORD_TYPE *)(const void *)(p));
++ v = CRC_HW_WORD_FUNC(v, *(const CRC_HW_WORD_TYPE *)(const void *)(p + sizeof(CRC_HW_WORD_TYPE)));
++ p += 2 * sizeof(CRC_HW_WORD_TYPE);
+ }
+ while (p != lim);
+ }
+@@ -187,136 +223,198 @@ UInt32 MY_FAST_CALL CrcUpdateT0_32(UInt3
+ return v;
+ }
+
+-ATTRIB_CRC
+-UInt32 MY_FAST_CALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-ATTRIB_CRC
+-UInt32 MY_FAST_CALL CrcUpdateT0_64(UInt32 v, const void *data, size_t size, const UInt32 *table)
++#ifdef Z7_ARM_FEATURE_CRC32_WAS_SET
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++#undef __ARM_FEATURE_CRC32
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++#undef Z7_ARM_FEATURE_CRC32_WAS_SET
++#endif
++
++#endif // defined(Z7_CRC_HW_USE)
++#endif // MY_CPU_LE
++
++
++
++#ifndef Z7_CRC_HW_FORCE
++
++#if defined(Z7_CRC_HW_USE) || defined(Z7_CRC_UPDATE_T1_FUNC_NAME)
++/*
++typedef UInt32 (Z7_FASTCALL *Z7_CRC_UPDATE_WITH_TABLE_FUNC)
++ (UInt32 v, const void *data, size_t size, const UInt32 *table);
++Z7_CRC_UPDATE_WITH_TABLE_FUNC g_CrcUpdate;
++*/
++static unsigned g_Crc_Algo;
++#if (!defined(MY_CPU_LE) && !defined(MY_CPU_BE))
++static unsigned g_Crc_Be;
++#endif
++#endif // defined(Z7_CRC_HW_USE) || defined(Z7_CRC_UPDATE_T1_FUNC_NAME)
++
++
++
++Z7_NO_INLINE
++#ifdef Z7_CRC_HW_USE
++ static UInt32 Z7_FASTCALL CrcUpdate_Base
++#else
++ UInt32 Z7_FASTCALL CrcUpdate
++#endif
++ (UInt32 crc, const void *data, size_t size)
+ {
+- const Byte *p = (const Byte *)data;
+- UNUSED_VAR(table);
++#if Z7_CRC_NUM_TABLES_USE == 1
++ return Z7_CRC_UPDATE_T1_FUNC_NAME(crc, data, size);
++#else // Z7_CRC_NUM_TABLES_USE != 1
++#ifdef Z7_CRC_UPDATE_T1_FUNC_NAME
++ if (g_Crc_Algo == 1)
++ return Z7_CRC_UPDATE_T1_FUNC_NAME(crc, data, size);
++#endif
+
+- for (; size != 0 && ((unsigned)(ptrdiff_t)p & (T0_64_UNROLL_BYTES - 1)) != 0; size--)
+- v = __crc32b(v, *p++);
++#ifdef MY_CPU_LE
++ return FUNC_NAME_LE(crc, data, size, g_CrcTable);
++#elif defined(MY_CPU_BE)
++ return FUNC_NAME_BE(crc, data, size, g_CrcTable);
++#else
++ if (g_Crc_Be)
++ return FUNC_NAME_BE(crc, data, size, g_CrcTable);
++ else
++ return FUNC_NAME_LE(crc, data, size, g_CrcTable);
++#endif
++#endif // Z7_CRC_NUM_TABLES_USE != 1
++}
+
+- if (size >= T0_64_UNROLL_BYTES)
+- {
+- const Byte *lim = p + size;
+- size &= (T0_64_UNROLL_BYTES - 1);
+- lim -= size;
+- do
+- {
+- v = __crc32d(v, *(const UInt64 *)(const void *)(p));
+- v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
+- v = __crc32d(v, *(const UInt64 *)(const void *)(p));
+- v = __crc32d(v, *(const UInt64 *)(const void *)(p + 8)); p += 2 * 8;
+- }
+- while (p != lim);
+- }
+-
+- for (; size != 0; size--)
+- v = __crc32b(v, *p++);
+
+- return v;
++#ifdef Z7_CRC_HW_USE
++Z7_NO_INLINE
++UInt32 Z7_FASTCALL CrcUpdate(UInt32 crc, const void *data, size_t size)
++{
++ if (g_Crc_Algo == 0)
++ return CrcUpdate_HW(crc, data, size);
++ return CrcUpdate_Base(crc, data, size);
+ }
++#endif
+
+-#endif // defined(USE_ARM64_CRC) || defined(USE_CRC_EMU)
++#endif // !defined(Z7_CRC_HW_FORCE)
+
+-#endif // MY_CPU_LE
+
+
++UInt32 Z7_FASTCALL CrcCalc(const void *data, size_t size)
++{
++ return CrcUpdate(CRC_INIT_VAL, data, size) ^ CRC_INIT_VAL;
++}
++
++
++MY_ALIGN(64)
++UInt32 g_CrcTable[256 * Z7_CRC_NUM_TABLES_TOTAL];
+
+
+-void MY_FAST_CALL CrcGenerateTable()
++void Z7_FASTCALL CrcGenerateTable(void)
+ {
+ UInt32 i;
+ for (i = 0; i < 256; i++)
+ {
++#if defined(Z7_CRC_HW_FORCE)
++ g_CrcTable[i] = __crc32b(i, 0);
++#else
++ #define kCrcPoly 0xEDB88320
+ UInt32 r = i;
+ unsigned j;
+ for (j = 0; j < 8; j++)
+ r = (r >> 1) ^ (kCrcPoly & ((UInt32)0 - (r & 1)));
+ g_CrcTable[i] = r;
++#endif
+ }
+- for (i = 256; i < 256 * CRC_NUM_TABLES; i++)
++ for (i = 256; i < 256 * Z7_CRC_NUM_TABLES_USE; i++)
+ {
+- UInt32 r = g_CrcTable[(size_t)i - 256];
++ const UInt32 r = g_CrcTable[(size_t)i - 256];
+ g_CrcTable[i] = g_CrcTable[r & 0xFF] ^ (r >> 8);
+ }
+
+- #if CRC_NUM_TABLES < 4
+-
+- g_CrcUpdate = CrcUpdateT1;
+-
+- #else
+-
+- #ifdef MY_CPU_LE
++#if !defined(Z7_CRC_HW_FORCE) && \
++ (defined(Z7_CRC_HW_USE) || defined(Z7_CRC_UPDATE_T1_FUNC_NAME) || defined(MY_CPU_BE))
+
+- g_CrcUpdateT4 = CrcUpdateT4;
+- g_CrcUpdate = CrcUpdateT4;
+-
+- #if CRC_NUM_TABLES >= 8
+- g_CrcUpdateT8 = CrcUpdateT8;
+-
+- #ifdef MY_CPU_X86_OR_AMD64
+- if (!CPU_Is_InOrder())
+- #endif
+- g_CrcUpdate = CrcUpdateT8;
+- #endif
+-
+- #else
++#if Z7_CRC_NUM_TABLES_USE <= 1
++ g_Crc_Algo = 1;
++#else // Z7_CRC_NUM_TABLES_USE <= 1
++
++#if defined(MY_CPU_LE)
++ g_Crc_Algo = Z7_CRC_NUM_TABLES_USE;
++#else // !defined(MY_CPU_LE)
+ {
+- #ifndef MY_CPU_BE
++#ifndef MY_CPU_BE
+ UInt32 k = 0x01020304;
+ const Byte *p = (const Byte *)&k;
+ if (p[0] == 4 && p[1] == 3)
+- {
+- g_CrcUpdateT4 = CrcUpdateT4;
+- g_CrcUpdate = CrcUpdateT4;
+- #if CRC_NUM_TABLES >= 8
+- g_CrcUpdateT8 = CrcUpdateT8;
+- g_CrcUpdate = CrcUpdateT8;
+- #endif
+- }
++ g_Crc_Algo = Z7_CRC_NUM_TABLES_USE;
+ else if (p[0] != 1 || p[1] != 2)
+- g_CrcUpdate = CrcUpdateT1;
++ g_Crc_Algo = 1;
+ else
+- #endif
++#endif // MY_CPU_BE
+ {
+- for (i = 256 * CRC_NUM_TABLES - 1; i >= 256; i--)
++ for (i = 256 * Z7_CRC_NUM_TABLES_TOTAL - 1; i >= 256; i--)
+ {
+- UInt32 x = g_CrcTable[(size_t)i - 256];
+- g_CrcTable[i] = CRC_UINT32_SWAP(x);
++ const UInt32 x = g_CrcTable[(size_t)i - 256];
++ g_CrcTable[i] = Z7_BSWAP32(x);
+ }
+- g_CrcUpdateT4 = CrcUpdateT1_BeT4;
+- g_CrcUpdate = CrcUpdateT1_BeT4;
+- #if CRC_NUM_TABLES >= 8
+- g_CrcUpdateT8 = CrcUpdateT1_BeT8;
+- g_CrcUpdate = CrcUpdateT1_BeT8;
+- #endif
++#if defined(Z7_CRC_UPDATE_T1_FUNC_NAME)
++ g_Crc_Algo = Z7_CRC_NUM_TABLES_USE;
++#endif
++#if (!defined(MY_CPU_LE) && !defined(MY_CPU_BE))
++ g_Crc_Be = 1;
++#endif
+ }
+ }
+- #endif
+- #endif
++#endif // !defined(MY_CPU_LE)
+
+- #ifdef MY_CPU_LE
+- #ifdef USE_ARM64_CRC
+- if (CPU_IsSupported_CRC32())
+- {
+- g_CrcUpdateT0_32 = CrcUpdateT0_32;
+- g_CrcUpdateT0_64 = CrcUpdateT0_64;
+- g_CrcUpdate =
+- #if defined(MY_CPU_ARM)
+- CrcUpdateT0_32;
+- #else
+- CrcUpdateT0_64;
+- #endif
+- }
+- #endif
+-
+- #ifdef USE_CRC_EMU
+- g_CrcUpdateT0_32 = CrcUpdateT0_32;
+- g_CrcUpdateT0_64 = CrcUpdateT0_64;
+- g_CrcUpdate = CrcUpdateT0_64;
+- #endif
++#ifdef MY_CPU_LE
++#ifdef Z7_CRC_HW_USE
++ if (CPU_IsSupported_CRC32())
++ g_Crc_Algo = 0;
++#endif // Z7_CRC_HW_USE
++#endif // MY_CPU_LE
++
++#endif // Z7_CRC_NUM_TABLES_USE <= 1
++#endif // g_Crc_Algo was declared
++}
++
++Z7_CRC_UPDATE_FUNC z7_GetFunc_CrcUpdate(unsigned algo)
++{
++ if (algo == 0)
++ return &CrcUpdate;
++
++#if defined(Z7_CRC_HW_USE)
++ if (algo == sizeof(CRC_HW_WORD_TYPE) * 8)
++ {
++#ifdef Z7_CRC_HW_FORCE
++ return &CrcUpdate;
++#else
++ if (g_Crc_Algo == 0)
++ return &CrcUpdate_HW;
++#endif
++ }
++#endif
++
++#ifndef Z7_CRC_HW_FORCE
++ if (algo == Z7_CRC_NUM_TABLES_USE)
++ return
++ #ifdef Z7_CRC_HW_USE
++ &CrcUpdate_Base;
++ #else
++ &CrcUpdate;
+ #endif
++#endif
++
++ return NULL;
+ }
++
++#undef kCrcPoly
++#undef Z7_CRC_NUM_TABLES_USE
++#undef Z7_CRC_NUM_TABLES_TOTAL
++#undef CRC_UPDATE_BYTE_2
++#undef FUNC_NAME_LE_2
++#undef FUNC_NAME_LE_1
++#undef FUNC_NAME_LE
++#undef FUNC_NAME_BE_2
++#undef FUNC_NAME_BE_1
++#undef FUNC_NAME_BE
++
++#undef CRC_HW_UNROLL_BYTES
++#undef CRC_HW_WORD_FUNC
++#undef CRC_HW_WORD_TYPE
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.h
new file mode 100644
index 0000000000..6b30552b20
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrc.h
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zCrc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zCrc.h
+@@ -1,8 +1,8 @@
+ /* 7zCrc.h -- CRC32 calculation
+-2013-01-18 : Igor Pavlov : Public domain */
++2024-01-22 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_CRC_H
+-#define __7Z_CRC_H
++#ifndef ZIP7_INC_7Z_CRC_H
++#define ZIP7_INC_7Z_CRC_H
+
+ #include "7zTypes.h"
+
+@@ -11,14 +11,17 @@ EXTERN_C_BEGIN
+ extern UInt32 g_CrcTable[];
+
+ /* Call CrcGenerateTable one time before other CRC functions */
+-void MY_FAST_CALL CrcGenerateTable(void);
++void Z7_FASTCALL CrcGenerateTable(void);
+
+ #define CRC_INIT_VAL 0xFFFFFFFF
+ #define CRC_GET_DIGEST(crc) ((crc) ^ CRC_INIT_VAL)
+ #define CRC_UPDATE_BYTE(crc, b) (g_CrcTable[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
+
+-UInt32 MY_FAST_CALL CrcUpdate(UInt32 crc, const void *data, size_t size);
+-UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size);
++UInt32 Z7_FASTCALL CrcUpdate(UInt32 crc, const void *data, size_t size);
++UInt32 Z7_FASTCALL CrcCalc(const void *data, size_t size);
++
++typedef UInt32 (Z7_FASTCALL *Z7_CRC_UPDATE_FUNC)(UInt32 v, const void *data, size_t size);
++Z7_CRC_UPDATE_FUNC z7_GetFunc_CrcUpdate(unsigned algo);
+
+ EXTERN_C_END
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zCrcOpt.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrcOpt.c
new file mode 100644
index 0000000000..ddea8f5173
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zCrcOpt.c
@@ -0,0 +1,289 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zCrcOpt.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zCrcOpt.c
+@@ -1,117 +1,199 @@
+-/* 7zCrcOpt.c -- CRC32 calculation
+-2021-02-09 : Igor Pavlov : Public domain */
++/* 7zCrcOpt.c -- CRC32 calculation (optimized functions)
++2023-12-07 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include "CpuArch.h"
+
++#if !defined(Z7_CRC_NUM_TABLES) || Z7_CRC_NUM_TABLES > 1
++
++// for debug only : define Z7_CRC_DEBUG_BE to test big-endian code in little-endian cpu
++// #define Z7_CRC_DEBUG_BE
++#ifdef Z7_CRC_DEBUG_BE
++#undef MY_CPU_LE
++#define MY_CPU_BE
++#endif
++
++// the value Z7_CRC_NUM_TABLES_USE must be defined to same value as in 7zCrc.c
++#ifdef Z7_CRC_NUM_TABLES
++#define Z7_CRC_NUM_TABLES_USE Z7_CRC_NUM_TABLES
++#else
++#define Z7_CRC_NUM_TABLES_USE 12
++#endif
++
++#if Z7_CRC_NUM_TABLES_USE % 4 || \
++ Z7_CRC_NUM_TABLES_USE < 4 * 1 || \
++ Z7_CRC_NUM_TABLES_USE > 4 * 6
++ #error Stop_Compiling_Bad_Z7_CRC_NUM_TABLES
++#endif
++
++
+ #ifndef MY_CPU_BE
+
+-#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++#define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
+
+-UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
+-{
+- const Byte *p = (const Byte *)data;
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
+- v = CRC_UPDATE_BYTE_2(v, *p);
+- for (; size >= 4; size -= 4, p += 4)
+- {
+- v ^= *(const UInt32 *)(const void *)p;
+- v =
+- (table + 0x300)[((v ) & 0xFF)]
+- ^ (table + 0x200)[((v >> 8) & 0xFF)]
+- ^ (table + 0x100)[((v >> 16) & 0xFF)]
+- ^ (table + 0x000)[((v >> 24))];
+- }
+- for (; size > 0; size--, p++)
+- v = CRC_UPDATE_BYTE_2(v, *p);
+- return v;
+-}
++#define Q(n, d) \
++ ( (table + ((n) * 4 + 3) * 0x100)[(Byte)(d)] \
++ ^ (table + ((n) * 4 + 2) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 1) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 0) * 0x100)[((d) >> 3 * 8)] )
++
++#define R(a) *((const UInt32 *)(const void *)p + (a))
++
++#define CRC_FUNC_PRE_LE2(step) \
++UInt32 Z7_FASTCALL CrcUpdateT ## step (UInt32 v, const void *data, size_t size, const UInt32 *table)
+
+-UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table);
+-UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
++#define CRC_FUNC_PRE_LE(step) \
++ CRC_FUNC_PRE_LE2(step); \
++ CRC_FUNC_PRE_LE2(step)
++
++CRC_FUNC_PRE_LE(Z7_CRC_NUM_TABLES_USE)
+ {
+ const Byte *p = (const Byte *)data;
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++)
++ const Byte *lim;
++ for (; size && ((unsigned)(ptrdiff_t)p & (7 - (Z7_CRC_NUM_TABLES_USE & 4))) != 0; size--, p++)
+ v = CRC_UPDATE_BYTE_2(v, *p);
+- for (; size >= 8; size -= 8, p += 8)
++ lim = p + size;
++ if (size >= Z7_CRC_NUM_TABLES_USE)
+ {
+- UInt32 d;
+- v ^= *(const UInt32 *)(const void *)p;
+- v =
+- (table + 0x700)[((v ) & 0xFF)]
+- ^ (table + 0x600)[((v >> 8) & 0xFF)]
+- ^ (table + 0x500)[((v >> 16) & 0xFF)]
+- ^ (table + 0x400)[((v >> 24))];
+- d = *((const UInt32 *)(const void *)p + 1);
+- v ^=
+- (table + 0x300)[((d ) & 0xFF)]
+- ^ (table + 0x200)[((d >> 8) & 0xFF)]
+- ^ (table + 0x100)[((d >> 16) & 0xFF)]
+- ^ (table + 0x000)[((d >> 24))];
++ lim -= Z7_CRC_NUM_TABLES_USE;
++ do
++ {
++ v ^= R(0);
++ {
++#if Z7_CRC_NUM_TABLES_USE == 1 * 4
++ v = Q(0, v);
++#else
++#define U2(r, op) \
++ { d = R(r); x op Q(Z7_CRC_NUM_TABLES_USE / 4 - 1 - (r), d); }
++ UInt32 d, x;
++ U2(1, =)
++#if Z7_CRC_NUM_TABLES_USE >= 3 * 4
++#define U(r) U2(r, ^=)
++ U(2)
++#if Z7_CRC_NUM_TABLES_USE >= 4 * 4
++ U(3)
++#if Z7_CRC_NUM_TABLES_USE >= 5 * 4
++ U(4)
++#if Z7_CRC_NUM_TABLES_USE >= 6 * 4
++ U(5)
++#if Z7_CRC_NUM_TABLES_USE >= 7 * 4
++#error Stop_Compiling_Bad_Z7_CRC_NUM_TABLES
++#endif
++#endif
++#endif
++#endif
++#endif
++#undef U
++#undef U2
++ v = x ^ Q(Z7_CRC_NUM_TABLES_USE / 4 - 1, v);
++#endif
++ }
++ p += Z7_CRC_NUM_TABLES_USE;
++ }
++ while (p <= lim);
++ lim += Z7_CRC_NUM_TABLES_USE;
+ }
+- for (; size > 0; size--, p++)
++ for (; p < lim; p++)
+ v = CRC_UPDATE_BYTE_2(v, *p);
+ return v;
+ }
+
++#undef CRC_UPDATE_BYTE_2
++#undef R
++#undef Q
++#undef CRC_FUNC_PRE_LE
++#undef CRC_FUNC_PRE_LE2
++
+ #endif
+
+
++
++
+ #ifndef MY_CPU_LE
+
+-#define CRC_UINT32_SWAP(v) ((v >> 24) | ((v >> 8) & 0xFF00) | ((v << 8) & 0xFF0000) | (v << 24))
++#define CRC_UPDATE_BYTE_2_BE(crc, b) (table[((crc) >> 24) ^ (b)] ^ ((crc) << 8))
+
+-#define CRC_UPDATE_BYTE_2_BE(crc, b) (table[(((crc) >> 24) ^ (b))] ^ ((crc) << 8))
++#define Q(n, d) \
++ ( (table + ((n) * 4 + 0) * 0x100)[((d)) & 0xFF] \
++ ^ (table + ((n) * 4 + 1) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 2) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 3) * 0x100)[((d) >> 3 * 8)] )
++
++#ifdef Z7_CRC_DEBUG_BE
++ #define R(a) GetBe32a((const UInt32 *)(const void *)p + (a))
++#else
++ #define R(a) *((const UInt32 *)(const void *)p + (a))
++#endif
+
+-UInt32 MY_FAST_CALL CrcUpdateT1_BeT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
+-{
+- const Byte *p = (const Byte *)data;
+- table += 0x100;
+- v = CRC_UINT32_SWAP(v);
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
+- v = CRC_UPDATE_BYTE_2_BE(v, *p);
+- for (; size >= 4; size -= 4, p += 4)
+- {
+- v ^= *(const UInt32 *)(const void *)p;
+- v =
+- (table + 0x000)[((v ) & 0xFF)]
+- ^ (table + 0x100)[((v >> 8) & 0xFF)]
+- ^ (table + 0x200)[((v >> 16) & 0xFF)]
+- ^ (table + 0x300)[((v >> 24))];
+- }
+- for (; size > 0; size--, p++)
+- v = CRC_UPDATE_BYTE_2_BE(v, *p);
+- return CRC_UINT32_SWAP(v);
+-}
+
+-UInt32 MY_FAST_CALL CrcUpdateT1_BeT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
++#define CRC_FUNC_PRE_BE2(step) \
++UInt32 Z7_FASTCALL CrcUpdateT1_BeT ## step (UInt32 v, const void *data, size_t size, const UInt32 *table)
++
++#define CRC_FUNC_PRE_BE(step) \
++ CRC_FUNC_PRE_BE2(step); \
++ CRC_FUNC_PRE_BE2(step)
++
++CRC_FUNC_PRE_BE(Z7_CRC_NUM_TABLES_USE)
+ {
+ const Byte *p = (const Byte *)data;
++ const Byte *lim;
+ table += 0x100;
+- v = CRC_UINT32_SWAP(v);
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 7) != 0; size--, p++)
++ v = Z7_BSWAP32(v);
++ for (; size && ((unsigned)(ptrdiff_t)p & (7 - (Z7_CRC_NUM_TABLES_USE & 4))) != 0; size--, p++)
+ v = CRC_UPDATE_BYTE_2_BE(v, *p);
+- for (; size >= 8; size -= 8, p += 8)
++ lim = p + size;
++ if (size >= Z7_CRC_NUM_TABLES_USE)
+ {
+- UInt32 d;
+- v ^= *(const UInt32 *)(const void *)p;
+- v =
+- (table + 0x400)[((v ) & 0xFF)]
+- ^ (table + 0x500)[((v >> 8) & 0xFF)]
+- ^ (table + 0x600)[((v >> 16) & 0xFF)]
+- ^ (table + 0x700)[((v >> 24))];
+- d = *((const UInt32 *)(const void *)p + 1);
+- v ^=
+- (table + 0x000)[((d ) & 0xFF)]
+- ^ (table + 0x100)[((d >> 8) & 0xFF)]
+- ^ (table + 0x200)[((d >> 16) & 0xFF)]
+- ^ (table + 0x300)[((d >> 24))];
++ lim -= Z7_CRC_NUM_TABLES_USE;
++ do
++ {
++ v ^= R(0);
++ {
++#if Z7_CRC_NUM_TABLES_USE == 1 * 4
++ v = Q(0, v);
++#else
++#define U2(r, op) \
++ { d = R(r); x op Q(Z7_CRC_NUM_TABLES_USE / 4 - 1 - (r), d); }
++ UInt32 d, x;
++ U2(1, =)
++#if Z7_CRC_NUM_TABLES_USE >= 3 * 4
++#define U(r) U2(r, ^=)
++ U(2)
++#if Z7_CRC_NUM_TABLES_USE >= 4 * 4
++ U(3)
++#if Z7_CRC_NUM_TABLES_USE >= 5 * 4
++ U(4)
++#if Z7_CRC_NUM_TABLES_USE >= 6 * 4
++ U(5)
++#if Z7_CRC_NUM_TABLES_USE >= 7 * 4
++#error Stop_Compiling_Bad_Z7_CRC_NUM_TABLES
++#endif
++#endif
++#endif
++#endif
++#endif
++#undef U
++#undef U2
++ v = x ^ Q(Z7_CRC_NUM_TABLES_USE / 4 - 1, v);
++#endif
++ }
++ p += Z7_CRC_NUM_TABLES_USE;
++ }
++ while (p <= lim);
++ lim += Z7_CRC_NUM_TABLES_USE;
+ }
+- for (; size > 0; size--, p++)
++ for (; p < lim; p++)
+ v = CRC_UPDATE_BYTE_2_BE(v, *p);
+- return CRC_UINT32_SWAP(v);
++ return Z7_BSWAP32(v);
+ }
+
++#undef CRC_UPDATE_BYTE_2_BE
++#undef R
++#undef Q
++#undef CRC_FUNC_PRE_BE
++#undef CRC_FUNC_PRE_BE2
++
++#endif
++#undef Z7_CRC_NUM_TABLES_USE
+ #endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zDec.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zDec.c
new file mode 100644
index 0000000000..20d2d47fa3
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zDec.c
@@ -0,0 +1,453 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zDec.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zDec.c
+@@ -1,11 +1,11 @@
+ /* 7zDec.c -- Decoding from 7z folder
+-2021-02-09 : Igor Pavlov : Public domain */
++: Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include <string.h>
+
+-/* #define _7ZIP_PPMD_SUPPPORT */
++/* #define Z7_PPMD_SUPPORT */
+
+ #include "7z.h"
+ #include "7zCrc.h"
+@@ -16,27 +16,50 @@
+ #include "Delta.h"
+ #include "LzmaDec.h"
+ #include "Lzma2Dec.h"
+-#ifdef _7ZIP_PPMD_SUPPPORT
++#ifdef Z7_PPMD_SUPPORT
+ #include "Ppmd7.h"
+ #endif
+
+ #define k_Copy 0
+-#ifndef _7Z_NO_METHOD_LZMA2
++#ifndef Z7_NO_METHOD_LZMA2
+ #define k_LZMA2 0x21
+ #endif
+ #define k_LZMA 0x30101
+ #define k_BCJ2 0x303011B
+-#ifndef _7Z_NO_METHODS_FILTERS
++
++#if !defined(Z7_NO_METHODS_FILTERS)
++#define Z7_USE_BRANCH_FILTER
++#endif
++
++#if !defined(Z7_NO_METHODS_FILTERS) || \
++ defined(Z7_USE_NATIVE_BRANCH_FILTER) && defined(MY_CPU_ARM64)
++#define Z7_USE_FILTER_ARM64
++#ifndef Z7_USE_BRANCH_FILTER
++#define Z7_USE_BRANCH_FILTER
++#endif
++#define k_ARM64 0xa
++#endif
++
++#if !defined(Z7_NO_METHODS_FILTERS) || \
++ defined(Z7_USE_NATIVE_BRANCH_FILTER) && defined(MY_CPU_ARMT)
++#define Z7_USE_FILTER_ARMT
++#ifndef Z7_USE_BRANCH_FILTER
++#define Z7_USE_BRANCH_FILTER
++#endif
++#define k_ARMT 0x3030701
++#endif
++
++#ifndef Z7_NO_METHODS_FILTERS
+ #define k_Delta 3
++#define k_RISCV 0xb
+ #define k_BCJ 0x3030103
+ #define k_PPC 0x3030205
+ #define k_IA64 0x3030401
+ #define k_ARM 0x3030501
+-#define k_ARMT 0x3030701
+ #define k_SPARC 0x3030805
+ #endif
+
+-#ifdef _7ZIP_PPMD_SUPPPORT
++#ifdef Z7_PPMD_SUPPORT
+
+ #define k_PPMD 0x30401
+
+@@ -49,12 +72,12 @@ typedef struct
+ UInt64 processed;
+ BoolInt extra;
+ SRes res;
+- const ILookInStream *inStream;
++ ILookInStreamPtr inStream;
+ } CByteInToLook;
+
+-static Byte ReadByte(const IByteIn *pp)
++static Byte ReadByte(IByteInPtr pp)
+ {
+- CByteInToLook *p = CONTAINER_FROM_VTBL(pp, CByteInToLook, vt);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CByteInToLook)
+ if (p->cur != p->end)
+ return *p->cur++;
+ if (p->res == SZ_OK)
+@@ -67,13 +90,13 @@ static Byte ReadByte(const IByteIn *pp)
+ p->cur = p->begin;
+ p->end = p->begin + size;
+ if (size != 0)
+- return *p->cur++;;
++ return *p->cur++;
+ }
+ p->extra = True;
+ return 0;
+ }
+
+-static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, const ILookInStream *inStream,
++static SRes SzDecodePpmd(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
+ Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
+ {
+ CPpmd7 ppmd;
+@@ -138,14 +161,14 @@ static SRes SzDecodePpmd(const Byte *pro
+ #endif
+
+
+-static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStream *inStream,
++static SRes SzDecodeLzma(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
+ Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
+ {
+ CLzmaDec state;
+ SRes res = SZ_OK;
+
+- LzmaDec_Construct(&state);
+- RINOK(LzmaDec_AllocateProbs(&state, props, propsSize, allocMain));
++ LzmaDec_CONSTRUCT(&state)
++ RINOK(LzmaDec_AllocateProbs(&state, props, propsSize, allocMain))
+ state.dic = outBuffer;
+ state.dicBufSize = outSize;
+ LzmaDec_Init(&state);
+@@ -196,18 +219,18 @@ static SRes SzDecodeLzma(const Byte *pro
+ }
+
+
+-#ifndef _7Z_NO_METHOD_LZMA2
++#ifndef Z7_NO_METHOD_LZMA2
+
+-static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStream *inStream,
++static SRes SzDecodeLzma2(const Byte *props, unsigned propsSize, UInt64 inSize, ILookInStreamPtr inStream,
+ Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain)
+ {
+ CLzma2Dec state;
+ SRes res = SZ_OK;
+
+- Lzma2Dec_Construct(&state);
++ Lzma2Dec_CONSTRUCT(&state)
+ if (propsSize != 1)
+ return SZ_ERROR_DATA;
+- RINOK(Lzma2Dec_AllocateProbs(&state, props[0], allocMain));
++ RINOK(Lzma2Dec_AllocateProbs(&state, props[0], allocMain))
+ state.decoder.dic = outBuffer;
+ state.decoder.dicBufSize = outSize;
+ Lzma2Dec_Init(&state);
+@@ -257,7 +280,7 @@ static SRes SzDecodeLzma2(const Byte *pr
+ #endif
+
+
+-static SRes SzDecodeCopy(UInt64 inSize, ILookInStream *inStream, Byte *outBuffer)
++static SRes SzDecodeCopy(UInt64 inSize, ILookInStreamPtr inStream, Byte *outBuffer)
+ {
+ while (inSize > 0)
+ {
+@@ -265,13 +288,13 @@ static SRes SzDecodeCopy(UInt64 inSize,
+ size_t curSize = (1 << 18);
+ if (curSize > inSize)
+ curSize = (size_t)inSize;
+- RINOK(ILookInStream_Look(inStream, &inBuf, &curSize));
++ RINOK(ILookInStream_Look(inStream, &inBuf, &curSize))
+ if (curSize == 0)
+ return SZ_ERROR_INPUT_EOF;
+ memcpy(outBuffer, inBuf, curSize);
+ outBuffer += curSize;
+ inSize -= curSize;
+- RINOK(ILookInStream_Skip(inStream, curSize));
++ RINOK(ILookInStream_Skip(inStream, curSize))
+ }
+ return SZ_OK;
+ }
+@@ -282,15 +305,16 @@ static BoolInt IS_MAIN_METHOD(UInt32 m)
+ {
+ case k_Copy:
+ case k_LZMA:
+- #ifndef _7Z_NO_METHOD_LZMA2
++ #ifndef Z7_NO_METHOD_LZMA2
+ case k_LZMA2:
+- #endif
+- #ifdef _7ZIP_PPMD_SUPPPORT
++ #endif
++ #ifdef Z7_PPMD_SUPPORT
+ case k_PPMD:
+- #endif
++ #endif
+ return True;
++ default:
++ return False;
+ }
+- return False;
+ }
+
+ static BoolInt IS_SUPPORTED_CODER(const CSzCoderInfo *c)
+@@ -317,7 +341,7 @@ static SRes CheckSupportedFolder(const C
+ }
+
+
+- #ifndef _7Z_NO_METHODS_FILTERS
++ #if defined(Z7_USE_BRANCH_FILTER)
+
+ if (f->NumCoders == 2)
+ {
+@@ -333,13 +357,21 @@ static SRes CheckSupportedFolder(const C
+ return SZ_ERROR_UNSUPPORTED;
+ switch ((UInt32)c->MethodID)
+ {
++ #if !defined(Z7_NO_METHODS_FILTERS)
+ case k_Delta:
+ case k_BCJ:
+ case k_PPC:
+ case k_IA64:
+ case k_SPARC:
+ case k_ARM:
++ case k_RISCV:
++ #endif
++ #ifdef Z7_USE_FILTER_ARM64
++ case k_ARM64:
++ #endif
++ #ifdef Z7_USE_FILTER_ARMT
+ case k_ARMT:
++ #endif
+ break;
+ default:
+ return SZ_ERROR_UNSUPPORTED;
+@@ -372,15 +404,16 @@ static SRes CheckSupportedFolder(const C
+ return SZ_ERROR_UNSUPPORTED;
+ }
+
+-#ifndef _7Z_NO_METHODS_FILTERS
+-#define CASE_BRA_CONV(isa) case k_ ## isa: isa ## _Convert(outBuffer, outSize, 0, 0); break;
+-#endif
++
++
++
++
+
+ static SRes SzFolder_Decode2(const CSzFolder *folder,
+ const Byte *propsData,
+ const UInt64 *unpackSizes,
+ const UInt64 *packPositions,
+- ILookInStream *inStream, UInt64 startPos,
++ ILookInStreamPtr inStream, UInt64 startPos,
+ Byte *outBuffer, SizeT outSize, ISzAllocPtr allocMain,
+ Byte *tempBuf[])
+ {
+@@ -389,7 +422,7 @@ static SRes SzFolder_Decode2(const CSzFo
+ SizeT tempSize3 = 0;
+ Byte *tempBuf3 = 0;
+
+- RINOK(CheckSupportedFolder(folder));
++ RINOK(CheckSupportedFolder(folder))
+
+ for (ci = 0; ci < folder->NumCoders; ci++)
+ {
+@@ -404,8 +437,8 @@ static SRes SzFolder_Decode2(const CSzFo
+ SizeT outSizeCur = outSize;
+ if (folder->NumCoders == 4)
+ {
+- UInt32 indices[] = { 3, 2, 0 };
+- UInt64 unpackSize = unpackSizes[ci];
++ const UInt32 indices[] = { 3, 2, 0 };
++ const UInt64 unpackSize = unpackSizes[ci];
+ si = indices[ci];
+ if (ci < 2)
+ {
+@@ -431,37 +464,37 @@ static SRes SzFolder_Decode2(const CSzFo
+ }
+ offset = packPositions[si];
+ inSize = packPositions[(size_t)si + 1] - offset;
+- RINOK(LookInStream_SeekTo(inStream, startPos + offset));
++ RINOK(LookInStream_SeekTo(inStream, startPos + offset))
+
+ if (coder->MethodID == k_Copy)
+ {
+ if (inSize != outSizeCur) /* check it */
+ return SZ_ERROR_DATA;
+- RINOK(SzDecodeCopy(inSize, inStream, outBufCur));
++ RINOK(SzDecodeCopy(inSize, inStream, outBufCur))
+ }
+ else if (coder->MethodID == k_LZMA)
+ {
+- RINOK(SzDecodeLzma(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain));
++ RINOK(SzDecodeLzma(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
+ }
+- #ifndef _7Z_NO_METHOD_LZMA2
++ #ifndef Z7_NO_METHOD_LZMA2
+ else if (coder->MethodID == k_LZMA2)
+ {
+- RINOK(SzDecodeLzma2(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain));
++ RINOK(SzDecodeLzma2(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
+ }
+- #endif
+- #ifdef _7ZIP_PPMD_SUPPPORT
++ #endif
++ #ifdef Z7_PPMD_SUPPORT
+ else if (coder->MethodID == k_PPMD)
+ {
+- RINOK(SzDecodePpmd(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain));
++ RINOK(SzDecodePpmd(propsData + coder->PropsOffset, coder->PropsSize, inSize, inStream, outBufCur, outSizeCur, allocMain))
+ }
+- #endif
++ #endif
+ else
+ return SZ_ERROR_UNSUPPORTED;
+ }
+ else if (coder->MethodID == k_BCJ2)
+ {
+- UInt64 offset = packPositions[1];
+- UInt64 s3Size = packPositions[2] - offset;
++ const UInt64 offset = packPositions[1];
++ const UInt64 s3Size = packPositions[2] - offset;
+
+ if (ci != 3)
+ return SZ_ERROR_UNSUPPORTED;
+@@ -473,8 +506,8 @@ static SRes SzFolder_Decode2(const CSzFo
+ if (!tempBuf[2] && tempSizes[2] != 0)
+ return SZ_ERROR_MEM;
+
+- RINOK(LookInStream_SeekTo(inStream, startPos + offset));
+- RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2]));
++ RINOK(LookInStream_SeekTo(inStream, startPos + offset))
++ RINOK(SzDecodeCopy(s3Size, inStream, tempBuf[2]))
+
+ if ((tempSizes[0] & 3) != 0 ||
+ (tempSizes[1] & 3) != 0 ||
+@@ -493,26 +526,22 @@ static SRes SzFolder_Decode2(const CSzFo
+ p.destLim = outBuffer + outSize;
+
+ Bcj2Dec_Init(&p);
+- RINOK(Bcj2Dec_Decode(&p));
++ RINOK(Bcj2Dec_Decode(&p))
+
+ {
+ unsigned i;
+ for (i = 0; i < 4; i++)
+ if (p.bufs[i] != p.lims[i])
+ return SZ_ERROR_DATA;
+-
+- if (!Bcj2Dec_IsFinished(&p))
+- return SZ_ERROR_DATA;
+-
+- if (p.dest != p.destLim
+- || p.state != BCJ2_STREAM_MAIN)
++ if (p.dest != p.destLim || !Bcj2Dec_IsMaybeFinished(&p))
+ return SZ_ERROR_DATA;
+ }
+ }
+ }
+- #ifndef _7Z_NO_METHODS_FILTERS
++#if defined(Z7_USE_BRANCH_FILTER)
+ else if (ci == 1)
+ {
++#if !defined(Z7_NO_METHODS_FILTERS)
+ if (coder->MethodID == k_Delta)
+ {
+ if (coder->PropsSize != 1)
+@@ -522,31 +551,75 @@ static SRes SzFolder_Decode2(const CSzFo
+ Delta_Init(state);
+ Delta_Decode(state, (unsigned)(propsData[coder->PropsOffset]) + 1, outBuffer, outSize);
+ }
++ continue;
+ }
+- else
++#endif
++
++#ifdef Z7_USE_FILTER_ARM64
++ if (coder->MethodID == k_ARM64)
++ {
++ UInt32 pc = 0;
++ if (coder->PropsSize == 4)
++ {
++ pc = GetUi32(propsData + coder->PropsOffset);
++ if (pc & 3)
++ return SZ_ERROR_UNSUPPORTED;
++ }
++ else if (coder->PropsSize != 0)
++ return SZ_ERROR_UNSUPPORTED;
++ z7_BranchConv_ARM64_Dec(outBuffer, outSize, pc);
++ continue;
++ }
++#endif
++
++#if !defined(Z7_NO_METHODS_FILTERS)
++ if (coder->MethodID == k_RISCV)
++ {
++ UInt32 pc = 0;
++ if (coder->PropsSize == 4)
++ {
++ pc = GetUi32(propsData + coder->PropsOffset);
++ if (pc & 1)
++ return SZ_ERROR_UNSUPPORTED;
++ }
++ else if (coder->PropsSize != 0)
++ return SZ_ERROR_UNSUPPORTED;
++ z7_BranchConv_RISCV_Dec(outBuffer, outSize, pc);
++ continue;
++ }
++#endif
++
++#if !defined(Z7_NO_METHODS_FILTERS) || defined(Z7_USE_FILTER_ARMT)
+ {
+ if (coder->PropsSize != 0)
+ return SZ_ERROR_UNSUPPORTED;
++ #define CASE_BRA_CONV(isa) case k_ ## isa: Z7_BRANCH_CONV_DEC(isa)(outBuffer, outSize, 0); break; // pc = 0;
+ switch (coder->MethodID)
+ {
++ #if !defined(Z7_NO_METHODS_FILTERS)
+ case k_BCJ:
+ {
+- UInt32 state;
+- x86_Convert_Init(state);
+- x86_Convert(outBuffer, outSize, 0, &state, 0);
++ UInt32 state = Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL;
++ z7_BranchConvSt_X86_Dec(outBuffer, outSize, 0, &state); // pc = 0
+ break;
+ }
+- CASE_BRA_CONV(PPC)
++ case k_PPC: Z7_BRANCH_CONV_DEC_2(BranchConv_PPC)(outBuffer, outSize, 0); break; // pc = 0;
++ // CASE_BRA_CONV(PPC)
+ CASE_BRA_CONV(IA64)
+ CASE_BRA_CONV(SPARC)
+ CASE_BRA_CONV(ARM)
++ #endif
++ #if !defined(Z7_NO_METHODS_FILTERS) || defined(Z7_USE_FILTER_ARMT)
+ CASE_BRA_CONV(ARMT)
++ #endif
+ default:
+ return SZ_ERROR_UNSUPPORTED;
+ }
++ continue;
+ }
+- }
+- #endif
++#endif
++ } // (c == 1)
++#endif // Z7_USE_BRANCH_FILTER
+ else
+ return SZ_ERROR_UNSUPPORTED;
+ }
+@@ -556,7 +629,7 @@ static SRes SzFolder_Decode2(const CSzFo
+
+
+ SRes SzAr_DecodeFolder(const CSzAr *p, UInt32 folderIndex,
+- ILookInStream *inStream, UInt64 startPos,
++ ILookInStreamPtr inStream, UInt64 startPos,
+ Byte *outBuffer, size_t outSize,
+ ISzAllocPtr allocMain)
+ {
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.c
new file mode 100644
index 0000000000..7459ec4734
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.c
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zFile.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zFile.c
+@@ -1,5 +1,5 @@
+ /* 7zFile.c -- File IO
+-2021-04-29 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -268,7 +268,7 @@ WRes File_Write(CSzFile *p, const void *
+ return errno;
+ if (processed == 0)
+ break;
+- data = (void *)((Byte *)data + (size_t)processed);
++ data = (const void *)((const Byte *)data + (size_t)processed);
+ originalSize -= (size_t)processed;
+ *size += (size_t)processed;
+ }
+@@ -287,7 +287,8 @@ WRes File_Seek(CSzFile *p, Int64 *pos, E
+ DWORD moveMethod;
+ UInt32 low = (UInt32)*pos;
+ LONG high = (LONG)((UInt64)*pos >> 16 >> 16); /* for case when UInt64 is 32-bit only */
+- switch (origin)
++ // (int) to eliminate clang warning
++ switch ((int)origin)
+ {
+ case SZ_SEEK_SET: moveMethod = FILE_BEGIN; break;
+ case SZ_SEEK_CUR: moveMethod = FILE_CURRENT; break;
+@@ -308,7 +309,7 @@ WRes File_Seek(CSzFile *p, Int64 *pos, E
+
+ int moveMethod; // = origin;
+
+- switch (origin)
++ switch ((int)origin)
+ {
+ case SZ_SEEK_SET: moveMethod = SEEK_SET; break;
+ case SZ_SEEK_CUR: moveMethod = SEEK_CUR; break;
+@@ -387,10 +388,10 @@ WRes File_GetLength(CSzFile *p, UInt64 *
+
+ /* ---------- FileSeqInStream ---------- */
+
+-static SRes FileSeqInStream_Read(const ISeqInStream *pp, void *buf, size_t *size)
++static SRes FileSeqInStream_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
+ {
+- CFileSeqInStream *p = CONTAINER_FROM_VTBL(pp, CFileSeqInStream, vt);
+- WRes wres = File_Read(&p->file, buf, size);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileSeqInStream)
++ const WRes wres = File_Read(&p->file, buf, size);
+ p->wres = wres;
+ return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
+ }
+@@ -403,18 +404,18 @@ void FileSeqInStream_CreateVTable(CFileS
+
+ /* ---------- FileInStream ---------- */
+
+-static SRes FileInStream_Read(const ISeekInStream *pp, void *buf, size_t *size)
++static SRes FileInStream_Read(ISeekInStreamPtr pp, void *buf, size_t *size)
+ {
+- CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
+- WRes wres = File_Read(&p->file, buf, size);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileInStream)
++ const WRes wres = File_Read(&p->file, buf, size);
+ p->wres = wres;
+ return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
+ }
+
+-static SRes FileInStream_Seek(const ISeekInStream *pp, Int64 *pos, ESzSeek origin)
++static SRes FileInStream_Seek(ISeekInStreamPtr pp, Int64 *pos, ESzSeek origin)
+ {
+- CFileInStream *p = CONTAINER_FROM_VTBL(pp, CFileInStream, vt);
+- WRes wres = File_Seek(&p->file, pos, origin);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileInStream)
++ const WRes wres = File_Seek(&p->file, pos, origin);
+ p->wres = wres;
+ return (wres == 0) ? SZ_OK : SZ_ERROR_READ;
+ }
+@@ -428,10 +429,10 @@ void FileInStream_CreateVTable(CFileInSt
+
+ /* ---------- FileOutStream ---------- */
+
+-static size_t FileOutStream_Write(const ISeqOutStream *pp, const void *data, size_t size)
++static size_t FileOutStream_Write(ISeqOutStreamPtr pp, const void *data, size_t size)
+ {
+- CFileOutStream *p = CONTAINER_FROM_VTBL(pp, CFileOutStream, vt);
+- WRes wres = File_Write(&p->file, data, &size);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CFileOutStream)
++ const WRes wres = File_Write(&p->file, data, &size);
+ p->wres = wres;
+ return size;
+ }
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.h
new file mode 100644
index 0000000000..7ffa107f2b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zFile.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zFile.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zFile.h
+@@ -1,8 +1,8 @@
+ /* 7zFile.h -- File IO
+-2021-02-15 : Igor Pavlov : Public domain */
++2023-03-05 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_FILE_H
+-#define __7Z_FILE_H
++#ifndef ZIP7_INC_FILE_H
++#define ZIP7_INC_FILE_H
+
+ #ifdef _WIN32
+ #define USE_WINDOWS_FILE
+@@ -10,7 +10,8 @@
+ #endif
+
+ #ifdef USE_WINDOWS_FILE
+-#include <windows.h>
++#include "7zWindows.h"
++
+ #else
+ // note: USE_FOPEN mode is limited to 32-bit file size
+ // #define USE_FOPEN
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zStream.c b/electron34/patches/patch-third__party_lzma__sdk_C_7zStream.c
new file mode 100644
index 0000000000..eb00034fa6
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zStream.c
@@ -0,0 +1,183 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zStream.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zStream.c
+@@ -1,5 +1,5 @@
+ /* 7zStream.c -- 7z Stream functions
+-2021-02-09 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -7,12 +7,33 @@
+
+ #include "7zTypes.h"
+
+-SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType)
++
++SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize)
++{
++ size_t size = *processedSize;
++ *processedSize = 0;
++ while (size != 0)
++ {
++ size_t cur = size;
++ const SRes res = ISeqInStream_Read(stream, buf, &cur);
++ *processedSize += cur;
++ buf = (void *)((Byte *)buf + cur);
++ size -= cur;
++ if (res != SZ_OK)
++ return res;
++ if (cur == 0)
++ return SZ_OK;
++ }
++ return SZ_OK;
++}
++
++/*
++SRes SeqInStream_Read2(ISeqInStreamPtr stream, void *buf, size_t size, SRes errorType)
+ {
+ while (size != 0)
+ {
+ size_t processed = size;
+- RINOK(ISeqInStream_Read(stream, buf, &processed));
++ RINOK(ISeqInStream_Read(stream, buf, &processed))
+ if (processed == 0)
+ return errorType;
+ buf = (void *)((Byte *)buf + processed);
+@@ -21,42 +42,44 @@ SRes SeqInStream_Read2(const ISeqInStrea
+ return SZ_OK;
+ }
+
+-SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size)
++SRes SeqInStream_Read(ISeqInStreamPtr stream, void *buf, size_t size)
+ {
+ return SeqInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
+ }
++*/
++
+
+-SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf)
++SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf)
+ {
+ size_t processed = 1;
+- RINOK(ISeqInStream_Read(stream, buf, &processed));
++ RINOK(ISeqInStream_Read(stream, buf, &processed))
+ return (processed == 1) ? SZ_OK : SZ_ERROR_INPUT_EOF;
+ }
+
+
+
+-SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset)
++SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset)
+ {
+ Int64 t = (Int64)offset;
+ return ILookInStream_Seek(stream, &t, SZ_SEEK_SET);
+ }
+
+-SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size)
++SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size)
+ {
+ const void *lookBuf;
+ if (*size == 0)
+ return SZ_OK;
+- RINOK(ILookInStream_Look(stream, &lookBuf, size));
++ RINOK(ILookInStream_Look(stream, &lookBuf, size))
+ memcpy(buf, lookBuf, *size);
+ return ILookInStream_Skip(stream, *size);
+ }
+
+-SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType)
++SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType)
+ {
+ while (size != 0)
+ {
+ size_t processed = size;
+- RINOK(ILookInStream_Read(stream, buf, &processed));
++ RINOK(ILookInStream_Read(stream, buf, &processed))
+ if (processed == 0)
+ return errorType;
+ buf = (void *)((Byte *)buf + processed);
+@@ -65,16 +88,16 @@ SRes LookInStream_Read2(const ILookInStr
+ return SZ_OK;
+ }
+
+-SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size)
++SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size)
+ {
+ return LookInStream_Read2(stream, buf, size, SZ_ERROR_INPUT_EOF);
+ }
+
+
+
+-#define GET_LookToRead2 CLookToRead2 *p = CONTAINER_FROM_VTBL(pp, CLookToRead2, vt);
++#define GET_LookToRead2 Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLookToRead2)
+
+-static SRes LookToRead2_Look_Lookahead(const ILookInStream *pp, const void **buf, size_t *size)
++static SRes LookToRead2_Look_Lookahead(ILookInStreamPtr pp, const void **buf, size_t *size)
+ {
+ SRes res = SZ_OK;
+ GET_LookToRead2
+@@ -93,7 +116,7 @@ static SRes LookToRead2_Look_Lookahead(c
+ return res;
+ }
+
+-static SRes LookToRead2_Look_Exact(const ILookInStream *pp, const void **buf, size_t *size)
++static SRes LookToRead2_Look_Exact(ILookInStreamPtr pp, const void **buf, size_t *size)
+ {
+ SRes res = SZ_OK;
+ GET_LookToRead2
+@@ -113,14 +136,14 @@ static SRes LookToRead2_Look_Exact(const
+ return res;
+ }
+
+-static SRes LookToRead2_Skip(const ILookInStream *pp, size_t offset)
++static SRes LookToRead2_Skip(ILookInStreamPtr pp, size_t offset)
+ {
+ GET_LookToRead2
+ p->pos += offset;
+ return SZ_OK;
+ }
+
+-static SRes LookToRead2_Read(const ILookInStream *pp, void *buf, size_t *size)
++static SRes LookToRead2_Read(ILookInStreamPtr pp, void *buf, size_t *size)
+ {
+ GET_LookToRead2
+ size_t rem = p->size - p->pos;
+@@ -134,7 +157,7 @@ static SRes LookToRead2_Read(const ILook
+ return SZ_OK;
+ }
+
+-static SRes LookToRead2_Seek(const ILookInStream *pp, Int64 *pos, ESzSeek origin)
++static SRes LookToRead2_Seek(ILookInStreamPtr pp, Int64 *pos, ESzSeek origin)
+ {
+ GET_LookToRead2
+ p->pos = p->size = 0;
+@@ -153,9 +176,9 @@ void LookToRead2_CreateVTable(CLookToRea
+
+
+
+-static SRes SecToLook_Read(const ISeqInStream *pp, void *buf, size_t *size)
++static SRes SecToLook_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
+ {
+- CSecToLook *p = CONTAINER_FROM_VTBL(pp, CSecToLook, vt);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CSecToLook)
+ return LookInStream_LookRead(p->realStream, buf, size);
+ }
+
+@@ -164,9 +187,9 @@ void SecToLook_CreateVTable(CSecToLook *
+ p->vt.Read = SecToLook_Read;
+ }
+
+-static SRes SecToRead_Read(const ISeqInStream *pp, void *buf, size_t *size)
++static SRes SecToRead_Read(ISeqInStreamPtr pp, void *buf, size_t *size)
+ {
+- CSecToRead *p = CONTAINER_FROM_VTBL(pp, CSecToRead, vt);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CSecToRead)
+ return ILookInStream_Read(p->realStream, buf, size);
+ }
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zTypes.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zTypes.h
new file mode 100644
index 0000000000..48157b4f94
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zTypes.h
@@ -0,0 +1,508 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zTypes.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zTypes.h
+@@ -1,8 +1,8 @@
+ /* 7zTypes.h -- Basic types
+-2022-04-01 : Igor Pavlov : Public domain */
++2024-01-24 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_TYPES_H
+-#define __7Z_TYPES_H
++#ifndef ZIP7_7Z_TYPES_H
++#define ZIP7_7Z_TYPES_H
+
+ #ifdef _WIN32
+ /* #include <windows.h> */
+@@ -52,6 +52,11 @@ typedef int SRes;
+ #define MY_ALIGN(n)
+ #endif
+ #else
++ /*
++ // C11/C++11:
++ #include <stdalign.h>
++ #define MY_ALIGN(n) alignas(n)
++ */
+ #define MY_ALIGN(n) __attribute__ ((aligned(n)))
+ #endif
+
+@@ -62,7 +67,7 @@ typedef int SRes;
+ typedef unsigned WRes;
+ #define MY_SRes_HRESULT_FROM_WRes(x) HRESULT_FROM_WIN32(x)
+
+-// #define MY_HRES_ERROR__INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
++// #define MY_HRES_ERROR_INTERNAL_ERROR MY_SRes_HRESULT_FROM_WRes(ERROR_INTERNAL_ERROR)
+
+ #else // _WIN32
+
+@@ -70,13 +75,13 @@ typedef unsigned WRes;
+ typedef int WRes;
+
+ // (FACILITY_ERRNO = 0x800) is 7zip's FACILITY constant to represent (errno) errors in HRESULT
+-#define MY__FACILITY_ERRNO 0x800
+-#define MY__FACILITY_WIN32 7
+-#define MY__FACILITY__WRes MY__FACILITY_ERRNO
++#define MY_FACILITY_ERRNO 0x800
++#define MY_FACILITY_WIN32 7
++#define MY_FACILITY_WRes MY_FACILITY_ERRNO
+
+ #define MY_HRESULT_FROM_errno_CONST_ERROR(x) ((HRESULT)( \
+ ( (HRESULT)(x) & 0x0000FFFF) \
+- | (MY__FACILITY__WRes << 16) \
++ | (MY_FACILITY_WRes << 16) \
+ | (HRESULT)0x80000000 ))
+
+ #define MY_SRes_HRESULT_FROM_WRes(x) \
+@@ -120,17 +125,17 @@ typedef int WRes;
+ #define ERROR_INVALID_REPARSE_DATA ((HRESULT)0x80071128L)
+ #define ERROR_REPARSE_TAG_INVALID ((HRESULT)0x80071129L)
+
+-// if (MY__FACILITY__WRes != FACILITY_WIN32),
++// if (MY_FACILITY_WRes != FACILITY_WIN32),
+ // we use FACILITY_WIN32 for COM errors:
+ #define E_OUTOFMEMORY ((HRESULT)0x8007000EL)
+ #define E_INVALIDARG ((HRESULT)0x80070057L)
+-#define MY__E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
++#define MY_E_ERROR_NEGATIVE_SEEK ((HRESULT)0x80070083L)
+
+ /*
+ // we can use FACILITY_ERRNO for some COM errors, that have errno equivalents:
+ #define E_OUTOFMEMORY MY_HRESULT_FROM_errno_CONST_ERROR(ENOMEM)
+ #define E_INVALIDARG MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
+-#define MY__E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
++#define MY_E_ERROR_NEGATIVE_SEEK MY_HRESULT_FROM_errno_CONST_ERROR(EINVAL)
+ */
+
+ #define TEXT(quote) quote
+@@ -156,18 +161,18 @@ typedef int WRes;
+
+
+ #ifndef RINOK
+-#define RINOK(x) { int __result__ = (x); if (__result__ != 0) return __result__; }
++#define RINOK(x) { const int _result_ = (x); if (_result_ != 0) return _result_; }
+ #endif
+
+ #ifndef RINOK_WRes
+-#define RINOK_WRes(x) { WRes __result__ = (x); if (__result__ != 0) return __result__; }
++#define RINOK_WRes(x) { const WRes _result_ = (x); if (_result_ != 0) return _result_; }
+ #endif
+
+ typedef unsigned char Byte;
+ typedef short Int16;
+ typedef unsigned short UInt16;
+
+-#ifdef _LZMA_UINT32_IS_ULONG
++#ifdef Z7_DECL_Int32_AS_long
+ typedef long Int32;
+ typedef unsigned long UInt32;
+ #else
+@@ -206,37 +211,51 @@ typedef size_t SIZE_T;
+ #endif // _WIN32
+
+
+-#define MY_HRES_ERROR__INTERNAL_ERROR ((HRESULT)0x8007054FL)
++#define MY_HRES_ERROR_INTERNAL_ERROR ((HRESULT)0x8007054FL)
+
+
+-#ifdef _SZ_NO_INT_64
+-
+-/* define _SZ_NO_INT_64, if your compiler doesn't support 64-bit integers.
+- NOTES: Some code will work incorrectly in that case! */
++#ifdef Z7_DECL_Int64_AS_long
+
+ typedef long Int64;
+ typedef unsigned long UInt64;
+
+ #else
+
+-#if defined(_MSC_VER) || defined(__BORLANDC__)
++#if (defined(_MSC_VER) || defined(__BORLANDC__)) && !defined(__clang__)
+ typedef __int64 Int64;
+ typedef unsigned __int64 UInt64;
+-#define UINT64_CONST(n) n
++#else
++#if defined(__clang__) || defined(__GNUC__)
++#include <stdint.h>
++typedef int64_t Int64;
++typedef uint64_t UInt64;
+ #else
+ typedef long long int Int64;
+ typedef unsigned long long int UInt64;
+-#define UINT64_CONST(n) n ## ULL
++// #define UINT64_CONST(n) n ## ULL
++#endif
+ #endif
+
+ #endif
+
+-#ifdef _LZMA_NO_SYSTEM_SIZE_T
+-typedef UInt32 SizeT;
++#define UINT64_CONST(n) n
++
++
++#ifdef Z7_DECL_SizeT_AS_unsigned_int
++typedef unsigned int SizeT;
+ #else
+ typedef size_t SizeT;
+ #endif
+
++/*
++#if (defined(_MSC_VER) && _MSC_VER <= 1200)
++typedef size_t MY_uintptr_t;
++#else
++#include <stdint.h>
++typedef uintptr_t MY_uintptr_t;
++#endif
++*/
++
+ typedef int BoolInt;
+ /* typedef BoolInt Bool; */
+ #define True 1
+@@ -244,23 +263,23 @@ typedef int BoolInt;
+
+
+ #ifdef _WIN32
+-#define MY_STD_CALL __stdcall
++#define Z7_STDCALL __stdcall
+ #else
+-#define MY_STD_CALL
++#define Z7_STDCALL
+ #endif
+
+ #ifdef _MSC_VER
+
+ #if _MSC_VER >= 1300
+-#define MY_NO_INLINE __declspec(noinline)
++#define Z7_NO_INLINE __declspec(noinline)
+ #else
+-#define MY_NO_INLINE
++#define Z7_NO_INLINE
+ #endif
+
+-#define MY_FORCE_INLINE __forceinline
++#define Z7_FORCE_INLINE __forceinline
+
+-#define MY_CDECL __cdecl
+-#define MY_FAST_CALL __fastcall
++#define Z7_CDECL __cdecl
++#define Z7_FASTCALL __fastcall
+
+ #else // _MSC_VER
+
+@@ -268,27 +287,25 @@ typedef int BoolInt;
+ || (defined(__clang__) && (__clang_major__ >= 4)) \
+ || defined(__INTEL_COMPILER) \
+ || defined(__xlC__)
+-#define MY_NO_INLINE __attribute__((noinline))
+-// #define MY_FORCE_INLINE __attribute__((always_inline)) inline
++#define Z7_NO_INLINE __attribute__((noinline))
++#define Z7_FORCE_INLINE __attribute__((always_inline)) inline
+ #else
+-#define MY_NO_INLINE
++#define Z7_NO_INLINE
++#define Z7_FORCE_INLINE
+ #endif
+
+-#define MY_FORCE_INLINE
+-
+-
+-#define MY_CDECL
++#define Z7_CDECL
+
+ #if defined(_M_IX86) \
+ || defined(__i386__)
+-// #define MY_FAST_CALL __attribute__((fastcall))
+-// #define MY_FAST_CALL __attribute__((cdecl))
+-#define MY_FAST_CALL
++// #define Z7_FASTCALL __attribute__((fastcall))
++// #define Z7_FASTCALL __attribute__((cdecl))
++#define Z7_FASTCALL
+ #elif defined(MY_CPU_AMD64)
+-// #define MY_FAST_CALL __attribute__((ms_abi))
+-#define MY_FAST_CALL
++// #define Z7_FASTCALL __attribute__((ms_abi))
++#define Z7_FASTCALL
+ #else
+-#define MY_FAST_CALL
++#define Z7_FASTCALL
+ #endif
+
+ #endif // _MSC_VER
+@@ -296,41 +313,49 @@ typedef int BoolInt;
+
+ /* The following interfaces use first parameter as pointer to structure */
+
+-typedef struct IByteIn IByteIn;
+-struct IByteIn
++// #define Z7_C_IFACE_CONST_QUAL
++#define Z7_C_IFACE_CONST_QUAL const
++
++#define Z7_C_IFACE_DECL(a) \
++ struct a ## _; \
++ typedef Z7_C_IFACE_CONST_QUAL struct a ## _ * a ## Ptr; \
++ typedef struct a ## _ a; \
++ struct a ## _
++
++
++Z7_C_IFACE_DECL (IByteIn)
+ {
+- Byte (*Read)(const IByteIn *p); /* reads one byte, returns 0 in case of EOF or error */
++ Byte (*Read)(IByteInPtr p); /* reads one byte, returns 0 in case of EOF or error */
+ };
+ #define IByteIn_Read(p) (p)->Read(p)
+
+
+-typedef struct IByteOut IByteOut;
+-struct IByteOut
++Z7_C_IFACE_DECL (IByteOut)
+ {
+- void (*Write)(const IByteOut *p, Byte b);
++ void (*Write)(IByteOutPtr p, Byte b);
+ };
+ #define IByteOut_Write(p, b) (p)->Write(p, b)
+
+
+-typedef struct ISeqInStream ISeqInStream;
+-struct ISeqInStream
++Z7_C_IFACE_DECL (ISeqInStream)
+ {
+- SRes (*Read)(const ISeqInStream *p, void *buf, size_t *size);
++ SRes (*Read)(ISeqInStreamPtr p, void *buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) < input(*size)) is allowed */
+ };
+ #define ISeqInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+
++/* try to read as much as avail in stream and limited by (*processedSize) */
++SRes SeqInStream_ReadMax(ISeqInStreamPtr stream, void *buf, size_t *processedSize);
+ /* it can return SZ_ERROR_INPUT_EOF */
+-SRes SeqInStream_Read(const ISeqInStream *stream, void *buf, size_t size);
+-SRes SeqInStream_Read2(const ISeqInStream *stream, void *buf, size_t size, SRes errorType);
+-SRes SeqInStream_ReadByte(const ISeqInStream *stream, Byte *buf);
++// SRes SeqInStream_Read(ISeqInStreamPtr stream, void *buf, size_t size);
++// SRes SeqInStream_Read2(ISeqInStreamPtr stream, void *buf, size_t size, SRes errorType);
++SRes SeqInStream_ReadByte(ISeqInStreamPtr stream, Byte *buf);
+
+
+-typedef struct ISeqOutStream ISeqOutStream;
+-struct ISeqOutStream
++Z7_C_IFACE_DECL (ISeqOutStream)
+ {
+- size_t (*Write)(const ISeqOutStream *p, const void *buf, size_t size);
++ size_t (*Write)(ISeqOutStreamPtr p, const void *buf, size_t size);
+ /* Returns: result - the number of actually written bytes.
+ (result < size) means error */
+ };
+@@ -344,29 +369,26 @@ typedef enum
+ } ESzSeek;
+
+
+-typedef struct ISeekInStream ISeekInStream;
+-struct ISeekInStream
++Z7_C_IFACE_DECL (ISeekInStream)
+ {
+- SRes (*Read)(const ISeekInStream *p, void *buf, size_t *size); /* same as ISeqInStream::Read */
+- SRes (*Seek)(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
++ SRes (*Read)(ISeekInStreamPtr p, void *buf, size_t *size); /* same as ISeqInStream::Read */
++ SRes (*Seek)(ISeekInStreamPtr p, Int64 *pos, ESzSeek origin);
+ };
+ #define ISeekInStream_Read(p, buf, size) (p)->Read(p, buf, size)
+ #define ISeekInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
+
+
+-typedef struct ILookInStream ILookInStream;
+-struct ILookInStream
++Z7_C_IFACE_DECL (ILookInStream)
+ {
+- SRes (*Look)(const ILookInStream *p, const void **buf, size_t *size);
++ SRes (*Look)(ILookInStreamPtr p, const void **buf, size_t *size);
+ /* if (input(*size) != 0 && output(*size) == 0) means end_of_stream.
+ (output(*size) > input(*size)) is not allowed
+ (output(*size) < input(*size)) is allowed */
+- SRes (*Skip)(const ILookInStream *p, size_t offset);
++ SRes (*Skip)(ILookInStreamPtr p, size_t offset);
+ /* offset must be <= output(*size) of Look */
+-
+- SRes (*Read)(const ILookInStream *p, void *buf, size_t *size);
++ SRes (*Read)(ILookInStreamPtr p, void *buf, size_t *size);
+ /* reads directly (without buffer). It's same as ISeqInStream::Read */
+- SRes (*Seek)(const ILookInStream *p, Int64 *pos, ESzSeek origin);
++ SRes (*Seek)(ILookInStreamPtr p, Int64 *pos, ESzSeek origin);
+ };
+
+ #define ILookInStream_Look(p, buf, size) (p)->Look(p, buf, size)
+@@ -375,19 +397,18 @@ struct ILookInStream
+ #define ILookInStream_Seek(p, pos, origin) (p)->Seek(p, pos, origin)
+
+
+-SRes LookInStream_LookRead(const ILookInStream *stream, void *buf, size_t *size);
+-SRes LookInStream_SeekTo(const ILookInStream *stream, UInt64 offset);
++SRes LookInStream_LookRead(ILookInStreamPtr stream, void *buf, size_t *size);
++SRes LookInStream_SeekTo(ILookInStreamPtr stream, UInt64 offset);
+
+ /* reads via ILookInStream::Read */
+-SRes LookInStream_Read2(const ILookInStream *stream, void *buf, size_t size, SRes errorType);
+-SRes LookInStream_Read(const ILookInStream *stream, void *buf, size_t size);
+-
++SRes LookInStream_Read2(ILookInStreamPtr stream, void *buf, size_t size, SRes errorType);
++SRes LookInStream_Read(ILookInStreamPtr stream, void *buf, size_t size);
+
+
+ typedef struct
+ {
+ ILookInStream vt;
+- const ISeekInStream *realStream;
++ ISeekInStreamPtr realStream;
+
+ size_t pos;
+ size_t size; /* it's data size */
+@@ -399,13 +420,13 @@ typedef struct
+
+ void LookToRead2_CreateVTable(CLookToRead2 *p, int lookahead);
+
+-#define LookToRead2_Init(p) { (p)->pos = (p)->size = 0; }
++#define LookToRead2_INIT(p) { (p)->pos = (p)->size = 0; }
+
+
+ typedef struct
+ {
+ ISeqInStream vt;
+- const ILookInStream *realStream;
++ ILookInStreamPtr realStream;
+ } CSecToLook;
+
+ void SecToLook_CreateVTable(CSecToLook *p);
+@@ -415,20 +436,19 @@ void SecToLook_CreateVTable(CSecToLook *
+ typedef struct
+ {
+ ISeqInStream vt;
+- const ILookInStream *realStream;
++ ILookInStreamPtr realStream;
+ } CSecToRead;
+
+ void SecToRead_CreateVTable(CSecToRead *p);
+
+
+-typedef struct ICompressProgress ICompressProgress;
+-
+-struct ICompressProgress
++Z7_C_IFACE_DECL (ICompressProgress)
+ {
+- SRes (*Progress)(const ICompressProgress *p, UInt64 inSize, UInt64 outSize);
++ SRes (*Progress)(ICompressProgressPtr p, UInt64 inSize, UInt64 outSize);
+ /* Returns: result. (result != SZ_OK) means break.
+ Value (UInt64)(Int64)-1 for size means unknown value. */
+ };
++
+ #define ICompressProgress_Progress(p, inSize, outSize) (p)->Progress(p, inSize, outSize)
+
+
+@@ -466,13 +486,13 @@ struct ISzAlloc
+
+
+
+-#ifndef MY_container_of
++#ifndef Z7_container_of
+
+ /*
+-#define MY_container_of(ptr, type, m) container_of(ptr, type, m)
+-#define MY_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
+-#define MY_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
+-#define MY_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
++#define Z7_container_of(ptr, type, m) container_of(ptr, type, m)
++#define Z7_container_of(ptr, type, m) CONTAINING_RECORD(ptr, type, m)
++#define Z7_container_of(ptr, type, m) ((type *)((char *)(ptr) - offsetof(type, m)))
++#define Z7_container_of(ptr, type, m) (&((type *)0)->m == (ptr), ((type *)(((char *)(ptr)) - MY_offsetof(type, m))))
+ */
+
+ /*
+@@ -481,24 +501,64 @@ struct ISzAlloc
+ GCC 4.8.1 : classes with non-public variable members"
+ */
+
+-#define MY_container_of(ptr, type, m) ((type *)(void *)((char *)(void *)(1 ? (ptr) : &((type *)0)->m) - MY_offsetof(type, m)))
++#define Z7_container_of(ptr, type, m) \
++ ((type *)(void *)((char *)(void *) \
++ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
++
++#define Z7_container_of_CONST(ptr, type, m) \
++ ((const type *)(const void *)((const char *)(const void *) \
++ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
++
++/*
++#define Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m) \
++ ((type *)(void *)(const void *)((const char *)(const void *) \
++ (1 ? (ptr) : &((type *)NULL)->m) - MY_offsetof(type, m)))
++*/
+
+ #endif
+
+-#define CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
++#define Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m) ((type *)(void *)(ptr))
+
+-/*
+-#define CONTAINER_FROM_VTBL(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+-*/
+-#define CONTAINER_FROM_VTBL(ptr, type, m) MY_container_of(ptr, type, m)
++// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
++#define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of(ptr, type, m)
++// #define Z7_CONTAINER_FROM_VTBL(ptr, type, m) Z7_container_of_NON_CONST_FROM_CONST(ptr, type, m)
+
+-#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
++#define Z7_CONTAINER_FROM_VTBL_CONST(ptr, type, m) Z7_container_of_CONST(ptr, type, m)
++
++#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL_SIMPLE(ptr, type, m)
+ /*
+-#define CONTAINER_FROM_VTBL_CLS(ptr, type, m) CONTAINER_FROM_VTBL(ptr, type, m)
++#define Z7_CONTAINER_FROM_VTBL_CLS(ptr, type, m) Z7_CONTAINER_FROM_VTBL(ptr, type, m)
+ */
++#if defined (__clang__) || defined(__GNUC__)
++#define Z7_DIAGNOSTIC_IGNORE_BEGIN_CAST_QUAL \
++ _Pragma("GCC diagnostic push") \
++ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"")
++#define Z7_DIAGNOSTIC_IGNORE_END_CAST_QUAL \
++ _Pragma("GCC diagnostic pop")
++#else
++#define Z7_DIAGNOSTIC_IGNORE_BEGIN_CAST_QUAL
++#define Z7_DIAGNOSTIC_IGNORE_END_CAST_QUAL
++#endif
++
++#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(ptr, type, m, p) \
++ Z7_DIAGNOSTIC_IGNORE_BEGIN_CAST_QUAL \
++ type *p = Z7_CONTAINER_FROM_VTBL(ptr, type, m); \
++ Z7_DIAGNOSTIC_IGNORE_END_CAST_QUAL
++
++#define Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(type) \
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR(pp, type, vt, p)
+
+
+-#define MY_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
++// #define ZIP7_DECLARE_HANDLE(name) typedef void *name;
++#define Z7_DECLARE_HANDLE(name) struct name##_dummy{int unused;}; typedef struct name##_dummy *name;
++
++
++#define Z7_memset_0_ARRAY(a) memset((a), 0, sizeof(a))
++
++#ifndef Z7_ARRAY_SIZE
++#define Z7_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
++#endif
++
+
+ #ifdef _WIN32
+
+@@ -527,3 +587,11 @@ struct ISzAlloc
+ EXTERN_C_END
+
+ #endif
++
++/*
++#ifndef Z7_ST
++#ifdef _7ZIP_ST
++#define Z7_ST
++#endif
++#endif
++*/
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.h
new file mode 100644
index 0000000000..191f048d24
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zVersion.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zVersion.h
+@@ -1,27 +0,0 @@
+-#define MY_VER_MAJOR 22
+-#define MY_VER_MINOR 01
+-#define MY_VER_BUILD 0
+-#define MY_VERSION_NUMBERS "22.01"
+-#define MY_VERSION MY_VERSION_NUMBERS
+-
+-#ifdef MY_CPU_NAME
+- #define MY_VERSION_CPU MY_VERSION " (" MY_CPU_NAME ")"
+-#else
+- #define MY_VERSION_CPU MY_VERSION
+-#endif
+-
+-#define MY_DATE "2022-07-15"
+-#undef MY_COPYRIGHT
+-#undef MY_VERSION_COPYRIGHT_DATE
+-#define MY_AUTHOR_NAME "Igor Pavlov"
+-#define MY_COPYRIGHT_PD "Igor Pavlov : Public domain"
+-#define MY_COPYRIGHT_CR "Copyright (c) 1999-2022 Igor Pavlov"
+-
+-#ifdef USE_COPYRIGHT_CR
+- #define MY_COPYRIGHT MY_COPYRIGHT_CR
+-#else
+- #define MY_COPYRIGHT MY_COPYRIGHT_PD
+-#endif
+-
+-#define MY_COPYRIGHT_DATE MY_COPYRIGHT " : " MY_DATE
+-#define MY_VERSION_COPYRIGHT_DATE MY_VERSION_CPU " : " MY_COPYRIGHT " : " MY_DATE
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.rc b/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.rc
new file mode 100644
index 0000000000..1d0e60e758
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zVersion.rc
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zVersion.rc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/7zVersion.rc
+@@ -1,55 +0,0 @@
+-#define MY_VS_FFI_FILEFLAGSMASK 0x0000003FL
+-#define MY_VOS_NT_WINDOWS32 0x00040004L
+-#define MY_VOS_CE_WINDOWS32 0x00050004L
+-
+-#define MY_VFT_APP 0x00000001L
+-#define MY_VFT_DLL 0x00000002L
+-
+-// #include <WinVer.h>
+-
+-#ifndef MY_VERSION
+-#include "7zVersion.h"
+-#endif
+-
+-#define MY_VER MY_VER_MAJOR,MY_VER_MINOR,MY_VER_BUILD,0
+-
+-#ifdef DEBUG
+-#define DBG_FL VS_FF_DEBUG
+-#else
+-#define DBG_FL 0
+-#endif
+-
+-#define MY_VERSION_INFO(fileType, descr, intName, origName) \
+-LANGUAGE 9, 1 \
+-1 VERSIONINFO \
+- FILEVERSION MY_VER \
+- PRODUCTVERSION MY_VER \
+- FILEFLAGSMASK MY_VS_FFI_FILEFLAGSMASK \
+- FILEFLAGS DBG_FL \
+- FILEOS MY_VOS_NT_WINDOWS32 \
+- FILETYPE fileType \
+- FILESUBTYPE 0x0L \
+-BEGIN \
+- BLOCK "StringFileInfo" \
+- BEGIN \
+- BLOCK "040904b0" \
+- BEGIN \
+- VALUE "CompanyName", "Igor Pavlov" \
+- VALUE "FileDescription", descr \
+- VALUE "FileVersion", MY_VERSION \
+- VALUE "InternalName", intName \
+- VALUE "LegalCopyright", MY_COPYRIGHT \
+- VALUE "OriginalFilename", origName \
+- VALUE "ProductName", "7-Zip" \
+- VALUE "ProductVersion", MY_VERSION \
+- END \
+- END \
+- BLOCK "VarFileInfo" \
+- BEGIN \
+- VALUE "Translation", 0x409, 1200 \
+- END \
+-END
+-
+-#define MY_VERSION_INFO_APP(descr, intName) MY_VERSION_INFO(MY_VFT_APP, descr, intName, intName ".exe")
+-
+-#define MY_VERSION_INFO_DLL(descr, intName) MY_VERSION_INFO(MY_VFT_DLL, descr, intName, intName ".dll")
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_7zWindows.h b/electron34/patches/patch-third__party_lzma__sdk_C_7zWindows.h
new file mode 100644
index 0000000000..6ee6d95d28
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_7zWindows.h
@@ -0,0 +1,110 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/7zWindows.h.orig 2025-05-24 17:57:53.643950247 +0000
++++ third_party/lzma_sdk/C/7zWindows.h
+@@ -0,0 +1,101 @@
++/* 7zWindows.h -- StdAfx
++2023-04-02 : Igor Pavlov : Public domain */
++
++#ifndef ZIP7_INC_7Z_WINDOWS_H
++#define ZIP7_INC_7Z_WINDOWS_H
++
++#ifdef _WIN32
++
++#if defined(__clang__)
++# pragma clang diagnostic push
++#endif
++
++#if defined(_MSC_VER)
++
++#pragma warning(push)
++#pragma warning(disable : 4668) // '_WIN32_WINNT' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
++
++#if _MSC_VER == 1900
++// for old kit10 versions
++// #pragma warning(disable : 4255) // winuser.h(13979): warning C4255: 'GetThreadDpiAwarenessContext':
++#endif
++// win10 Windows Kit:
++#endif // _MSC_VER
++
++#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
++// for msvc6 without sdk2003
++#define RPC_NO_WINDOWS_H
++#endif
++
++#if defined(__MINGW32__) || defined(__MINGW64__)
++// #if defined(__GNUC__) && !defined(__clang__)
++#include <windows.h>
++#else
++#include <Windows.h>
++#endif
++// #include <basetsd.h>
++// #include <wtypes.h>
++
++// but if precompiled with clang-cl then we need
++// #include <windows.h>
++#if defined(_MSC_VER)
++#pragma warning(pop)
++#endif
++
++#if defined(__clang__)
++# pragma clang diagnostic pop
++#endif
++
++#if defined(_MSC_VER) && _MSC_VER <= 1200 && !defined(_WIN64)
++#ifndef _W64
++
++typedef long LONG_PTR, *PLONG_PTR;
++typedef unsigned long ULONG_PTR, *PULONG_PTR;
++typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
++
++#define Z7_OLD_WIN_SDK
++#endif // _W64
++#endif // _MSC_VER == 1200
++
++#ifdef Z7_OLD_WIN_SDK
++
++#ifndef INVALID_FILE_ATTRIBUTES
++#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
++#endif
++#ifndef INVALID_SET_FILE_POINTER
++#define INVALID_SET_FILE_POINTER ((DWORD)-1)
++#endif
++#ifndef FILE_SPECIAL_ACCESS
++#define FILE_SPECIAL_ACCESS (FILE_ANY_ACCESS)
++#endif
++
++// ShlObj.h:
++// #define BIF_NEWDIALOGSTYLE 0x0040
++
++#pragma warning(disable : 4201)
++// #pragma warning(disable : 4115)
++
++#undef VARIANT_TRUE
++#define VARIANT_TRUE ((VARIANT_BOOL)-1)
++#endif
++
++#endif // Z7_OLD_WIN_SDK
++
++#ifdef UNDER_CE
++#undef VARIANT_TRUE
++#define VARIANT_TRUE ((VARIANT_BOOL)-1)
++#endif
++
++
++#if defined(_MSC_VER)
++#if _MSC_VER >= 1400 && _MSC_VER <= 1600
++ // BaseTsd.h(148) : 'HandleToULong' : unreferenced inline function has been removed
++ // string.h
++ // #pragma warning(disable : 4514)
++#endif
++#endif
++
++
++/* #include "7zTypes.h" */
++
++#endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.c b/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.c
new file mode 100644
index 0000000000..cf54540d8a
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.c
@@ -0,0 +1,577 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Alloc.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Alloc.c
+@@ -1,38 +1,53 @@
+ /* Alloc.c -- Memory allocation functions
+-2021-07-13 : Igor Pavlov : Public domain */
++2024-02-18 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+-#include <stdio.h>
+-
+ #ifdef _WIN32
+-#include <Windows.h>
++#include "7zWindows.h"
+ #endif
+ #include <stdlib.h>
+
+ #include "Alloc.h"
+
+-/* #define _SZ_ALLOC_DEBUG */
++#if defined(Z7_LARGE_PAGES) && defined(_WIN32) && \
++ (!defined(Z7_WIN32_WINNT_MIN) || Z7_WIN32_WINNT_MIN < 0x0502) // < Win2003 (xp-64)
++ #define Z7_USE_DYN_GetLargePageMinimum
++#endif
++
++// for debug:
++#if 0
++#if defined(__CHERI__) && defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 16)
++// #pragma message("=== Z7_ALLOC_NO_OFFSET_ALLOCATOR === ")
++#define Z7_ALLOC_NO_OFFSET_ALLOCATOR
++#endif
++#endif
+
+-/* use _SZ_ALLOC_DEBUG to debug alloc/free operations */
+-#ifdef _SZ_ALLOC_DEBUG
++// #define SZ_ALLOC_DEBUG
++/* #define SZ_ALLOC_DEBUG */
+
++/* use SZ_ALLOC_DEBUG to debug alloc/free operations */
++#ifdef SZ_ALLOC_DEBUG
++
++#include <string.h>
+ #include <stdio.h>
+-int g_allocCount = 0;
+-int g_allocCountMid = 0;
+-int g_allocCountBig = 0;
++static int g_allocCount = 0;
++#ifdef _WIN32
++static int g_allocCountMid = 0;
++static int g_allocCountBig = 0;
++#endif
+
+
+ #define CONVERT_INT_TO_STR(charType, tempSize) \
+- unsigned char temp[tempSize]; unsigned i = 0; \
+- while (val >= 10) { temp[i++] = (unsigned char)('0' + (unsigned)(val % 10)); val /= 10; } \
++ char temp[tempSize]; unsigned i = 0; \
++ while (val >= 10) { temp[i++] = (char)('0' + (unsigned)(val % 10)); val /= 10; } \
+ *s++ = (charType)('0' + (unsigned)val); \
+ while (i != 0) { i--; *s++ = temp[i]; } \
+ *s = 0;
+
+ static void ConvertUInt64ToString(UInt64 val, char *s)
+ {
+- CONVERT_INT_TO_STR(char, 24);
++ CONVERT_INT_TO_STR(char, 24)
+ }
+
+ #define GET_HEX_CHAR(t) ((char)(((t < 10) ? ('0' + t) : ('A' + (t - 10)))))
+@@ -77,7 +92,7 @@ static void PrintAligned(const char *s,
+ Print(s);
+ }
+
+-static void PrintLn()
++static void PrintLn(void)
+ {
+ Print("\n");
+ }
+@@ -89,10 +104,10 @@ static void PrintHex(UInt64 v, size_t al
+ PrintAligned(s, align);
+ }
+
+-static void PrintDec(UInt64 v, size_t align)
++static void PrintDec(int v, size_t align)
+ {
+ char s[32];
+- ConvertUInt64ToString(v, s);
++ ConvertUInt64ToString((unsigned)v, s);
+ PrintAligned(s, align);
+ }
+
+@@ -102,12 +117,19 @@ static void PrintAddr(void *p)
+ }
+
+
+-#define PRINT_ALLOC(name, cnt, size, ptr) \
++#define PRINT_REALLOC(name, cnt, size, ptr) { \
++ Print(name " "); \
++ if (!ptr) PrintDec(cnt++, 10); \
++ PrintHex(size, 10); \
++ PrintAddr(ptr); \
++ PrintLn(); }
++
++#define PRINT_ALLOC(name, cnt, size, ptr) { \
+ Print(name " "); \
+ PrintDec(cnt++, 10); \
+ PrintHex(size, 10); \
+ PrintAddr(ptr); \
+- PrintLn();
++ PrintLn(); }
+
+ #define PRINT_FREE(name, cnt, ptr) if (ptr) { \
+ Print(name " "); \
+@@ -117,26 +139,45 @@ static void PrintAddr(void *p)
+
+ #else
+
++#ifdef _WIN32
+ #define PRINT_ALLOC(name, cnt, size, ptr)
++#endif
+ #define PRINT_FREE(name, cnt, ptr)
+ #define Print(s)
+ #define PrintLn()
++#ifndef Z7_ALLOC_NO_OFFSET_ALLOCATOR
+ #define PrintHex(v, align)
++#endif
+ #define PrintAddr(p)
+
+ #endif
+
+
++/*
++by specification:
++ malloc(non_NULL, 0) : returns NULL or a unique pointer value that can later be successfully passed to free()
++ realloc(NULL, size) : the call is equivalent to malloc(size)
++ realloc(non_NULL, 0) : the call is equivalent to free(ptr)
++
++in main compilers:
++ malloc(0) : returns non_NULL
++ realloc(NULL, 0) : returns non_NULL
++ realloc(non_NULL, 0) : returns NULL
++*/
++
+
+ void *MyAlloc(size_t size)
+ {
+ if (size == 0)
+ return NULL;
+- PRINT_ALLOC("Alloc ", g_allocCount, size, NULL);
+- #ifdef _SZ_ALLOC_DEBUG
++ // PRINT_ALLOC("Alloc ", g_allocCount, size, NULL)
++ #ifdef SZ_ALLOC_DEBUG
+ {
+ void *p = malloc(size);
+- // PRINT_ALLOC("Alloc ", g_allocCount, size, p);
++ if (p)
++ {
++ PRINT_ALLOC("Alloc ", g_allocCount, size, p)
++ }
+ return p;
+ }
+ #else
+@@ -146,71 +187,107 @@ void *MyAlloc(size_t size)
+
+ void MyFree(void *address)
+ {
+- PRINT_FREE("Free ", g_allocCount, address);
++ PRINT_FREE("Free ", g_allocCount, address)
+
+ free(address);
+ }
+
++void *MyRealloc(void *address, size_t size)
++{
++ if (size == 0)
++ {
++ MyFree(address);
++ return NULL;
++ }
++ // PRINT_REALLOC("Realloc ", g_allocCount, size, address)
++ #ifdef SZ_ALLOC_DEBUG
++ {
++ void *p = realloc(address, size);
++ if (p)
++ {
++ PRINT_REALLOC("Realloc ", g_allocCount, size, address)
++ }
++ return p;
++ }
++ #else
++ return realloc(address, size);
++ #endif
++}
++
++
+ #ifdef _WIN32
+
+ void *MidAlloc(size_t size)
+ {
+ if (size == 0)
+ return NULL;
+-
+- PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, NULL);
+-
++ #ifdef SZ_ALLOC_DEBUG
++ {
++ void *p = VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
++ if (p)
++ {
++ PRINT_ALLOC("Alloc-Mid", g_allocCountMid, size, p)
++ }
++ return p;
++ }
++ #else
+ return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
++ #endif
+ }
+
+ void MidFree(void *address)
+ {
+- PRINT_FREE("Free-Mid", g_allocCountMid, address);
++ PRINT_FREE("Free-Mid", g_allocCountMid, address)
+
+ if (!address)
+ return;
+ VirtualFree(address, 0, MEM_RELEASE);
+ }
+
+-#ifdef _7ZIP_LARGE_PAGES
++#ifdef Z7_LARGE_PAGES
+
+ #ifdef MEM_LARGE_PAGES
+- #define MY__MEM_LARGE_PAGES MEM_LARGE_PAGES
++ #define MY_MEM_LARGE_PAGES MEM_LARGE_PAGES
+ #else
+- #define MY__MEM_LARGE_PAGES 0x20000000
++ #define MY_MEM_LARGE_PAGES 0x20000000
+ #endif
+
+ extern
+ SIZE_T g_LargePageSize;
+ SIZE_T g_LargePageSize = 0;
+-typedef SIZE_T (WINAPI *GetLargePageMinimumP)(VOID);
++typedef SIZE_T (WINAPI *Func_GetLargePageMinimum)(VOID);
+
+-#endif // _7ZIP_LARGE_PAGES
+-
+-void SetLargePageSize()
++void SetLargePageSize(void)
+ {
+- #ifdef _7ZIP_LARGE_PAGES
+ SIZE_T size;
+- GetLargePageMinimumP largePageMinimum = (GetLargePageMinimumP)
+- GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "GetLargePageMinimum");
+- if (!largePageMinimum)
++#ifdef Z7_USE_DYN_GetLargePageMinimum
++Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
++
++ const
++ Func_GetLargePageMinimum fn =
++ (Func_GetLargePageMinimum) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
++ "GetLargePageMinimum");
++ if (!fn)
+ return;
+- size = largePageMinimum();
++ size = fn();
++#else
++ size = GetLargePageMinimum();
++#endif
+ if (size == 0 || (size & (size - 1)) != 0)
+ return;
+ g_LargePageSize = size;
+- #endif
+ }
+
++#endif // Z7_LARGE_PAGES
+
+ void *BigAlloc(size_t size)
+ {
+ if (size == 0)
+ return NULL;
+
+- PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL);
+-
+- #ifdef _7ZIP_LARGE_PAGES
++ PRINT_ALLOC("Alloc-Big", g_allocCountBig, size, NULL)
++
++ #ifdef Z7_LARGE_PAGES
+ {
+ SIZE_T ps = g_LargePageSize;
+ if (ps != 0 && ps <= (1 << 30) && size > (ps / 2))
+@@ -220,56 +297,43 @@ void *BigAlloc(size_t size)
+ size2 = (size + ps) & ~ps;
+ if (size2 >= size)
+ {
+- void *res = VirtualAlloc(NULL, size2, MEM_COMMIT | MY__MEM_LARGE_PAGES, PAGE_READWRITE);
+- if (res)
+- return res;
++ void *p = VirtualAlloc(NULL, size2, MEM_COMMIT | MY_MEM_LARGE_PAGES, PAGE_READWRITE);
++ if (p)
++ {
++ PRINT_ALLOC("Alloc-BM ", g_allocCountMid, size2, p)
++ return p;
++ }
+ }
+ }
+ }
+ #endif
+
+- return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_READWRITE);
++ return MidAlloc(size);
+ }
+
+ void BigFree(void *address)
+ {
+- PRINT_FREE("Free-Big", g_allocCountBig, address);
+-
+- if (!address)
+- return;
+- VirtualFree(address, 0, MEM_RELEASE);
++ PRINT_FREE("Free-Big", g_allocCountBig, address)
++ MidFree(address);
+ }
+
+-#endif
++#endif // _WIN32
+
+
+-static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MyAlloc(size); }
+-static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MyFree(address); }
++static void *SzAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MyAlloc(size); }
++static void SzFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MyFree(address); }
+ const ISzAlloc g_Alloc = { SzAlloc, SzFree };
+
+ #ifdef _WIN32
+-static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return MidAlloc(size); }
+-static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); MidFree(address); }
+-static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p); return BigAlloc(size); }
+-static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p); BigFree(address); }
++static void *SzMidAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return MidAlloc(size); }
++static void SzMidFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) MidFree(address); }
++static void *SzBigAlloc(ISzAllocPtr p, size_t size) { UNUSED_VAR(p) return BigAlloc(size); }
++static void SzBigFree(ISzAllocPtr p, void *address) { UNUSED_VAR(p) BigFree(address); }
+ const ISzAlloc g_MidAlloc = { SzMidAlloc, SzMidFree };
+ const ISzAlloc g_BigAlloc = { SzBigAlloc, SzBigFree };
+ #endif
+
+-/*
+- uintptr_t : <stdint.h> C99 (optional)
+- : unsupported in VS6
+-*/
+-
+-#ifdef _WIN32
+- typedef UINT_PTR UIntPtr;
+-#else
+- /*
+- typedef uintptr_t UIntPtr;
+- */
+- typedef ptrdiff_t UIntPtr;
+-#endif
+-
++#ifndef Z7_ALLOC_NO_OFFSET_ALLOCATOR
+
+ #define ADJUST_ALLOC_SIZE 0
+ /*
+@@ -280,14 +344,36 @@ const ISzAlloc g_BigAlloc = { SzBigAlloc
+ MyAlloc() can return address that is NOT multiple of sizeof(void *).
+ */
+
+-
+ /*
+-#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((char *)(p) - ((size_t)(UIntPtr)(p) & ((align) - 1))))
++ uintptr_t : <stdint.h> C99 (optional)
++ : unsupported in VS6
+ */
+-#define MY_ALIGN_PTR_DOWN(p, align) ((void *)((((UIntPtr)(p)) & ~((UIntPtr)(align) - 1))))
++typedef
++ #ifdef _WIN32
++ UINT_PTR
++ #elif 1
++ uintptr_t
++ #else
++ ptrdiff_t
++ #endif
++ MY_uintptr_t;
++
++#if 0 \
++ || (defined(__CHERI__) \
++ || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ > 8))
++// for 128-bit pointers (cheri):
++#define MY_ALIGN_PTR_DOWN(p, align) \
++ ((void *)((char *)(p) - ((size_t)(MY_uintptr_t)(p) & ((align) - 1))))
++#else
++#define MY_ALIGN_PTR_DOWN(p, align) \
++ ((void *)((((MY_uintptr_t)(p)) & ~((MY_uintptr_t)(align) - 1))))
++#endif
+
++#endif
+
+-#if !defined(_WIN32) && defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L)
++#if !defined(_WIN32) \
++ && (defined(Z7_ALLOC_NO_OFFSET_ALLOCATOR) \
++ || defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L))
+ #define USE_posix_memalign
+ #endif
+
+@@ -327,14 +413,13 @@ static int posix_memalign(void **ptr, si
+
+ #define ALLOC_ALIGN_SIZE ((size_t)1 << 7)
+
+-static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
++void *z7_AlignedAlloc(size_t size)
+ {
+- #ifndef USE_posix_memalign
++#ifndef USE_posix_memalign
+
+ void *p;
+ void *pAligned;
+ size_t newSize;
+- UNUSED_VAR(pp);
+
+ /* also we can allocate additional dummy ALLOC_ALIGN_SIZE bytes after aligned
+ block to prevent cache line sharing with another allocated blocks */
+@@ -359,10 +444,9 @@ static void *SzAlignedAlloc(ISzAllocPtr
+
+ return pAligned;
+
+- #else
++#else
+
+ void *p;
+- UNUSED_VAR(pp);
+ if (posix_memalign(&p, ALLOC_ALIGN_SIZE, size))
+ return NULL;
+
+@@ -371,19 +455,37 @@ static void *SzAlignedAlloc(ISzAllocPtr
+
+ return p;
+
+- #endif
++#endif
++}
++
++
++void z7_AlignedFree(void *address)
++{
++#ifndef USE_posix_memalign
++ if (address)
++ MyFree(((void **)address)[-1]);
++#else
++ free(address);
++#endif
++}
++
++
++static void *SzAlignedAlloc(ISzAllocPtr pp, size_t size)
++{
++ UNUSED_VAR(pp)
++ return z7_AlignedAlloc(size);
+ }
+
+
+ static void SzAlignedFree(ISzAllocPtr pp, void *address)
+ {
+- UNUSED_VAR(pp);
+- #ifndef USE_posix_memalign
++ UNUSED_VAR(pp)
++#ifndef USE_posix_memalign
+ if (address)
+ MyFree(((void **)address)[-1]);
+- #else
++#else
+ free(address);
+- #endif
++#endif
+ }
+
+
+@@ -391,17 +493,45 @@ const ISzAlloc g_AlignedAlloc = { SzAlig
+
+
+
+-#define MY_ALIGN_PTR_DOWN_1(p) MY_ALIGN_PTR_DOWN(p, sizeof(void *))
+-
+ /* we align ptr to support cases where CAlignOffsetAlloc::offset is not multiply of sizeof(void *) */
+-#define REAL_BLOCK_PTR_VAR(p) ((void **)MY_ALIGN_PTR_DOWN_1(p))[-1]
+-/*
+-#define REAL_BLOCK_PTR_VAR(p) ((void **)(p))[-1]
+-*/
++#ifndef Z7_ALLOC_NO_OFFSET_ALLOCATOR
++#if 1
++ #define MY_ALIGN_PTR_DOWN_1(p) MY_ALIGN_PTR_DOWN(p, sizeof(void *))
++ #define REAL_BLOCK_PTR_VAR(p) ((void **)MY_ALIGN_PTR_DOWN_1(p))[-1]
++#else
++ // we can use this simplified code,
++ // if (CAlignOffsetAlloc::offset == (k * sizeof(void *))
++ #define REAL_BLOCK_PTR_VAR(p) (((void **)(p))[-1])
++#endif
++#endif
++
++
++#if 0
++#ifndef Z7_ALLOC_NO_OFFSET_ALLOCATOR
++#include <stdio.h>
++static void PrintPtr(const char *s, const void *p)
++{
++ const Byte *p2 = (const Byte *)&p;
++ unsigned i;
++ printf("%s %p ", s, p);
++ for (i = sizeof(p); i != 0;)
++ {
++ i--;
++ printf("%02x", p2[i]);
++ }
++ printf("\n");
++}
++#endif
++#endif
++
+
+ static void *AlignOffsetAlloc_Alloc(ISzAllocPtr pp, size_t size)
+ {
+- CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
++#if defined(Z7_ALLOC_NO_OFFSET_ALLOCATOR)
++ UNUSED_VAR(pp)
++ return z7_AlignedAlloc(size);
++#else
++ const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
+ void *adr;
+ void *pAligned;
+ size_t newSize;
+@@ -429,6 +559,12 @@ static void *AlignOffsetAlloc_Alloc(ISzA
+ pAligned = (char *)MY_ALIGN_PTR_DOWN((char *)adr +
+ alignSize - p->offset + extra + ADJUST_ALLOC_SIZE, alignSize) + p->offset;
+
++#if 0
++ printf("\nalignSize = %6x, offset=%6x, size=%8x \n", (unsigned)alignSize, (unsigned)p->offset, (unsigned)size);
++ PrintPtr("base", adr);
++ PrintPtr("alig", pAligned);
++#endif
++
+ PrintLn();
+ Print("- Aligned: ");
+ Print(" size="); PrintHex(size, 8);
+@@ -440,19 +576,25 @@ static void *AlignOffsetAlloc_Alloc(ISzA
+ REAL_BLOCK_PTR_VAR(pAligned) = adr;
+
+ return pAligned;
++#endif
+ }
+
+
+ static void AlignOffsetAlloc_Free(ISzAllocPtr pp, void *address)
+ {
++#if defined(Z7_ALLOC_NO_OFFSET_ALLOCATOR)
++ UNUSED_VAR(pp)
++ z7_AlignedFree(address);
++#else
+ if (address)
+ {
+- CAlignOffsetAlloc *p = CONTAINER_FROM_VTBL(pp, CAlignOffsetAlloc, vt);
++ const CAlignOffsetAlloc *p = Z7_CONTAINER_FROM_VTBL_CONST(pp, CAlignOffsetAlloc, vt);
+ PrintLn();
+ Print("- Aligned Free: ");
+ PrintLn();
+ ISzAlloc_Free(p->baseAlloc, REAL_BLOCK_PTR_VAR(address));
+ }
++#endif
+ }
+
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.h b/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.h
new file mode 100644
index 0000000000..4810e23015
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Alloc.h
@@ -0,0 +1,65 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Alloc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Alloc.h
+@@ -1,31 +1,49 @@
+ /* Alloc.h -- Memory allocation functions
+-2021-07-13 : Igor Pavlov : Public domain */
++2024-01-22 : Igor Pavlov : Public domain */
+
+-#ifndef __COMMON_ALLOC_H
+-#define __COMMON_ALLOC_H
++#ifndef ZIP7_INC_ALLOC_H
++#define ZIP7_INC_ALLOC_H
+
+ #include "7zTypes.h"
+
+ EXTERN_C_BEGIN
+
++/*
++ MyFree(NULL) : is allowed, as free(NULL)
++ MyAlloc(0) : returns NULL : but malloc(0) is allowed to return NULL or non_NULL
++ MyRealloc(NULL, 0) : returns NULL : but realloc(NULL, 0) is allowed to return NULL or non_NULL
++MyRealloc() is similar to realloc() for the following cases:
++ MyRealloc(non_NULL, 0) : returns NULL and always calls MyFree(ptr)
++ MyRealloc(NULL, non_ZERO) : returns NULL, if allocation failed
++ MyRealloc(non_NULL, non_ZERO) : returns NULL, if reallocation failed
++*/
++
+ void *MyAlloc(size_t size);
+ void MyFree(void *address);
++void *MyRealloc(void *address, size_t size);
++
++void *z7_AlignedAlloc(size_t size);
++void z7_AlignedFree(void *p);
+
+ #ifdef _WIN32
+
++#ifdef Z7_LARGE_PAGES
+ void SetLargePageSize(void);
++#endif
+
+ void *MidAlloc(size_t size);
+ void MidFree(void *address);
+ void *BigAlloc(size_t size);
+ void BigFree(void *address);
+
++/* #define Z7_BIG_ALLOC_IS_ZERO_FILLED */
++
+ #else
+
+-#define MidAlloc(size) MyAlloc(size)
+-#define MidFree(address) MyFree(address)
+-#define BigAlloc(size) MyAlloc(size)
+-#define BigFree(address) MyFree(address)
++#define MidAlloc(size) z7_AlignedAlloc(size)
++#define MidFree(address) z7_AlignedFree(address)
++#define BigAlloc(size) z7_AlignedAlloc(size)
++#define BigFree(address) z7_AlignedFree(address)
+
+ #endif
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.c b/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.c
new file mode 100644
index 0000000000..192e2cd45b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.c
@@ -0,0 +1,439 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Bcj2.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Bcj2.c
+@@ -1,29 +1,24 @@
+ /* Bcj2.c -- BCJ2 Decoder (Converter for x86 code)
+-2021-02-09 : Igor Pavlov : Public domain */
++2023-03-01 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include "Bcj2.h"
+ #include "CpuArch.h"
+
+-#define CProb UInt16
+-
+ #define kTopValue ((UInt32)1 << 24)
+-#define kNumModelBits 11
+-#define kBitModelTotal (1 << kNumModelBits)
++#define kNumBitModelTotalBits 11
++#define kBitModelTotal (1 << kNumBitModelTotalBits)
+ #define kNumMoveBits 5
+
+-#define _IF_BIT_0 ttt = *prob; bound = (p->range >> kNumModelBits) * ttt; if (p->code < bound)
+-#define _UPDATE_0 p->range = bound; *prob = (CProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+-#define _UPDATE_1 p->range -= bound; p->code -= bound; *prob = (CProb)(ttt - (ttt >> kNumMoveBits));
++// UInt32 bcj2_stats[256 + 2][2];
+
+ void Bcj2Dec_Init(CBcj2Dec *p)
+ {
+ unsigned i;
+-
+- p->state = BCJ2_DEC_STATE_OK;
++ p->state = BCJ2_STREAM_RC; // BCJ2_DEC_STATE_OK;
+ p->ip = 0;
+- p->temp[3] = 0;
++ p->temp = 0;
+ p->range = 0;
+ p->code = 0;
+ for (i = 0; i < sizeof(p->probs) / sizeof(p->probs[0]); i++)
+@@ -32,217 +27,248 @@ void Bcj2Dec_Init(CBcj2Dec *p)
+
+ SRes Bcj2Dec_Decode(CBcj2Dec *p)
+ {
++ UInt32 v = p->temp;
++ // const Byte *src;
+ if (p->range <= 5)
+ {
+- p->state = BCJ2_DEC_STATE_OK;
++ UInt32 code = p->code;
++ p->state = BCJ2_DEC_STATE_ERROR; /* for case if we return SZ_ERROR_DATA; */
+ for (; p->range != 5; p->range++)
+ {
+- if (p->range == 1 && p->code != 0)
++ if (p->range == 1 && code != 0)
+ return SZ_ERROR_DATA;
+-
+ if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC])
+ {
+ p->state = BCJ2_STREAM_RC;
+ return SZ_OK;
+ }
+-
+- p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
++ code = (code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
++ p->code = code;
+ }
+-
+- if (p->code == 0xFFFFFFFF)
++ if (code == 0xffffffff)
+ return SZ_ERROR_DATA;
+-
+- p->range = 0xFFFFFFFF;
++ p->range = 0xffffffff;
+ }
+- else if (p->state >= BCJ2_DEC_STATE_ORIG_0)
++ // else
+ {
+- while (p->state <= BCJ2_DEC_STATE_ORIG_3)
++ unsigned state = p->state;
++ // we check BCJ2_IS_32BIT_STREAM() here instead of check in the main loop
++ if (BCJ2_IS_32BIT_STREAM(state))
+ {
+- Byte *dest = p->dest;
+- if (dest == p->destLim)
++ const Byte *cur = p->bufs[state];
++ if (cur == p->lims[state])
+ return SZ_OK;
+- *dest = p->temp[(size_t)p->state - BCJ2_DEC_STATE_ORIG_0];
+- p->state++;
+- p->dest = dest + 1;
++ p->bufs[state] = cur + 4;
++ {
++ const UInt32 ip = p->ip + 4;
++ v = GetBe32a(cur) - ip;
++ p->ip = ip;
++ }
++ state = BCJ2_DEC_STATE_ORIG_0;
+ }
+- }
+-
+- /*
+- if (BCJ2_IS_32BIT_STREAM(p->state))
+- {
+- const Byte *cur = p->bufs[p->state];
+- if (cur == p->lims[p->state])
+- return SZ_OK;
+- p->bufs[p->state] = cur + 4;
+-
++ if ((unsigned)(state - BCJ2_DEC_STATE_ORIG_0) < 4)
+ {
+- UInt32 val;
+- Byte *dest;
+- SizeT rem;
+-
+- p->ip += 4;
+- val = GetBe32(cur) - p->ip;
+- dest = p->dest;
+- rem = p->destLim - dest;
+- if (rem < 4)
++ Byte *dest = p->dest;
++ for (;;)
+ {
+- SizeT i;
+- SetUi32(p->temp, val);
+- for (i = 0; i < rem; i++)
+- dest[i] = p->temp[i];
+- p->dest = dest + rem;
+- p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem;
+- return SZ_OK;
++ if (dest == p->destLim)
++ {
++ p->state = state;
++ p->temp = v;
++ return SZ_OK;
++ }
++ *dest++ = (Byte)v;
++ p->dest = dest;
++ if (++state == BCJ2_DEC_STATE_ORIG_3 + 1)
++ break;
++ v >>= 8;
+ }
+- SetUi32(dest, val);
+- p->temp[3] = (Byte)(val >> 24);
+- p->dest = dest + 4;
+- p->state = BCJ2_DEC_STATE_OK;
+ }
+ }
+- */
+
++ // src = p->bufs[BCJ2_STREAM_MAIN];
+ for (;;)
+ {
++ /*
+ if (BCJ2_IS_32BIT_STREAM(p->state))
+ p->state = BCJ2_DEC_STATE_OK;
+ else
++ */
+ {
+ if (p->range < kTopValue)
+ {
+ if (p->bufs[BCJ2_STREAM_RC] == p->lims[BCJ2_STREAM_RC])
+ {
+ p->state = BCJ2_STREAM_RC;
++ p->temp = v;
+ return SZ_OK;
+ }
+ p->range <<= 8;
+ p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
+ }
+-
+ {
+ const Byte *src = p->bufs[BCJ2_STREAM_MAIN];
+ const Byte *srcLim;
+- Byte *dest;
+- SizeT num = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - src);
+-
+- if (num == 0)
++ Byte *dest = p->dest;
+ {
+- p->state = BCJ2_STREAM_MAIN;
+- return SZ_OK;
++ const SizeT rem = (SizeT)(p->lims[BCJ2_STREAM_MAIN] - src);
++ SizeT num = (SizeT)(p->destLim - dest);
++ if (num >= rem)
++ num = rem;
++ #define NUM_ITERS 4
++ #if (NUM_ITERS & (NUM_ITERS - 1)) == 0
++ num &= ~((SizeT)NUM_ITERS - 1); // if (NUM_ITERS == (1 << x))
++ #else
++ num -= num % NUM_ITERS; // if (NUM_ITERS != (1 << x))
++ #endif
++ srcLim = src + num;
+ }
+-
+- dest = p->dest;
+- if (num > (SizeT)(p->destLim - dest))
++
++ #define NUM_SHIFT_BITS 24
++ #define ONE_ITER(indx) { \
++ const unsigned b = src[indx]; \
++ *dest++ = (Byte)b; \
++ v = (v << NUM_SHIFT_BITS) | b; \
++ if (((b + (0x100 - 0xe8)) & 0xfe) == 0) break; \
++ if (((v - (((UInt32)0x0f << (NUM_SHIFT_BITS)) + 0x80)) & \
++ ((((UInt32)1 << (4 + NUM_SHIFT_BITS)) - 0x1) << 4)) == 0) break; \
++ /* ++dest */; /* v = b; */ }
++
++ if (src != srcLim)
++ for (;;)
+ {
+- num = (SizeT)(p->destLim - dest);
+- if (num == 0)
+- {
+- p->state = BCJ2_DEC_STATE_ORIG;
+- return SZ_OK;
+- }
++ /* The dependency chain of 2-cycle for (v) calculation is not big problem here.
++ But we can remove dependency chain with v = b in the end of loop. */
++ ONE_ITER(0)
++ #if (NUM_ITERS > 1)
++ ONE_ITER(1)
++ #if (NUM_ITERS > 2)
++ ONE_ITER(2)
++ #if (NUM_ITERS > 3)
++ ONE_ITER(3)
++ #if (NUM_ITERS > 4)
++ ONE_ITER(4)
++ #if (NUM_ITERS > 5)
++ ONE_ITER(5)
++ #if (NUM_ITERS > 6)
++ ONE_ITER(6)
++ #if (NUM_ITERS > 7)
++ ONE_ITER(7)
++ #endif
++ #endif
++ #endif
++ #endif
++ #endif
++ #endif
++ #endif
++
++ src += NUM_ITERS;
++ if (src == srcLim)
++ break;
+ }
+-
+- srcLim = src + num;
+
+- if (p->temp[3] == 0x0F && (src[0] & 0xF0) == 0x80)
+- *dest = src[0];
+- else for (;;)
++ if (src == srcLim)
++ #if (NUM_ITERS > 1)
++ for (;;)
++ #endif
+ {
+- Byte b = *src;
+- *dest = b;
+- if (b != 0x0F)
++ #if (NUM_ITERS > 1)
++ if (src == p->lims[BCJ2_STREAM_MAIN] || dest == p->destLim)
++ #endif
+ {
+- if ((b & 0xFE) == 0xE8)
+- break;
+- dest++;
+- if (++src != srcLim)
+- continue;
+- break;
++ const SizeT num = (SizeT)(src - p->bufs[BCJ2_STREAM_MAIN]);
++ p->bufs[BCJ2_STREAM_MAIN] = src;
++ p->dest = dest;
++ p->ip += (UInt32)num;
++ /* state BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
++ p->state =
++ src == p->lims[BCJ2_STREAM_MAIN] ?
++ (unsigned)BCJ2_STREAM_MAIN :
++ (unsigned)BCJ2_DEC_STATE_ORIG;
++ p->temp = v;
++ return SZ_OK;
+ }
+- dest++;
+- if (++src == srcLim)
+- break;
+- if ((*src & 0xF0) != 0x80)
+- continue;
+- *dest = *src;
+- break;
++ #if (NUM_ITERS > 1)
++ ONE_ITER(0)
++ src++;
++ #endif
+ }
+-
+- num = (SizeT)(src - p->bufs[BCJ2_STREAM_MAIN]);
+-
+- if (src == srcLim)
++
+ {
+- p->temp[3] = src[-1];
+- p->bufs[BCJ2_STREAM_MAIN] = src;
++ const SizeT num = (SizeT)(dest - p->dest);
++ p->dest = dest; // p->dest += num;
++ p->bufs[BCJ2_STREAM_MAIN] += num; // = src;
+ p->ip += (UInt32)num;
+- p->dest += num;
+- p->state =
+- p->bufs[BCJ2_STREAM_MAIN] ==
+- p->lims[BCJ2_STREAM_MAIN] ?
+- (unsigned)BCJ2_STREAM_MAIN :
+- (unsigned)BCJ2_DEC_STATE_ORIG;
+- return SZ_OK;
+ }
+-
+ {
+ UInt32 bound, ttt;
+- CProb *prob;
+- Byte b = src[0];
+- Byte prev = (Byte)(num == 0 ? p->temp[3] : src[-1]);
+-
+- p->temp[3] = b;
+- p->bufs[BCJ2_STREAM_MAIN] = src + 1;
+- num++;
+- p->ip += (UInt32)num;
+- p->dest += num;
+-
+- prob = p->probs + (unsigned)(b == 0xE8 ? 2 + (unsigned)prev : (b == 0xE9 ? 1 : 0));
+-
+- _IF_BIT_0
++ CBcj2Prob *prob; // unsigned index;
++ /*
++ prob = p->probs + (unsigned)((Byte)v == 0xe8 ?
++ 2 + (Byte)(v >> 8) :
++ ((v >> 5) & 1)); // ((Byte)v < 0xe8 ? 0 : 1));
++ */
+ {
+- _UPDATE_0
++ const unsigned c = ((v + 0x17) >> 6) & 1;
++ prob = p->probs + (unsigned)
++ (((0 - c) & (Byte)(v >> NUM_SHIFT_BITS)) + c + ((v >> 5) & 1));
++ // (Byte)
++ // 8x->0 : e9->1 : xxe8->xx+2
++ // 8x->0x100 : e9->0x101 : xxe8->xx
++ // (((0x100 - (e & ~v)) & (0x100 | (v >> 8))) + (e & v));
++ // (((0x101 + (~e | v)) & (0x100 | (v >> 8))) + (e & v));
++ }
++ ttt = *prob;
++ bound = (p->range >> kNumBitModelTotalBits) * ttt;
++ if (p->code < bound)
++ {
++ // bcj2_stats[prob - p->probs][0]++;
++ p->range = bound;
++ *prob = (CBcj2Prob)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+ continue;
+ }
+- _UPDATE_1
+-
++ {
++ // bcj2_stats[prob - p->probs][1]++;
++ p->range -= bound;
++ p->code -= bound;
++ *prob = (CBcj2Prob)(ttt - (ttt >> kNumMoveBits));
++ }
+ }
+ }
+ }
+-
+ {
+- UInt32 val;
+- unsigned cj = (p->temp[3] == 0xE8) ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP;
++ /* (v == 0xe8 ? 0 : 1) uses setcc instruction with additional zero register usage in x64 MSVC. */
++ // const unsigned cj = ((Byte)v == 0xe8) ? BCJ2_STREAM_CALL : BCJ2_STREAM_JUMP;
++ const unsigned cj = (((v + 0x57) >> 6) & 1) + BCJ2_STREAM_CALL;
+ const Byte *cur = p->bufs[cj];
+ Byte *dest;
+ SizeT rem;
+-
+ if (cur == p->lims[cj])
+ {
+ p->state = cj;
+ break;
+ }
+-
+- val = GetBe32(cur);
++ v = GetBe32a(cur);
+ p->bufs[cj] = cur + 4;
+-
+- p->ip += 4;
+- val -= p->ip;
++ {
++ const UInt32 ip = p->ip + 4;
++ v -= ip;
++ p->ip = ip;
++ }
+ dest = p->dest;
+ rem = (SizeT)(p->destLim - dest);
+-
+ if (rem < 4)
+ {
+- p->temp[0] = (Byte)val; if (rem > 0) dest[0] = (Byte)val; val >>= 8;
+- p->temp[1] = (Byte)val; if (rem > 1) dest[1] = (Byte)val; val >>= 8;
+- p->temp[2] = (Byte)val; if (rem > 2) dest[2] = (Byte)val; val >>= 8;
+- p->temp[3] = (Byte)val;
++ if ((unsigned)rem > 0) { dest[0] = (Byte)v; v >>= 8;
++ if ((unsigned)rem > 1) { dest[1] = (Byte)v; v >>= 8;
++ if ((unsigned)rem > 2) { dest[2] = (Byte)v; v >>= 8; }}}
++ p->temp = v;
+ p->dest = dest + rem;
+ p->state = BCJ2_DEC_STATE_ORIG_0 + (unsigned)rem;
+ break;
+ }
+-
+- SetUi32(dest, val);
+- p->temp[3] = (Byte)(val >> 24);
++ SetUi32(dest, v)
++ v >>= 24;
+ p->dest = dest + 4;
+ }
+ }
+@@ -252,6 +278,13 @@ SRes Bcj2Dec_Decode(CBcj2Dec *p)
+ p->range <<= 8;
+ p->code = (p->code << 8) | *(p->bufs[BCJ2_STREAM_RC])++;
+ }
+-
+ return SZ_OK;
+ }
++
++#undef NUM_ITERS
++#undef ONE_ITER
++#undef NUM_SHIFT_BITS
++#undef kTopValue
++#undef kNumBitModelTotalBits
++#undef kBitModelTotal
++#undef kNumMoveBits
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.h b/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.h
new file mode 100644
index 0000000000..c2856aa74b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Bcj2.h
@@ -0,0 +1,358 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Bcj2.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Bcj2.h
+@@ -1,8 +1,8 @@
+-/* Bcj2.h -- BCJ2 Converter for x86 code
+-2014-11-10 : Igor Pavlov : Public domain */
++/* Bcj2.h -- BCJ2 converter for x86 code (Branch CALL/JUMP variant2)
++2023-03-02 : Igor Pavlov : Public domain */
+
+-#ifndef __BCJ2_H
+-#define __BCJ2_H
++#ifndef ZIP7_INC_BCJ2_H
++#define ZIP7_INC_BCJ2_H
+
+ #include "7zTypes.h"
+
+@@ -26,37 +26,68 @@ enum
+ BCJ2_DEC_STATE_ORIG_3,
+
+ BCJ2_DEC_STATE_ORIG,
+- BCJ2_DEC_STATE_OK
++ BCJ2_DEC_STATE_ERROR /* after detected data error */
+ };
+
+ enum
+ {
+ BCJ2_ENC_STATE_ORIG = BCJ2_NUM_STREAMS,
+- BCJ2_ENC_STATE_OK
++ BCJ2_ENC_STATE_FINISHED /* it's state after fully encoded stream */
+ };
+
+
+-#define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP)
++/* #define BCJ2_IS_32BIT_STREAM(s) ((s) == BCJ2_STREAM_CALL || (s) == BCJ2_STREAM_JUMP) */
++#define BCJ2_IS_32BIT_STREAM(s) ((unsigned)((unsigned)(s) - (unsigned)BCJ2_STREAM_CALL) < 2)
+
+ /*
+ CBcj2Dec / CBcj2Enc
+ bufs sizes:
+ BUF_SIZE(n) = lims[n] - bufs[n]
+-bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be mutliply of 4:
++bufs sizes for BCJ2_STREAM_CALL and BCJ2_STREAM_JUMP must be multiply of 4:
+ (BUF_SIZE(BCJ2_STREAM_CALL) & 3) == 0
+ (BUF_SIZE(BCJ2_STREAM_JUMP) & 3) == 0
+ */
+
++// typedef UInt32 CBcj2Prob;
++typedef UInt16 CBcj2Prob;
++
++/*
++BCJ2 encoder / decoder internal requirements:
++ - If last bytes of stream contain marker (e8/e8/0f8x), then
++ there is also encoded symbol (0 : no conversion) in RC stream.
++ - One case of overlapped instructions is supported,
++ if last byte of converted instruction is (0f) and next byte is (8x):
++ marker [xx xx xx 0f] 8x
++ then the pair (0f 8x) is treated as marker.
++*/
++
++/* ---------- BCJ2 Decoder ---------- */
++
+ /*
+ CBcj2Dec:
+-dest is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions:
++(dest) is allowed to overlap with bufs[BCJ2_STREAM_MAIN], with the following conditions:
+ bufs[BCJ2_STREAM_MAIN] >= dest &&
+- bufs[BCJ2_STREAM_MAIN] - dest >= tempReserv +
++ bufs[BCJ2_STREAM_MAIN] - dest >=
+ BUF_SIZE(BCJ2_STREAM_CALL) +
+ BUF_SIZE(BCJ2_STREAM_JUMP)
+- tempReserv = 0 : for first call of Bcj2Dec_Decode
+- tempReserv = 4 : for any other calls of Bcj2Dec_Decode
+- overlap with offset = 1 is not allowed
++ reserve = bufs[BCJ2_STREAM_MAIN] - dest -
++ ( BUF_SIZE(BCJ2_STREAM_CALL) +
++ BUF_SIZE(BCJ2_STREAM_JUMP) )
++ and additional conditions:
++ if (it's first call of Bcj2Dec_Decode() after Bcj2Dec_Init())
++ {
++ (reserve != 1) : if (ver < v23.00)
++ }
++ else // if there are more than one calls of Bcj2Dec_Decode() after Bcj2Dec_Init())
++ {
++ (reserve >= 6) : if (ver < v23.00)
++ (reserve >= 4) : if (ver >= v23.00)
++ We need that (reserve) because after first call of Bcj2Dec_Decode(),
++ CBcj2Dec::temp can contain up to 4 bytes for writing to (dest).
++ }
++ (reserve == 0) is allowed, if we decode full stream via single call of Bcj2Dec_Decode().
++ (reserve == 0) also is allowed in case of multi-call, if we use fixed buffers,
++ and (reserve) is calculated from full (final) sizes of all streams before first call.
+ */
+
+ typedef struct
+@@ -68,22 +99,66 @@ typedef struct
+
+ unsigned state; /* BCJ2_STREAM_MAIN has more priority than BCJ2_STATE_ORIG */
+
+- UInt32 ip;
+- Byte temp[4];
++ UInt32 ip; /* property of starting base for decoding */
++ UInt32 temp; /* Byte temp[4]; */
+ UInt32 range;
+ UInt32 code;
+- UInt16 probs[2 + 256];
++ CBcj2Prob probs[2 + 256];
+ } CBcj2Dec;
+
++
++/* Note:
++ Bcj2Dec_Init() sets (CBcj2Dec::ip = 0)
++ if (ip != 0) property is required, the caller must set CBcj2Dec::ip after Bcj2Dec_Init()
++*/
+ void Bcj2Dec_Init(CBcj2Dec *p);
+
+-/* Returns: SZ_OK or SZ_ERROR_DATA */
++
++/* Bcj2Dec_Decode():
++ returns:
++ SZ_OK
++ SZ_ERROR_DATA : if data in 5 starting bytes of BCJ2_STREAM_RC stream are not correct
++*/
+ SRes Bcj2Dec_Decode(CBcj2Dec *p);
+
+-#define Bcj2Dec_IsFinished(_p_) ((_p_)->code == 0)
++/* To check that decoding was finished you can compare
++ sizes of processed streams with sizes known from another sources.
++ You must do at least one mandatory check from the two following options:
++ - the check for size of processed output (ORIG) stream.
++ - the check for size of processed input (MAIN) stream.
++ additional optional checks:
++ - the checks for processed sizes of all input streams (MAIN, CALL, JUMP, RC)
++ - the checks Bcj2Dec_IsMaybeFinished*()
++ also before actual decoding you can check that the
++ following condition is met for stream sizes:
++ ( size(ORIG) == size(MAIN) + size(CALL) + size(JUMP) )
++*/
++
++/* (state == BCJ2_STREAM_MAIN) means that decoder is ready for
++ additional input data in BCJ2_STREAM_MAIN stream.
++ Note that (state == BCJ2_STREAM_MAIN) is allowed for non-finished decoding.
++*/
++#define Bcj2Dec_IsMaybeFinished_state_MAIN(_p_) ((_p_)->state == BCJ2_STREAM_MAIN)
++
++/* if the stream decoding was finished correctly, then range decoder
++ part of CBcj2Dec also was finished, and then (CBcj2Dec::code == 0).
++ Note that (CBcj2Dec::code == 0) is allowed for non-finished decoding.
++*/
++#define Bcj2Dec_IsMaybeFinished_code(_p_) ((_p_)->code == 0)
++
++/* use Bcj2Dec_IsMaybeFinished() only as additional check
++ after at least one mandatory check from the two following options:
++ - the check for size of processed output (ORIG) stream.
++ - the check for size of processed input (MAIN) stream.
++*/
++#define Bcj2Dec_IsMaybeFinished(_p_) ( \
++ Bcj2Dec_IsMaybeFinished_state_MAIN(_p_) && \
++ Bcj2Dec_IsMaybeFinished_code(_p_))
+
+
+
++/* ---------- BCJ2 Encoder ---------- */
++
+ typedef enum
+ {
+ BCJ2_ENC_FINISH_MODE_CONTINUE,
+@@ -91,6 +166,91 @@ typedef enum
+ BCJ2_ENC_FINISH_MODE_END_STREAM
+ } EBcj2Enc_FinishMode;
+
++/*
++ BCJ2_ENC_FINISH_MODE_CONTINUE:
++ process non finished encoding.
++ It notifies the encoder that additional further calls
++ can provide more input data (src) than provided by current call.
++ In that case the CBcj2Enc encoder still can move (src) pointer
++ up to (srcLim), but CBcj2Enc encoder can store some of the last
++ processed bytes (up to 4 bytes) from src to internal CBcj2Enc::temp[] buffer.
++ at return:
++ (CBcj2Enc::src will point to position that includes
++ processed data and data copied to (temp[]) buffer)
++ That data from (temp[]) buffer will be used in further calls.
++
++ BCJ2_ENC_FINISH_MODE_END_BLOCK:
++ finish encoding of current block (ended at srcLim) without RC flushing.
++ at return: if (CBcj2Enc::state == BCJ2_ENC_STATE_ORIG) &&
++ CBcj2Enc::src == CBcj2Enc::srcLim)
++ : it shows that block encoding was finished. And the encoder is
++ ready for new (src) data or for stream finish operation.
++ finished block means
++ {
++ CBcj2Enc has completed block encoding up to (srcLim).
++ (1 + 4 bytes) or (2 + 4 bytes) CALL/JUMP cortages will
++ not cross block boundary at (srcLim).
++ temporary CBcj2Enc buffer for (ORIG) src data is empty.
++ 3 output uncompressed streams (MAIN, CALL, JUMP) were flushed.
++ RC stream was not flushed. And RC stream will cross block boundary.
++ }
++ Note: some possible implementation of BCJ2 encoder could
++ write branch marker (e8/e8/0f8x) in one call of Bcj2Enc_Encode(),
++ and it could calculate symbol for RC in another call of Bcj2Enc_Encode().
++ BCJ2 encoder uses ip/fileIp/fileSize/relatLimit values to calculate RC symbol.
++ And these CBcj2Enc variables can have different values in different Bcj2Enc_Encode() calls.
++ So caller must finish each block with BCJ2_ENC_FINISH_MODE_END_BLOCK
++ to ensure that RC symbol is calculated and written in proper block.
++
++ BCJ2_ENC_FINISH_MODE_END_STREAM
++ finish encoding of stream (ended at srcLim) fully including RC flushing.
++ at return: if (CBcj2Enc::state == BCJ2_ENC_STATE_FINISHED)
++ : it shows that stream encoding was finished fully,
++ and all output streams were flushed fully.
++ also Bcj2Enc_IsFinished() can be called.
++*/
++
++
++/*
++ 32-bit relative offset in JUMP/CALL commands is
++ - (mod 4 GiB) for 32-bit x86 code
++ - signed Int32 for 64-bit x86-64 code
++ BCJ2 encoder also does internal relative to absolute address conversions.
++ And there are 2 possible ways to do it:
++ before v23: we used 32-bit variables and (mod 4 GiB) conversion
++ since v23: we use 64-bit variables and (signed Int32 offset) conversion.
++ The absolute address condition for conversion in v23:
++ ((UInt64)((Int64)ip64 - (Int64)fileIp64 + 5 + (Int32)offset) < (UInt64)fileSize64)
++ note that if (fileSize64 > 2 GiB). there is difference between
++ old (mod 4 GiB) way (v22) and new (signed Int32 offset) way (v23).
++ And new (v23) way is more suitable to encode 64-bit x86-64 code for (fileSize64 > 2 GiB) cases.
++*/
++
++/*
++// for old (v22) way for conversion:
++typedef UInt32 CBcj2Enc_ip_unsigned;
++typedef Int32 CBcj2Enc_ip_signed;
++#define BCJ2_ENC_FileSize_MAX ((UInt32)1 << 31)
++*/
++typedef UInt64 CBcj2Enc_ip_unsigned;
++typedef Int64 CBcj2Enc_ip_signed;
++
++/* maximum size of file that can be used for conversion condition */
++#define BCJ2_ENC_FileSize_MAX ((CBcj2Enc_ip_unsigned)0 - 2)
++
++/* default value of fileSize64_minus1 variable that means
++ that absolute address limitation will not be used */
++#define BCJ2_ENC_FileSizeField_UNLIMITED ((CBcj2Enc_ip_unsigned)0 - 1)
++
++/* calculate value that later can be set to CBcj2Enc::fileSize64_minus1 */
++#define BCJ2_ENC_GET_FileSizeField_VAL_FROM_FileSize(fileSize) \
++ ((CBcj2Enc_ip_unsigned)(fileSize) - 1)
++
++/* set CBcj2Enc::fileSize64_minus1 variable from size of file */
++#define Bcj2Enc_SET_FileSize(p, fileSize) \
++ (p)->fileSize64_minus1 = BCJ2_ENC_GET_FileSizeField_VAL_FROM_FileSize(fileSize);
++
++
+ typedef struct
+ {
+ Byte *bufs[BCJ2_NUM_STREAMS];
+@@ -101,45 +261,71 @@ typedef struct
+ unsigned state;
+ EBcj2Enc_FinishMode finishMode;
+
+- Byte prevByte;
++ Byte context;
++ Byte flushRem;
++ Byte isFlushState;
+
+ Byte cache;
+ UInt32 range;
+ UInt64 low;
+ UInt64 cacheSize;
+
+- UInt32 ip;
++ // UInt32 context; // for marker version, it can include marker flag.
+
+- /* 32-bit ralative offset in JUMP/CALL commands is
+- - (mod 4 GB) in 32-bit mode
+- - signed Int32 in 64-bit mode
+- We use (mod 4 GB) check for fileSize.
+- Use fileSize up to 2 GB, if you want to support 32-bit and 64-bit code conversion. */
+- UInt32 fileIp;
+- UInt32 fileSize; /* (fileSize <= ((UInt32)1 << 31)), 0 means no_limit */
+- UInt32 relatLimit; /* (relatLimit <= ((UInt32)1 << 31)), 0 means desable_conversion */
++ /* (ip64) and (fileIp64) correspond to virtual source stream position
++ that doesn't include data in temp[] */
++ CBcj2Enc_ip_unsigned ip64; /* current (ip) position */
++ CBcj2Enc_ip_unsigned fileIp64; /* start (ip) position of current file */
++ CBcj2Enc_ip_unsigned fileSize64_minus1; /* size of current file (for conversion limitation) */
++ UInt32 relatLimit; /* (relatLimit <= ((UInt32)1 << 31)) : 0 means disable_conversion */
++ // UInt32 relatExcludeBits;
+
+ UInt32 tempTarget;
+- unsigned tempPos;
+- Byte temp[4 * 2];
+-
+- unsigned flushPos;
+-
+- UInt16 probs[2 + 256];
++ unsigned tempPos; /* the number of bytes that were copied to temp[] buffer
++ (tempPos <= 4) outside of Bcj2Enc_Encode() */
++ // Byte temp[4]; // for marker version
++ Byte temp[8];
++ CBcj2Prob probs[2 + 256];
+ } CBcj2Enc;
+
+ void Bcj2Enc_Init(CBcj2Enc *p);
+-void Bcj2Enc_Encode(CBcj2Enc *p);
+
+-#define Bcj2Enc_Get_InputData_Size(p) ((SizeT)((p)->srcLim - (p)->src) + (p)->tempPos)
+-#define Bcj2Enc_IsFinished(p) ((p)->flushPos == 5)
+
++/*
++Bcj2Enc_Encode(): at exit:
++ p->State < BCJ2_NUM_STREAMS : we need more buffer space for output stream
++ (bufs[p->State] == lims[p->State])
++ p->State == BCJ2_ENC_STATE_ORIG : we need more data in input src stream
++ (src == srcLim)
++ p->State == BCJ2_ENC_STATE_FINISHED : after fully encoded stream
++*/
++void Bcj2Enc_Encode(CBcj2Enc *p);
++
++/* Bcj2Enc encoder can look ahead for up 4 bytes of source stream.
++ CBcj2Enc::tempPos : is the number of bytes that were copied from input stream to temp[] buffer.
++ (CBcj2Enc::src) after Bcj2Enc_Encode() is starting position after
++ fully processed data and after data copied to temp buffer.
++ So if the caller needs to get real number of fully processed input
++ bytes (without look ahead data in temp buffer),
++ the caller must subtruct (CBcj2Enc::tempPos) value from processed size
++ value that is calculated based on current (CBcj2Enc::src):
++ cur_processed_pos = Calc_Big_Processed_Pos(enc.src)) -
++ Bcj2Enc_Get_AvailInputSize_in_Temp(&enc);
++*/
++/* get the size of input data that was stored in temp[] buffer: */
++#define Bcj2Enc_Get_AvailInputSize_in_Temp(p) ((p)->tempPos)
+
+-#define BCJ2_RELAT_LIMIT_NUM_BITS 26
+-#define BCJ2_RELAT_LIMIT ((UInt32)1 << BCJ2_RELAT_LIMIT_NUM_BITS)
++#define Bcj2Enc_IsFinished(p) ((p)->flushRem == 0)
+
+-/* limit for CBcj2Enc::fileSize variable */
+-#define BCJ2_FileSize_MAX ((UInt32)1 << 31)
++/* Note : the decoder supports overlapping of marker (0f 80).
++ But we can eliminate such overlapping cases by setting
++ the limit for relative offset conversion as
++ CBcj2Enc::relatLimit <= (0x0f << 24) == (240 MiB)
++*/
++/* default value for CBcj2Enc::relatLimit */
++#define BCJ2_ENC_RELAT_LIMIT_DEFAULT ((UInt32)0x0f << 24)
++#define BCJ2_ENC_RELAT_LIMIT_MAX ((UInt32)1 << 31)
++// #define BCJ2_RELAT_EXCLUDE_NUM_BITS 5
+
+ EXTERN_C_END
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Bra.c b/electron34/patches/patch-third__party_lzma__sdk_C_Bra.c
new file mode 100644
index 0000000000..622ac2b797
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Bra.c
@@ -0,0 +1,860 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Bra.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Bra.c
+@@ -1,230 +1,709 @@
+-/* Bra.c -- Converters for RISC code
+-2021-02-09 : Igor Pavlov : Public domain */
++/* Bra.c -- Branch converters for RISC code
++2024-01-20 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+-#include "CpuArch.h"
+ #include "Bra.h"
++#include "RotateDefs.h"
++#include "CpuArch.h"
++
++#if defined(MY_CPU_SIZEOF_POINTER) \
++ && ( MY_CPU_SIZEOF_POINTER == 4 \
++ || MY_CPU_SIZEOF_POINTER == 8)
++ #define BR_CONV_USE_OPT_PC_PTR
++#endif
++
++#ifdef BR_CONV_USE_OPT_PC_PTR
++#define BR_PC_INIT pc -= (UInt32)(SizeT)p;
++#define BR_PC_GET (pc + (UInt32)(SizeT)p)
++#else
++#define BR_PC_INIT pc += (UInt32)size;
++#define BR_PC_GET (pc - (UInt32)(SizeT)(lim - p))
++// #define BR_PC_INIT
++// #define BR_PC_GET (pc + (UInt32)(SizeT)(p - data))
++#endif
++
++#define BR_CONVERT_VAL(v, c) if (encoding) v += c; else v -= c;
++// #define BR_CONVERT_VAL(v, c) if (!encoding) c = (UInt32)0 - c; v += c;
++
++#define Z7_BRANCH_CONV(name) z7_ ## name
++
++#define Z7_BRANCH_FUNC_MAIN(name) \
++static \
++Z7_FORCE_INLINE \
++Z7_ATTRIB_NO_VECTOR \
++Byte *Z7_BRANCH_CONV(name)(Byte *p, SizeT size, UInt32 pc, int encoding)
++
++#define Z7_BRANCH_FUNC_IMP(name, m, encoding) \
++Z7_NO_INLINE \
++Z7_ATTRIB_NO_VECTOR \
++Byte *m(name)(Byte *data, SizeT size, UInt32 pc) \
++ { return Z7_BRANCH_CONV(name)(data, size, pc, encoding); } \
++
++#ifdef Z7_EXTRACT_ONLY
++#define Z7_BRANCH_FUNCS_IMP(name) \
++ Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_DEC_2, 0)
++#else
++#define Z7_BRANCH_FUNCS_IMP(name) \
++ Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_DEC_2, 0) \
++ Z7_BRANCH_FUNC_IMP(name, Z7_BRANCH_CONV_ENC_2, 1)
++#endif
++
++#if defined(__clang__)
++#define BR_EXTERNAL_FOR
++#define BR_NEXT_ITERATION continue;
++#else
++#define BR_EXTERNAL_FOR for (;;)
++#define BR_NEXT_ITERATION break;
++#endif
++
++#if defined(__clang__) && (__clang_major__ >= 8) \
++ || defined(__GNUC__) && (__GNUC__ >= 1000) \
++ // GCC is not good for __builtin_expect() here
++ /* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
++ // #define Z7_unlikely [[unlikely]]
++ // #define Z7_LIKELY(x) (__builtin_expect((x), 1))
++ #define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
++ // #define Z7_likely [[likely]]
++#else
++ // #define Z7_LIKELY(x) (x)
++ #define Z7_UNLIKELY(x) (x)
++ // #define Z7_likely
++#endif
++
+
+-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
++Z7_BRANCH_FUNC_MAIN(BranchConv_ARM64)
+ {
+- Byte *p;
++ // Byte *p = data;
+ const Byte *lim;
+- size &= ~(size_t)3;
+- ip += 4;
+- p = data;
+- lim = data + size;
++ const UInt32 flag = (UInt32)1 << (24 - 4);
++ const UInt32 mask = ((UInt32)1 << 24) - (flag << 1);
++ size &= ~(SizeT)3;
++ // if (size == 0) return p;
++ lim = p + size;
++ BR_PC_INIT
++ pc -= 4; // because (p) will point to next instruction
++
++ BR_EXTERNAL_FOR
++ {
++ // Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
++ for (;;)
++ {
++ UInt32 v;
++ if Z7_UNLIKELY(p == lim)
++ return p;
++ v = GetUi32a(p);
++ p += 4;
++ if Z7_UNLIKELY(((v - 0x94000000) & 0xfc000000) == 0)
++ {
++ UInt32 c = BR_PC_GET >> 2;
++ BR_CONVERT_VAL(v, c)
++ v &= 0x03ffffff;
++ v |= 0x94000000;
++ SetUi32a(p - 4, v)
++ BR_NEXT_ITERATION
++ }
++ // v = rotlFixed(v, 8); v += (flag << 8) - 0x90; if Z7_UNLIKELY((v & ((mask << 8) + 0x9f)) == 0)
++ v -= 0x90000000; if Z7_UNLIKELY((v & 0x9f000000) == 0)
++ {
++ UInt32 z, c;
++ // v = rotrFixed(v, 8);
++ v += flag; if Z7_UNLIKELY(v & mask) continue;
++ z = (v & 0xffffffe0) | (v >> 26);
++ c = (BR_PC_GET >> (12 - 3)) & ~(UInt32)7;
++ BR_CONVERT_VAL(z, c)
++ v &= 0x1f;
++ v |= 0x90000000;
++ v |= z << 26;
++ v |= 0x00ffffe0 & ((z & (((flag << 1) - 1))) - flag);
++ SetUi32a(p - 4, v)
++ }
++ }
++ }
++}
++Z7_BRANCH_FUNCS_IMP(BranchConv_ARM64)
+
+- if (encoding)
++
++Z7_BRANCH_FUNC_MAIN(BranchConv_ARM)
++{
++ // Byte *p = data;
++ const Byte *lim;
++ size &= ~(SizeT)3;
++ lim = p + size;
++ BR_PC_INIT
++ /* in ARM: branch offset is relative to the +2 instructions from current instruction.
++ (p) will point to next instruction */
++ pc += 8 - 4;
+
+ for (;;)
+ {
+ for (;;)
+ {
+- if (p >= lim)
+- return (SizeT)(p - data);
+- p += 4;
+- if (p[-1] == 0xEB)
+- break;
++ if Z7_UNLIKELY(p >= lim) { return p; } p += 4; if Z7_UNLIKELY(p[-1] == 0xeb) break;
++ if Z7_UNLIKELY(p >= lim) { return p; } p += 4; if Z7_UNLIKELY(p[-1] == 0xeb) break;
+ }
+ {
+- UInt32 v = GetUi32(p - 4);
+- v <<= 2;
+- v += ip + (UInt32)(p - data);
+- v >>= 2;
+- v &= 0x00FFFFFF;
+- v |= 0xEB000000;
+- SetUi32(p - 4, v);
++ UInt32 v = GetUi32a(p - 4);
++ UInt32 c = BR_PC_GET >> 2;
++ BR_CONVERT_VAL(v, c)
++ v &= 0x00ffffff;
++ v |= 0xeb000000;
++ SetUi32a(p - 4, v)
+ }
+ }
++}
++Z7_BRANCH_FUNCS_IMP(BranchConv_ARM)
++
++
++Z7_BRANCH_FUNC_MAIN(BranchConv_PPC)
++{
++ // Byte *p = data;
++ const Byte *lim;
++ size &= ~(SizeT)3;
++ lim = p + size;
++ BR_PC_INIT
++ pc -= 4; // because (p) will point to next instruction
+
+ for (;;)
+ {
++ UInt32 v;
+ for (;;)
+ {
+- if (p >= lim)
+- return (SizeT)(p - data);
++ if Z7_UNLIKELY(p == lim)
++ return p;
++ // v = GetBe32a(p);
++ v = *(UInt32 *)(void *)p;
+ p += 4;
+- if (p[-1] == 0xEB)
+- break;
++ // if ((v & 0xfc000003) == 0x48000001) break;
++ // if ((p[-4] & 0xFC) == 0x48 && (p[-1] & 3) == 1) break;
++ if Z7_UNLIKELY(
++ ((v - Z7_CONV_BE_TO_NATIVE_CONST32(0x48000001))
++ & Z7_CONV_BE_TO_NATIVE_CONST32(0xfc000003)) == 0) break;
+ }
+ {
+- UInt32 v = GetUi32(p - 4);
+- v <<= 2;
+- v -= ip + (UInt32)(p - data);
+- v >>= 2;
+- v &= 0x00FFFFFF;
+- v |= 0xEB000000;
+- SetUi32(p - 4, v);
++ v = Z7_CONV_NATIVE_TO_BE_32(v);
++ {
++ UInt32 c = BR_PC_GET;
++ BR_CONVERT_VAL(v, c)
++ }
++ v &= 0x03ffffff;
++ v |= 0x48000000;
++ SetBe32a(p - 4, v)
+ }
+ }
+ }
++Z7_BRANCH_FUNCS_IMP(BranchConv_PPC)
++
+
++#ifdef Z7_CPU_FAST_ROTATE_SUPPORTED
++#define BR_SPARC_USE_ROTATE
++#endif
+
+-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
++Z7_BRANCH_FUNC_MAIN(BranchConv_SPARC)
+ {
+- Byte *p;
++ // Byte *p = data;
+ const Byte *lim;
+- size &= ~(size_t)1;
+- p = data;
+- lim = data + size - 4;
+-
+- if (encoding)
+-
++ const UInt32 flag = (UInt32)1 << 22;
++ size &= ~(SizeT)3;
++ lim = p + size;
++ BR_PC_INIT
++ pc -= 4; // because (p) will point to next instruction
+ for (;;)
+ {
+- UInt32 b1;
++ UInt32 v;
+ for (;;)
+ {
+- UInt32 b3;
+- if (p > lim)
+- return (SizeT)(p - data);
+- b1 = p[1];
+- b3 = p[3];
+- p += 2;
+- b1 ^= 8;
+- if ((b3 & b1) >= 0xF8)
++ if Z7_UNLIKELY(p == lim)
++ return p;
++ /* // the code without GetBe32a():
++ { const UInt32 v = GetUi16a(p) & 0xc0ff; p += 4; if (v == 0x40 || v == 0xc07f) break; }
++ */
++ v = GetBe32a(p);
++ p += 4;
++ #ifdef BR_SPARC_USE_ROTATE
++ v = rotlFixed(v, 2);
++ v += (flag << 2) - 1;
++ if Z7_UNLIKELY((v & (3 - (flag << 3))) == 0)
++ #else
++ v += (UInt32)5 << 29;
++ v ^= (UInt32)7 << 29;
++ v += flag;
++ if Z7_UNLIKELY((v & (0 - (flag << 1))) == 0)
++ #endif
+ break;
+ }
+ {
+- UInt32 v =
+- ((UInt32)b1 << 19)
+- + (((UInt32)p[1] & 0x7) << 8)
+- + (((UInt32)p[-2] << 11))
+- + (p[0]);
+-
+- p += 2;
++ // UInt32 v = GetBe32a(p - 4);
++ #ifndef BR_SPARC_USE_ROTATE
++ v <<= 2;
++ #endif
+ {
+- UInt32 cur = (ip + (UInt32)(p - data)) >> 1;
+- v += cur;
++ UInt32 c = BR_PC_GET;
++ BR_CONVERT_VAL(v, c)
+ }
+-
+- p[-4] = (Byte)(v >> 11);
+- p[-3] = (Byte)(0xF0 | ((v >> 19) & 0x7));
+- p[-2] = (Byte)v;
+- p[-1] = (Byte)(0xF8 | (v >> 8));
++ v &= (flag << 3) - 1;
++ #ifdef BR_SPARC_USE_ROTATE
++ v -= (flag << 2) - 1;
++ v = rotrFixed(v, 2);
++ #else
++ v -= (flag << 2);
++ v >>= 2;
++ v |= (UInt32)1 << 30;
++ #endif
++ SetBe32a(p - 4, v)
+ }
+ }
++}
++Z7_BRANCH_FUNCS_IMP(BranchConv_SPARC)
++
++
++Z7_BRANCH_FUNC_MAIN(BranchConv_ARMT)
++{
++ // Byte *p = data;
++ Byte *lim;
++ size &= ~(SizeT)1;
++ // if (size == 0) return p;
++ if (size <= 2) return p;
++ size -= 2;
++ lim = p + size;
++ BR_PC_INIT
++ /* in ARM: branch offset is relative to the +2 instructions from current instruction.
++ (p) will point to the +2 instructions from current instruction */
++ // pc += 4 - 4;
++ // if (encoding) pc -= 0xf800 << 1; else pc += 0xf800 << 1;
++ // #define ARMT_TAIL_PROC { goto armt_tail; }
++ #define ARMT_TAIL_PROC { return p; }
+
+- for (;;)
++ do
+ {
+- UInt32 b1;
++ /* in MSVC 32-bit x86 compilers:
++ UInt32 version : it loads value from memory with movzx
++ Byte version : it loads value to 8-bit register (AL/CL)
++ movzx version is slightly faster in some cpus
++ */
++ unsigned b1;
++ // Byte / unsigned
++ b1 = p[1];
++ // optimized version to reduce one (p >= lim) check:
++ // unsigned a1 = p[1]; b1 = p[3]; p += 2; if Z7_LIKELY((b1 & (a1 ^ 8)) < 0xf8)
+ for (;;)
+ {
+- UInt32 b3;
+- if (p > lim)
+- return (SizeT)(p - data);
+- b1 = p[1];
+- b3 = p[3];
+- p += 2;
+- b1 ^= 8;
+- if ((b3 & b1) >= 0xF8)
+- break;
++ unsigned b3; // Byte / UInt32
++ /* (Byte)(b3) normalization can use low byte computations in MSVC.
++ It gives smaller code, and no loss of speed in some compilers/cpus.
++ But new MSVC 32-bit x86 compilers use more slow load
++ from memory to low byte register in that case.
++ So we try to use full 32-bit computations for faster code.
++ */
++ // if (p >= lim) { ARMT_TAIL_PROC } b3 = b1 + 8; b1 = p[3]; p += 2; if ((b3 & b1) >= 0xf8) break;
++ if Z7_UNLIKELY(p >= lim) { ARMT_TAIL_PROC } b3 = p[3]; p += 2; if Z7_UNLIKELY((b3 & (b1 ^ 8)) >= 0xf8) break;
++ if Z7_UNLIKELY(p >= lim) { ARMT_TAIL_PROC } b1 = p[3]; p += 2; if Z7_UNLIKELY((b1 & (b3 ^ 8)) >= 0xf8) break;
+ }
+ {
++ /* we can adjust pc for (0xf800) to rid of (& 0x7FF) operation.
++ But gcc/clang for arm64 can use bfi instruction for full code here */
+ UInt32 v =
+- ((UInt32)b1 << 19)
++ ((UInt32)GetUi16a(p - 2) << 11) |
++ ((UInt32)GetUi16a(p) & 0x7FF);
++ /*
++ UInt32 v =
++ ((UInt32)p[1 - 2] << 19)
+ + (((UInt32)p[1] & 0x7) << 8)
+ + (((UInt32)p[-2] << 11))
+ + (p[0]);
+-
++ */
+ p += 2;
+ {
+- UInt32 cur = (ip + (UInt32)(p - data)) >> 1;
+- v -= cur;
++ UInt32 c = BR_PC_GET >> 1;
++ BR_CONVERT_VAL(v, c)
+ }
+-
++ SetUi16a(p - 4, (UInt16)(((v >> 11) & 0x7ff) | 0xf000))
++ SetUi16a(p - 2, (UInt16)(v | 0xf800))
+ /*
+- SetUi16(p - 4, (UInt16)(((v >> 11) & 0x7FF) | 0xF000));
+- SetUi16(p - 2, (UInt16)(v | 0xF800));
+- */
+-
+ p[-4] = (Byte)(v >> 11);
+- p[-3] = (Byte)(0xF0 | ((v >> 19) & 0x7));
++ p[-3] = (Byte)(0xf0 | ((v >> 19) & 0x7));
+ p[-2] = (Byte)v;
+- p[-1] = (Byte)(0xF8 | (v >> 8));
++ p[-1] = (Byte)(0xf8 | (v >> 8));
++ */
+ }
+ }
++ while (p < lim);
++ return p;
++ // armt_tail:
++ // if ((Byte)((lim[1] & 0xf8)) != 0xf0) { lim += 2; } return lim;
++ // return (Byte *)(lim + ((Byte)((lim[1] ^ 0xf0) & 0xf8) == 0 ? 0 : 2));
++ // return (Byte *)(lim + (((lim[1] ^ ~0xfu) & ~7u) == 0 ? 0 : 2));
++ // return (Byte *)(lim + 2 - (((((unsigned)lim[1] ^ 8) + 8) >> 7) & 2));
+ }
++Z7_BRANCH_FUNCS_IMP(BranchConv_ARMT)
++
+
++// #define BR_IA64_NO_INLINE
+
+-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
++Z7_BRANCH_FUNC_MAIN(BranchConv_IA64)
+ {
+- Byte *p;
++ // Byte *p = data;
+ const Byte *lim;
+- size &= ~(size_t)3;
+- ip -= 4;
+- p = data;
+- lim = data + size;
++ size &= ~(SizeT)15;
++ lim = p + size;
++ pc -= 1 << 4;
++ pc >>= 4 - 1;
++ // pc -= 1 << 1;
+
+ for (;;)
+ {
++ unsigned m;
+ for (;;)
+ {
+- if (p >= lim)
+- return (SizeT)(p - data);
+- p += 4;
+- /* if ((v & 0xFC000003) == 0x48000001) */
+- if ((p[-4] & 0xFC) == 0x48 && (p[-1] & 3) == 1)
++ if Z7_UNLIKELY(p == lim)
++ return p;
++ m = (unsigned)((UInt32)0x334b0000 >> (*p & 0x1e));
++ p += 16;
++ pc += 1 << 1;
++ if (m &= 3)
+ break;
+ }
+ {
+- UInt32 v = GetBe32(p - 4);
+- if (encoding)
+- v += ip + (UInt32)(p - data);
+- else
+- v -= ip + (UInt32)(p - data);
+- v &= 0x03FFFFFF;
+- v |= 0x48000000;
+- SetBe32(p - 4, v);
++ p += (ptrdiff_t)m * 5 - 20; // negative value is expected here.
++ do
++ {
++ const UInt32 t =
++ #if defined(MY_CPU_X86_OR_AMD64)
++ // we use 32-bit load here to reduce code size on x86:
++ GetUi32(p);
++ #else
++ GetUi16(p);
++ #endif
++ UInt32 z = GetUi32(p + 1) >> m;
++ p += 5;
++ if (((t >> m) & (0x70 << 1)) == 0
++ && ((z - (0x5000000 << 1)) & (0xf000000 << 1)) == 0)
++ {
++ UInt32 v = (UInt32)((0x8fffff << 1) | 1) & z;
++ z ^= v;
++ #ifdef BR_IA64_NO_INLINE
++ v |= (v & ((UInt32)1 << (23 + 1))) >> 3;
++ {
++ UInt32 c = pc;
++ BR_CONVERT_VAL(v, c)
++ }
++ v &= (0x1fffff << 1) | 1;
++ #else
++ {
++ if (encoding)
++ {
++ // pc &= ~(0xc00000 << 1); // we just need to clear at least 2 bits
++ pc &= (0x1fffff << 1) | 1;
++ v += pc;
++ }
++ else
++ {
++ // pc |= 0xc00000 << 1; // we need to set at least 2 bits
++ pc |= ~(UInt32)((0x1fffff << 1) | 1);
++ v -= pc;
++ }
++ }
++ v &= ~(UInt32)(0x600000 << 1);
++ #endif
++ v += (0x700000 << 1);
++ v &= (0x8fffff << 1) | 1;
++ z |= v;
++ z <<= m;
++ SetUi32(p + 1 - 5, z)
++ }
++ m++;
++ }
++ while (m &= 3); // while (m < 4);
+ }
+ }
+ }
++Z7_BRANCH_FUNCS_IMP(BranchConv_IA64)
++
++
++#define BR_CONVERT_VAL_ENC(v) v += BR_PC_GET;
++#define BR_CONVERT_VAL_DEC(v) v -= BR_PC_GET;
+
++#if 1 && defined(MY_CPU_LE_UNALIGN)
++ #define RISCV_USE_UNALIGNED_LOAD
++#endif
++
++#ifdef RISCV_USE_UNALIGNED_LOAD
++ #define RISCV_GET_UI32(p) GetUi32(p)
++ #define RISCV_SET_UI32(p, v) { SetUi32(p, v) }
++#else
++ #define RISCV_GET_UI32(p) \
++ ((UInt32)GetUi16a(p) + \
++ ((UInt32)GetUi16a((p) + 2) << 16))
++ #define RISCV_SET_UI32(p, v) { \
++ SetUi16a(p, (UInt16)(v)) \
++ SetUi16a((p) + 2, (UInt16)(v >> 16)) }
++#endif
++
++#if 1 && defined(MY_CPU_LE)
++ #define RISCV_USE_16BIT_LOAD
++#endif
++
++#ifdef RISCV_USE_16BIT_LOAD
++ #define RISCV_LOAD_VAL(p) GetUi16a(p)
++#else
++ #define RISCV_LOAD_VAL(p) (*(p))
++#endif
++
++#define RISCV_INSTR_SIZE 2
++#define RISCV_STEP_1 (4 + RISCV_INSTR_SIZE)
++#define RISCV_STEP_2 4
++#define RISCV_REG_VAL (2 << 7)
++#define RISCV_CMD_VAL 3
++#if 1
++ // for code size optimization:
++ #define RISCV_DELTA_7F 0x7f
++#else
++ #define RISCV_DELTA_7F 0
++#endif
++
++#define RISCV_CHECK_1(v, b) \
++ (((((b) - RISCV_CMD_VAL) ^ ((v) << 8)) & (0xf8000 + RISCV_CMD_VAL)) == 0)
++
++#if 1
++ #define RISCV_CHECK_2(v, r) \
++ ((((v) - ((RISCV_CMD_VAL << 12) | RISCV_REG_VAL | 8)) \
++ << 18) \
++ < ((r) & 0x1d))
++#else
++ // this branch gives larger code, because
++ // compilers generate larger code for big constants.
++ #define RISCV_CHECK_2(v, r) \
++ ((((v) - ((RISCV_CMD_VAL << 12) | RISCV_REG_VAL)) \
++ & ((RISCV_CMD_VAL << 12) | RISCV_REG_VAL)) \
++ < ((r) & 0x1d))
++#endif
++
++
++#define RISCV_SCAN_LOOP \
++ Byte *lim; \
++ size &= ~(SizeT)(RISCV_INSTR_SIZE - 1); \
++ if (size <= 6) return p; \
++ size -= 6; \
++ lim = p + size; \
++ BR_PC_INIT \
++ for (;;) \
++ { \
++ UInt32 a, v; \
++ /* Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE */ \
++ for (;;) \
++ { \
++ if Z7_UNLIKELY(p >= lim) { return p; } \
++ a = (RISCV_LOAD_VAL(p) ^ 0x10u) + 1; \
++ if ((a & 0x77) == 0) break; \
++ a = (RISCV_LOAD_VAL(p + RISCV_INSTR_SIZE) ^ 0x10u) + 1; \
++ p += RISCV_INSTR_SIZE * 2; \
++ if ((a & 0x77) == 0) \
++ { \
++ p -= RISCV_INSTR_SIZE; \
++ if Z7_UNLIKELY(p >= lim) { return p; } \
++ break; \
++ } \
++ }
++// (xx6f ^ 10) + 1 = xx7f + 1 = xx80 : JAL
++// (xxef ^ 10) + 1 = xxff + 1 = xx00 + 100 : JAL
++// (xx17 ^ 10) + 1 = xx07 + 1 = xx08 : AUIPC
++// (xx97 ^ 10) + 1 = xx87 + 1 = xx88 : AUIPC
+
+-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
++Byte * Z7_BRANCH_CONV_ENC(RISCV)(Byte *p, SizeT size, UInt32 pc)
+ {
+- Byte *p;
+- const Byte *lim;
+- size &= ~(size_t)3;
+- ip -= 4;
+- p = data;
+- lim = data + size;
++ RISCV_SCAN_LOOP
++ v = a;
++ a = RISCV_GET_UI32(p);
++#ifndef RISCV_USE_16BIT_LOAD
++ v += (UInt32)p[1] << 8;
++#endif
+
+- for (;;)
+- {
+- for (;;)
++ if ((v & 8) == 0) // JAL
+ {
+- if (p >= lim)
+- return (SizeT)(p - data);
+- /*
+- v = GetBe32(p);
+- p += 4;
+- m = v + ((UInt32)5 << 29);
+- m ^= (UInt32)7 << 29;
+- m += (UInt32)1 << 22;
+- if ((m & ((UInt32)0x1FF << 23)) == 0)
+- break;
+- */
++ if ((v - (0x100 /* - RISCV_DELTA_7F */)) & 0xd80)
++ {
++ p += RISCV_INSTR_SIZE;
++ continue;
++ }
++ {
++ v = ((a & 1u << 31) >> 11)
++ | ((a & 0x3ff << 21) >> 20)
++ | ((a & 1 << 20) >> 9)
++ | (a & 0xff << 12);
++ BR_CONVERT_VAL_ENC(v)
++ // ((v & 1) == 0)
++ // v: bits [1 : 20] contain offset bits
++#if 0 && defined(RISCV_USE_UNALIGNED_LOAD)
++ a &= 0xfff;
++ a |= ((UInt32)(v << 23))
++ | ((UInt32)(v << 7) & ((UInt32)0xff << 16))
++ | ((UInt32)(v >> 5) & ((UInt32)0xf0 << 8));
++ RISCV_SET_UI32(p, a)
++#else // aligned
++#if 0
++ SetUi16a(p, (UInt16)(((v >> 5) & 0xf000) | (a & 0xfff)))
++#else
++ p[1] = (Byte)(((v >> 13) & 0xf0) | ((a >> 8) & 0xf));
++#endif
++
++#if 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) && defined(MY_CPU_LE)
++ v <<= 15;
++ v = Z7_BSWAP32(v);
++ SetUi16a(p + 2, (UInt16)v)
++#else
++ p[2] = (Byte)(v >> 9);
++ p[3] = (Byte)(v >> 1);
++#endif
++#endif // aligned
++ }
+ p += 4;
+- if ((p[-4] == 0x40 && (p[-3] & 0xC0) == 0) ||
+- (p[-4] == 0x7F && (p[-3] >= 0xC0)))
+- break;
++ continue;
++ } // JAL
++
++ {
++ // AUIPC
++ if (v & 0xe80) // (not x0) and (not x2)
++ {
++ const UInt32 b = RISCV_GET_UI32(p + 4);
++ if (RISCV_CHECK_1(v, b))
++ {
++ {
++ const UInt32 temp = (b << 12) | (0x17 + RISCV_REG_VAL);
++ RISCV_SET_UI32(p, temp)
++ }
++ a &= 0xfffff000;
++ {
++#if 1
++ const int t = -1 >> 1;
++ if (t != -1)
++ a += (b >> 20) - ((b >> 19) & 0x1000); // arithmetic right shift emulation
++ else
++#endif
++ a += (UInt32)((Int32)b >> 20); // arithmetic right shift (sign-extension).
++ }
++ BR_CONVERT_VAL_ENC(a)
++#if 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) && defined(MY_CPU_LE)
++ a = Z7_BSWAP32(a);
++ RISCV_SET_UI32(p + 4, a)
++#else
++ SetBe32(p + 4, a)
++#endif
++ p += 8;
++ }
++ else
++ p += RISCV_STEP_1;
++ }
++ else
++ {
++ UInt32 r = a >> 27;
++ if (RISCV_CHECK_2(v, r))
++ {
++ v = RISCV_GET_UI32(p + 4);
++ r = (r << 7) + 0x17 + (v & 0xfffff000);
++ a = (a >> 12) | (v << 20);
++ RISCV_SET_UI32(p, r)
++ RISCV_SET_UI32(p + 4, a)
++ p += 8;
++ }
++ else
++ p += RISCV_STEP_2;
++ }
+ }
++ } // for
++}
++
++
++Byte * Z7_BRANCH_CONV_DEC(RISCV)(Byte *p, SizeT size, UInt32 pc)
++{
++ RISCV_SCAN_LOOP
++#ifdef RISCV_USE_16BIT_LOAD
++ if ((a & 8) == 0)
++ {
++#else
++ v = a;
++ a += (UInt32)p[1] << 8;
++ if ((v & 8) == 0)
++ {
++#endif
++ // JAL
++ a -= 0x100 - RISCV_DELTA_7F;
++ if (a & 0xd80)
++ {
++ p += RISCV_INSTR_SIZE;
++ continue;
++ }
++ {
++ const UInt32 a_old = (a + (0xef - RISCV_DELTA_7F)) & 0xfff;
++#if 0 // unaligned
++ a = GetUi32(p);
++ v = (UInt32)(a >> 23) & ((UInt32)0xff << 1)
++ | (UInt32)(a >> 7) & ((UInt32)0xff << 9)
++#elif 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) && defined(MY_CPU_LE)
++ v = GetUi16a(p + 2);
++ v = Z7_BSWAP32(v) >> 15
++#else
++ v = (UInt32)p[3] << 1
++ | (UInt32)p[2] << 9
++#endif
++ | (UInt32)((a & 0xf000) << 5);
++ BR_CONVERT_VAL_DEC(v)
++ a = a_old
++ | (v << 11 & 1u << 31)
++ | (v << 20 & 0x3ff << 21)
++ | (v << 9 & 1 << 20)
++ | (v & 0xff << 12);
++ RISCV_SET_UI32(p, a)
++ }
++ p += 4;
++ continue;
++ } // JAL
++
+ {
+- UInt32 v = GetBe32(p - 4);
+- v <<= 2;
+- if (encoding)
+- v += ip + (UInt32)(p - data);
++ // AUIPC
++ v = a;
++#if 1 && defined(RISCV_USE_UNALIGNED_LOAD)
++ a = GetUi32(p);
++#else
++ a |= (UInt32)GetUi16a(p + 2) << 16;
++#endif
++ if ((v & 0xe80) == 0) // x0/x2
++ {
++ const UInt32 r = a >> 27;
++ if (RISCV_CHECK_2(v, r))
++ {
++ UInt32 b;
++#if 1 && defined(Z7_CPU_FAST_BSWAP_SUPPORTED) && defined(MY_CPU_LE)
++ b = RISCV_GET_UI32(p + 4);
++ b = Z7_BSWAP32(b);
++#else
++ b = GetBe32(p + 4);
++#endif
++ v = a >> 12;
++ BR_CONVERT_VAL_DEC(b)
++ a = (r << 7) + 0x17;
++ a += (b + 0x800) & 0xfffff000;
++ v |= b << 20;
++ RISCV_SET_UI32(p, a)
++ RISCV_SET_UI32(p + 4, v)
++ p += 8;
++ }
++ else
++ p += RISCV_STEP_2;
++ }
+ else
+- v -= ip + (UInt32)(p - data);
+-
+- v &= 0x01FFFFFF;
+- v -= (UInt32)1 << 24;
+- v ^= 0xFF000000;
+- v >>= 2;
+- v |= 0x40000000;
+- SetBe32(p - 4, v);
++ {
++ const UInt32 b = RISCV_GET_UI32(p + 4);
++ if (!RISCV_CHECK_1(v, b))
++ p += RISCV_STEP_1;
++ else
++ {
++ v = (a & 0xfffff000) | (b >> 20);
++ a = (b << 12) | (0x17 + RISCV_REG_VAL);
++ RISCV_SET_UI32(p, a)
++ RISCV_SET_UI32(p + 4, v)
++ p += 8;
++ }
++ }
+ }
+- }
++ } // for
+ }
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Bra.h b/electron34/patches/patch-third__party_lzma__sdk_C_Bra.h
new file mode 100644
index 0000000000..f2d4e7dad4
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Bra.h
@@ -0,0 +1,156 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Bra.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Bra.h
+@@ -1,64 +1,105 @@
+ /* Bra.h -- Branch converters for executables
+-2013-01-18 : Igor Pavlov : Public domain */
++2024-01-20 : Igor Pavlov : Public domain */
+
+-#ifndef __BRA_H
+-#define __BRA_H
++#ifndef ZIP7_INC_BRA_H
++#define ZIP7_INC_BRA_H
+
+ #include "7zTypes.h"
+
+ EXTERN_C_BEGIN
+
+-/*
+-These functions convert relative addresses to absolute addresses
+-in CALL instructions to increase the compression ratio.
+-
+- In:
+- data - data buffer
+- size - size of data
+- ip - current virtual Instruction Pinter (IP) value
+- state - state variable for x86 converter
+- encoding - 0 (for decoding), 1 (for encoding)
+-
+- Out:
+- state - state variable for x86 converter
++/* #define PPC BAD_PPC_11 // for debug */
++
++#define Z7_BRANCH_CONV_DEC_2(name) z7_ ## name ## _Dec
++#define Z7_BRANCH_CONV_ENC_2(name) z7_ ## name ## _Enc
++#define Z7_BRANCH_CONV_DEC(name) Z7_BRANCH_CONV_DEC_2(BranchConv_ ## name)
++#define Z7_BRANCH_CONV_ENC(name) Z7_BRANCH_CONV_ENC_2(BranchConv_ ## name)
++#define Z7_BRANCH_CONV_ST_DEC(name) z7_BranchConvSt_ ## name ## _Dec
++#define Z7_BRANCH_CONV_ST_ENC(name) z7_BranchConvSt_ ## name ## _Enc
++
++#define Z7_BRANCH_CONV_DECL(name) Byte * name(Byte *data, SizeT size, UInt32 pc)
++#define Z7_BRANCH_CONV_ST_DECL(name) Byte * name(Byte *data, SizeT size, UInt32 pc, UInt32 *state)
++
++typedef Z7_BRANCH_CONV_DECL( (*z7_Func_BranchConv));
++typedef Z7_BRANCH_CONV_ST_DECL((*z7_Func_BranchConvSt));
++
++#define Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL 0
++Z7_BRANCH_CONV_ST_DECL (Z7_BRANCH_CONV_ST_DEC(X86));
++Z7_BRANCH_CONV_ST_DECL (Z7_BRANCH_CONV_ST_ENC(X86));
++
++#define Z7_BRANCH_FUNCS_DECL(name) \
++Z7_BRANCH_CONV_DECL (Z7_BRANCH_CONV_DEC_2(name)); \
++Z7_BRANCH_CONV_DECL (Z7_BRANCH_CONV_ENC_2(name));
++
++Z7_BRANCH_FUNCS_DECL (BranchConv_ARM64)
++Z7_BRANCH_FUNCS_DECL (BranchConv_ARM)
++Z7_BRANCH_FUNCS_DECL (BranchConv_ARMT)
++Z7_BRANCH_FUNCS_DECL (BranchConv_PPC)
++Z7_BRANCH_FUNCS_DECL (BranchConv_SPARC)
++Z7_BRANCH_FUNCS_DECL (BranchConv_IA64)
++Z7_BRANCH_FUNCS_DECL (BranchConv_RISCV)
+
+- Returns:
+- The number of processed bytes. If you call these functions with multiple calls,
+- you must start next call with first byte after block of processed bytes.
++/*
++These functions convert data that contain CPU instructions.
++Each such function converts relative addresses to absolute addresses in some
++branch instructions: CALL (in all converters) and JUMP (X86 converter only).
++Such conversion allows to increase compression ratio, if we compress that data.
++
++There are 2 types of converters:
++ Byte * Conv_RISC (Byte *data, SizeT size, UInt32 pc);
++ Byte * ConvSt_X86(Byte *data, SizeT size, UInt32 pc, UInt32 *state);
++Each Converter supports 2 versions: one for encoding
++and one for decoding (_Enc/_Dec postfixes in function name).
++
++In params:
++ data : data buffer
++ size : size of data
++ pc : current virtual Program Counter (Instruction Pointer) value
++In/Out param:
++ state : pointer to state variable (for X86 converter only)
++
++Return:
++ The pointer to position in (data) buffer after last byte that was processed.
++ If the caller calls converter again, it must call it starting with that position.
++ But the caller is allowed to move data in buffer. So pointer to
++ current processed position also will be changed for next call.
++ Also the caller must increase internal (pc) value for next call.
+
++Each converter has some characteristics: Endian, Alignment, LookAhead.
+ Type Endian Alignment LookAhead
+
+- x86 little 1 4
++ X86 little 1 4
+ ARMT little 2 2
++ RISCV little 2 6
+ ARM little 4 0
++ ARM64 little 4 0
+ PPC big 4 0
+ SPARC big 4 0
+ IA64 little 16 0
+
+- size must be >= Alignment + LookAhead, if it's not last block.
+- If (size < Alignment + LookAhead), converter returns 0.
+-
+- Example:
+-
+- UInt32 ip = 0;
+- for ()
+- {
+- ; size must be >= Alignment + LookAhead, if it's not last block
+- SizeT processed = Convert(data, size, ip, 1);
+- data += processed;
+- size -= processed;
+- ip += processed;
+- }
++ (data) must be aligned for (Alignment).
++ processed size can be calculated as:
++ SizeT processed = Conv(data, size, pc) - data;
++ if (processed == 0)
++ it means that converter needs more data for processing.
++ If (size < Alignment + LookAhead)
++ then (processed == 0) is allowed.
++
++Example code for conversion in loop:
++ UInt32 pc = 0;
++ size = 0;
++ for (;;)
++ {
++ size += Load_more_input_data(data + size);
++ SizeT processed = Conv(data, size, pc) - data;
++ if (processed == 0 && no_more_input_data_after_size)
++ break; // we stop convert loop
++ data += processed;
++ size -= processed;
++ pc += processed;
++ }
+ */
+
+-#define x86_Convert_Init(state) { state = 0; }
+-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding);
+-SizeT ARM_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+-SizeT ARMT_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+-SizeT PPC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+-SizeT SPARC_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding);
+-
+ EXTERN_C_END
+
+ #endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Bra86.c b/electron34/patches/patch-third__party_lzma__sdk_C_Bra86.c
new file mode 100644
index 0000000000..f273bb8dec
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Bra86.c
@@ -0,0 +1,254 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Bra86.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Bra86.c
+@@ -1,82 +1,187 @@
+-/* Bra86.c -- Converter for x86 code (BCJ)
+-2021-02-09 : Igor Pavlov : Public domain */
++/* Bra86.c -- Branch converter for X86 code (BCJ)
++2023-04-02 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include "Bra.h"
++#include "CpuArch.h"
+
+-#define Test86MSByte(b) ((((b) + 1) & 0xFE) == 0)
+
+-SizeT x86_Convert(Byte *data, SizeT size, UInt32 ip, UInt32 *state, int encoding)
++#if defined(MY_CPU_SIZEOF_POINTER) \
++ && ( MY_CPU_SIZEOF_POINTER == 4 \
++ || MY_CPU_SIZEOF_POINTER == 8)
++ #define BR_CONV_USE_OPT_PC_PTR
++#endif
++
++#ifdef BR_CONV_USE_OPT_PC_PTR
++#define BR_PC_INIT pc -= (UInt32)(SizeT)p; // (MY_uintptr_t)
++#define BR_PC_GET (pc + (UInt32)(SizeT)p)
++#else
++#define BR_PC_INIT pc += (UInt32)size;
++#define BR_PC_GET (pc - (UInt32)(SizeT)(lim - p))
++// #define BR_PC_INIT
++// #define BR_PC_GET (pc + (UInt32)(SizeT)(p - data))
++#endif
++
++#define BR_CONVERT_VAL(v, c) if (encoding) v += c; else v -= c;
++// #define BR_CONVERT_VAL(v, c) if (!encoding) c = (UInt32)0 - c; v += c;
++
++#define Z7_BRANCH_CONV_ST(name) z7_BranchConvSt_ ## name
++
++#define BR86_NEED_CONV_FOR_MS_BYTE(b) ((((b) + 1) & 0xfe) == 0)
++
++#ifdef MY_CPU_LE_UNALIGN
++ #define BR86_PREPARE_BCJ_SCAN const UInt32 v = GetUi32(p) ^ 0xe8e8e8e8;
++ #define BR86_IS_BCJ_BYTE(n) ((v & ((UInt32)0xfe << (n) * 8)) == 0)
++#else
++ #define BR86_PREPARE_BCJ_SCAN
++ // bad for MSVC X86 (partial write to byte reg):
++ #define BR86_IS_BCJ_BYTE(n) ((p[n - 4] & 0xfe) == 0xe8)
++ // bad for old MSVC (partial write to byte reg):
++ // #define BR86_IS_BCJ_BYTE(n) (((*p ^ 0xe8) & 0xfe) == 0)
++#endif
++
++static
++Z7_FORCE_INLINE
++Z7_ATTRIB_NO_VECTOR
++Byte *Z7_BRANCH_CONV_ST(X86)(Byte *p, SizeT size, UInt32 pc, UInt32 *state, int encoding)
+ {
+- SizeT pos = 0;
+- UInt32 mask = *state & 7;
+ if (size < 5)
+- return 0;
+- size -= 4;
+- ip += 5;
++ return p;
++ {
++ // Byte *p = data;
++ const Byte *lim = p + size - 4;
++ unsigned mask = (unsigned)*state; // & 7;
++#ifdef BR_CONV_USE_OPT_PC_PTR
++ /* if BR_CONV_USE_OPT_PC_PTR is defined: we need to adjust (pc) for (+4),
++ because call/jump offset is relative to the next instruction.
++ if BR_CONV_USE_OPT_PC_PTR is not defined : we don't need to adjust (pc) for (+4),
++ because BR_PC_GET uses (pc - (lim - p)), and lim was adjusted for (-4) before.
++ */
++ pc += 4;
++#endif
++ BR_PC_INIT
++ goto start;
+
+- for (;;)
++ for (;; mask |= 4)
+ {
+- Byte *p = data + pos;
+- const Byte *limit = data + size;
+- for (; p < limit; p++)
+- if ((*p & 0xFE) == 0xE8)
+- break;
+-
++ // cont: mask |= 4;
++ start:
++ if (p >= lim)
++ goto fin;
+ {
+- SizeT d = (SizeT)(p - data) - pos;
+- pos = (SizeT)(p - data);
+- if (p >= limit)
+- {
+- *state = (d > 2 ? 0 : mask >> (unsigned)d);
+- return pos;
+- }
+- if (d > 2)
+- mask = 0;
+- else
+- {
+- mask >>= (unsigned)d;
+- if (mask != 0 && (mask > 4 || mask == 3 || Test86MSByte(p[(size_t)(mask >> 1) + 1])))
+- {
+- mask = (mask >> 1) | 4;
+- pos++;
+- continue;
+- }
+- }
++ BR86_PREPARE_BCJ_SCAN
++ p += 4;
++ if (BR86_IS_BCJ_BYTE(0)) { goto m0; } mask >>= 1;
++ if (BR86_IS_BCJ_BYTE(1)) { goto m1; } mask >>= 1;
++ if (BR86_IS_BCJ_BYTE(2)) { goto m2; } mask = 0;
++ if (BR86_IS_BCJ_BYTE(3)) { goto a3; }
+ }
++ goto main_loop;
++
++ m0: p--;
++ m1: p--;
++ m2: p--;
++ if (mask == 0)
++ goto a3;
++ if (p > lim)
++ goto fin_p;
+
+- if (Test86MSByte(p[4]))
++ // if (((0x17u >> mask) & 1) == 0)
++ if (mask > 4 || mask == 3)
+ {
+- UInt32 v = ((UInt32)p[4] << 24) | ((UInt32)p[3] << 16) | ((UInt32)p[2] << 8) | ((UInt32)p[1]);
+- UInt32 cur = ip + (UInt32)pos;
+- pos += 5;
+- if (encoding)
+- v += cur;
+- else
+- v -= cur;
+- if (mask != 0)
++ mask >>= 1;
++ continue; // goto cont;
++ }
++ mask >>= 1;
++ if (BR86_NEED_CONV_FOR_MS_BYTE(p[mask]))
++ continue; // goto cont;
++ // if (!BR86_NEED_CONV_FOR_MS_BYTE(p[3])) continue; // goto cont;
++ {
++ UInt32 v = GetUi32(p);
++ UInt32 c;
++ v += (1 << 24); if (v & 0xfe000000) continue; // goto cont;
++ c = BR_PC_GET;
++ BR_CONVERT_VAL(v, c)
+ {
+- unsigned sh = (mask & 6) << 2;
+- if (Test86MSByte((Byte)(v >> sh)))
++ mask <<= 3;
++ if (BR86_NEED_CONV_FOR_MS_BYTE(v >> mask))
+ {
+- v ^= (((UInt32)0x100 << sh) - 1);
+- if (encoding)
+- v += cur;
+- else
+- v -= cur;
++ v ^= (((UInt32)0x100 << mask) - 1);
++ #ifdef MY_CPU_X86
++ // for X86 : we can recalculate (c) to reduce register pressure
++ c = BR_PC_GET;
++ #endif
++ BR_CONVERT_VAL(v, c)
+ }
+ mask = 0;
+ }
+- p[1] = (Byte)v;
+- p[2] = (Byte)(v >> 8);
+- p[3] = (Byte)(v >> 16);
+- p[4] = (Byte)(0 - ((v >> 24) & 1));
++ // v = (v & ((1 << 24) - 1)) - (v & (1 << 24));
++ v &= (1 << 25) - 1; v -= (1 << 24);
++ SetUi32(p, v)
++ p += 4;
++ goto main_loop;
+ }
+- else
++
++ main_loop:
++ if (p >= lim)
++ goto fin;
++ for (;;)
+ {
+- mask = (mask >> 1) | 4;
+- pos++;
++ BR86_PREPARE_BCJ_SCAN
++ p += 4;
++ if (BR86_IS_BCJ_BYTE(0)) { goto a0; }
++ if (BR86_IS_BCJ_BYTE(1)) { goto a1; }
++ if (BR86_IS_BCJ_BYTE(2)) { goto a2; }
++ if (BR86_IS_BCJ_BYTE(3)) { goto a3; }
++ if (p >= lim)
++ goto fin;
++ }
++
++ a0: p--;
++ a1: p--;
++ a2: p--;
++ a3:
++ if (p > lim)
++ goto fin_p;
++ // if (!BR86_NEED_CONV_FOR_MS_BYTE(p[3])) continue; // goto cont;
++ {
++ UInt32 v = GetUi32(p);
++ UInt32 c;
++ v += (1 << 24); if (v & 0xfe000000) continue; // goto cont;
++ c = BR_PC_GET;
++ BR_CONVERT_VAL(v, c)
++ // v = (v & ((1 << 24) - 1)) - (v & (1 << 24));
++ v &= (1 << 25) - 1; v -= (1 << 24);
++ SetUi32(p, v)
++ p += 4;
++ goto main_loop;
+ }
+ }
++
++fin_p:
++ p--;
++fin:
++ // the following processing for tail is optional and can be commented
++ /*
++ lim += 4;
++ for (; p < lim; p++, mask >>= 1)
++ if ((*p & 0xfe) == 0xe8)
++ break;
++ */
++ *state = (UInt32)mask;
++ return p;
++ }
+ }
++
++
++#define Z7_BRANCH_CONV_ST_FUNC_IMP(name, m, encoding) \
++Z7_NO_INLINE \
++Z7_ATTRIB_NO_VECTOR \
++Byte *m(name)(Byte *data, SizeT size, UInt32 pc, UInt32 *state) \
++ { return Z7_BRANCH_CONV_ST(name)(data, size, pc, state, encoding); }
++
++Z7_BRANCH_CONV_ST_FUNC_IMP(X86, Z7_BRANCH_CONV_ST_DEC, 0)
++#ifndef Z7_EXTRACT_ONLY
++Z7_BRANCH_CONV_ST_FUNC_IMP(X86, Z7_BRANCH_CONV_ST_ENC, 1)
++#endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_BraIA64.c b/electron34/patches/patch-third__party_lzma__sdk_C_BraIA64.c
new file mode 100644
index 0000000000..d332034e6e
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_BraIA64.c
@@ -0,0 +1,71 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/BraIA64.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/BraIA64.c
+@@ -1,53 +1,14 @@
+ /* BraIA64.c -- Converter for IA-64 code
+-2017-01-26 : Igor Pavlov : Public domain */
++2023-02-20 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+-#include "CpuArch.h"
+-#include "Bra.h"
++// the code was moved to Bra.c
+
+-SizeT IA64_Convert(Byte *data, SizeT size, UInt32 ip, int encoding)
+-{
+- SizeT i;
+- if (size < 16)
+- return 0;
+- size -= 16;
+- i = 0;
+- do
+- {
+- unsigned m = ((UInt32)0x334B0000 >> (data[i] & 0x1E)) & 3;
+- if (m)
+- {
+- m++;
+- do
+- {
+- Byte *p = data + (i + (size_t)m * 5 - 8);
+- if (((p[3] >> m) & 15) == 5
+- && (((p[-1] | ((UInt32)p[0] << 8)) >> m) & 0x70) == 0)
+- {
+- unsigned raw = GetUi32(p);
+- unsigned v = raw >> m;
+- v = (v & 0xFFFFF) | ((v & (1 << 23)) >> 3);
+-
+- v <<= 4;
+- if (encoding)
+- v += ip + (UInt32)i;
+- else
+- v -= ip + (UInt32)i;
+- v >>= 4;
+-
+- v &= 0x1FFFFF;
+- v += 0x700000;
+- v &= 0x8FFFFF;
+- raw &= ~((UInt32)0x8FFFFF << m);
+- raw |= (v << m);
+- SetUi32(p, raw);
+- }
+- }
+- while (++m <= 4);
+- }
+- i += 16;
+- }
+- while (i <= size);
+- return i;
+-}
++#ifdef _MSC_VER
++#pragma warning(disable : 4206) // nonstandard extension used : translation unit is empty
++#endif
++
++#if defined(__clang__)
++#pragma GCC diagnostic ignored "-Wempty-translation-unit"
++#endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Compiler.h b/electron34/patches/patch-third__party_lzma__sdk_C_Compiler.h
new file mode 100644
index 0000000000..ff277dc8b4
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Compiler.h
@@ -0,0 +1,261 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Compiler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Compiler.h
+@@ -1,12 +1,105 @@
+-/* Compiler.h
+-2021-01-05 : Igor Pavlov : Public domain */
++/* Compiler.h : Compiler specific defines and pragmas
++2024-01-22 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_COMPILER_H
+-#define __7Z_COMPILER_H
++#ifndef ZIP7_INC_COMPILER_H
++#define ZIP7_INC_COMPILER_H
+
+- #ifdef __clang__
+- #pragma clang diagnostic ignored "-Wunused-private-field"
++#if defined(__clang__)
++# define Z7_CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
++#endif
++#if defined(__clang__) && defined(__apple_build_version__)
++# define Z7_APPLE_CLANG_VERSION Z7_CLANG_VERSION
++#elif defined(__clang__)
++# define Z7_LLVM_CLANG_VERSION Z7_CLANG_VERSION
++#elif defined(__GNUC__)
++# define Z7_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
++#endif
++
++#ifdef _MSC_VER
++#if !defined(__clang__) && !defined(__GNUC__)
++#define Z7_MSC_VER_ORIGINAL _MSC_VER
++#endif
++#endif
++
++#if defined(__MINGW32__) || defined(__MINGW64__)
++#define Z7_MINGW
++#endif
++
++#if defined(__LCC__) && (defined(__MCST__) || defined(__e2k__))
++#define Z7_MCST_LCC
++#define Z7_MCST_LCC_VERSION (__LCC__ * 100 + __LCC_MINOR__)
++#endif
++
++/*
++#if defined(__AVX2__) \
++ || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \
++ || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 40600) \
++ || defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30100) \
++ || defined(Z7_MSC_VER_ORIGINAL) && (Z7_MSC_VER_ORIGINAL >= 1800) \
++ || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1400)
++ #define Z7_COMPILER_AVX2_SUPPORTED
+ #endif
++#endif
++*/
++
++// #pragma GCC diagnostic ignored "-Wunknown-pragmas"
++
++#ifdef __clang__
++// padding size of '' with 4 bytes to alignment boundary
++#pragma GCC diagnostic ignored "-Wpadded"
++
++#if defined(Z7_LLVM_CLANG_VERSION) && (__clang_major__ == 13) \
++ && defined(__FreeBSD__)
++// freebsd:
++#pragma GCC diagnostic ignored "-Wexcess-padding"
++#endif
++
++#if __clang_major__ >= 16
++#pragma GCC diagnostic ignored "-Wunsafe-buffer-usage"
++#endif
++
++#if __clang_major__ == 13
++#if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 16)
++// cheri
++#pragma GCC diagnostic ignored "-Wcapability-to-integer-cast"
++#endif
++#endif
++
++#if __clang_major__ == 13
++ // for <arm_neon.h>
++ #pragma GCC diagnostic ignored "-Wreserved-identifier"
++#endif
++
++#endif // __clang__
++
++#if defined(_WIN32) && defined(__clang__) && __clang_major__ >= 16
++// #pragma GCC diagnostic ignored "-Wcast-function-type-strict"
++#define Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION \
++ _Pragma("GCC diagnostic ignored \"-Wcast-function-type-strict\"")
++#else
++#define Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
++#endif
++
++typedef void (*Z7_void_Function)(void);
++#if defined(__clang__) || defined(__GNUC__)
++#define Z7_CAST_FUNC_C (Z7_void_Function)
++#elif defined(_MSC_VER) && _MSC_VER > 1920
++#define Z7_CAST_FUNC_C (void *)
++// #pragma warning(disable : 4191) // 'type cast': unsafe conversion from 'FARPROC' to 'void (__cdecl *)()'
++#else
++#define Z7_CAST_FUNC_C
++#endif
++/*
++#if (defined(__GNUC__) && (__GNUC__ >= 8)) || defined(__clang__)
++ // #pragma GCC diagnostic ignored "-Wcast-function-type"
++#endif
++*/
++#ifdef __GNUC__
++#if defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40000) && (Z7_GCC_VERSION < 70000)
++#pragma GCC diagnostic ignored "-Wstrict-aliasing"
++#endif
++#endif
++
+
+ #ifdef _MSC_VER
+
+@@ -17,24 +110,124 @@
+ #pragma warning(disable : 4214) // nonstandard extension used : bit field types other than int
+ #endif
+
+- #if _MSC_VER >= 1300
+- #pragma warning(disable : 4996) // This function or variable may be unsafe
+- #else
+- #pragma warning(disable : 4511) // copy constructor could not be generated
+- #pragma warning(disable : 4512) // assignment operator could not be generated
+- #pragma warning(disable : 4514) // unreferenced inline function has been removed
+- #pragma warning(disable : 4702) // unreachable code
+- #pragma warning(disable : 4710) // not inlined
+- #pragma warning(disable : 4714) // function marked as __forceinline not inlined
+- #pragma warning(disable : 4786) // identifier was truncated to '255' characters in the debug information
+- #endif
++#if defined(_MSC_VER) && _MSC_VER >= 1800
++#pragma warning(disable : 4464) // relative include path contains '..'
++#endif
+
+- #ifdef __clang__
+- #pragma clang diagnostic ignored "-Wdeprecated-declarations"
+- #pragma clang diagnostic ignored "-Wmicrosoft-exception-spec"
+- // #pragma clang diagnostic ignored "-Wreserved-id-macro"
+- #endif
++// == 1200 : -O1 : for __forceinline
++// >= 1900 : -O1 : for printf
++#pragma warning(disable : 4710) // function not inlined
++
++#if _MSC_VER < 1900
++// winnt.h: 'Int64ShllMod32'
++#pragma warning(disable : 4514) // unreferenced inline function has been removed
++#endif
++
++#if _MSC_VER < 1300
++// #pragma warning(disable : 4702) // unreachable code
++// Bra.c : -O1:
++#pragma warning(disable : 4714) // function marked as __forceinline not inlined
++#endif
++
++/*
++#if _MSC_VER > 1400 && _MSC_VER <= 1900
++// strcat: This function or variable may be unsafe
++// sysinfoapi.h: kit10: GetVersion was declared deprecated
++#pragma warning(disable : 4996)
++#endif
++*/
++
++#if _MSC_VER > 1200
++// -Wall warnings
++
++#pragma warning(disable : 4711) // function selected for automatic inline expansion
++#pragma warning(disable : 4820) // '2' bytes padding added after data member
++
++#if _MSC_VER >= 1400 && _MSC_VER < 1920
++// 1400: string.h: _DBG_MEMCPY_INLINE_
++// 1600 - 191x : smmintrin.h __cplusplus'
++// is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
++#pragma warning(disable : 4668)
++
++// 1400 - 1600 : WinDef.h : 'FARPROC' :
++// 1900 - 191x : immintrin.h: _readfsbase_u32
++// no function prototype given : converting '()' to '(void)'
++#pragma warning(disable : 4255)
++#endif
++
++#if _MSC_VER >= 1914
++// Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
++#pragma warning(disable : 5045)
++#endif
++
++#endif // _MSC_VER > 1200
++#endif // _MSC_VER
++
++
++#if defined(__clang__) && (__clang_major__ >= 4)
++ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
++ _Pragma("clang loop unroll(disable)") \
++ _Pragma("clang loop vectorize(disable)")
++ #define Z7_ATTRIB_NO_VECTORIZE
++#elif defined(__GNUC__) && (__GNUC__ >= 5) \
++ && (!defined(Z7_MCST_LCC_VERSION) || (Z7_MCST_LCC_VERSION >= 12610))
++ #define Z7_ATTRIB_NO_VECTORIZE __attribute__((optimize("no-tree-vectorize")))
++ // __attribute__((optimize("no-unroll-loops")));
++ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
++#elif defined(_MSC_VER) && (_MSC_VER >= 1920)
++ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE \
++ _Pragma("loop( no_vector )")
++ #define Z7_ATTRIB_NO_VECTORIZE
++#else
++ #define Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
++ #define Z7_ATTRIB_NO_VECTORIZE
++#endif
++
++#if defined(MY_CPU_X86_OR_AMD64) && ( \
++ defined(__clang__) && (__clang_major__ >= 4) \
++ || defined(__GNUC__) && (__GNUC__ >= 5))
++ #define Z7_ATTRIB_NO_SSE __attribute__((__target__("no-sse")))
++#else
++ #define Z7_ATTRIB_NO_SSE
++#endif
++
++#define Z7_ATTRIB_NO_VECTOR \
++ Z7_ATTRIB_NO_VECTORIZE \
++ Z7_ATTRIB_NO_SSE
++
++
++#if defined(__clang__) && (__clang_major__ >= 8) \
++ || defined(__GNUC__) && (__GNUC__ >= 1000) \
++ /* || defined(_MSC_VER) && (_MSC_VER >= 1920) */
++ // GCC is not good for __builtin_expect()
++ #define Z7_LIKELY(x) (__builtin_expect((x), 1))
++ #define Z7_UNLIKELY(x) (__builtin_expect((x), 0))
++ // #define Z7_unlikely [[unlikely]]
++ // #define Z7_likely [[likely]]
++#else
++ #define Z7_LIKELY(x) (x)
++ #define Z7_UNLIKELY(x) (x)
++ // #define Z7_likely
++#endif
++
++
++#if (defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30600))
++
++#if (Z7_CLANG_VERSION < 130000)
++#define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
++ _Pragma("GCC diagnostic push") \
++ _Pragma("GCC diagnostic ignored \"-Wreserved-id-macro\"")
++#else
++#define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER \
++ _Pragma("GCC diagnostic push") \
++ _Pragma("GCC diagnostic ignored \"-Wreserved-macro-identifier\"")
++#endif
+
++#define Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER \
++ _Pragma("GCC diagnostic pop")
++#else
++#define Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++#define Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
+ #endif
+
+ #define UNUSED_VAR(x) (void)x;
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.c b/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.c
new file mode 100644
index 0000000000..1d0e3844cd
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.c
@@ -0,0 +1,1210 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/CpuArch.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/CpuArch.c
+@@ -1,187 +1,357 @@
+ /* CpuArch.c -- CPU specific code
+-2021-07-13 : Igor Pavlov : Public domain */
++Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
++// #include <stdio.h>
++
+ #include "CpuArch.h"
+
+ #ifdef MY_CPU_X86_OR_AMD64
+
+-#if (defined(_MSC_VER) && !defined(MY_CPU_AMD64)) || defined(__GNUC__)
+-#define USE_ASM
++#undef NEED_CHECK_FOR_CPUID
++#if !defined(MY_CPU_AMD64)
++#define NEED_CHECK_FOR_CPUID
+ #endif
+
+-#if !defined(USE_ASM) && _MSC_VER >= 1500
+-#include <intrin.h>
+-#endif
++/*
++ cpuid instruction supports (subFunction) parameter in ECX,
++ that is used only with some specific (function) parameter values.
++ most functions use only (subFunction==0).
++*/
++/*
++ __cpuid(): MSVC and GCC/CLANG use same function/macro name
++ but parameters are different.
++ We use MSVC __cpuid() parameters style for our z7_x86_cpuid() function.
++*/
++
++#if defined(__GNUC__) /* && (__GNUC__ >= 10) */ \
++ || defined(__clang__) /* && (__clang_major__ >= 10) */
++
++/* there was some CLANG/GCC compilers that have issues with
++ rbx(ebx) handling in asm blocks in -fPIC mode (__PIC__ is defined).
++ compiler's <cpuid.h> contains the macro __cpuid() that is similar to our code.
++ The history of __cpuid() changes in CLANG/GCC:
++ GCC:
++ 2007: it preserved ebx for (__PIC__ && __i386__)
++ 2013: it preserved rbx and ebx for __PIC__
++ 2014: it doesn't preserves rbx and ebx anymore
++ we suppose that (__GNUC__ >= 5) fixed that __PIC__ ebx/rbx problem.
++ CLANG:
++ 2014+: it preserves rbx, but only for 64-bit code. No __PIC__ check.
++ Why CLANG cares about 64-bit mode only, and doesn't care about ebx (in 32-bit)?
++ Do we need __PIC__ test for CLANG or we must care about rbx even if
++ __PIC__ is not defined?
++*/
++
++#define ASM_LN "\n"
++
++#if defined(MY_CPU_AMD64) && defined(__PIC__) \
++ && ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
++
++ /* "=&r" selects free register. It can select even rbx, if that register is free.
++ "=&D" for (RDI) also works, but the code can be larger with "=&D"
++ "2"(subFun) : 2 is (zero-based) index in the output constraint list "=c" (ECX). */
++
++#define x86_cpuid_MACRO_2(p, func, subFunc) { \
++ __asm__ __volatile__ ( \
++ ASM_LN "mov %%rbx, %q1" \
++ ASM_LN "cpuid" \
++ ASM_LN "xchg %%rbx, %q1" \
++ : "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(subFunc)); }
++
++#elif defined(MY_CPU_X86) && defined(__PIC__) \
++ && ((defined (__GNUC__) && (__GNUC__ < 5)) || defined(__clang__))
++
++#define x86_cpuid_MACRO_2(p, func, subFunc) { \
++ __asm__ __volatile__ ( \
++ ASM_LN "mov %%ebx, %k1" \
++ ASM_LN "cpuid" \
++ ASM_LN "xchg %%ebx, %k1" \
++ : "=a" ((p)[0]), "=&r" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(subFunc)); }
+
+-#if defined(USE_ASM) && !defined(MY_CPU_AMD64)
+-static UInt32 CheckFlag(UInt32 flag)
+-{
+- #ifdef _MSC_VER
+- __asm pushfd;
+- __asm pop EAX;
+- __asm mov EDX, EAX;
+- __asm xor EAX, flag;
+- __asm push EAX;
+- __asm popfd;
+- __asm pushfd;
+- __asm pop EAX;
+- __asm xor EAX, EDX;
+- __asm push EDX;
+- __asm popfd;
+- __asm and flag, EAX;
+- #else
+- __asm__ __volatile__ (
+- "pushf\n\t"
+- "pop %%EAX\n\t"
+- "movl %%EAX,%%EDX\n\t"
+- "xorl %0,%%EAX\n\t"
+- "push %%EAX\n\t"
+- "popf\n\t"
+- "pushf\n\t"
+- "pop %%EAX\n\t"
+- "xorl %%EDX,%%EAX\n\t"
+- "push %%EDX\n\t"
+- "popf\n\t"
+- "andl %%EAX, %0\n\t":
+- "=c" (flag) : "c" (flag) :
+- "%eax", "%edx");
+- #endif
+- return flag;
+-}
+-#define CHECK_CPUID_IS_SUPPORTED if (CheckFlag(1 << 18) == 0 || CheckFlag(1 << 21) == 0) return False;
+ #else
+-#define CHECK_CPUID_IS_SUPPORTED
++
++#define x86_cpuid_MACRO_2(p, func, subFunc) { \
++ __asm__ __volatile__ ( \
++ ASM_LN "cpuid" \
++ : "=a" ((p)[0]), "=b" ((p)[1]), "=c" ((p)[2]), "=d" ((p)[3]) : "0" (func), "2"(subFunc)); }
++
+ #endif
+
+-#ifndef USE_ASM
+- #ifdef _MSC_VER
+- #if _MSC_VER >= 1600
+- #define MY__cpuidex __cpuidex
+- #else
++#define x86_cpuid_MACRO(p, func) x86_cpuid_MACRO_2(p, func, 0)
+
+-/*
+- __cpuid (function == 4) requires subfunction number in ECX.
+- MSDN: The __cpuid intrinsic clears the ECX register before calling the cpuid instruction.
+- __cpuid() in new MSVC clears ECX.
+- __cpuid() in old MSVC (14.00) doesn't clear ECX
+- We still can use __cpuid for low (function) values that don't require ECX,
+- but __cpuid() in old MSVC will be incorrect for some function values: (function == 4).
+- So here we use the hack for old MSVC to send (subFunction) in ECX register to cpuid instruction,
+- where ECX value is first parameter for FAST_CALL / NO_INLINE function,
+- So the caller of MY__cpuidex_HACK() sets ECX as subFunction, and
+- old MSVC for __cpuid() doesn't change ECX and cpuid instruction gets (subFunction) value.
+-
+- DON'T remove MY_NO_INLINE and MY_FAST_CALL for MY__cpuidex_HACK() !!!
+-*/
++void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
++{
++ x86_cpuid_MACRO(p, func)
++}
+
+ static
+-MY_NO_INLINE
+-void MY_FAST_CALL MY__cpuidex_HACK(UInt32 subFunction, int *CPUInfo, UInt32 function)
++void Z7_FASTCALL z7_x86_cpuid_subFunc(UInt32 p[4], UInt32 func, UInt32 subFunc)
+ {
+- UNUSED_VAR(subFunction);
+- __cpuid(CPUInfo, function);
++ x86_cpuid_MACRO_2(p, func, subFunc)
+ }
+
+- #define MY__cpuidex(info, func, func2) MY__cpuidex_HACK(func2, info, func)
+- #pragma message("======== MY__cpuidex_HACK WAS USED ========")
+- #endif
+- #else
+- #define MY__cpuidex(info, func, func2) __cpuid(info, func)
+- #pragma message("======== (INCORRECT ?) cpuid WAS USED ========")
+- #endif
+-#endif
+
++Z7_NO_INLINE
++UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
++{
++ #if defined(NEED_CHECK_FOR_CPUID)
++ #define EFALGS_CPUID_BIT 21
++ UInt32 a;
++ __asm__ __volatile__ (
++ ASM_LN "pushf"
++ ASM_LN "pushf"
++ ASM_LN "pop %0"
++ // ASM_LN "movl %0, %1"
++ // ASM_LN "xorl $0x200000, %0"
++ ASM_LN "btc %1, %0"
++ ASM_LN "push %0"
++ ASM_LN "popf"
++ ASM_LN "pushf"
++ ASM_LN "pop %0"
++ ASM_LN "xorl (%%esp), %0"
++
++ ASM_LN "popf"
++ ASM_LN
++ : "=&r" (a) // "=a"
++ : "i" (EFALGS_CPUID_BIT)
++ );
++ if ((a & (1 << EFALGS_CPUID_BIT)) == 0)
++ return 0;
++ #endif
++ {
++ UInt32 p[4];
++ x86_cpuid_MACRO(p, 0)
++ return p[0];
++ }
++}
+
++#undef ASM_LN
+
++#elif !defined(_MSC_VER)
+
+-void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d)
++/*
++// for gcc/clang and other: we can try to use __cpuid macro:
++#include <cpuid.h>
++void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
+ {
+- #ifdef USE_ASM
+-
+- #ifdef _MSC_VER
++ __cpuid(func, p[0], p[1], p[2], p[3]);
++}
++UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
++{
++ return (UInt32)__get_cpuid_max(0, NULL);
++}
++*/
++// for unsupported cpuid:
++void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
++{
++ UNUSED_VAR(func)
++ p[0] = p[1] = p[2] = p[3] = 0;
++}
++UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
++{
++ return 0;
++}
+
+- UInt32 a2, b2, c2, d2;
+- __asm xor EBX, EBX;
+- __asm xor ECX, ECX;
+- __asm xor EDX, EDX;
+- __asm mov EAX, function;
+- __asm cpuid;
+- __asm mov a2, EAX;
+- __asm mov b2, EBX;
+- __asm mov c2, ECX;
+- __asm mov d2, EDX;
+-
+- *a = a2;
+- *b = b2;
+- *c = c2;
+- *d = d2;
++#else // _MSC_VER
+
+- #else
++#if !defined(MY_CPU_AMD64)
+
+- __asm__ __volatile__ (
+- #if defined(MY_CPU_AMD64) && defined(__PIC__)
+- "mov %%rbx, %%rdi;"
+- "cpuid;"
+- "xchg %%rbx, %%rdi;"
+- : "=a" (*a) ,
+- "=D" (*b) ,
+- #elif defined(MY_CPU_X86) && defined(__PIC__)
+- "mov %%ebx, %%edi;"
+- "cpuid;"
+- "xchgl %%ebx, %%edi;"
+- : "=a" (*a) ,
+- "=D" (*b) ,
+- #else
+- "cpuid"
+- : "=a" (*a) ,
+- "=b" (*b) ,
++UInt32 __declspec(naked) Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
++{
++ #if defined(NEED_CHECK_FOR_CPUID)
++ #define EFALGS_CPUID_BIT 21
++ __asm pushfd
++ __asm pushfd
++ /*
++ __asm pop eax
++ // __asm mov edx, eax
++ __asm btc eax, EFALGS_CPUID_BIT
++ __asm push eax
++ */
++ __asm btc dword ptr [esp], EFALGS_CPUID_BIT
++ __asm popfd
++ __asm pushfd
++ __asm pop eax
++ // __asm xor eax, edx
++ __asm xor eax, [esp]
++ // __asm push edx
++ __asm popfd
++ __asm and eax, (1 shl EFALGS_CPUID_BIT)
++ __asm jz end_func
+ #endif
+- "=c" (*c) ,
+- "=d" (*d)
+- : "0" (function), "c"(0) ) ;
+-
++ __asm push ebx
++ __asm xor eax, eax // func
++ __asm xor ecx, ecx // subFunction (optional) for (func == 0)
++ __asm cpuid
++ __asm pop ebx
++ #if defined(NEED_CHECK_FOR_CPUID)
++ end_func:
+ #endif
+-
+- #else
++ __asm ret 0
++}
++
++void __declspec(naked) Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
++{
++ UNUSED_VAR(p)
++ UNUSED_VAR(func)
++ __asm push ebx
++ __asm push edi
++ __asm mov edi, ecx // p
++ __asm mov eax, edx // func
++ __asm xor ecx, ecx // subfunction (optional) for (func == 0)
++ __asm cpuid
++ __asm mov [edi ], eax
++ __asm mov [edi + 4], ebx
++ __asm mov [edi + 8], ecx
++ __asm mov [edi + 12], edx
++ __asm pop edi
++ __asm pop ebx
++ __asm ret 0
++}
+
+- int CPUInfo[4];
++static
++void __declspec(naked) Z7_FASTCALL z7_x86_cpuid_subFunc(UInt32 p[4], UInt32 func, UInt32 subFunc)
++{
++ UNUSED_VAR(p)
++ UNUSED_VAR(func)
++ UNUSED_VAR(subFunc)
++ __asm push ebx
++ __asm push edi
++ __asm mov edi, ecx // p
++ __asm mov eax, edx // func
++ __asm mov ecx, [esp + 12] // subFunc
++ __asm cpuid
++ __asm mov [edi ], eax
++ __asm mov [edi + 4], ebx
++ __asm mov [edi + 8], ecx
++ __asm mov [edi + 12], edx
++ __asm pop edi
++ __asm pop ebx
++ __asm ret 4
++}
+
+- MY__cpuidex(CPUInfo, (int)function, 0);
++#else // MY_CPU_AMD64
+
+- *a = (UInt32)CPUInfo[0];
+- *b = (UInt32)CPUInfo[1];
+- *c = (UInt32)CPUInfo[2];
+- *d = (UInt32)CPUInfo[3];
++ #if _MSC_VER >= 1600
++ #include <intrin.h>
++ #define MY_cpuidex __cpuidex
+
+- #endif
++static
++void Z7_FASTCALL z7_x86_cpuid_subFunc(UInt32 p[4], UInt32 func, UInt32 subFunc)
++{
++ __cpuidex((int *)p, func, subFunc);
++}
++
++ #else
++/*
++ __cpuid (func == (0 or 7)) requires subfunction number in ECX.
++ MSDN: The __cpuid intrinsic clears the ECX register before calling the cpuid instruction.
++ __cpuid() in new MSVC clears ECX.
++ __cpuid() in old MSVC (14.00) x64 doesn't clear ECX
++ We still can use __cpuid for low (func) values that don't require ECX,
++ but __cpuid() in old MSVC will be incorrect for some func values: (func == 7).
++ So here we use the hack for old MSVC to send (subFunction) in ECX register to cpuid instruction,
++ where ECX value is first parameter for FASTCALL / NO_INLINE func.
++ So the caller of MY_cpuidex_HACK() sets ECX as subFunction, and
++ old MSVC for __cpuid() doesn't change ECX and cpuid instruction gets (subFunction) value.
++
++DON'T remove Z7_NO_INLINE and Z7_FASTCALL for MY_cpuidex_HACK(): !!!
++*/
++static
++Z7_NO_INLINE void Z7_FASTCALL MY_cpuidex_HACK(Int32 subFunction, Int32 func, Int32 *CPUInfo)
++{
++ UNUSED_VAR(subFunction)
++ __cpuid(CPUInfo, func);
++}
++ #define MY_cpuidex(info, func, func2) MY_cpuidex_HACK(func2, func, info)
++ #pragma message("======== MY_cpuidex_HACK WAS USED ========")
++static
++void Z7_FASTCALL z7_x86_cpuid_subFunc(UInt32 p[4], UInt32 func, UInt32 subFunc)
++{
++ MY_cpuidex_HACK(subFunc, func, (Int32 *)p);
+ }
++ #endif // _MSC_VER >= 1600
+
+-BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p)
++#if !defined(MY_CPU_AMD64)
++/* inlining for __cpuid() in MSVC x86 (32-bit) produces big ineffective code,
++ so we disable inlining here */
++Z7_NO_INLINE
++#endif
++void Z7_FASTCALL z7_x86_cpuid(UInt32 p[4], UInt32 func)
++{
++ MY_cpuidex((Int32 *)p, (Int32)func, 0);
++}
++
++Z7_NO_INLINE
++UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void)
++{
++ Int32 a[4];
++ MY_cpuidex(a, 0, 0);
++ return a[0];
++}
++
++#endif // MY_CPU_AMD64
++#endif // _MSC_VER
++
++#if defined(NEED_CHECK_FOR_CPUID)
++#define CHECK_CPUID_IS_SUPPORTED { if (z7_x86_cpuid_GetMaxFunc() == 0) return 0; }
++#else
++#define CHECK_CPUID_IS_SUPPORTED
++#endif
++#undef NEED_CHECK_FOR_CPUID
++
++
++static
++BoolInt x86cpuid_Func_1(UInt32 *p)
+ {
+ CHECK_CPUID_IS_SUPPORTED
+- MyCPUID(0, &p->maxFunc, &p->vendor[0], &p->vendor[2], &p->vendor[1]);
+- MyCPUID(1, &p->ver, &p->b, &p->c, &p->d);
++ z7_x86_cpuid(p, 1);
+ return True;
+ }
+
+-static const UInt32 kVendors[][3] =
++/*
++static const UInt32 kVendors[][1] =
+ {
+- { 0x756E6547, 0x49656E69, 0x6C65746E},
+- { 0x68747541, 0x69746E65, 0x444D4163},
+- { 0x746E6543, 0x48727561, 0x736C7561}
++ { 0x756E6547 }, // , 0x49656E69, 0x6C65746E },
++ { 0x68747541 }, // , 0x69746E65, 0x444D4163 },
++ { 0x746E6543 } // , 0x48727561, 0x736C7561 }
+ };
++*/
++
++/*
++typedef struct
++{
++ UInt32 maxFunc;
++ UInt32 vendor[3];
++ UInt32 ver;
++ UInt32 b;
++ UInt32 c;
++ UInt32 d;
++} Cx86cpuid;
++
++enum
++{
++ CPU_FIRM_INTEL,
++ CPU_FIRM_AMD,
++ CPU_FIRM_VIA
++};
++int x86cpuid_GetFirm(const Cx86cpuid *p);
++#define x86cpuid_ver_GetFamily(ver) (((ver >> 16) & 0xff0) | ((ver >> 8) & 0xf))
++#define x86cpuid_ver_GetModel(ver) (((ver >> 12) & 0xf0) | ((ver >> 4) & 0xf))
++#define x86cpuid_ver_GetStepping(ver) (ver & 0xf)
+
+ int x86cpuid_GetFirm(const Cx86cpuid *p)
+ {
+ unsigned i;
+- for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[i]); i++)
++ for (i = 0; i < sizeof(kVendors) / sizeof(kVendors[0]); i++)
+ {
+ const UInt32 *v = kVendors[i];
+- if (v[0] == p->vendor[0] &&
+- v[1] == p->vendor[1] &&
+- v[2] == p->vendor[2])
++ if (v[0] == p->vendor[0]
++ // && v[1] == p->vendor[1]
++ // && v[2] == p->vendor[2]
++ )
+ return (int)i;
+ }
+ return -1;
+@@ -190,41 +360,55 @@ int x86cpuid_GetFirm(const Cx86cpuid *p)
+ BoolInt CPU_Is_InOrder()
+ {
+ Cx86cpuid p;
+- int firm;
+ UInt32 family, model;
+ if (!x86cpuid_CheckAndRead(&p))
+ return True;
+
+- family = x86cpuid_GetFamily(p.ver);
+- model = x86cpuid_GetModel(p.ver);
+-
+- firm = x86cpuid_GetFirm(&p);
++ family = x86cpuid_ver_GetFamily(p.ver);
++ model = x86cpuid_ver_GetModel(p.ver);
+
+- switch (firm)
++ switch (x86cpuid_GetFirm(&p))
+ {
+ case CPU_FIRM_INTEL: return (family < 6 || (family == 6 && (
+- /* In-Order Atom CPU */
+- model == 0x1C /* 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330 */
+- || model == 0x26 /* 45 nm, Z6xx */
+- || model == 0x27 /* 32 nm, Z2460 */
+- || model == 0x35 /* 32 nm, Z2760 */
+- || model == 0x36 /* 32 nm, N2xxx, D2xxx */
++ // In-Order Atom CPU
++ model == 0x1C // 45 nm, N4xx, D4xx, N5xx, D5xx, 230, 330
++ || model == 0x26 // 45 nm, Z6xx
++ || model == 0x27 // 32 nm, Z2460
++ || model == 0x35 // 32 nm, Z2760
++ || model == 0x36 // 32 nm, N2xxx, D2xxx
+ )));
+ case CPU_FIRM_AMD: return (family < 5 || (family == 5 && (model < 6 || model == 0xA)));
+ case CPU_FIRM_VIA: return (family < 6 || (family == 6 && model < 0xF));
+ }
+- return True;
++ return False; // v23 : unknown processors are not In-Order
+ }
++*/
++
++#ifdef _WIN32
++#include "7zWindows.h"
++#endif
+
+ #if !defined(MY_CPU_AMD64) && defined(_WIN32)
+-#include <Windows.h>
+-static BoolInt CPU_Sys_Is_SSE_Supported()
++
++/* for legacy SSE ia32: there is no user-space cpu instruction to check
++ that OS supports SSE register storing/restoring on context switches.
++ So we need some OS-specific function to check that it's safe to use SSE registers.
++*/
++
++Z7_FORCE_INLINE
++static BoolInt CPU_Sys_Is_SSE_Supported(void)
+ {
+- OSVERSIONINFO vi;
+- vi.dwOSVersionInfoSize = sizeof(vi);
+- if (!GetVersionEx(&vi))
+- return False;
+- return (vi.dwMajorVersion >= 5);
++#ifdef _MSC_VER
++ #pragma warning(push)
++ #pragma warning(disable : 4996) // `GetVersion': was declared deprecated
++#endif
++ /* low byte is major version of Windows
++ We suppose that any Windows version since
++ Windows2000 (major == 5) supports SSE registers */
++ return (Byte)GetVersion() >= 5;
++#if defined(_MSC_VER)
++ #pragma warning(pop)
++#endif
+ }
+ #define CHECK_SYS_SSE_SUPPORT if (!CPU_Sys_Is_SSE_Supported()) return False;
+ #else
+@@ -232,117 +416,364 @@ static BoolInt CPU_Sys_Is_SSE_Supported(
+ #endif
+
+
+-static UInt32 X86_CPUID_ECX_Get_Flags()
++#if !defined(MY_CPU_AMD64)
++
++BoolInt CPU_IsSupported_CMOV(void)
+ {
+- Cx86cpuid p;
++ UInt32 a[4];
++ if (!x86cpuid_Func_1(&a[0]))
++ return 0;
++ return (BoolInt)(a[3] >> 15) & 1;
++}
++
++BoolInt CPU_IsSupported_SSE(void)
++{
++ UInt32 a[4];
+ CHECK_SYS_SSE_SUPPORT
+- if (!x86cpuid_CheckAndRead(&p))
++ if (!x86cpuid_Func_1(&a[0]))
++ return 0;
++ return (BoolInt)(a[3] >> 25) & 1;
++}
++
++BoolInt CPU_IsSupported_SSE2(void)
++{
++ UInt32 a[4];
++ CHECK_SYS_SSE_SUPPORT
++ if (!x86cpuid_Func_1(&a[0]))
+ return 0;
+- return p.c;
++ return (BoolInt)(a[3] >> 26) & 1;
+ }
+
+-BoolInt CPU_IsSupported_AES()
++#endif
++
++
++static UInt32 x86cpuid_Func_1_ECX(void)
+ {
+- return (X86_CPUID_ECX_Get_Flags() >> 25) & 1;
++ UInt32 a[4];
++ CHECK_SYS_SSE_SUPPORT
++ if (!x86cpuid_Func_1(&a[0]))
++ return 0;
++ return a[2];
+ }
+
+-BoolInt CPU_IsSupported_SSSE3()
++BoolInt CPU_IsSupported_AES(void)
+ {
+- return (X86_CPUID_ECX_Get_Flags() >> 9) & 1;
++ return (BoolInt)(x86cpuid_Func_1_ECX() >> 25) & 1;
+ }
+
+-BoolInt CPU_IsSupported_SSE41()
++BoolInt CPU_IsSupported_SSSE3(void)
+ {
+- return (X86_CPUID_ECX_Get_Flags() >> 19) & 1;
++ return (BoolInt)(x86cpuid_Func_1_ECX() >> 9) & 1;
+ }
+
+-BoolInt CPU_IsSupported_SHA()
++BoolInt CPU_IsSupported_SSE41(void)
++{
++ return (BoolInt)(x86cpuid_Func_1_ECX() >> 19) & 1;
++}
++
++BoolInt CPU_IsSupported_SHA(void)
+ {
+- Cx86cpuid p;
+ CHECK_SYS_SSE_SUPPORT
+- if (!x86cpuid_CheckAndRead(&p))
++
++ if (z7_x86_cpuid_GetMaxFunc() < 7)
+ return False;
++ {
++ UInt32 d[4];
++ z7_x86_cpuid(d, 7);
++ return (BoolInt)(d[1] >> 29) & 1;
++ }
++}
++
++
++BoolInt CPU_IsSupported_SHA512(void)
++{
++ if (!CPU_IsSupported_AVX2()) return False; // maybe CPU_IsSupported_AVX() is enough here
+
+- if (p.maxFunc < 7)
++ if (z7_x86_cpuid_GetMaxFunc() < 7)
+ return False;
+ {
+- UInt32 d[4] = { 0 };
+- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
+- return (d[1] >> 29) & 1;
++ UInt32 d[4];
++ z7_x86_cpuid_subFunc(d, 7, 0);
++ if (d[0] < 1) // d[0] - is max supported subleaf value
++ return False;
++ z7_x86_cpuid_subFunc(d, 7, 1);
++ return (BoolInt)(d[0]) & 1;
+ }
+ }
+
+-// #include <stdio.h>
++/*
++MSVC: _xgetbv() intrinsic is available since VS2010SP1.
++ MSVC also defines (_XCR_XFEATURE_ENABLED_MASK) macro in
++ <immintrin.h> that we can use or check.
++ For any 32-bit x86 we can use asm code in MSVC,
++ but MSVC asm code is huge after compilation.
++ So _xgetbv() is better
++
++ICC: _xgetbv() intrinsic is available (in what version of ICC?)
++ ICC defines (__GNUC___) and it supports gnu assembler
++ also ICC supports MASM style code with -use-msasm switch.
++ but ICC doesn't support __attribute__((__target__))
++
++GCC/CLANG 9:
++ _xgetbv() is macro that works via __builtin_ia32_xgetbv()
++ and we need __attribute__((__target__("xsave")).
++ But with __target__("xsave") the function will be not
++ inlined to function that has no __target__("xsave") attribute.
++ If we want _xgetbv() call inlining, then we should use asm version
++ instead of calling _xgetbv().
++ Note:intrinsic is broke before GCC 8.2:
++ https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85684
++*/
+
+-#ifdef _WIN32
+-#include <Windows.h>
++#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) \
++ || defined(_MSC_VER) && (_MSC_VER >= 1600) && (_MSC_FULL_VER >= 160040219) \
++ || defined(__GNUC__) && (__GNUC__ >= 9) \
++ || defined(__clang__) && (__clang_major__ >= 9)
++// we define ATTRIB_XGETBV, if we want to use predefined _xgetbv() from compiler
++#if defined(__INTEL_COMPILER)
++#define ATTRIB_XGETBV
++#elif defined(__GNUC__) || defined(__clang__)
++// we don't define ATTRIB_XGETBV here, because asm version is better for inlining.
++// #define ATTRIB_XGETBV __attribute__((__target__("xsave")))
++#else
++#define ATTRIB_XGETBV
++#endif
+ #endif
+
+-BoolInt CPU_IsSupported_AVX2()
++#if defined(ATTRIB_XGETBV)
++#include <immintrin.h>
++#endif
++
++
++// XFEATURE_ENABLED_MASK/XCR0
++#define MY_XCR_XFEATURE_ENABLED_MASK 0
++
++#if defined(ATTRIB_XGETBV)
++ATTRIB_XGETBV
++#endif
++static UInt64 x86_xgetbv_0(UInt32 num)
+ {
+- Cx86cpuid p;
+- CHECK_SYS_SSE_SUPPORT
++#if defined(ATTRIB_XGETBV)
++ {
++ return
++ #if (defined(_MSC_VER))
++ _xgetbv(num);
++ #else
++ __builtin_ia32_xgetbv(
++ #if !defined(__clang__)
++ (int)
++ #endif
++ num);
++ #endif
++ }
+
++#elif defined(__GNUC__) || defined(__clang__) || defined(__SUNPRO_CC)
++
++ UInt32 a, d;
++ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4))
++ __asm__
++ (
++ "xgetbv"
++ : "=a"(a), "=d"(d) : "c"(num) : "cc"
++ );
++ #else // is old gcc
++ __asm__
++ (
++ ".byte 0x0f, 0x01, 0xd0" "\n\t"
++ : "=a"(a), "=d"(d) : "c"(num) : "cc"
++ );
++ #endif
++ return ((UInt64)d << 32) | a;
++ // return a;
++
++#elif defined(_MSC_VER) && !defined(MY_CPU_AMD64)
++
++ UInt32 a, d;
++ __asm {
++ push eax
++ push edx
++ push ecx
++ mov ecx, num;
++ // xor ecx, ecx // = MY_XCR_XFEATURE_ENABLED_MASK
++ _emit 0x0f
++ _emit 0x01
++ _emit 0xd0
++ mov a, eax
++ mov d, edx
++ pop ecx
++ pop edx
++ pop eax
++ }
++ return ((UInt64)d << 32) | a;
++ // return a;
++
++#else // it's unknown compiler
++ // #error "Need xgetbv function"
++ UNUSED_VAR(num)
++ // for MSVC-X64 we could call external function from external file.
++ /* Actually we had checked OSXSAVE/AVX in cpuid before.
++ So it's expected that OS supports at least AVX and below. */
++ // if (num != MY_XCR_XFEATURE_ENABLED_MASK) return 0; // if not XCR0
++ return
++ // (1 << 0) | // x87
++ (1 << 1) // SSE
++ | (1 << 2); // AVX
++
++#endif
++}
++
++#ifdef _WIN32
++/*
++ Windows versions do not know about new ISA extensions that
++ can be introduced. But we still can use new extensions,
++ even if Windows doesn't report about supporting them,
++ But we can use new extensions, only if Windows knows about new ISA extension
++ that changes the number or size of registers: SSE, AVX/XSAVE, AVX512
++ So it's enough to check
++ MY_PF_AVX_INSTRUCTIONS_AVAILABLE
++ instead of
++ MY_PF_AVX2_INSTRUCTIONS_AVAILABLE
++*/
++#define MY_PF_XSAVE_ENABLED 17
++// #define MY_PF_SSSE3_INSTRUCTIONS_AVAILABLE 36
++// #define MY_PF_SSE4_1_INSTRUCTIONS_AVAILABLE 37
++// #define MY_PF_SSE4_2_INSTRUCTIONS_AVAILABLE 38
++// #define MY_PF_AVX_INSTRUCTIONS_AVAILABLE 39
++// #define MY_PF_AVX2_INSTRUCTIONS_AVAILABLE 40
++// #define MY_PF_AVX512F_INSTRUCTIONS_AVAILABLE 41
++#endif
++
++BoolInt CPU_IsSupported_AVX(void)
++{
+ #ifdef _WIN32
+- #define MY__PF_XSAVE_ENABLED 17
+- if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
++ if (!IsProcessorFeaturePresent(MY_PF_XSAVE_ENABLED))
++ return False;
++ /* PF_AVX_INSTRUCTIONS_AVAILABLE probably is supported starting from
++ some latest Win10 revisions. But we need AVX in older Windows also.
++ So we don't use the following check: */
++ /*
++ if (!IsProcessorFeaturePresent(MY_PF_AVX_INSTRUCTIONS_AVAILABLE))
+ return False;
++ */
+ #endif
+
+- if (!x86cpuid_CheckAndRead(&p))
++ /*
++ OS must use new special XSAVE/XRSTOR instructions to save
++ AVX registers when it required for context switching.
++ At OS statring:
++ OS sets CR4.OSXSAVE flag to signal the processor that OS supports the XSAVE extensions.
++ Also OS sets bitmask in XCR0 register that defines what
++ registers will be processed by XSAVE instruction:
++ XCR0.SSE[bit 0] - x87 registers and state
++ XCR0.SSE[bit 1] - SSE registers and state
++ XCR0.AVX[bit 2] - AVX registers and state
++ CR4.OSXSAVE is reflected to CPUID.1:ECX.OSXSAVE[bit 27].
++ So we can read that bit in user-space.
++ XCR0 is available for reading in user-space by new XGETBV instruction.
++ */
++ {
++ const UInt32 c = x86cpuid_Func_1_ECX();
++ if (0 == (1
++ & (c >> 28) // AVX instructions are supported by hardware
++ & (c >> 27))) // OSXSAVE bit: XSAVE and related instructions are enabled by OS.
++ return False;
++ }
++
++ /* also we can check
++ CPUID.1:ECX.XSAVE [bit 26] : that shows that
++ XSAVE, XRESTOR, XSETBV, XGETBV instructions are supported by hardware.
++ But that check is redundant, because if OSXSAVE bit is set, then XSAVE is also set */
++
++ /* If OS have enabled XSAVE extension instructions (OSXSAVE == 1),
++ in most cases we expect that OS also will support storing/restoring
++ for AVX and SSE states at least.
++ But to be ensure for that we call user-space instruction
++ XGETBV(0) to get XCR0 value that contains bitmask that defines
++ what exact states(registers) OS have enabled for storing/restoring.
++ */
++
++ {
++ const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK);
++ // printf("\n=== XGetBV=0x%x\n", bm);
++ return 1
++ & (BoolInt)(bm >> 1) // SSE state is supported (set by OS) for storing/restoring
++ & (BoolInt)(bm >> 2); // AVX state is supported (set by OS) for storing/restoring
++ }
++ // since Win7SP1: we can use GetEnabledXStateFeatures();
++}
++
++
++BoolInt CPU_IsSupported_AVX2(void)
++{
++ if (!CPU_IsSupported_AVX())
+ return False;
+- if (p.maxFunc < 7)
++ if (z7_x86_cpuid_GetMaxFunc() < 7)
+ return False;
+ {
+- UInt32 d[4] = { 0 };
+- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
++ UInt32 d[4];
++ z7_x86_cpuid(d, 7);
+ // printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
+ return 1
+- & (d[1] >> 5); // avx2
++ & (BoolInt)(d[1] >> 5); // avx2
+ }
+ }
+
+-BoolInt CPU_IsSupported_VAES_AVX2()
++#if 0
++BoolInt CPU_IsSupported_AVX512F_AVX512VL(void)
+ {
+- Cx86cpuid p;
+- CHECK_SYS_SSE_SUPPORT
+-
+- #ifdef _WIN32
+- #define MY__PF_XSAVE_ENABLED 17
+- if (!IsProcessorFeaturePresent(MY__PF_XSAVE_ENABLED))
++ if (!CPU_IsSupported_AVX())
+ return False;
+- #endif
++ if (z7_x86_cpuid_GetMaxFunc() < 7)
++ return False;
++ {
++ UInt32 d[4];
++ BoolInt v;
++ z7_x86_cpuid(d, 7);
++ // printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
++ v = 1
++ & (BoolInt)(d[1] >> 16) // avx512f
++ & (BoolInt)(d[1] >> 31); // avx512vl
++ if (!v)
++ return False;
++ }
++ {
++ const UInt32 bm = (UInt32)x86_xgetbv_0(MY_XCR_XFEATURE_ENABLED_MASK);
++ // printf("\n=== XGetBV=0x%x\n", bm);
++ return 1
++ & (BoolInt)(bm >> 5) // OPMASK
++ & (BoolInt)(bm >> 6) // ZMM upper 256-bit
++ & (BoolInt)(bm >> 7); // ZMM16 ... ZMM31
++ }
++}
++#endif
+
+- if (!x86cpuid_CheckAndRead(&p))
++BoolInt CPU_IsSupported_VAES_AVX2(void)
++{
++ if (!CPU_IsSupported_AVX())
+ return False;
+- if (p.maxFunc < 7)
++ if (z7_x86_cpuid_GetMaxFunc() < 7)
+ return False;
+ {
+- UInt32 d[4] = { 0 };
+- MyCPUID(7, &d[0], &d[1], &d[2], &d[3]);
++ UInt32 d[4];
++ z7_x86_cpuid(d, 7);
+ // printf("\ncpuid(7): ebx=%8x ecx=%8x\n", d[1], d[2]);
+ return 1
+- & (d[1] >> 5) // avx2
++ & (BoolInt)(d[1] >> 5) // avx2
+ // & (d[1] >> 31) // avx512vl
+- & (d[2] >> 9); // vaes // VEX-256/EVEX
++ & (BoolInt)(d[2] >> 9); // vaes // VEX-256/EVEX
+ }
+ }
+
+-BoolInt CPU_IsSupported_PageGB()
++BoolInt CPU_IsSupported_PageGB(void)
+ {
+- Cx86cpuid cpuid;
+- if (!x86cpuid_CheckAndRead(&cpuid))
+- return False;
++ CHECK_CPUID_IS_SUPPORTED
+ {
+- UInt32 d[4] = { 0 };
+- MyCPUID(0x80000000, &d[0], &d[1], &d[2], &d[3]);
++ UInt32 d[4];
++ z7_x86_cpuid(d, 0x80000000);
+ if (d[0] < 0x80000001)
+ return False;
+- }
+- {
+- UInt32 d[4] = { 0 };
+- MyCPUID(0x80000001, &d[0], &d[1], &d[2], &d[3]);
+- return (d[3] >> 26) & 1;
++ z7_x86_cpuid(d, 0x80000001);
++ return (BoolInt)(d[3] >> 26) & 1;
+ }
+ }
+
+@@ -351,11 +782,11 @@ BoolInt CPU_IsSupported_PageGB()
+
+ #ifdef _WIN32
+
+-#include <Windows.h>
++#include "7zWindows.h"
+
+-BoolInt CPU_IsSupported_CRC32() { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+-BoolInt CPU_IsSupported_CRYPTO() { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+-BoolInt CPU_IsSupported_NEON() { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
++BoolInt CPU_IsSupported_CRC32(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
++BoolInt CPU_IsSupported_CRYPTO(void) { return IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
++BoolInt CPU_IsSupported_NEON(void) { return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) ? 1 : 0; }
+
+ #else
+
+@@ -378,29 +809,40 @@ static void Print_sysctlbyname(const cha
+ }
+ }
+ */
++/*
++ Print_sysctlbyname("hw.pagesize");
++ Print_sysctlbyname("machdep.cpu.brand_string");
++*/
+
+-static BoolInt My_sysctlbyname_Get_BoolInt(const char *name)
++static BoolInt z7_sysctlbyname_Get_BoolInt(const char *name)
+ {
+ UInt32 val = 0;
+- if (My_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
++ if (z7_sysctlbyname_Get_UInt32(name, &val) == 0 && val == 1)
+ return 1;
+ return 0;
+ }
+
+- /*
+- Print_sysctlbyname("hw.pagesize");
+- Print_sysctlbyname("machdep.cpu.brand_string");
+- */
+-
+ BoolInt CPU_IsSupported_CRC32(void)
+ {
+- return My_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
++ return z7_sysctlbyname_Get_BoolInt("hw.optional.armv8_crc32");
+ }
+
+ BoolInt CPU_IsSupported_NEON(void)
+ {
+- return My_sysctlbyname_Get_BoolInt("hw.optional.neon");
++ return z7_sysctlbyname_Get_BoolInt("hw.optional.neon");
++}
++
++BoolInt CPU_IsSupported_SHA512(void)
++{
++ return z7_sysctlbyname_Get_BoolInt("hw.optional.armv8_2_sha512");
++}
++
++/*
++BoolInt CPU_IsSupported_SHA3(void)
++{
++ return z7_sysctlbyname_Get_BoolInt("hw.optional.armv8_2_sha3");
+ }
++*/
+
+ #ifdef MY_CPU_ARM64
+ #define APPLE_CRYPTO_SUPPORT_VAL 1
+@@ -412,38 +854,101 @@ BoolInt CPU_IsSupported_SHA1(void) { ret
+ BoolInt CPU_IsSupported_SHA2(void) { return APPLE_CRYPTO_SUPPORT_VAL; }
+ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
+
++#elif defined(__OpenBSD__)
++
++#include <sys/param.h>
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
++#include <machine/armreg.h>
++
++BoolInt CPU_IsSupported_NEON() { return 1; }
++
++#define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
++ BoolInt CPU_IsSupported_ ## name1() { \
++ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 }; \
++ size_t len = sizeof(uint64_t); \
++ uint64_t cpu_id = 0; \
++ if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) < 0) \
++ return 0; \
++ if (ID_AA64ISAR0_ ## name2(cpu_id) >= ID_AA64ISAR0_## name2 ##_BASE) \
++ return 1; \
++ return 0; \
++ }
++
++#define MY_HWCAP_CHECK_FUNC(name) \
++ MY_HWCAP_CHECK_FUNC_2(name, name)
++
++MY_HWCAP_CHECK_FUNC (CRC32)
++MY_HWCAP_CHECK_FUNC (SHA1)
++MY_HWCAP_CHECK_FUNC (SHA2)
++MY_HWCAP_CHECK_FUNC (AES)
+
+ #else // __APPLE__
+
+-#include <sys/auxv.h>
++#if defined(__GLIBC__) && (__GLIBC__ * 100 + __GLIBC_MINOR__ >= 216)
++ #define Z7_GETAUXV_AVAILABLE
++#else
++// #pragma message("=== is not NEW GLIBC === ")
++ #if defined __has_include
++ #if __has_include (<sys/auxv.h>)
++// #pragma message("=== sys/auxv.h is avail=== ")
++ #define Z7_GETAUXV_AVAILABLE
++ #endif
++ #endif
++#endif
+
+-#if !defined(ARMV8_OS_FUCHSIA)
++#ifdef Z7_GETAUXV_AVAILABLE
++// #pragma message("=== Z7_GETAUXV_AVAILABLE === ")
++#include <sys/auxv.h>
+ #define USE_HWCAP
+-#endif // !defined(ARMV8_OS_FUCHSIA)
++#endif
+
+ #ifdef USE_HWCAP
+
++#if defined(__FreeBSD__)
++static unsigned long MY_getauxval(int aux)
++{
++ unsigned long val;
++ if (elf_aux_info(aux, &val, sizeof(val)))
++ return 0;
++ return val;
++}
++#else
++#define MY_getauxval getauxval
++ #if defined __has_include
++ #if __has_include (<asm/hwcap.h>)
+ #include <asm/hwcap.h>
++ #endif
++ #endif
++#endif
+
+ #define MY_HWCAP_CHECK_FUNC_2(name1, name2) \
+- BoolInt CPU_IsSupported_ ## name1() { return (getauxval(AT_HWCAP) & (HWCAP_ ## name2)) ? 1 : 0; }
++ BoolInt CPU_IsSupported_ ## name1(void) { return (MY_getauxval(AT_HWCAP) & (HWCAP_ ## name2)); }
+
+ #ifdef MY_CPU_ARM64
+ #define MY_HWCAP_CHECK_FUNC(name) \
+ MY_HWCAP_CHECK_FUNC_2(name, name)
++#if 1 || defined(__ARM_NEON)
++ BoolInt CPU_IsSupported_NEON(void) { return True; }
++#else
+ MY_HWCAP_CHECK_FUNC_2(NEON, ASIMD)
++#endif
+ // MY_HWCAP_CHECK_FUNC (ASIMD)
+ #elif defined(MY_CPU_ARM)
+ #define MY_HWCAP_CHECK_FUNC(name) \
+- BoolInt CPU_IsSupported_ ## name() { return (getauxval(AT_HWCAP2) & (HWCAP2_ ## name)) ? 1 : 0; }
++ BoolInt CPU_IsSupported_ ## name(void) { return (MY_getauxval(AT_HWCAP2) & (HWCAP2_ ## name)); }
+ MY_HWCAP_CHECK_FUNC_2(NEON, NEON)
+ #endif
+
+ #else // USE_HWCAP
+
+ #define MY_HWCAP_CHECK_FUNC(name) \
+- BoolInt CPU_IsSupported_ ## name() { return 0; }
++ BoolInt CPU_IsSupported_ ## name(void) { return 0; }
++#if defined(__ARM_NEON)
++ BoolInt CPU_IsSupported_NEON(void) { return True; }
++#else
+ MY_HWCAP_CHECK_FUNC(NEON)
++#endif
+
+ #endif // USE_HWCAP
+
+@@ -451,6 +956,19 @@ MY_HWCAP_CHECK_FUNC (CRC32)
+ MY_HWCAP_CHECK_FUNC (SHA1)
+ MY_HWCAP_CHECK_FUNC (SHA2)
+ MY_HWCAP_CHECK_FUNC (AES)
++#ifdef MY_CPU_ARM64
++// <hwcap.h> supports HWCAP_SHA512 and HWCAP_SHA3 since 2017.
++// we define them here, if they are not defined
++#ifndef HWCAP_SHA3
++// #define HWCAP_SHA3 (1 << 17)
++#endif
++#ifndef HWCAP_SHA512
++// #pragma message("=== HWCAP_SHA512 define === ")
++#define HWCAP_SHA512 (1 << 21)
++#endif
++MY_HWCAP_CHECK_FUNC (SHA512)
++// MY_HWCAP_CHECK_FUNC (SHA3)
++#endif
+
+ #endif // __APPLE__
+ #endif // _WIN32
+@@ -463,15 +981,15 @@ MY_HWCAP_CHECK_FUNC (AES)
+
+ #include <sys/sysctl.h>
+
+-int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
++int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize)
+ {
+ return sysctlbyname(name, buf, bufSize, NULL, 0);
+ }
+
+-int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
++int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val)
+ {
+ size_t bufSize = sizeof(*val);
+- int res = My_sysctlbyname_Get(name, val, &bufSize);
++ const int res = z7_sysctlbyname_Get(name, val, &bufSize);
+ if (res == 0 && bufSize != sizeof(*val))
+ return EFAULT;
+ return res;
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.h b/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.h
new file mode 100644
index 0000000000..89648bfd5b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_CpuArch.h
@@ -0,0 +1,572 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/CpuArch.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/CpuArch.h
+@@ -1,8 +1,8 @@
+ /* CpuArch.h -- CPU specific code
+-2022-07-15 : Igor Pavlov : Public domain */
++Igor Pavlov : Public domain */
+
+-#ifndef __CPU_ARCH_H
+-#define __CPU_ARCH_H
++#ifndef ZIP7_INC_CPU_ARCH_H
++#define ZIP7_INC_CPU_ARCH_H
+
+ #include "7zTypes.h"
+
+@@ -20,6 +20,7 @@ MY_CPU_64BIT means that processor can wo
+ MY_CPU_64BIT doesn't mean that (sizeof(void *) == 8)
+ */
+
++#if !defined(_M_ARM64EC)
+ #if defined(_M_X64) \
+ || defined(_M_AMD64) \
+ || defined(__x86_64__) \
+@@ -35,6 +36,7 @@ MY_CPU_64BIT means that processor can wo
+ #endif
+ #define MY_CPU_64BIT
+ #endif
++#endif
+
+
+ #if defined(_M_IX86) \
+@@ -47,11 +49,26 @@ MY_CPU_64BIT means that processor can wo
+
+
+ #if defined(_M_ARM64) \
++ || defined(_M_ARM64EC) \
+ || defined(__AARCH64EL__) \
+ || defined(__AARCH64EB__) \
+ || defined(__aarch64__)
+ #define MY_CPU_ARM64
+- #define MY_CPU_NAME "arm64"
++#if defined(__ILP32__) \
++ || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4)
++ #define MY_CPU_NAME "arm64-32"
++ #define MY_CPU_SIZEOF_POINTER 4
++#elif defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 16)
++ #define MY_CPU_NAME "arm64-128"
++ #define MY_CPU_SIZEOF_POINTER 16
++#else
++#if defined(_M_ARM64EC)
++ #define MY_CPU_NAME "arm64ec"
++#else
++ #define MY_CPU_NAME "arm64"
++#endif
++ #define MY_CPU_SIZEOF_POINTER 8
++#endif
+ #define MY_CPU_64BIT
+ #endif
+
+@@ -68,8 +85,10 @@ MY_CPU_64BIT means that processor can wo
+ #define MY_CPU_ARM
+
+ #if defined(__thumb__) || defined(__THUMBEL__) || defined(_M_ARMT)
++ #define MY_CPU_ARMT
+ #define MY_CPU_NAME "armt"
+ #else
++ #define MY_CPU_ARM32
+ #define MY_CPU_NAME "arm"
+ #endif
+ /* #define MY_CPU_32BIT */
+@@ -103,6 +122,8 @@ MY_CPU_64BIT means that processor can wo
+ || defined(__PPC__) \
+ || defined(_POWER)
+
++#define MY_CPU_PPC_OR_PPC64
++
+ #if defined(__ppc64__) \
+ || defined(__powerpc64__) \
+ || defined(_LP64) \
+@@ -123,8 +144,36 @@ MY_CPU_64BIT means that processor can wo
+ #endif
+
+
++#if defined(__sparc__) \
++ || defined(__sparc)
++ #define MY_CPU_SPARC
++ #if defined(__LP64__) \
++ || defined(_LP64) \
++ || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 8)
++ #define MY_CPU_NAME "sparcv9"
++ #define MY_CPU_SIZEOF_POINTER 8
++ #define MY_CPU_64BIT
++ #elif defined(__sparc_v9__) \
++ || defined(__sparcv9)
++ #define MY_CPU_64BIT
++ #if defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4)
++ #define MY_CPU_NAME "sparcv9-32"
++ #else
++ #define MY_CPU_NAME "sparcv9m"
++ #endif
++ #elif defined(__sparc_v8__) \
++ || defined(__sparcv8)
++ #define MY_CPU_NAME "sparcv8"
++ #define MY_CPU_SIZEOF_POINTER 4
++ #else
++ #define MY_CPU_NAME "sparc"
++ #endif
++#endif
++
++
+ #if defined(__riscv) \
+ || defined(__riscv__)
++ #define MY_CPU_RISCV
+ #if __riscv_xlen == 32
+ #define MY_CPU_NAME "riscv32"
+ #elif __riscv_xlen == 64
+@@ -135,6 +184,39 @@ MY_CPU_64BIT means that processor can wo
+ #endif
+
+
++#if defined(__loongarch__)
++ #define MY_CPU_LOONGARCH
++ #if defined(__loongarch64) || defined(__loongarch_grlen) && (__loongarch_grlen == 64)
++ #define MY_CPU_64BIT
++ #endif
++ #if defined(__loongarch64)
++ #define MY_CPU_NAME "loongarch64"
++ #define MY_CPU_LOONGARCH64
++ #else
++ #define MY_CPU_NAME "loongarch"
++ #endif
++#endif
++
++
++// #undef MY_CPU_NAME
++// #undef MY_CPU_SIZEOF_POINTER
++// #define __e2k__
++// #define __SIZEOF_POINTER__ 4
++#if defined(__e2k__)
++ #define MY_CPU_E2K
++ #if defined(__ILP32__) || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 4)
++ #define MY_CPU_NAME "e2k-32"
++ #define MY_CPU_SIZEOF_POINTER 4
++ #else
++ #define MY_CPU_NAME "e2k"
++ #if defined(__LP64__) || defined(__SIZEOF_POINTER__) && (__SIZEOF_POINTER__ == 8)
++ #define MY_CPU_SIZEOF_POINTER 8
++ #endif
++ #endif
++ #define MY_CPU_64BIT
++#endif
++
++
+ #if defined(MY_CPU_X86) || defined(MY_CPU_AMD64)
+ #define MY_CPU_X86_OR_AMD64
+ #endif
+@@ -165,6 +247,7 @@ MY_CPU_64BIT means that processor can wo
+ || defined(MY_CPU_ARM_LE) \
+ || defined(MY_CPU_ARM64_LE) \
+ || defined(MY_CPU_IA64_LE) \
++ || defined(_LITTLE_ENDIAN) \
+ || defined(__LITTLE_ENDIAN__) \
+ || defined(__ARMEL__) \
+ || defined(__THUMBEL__) \
+@@ -197,6 +280,9 @@ MY_CPU_64BIT means that processor can wo
+ #error Stop_Compiling_Bad_Endian
+ #endif
+
++#if !defined(MY_CPU_LE) && !defined(MY_CPU_BE)
++ #error Stop_Compiling_CPU_ENDIAN_must_be_detected_at_compile_time
++#endif
+
+ #if defined(MY_CPU_32BIT) && defined(MY_CPU_64BIT)
+ #error Stop_Compiling_Bad_32_64_BIT
+@@ -238,6 +324,7 @@ MY_CPU_64BIT means that processor can wo
+
+
+ #ifndef MY_CPU_NAME
++ // #define MY_CPU_IS_UNKNOWN
+ #ifdef MY_CPU_LE
+ #define MY_CPU_NAME "LE"
+ #elif defined(MY_CPU_BE)
+@@ -253,24 +340,127 @@ MY_CPU_64BIT means that processor can wo
+
+
+
++#ifdef __has_builtin
++ #define Z7_has_builtin(x) __has_builtin(x)
++#else
++ #define Z7_has_builtin(x) 0
++#endif
++
++
++#define Z7_BSWAP32_CONST(v) \
++ ( (((UInt32)(v) << 24) ) \
++ | (((UInt32)(v) << 8) & (UInt32)0xff0000) \
++ | (((UInt32)(v) >> 8) & (UInt32)0xff00 ) \
++ | (((UInt32)(v) >> 24) ))
++
++
++#if defined(_MSC_VER) && (_MSC_VER >= 1300)
++
++#include <stdlib.h>
++
++/* Note: these macros will use bswap instruction (486), that is unsupported in 386 cpu */
++
++#pragma intrinsic(_byteswap_ushort)
++#pragma intrinsic(_byteswap_ulong)
++#pragma intrinsic(_byteswap_uint64)
++
++#define Z7_BSWAP16(v) _byteswap_ushort(v)
++#define Z7_BSWAP32(v) _byteswap_ulong (v)
++#define Z7_BSWAP64(v) _byteswap_uint64(v)
++#define Z7_CPU_FAST_BSWAP_SUPPORTED
++
++/* GCC can generate slow code that calls function for __builtin_bswap32() for:
++ - GCC for RISCV, if Zbb/XTHeadBb extension is not used.
++ - GCC for SPARC.
++ The code from CLANG for SPARC also is not fastest.
++ So we don't define Z7_CPU_FAST_BSWAP_SUPPORTED in some cases.
++*/
++#elif (!defined(MY_CPU_RISCV) || defined (__riscv_zbb) || defined(__riscv_xtheadbb)) \
++ && !defined(MY_CPU_SPARC) \
++ && ( \
++ (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
++ || (defined(__clang__) && Z7_has_builtin(__builtin_bswap16)) \
++ )
++
++#define Z7_BSWAP16(v) __builtin_bswap16(v)
++#define Z7_BSWAP32(v) __builtin_bswap32(v)
++#define Z7_BSWAP64(v) __builtin_bswap64(v)
++#define Z7_CPU_FAST_BSWAP_SUPPORTED
++
++#else
++
++#define Z7_BSWAP16(v) ((UInt16) \
++ ( ((UInt32)(v) << 8) \
++ | ((UInt32)(v) >> 8) \
++ ))
++
++#define Z7_BSWAP32(v) Z7_BSWAP32_CONST(v)
++
++#define Z7_BSWAP64(v) \
++ ( ( ( (UInt64)(v) ) << 8 * 7 ) \
++ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 1) ) << 8 * 5 ) \
++ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 2) ) << 8 * 3 ) \
++ | ( ( (UInt64)(v) & ((UInt32)0xff << 8 * 3) ) << 8 * 1 ) \
++ | ( ( (UInt64)(v) >> 8 * 1 ) & ((UInt32)0xff << 8 * 3) ) \
++ | ( ( (UInt64)(v) >> 8 * 3 ) & ((UInt32)0xff << 8 * 2) ) \
++ | ( ( (UInt64)(v) >> 8 * 5 ) & ((UInt32)0xff << 8 * 1) ) \
++ | ( ( (UInt64)(v) >> 8 * 7 ) ) \
++ )
++
++#endif
++
++
+ // Disable MY_CPU_LE_UNALIGN. Although the underlying ISA may be able to load
+ // unaligned words, doing so via pointer casts is undefined behavior in C and
+ // C++, under both strict aliasing and because it is invalid to construct
+ // unaligned pointers. Instead, load the bytes generically and leave optimizing
+ // this to the compiler.
+-#if 0
+ #ifdef MY_CPU_LE
+ #if defined(MY_CPU_X86_OR_AMD64) \
+- || defined(MY_CPU_ARM64)
+- #define MY_CPU_LE_UNALIGN
+- #define MY_CPU_LE_UNALIGN_64
++ || defined(MY_CPU_ARM64) \
++ || defined(MY_CPU_RISCV) && defined(__riscv_misaligned_fast) \
++ || defined(MY_CPU_E2K) && defined(__iset__) && (__iset__ >= 6)
++ // #define MY_CPU_LE_UNALIGN
++ // #define MY_CPU_LE_UNALIGN_64
+ #elif defined(__ARM_FEATURE_UNALIGNED)
+- /* gcc9 for 32-bit arm can use LDRD instruction that requires 32-bit alignment.
+- So we can't use unaligned 64-bit operations. */
+- #define MY_CPU_LE_UNALIGN
++/* === ALIGNMENT on 32-bit arm and LDRD/STRD/LDM/STM instructions.
++ Description of problems:
++problem-1 : 32-bit ARM architecture:
++ multi-access (pair of 32-bit accesses) instructions (LDRD/STRD/LDM/STM)
++ require 32-bit (WORD) alignment (by 32-bit ARM architecture).
++ So there is "Alignment fault exception", if data is not aligned for 32-bit.
++
++problem-2 : 32-bit kernels and arm64 kernels:
++ 32-bit linux kernels provide fixup for these "paired" instruction "Alignment fault exception".
++ So unaligned paired-access instructions work via exception handler in kernel in 32-bit linux.
++
++ But some arm64 kernels do not handle these faults in 32-bit programs.
++ So we have unhandled exception for such instructions.
++ Probably some new arm64 kernels have fixed it, and unaligned
++ paired-access instructions work in new kernels?
++
++problem-3 : compiler for 32-bit arm:
++ Compilers use LDRD/STRD/LDM/STM for UInt64 accesses
++ and for another cases where two 32-bit accesses are fused
++ to one multi-access instruction.
++ So UInt64 variables must be aligned for 32-bit, and each
++ 32-bit access must be aligned for 32-bit, if we want to
++ avoid "Alignment fault" exception (handled or unhandled).
++
++problem-4 : performace:
++ Even if unaligned access is handled by kernel, it will be slow.
++ So if we allow unaligned access, we can get fast unaligned
++ single-access, and slow unaligned paired-access.
++
++ We don't allow unaligned access on 32-bit arm, because compiler
++ genarates paired-access instructions that require 32-bit alignment,
++ and some arm64 kernels have no handler for these instructions.
++ Also unaligned paired-access instructions will be slow, if kernel handles them.
++*/
++ // it must be disabled:
++ // #define MY_CPU_LE_UNALIGN
+ #endif
+ #endif
+-#endif
+
+
+ #ifdef MY_CPU_LE_UNALIGN
+@@ -279,13 +469,11 @@ MY_CPU_64BIT means that processor can wo
+ #define GetUi32(p) (*(const UInt32 *)(const void *)(p))
+ #ifdef MY_CPU_LE_UNALIGN_64
+ #define GetUi64(p) (*(const UInt64 *)(const void *)(p))
++#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
+ #endif
+
+ #define SetUi16(p, v) { *(UInt16 *)(void *)(p) = (v); }
+ #define SetUi32(p, v) { *(UInt32 *)(void *)(p) = (v); }
+-#ifdef MY_CPU_LE_UNALIGN_64
+-#define SetUi64(p, v) { *(UInt64 *)(void *)(p) = (v); }
+-#endif
+
+ #else
+
+@@ -312,50 +500,33 @@ MY_CPU_64BIT means that processor can wo
+ #endif
+
+
+-#ifndef MY_CPU_LE_UNALIGN_64
+-
++#ifndef GetUi64
+ #define GetUi64(p) (GetUi32(p) | ((UInt64)GetUi32(((const Byte *)(p)) + 4) << 32))
++#endif
+
++#ifndef SetUi64
+ #define SetUi64(p, v) { Byte *_ppp2_ = (Byte *)(p); UInt64 _vvv2_ = (v); \
+- SetUi32(_ppp2_ , (UInt32)_vvv2_); \
+- SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)); }
+-
++ SetUi32(_ppp2_ , (UInt32)_vvv2_) \
++ SetUi32(_ppp2_ + 4, (UInt32)(_vvv2_ >> 32)) }
+ #endif
+
+
++#if defined(MY_CPU_LE_UNALIGN) && defined(Z7_CPU_FAST_BSWAP_SUPPORTED)
+
+-
+-#ifdef __has_builtin
+- #define MY__has_builtin(x) __has_builtin(x)
++#if 0
++// Z7_BSWAP16 can be slow for x86-msvc
++#define GetBe16_to32(p) (Z7_BSWAP16 (*(const UInt16 *)(const void *)(p)))
+ #else
+- #define MY__has_builtin(x) 0
++#define GetBe16_to32(p) (Z7_BSWAP32 (*(const UInt16 *)(const void *)(p)) >> 16)
+ #endif
+
+-#if defined(MY_CPU_LE_UNALIGN) && /* defined(_WIN64) && */ defined(_MSC_VER) && (_MSC_VER >= 1300)
+-
+-/* Note: we use bswap instruction, that is unsupported in 386 cpu */
++#define GetBe32(p) Z7_BSWAP32 (*(const UInt32 *)(const void *)(p))
++#define SetBe32(p, v) { (*(UInt32 *)(void *)(p)) = Z7_BSWAP32(v); }
+
+-#include <stdlib.h>
+-
+-#pragma intrinsic(_byteswap_ushort)
+-#pragma intrinsic(_byteswap_ulong)
+-#pragma intrinsic(_byteswap_uint64)
+-
+-/* #define GetBe16(p) _byteswap_ushort(*(const UInt16 *)(const Byte *)(p)) */
+-#define GetBe32(p) _byteswap_ulong (*(const UInt32 *)(const void *)(p))
+-#define GetBe64(p) _byteswap_uint64(*(const UInt64 *)(const void *)(p))
+-
+-#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = _byteswap_ulong(v)
+-
+-#elif defined(MY_CPU_LE_UNALIGN) && ( \
+- (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) \
+- || (defined(__clang__) && MY__has_builtin(__builtin_bswap16)) )
+-
+-/* #define GetBe16(p) __builtin_bswap16(*(const UInt16 *)(const void *)(p)) */
+-#define GetBe32(p) __builtin_bswap32(*(const UInt32 *)(const void *)(p))
+-#define GetBe64(p) __builtin_bswap64(*(const UInt64 *)(const void *)(p))
+-
+-#define SetBe32(p, v) (*(UInt32 *)(void *)(p)) = __builtin_bswap32(v)
++#if defined(MY_CPU_LE_UNALIGN_64)
++#define GetBe64(p) Z7_BSWAP64 (*(const UInt64 *)(const void *)(p))
++#define SetBe64(p, v) { (*(UInt64 *)(void *)(p)) = Z7_BSWAP64(v); }
++#endif
+
+ #else
+
+@@ -365,8 +536,6 @@ MY_CPU_64BIT means that processor can wo
+ ((UInt32)((const Byte *)(p))[2] << 8) | \
+ ((const Byte *)(p))[3] )
+
+-#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
+-
+ #define SetBe32(p, v) { Byte *_ppp_ = (Byte *)(p); UInt32 _vvv_ = (v); \
+ _ppp_[0] = (Byte)(_vvv_ >> 24); \
+ _ppp_[1] = (Byte)(_vvv_ >> 16); \
+@@ -375,53 +544,113 @@ MY_CPU_64BIT means that processor can wo
+
+ #endif
+
++#ifndef GetBe64
++#define GetBe64(p) (((UInt64)GetBe32(p) << 32) | GetBe32(((const Byte *)(p)) + 4))
++#endif
+
+-#ifndef GetBe16
++#ifndef SetBe64
++#define SetBe64(p, v) { Byte *_ppp_ = (Byte *)(p); UInt64 _vvv_ = (v); \
++ _ppp_[0] = (Byte)(_vvv_ >> 56); \
++ _ppp_[1] = (Byte)(_vvv_ >> 48); \
++ _ppp_[2] = (Byte)(_vvv_ >> 40); \
++ _ppp_[3] = (Byte)(_vvv_ >> 32); \
++ _ppp_[4] = (Byte)(_vvv_ >> 24); \
++ _ppp_[5] = (Byte)(_vvv_ >> 16); \
++ _ppp_[6] = (Byte)(_vvv_ >> 8); \
++ _ppp_[7] = (Byte)_vvv_; }
++#endif
+
++#ifndef GetBe16
++#ifdef GetBe16_to32
++#define GetBe16(p) ( (UInt16) GetBe16_to32(p))
++#else
+ #define GetBe16(p) ( (UInt16) ( \
+ ((UInt16)((const Byte *)(p))[0] << 8) | \
+ ((const Byte *)(p))[1] ))
++#endif
++#endif
+
++
++#if defined(MY_CPU_BE)
++#define Z7_CONV_BE_TO_NATIVE_CONST32(v) (v)
++#define Z7_CONV_LE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
++#define Z7_CONV_NATIVE_TO_BE_32(v) (v)
++#elif defined(MY_CPU_LE)
++#define Z7_CONV_BE_TO_NATIVE_CONST32(v) Z7_BSWAP32_CONST(v)
++#define Z7_CONV_LE_TO_NATIVE_CONST32(v) (v)
++#define Z7_CONV_NATIVE_TO_BE_32(v) Z7_BSWAP32(v)
++#else
++#error Stop_Compiling_Unknown_Endian_CONV
+ #endif
+
+
++#if defined(MY_CPU_BE)
+
+-#ifdef MY_CPU_X86_OR_AMD64
++#define GetBe64a(p) (*(const UInt64 *)(const void *)(p))
++#define GetBe32a(p) (*(const UInt32 *)(const void *)(p))
++#define GetBe16a(p) (*(const UInt16 *)(const void *)(p))
++#define SetBe32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
++#define SetBe16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
++
++#define GetUi64a(p) GetUi64(p)
++#define GetUi32a(p) GetUi32(p)
++#define GetUi16a(p) GetUi16(p)
++#define SetUi32a(p, v) SetUi32(p, v)
++#define SetUi16a(p, v) SetUi16(p, v)
++
++#elif defined(MY_CPU_LE)
++
++#define GetUi64a(p) (*(const UInt64 *)(const void *)(p))
++#define GetUi32a(p) (*(const UInt32 *)(const void *)(p))
++#define GetUi16a(p) (*(const UInt16 *)(const void *)(p))
++#define SetUi32a(p, v) { *(UInt32 *)(void *)(p) = (v); }
++#define SetUi16a(p, v) { *(UInt16 *)(void *)(p) = (v); }
++
++#define GetBe64a(p) GetBe64(p)
++#define GetBe32a(p) GetBe32(p)
++#define GetBe16a(p) GetBe16(p)
++#define SetBe32a(p, v) SetBe32(p, v)
++#define SetBe16a(p, v) SetBe16(p, v)
+
+-typedef struct
+-{
+- UInt32 maxFunc;
+- UInt32 vendor[3];
+- UInt32 ver;
+- UInt32 b;
+- UInt32 c;
+- UInt32 d;
+-} Cx86cpuid;
+-
+-enum
+-{
+- CPU_FIRM_INTEL,
+- CPU_FIRM_AMD,
+- CPU_FIRM_VIA
+-};
+-
+-void MyCPUID(UInt32 function, UInt32 *a, UInt32 *b, UInt32 *c, UInt32 *d);
+-
+-BoolInt x86cpuid_CheckAndRead(Cx86cpuid *p);
+-int x86cpuid_GetFirm(const Cx86cpuid *p);
+-
+-#define x86cpuid_GetFamily(ver) (((ver >> 16) & 0xFF0) | ((ver >> 8) & 0xF))
+-#define x86cpuid_GetModel(ver) (((ver >> 12) & 0xF0) | ((ver >> 4) & 0xF))
+-#define x86cpuid_GetStepping(ver) (ver & 0xF)
++#else
++#error Stop_Compiling_Unknown_Endian_CPU_a
++#endif
++
++
++#ifndef GetBe16_to32
++#define GetBe16_to32(p) GetBe16(p)
++#endif
++
++
++#if defined(MY_CPU_X86_OR_AMD64) \
++ || defined(MY_CPU_ARM_OR_ARM64) \
++ || defined(MY_CPU_PPC_OR_PPC64)
++ #define Z7_CPU_FAST_ROTATE_SUPPORTED
++#endif
+
+-BoolInt CPU_Is_InOrder(void);
++
++#ifdef MY_CPU_X86_OR_AMD64
++
++void Z7_FASTCALL z7_x86_cpuid(UInt32 a[4], UInt32 function);
++UInt32 Z7_FASTCALL z7_x86_cpuid_GetMaxFunc(void);
++#if defined(MY_CPU_AMD64)
++#define Z7_IF_X86_CPUID_SUPPORTED
++#else
++#define Z7_IF_X86_CPUID_SUPPORTED if (z7_x86_cpuid_GetMaxFunc())
++#endif
+
+ BoolInt CPU_IsSupported_AES(void);
++BoolInt CPU_IsSupported_AVX(void);
+ BoolInt CPU_IsSupported_AVX2(void);
++BoolInt CPU_IsSupported_AVX512F_AVX512VL(void);
+ BoolInt CPU_IsSupported_VAES_AVX2(void);
++BoolInt CPU_IsSupported_CMOV(void);
++BoolInt CPU_IsSupported_SSE(void);
++BoolInt CPU_IsSupported_SSE2(void);
+ BoolInt CPU_IsSupported_SSSE3(void);
+ BoolInt CPU_IsSupported_SSE41(void);
+ BoolInt CPU_IsSupported_SHA(void);
++BoolInt CPU_IsSupported_SHA512(void);
+ BoolInt CPU_IsSupported_PageGB(void);
+
+ #elif defined(MY_CPU_ARM_OR_ARM64)
+@@ -439,12 +668,13 @@ BoolInt CPU_IsSupported_SHA1(void);
+ BoolInt CPU_IsSupported_SHA2(void);
+ BoolInt CPU_IsSupported_AES(void);
+ #endif
++BoolInt CPU_IsSupported_SHA512(void);
+
+ #endif
+
+ #if defined(__APPLE__)
+-int My_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
+-int My_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
++int z7_sysctlbyname_Get(const char *name, void *buf, size_t *bufSize);
++int z7_sysctlbyname_Get_UInt32(const char *name, UInt32 *val);
+ #endif
+
+ EXTERN_C_END
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Delta.h b/electron34/patches/patch-third__party_lzma__sdk_C_Delta.h
new file mode 100644
index 0000000000..cdd1e55204
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Delta.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Delta.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Delta.h
+@@ -1,8 +1,8 @@
+ /* Delta.h -- Delta converter
+-2013-01-18 : Igor Pavlov : Public domain */
++2023-03-03 : Igor Pavlov : Public domain */
+
+-#ifndef __DELTA_H
+-#define __DELTA_H
++#ifndef ZIP7_INC_DELTA_H
++#define ZIP7_INC_DELTA_H
+
+ #include "7zTypes.h"
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.c b/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.c
new file mode 100644
index 0000000000..63a03f83eb
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.c
@@ -0,0 +1,174 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/DllSecur.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/DllSecur.c
+@@ -1,114 +1,99 @@
+ /* DllSecur.c -- DLL loading security
+-2022-07-15 : Igor Pavlov : Public domain */
++2023-12-03 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #ifdef _WIN32
+
+-#include <Windows.h>
++#include "7zWindows.h"
+
+ #include "DllSecur.h"
+
+ #ifndef UNDER_CE
+
+-#if defined(__GNUC__) && (__GNUC__ >= 8)
+- #pragma GCC diagnostic ignored "-Wcast-function-type"
+-#endif
++Z7_DIAGNOSTIC_IGNORE_CAST_FUNCTION
+
+ typedef BOOL (WINAPI *Func_SetDefaultDllDirectories)(DWORD DirectoryFlags);
+
+ #define MY_LOAD_LIBRARY_SEARCH_USER_DIRS 0x400
+ #define MY_LOAD_LIBRARY_SEARCH_SYSTEM32 0x800
+
++#define DELIM "\0"
++
+ static const char * const g_Dlls =
++ "userenv"
++ DELIM "setupapi"
++ DELIM "apphelp"
++ DELIM "propsys"
++ DELIM "dwmapi"
++ DELIM "cryptbase"
++ DELIM "oleacc"
++ DELIM "clbcatq"
++ DELIM "version"
+ #ifndef _CONSOLE
+- "UXTHEME\0"
++ DELIM "uxtheme"
+ #endif
+- "USERENV\0"
+- "SETUPAPI\0"
+- "APPHELP\0"
+- "PROPSYS\0"
+- "DWMAPI\0"
+- "CRYPTBASE\0"
+- "OLEACC\0"
+- "CLBCATQ\0"
+- "VERSION\0"
+- ;
++ DELIM;
++
++#endif
+
++#ifdef __clang__
++ #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
++#endif
++#if defined (_MSC_VER) && _MSC_VER >= 1900
++// sysinfoapi.h: kit10: GetVersion was declared deprecated
++#pragma warning(disable : 4996)
+ #endif
+
+-// #define MY_CAST_FUNC (void(*)())
+-#define MY_CAST_FUNC
++#define IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN \
++ if ((UInt16)GetVersion() != 6) { \
++ const \
++ Func_SetDefaultDllDirectories setDllDirs = \
++ (Func_SetDefaultDllDirectories) Z7_CAST_FUNC_C GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), \
++ "SetDefaultDllDirectories"); \
++ if (setDllDirs) if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS)) return; }
+
+-void My_SetDefaultDllDirectories()
++void My_SetDefaultDllDirectories(void)
+ {
+ #ifndef UNDER_CE
+-
+- OSVERSIONINFO vi;
+- vi.dwOSVersionInfoSize = sizeof(vi);
+- if (!GetVersionEx(&vi) || vi.dwMajorVersion != 6 || vi.dwMinorVersion != 0)
+- {
+- Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)
+- MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
+- if (setDllDirs)
+- if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS))
+- return;
+- }
+-
++ IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN
+ #endif
+ }
+
+
+-void LoadSecurityDlls()
++void LoadSecurityDlls(void)
+ {
+ #ifndef UNDER_CE
+-
+- wchar_t buf[MAX_PATH + 100];
+-
+- {
+- // at Vista (ver 6.0) : CoCreateInstance(CLSID_ShellLink, ...) doesn't work after SetDefaultDllDirectories() : Check it ???
+- OSVERSIONINFO vi;
+- vi.dwOSVersionInfoSize = sizeof(vi);
+- if (!GetVersionEx(&vi) || vi.dwMajorVersion != 6 || vi.dwMinorVersion != 0)
+- {
+- Func_SetDefaultDllDirectories setDllDirs = (Func_SetDefaultDllDirectories)
+- MY_CAST_FUNC GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")), "SetDefaultDllDirectories");
+- if (setDllDirs)
+- if (setDllDirs(MY_LOAD_LIBRARY_SEARCH_SYSTEM32 | MY_LOAD_LIBRARY_SEARCH_USER_DIRS))
+- return;
+- }
+- }
+-
+- {
+- unsigned len = GetSystemDirectoryW(buf, MAX_PATH + 2);
+- if (len == 0 || len > MAX_PATH)
+- return;
+- }
++ // at Vista (ver 6.0) : CoCreateInstance(CLSID_ShellLink, ...) doesn't work after SetDefaultDllDirectories() : Check it ???
++ IF_NON_VISTA_SET_DLL_DIRS_AND_RETURN
+ {
++ wchar_t buf[MAX_PATH + 100];
+ const char *dll;
+- unsigned pos = (unsigned)lstrlenW(buf);
+-
++ unsigned pos = GetSystemDirectoryW(buf, MAX_PATH + 2);
++ if (pos == 0 || pos > MAX_PATH)
++ return;
+ if (buf[pos - 1] != '\\')
+ buf[pos++] = '\\';
+-
+- for (dll = g_Dlls; dll[0] != 0;)
++ for (dll = g_Dlls; *dll != 0;)
+ {
+- unsigned k = 0;
++ wchar_t *dest = &buf[pos];
+ for (;;)
+ {
+- char c = *dll++;
+- buf[pos + k] = (Byte)c;
+- k++;
++ const char c = *dll++;
+ if (c == 0)
+ break;
++ *dest++ = (Byte)c;
+ }
+-
+- lstrcatW(buf, L".dll");
++ dest[0] = '.';
++ dest[1] = 'd';
++ dest[2] = 'l';
++ dest[3] = 'l';
++ dest[4] = 0;
++ // lstrcatW(buf, L".dll");
+ LoadLibraryExW(buf, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
+ }
+ }
+-
+ #endif
+ }
+
+-#endif
++#endif // _WIN32
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.h b/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.h
new file mode 100644
index 0000000000..12f15bf330
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_DllSecur.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/DllSecur.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/DllSecur.h
+@@ -1,8 +1,8 @@
+ /* DllSecur.h -- DLL loading for security
+-2018-02-19 : Igor Pavlov : Public domain */
++2023-03-03 : Igor Pavlov : Public domain */
+
+-#ifndef __DLL_SECUR_H
+-#define __DLL_SECUR_H
++#ifndef ZIP7_INC_DLL_SECUR_H
++#define ZIP7_INC_DLL_SECUR_H
+
+ #include "7zTypes.h"
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.c b/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.c
new file mode 100644
index 0000000000..9f286ddd06
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.c
@@ -0,0 +1,1259 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzFind.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzFind.c
+@@ -1,5 +1,5 @@
+ /* LzFind.c -- Match finder for LZ algorithms
+-2021-11-29 : Igor Pavlov : Public domain */
++2024-03-01 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -17,7 +17,7 @@
+ #define kEmptyHashValue 0
+
+ #define kMaxValForNormalize ((UInt32)0)
+-// #define kMaxValForNormalize ((UInt32)(1 << 20) + 0xFFF) // for debug
++// #define kMaxValForNormalize ((UInt32)(1 << 20) + 0xfff) // for debug
+
+ // #define kNormalizeAlign (1 << 7) // alignment for speculated accesses
+
+@@ -67,10 +67,10 @@
+
+ static void LzInWindow_Free(CMatchFinder *p, ISzAllocPtr alloc)
+ {
+- if (!p->directInput)
++ // if (!p->directInput)
+ {
+- ISzAlloc_Free(alloc, p->bufferBase);
+- p->bufferBase = NULL;
++ ISzAlloc_Free(alloc, p->bufBase);
++ p->bufBase = NULL;
+ }
+ }
+
+@@ -79,7 +79,7 @@ static int LzInWindow_Create2(CMatchFind
+ {
+ if (blockSize == 0)
+ return 0;
+- if (!p->bufferBase || p->blockSize != blockSize)
++ if (!p->bufBase || p->blockSize != blockSize)
+ {
+ // size_t blockSizeT;
+ LzInWindow_Free(p, alloc);
+@@ -101,19 +101,25 @@ static int LzInWindow_Create2(CMatchFind
+ #endif
+ */
+
+- p->bufferBase = (Byte *)ISzAlloc_Alloc(alloc, blockSize);
+- // printf("\nbufferBase = %p\n", p->bufferBase);
++ p->bufBase = (Byte *)ISzAlloc_Alloc(alloc, blockSize);
++ // printf("\nbufferBase = %p\n", p->bufBase);
+ // return 0; // for debug
+ }
+- return (p->bufferBase != NULL);
++ return (p->bufBase != NULL);
+ }
+
+-static const Byte *MatchFinder_GetPointerToCurrentPos(CMatchFinder *p) { return p->buffer; }
++static const Byte *MatchFinder_GetPointerToCurrentPos(void *p)
++{
++ return ((CMatchFinder *)p)->buffer;
++}
+
+-static UInt32 MatchFinder_GetNumAvailableBytes(CMatchFinder *p) { return GET_AVAIL_BYTES(p); }
++static UInt32 MatchFinder_GetNumAvailableBytes(void *p)
++{
++ return GET_AVAIL_BYTES((CMatchFinder *)p);
++}
+
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static void MatchFinder_ReadBlock(CMatchFinder *p)
+ {
+ if (p->streamEndWasReached || p->result != SZ_OK)
+@@ -127,8 +133,8 @@ static void MatchFinder_ReadBlock(CMatch
+ UInt32 curSize = 0xFFFFFFFF - GET_AVAIL_BYTES(p);
+ if (curSize > p->directInputRem)
+ curSize = (UInt32)p->directInputRem;
+- p->directInputRem -= curSize;
+ p->streamPos += curSize;
++ p->directInputRem -= curSize;
+ if (p->directInputRem == 0)
+ p->streamEndWasReached = 1;
+ return;
+@@ -136,8 +142,8 @@ static void MatchFinder_ReadBlock(CMatch
+
+ for (;;)
+ {
+- Byte *dest = p->buffer + GET_AVAIL_BYTES(p);
+- size_t size = (size_t)(p->bufferBase + p->blockSize - dest);
++ const Byte *dest = p->buffer + GET_AVAIL_BYTES(p);
++ size_t size = (size_t)(p->bufBase + p->blockSize - dest);
+ if (size == 0)
+ {
+ /* we call ReadBlock() after NeedMove() and MoveBlock().
+@@ -153,7 +159,14 @@ static void MatchFinder_ReadBlock(CMatch
+ // #define kRead 3
+ // if (size > kRead) size = kRead; // for debug
+
+- p->result = ISeqInStream_Read(p->stream, dest, &size);
++ /*
++ // we need cast (Byte *)dest.
++ #ifdef __clang__
++ #pragma GCC diagnostic ignored "-Wcast-qual"
++ #endif
++ */
++ p->result = ISeqInStream_Read(p->stream,
++ p->bufBase + (dest - p->bufBase), &size);
+ if (p->result != SZ_OK)
+ return;
+ if (size == 0)
+@@ -173,14 +186,14 @@ static void MatchFinder_ReadBlock(CMatch
+
+
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ void MatchFinder_MoveBlock(CMatchFinder *p)
+ {
+- const size_t offset = (size_t)(p->buffer - p->bufferBase) - p->keepSizeBefore;
++ const size_t offset = (size_t)(p->buffer - p->bufBase) - p->keepSizeBefore;
+ const size_t keepBefore = (offset & (kBlockMoveAlign - 1)) + p->keepSizeBefore;
+- p->buffer = p->bufferBase + keepBefore;
+- memmove(p->bufferBase,
+- p->bufferBase + (offset & ~((size_t)kBlockMoveAlign - 1)),
++ p->buffer = p->bufBase + keepBefore;
++ memmove(p->bufBase,
++ p->bufBase + (offset & ~((size_t)kBlockMoveAlign - 1)),
+ keepBefore + (size_t)GET_AVAIL_BYTES(p));
+ }
+
+@@ -198,7 +211,7 @@ int MatchFinder_NeedMove(CMatchFinder *p
+ return 0;
+ if (p->streamEndWasReached || p->result != SZ_OK)
+ return 0;
+- return ((size_t)(p->bufferBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
++ return ((size_t)(p->bufBase + p->blockSize - p->buffer) <= p->keepSizeAfter);
+ }
+
+ void MatchFinder_ReadIfRequired(CMatchFinder *p)
+@@ -214,6 +227,8 @@ static void MatchFinder_SetDefaultSettin
+ p->cutValue = 32;
+ p->btMode = 1;
+ p->numHashBytes = 4;
++ p->numHashBytes_Min = 2;
++ p->numHashOutBits = 0;
+ p->bigHash = 0;
+ }
+
+@@ -222,8 +237,10 @@ static void MatchFinder_SetDefaultSettin
+ void MatchFinder_Construct(CMatchFinder *p)
+ {
+ unsigned i;
+- p->bufferBase = NULL;
++ p->buffer = NULL;
++ p->bufBase = NULL;
+ p->directInput = 0;
++ p->stream = NULL;
+ p->hash = NULL;
+ p->expectedDataSize = (UInt64)(Int64)-1;
+ MatchFinder_SetDefaultSettings(p);
+@@ -238,6 +255,8 @@ void MatchFinder_Construct(CMatchFinder
+ }
+ }
+
++#undef kCrcPoly
++
+ static void MatchFinder_FreeThisClassMemory(CMatchFinder *p, ISzAllocPtr alloc)
+ {
+ ISzAlloc_Free(alloc, p->hash);
+@@ -252,7 +271,7 @@ void MatchFinder_Free(CMatchFinder *p, I
+
+ static CLzRef* AllocRefs(size_t num, ISzAllocPtr alloc)
+ {
+- size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
++ const size_t sizeInBytes = (size_t)num * sizeof(CLzRef);
+ if (sizeInBytes / sizeof(CLzRef) != num)
+ return NULL;
+ return (CLzRef *)ISzAlloc_Alloc(alloc, sizeInBytes);
+@@ -298,6 +317,62 @@ static UInt32 GetBlockSize(CMatchFinder
+ }
+
+
++// input is historySize
++static UInt32 MatchFinder_GetHashMask2(CMatchFinder *p, UInt32 hs)
++{
++ if (p->numHashBytes == 2)
++ return (1 << 16) - 1;
++ if (hs != 0)
++ hs--;
++ hs |= (hs >> 1);
++ hs |= (hs >> 2);
++ hs |= (hs >> 4);
++ hs |= (hs >> 8);
++ // we propagated 16 bits in (hs). Low 16 bits must be set later
++ if (hs >= (1 << 24))
++ {
++ if (p->numHashBytes == 3)
++ hs = (1 << 24) - 1;
++ /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
++ }
++ // (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
++ hs |= (1 << 16) - 1; /* don't change it! */
++ // bt5: we adjust the size with recommended minimum size
++ if (p->numHashBytes >= 5)
++ hs |= (256 << kLzHash_CrcShift_2) - 1;
++ return hs;
++}
++
++// input is historySize
++static UInt32 MatchFinder_GetHashMask(CMatchFinder *p, UInt32 hs)
++{
++ if (p->numHashBytes == 2)
++ return (1 << 16) - 1;
++ if (hs != 0)
++ hs--;
++ hs |= (hs >> 1);
++ hs |= (hs >> 2);
++ hs |= (hs >> 4);
++ hs |= (hs >> 8);
++ // we propagated 16 bits in (hs). Low 16 bits must be set later
++ hs >>= 1;
++ if (hs >= (1 << 24))
++ {
++ if (p->numHashBytes == 3)
++ hs = (1 << 24) - 1;
++ else
++ hs >>= 1;
++ /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
++ }
++ // (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
++ hs |= (1 << 16) - 1; /* don't change it! */
++ // bt5: we adjust the size with recommended minimum size
++ if (p->numHashBytes >= 5)
++ hs |= (256 << kLzHash_CrcShift_2) - 1;
++ return hs;
++}
++
++
+ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAllocPtr alloc)
+@@ -318,78 +393,91 @@ int MatchFinder_Create(CMatchFinder *p,
+ p->blockSize = 0;
+ if (p->directInput || LzInWindow_Create2(p, GetBlockSize(p, historySize), alloc))
+ {
+- const UInt32 newCyclicBufferSize = historySize + 1; // do not change it
+- UInt32 hs;
+- p->matchMaxLen = matchMaxLen;
++ size_t hashSizeSum;
+ {
+- // UInt32 hs4;
+- p->fixedHashSize = 0;
+- hs = (1 << 16) - 1;
+- if (p->numHashBytes != 2)
++ UInt32 hs;
++ UInt32 hsCur;
++
++ if (p->numHashOutBits != 0)
+ {
+- hs = historySize;
+- if (hs > p->expectedDataSize)
+- hs = (UInt32)p->expectedDataSize;
+- if (hs != 0)
+- hs--;
+- hs |= (hs >> 1);
+- hs |= (hs >> 2);
+- hs |= (hs >> 4);
+- hs |= (hs >> 8);
+- // we propagated 16 bits in (hs). Low 16 bits must be set later
+- hs >>= 1;
+- if (hs >= (1 << 24))
+- {
+- if (p->numHashBytes == 3)
+- hs = (1 << 24) - 1;
+- else
+- hs >>= 1;
+- /* if (bigHash) mode, GetHeads4b() in LzFindMt.c needs (hs >= ((1 << 24) - 1))) */
+- }
+-
+- // hs = ((UInt32)1 << 25) - 1; // for test
+-
++ unsigned numBits = p->numHashOutBits;
++ const unsigned nbMax =
++ (p->numHashBytes == 2 ? 16 :
++ (p->numHashBytes == 3 ? 24 : 32));
++ if (numBits > nbMax)
++ numBits = nbMax;
++ if (numBits >= 32)
++ hs = (UInt32)0 - 1;
++ else
++ hs = ((UInt32)1 << numBits) - 1;
+ // (hash_size >= (1 << 16)) : Required for (numHashBytes > 2)
+ hs |= (1 << 16) - 1; /* don't change it! */
+-
+- // bt5: we adjust the size with recommended minimum size
+ if (p->numHashBytes >= 5)
+ hs |= (256 << kLzHash_CrcShift_2) - 1;
++ {
++ const UInt32 hs2 = MatchFinder_GetHashMask2(p, historySize);
++ if (hs > hs2)
++ hs = hs2;
++ }
++ hsCur = hs;
++ if (p->expectedDataSize < historySize)
++ {
++ const UInt32 hs2 = MatchFinder_GetHashMask2(p, (UInt32)p->expectedDataSize);
++ if (hsCur > hs2)
++ hsCur = hs2;
++ }
++ }
++ else
++ {
++ hs = MatchFinder_GetHashMask(p, historySize);
++ hsCur = hs;
++ if (p->expectedDataSize < historySize)
++ {
++ hsCur = MatchFinder_GetHashMask(p, (UInt32)p->expectedDataSize);
++ if (hsCur > hs) // is it possible?
++ hsCur = hs;
++ }
+ }
+- p->hashMask = hs;
+- hs++;
+
+- /*
+- hs4 = (1 << 20);
+- if (hs4 > hs)
+- hs4 = hs;
+- // hs4 = (1 << 16); // for test
+- p->hash4Mask = hs4 - 1;
+- */
++ p->hashMask = hsCur;
+
+- if (p->numHashBytes > 2) p->fixedHashSize += kHash2Size;
+- if (p->numHashBytes > 3) p->fixedHashSize += kHash3Size;
+- // if (p->numHashBytes > 4) p->fixedHashSize += hs4; // kHash4Size;
+- hs += p->fixedHashSize;
++ hashSizeSum = hs;
++ hashSizeSum++;
++ if (hashSizeSum < hs)
++ return 0;
++ {
++ UInt32 fixedHashSize = 0;
++ if (p->numHashBytes > 2 && p->numHashBytes_Min <= 2) fixedHashSize += kHash2Size;
++ if (p->numHashBytes > 3 && p->numHashBytes_Min <= 3) fixedHashSize += kHash3Size;
++ // if (p->numHashBytes > 4) p->fixedHashSize += hs4; // kHash4Size;
++ hashSizeSum += fixedHashSize;
++ p->fixedHashSize = fixedHashSize;
++ }
+ }
+
++ p->matchMaxLen = matchMaxLen;
++
+ {
+ size_t newSize;
+ size_t numSons;
++ const UInt32 newCyclicBufferSize = historySize + 1; // do not change it
+ p->historySize = historySize;
+- p->hashSizeSum = hs;
+ p->cyclicBufferSize = newCyclicBufferSize; // it must be = (historySize + 1)
+
+ numSons = newCyclicBufferSize;
+ if (p->btMode)
+ numSons <<= 1;
+- newSize = hs + numSons;
++ newSize = hashSizeSum + numSons;
++
++ if (numSons < newCyclicBufferSize || newSize < numSons)
++ return 0;
+
+ // aligned size is not required here, but it can be better for some loops
+ #define NUM_REFS_ALIGN_MASK 0xF
+ newSize = (newSize + NUM_REFS_ALIGN_MASK) & ~(size_t)NUM_REFS_ALIGN_MASK;
+
+- if (p->hash && p->numRefs == newSize)
++ // 22.02: we don't reallocate buffer, if old size is enough
++ if (p->hash && p->numRefs >= newSize)
+ return 1;
+
+ MatchFinder_FreeThisClassMemory(p, alloc);
+@@ -398,7 +486,7 @@ int MatchFinder_Create(CMatchFinder *p,
+
+ if (p->hash)
+ {
+- p->son = p->hash + p->hashSizeSum;
++ p->son = p->hash + hashSizeSum;
+ return 1;
+ }
+ }
+@@ -470,7 +558,8 @@ void MatchFinder_Init_HighHash(CMatchFin
+
+ void MatchFinder_Init_4(CMatchFinder *p)
+ {
+- p->buffer = p->bufferBase;
++ if (!p->directInput)
++ p->buffer = p->bufBase;
+ {
+ /* kEmptyHashValue = 0 (Zero) is used in hash tables as NO-VALUE marker.
+ the code in CMatchFinderMt expects (pos = 1) */
+@@ -488,8 +577,9 @@ void MatchFinder_Init_4(CMatchFinder *p)
+ #define CYC_TO_POS_OFFSET 0
+ // #define CYC_TO_POS_OFFSET 1 // for debug
+
+-void MatchFinder_Init(CMatchFinder *p)
++void MatchFinder_Init(void *_p)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ MatchFinder_Init_HighHash(p);
+ MatchFinder_Init_LowHash(p);
+ MatchFinder_Init_4(p);
+@@ -507,165 +597,173 @@ void MatchFinder_Init(CMatchFinder *p)
+
+ #if 0
+ #ifdef MY_CPU_X86_OR_AMD64
+- #if defined(__clang__) && (__clang_major__ >= 8) \
+- || defined(__GNUC__) && (__GNUC__ >= 8) \
+- || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900)
+- #define USE_SATUR_SUB_128
+- #define USE_AVX2
+- #define ATTRIB_SSE41 __attribute__((__target__("sse4.1")))
+- #define ATTRIB_AVX2 __attribute__((__target__("avx2")))
++ #if defined(__clang__) && (__clang_major__ >= 4) \
++ || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40701)
++ // || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1900)
++
++ #define USE_LZFIND_SATUR_SUB_128
++ #define USE_LZFIND_SATUR_SUB_256
++ #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("sse4.1")))
++ #define LZFIND_ATTRIB_AVX2 __attribute__((__target__("avx2")))
+ #elif defined(_MSC_VER)
+ #if (_MSC_VER >= 1600)
+- #define USE_SATUR_SUB_128
+- #if (_MSC_VER >= 1900)
+- #define USE_AVX2
+- #include <immintrin.h> // avx
+- #endif
++ #define USE_LZFIND_SATUR_SUB_128
++ #endif
++ #if (_MSC_VER >= 1900)
++ #define USE_LZFIND_SATUR_SUB_256
+ #endif
+ #endif
+
+-// #elif defined(MY_CPU_ARM_OR_ARM64)
+-#elif defined(MY_CPU_ARM64)
++#elif defined(MY_CPU_ARM64) \
++ /* || (defined(__ARM_ARCH) && (__ARM_ARCH >= 7)) */
+
+- #if defined(__clang__) && (__clang_major__ >= 8) \
+- || defined(__GNUC__) && (__GNUC__ >= 8)
+- #define USE_SATUR_SUB_128
++ #if defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30800) \
++ || defined(__GNUC__) && (__GNUC__ >= 6)
++ #define USE_LZFIND_SATUR_SUB_128
+ #ifdef MY_CPU_ARM64
+- // #define ATTRIB_SSE41 __attribute__((__target__("")))
++ // #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("")))
+ #else
+- // #define ATTRIB_SSE41 __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
++ #define LZFIND_ATTRIB_SSE41 __attribute__((__target__("fpu=neon")))
+ #endif
+
+ #elif defined(_MSC_VER)
+ #if (_MSC_VER >= 1910)
+- #define USE_SATUR_SUB_128
++ #define USE_LZFIND_SATUR_SUB_128
+ #endif
+ #endif
+
+- #if defined(_MSC_VER) && defined(MY_CPU_ARM64)
++ #if defined(Z7_MSC_VER_ORIGINAL) && defined(MY_CPU_ARM64)
+ #include <arm64_neon.h>
+ #else
+ #include <arm_neon.h>
+ #endif
+
+ #endif
+-#endif
+-
+-/*
+-#ifndef ATTRIB_SSE41
+- #define ATTRIB_SSE41
+-#endif
+-#ifndef ATTRIB_AVX2
+- #define ATTRIB_AVX2
+-#endif
+-*/
++#endif // #if 0
+
+-#ifdef USE_SATUR_SUB_128
++#ifdef USE_LZFIND_SATUR_SUB_128
+
+-// #define _SHOW_HW_STATUS
++// #define Z7_SHOW_HW_STATUS
+
+-#ifdef _SHOW_HW_STATUS
++#ifdef Z7_SHOW_HW_STATUS
+ #include <stdio.h>
+-#define _PRF(x) x
+-_PRF(;)
++#define PRF(x) x
++PRF(;)
+ #else
+-#define _PRF(x)
++#define PRF(x)
+ #endif
+
++
+ #ifdef MY_CPU_ARM_OR_ARM64
+
+ #ifdef MY_CPU_ARM64
+-// #define FORCE_SATUR_SUB_128
++// #define FORCE_LZFIND_SATUR_SUB_128
+ #endif
++typedef uint32x4_t LzFind_v128;
++#define SASUB_128_V(v, s) \
++ vsubq_u32(vmaxq_u32(v, s), s)
+
+-typedef uint32x4_t v128;
+-#define SASUB_128(i) \
+- *(v128 *)(void *)(items + (i) * 4) = \
+- vsubq_u32(vmaxq_u32(*(const v128 *)(const void *)(items + (i) * 4), sub2), sub2);
+-
+-#else
++#else // MY_CPU_ARM_OR_ARM64
+
+ #include <smmintrin.h> // sse4.1
+
+-typedef __m128i v128;
+-#define SASUB_128(i) \
+- *(v128 *)(void *)(items + (i) * 4) = \
+- _mm_sub_epi32(_mm_max_epu32(*(const v128 *)(const void *)(items + (i) * 4), sub2), sub2); // SSE 4.1
++typedef __m128i LzFind_v128;
++// SSE 4.1
++#define SASUB_128_V(v, s) \
++ _mm_sub_epi32(_mm_max_epu32(v, s), s)
++
++#endif // MY_CPU_ARM_OR_ARM64
+
+-#endif
+
++#define SASUB_128(i) \
++ *( LzFind_v128 *)( void *)(items + (i) * 4) = SASUB_128_V( \
++ *(const LzFind_v128 *)(const void *)(items + (i) * 4), sub2);
+
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static
+-#ifdef ATTRIB_SSE41
+-ATTRIB_SSE41
++#ifdef LZFIND_ATTRIB_SSE41
++LZFIND_ATTRIB_SSE41
+ #endif
+ void
+-MY_FAST_CALL
++Z7_FASTCALL
+ LzFind_SaturSub_128(UInt32 subValue, CLzRef *items, const CLzRef *lim)
+ {
+- v128 sub2 =
++ const LzFind_v128 sub2 =
+ #ifdef MY_CPU_ARM_OR_ARM64
+ vdupq_n_u32(subValue);
+ #else
+ _mm_set_epi32((Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue);
+ #endif
++ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ do
+ {
+- SASUB_128(0)
+- SASUB_128(1)
+- SASUB_128(2)
+- SASUB_128(3)
+- items += 4 * 4;
++ SASUB_128(0) SASUB_128(1) items += 2 * 4;
++ SASUB_128(0) SASUB_128(1) items += 2 * 4;
+ }
+ while (items != lim);
+ }
+
+
+
+-#ifdef USE_AVX2
++#ifdef USE_LZFIND_SATUR_SUB_256
+
+ #include <immintrin.h> // avx
++/*
++clang :immintrin.h uses
++#if !(defined(_MSC_VER) || defined(__SCE__)) || __has_feature(modules) || \
++ defined(__AVX2__)
++#include <avx2intrin.h>
++#endif
++so we need <avxintrin.h> for clang-cl */
+
+-#define SASUB_256(i) *(__m256i *)(void *)(items + (i) * 8) = _mm256_sub_epi32(_mm256_max_epu32(*(const __m256i *)(const void *)(items + (i) * 8), sub2), sub2); // AVX2
++#if defined(__clang__)
++#include <avxintrin.h>
++#include <avx2intrin.h>
++#endif
++
++// AVX2:
++#define SASUB_256(i) \
++ *( __m256i *)( void *)(items + (i) * 8) = \
++ _mm256_sub_epi32(_mm256_max_epu32( \
++ *(const __m256i *)(const void *)(items + (i) * 8), sub2), sub2);
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static
+-#ifdef ATTRIB_AVX2
+-ATTRIB_AVX2
++#ifdef LZFIND_ATTRIB_AVX2
++LZFIND_ATTRIB_AVX2
+ #endif
+ void
+-MY_FAST_CALL
++Z7_FASTCALL
+ LzFind_SaturSub_256(UInt32 subValue, CLzRef *items, const CLzRef *lim)
+ {
+- __m256i sub2 = _mm256_set_epi32(
++ const __m256i sub2 = _mm256_set_epi32(
+ (Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue,
+ (Int32)subValue, (Int32)subValue, (Int32)subValue, (Int32)subValue);
++ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ do
+ {
+- SASUB_256(0)
+- SASUB_256(1)
+- items += 2 * 8;
++ SASUB_256(0) SASUB_256(1) items += 2 * 8;
++ SASUB_256(0) SASUB_256(1) items += 2 * 8;
+ }
+ while (items != lim);
+ }
+-#endif // USE_AVX2
++#endif // USE_LZFIND_SATUR_SUB_256
+
+-#ifndef FORCE_SATUR_SUB_128
+-typedef void (MY_FAST_CALL *LZFIND_SATUR_SUB_CODE_FUNC)(
++#ifndef FORCE_LZFIND_SATUR_SUB_128
++typedef void (Z7_FASTCALL *LZFIND_SATUR_SUB_CODE_FUNC)(
+ UInt32 subValue, CLzRef *items, const CLzRef *lim);
+ static LZFIND_SATUR_SUB_CODE_FUNC g_LzFind_SaturSub;
+-#endif // FORCE_SATUR_SUB_128
++#endif // FORCE_LZFIND_SATUR_SUB_128
+
+-#endif // USE_SATUR_SUB_128
++#endif // USE_LZFIND_SATUR_SUB_128
+
+
+ // kEmptyHashValue must be zero
+-// #define SASUB_32(i) v = items[i]; m = v - subValue; if (v < subValue) m = kEmptyHashValue; items[i] = m;
+-#define SASUB_32(i) v = items[i]; if (v < subValue) v = subValue; items[i] = v - subValue;
++// #define SASUB_32(i) { UInt32 v = items[i]; UInt32 m = v - subValue; if (v < subValue) m = kEmptyHashValue; items[i] = m; }
++#define SASUB_32(i) { UInt32 v = items[i]; if (v < subValue) v = subValue; items[i] = v - subValue; }
+
+-#ifdef FORCE_SATUR_SUB_128
++#ifdef FORCE_LZFIND_SATUR_SUB_128
+
+ #define DEFAULT_SaturSub LzFind_SaturSub_128
+
+@@ -673,24 +771,19 @@ static LZFIND_SATUR_SUB_CODE_FUNC g_LzFi
+
+ #define DEFAULT_SaturSub LzFind_SaturSub_32
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static
+ void
+-MY_FAST_CALL
++Z7_FASTCALL
+ LzFind_SaturSub_32(UInt32 subValue, CLzRef *items, const CLzRef *lim)
+ {
++ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ do
+ {
+- UInt32 v;
+- SASUB_32(0)
+- SASUB_32(1)
+- SASUB_32(2)
+- SASUB_32(3)
+- SASUB_32(4)
+- SASUB_32(5)
+- SASUB_32(6)
+- SASUB_32(7)
+- items += 8;
++ SASUB_32(0) SASUB_32(1) items += 2;
++ SASUB_32(0) SASUB_32(1) items += 2;
++ SASUB_32(0) SASUB_32(1) items += 2;
++ SASUB_32(0) SASUB_32(1) items += 2;
+ }
+ while (items != lim);
+ }
+@@ -698,27 +791,23 @@ LzFind_SaturSub_32(UInt32 subValue, CLzR
+ #endif
+
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems)
+ {
+- #define K_NORM_ALIGN_BLOCK_SIZE (1 << 6)
+-
+- CLzRef *lim;
+-
+- for (; numItems != 0 && ((unsigned)(ptrdiff_t)items & (K_NORM_ALIGN_BLOCK_SIZE - 1)) != 0; numItems--)
++ #define LZFIND_NORM_ALIGN_BLOCK_SIZE (1 << 7)
++ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
++ for (; numItems != 0 && ((unsigned)(ptrdiff_t)items & (LZFIND_NORM_ALIGN_BLOCK_SIZE - 1)) != 0; numItems--)
+ {
+- UInt32 v;
+- SASUB_32(0);
++ SASUB_32(0)
+ items++;
+ }
+-
+ {
+- #define K_NORM_ALIGN_MASK (K_NORM_ALIGN_BLOCK_SIZE / 4 - 1)
+- lim = items + (numItems & ~(size_t)K_NORM_ALIGN_MASK);
+- numItems &= K_NORM_ALIGN_MASK;
++ const size_t k_Align_Mask = (LZFIND_NORM_ALIGN_BLOCK_SIZE / 4 - 1);
++ CLzRef *lim = items + (numItems & ~(size_t)k_Align_Mask);
++ numItems &= k_Align_Mask;
+ if (items != lim)
+ {
+- #if defined(USE_SATUR_SUB_128) && !defined(FORCE_SATUR_SUB_128)
++ #if defined(USE_LZFIND_SATUR_SUB_128) && !defined(FORCE_LZFIND_SATUR_SUB_128)
+ if (g_LzFind_SaturSub)
+ g_LzFind_SaturSub(subValue, items, lim);
+ else
+@@ -727,12 +816,10 @@ void MatchFinder_Normalize3(UInt32 subVa
+ }
+ items = lim;
+ }
+-
+-
++ Z7_PRAGMA_OPT_DISABLE_LOOP_UNROLL_VECTORIZE
+ for (; numItems != 0; numItems--)
+ {
+- UInt32 v;
+- SASUB_32(0);
++ SASUB_32(0)
+ items++;
+ }
+ }
+@@ -741,7 +828,7 @@ void MatchFinder_Normalize3(UInt32 subVa
+
+ // call MatchFinder_CheckLimits() only after (p->pos++) update
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static void MatchFinder_CheckLimits(CMatchFinder *p)
+ {
+ if (// !p->streamEndWasReached && p->result == SZ_OK &&
+@@ -769,11 +856,14 @@ static void MatchFinder_CheckLimits(CMat
+ const UInt32 subValue = (p->pos - p->historySize - 1) /* & ~(UInt32)(kNormalizeAlign - 1) */;
+ // const UInt32 subValue = (1 << 15); // for debug
+ // printf("\nMatchFinder_Normalize() subValue == 0x%x\n", subValue);
+- size_t numSonRefs = p->cyclicBufferSize;
+- if (p->btMode)
+- numSonRefs <<= 1;
+- Inline_MatchFinder_ReduceOffsets(p, subValue);
+- MatchFinder_Normalize3(subValue, p->hash, (size_t)p->hashSizeSum + numSonRefs);
++ MatchFinder_REDUCE_OFFSETS(p, subValue)
++ MatchFinder_Normalize3(subValue, p->hash, (size_t)p->hashMask + 1 + p->fixedHashSize);
++ {
++ size_t numSonRefs = p->cyclicBufferSize;
++ if (p->btMode)
++ numSonRefs <<= 1;
++ MatchFinder_Normalize3(subValue, p->son, numSonRefs);
++ }
+ }
+
+ if (p->cyclicBufferPos == p->cyclicBufferSize)
+@@ -786,7 +876,7 @@ static void MatchFinder_CheckLimits(CMat
+ /*
+ (lenLimit > maxLen)
+ */
+-MY_FORCE_INLINE
++Z7_FORCE_INLINE
+ static UInt32 * Hc_GetMatchesSpec(size_t lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *d, unsigned maxLen)
+@@ -868,7 +958,7 @@ static UInt32 * Hc_GetMatchesSpec(size_t
+ }
+
+
+-MY_FORCE_INLINE
++Z7_FORCE_INLINE
+ UInt32 * GetMatchesSpec1(UInt32 lenLimit, UInt32 curMatch, UInt32 pos, const Byte *cur, CLzRef *son,
+ size_t _cyclicBufferPos, UInt32 _cyclicBufferSize, UInt32 cutValue,
+ UInt32 *d, UInt32 maxLen)
+@@ -999,13 +1089,15 @@ static void SkipMatchesSpec(UInt32 lenLi
+
+
+ #define MOVE_POS \
+- ++p->cyclicBufferPos; \
++ p->cyclicBufferPos++; \
+ p->buffer++; \
+- { const UInt32 pos1 = p->pos + 1; p->pos = pos1; if (pos1 == p->posLimit) MatchFinder_CheckLimits(p); }
++ { const UInt32 pos1 = p->pos + 1; \
++ p->pos = pos1; \
++ if (pos1 == p->posLimit) MatchFinder_CheckLimits(p); }
+
+ #define MOVE_POS_RET MOVE_POS return distances;
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static void MatchFinder_MovePos(CMatchFinder *p)
+ {
+ /* we go here at the end of stream data, when (avail < num_hash_bytes)
+@@ -1016,24 +1108,30 @@ static void MatchFinder_MovePos(CMatchFi
+ if (p->btMode)
+ p->sons[(p->cyclicBufferPos << p->btMode) + 1] = 0; // kEmptyHashValue
+ */
+- MOVE_POS;
++ MOVE_POS
+ }
+
+ #define GET_MATCHES_HEADER2(minLen, ret_op) \
+- unsigned lenLimit; UInt32 hv; Byte *cur; UInt32 curMatch; \
+- lenLimit = (unsigned)p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \
++ UInt32 hv; const Byte *cur; UInt32 curMatch; \
++ UInt32 lenLimit = p->lenLimit; \
++ if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; } \
+ cur = p->buffer;
+
+ #define GET_MATCHES_HEADER(minLen) GET_MATCHES_HEADER2(minLen, return distances)
+-#define SKIP_HEADER(minLen) do { GET_MATCHES_HEADER2(minLen, continue)
++#define SKIP_HEADER(minLen) \
++ do { GET_MATCHES_HEADER2(minLen, continue)
+
+-#define MF_PARAMS(p) lenLimit, curMatch, p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
++#define MF_PARAMS(p) lenLimit, curMatch, p->pos, p->buffer, p->son, \
++ p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue
+
+-#define SKIP_FOOTER SkipMatchesSpec(MF_PARAMS(p)); MOVE_POS; } while (--num);
++#define SKIP_FOOTER \
++ SkipMatchesSpec(MF_PARAMS(p)); \
++ MOVE_POS \
++ } while (--num);
+
+ #define GET_MATCHES_FOOTER_BASE(_maxLen_, func) \
+- distances = func(MF_PARAMS(p), \
+- distances, (UInt32)_maxLen_); MOVE_POS_RET;
++ distances = func(MF_PARAMS(p), distances, (UInt32)_maxLen_); \
++ MOVE_POS_RET
+
+ #define GET_MATCHES_FOOTER_BT(_maxLen_) \
+ GET_MATCHES_FOOTER_BASE(_maxLen_, GetMatchesSpec1)
+@@ -1050,10 +1148,11 @@ static void MatchFinder_MovePos(CMatchFi
+ for (; c != lim; c++) if (*(c + diff) != *c) break; \
+ maxLen = (unsigned)(c - cur); }
+
+-static UInt32* Bt2_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32* Bt2_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ GET_MATCHES_HEADER(2)
+- HASH2_CALC;
++ HASH2_CALC
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ GET_MATCHES_FOOTER_BT(1)
+@@ -1062,7 +1161,7 @@ static UInt32* Bt2_MatchFinder_GetMatche
+ UInt32* Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+ {
+ GET_MATCHES_HEADER(3)
+- HASH_ZIP_CALC;
++ HASH_ZIP_CALC
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ GET_MATCHES_FOOTER_BT(2)
+@@ -1075,15 +1174,16 @@ UInt32* Bt3Zip_MatchFinder_GetMatches(CM
+ mmm = pos;
+
+
+-static UInt32* Bt3_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32* Bt3_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ UInt32 mmm;
+ UInt32 h2, d2, pos;
+ unsigned maxLen;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(3)
+
+- HASH3_CALC;
++ HASH3_CALC
+
+ hash = p->hash;
+ pos = p->pos;
+@@ -1108,7 +1208,7 @@ static UInt32* Bt3_MatchFinder_GetMatche
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(MF_PARAMS(p));
+- MOVE_POS_RET;
++ MOVE_POS_RET
+ }
+ }
+
+@@ -1116,15 +1216,16 @@ static UInt32* Bt3_MatchFinder_GetMatche
+ }
+
+
+-static UInt32* Bt4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32* Bt4_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ UInt32 mmm;
+ UInt32 h2, h3, d2, d3, pos;
+ unsigned maxLen;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(4)
+
+- HASH4_CALC;
++ HASH4_CALC
+
+ hash = p->hash;
+ pos = p->pos;
+@@ -1184,14 +1285,16 @@ static UInt32* Bt4_MatchFinder_GetMatche
+ }
+
+
+-static UInt32* Bt5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32* Bt5_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ UInt32 mmm;
+- UInt32 h2, h3, d2, d3, maxLen, pos;
++ UInt32 h2, h3, d2, d3, pos;
++ unsigned maxLen;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(5)
+
+- HASH5_CALC;
++ HASH5_CALC
+
+ hash = p->hash;
+ pos = p->pos;
+@@ -1247,7 +1350,7 @@ static UInt32* Bt5_MatchFinder_GetMatche
+ if (maxLen == lenLimit)
+ {
+ SkipMatchesSpec(MF_PARAMS(p));
+- MOVE_POS_RET;
++ MOVE_POS_RET
+ }
+ break;
+ }
+@@ -1256,15 +1359,16 @@ static UInt32* Bt5_MatchFinder_GetMatche
+ }
+
+
+-static UInt32* Hc4_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32* Hc4_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ UInt32 mmm;
+ UInt32 h2, h3, d2, d3, pos;
+ unsigned maxLen;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(4)
+
+- HASH4_CALC;
++ HASH4_CALC
+
+ hash = p->hash;
+ pos = p->pos;
+@@ -1315,23 +1419,25 @@ static UInt32* Hc4_MatchFinder_GetMatche
+ if (maxLen == lenLimit)
+ {
+ p->son[p->cyclicBufferPos] = curMatch;
+- MOVE_POS_RET;
++ MOVE_POS_RET
+ }
+ break;
+ }
+
+- GET_MATCHES_FOOTER_HC(maxLen);
++ GET_MATCHES_FOOTER_HC(maxLen)
+ }
+
+
+-static UInt32 * Hc5_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
++static UInt32 * Hc5_MatchFinder_GetMatches(void *_p, UInt32 *distances)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ UInt32 mmm;
+- UInt32 h2, h3, d2, d3, maxLen, pos;
++ UInt32 h2, h3, d2, d3, pos;
++ unsigned maxLen;
+ UInt32 *hash;
+ GET_MATCHES_HEADER(5)
+
+- HASH5_CALC;
++ HASH5_CALC
+
+ hash = p->hash;
+ pos = p->pos;
+@@ -1383,34 +1489,35 @@ static UInt32 * Hc5_MatchFinder_GetMatch
+ if (*(cur - d2 + 3) != cur[3])
+ break;
+ UPDATE_maxLen
+- distances[-2] = maxLen;
++ distances[-2] = (UInt32)maxLen;
+ if (maxLen == lenLimit)
+ {
+ p->son[p->cyclicBufferPos] = curMatch;
+- MOVE_POS_RET;
++ MOVE_POS_RET
+ }
+ break;
+ }
+
+- GET_MATCHES_FOOTER_HC(maxLen);
++ GET_MATCHES_FOOTER_HC(maxLen)
+ }
+
+
+ UInt32* Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances)
+ {
+ GET_MATCHES_HEADER(3)
+- HASH_ZIP_CALC;
++ HASH_ZIP_CALC
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ GET_MATCHES_FOOTER_HC(2)
+ }
+
+
+-static void Bt2_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Bt2_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ SKIP_HEADER(2)
+ {
+- HASH2_CALC;
++ HASH2_CALC
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ }
+@@ -1421,20 +1528,21 @@ void Bt3Zip_MatchFinder_Skip(CMatchFinde
+ {
+ SKIP_HEADER(3)
+ {
+- HASH_ZIP_CALC;
++ HASH_ZIP_CALC
+ curMatch = p->hash[hv];
+ p->hash[hv] = p->pos;
+ }
+ SKIP_FOOTER
+ }
+
+-static void Bt3_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Bt3_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ SKIP_HEADER(3)
+ {
+ UInt32 h2;
+ UInt32 *hash;
+- HASH3_CALC;
++ HASH3_CALC
+ hash = p->hash;
+ curMatch = (hash + kFix3HashSize)[hv];
+ hash[h2] =
+@@ -1443,13 +1551,14 @@ static void Bt3_MatchFinder_Skip(CMatchF
+ SKIP_FOOTER
+ }
+
+-static void Bt4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Bt4_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ SKIP_HEADER(4)
+ {
+ UInt32 h2, h3;
+ UInt32 *hash;
+- HASH4_CALC;
++ HASH4_CALC
+ hash = p->hash;
+ curMatch = (hash + kFix4HashSize)[hv];
+ hash [h2] =
+@@ -1459,13 +1568,14 @@ static void Bt4_MatchFinder_Skip(CMatchF
+ SKIP_FOOTER
+ }
+
+-static void Bt5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Bt5_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ SKIP_HEADER(5)
+ {
+ UInt32 h2, h3;
+ UInt32 *hash;
+- HASH5_CALC;
++ HASH5_CALC
+ hash = p->hash;
+ curMatch = (hash + kFix5HashSize)[hv];
+ hash [h2] =
+@@ -1479,7 +1589,7 @@ static void Bt5_MatchFinder_Skip(CMatchF
+
+ #define HC_SKIP_HEADER(minLen) \
+ do { if (p->lenLimit < minLen) { MatchFinder_MovePos(p); num--; continue; } { \
+- Byte *cur; \
++ const Byte *cur; \
+ UInt32 *hash; \
+ UInt32 *son; \
+ UInt32 pos = p->pos; \
+@@ -1506,12 +1616,13 @@ static void Bt5_MatchFinder_Skip(CMatchF
+ }} while(num); \
+
+
+-static void Hc4_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Hc4_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ HC_SKIP_HEADER(4)
+
+ UInt32 h2, h3;
+- HASH4_CALC;
++ HASH4_CALC
+ curMatch = (hash + kFix4HashSize)[hv];
+ hash [h2] =
+ (hash + kFix3HashSize)[h3] =
+@@ -1521,8 +1632,9 @@ static void Hc4_MatchFinder_Skip(CMatchF
+ }
+
+
+-static void Hc5_MatchFinder_Skip(CMatchFinder *p, UInt32 num)
++static void Hc5_MatchFinder_Skip(void *_p, UInt32 num)
+ {
++ CMatchFinder *p = (CMatchFinder *)_p;
+ HC_SKIP_HEADER(5)
+
+ UInt32 h2, h3;
+@@ -1541,7 +1653,7 @@ void Hc3Zip_MatchFinder_Skip(CMatchFinde
+ {
+ HC_SKIP_HEADER(3)
+
+- HASH_ZIP_CALC;
++ HASH_ZIP_CALC
+ curMatch = hash[hv];
+ hash[hv] = pos;
+
+@@ -1551,57 +1663,57 @@ void Hc3Zip_MatchFinder_Skip(CMatchFinde
+
+ void MatchFinder_CreateVTable(CMatchFinder *p, IMatchFinder2 *vTable)
+ {
+- vTable->Init = (Mf_Init_Func)MatchFinder_Init;
+- vTable->GetNumAvailableBytes = (Mf_GetNumAvailableBytes_Func)MatchFinder_GetNumAvailableBytes;
+- vTable->GetPointerToCurrentPos = (Mf_GetPointerToCurrentPos_Func)MatchFinder_GetPointerToCurrentPos;
++ vTable->Init = MatchFinder_Init;
++ vTable->GetNumAvailableBytes = MatchFinder_GetNumAvailableBytes;
++ vTable->GetPointerToCurrentPos = MatchFinder_GetPointerToCurrentPos;
+ if (!p->btMode)
+ {
+ if (p->numHashBytes <= 4)
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Hc4_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Hc4_MatchFinder_Skip;
++ vTable->GetMatches = Hc4_MatchFinder_GetMatches;
++ vTable->Skip = Hc4_MatchFinder_Skip;
+ }
+ else
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Hc5_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Hc5_MatchFinder_Skip;
++ vTable->GetMatches = Hc5_MatchFinder_GetMatches;
++ vTable->Skip = Hc5_MatchFinder_Skip;
+ }
+ }
+ else if (p->numHashBytes == 2)
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Bt2_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Bt2_MatchFinder_Skip;
++ vTable->GetMatches = Bt2_MatchFinder_GetMatches;
++ vTable->Skip = Bt2_MatchFinder_Skip;
+ }
+ else if (p->numHashBytes == 3)
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Bt3_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Bt3_MatchFinder_Skip;
++ vTable->GetMatches = Bt3_MatchFinder_GetMatches;
++ vTable->Skip = Bt3_MatchFinder_Skip;
+ }
+ else if (p->numHashBytes == 4)
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Bt4_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Bt4_MatchFinder_Skip;
++ vTable->GetMatches = Bt4_MatchFinder_GetMatches;
++ vTable->Skip = Bt4_MatchFinder_Skip;
+ }
+ else
+ {
+- vTable->GetMatches = (Mf_GetMatches_Func)Bt5_MatchFinder_GetMatches;
+- vTable->Skip = (Mf_Skip_Func)Bt5_MatchFinder_Skip;
++ vTable->GetMatches = Bt5_MatchFinder_GetMatches;
++ vTable->Skip = Bt5_MatchFinder_Skip;
+ }
+ }
+
+
+
+-void LzFindPrepare()
++void LzFindPrepare(void)
+ {
+- #ifndef FORCE_SATUR_SUB_128
+- #ifdef USE_SATUR_SUB_128
++ #ifndef FORCE_LZFIND_SATUR_SUB_128
++ #ifdef USE_LZFIND_SATUR_SUB_128
+ LZFIND_SATUR_SUB_CODE_FUNC f = NULL;
+ #ifdef MY_CPU_ARM_OR_ARM64
+ {
+ if (CPU_IsSupported_NEON())
+ {
+ // #pragma message ("=== LzFind NEON")
+- _PRF(printf("\n=== LzFind NEON\n"));
++ PRF(printf("\n=== LzFind NEON\n"));
+ f = LzFind_SaturSub_128;
+ }
+ // f = 0; // for debug
+@@ -1610,20 +1722,25 @@ void LzFindPrepare()
+ if (CPU_IsSupported_SSE41())
+ {
+ // #pragma message ("=== LzFind SSE41")
+- _PRF(printf("\n=== LzFind SSE41\n"));
++ PRF(printf("\n=== LzFind SSE41\n"));
+ f = LzFind_SaturSub_128;
+
+- #ifdef USE_AVX2
++ #ifdef USE_LZFIND_SATUR_SUB_256
+ if (CPU_IsSupported_AVX2())
+ {
+ // #pragma message ("=== LzFind AVX2")
+- _PRF(printf("\n=== LzFind AVX2\n"));
++ PRF(printf("\n=== LzFind AVX2\n"));
+ f = LzFind_SaturSub_256;
+ }
+ #endif
+ }
+ #endif // MY_CPU_ARM_OR_ARM64
+ g_LzFind_SaturSub = f;
+- #endif // USE_SATUR_SUB_128
+- #endif // FORCE_SATUR_SUB_128
++ #endif // USE_LZFIND_SATUR_SUB_128
++ #endif // FORCE_LZFIND_SATUR_SUB_128
+ }
++
++
++#undef MOVE_POS
++#undef MOVE_POS_RET
++#undef PRF
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.h b/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.h
new file mode 100644
index 0000000000..29d322cf68
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzFind.h
@@ -0,0 +1,125 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzFind.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzFind.h
+@@ -1,8 +1,8 @@
+ /* LzFind.h -- Match finder for LZ algorithms
+-2021-07-13 : Igor Pavlov : Public domain */
++2024-01-22 : Igor Pavlov : Public domain */
+
+-#ifndef __LZ_FIND_H
+-#define __LZ_FIND_H
++#ifndef ZIP7_INC_LZ_FIND_H
++#define ZIP7_INC_LZ_FIND_H
+
+ #include "7zTypes.h"
+
+@@ -10,9 +10,9 @@ EXTERN_C_BEGIN
+
+ typedef UInt32 CLzRef;
+
+-typedef struct _CMatchFinder
++typedef struct
+ {
+- Byte *buffer;
++ const Byte *buffer;
+ UInt32 pos;
+ UInt32 posLimit;
+ UInt32 streamPos; /* wrap over Zero is allowed (streamPos < pos). Use (UInt32)(streamPos - pos) */
+@@ -32,8 +32,8 @@ typedef struct _CMatchFinder
+ UInt32 hashMask;
+ UInt32 cutValue;
+
+- Byte *bufferBase;
+- ISeqInStream *stream;
++ Byte *bufBase;
++ ISeqInStreamPtr stream;
+
+ UInt32 blockSize;
+ UInt32 keepSizeBefore;
+@@ -43,7 +43,9 @@ typedef struct _CMatchFinder
+ size_t directInputRem;
+ UInt32 historySize;
+ UInt32 fixedHashSize;
+- UInt32 hashSizeSum;
++ Byte numHashBytes_Min;
++ Byte numHashOutBits;
++ Byte _pad2_[2];
+ SRes result;
+ UInt32 crc[256];
+ size_t numRefs;
+@@ -69,24 +71,45 @@ void MatchFinder_ReadIfRequired(CMatchFi
+
+ void MatchFinder_Construct(CMatchFinder *p);
+
+-/* Conditions:
+- historySize <= 3 GB
+- keepAddBufferBefore + matchMaxLen + keepAddBufferAfter < 511MB
++/* (directInput = 0) is default value.
++ It's required to provide correct (directInput) value
++ before calling MatchFinder_Create().
++ You can set (directInput) by any of the following calls:
++ - MatchFinder_SET_DIRECT_INPUT_BUF()
++ - MatchFinder_SET_STREAM()
++ - MatchFinder_SET_STREAM_MODE()
+ */
++
++#define MatchFinder_SET_DIRECT_INPUT_BUF(p, _src_, _srcLen_) { \
++ (p)->stream = NULL; \
++ (p)->directInput = 1; \
++ (p)->buffer = (_src_); \
++ (p)->directInputRem = (_srcLen_); }
++
++/*
++#define MatchFinder_SET_STREAM_MODE(p) { \
++ (p)->directInput = 0; }
++*/
++
++#define MatchFinder_SET_STREAM(p, _stream_) { \
++ (p)->stream = _stream_; \
++ (p)->directInput = 0; }
++
++
+ int MatchFinder_Create(CMatchFinder *p, UInt32 historySize,
+ UInt32 keepAddBufferBefore, UInt32 matchMaxLen, UInt32 keepAddBufferAfter,
+ ISzAllocPtr alloc);
+ void MatchFinder_Free(CMatchFinder *p, ISzAllocPtr alloc);
+ void MatchFinder_Normalize3(UInt32 subValue, CLzRef *items, size_t numItems);
+-// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
+
+ /*
+-#define Inline_MatchFinder_InitPos(p, val) \
++#define MatchFinder_INIT_POS(p, val) \
+ (p)->pos = (val); \
+ (p)->streamPos = (val);
+ */
+
+-#define Inline_MatchFinder_ReduceOffsets(p, subValue) \
++// void MatchFinder_ReduceOffsets(CMatchFinder *p, UInt32 subValue);
++#define MatchFinder_REDUCE_OFFSETS(p, subValue) \
+ (p)->pos -= (subValue); \
+ (p)->streamPos -= (subValue);
+
+@@ -107,7 +130,7 @@ typedef const Byte * (*Mf_GetPointerToCu
+ typedef UInt32 * (*Mf_GetMatches_Func)(void *object, UInt32 *distances);
+ typedef void (*Mf_Skip_Func)(void *object, UInt32);
+
+-typedef struct _IMatchFinder
++typedef struct
+ {
+ Mf_Init_Func Init;
+ Mf_GetNumAvailableBytes_Func GetNumAvailableBytes;
+@@ -121,7 +144,8 @@ void MatchFinder_CreateVTable(CMatchFind
+ void MatchFinder_Init_LowHash(CMatchFinder *p);
+ void MatchFinder_Init_HighHash(CMatchFinder *p);
+ void MatchFinder_Init_4(CMatchFinder *p);
+-void MatchFinder_Init(CMatchFinder *p);
++// void MatchFinder_Init(CMatchFinder *p);
++void MatchFinder_Init(void *p);
+
+ UInt32* Bt3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
+ UInt32* Hc3Zip_MatchFinder_GetMatches(CMatchFinder *p, UInt32 *distances);
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzHash.h b/electron34/patches/patch-third__party_lzma__sdk_C_LzHash.h
new file mode 100644
index 0000000000..610d0a2211
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzHash.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzHash.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzHash.h
+@@ -1,8 +1,8 @@
+-/* LzHash.h -- HASH functions for LZ algorithms
+-2019-10-30 : Igor Pavlov : Public domain */
++/* LzHash.h -- HASH constants for LZ algorithms
++2023-03-05 : Igor Pavlov : Public domain */
+
+-#ifndef __LZ_HASH_H
+-#define __LZ_HASH_H
++#ifndef ZIP7_INC_LZ_HASH_H
++#define ZIP7_INC_LZ_HASH_H
+
+ /*
+ (kHash2Size >= (1 << 8)) : Required
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.c b/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.c
new file mode 100644
index 0000000000..829fb21bdf
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.c
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Lzma2Dec.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Lzma2Dec.c
+@@ -1,5 +1,5 @@
+ /* Lzma2Dec.c -- LZMA2 Decoder
+-2021-02-09 : Igor Pavlov : Public domain */
++2024-03-01 : Igor Pavlov : Public domain */
+
+ /* #define SHOW_DEBUG_INFO */
+
+@@ -71,14 +71,14 @@ static SRes Lzma2Dec_GetOldProps(Byte pr
+ SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
+ {
+ Byte props[LZMA_PROPS_SIZE];
+- RINOK(Lzma2Dec_GetOldProps(prop, props));
++ RINOK(Lzma2Dec_GetOldProps(prop, props))
+ return LzmaDec_AllocateProbs(&p->decoder, props, LZMA_PROPS_SIZE, alloc);
+ }
+
+ SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc)
+ {
+ Byte props[LZMA_PROPS_SIZE];
+- RINOK(Lzma2Dec_GetOldProps(prop, props));
++ RINOK(Lzma2Dec_GetOldProps(prop, props))
+ return LzmaDec_Allocate(&p->decoder, props, LZMA_PROPS_SIZE, alloc);
+ }
+
+@@ -157,8 +157,10 @@ static unsigned Lzma2Dec_UpdateState(CLz
+ p->decoder.prop.lp = (Byte)lp;
+ return LZMA2_STATE_DATA;
+ }
++
++ default:
++ return LZMA2_STATE_ERROR;
+ }
+- return LZMA2_STATE_ERROR;
+ }
+
+ static void LzmaDec_UpdateWithUncompressed(CLzmaDec *p, const Byte *src, SizeT size)
+@@ -474,8 +476,8 @@ SRes Lzma2Decode(Byte *dest, SizeT *dest
+ SizeT outSize = *destLen, inSize = *srcLen;
+ *destLen = *srcLen = 0;
+ *status = LZMA_STATUS_NOT_SPECIFIED;
+- Lzma2Dec_Construct(&p);
+- RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc));
++ Lzma2Dec_CONSTRUCT(&p)
++ RINOK(Lzma2Dec_AllocateProbs(&p, prop, alloc))
+ p.decoder.dic = dest;
+ p.decoder.dicBufSize = outSize;
+ Lzma2Dec_Init(&p);
+@@ -487,3 +489,5 @@ SRes Lzma2Decode(Byte *dest, SizeT *dest
+ Lzma2Dec_FreeProbs(&p, alloc);
+ return res;
+ }
++
++#undef PRF
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.h b/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.h
new file mode 100644
index 0000000000..790efff56e
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Lzma2Dec.h
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Lzma2Dec.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Lzma2Dec.h
+@@ -1,8 +1,8 @@
+ /* Lzma2Dec.h -- LZMA2 Decoder
+-2018-02-19 : Igor Pavlov : Public domain */
++2023-03-03 : Igor Pavlov : Public domain */
+
+-#ifndef __LZMA2_DEC_H
+-#define __LZMA2_DEC_H
++#ifndef ZIP7_INC_LZMA2_DEC_H
++#define ZIP7_INC_LZMA2_DEC_H
+
+ #include "LzmaDec.h"
+
+@@ -22,9 +22,10 @@ typedef struct
+ CLzmaDec decoder;
+ } CLzma2Dec;
+
+-#define Lzma2Dec_Construct(p) LzmaDec_Construct(&(p)->decoder)
+-#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc)
+-#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc)
++#define Lzma2Dec_CONSTRUCT(p) LzmaDec_CONSTRUCT(&(p)->decoder)
++#define Lzma2Dec_Construct(p) Lzma2Dec_CONSTRUCT(p)
++#define Lzma2Dec_FreeProbs(p, alloc) LzmaDec_FreeProbs(&(p)->decoder, alloc)
++#define Lzma2Dec_Free(p, alloc) LzmaDec_Free(&(p)->decoder, alloc)
+
+ SRes Lzma2Dec_AllocateProbs(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc);
+ SRes Lzma2Dec_Allocate(CLzma2Dec *p, Byte prop, ISzAllocPtr alloc);
+@@ -90,7 +91,7 @@ Lzma2Dec_GetUnpackExtra() returns the va
+ at current input positon.
+ */
+
+-#define Lzma2Dec_GetUnpackExtra(p) ((p)->isExtraMode ? (p)->unpackSize : 0);
++#define Lzma2Dec_GetUnpackExtra(p) ((p)->isExtraMode ? (p)->unpackSize : 0)
+
+
+ /* ---------- One Call Interface ---------- */
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.c b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.c
new file mode 100644
index 0000000000..0d553d749c
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.c
@@ -0,0 +1,580 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaDec.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaDec.c
+@@ -1,5 +1,5 @@
+ /* LzmaDec.c -- LZMA Decoder
+-2021-04-01 : Igor Pavlov : Public domain */
++2023-04-07 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -8,15 +8,15 @@
+ /* #include "CpuArch.h" */
+ #include "LzmaDec.h"
+
+-#define kNumTopBits 24
+-#define kTopValue ((UInt32)1 << kNumTopBits)
++// #define kNumTopBits 24
++#define kTopValue ((UInt32)1 << 24)
+
+ #define kNumBitModelTotalBits 11
+ #define kBitModelTotal (1 << kNumBitModelTotalBits)
+
+ #define RC_INIT_SIZE 5
+
+-#ifndef _LZMA_DEC_OPT
++#ifndef Z7_LZMA_DEC_OPT
+
+ #define kNumMoveBits 5
+ #define NORMALIZE if (range < kTopValue) { range <<= 8; code = (code << 8) | (*buf++); }
+@@ -25,14 +25,14 @@
+ #define UPDATE_0(p) range = bound; *(p) = (CLzmaProb)(ttt + ((kBitModelTotal - ttt) >> kNumMoveBits));
+ #define UPDATE_1(p) range -= bound; code -= bound; *(p) = (CLzmaProb)(ttt - (ttt >> kNumMoveBits));
+ #define GET_BIT2(p, i, A0, A1) IF_BIT_0(p) \
+- { UPDATE_0(p); i = (i + i); A0; } else \
+- { UPDATE_1(p); i = (i + i) + 1; A1; }
++ { UPDATE_0(p) i = (i + i); A0; } else \
++ { UPDATE_1(p) i = (i + i) + 1; A1; }
+
+ #define TREE_GET_BIT(probs, i) { GET_BIT2(probs + i, i, ;, ;); }
+
+ #define REV_BIT(p, i, A0, A1) IF_BIT_0(p + i) \
+- { UPDATE_0(p + i); A0; } else \
+- { UPDATE_1(p + i); A1; }
++ { UPDATE_0(p + i) A0; } else \
++ { UPDATE_1(p + i) A1; }
+ #define REV_BIT_VAR( p, i, m) REV_BIT(p, i, i += m; m += m, m += m; i += m; )
+ #define REV_BIT_CONST(p, i, m) REV_BIT(p, i, i += m; , i += m * 2; )
+ #define REV_BIT_LAST( p, i, m) REV_BIT(p, i, i -= m , ; )
+@@ -40,19 +40,19 @@
+ #define TREE_DECODE(probs, limit, i) \
+ { i = 1; do { TREE_GET_BIT(probs, i); } while (i < limit); i -= limit; }
+
+-/* #define _LZMA_SIZE_OPT */
++/* #define Z7_LZMA_SIZE_OPT */
+
+-#ifdef _LZMA_SIZE_OPT
++#ifdef Z7_LZMA_SIZE_OPT
+ #define TREE_6_DECODE(probs, i) TREE_DECODE(probs, (1 << 6), i)
+ #else
+ #define TREE_6_DECODE(probs, i) \
+ { i = 1; \
+- TREE_GET_BIT(probs, i); \
+- TREE_GET_BIT(probs, i); \
+- TREE_GET_BIT(probs, i); \
+- TREE_GET_BIT(probs, i); \
+- TREE_GET_BIT(probs, i); \
+- TREE_GET_BIT(probs, i); \
++ TREE_GET_BIT(probs, i) \
++ TREE_GET_BIT(probs, i) \
++ TREE_GET_BIT(probs, i) \
++ TREE_GET_BIT(probs, i) \
++ TREE_GET_BIT(probs, i) \
++ TREE_GET_BIT(probs, i) \
+ i -= 0x40; }
+ #endif
+
+@@ -64,25 +64,25 @@
+ probLit = prob + (offs + bit + symbol); \
+ GET_BIT2(probLit, symbol, offs ^= bit; , ;)
+
+-#endif // _LZMA_DEC_OPT
++#endif // Z7_LZMA_DEC_OPT
+
+
+ #define NORMALIZE_CHECK if (range < kTopValue) { if (buf >= bufLimit) return DUMMY_INPUT_EOF; range <<= 8; code = (code << 8) | (*buf++); }
+
+-#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK; bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
++#define IF_BIT_0_CHECK(p) ttt = *(p); NORMALIZE_CHECK bound = (range >> kNumBitModelTotalBits) * (UInt32)ttt; if (code < bound)
+ #define UPDATE_0_CHECK range = bound;
+ #define UPDATE_1_CHECK range -= bound; code -= bound;
+ #define GET_BIT2_CHECK(p, i, A0, A1) IF_BIT_0_CHECK(p) \
+- { UPDATE_0_CHECK; i = (i + i); A0; } else \
+- { UPDATE_1_CHECK; i = (i + i) + 1; A1; }
++ { UPDATE_0_CHECK i = (i + i); A0; } else \
++ { UPDATE_1_CHECK i = (i + i) + 1; A1; }
+ #define GET_BIT_CHECK(p, i) GET_BIT2_CHECK(p, i, ; , ;)
+ #define TREE_DECODE_CHECK(probs, limit, i) \
+ { i = 1; do { GET_BIT_CHECK(probs + i, i) } while (i < limit); i -= limit; }
+
+
+ #define REV_BIT_CHECK(p, i, m) IF_BIT_0_CHECK(p + i) \
+- { UPDATE_0_CHECK; i += m; m += m; } else \
+- { UPDATE_1_CHECK; m += m; i += m; }
++ { UPDATE_0_CHECK i += m; m += m; } else \
++ { UPDATE_1_CHECK m += m; i += m; }
+
+
+ #define kNumPosBitsMax 4
+@@ -224,14 +224,14 @@ Out:
+ */
+
+
+-#ifdef _LZMA_DEC_OPT
++#ifdef Z7_LZMA_DEC_OPT
+
+-int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit);
++int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit);
+
+ #else
+
+ static
+-int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
++int Z7_FASTCALL LZMA_DECODE_REAL(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+ {
+ CLzmaProb *probs = GET_PROBS;
+ unsigned state = (unsigned)p->state;
+@@ -263,7 +263,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ IF_BIT_0(prob)
+ {
+ unsigned symbol;
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+ prob = probs + Literal;
+ if (processedPos != 0 || checkDicSize != 0)
+ prob += (UInt32)3 * ((((processedPos << 8) + dic[(dicPos == 0 ? dicBufSize : dicPos) - 1]) & lpMask) << lc);
+@@ -273,7 +273,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ {
+ state -= (state < 4) ? state : 3;
+ symbol = 1;
+- #ifdef _LZMA_SIZE_OPT
++ #ifdef Z7_LZMA_SIZE_OPT
+ do { NORMAL_LITER_DEC } while (symbol < 0x100);
+ #else
+ NORMAL_LITER_DEC
+@@ -292,7 +292,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ unsigned offs = 0x100;
+ state -= (state < 10) ? 3 : 6;
+ symbol = 1;
+- #ifdef _LZMA_SIZE_OPT
++ #ifdef Z7_LZMA_SIZE_OPT
+ do
+ {
+ unsigned bit;
+@@ -321,25 +321,25 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ }
+
+ {
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ prob = probs + IsRep + state;
+ IF_BIT_0(prob)
+ {
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+ state += kNumStates;
+ prob = probs + LenCoder;
+ }
+ else
+ {
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0(prob)
+ {
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+ prob = probs + IsRep0Long + COMBINED_PS_STATE;
+ IF_BIT_0(prob)
+ {
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+
+ // that case was checked before with kBadRepCode
+ // if (checkDicSize == 0 && processedPos == 0) { len = kMatchSpecLen_Error_Data + 1; break; }
+@@ -353,30 +353,30 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ state = state < kNumLitStates ? 9 : 11;
+ continue;
+ }
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ }
+ else
+ {
+ UInt32 distance;
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0(prob)
+ {
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+ distance = rep1;
+ }
+ else
+ {
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0(prob)
+ {
+- UPDATE_0(prob);
++ UPDATE_0(prob)
+ distance = rep2;
+ }
+ else
+ {
+- UPDATE_1(prob);
++ UPDATE_1(prob)
+ distance = rep3;
+ rep3 = rep2;
+ }
+@@ -389,37 +389,37 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ prob = probs + RepLenCoder;
+ }
+
+- #ifdef _LZMA_SIZE_OPT
++ #ifdef Z7_LZMA_SIZE_OPT
+ {
+ unsigned lim, offset;
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0(probLen)
+ {
+- UPDATE_0(probLen);
++ UPDATE_0(probLen)
+ probLen = prob + LenLow + GET_LEN_STATE;
+ offset = 0;
+ lim = (1 << kLenNumLowBits);
+ }
+ else
+ {
+- UPDATE_1(probLen);
++ UPDATE_1(probLen)
+ probLen = prob + LenChoice2;
+ IF_BIT_0(probLen)
+ {
+- UPDATE_0(probLen);
++ UPDATE_0(probLen)
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ offset = kLenNumLowSymbols;
+ lim = (1 << kLenNumLowBits);
+ }
+ else
+ {
+- UPDATE_1(probLen);
++ UPDATE_1(probLen)
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols * 2;
+ lim = (1 << kLenNumHighBits);
+ }
+ }
+- TREE_DECODE(probLen, lim, len);
++ TREE_DECODE(probLen, lim, len)
+ len += offset;
+ }
+ #else
+@@ -427,32 +427,32 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0(probLen)
+ {
+- UPDATE_0(probLen);
++ UPDATE_0(probLen)
+ probLen = prob + LenLow + GET_LEN_STATE;
+ len = 1;
+- TREE_GET_BIT(probLen, len);
+- TREE_GET_BIT(probLen, len);
+- TREE_GET_BIT(probLen, len);
++ TREE_GET_BIT(probLen, len)
++ TREE_GET_BIT(probLen, len)
++ TREE_GET_BIT(probLen, len)
+ len -= 8;
+ }
+ else
+ {
+- UPDATE_1(probLen);
++ UPDATE_1(probLen)
+ probLen = prob + LenChoice2;
+ IF_BIT_0(probLen)
+ {
+- UPDATE_0(probLen);
++ UPDATE_0(probLen)
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ len = 1;
+- TREE_GET_BIT(probLen, len);
+- TREE_GET_BIT(probLen, len);
+- TREE_GET_BIT(probLen, len);
++ TREE_GET_BIT(probLen, len)
++ TREE_GET_BIT(probLen, len)
++ TREE_GET_BIT(probLen, len)
+ }
+ else
+ {
+- UPDATE_1(probLen);
++ UPDATE_1(probLen)
+ probLen = prob + LenHigh;
+- TREE_DECODE(probLen, (1 << kLenNumHighBits), len);
++ TREE_DECODE(probLen, (1 << kLenNumHighBits), len)
+ len += kLenNumLowSymbols * 2;
+ }
+ }
+@@ -464,7 +464,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ UInt32 distance;
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates ? len : kNumLenToPosStates - 1) << kNumPosSlotBits);
+- TREE_6_DECODE(prob, distance);
++ TREE_6_DECODE(prob, distance)
+ if (distance >= kStartPosModelIndex)
+ {
+ unsigned posSlot = (unsigned)distance;
+@@ -479,7 +479,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ distance++;
+ do
+ {
+- REV_BIT_VAR(prob, distance, m);
++ REV_BIT_VAR(prob, distance, m)
+ }
+ while (--numDirectBits);
+ distance -= m;
+@@ -514,10 +514,10 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ distance <<= kNumAlignBits;
+ {
+ unsigned i = 1;
+- REV_BIT_CONST(prob, i, 1);
+- REV_BIT_CONST(prob, i, 2);
+- REV_BIT_CONST(prob, i, 4);
+- REV_BIT_LAST (prob, i, 8);
++ REV_BIT_CONST(prob, i, 1)
++ REV_BIT_CONST(prob, i, 2)
++ REV_BIT_CONST(prob, i, 4)
++ REV_BIT_LAST (prob, i, 8)
+ distance |= i;
+ }
+ if (distance == (UInt32)0xFFFFFFFF)
+@@ -592,7 +592,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+ }
+ while (dicPos < limit && buf < bufLimit);
+
+- NORMALIZE;
++ NORMALIZE
+
+ p->buf = buf;
+ p->range = range;
+@@ -613,7 +613,7 @@ int MY_FAST_CALL LZMA_DECODE_REAL(CLzmaD
+
+
+
+-static void MY_FAST_CALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
++static void Z7_FASTCALL LzmaDec_WriteRem(CLzmaDec *p, SizeT limit)
+ {
+ unsigned len = (unsigned)p->remainLen;
+ if (len == 0 /* || len >= kMatchSpecLenStart */)
+@@ -683,7 +683,7 @@ and we support the following state of (p
+ (p->checkDicSize == p->prop.dicSize)
+ */
+
+-static int MY_FAST_CALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
++static int Z7_FASTCALL LzmaDec_DecodeReal2(CLzmaDec *p, SizeT limit, const Byte *bufLimit)
+ {
+ if (p->checkDicSize == 0)
+ {
+@@ -767,54 +767,54 @@ static ELzmaDummy LzmaDec_TryDummy(const
+ else
+ {
+ unsigned len;
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+
+ prob = probs + IsRep + state;
+ IF_BIT_0_CHECK(prob)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ state = 0;
+ prob = probs + LenCoder;
+ res = DUMMY_MATCH;
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ res = DUMMY_REP;
+ prob = probs + IsRepG0 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ prob = probs + IsRep0Long + COMBINED_PS_STATE;
+ IF_BIT_0_CHECK(prob)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ break;
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ }
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ prob = probs + IsRepG1 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ prob = probs + IsRepG2 + state;
+ IF_BIT_0_CHECK(prob)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ }
+ }
+ }
+@@ -826,31 +826,31 @@ static ELzmaDummy LzmaDec_TryDummy(const
+ const CLzmaProb *probLen = prob + LenChoice;
+ IF_BIT_0_CHECK(probLen)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ probLen = prob + LenLow + GET_LEN_STATE;
+ offset = 0;
+ limit = 1 << kLenNumLowBits;
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ probLen = prob + LenChoice2;
+ IF_BIT_0_CHECK(probLen)
+ {
+- UPDATE_0_CHECK;
++ UPDATE_0_CHECK
+ probLen = prob + LenLow + GET_LEN_STATE + (1 << kLenNumLowBits);
+ offset = kLenNumLowSymbols;
+ limit = 1 << kLenNumLowBits;
+ }
+ else
+ {
+- UPDATE_1_CHECK;
++ UPDATE_1_CHECK
+ probLen = prob + LenHigh;
+ offset = kLenNumLowSymbols * 2;
+ limit = 1 << kLenNumHighBits;
+ }
+ }
+- TREE_DECODE_CHECK(probLen, limit, len);
++ TREE_DECODE_CHECK(probLen, limit, len)
+ len += offset;
+ }
+
+@@ -860,7 +860,7 @@ static ELzmaDummy LzmaDec_TryDummy(const
+ prob = probs + PosSlot +
+ ((len < kNumLenToPosStates - 1 ? len : kNumLenToPosStates - 1) <<
+ kNumPosSlotBits);
+- TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot);
++ TREE_DECODE_CHECK(prob, 1 << kNumPosSlotBits, posSlot)
+ if (posSlot >= kStartPosModelIndex)
+ {
+ unsigned numDirectBits = ((posSlot >> 1) - 1);
+@@ -888,7 +888,7 @@ static ELzmaDummy LzmaDec_TryDummy(const
+ unsigned m = 1;
+ do
+ {
+- REV_BIT_CHECK(prob, i, m);
++ REV_BIT_CHECK(prob, i, m)
+ }
+ while (--numDirectBits);
+ }
+@@ -897,7 +897,7 @@ static ELzmaDummy LzmaDec_TryDummy(const
+ }
+ break;
+ }
+- NORMALIZE_CHECK;
++ NORMALIZE_CHECK
+
+ *bufOut = buf;
+ return res;
+@@ -943,7 +943,7 @@ When the decoder lookahead, and the look
+ */
+
+
+-#define RETURN__NOT_FINISHED__FOR_FINISH \
++#define RETURN_NOT_FINISHED_FOR_FINISH \
+ *status = LZMA_STATUS_NOT_FINISHED; \
+ return SZ_ERROR_DATA; // for strict mode
+ // return SZ_OK; // for relaxed mode
+@@ -1029,7 +1029,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
+ }
+ if (p->remainLen != 0)
+ {
+- RETURN__NOT_FINISHED__FOR_FINISH;
++ RETURN_NOT_FINISHED_FOR_FINISH
+ }
+ checkEndMarkNow = 1;
+ }
+@@ -1072,7 +1072,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
+ for (i = 0; i < (unsigned)dummyProcessed; i++)
+ p->tempBuf[i] = src[i];
+ // p->remainLen = kMatchSpecLen_Error_Data;
+- RETURN__NOT_FINISHED__FOR_FINISH;
++ RETURN_NOT_FINISHED_FOR_FINISH
+ }
+
+ bufLimit = src;
+@@ -1150,7 +1150,7 @@ SRes LzmaDec_DecodeToDic(CLzmaDec *p, Si
+ (*srcLen) += (unsigned)dummyProcessed - p->tempBufSize;
+ p->tempBufSize = (unsigned)dummyProcessed;
+ // p->remainLen = kMatchSpecLen_Error_Data;
+- RETURN__NOT_FINISHED__FOR_FINISH;
++ RETURN_NOT_FINISHED_FOR_FINISH
+ }
+ }
+
+@@ -1299,8 +1299,8 @@ static SRes LzmaDec_AllocateProbs2(CLzma
+ SRes LzmaDec_AllocateProbs(CLzmaDec *p, const Byte *props, unsigned propsSize, ISzAllocPtr alloc)
+ {
+ CLzmaProps propNew;
+- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
++ RINOK(LzmaProps_Decode(&propNew, props, propsSize))
++ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc))
+ p->prop = propNew;
+ return SZ_OK;
+ }
+@@ -1309,14 +1309,14 @@ SRes LzmaDec_Allocate(CLzmaDec *p, const
+ {
+ CLzmaProps propNew;
+ SizeT dicBufSize;
+- RINOK(LzmaProps_Decode(&propNew, props, propsSize));
+- RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc));
++ RINOK(LzmaProps_Decode(&propNew, props, propsSize))
++ RINOK(LzmaDec_AllocateProbs2(p, &propNew, alloc))
+
+ {
+ UInt32 dictSize = propNew.dicSize;
+ SizeT mask = ((UInt32)1 << 12) - 1;
+ if (dictSize >= ((UInt32)1 << 30)) mask = ((UInt32)1 << 22) - 1;
+- else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;;
++ else if (dictSize >= ((UInt32)1 << 22)) mask = ((UInt32)1 << 20) - 1;
+ dicBufSize = ((SizeT)dictSize + mask) & ~mask;
+ if (dicBufSize < dictSize)
+ dicBufSize = dictSize;
+@@ -1348,8 +1348,8 @@ SRes LzmaDecode(Byte *dest, SizeT *destL
+ *status = LZMA_STATUS_NOT_SPECIFIED;
+ if (inSize < RC_INIT_SIZE)
+ return SZ_ERROR_INPUT_EOF;
+- LzmaDec_Construct(&p);
+- RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc));
++ LzmaDec_CONSTRUCT(&p)
++ RINOK(LzmaDec_AllocateProbs(&p, propData, propSize, alloc))
+ p.dic = dest;
+ p.dicBufSize = outSize;
+ LzmaDec_Init(&p);
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.h b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.h
new file mode 100644
index 0000000000..e34d23cf46
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaDec.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaDec.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaDec.h
+@@ -1,19 +1,19 @@
+ /* LzmaDec.h -- LZMA Decoder
+-2020-03-19 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
+
+-#ifndef __LZMA_DEC_H
+-#define __LZMA_DEC_H
++#ifndef ZIP7_INC_LZMA_DEC_H
++#define ZIP7_INC_LZMA_DEC_H
+
+ #include "7zTypes.h"
+
+ EXTERN_C_BEGIN
+
+-/* #define _LZMA_PROB32 */
+-/* _LZMA_PROB32 can increase the speed on some CPUs,
++/* #define Z7_LZMA_PROB32 */
++/* Z7_LZMA_PROB32 can increase the speed on some CPUs,
+ but memory usage for CLzmaDec::probs will be doubled in that case */
+
+ typedef
+-#ifdef _LZMA_PROB32
++#ifdef Z7_LZMA_PROB32
+ UInt32
+ #else
+ UInt16
+@@ -25,7 +25,7 @@ typedef
+
+ #define LZMA_PROPS_SIZE 5
+
+-typedef struct _CLzmaProps
++typedef struct
+ {
+ Byte lc;
+ Byte lp;
+@@ -73,7 +73,8 @@ typedef struct
+ Byte tempBuf[LZMA_REQUIRED_INPUT_MAX];
+ } CLzmaDec;
+
+-#define LzmaDec_Construct(p) { (p)->dic = NULL; (p)->probs = NULL; }
++#define LzmaDec_CONSTRUCT(p) { (p)->dic = NULL; (p)->probs = NULL; }
++#define LzmaDec_Construct(p) LzmaDec_CONSTRUCT(p)
+
+ void LzmaDec_Init(CLzmaDec *p);
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.c b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.c
new file mode 100644
index 0000000000..56f1d9993f
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.c
@@ -0,0 +1,1084 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaEnc.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaEnc.c
+@@ -1,5 +1,5 @@
+ /* LzmaEnc.c -- LZMA Encoder
+-2022-07-15: Igor Pavlov : Public domain */
++Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -16,22 +16,22 @@
+ #include "LzmaEnc.h"
+
+ #include "LzFind.h"
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+ #include "LzFindMt.h"
+ #endif
+
+ /* the following LzmaEnc_* declarations is internal LZMA interface for LZMA2 encoder */
+
+-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp, ISeqInStream *inStream, UInt32 keepWindowSize,
++SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p, ISeqInStreamPtr inStream, UInt32 keepWindowSize,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig);
+-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
++SRes LzmaEnc_MemPrepare(CLzmaEncHandle p, const Byte *src, SizeT srcLen,
+ UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
++SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit,
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize);
+-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp);
+-void LzmaEnc_Finish(CLzmaEncHandle pp);
+-void LzmaEnc_SaveState(CLzmaEncHandle pp);
+-void LzmaEnc_RestoreState(CLzmaEncHandle pp);
++const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p);
++void LzmaEnc_Finish(CLzmaEncHandle p);
++void LzmaEnc_SaveState(CLzmaEncHandle p);
++void LzmaEnc_RestoreState(CLzmaEncHandle p);
+
+ #ifdef SHOW_STAT
+ static unsigned g_STAT_OFFSET = 0;
+@@ -40,8 +40,8 @@ static unsigned g_STAT_OFFSET = 0;
+ /* for good normalization speed we still reserve 256 MB before 4 GB range */
+ #define kLzmaMaxHistorySize ((UInt32)15 << 28)
+
+-#define kNumTopBits 24
+-#define kTopValue ((UInt32)1 << kNumTopBits)
++// #define kNumTopBits 24
++#define kTopValue ((UInt32)1 << 24)
+
+ #define kNumBitModelTotalBits 11
+ #define kBitModelTotal (1 << kNumBitModelTotalBits)
+@@ -60,6 +60,7 @@ void LzmaEncProps_Init(CLzmaEncProps *p)
+ p->dictSize = p->mc = 0;
+ p->reduceSize = (UInt64)(Int64)-1;
+ p->lc = p->lp = p->pb = p->algo = p->fb = p->btMode = p->numHashBytes = p->numThreads = -1;
++ p->numHashOutBits = 0;
+ p->writeEndMark = 0;
+ p->affinity = 0;
+ }
+@@ -71,11 +72,11 @@ void LzmaEncProps_Normalize(CLzmaEncProp
+ p->level = level;
+
+ if (p->dictSize == 0)
+- p->dictSize =
+- ( level <= 3 ? ((UInt32)1 << (level * 2 + 16)) :
+- ( level <= 6 ? ((UInt32)1 << (level + 19)) :
+- ( level <= 7 ? ((UInt32)1 << 25) : ((UInt32)1 << 26)
+- )));
++ p->dictSize = (unsigned)level <= 4 ?
++ (UInt32)1 << (level * 2 + 16) :
++ (unsigned)level <= sizeof(size_t) / 2 + 4 ?
++ (UInt32)1 << (level + 20) :
++ (UInt32)1 << (sizeof(size_t) / 2 + 24);
+
+ if (p->dictSize > p->reduceSize)
+ {
+@@ -91,15 +92,15 @@ void LzmaEncProps_Normalize(CLzmaEncProp
+ if (p->lp < 0) p->lp = 0;
+ if (p->pb < 0) p->pb = 2;
+
+- if (p->algo < 0) p->algo = (level < 5 ? 0 : 1);
+- if (p->fb < 0) p->fb = (level < 7 ? 32 : 64);
++ if (p->algo < 0) p->algo = (unsigned)level < 5 ? 0 : 1;
++ if (p->fb < 0) p->fb = (unsigned)level < 7 ? 32 : 64;
+ if (p->btMode < 0) p->btMode = (p->algo == 0 ? 0 : 1);
+ if (p->numHashBytes < 0) p->numHashBytes = (p->btMode ? 4 : 5);
+ if (p->mc == 0) p->mc = (16 + ((unsigned)p->fb >> 1)) >> (p->btMode ? 0 : 1);
+
+ if (p->numThreads < 0)
+ p->numThreads =
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ ((p->btMode && p->algo) ? 2 : 1);
+ #else
+ 1;
+@@ -194,11 +195,11 @@ unsigned GetPosSlot1(UInt32 pos);
+ unsigned GetPosSlot1(UInt32 pos)
+ {
+ unsigned res;
+- BSR2_RET(pos, res);
++ BSR2_RET(pos, res)
+ return res;
+ }
+-#define GetPosSlot2(pos, res) { BSR2_RET(pos, res); }
+-#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res); }
++#define GetPosSlot2(pos, res) { BSR2_RET(pos, res) }
++#define GetPosSlot(pos, res) { if (pos < 2) res = pos; else BSR2_RET(pos, res) }
+
+
+ #else // ! LZMA_LOG_BSR
+@@ -293,7 +294,7 @@ typedef struct
+ #define kNumFullDistances (1 << (kEndPosModelIndex >> 1))
+
+ typedef
+-#ifdef _LZMA_PROB32
++#ifdef Z7_LZMA_PROB32
+ UInt32
+ #else
+ UInt16
+@@ -350,7 +351,7 @@ typedef struct
+ Byte *buf;
+ Byte *bufLim;
+ Byte *bufBase;
+- ISeqOutStream *outStream;
++ ISeqOutStreamPtr outStream;
+ UInt64 processed;
+ SRes res;
+ } CRangeEnc;
+@@ -383,7 +384,7 @@ typedef struct
+ typedef UInt32 CProbPrice;
+
+
+-typedef struct
++struct CLzmaEnc
+ {
+ void *matchFinderObj;
+ IMatchFinder2 matchFinder;
+@@ -426,7 +427,7 @@ typedef struct
+ UInt32 dictSize;
+ SRes result;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ BoolInt mtMode;
+ // begin of CMatchFinderMt is used in LZ thread
+ CMatchFinderMt matchFinderMt;
+@@ -439,7 +440,7 @@ typedef struct
+
+ // we suppose that we have 8-bytes alignment after CMatchFinder
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ Byte pad[128];
+ #endif
+
+@@ -479,77 +480,59 @@ typedef struct
+ CSaveState saveState;
+
+ // BoolInt mf_Failure;
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ Byte pad2[128];
+ #endif
+-} CLzmaEnc;
++};
+
+
+ #define MFB (p->matchFinderBase)
+ /*
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+ #define MFB (p->matchFinderMt.MatchFinder)
+ #endif
+ */
+
+-#define COPY_ARR(dest, src, arr) memcpy(dest->arr, src->arr, sizeof(src->arr));
++// #define GET_CLzmaEnc_p CLzmaEnc *p = (CLzmaEnc*)(void *)p;
++// #define GET_const_CLzmaEnc_p const CLzmaEnc *p = (const CLzmaEnc*)(const void *)p;
+
+-void LzmaEnc_SaveState(CLzmaEncHandle pp)
+-{
+- CLzmaEnc *p = (CLzmaEnc *)pp;
+- CSaveState *dest = &p->saveState;
+-
+- dest->state = p->state;
+-
+- dest->lenProbs = p->lenProbs;
+- dest->repLenProbs = p->repLenProbs;
+-
+- COPY_ARR(dest, p, reps);
++#define COPY_ARR(dest, src, arr) memcpy((dest)->arr, (src)->arr, sizeof((src)->arr));
+
+- COPY_ARR(dest, p, posAlignEncoder);
+- COPY_ARR(dest, p, isRep);
+- COPY_ARR(dest, p, isRepG0);
+- COPY_ARR(dest, p, isRepG1);
+- COPY_ARR(dest, p, isRepG2);
+- COPY_ARR(dest, p, isMatch);
+- COPY_ARR(dest, p, isRep0Long);
+- COPY_ARR(dest, p, posSlotEncoder);
+- COPY_ARR(dest, p, posEncoders);
++#define COPY_LZMA_ENC_STATE(d, s, p) \
++ (d)->state = (s)->state; \
++ COPY_ARR(d, s, reps) \
++ COPY_ARR(d, s, posAlignEncoder) \
++ COPY_ARR(d, s, isRep) \
++ COPY_ARR(d, s, isRepG0) \
++ COPY_ARR(d, s, isRepG1) \
++ COPY_ARR(d, s, isRepG2) \
++ COPY_ARR(d, s, isMatch) \
++ COPY_ARR(d, s, isRep0Long) \
++ COPY_ARR(d, s, posSlotEncoder) \
++ COPY_ARR(d, s, posEncoders) \
++ (d)->lenProbs = (s)->lenProbs; \
++ (d)->repLenProbs = (s)->repLenProbs; \
++ memcpy((d)->litProbs, (s)->litProbs, ((size_t)0x300 * sizeof(CLzmaProb)) << (p)->lclp);
+
+- memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << p->lclp) * sizeof(CLzmaProb));
++void LzmaEnc_SaveState(CLzmaEncHandle p)
++{
++ // GET_CLzmaEnc_p
++ CSaveState *v = &p->saveState;
++ COPY_LZMA_ENC_STATE(v, p, p)
+ }
+
+-
+-void LzmaEnc_RestoreState(CLzmaEncHandle pp)
++void LzmaEnc_RestoreState(CLzmaEncHandle p)
+ {
+- CLzmaEnc *dest = (CLzmaEnc *)pp;
+- const CSaveState *p = &dest->saveState;
+-
+- dest->state = p->state;
+-
+- dest->lenProbs = p->lenProbs;
+- dest->repLenProbs = p->repLenProbs;
+-
+- COPY_ARR(dest, p, reps);
+-
+- COPY_ARR(dest, p, posAlignEncoder);
+- COPY_ARR(dest, p, isRep);
+- COPY_ARR(dest, p, isRepG0);
+- COPY_ARR(dest, p, isRepG1);
+- COPY_ARR(dest, p, isRepG2);
+- COPY_ARR(dest, p, isMatch);
+- COPY_ARR(dest, p, isRep0Long);
+- COPY_ARR(dest, p, posSlotEncoder);
+- COPY_ARR(dest, p, posEncoders);
+-
+- memcpy(dest->litProbs, p->litProbs, ((UInt32)0x300 << dest->lclp) * sizeof(CLzmaProb));
++ // GET_CLzmaEnc_p
++ const CSaveState *v = &p->saveState;
++ COPY_LZMA_ENC_STATE(p, v, p)
+ }
+
+
+-
+-SRes LzmaEnc_SetProps(CLzmaEncHandle pp, const CLzmaEncProps *props2)
++Z7_NO_INLINE
++SRes LzmaEnc_SetProps(CLzmaEncHandle p, const CLzmaEncProps *props2)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
++ // GET_CLzmaEnc_p
+ CLzmaEncProps props = *props2;
+ LzmaEncProps_Normalize(&props);
+
+@@ -585,6 +568,7 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp,
+ p->fastMode = (props.algo == 0);
+ // p->_maxMode = True;
+ MFB.btMode = (Byte)(props.btMode ? 1 : 0);
++ // MFB.btMode = (Byte)(props.btMode);
+ {
+ unsigned numHashBytes = 4;
+ if (props.btMode)
+@@ -595,13 +579,15 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp,
+ if (props.numHashBytes >= 5) numHashBytes = 5;
+
+ MFB.numHashBytes = numHashBytes;
++ // MFB.numHashBytes_Min = 2;
++ MFB.numHashOutBits = (Byte)props.numHashOutBits;
+ }
+
+ MFB.cutValue = props.mc;
+
+ p->writeEndMark = (BoolInt)props.writeEndMark;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ /*
+ if (newMultiThread != _multiThread)
+ {
+@@ -618,9 +604,9 @@ SRes LzmaEnc_SetProps(CLzmaEncHandle pp,
+ }
+
+
+-void LzmaEnc_SetDataSize(CLzmaEncHandle pp, UInt64 expectedDataSiize)
++void LzmaEnc_SetDataSize(CLzmaEncHandle p, UInt64 expectedDataSiize)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
++ // GET_CLzmaEnc_p
+ MFB.expectedDataSize = expectedDataSiize;
+ }
+
+@@ -684,7 +670,7 @@ static void RangeEnc_Init(CRangeEnc *p)
+ p->res = SZ_OK;
+ }
+
+-MY_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
++Z7_NO_INLINE static void RangeEnc_FlushStream(CRangeEnc *p)
+ {
+ const size_t num = (size_t)(p->buf - p->bufBase);
+ if (p->res == SZ_OK)
+@@ -696,7 +682,7 @@ MY_NO_INLINE static void RangeEnc_FlushS
+ p->buf = p->bufBase;
+ }
+
+-MY_NO_INLINE static void MY_FAST_CALL RangeEnc_ShiftLow(CRangeEnc *p)
++Z7_NO_INLINE static void Z7_FASTCALL RangeEnc_ShiftLow(CRangeEnc *p)
+ {
+ UInt32 low = (UInt32)p->low;
+ unsigned high = (unsigned)(p->low >> 32);
+@@ -741,9 +727,9 @@ static void RangeEnc_FlushData(CRangeEnc
+ ttt = *(prob); \
+ newBound = (range >> kNumBitModelTotalBits) * ttt;
+
+-// #define _LZMA_ENC_USE_BRANCH
++// #define Z7_LZMA_ENC_USE_BRANCH
+
+-#ifdef _LZMA_ENC_USE_BRANCH
++#ifdef Z7_LZMA_ENC_USE_BRANCH
+
+ #define RC_BIT(p, prob, bit) { \
+ RC_BIT_PRE(p, prob) \
+@@ -811,7 +797,7 @@ static void LitEnc_Encode(CRangeEnc *p,
+ CLzmaProb *prob = probs + (sym >> 8);
+ UInt32 bit = (sym >> 7) & 1;
+ sym <<= 1;
+- RC_BIT(p, prob, bit);
++ RC_BIT(p, prob, bit)
+ }
+ while (sym < 0x10000);
+ p->range = range;
+@@ -833,7 +819,7 @@ static void LitEnc_EncodeMatched(CRangeE
+ bit = (sym >> 7) & 1;
+ sym <<= 1;
+ offs &= ~(matchByte ^ sym);
+- RC_BIT(p, prob, bit);
++ RC_BIT(p, prob, bit)
+ }
+ while (sym < 0x10000);
+ p->range = range;
+@@ -867,10 +853,10 @@ static void LzmaEnc_InitPriceTables(CPro
+
+
+ #define GET_PRICE(prob, bit) \
+- p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
++ p->ProbPrices[((prob) ^ (unsigned)(((-(int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]
+
+ #define GET_PRICEa(prob, bit) \
+- ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits];
++ ProbPrices[((prob) ^ (unsigned)((-((int)(bit))) & (kBitModelTotal - 1))) >> kNumMoveReducingBits]
+
+ #define GET_PRICE_0(prob) p->ProbPrices[(prob) >> kNumMoveReducingBits]
+ #define GET_PRICE_1(prob) p->ProbPrices[((prob) ^ (kBitModelTotal - 1)) >> kNumMoveReducingBits]
+@@ -921,7 +907,7 @@ static void RcTree_ReverseEncode(CRangeE
+ unsigned bit = sym & 1;
+ // RangeEnc_EncodeBit(rc, probs + m, bit);
+ sym >>= 1;
+- RC_BIT(rc, probs + m, bit);
++ RC_BIT(rc, probs + m, bit)
+ m = (m << 1) | bit;
+ }
+ while (--numBits);
+@@ -944,15 +930,15 @@ static void LenEnc_Encode(CLenEnc *p, CR
+ UInt32 range, ttt, newBound;
+ CLzmaProb *probs = p->low;
+ range = rc->range;
+- RC_BIT_PRE(rc, probs);
++ RC_BIT_PRE(rc, probs)
+ if (sym >= kLenNumLowSymbols)
+ {
+- RC_BIT_1(rc, probs);
++ RC_BIT_1(rc, probs)
+ probs += kLenNumLowSymbols;
+- RC_BIT_PRE(rc, probs);
++ RC_BIT_PRE(rc, probs)
+ if (sym >= kLenNumLowSymbols * 2)
+ {
+- RC_BIT_1(rc, probs);
++ RC_BIT_1(rc, probs)
+ rc->range = range;
+ // RcTree_Encode(rc, p->high, kLenNumHighBits, sym - kLenNumLowSymbols * 2);
+ LitEnc_Encode(rc, p->high, sym - kLenNumLowSymbols * 2);
+@@ -965,11 +951,11 @@ static void LenEnc_Encode(CLenEnc *p, CR
+ {
+ unsigned m;
+ unsigned bit;
+- RC_BIT_0(rc, probs);
++ RC_BIT_0(rc, probs)
+ probs += (posState << (1 + kLenNumLowBits));
+- bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit); m = (1 << 1) + bit;
+- bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit); m = (m << 1) + bit;
+- bit = sym & 1; RC_BIT(rc, probs + m, bit);
++ bit = (sym >> 2) ; RC_BIT(rc, probs + 1, bit) m = (1 << 1) + bit;
++ bit = (sym >> 1) & 1; RC_BIT(rc, probs + m, bit) m = (m << 1) + bit;
++ bit = sym & 1; RC_BIT(rc, probs + m, bit)
+ rc->range = range;
+ }
+ }
+@@ -990,7 +976,7 @@ static void SetPrices_3(const CLzmaProb
+ }
+
+
+-MY_NO_INLINE static void MY_FAST_CALL LenPriceEnc_UpdateTables(
++Z7_NO_INLINE static void Z7_FASTCALL LenPriceEnc_UpdateTables(
+ CLenPriceEnc *p,
+ unsigned numPosStates,
+ const CLenEnc *enc,
+@@ -1054,14 +1040,14 @@ MY_NO_INLINE static void MY_FAST_CALL Le
+ UInt32 price = b;
+ do
+ {
+- unsigned bit = sym & 1;
++ const unsigned bit = sym & 1;
+ sym >>= 1;
+ price += GET_PRICEa(probs[sym], bit);
+ }
+ while (sym >= 2);
+
+ {
+- unsigned prob = probs[(size_t)i + (1 << (kLenNumHighBits - 1))];
++ const unsigned prob = probs[(size_t)i + (1 << (kLenNumHighBits - 1))];
+ prices[(size_t)i * 2 ] = price + GET_PRICEa_0(prob);
+ prices[(size_t)i * 2 + 1] = price + GET_PRICEa_1(prob);
+ }
+@@ -1070,7 +1056,7 @@ MY_NO_INLINE static void MY_FAST_CALL Le
+
+ {
+ unsigned posState;
+- size_t num = (p->tableSize - kLenNumLowSymbols * 2) * sizeof(p->prices[0][0]);
++ const size_t num = (p->tableSize - kLenNumLowSymbols * 2) * sizeof(p->prices[0][0]);
+ for (posState = 1; posState < numPosStates; posState++)
+ memcpy(p->prices[posState] + kLenNumLowSymbols * 2, p->prices[0] + kLenNumLowSymbols * 2, num);
+ }
+@@ -1152,7 +1138,7 @@ static unsigned ReadMatchDistances(CLzma
+ + GET_PRICE_1(p->isRep[state]) \
+ + GET_PRICE_0(p->isRepG0[state])
+
+-MY_FORCE_INLINE
++Z7_FORCE_INLINE
+ static UInt32 GetPrice_PureRep(const CLzmaEnc *p, unsigned repIndex, size_t state, size_t posState)
+ {
+ UInt32 price;
+@@ -1331,7 +1317,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ LitEnc_GetPrice(probs, curByte, p->ProbPrices));
+ }
+
+- MakeAs_Lit(&p->opt[1]);
++ MakeAs_Lit(&p->opt[1])
+
+ matchPrice = GET_PRICE_1(p->isMatch[p->state][posState]);
+ repMatchPrice = matchPrice + GET_PRICE_1(p->isRep[p->state]);
+@@ -1343,7 +1329,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ if (shortRepPrice < p->opt[1].price)
+ {
+ p->opt[1].price = shortRepPrice;
+- MakeAs_ShortRep(&p->opt[1]);
++ MakeAs_ShortRep(&p->opt[1])
+ }
+ if (last < 2)
+ {
+@@ -1410,7 +1396,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ else
+ {
+ unsigned slot;
+- GetPosSlot2(dist, slot);
++ GetPosSlot2(dist, slot)
+ price += p->alignPrices[dist & kAlignMask];
+ price += p->posSlotPrices[lenToPosState][slot];
+ }
+@@ -1486,7 +1472,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ unsigned delta = best - cur;
+ if (delta != 0)
+ {
+- MOVE_POS(p, delta);
++ MOVE_POS(p, delta)
+ }
+ }
+ cur = best;
+@@ -1633,7 +1619,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ {
+ nextOpt->price = litPrice;
+ nextOpt->len = 1;
+- MakeAs_Lit(nextOpt);
++ MakeAs_Lit(nextOpt)
+ nextIsLit = True;
+ }
+ }
+@@ -1667,7 +1653,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ {
+ nextOpt->price = shortRepPrice;
+ nextOpt->len = 1;
+- MakeAs_ShortRep(nextOpt);
++ MakeAs_ShortRep(nextOpt)
+ nextIsLit = False;
+ }
+ }
+@@ -1871,7 +1857,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ dist = MATCHES[(size_t)offs + 1];
+
+ // if (dist >= kNumFullDistances)
+- GetPosSlot2(dist, posSlot);
++ GetPosSlot2(dist, posSlot)
+
+ for (len = /*2*/ startLen; ; len++)
+ {
+@@ -1962,7 +1948,7 @@ static unsigned GetOptimum(CLzmaEnc *p,
+ break;
+ dist = MATCHES[(size_t)offs + 1];
+ // if (dist >= kNumFullDistances)
+- GetPosSlot2(dist, posSlot);
++ GetPosSlot2(dist, posSlot)
+ }
+ }
+ }
+@@ -2138,7 +2124,7 @@ static void WriteEndMarker(CLzmaEnc *p,
+ {
+ UInt32 ttt, newBound;
+ RC_BIT_PRE(p, probs + m)
+- RC_BIT_1(&p->rc, probs + m);
++ RC_BIT_1(&p->rc, probs + m)
+ m = (m << 1) + 1;
+ }
+ while (m < (1 << kNumPosSlotBits));
+@@ -2163,7 +2149,7 @@ static void WriteEndMarker(CLzmaEnc *p,
+ {
+ UInt32 ttt, newBound;
+ RC_BIT_PRE(p, probs + m)
+- RC_BIT_1(&p->rc, probs + m);
++ RC_BIT_1(&p->rc, probs + m)
+ m = (m << 1) + 1;
+ }
+ while (m < kAlignTableSize);
+@@ -2179,7 +2165,7 @@ static SRes CheckErrors(CLzmaEnc *p)
+ if (p->rc.res != SZ_OK)
+ p->result = SZ_ERROR_WRITE;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ if (
+ // p->mf_Failure ||
+ (p->mtMode &&
+@@ -2187,7 +2173,7 @@ static SRes CheckErrors(CLzmaEnc *p)
+ p->matchFinderMt.failure_LZ_BT))
+ )
+ {
+- p->result = MY_HRES_ERROR__INTERNAL_ERROR;
++ p->result = MY_HRES_ERROR_INTERNAL_ERROR;
+ // printf("\nCheckErrors p->matchFinderMt.failureLZ\n");
+ }
+ #endif
+@@ -2201,7 +2187,7 @@ static SRes CheckErrors(CLzmaEnc *p)
+ }
+
+
+-MY_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
++Z7_NO_INLINE static SRes Flush(CLzmaEnc *p, UInt32 nowPos)
+ {
+ /* ReleaseMFStream(); */
+ p->finished = True;
+@@ -2213,7 +2199,7 @@ MY_NO_INLINE static SRes Flush(CLzmaEnc
+ }
+
+
+-MY_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
++Z7_NO_INLINE static void FillAlignPrices(CLzmaEnc *p)
+ {
+ unsigned i;
+ const CProbPrice *ProbPrices = p->ProbPrices;
+@@ -2237,7 +2223,7 @@ MY_NO_INLINE static void FillAlignPrices
+ }
+
+
+-MY_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
++Z7_NO_INLINE static void FillDistancesPrices(CLzmaEnc *p)
+ {
+ // int y; for (y = 0; y < 100; y++) {
+
+@@ -2337,7 +2323,7 @@ static void LzmaEnc_Construct(CLzmaEnc *
+ RangeEnc_Construct(&p->rc);
+ MatchFinder_Construct(&MFB);
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ p->matchFinderMt.MatchFinder = &MFB;
+ MatchFinderMt_Construct(&p->matchFinderMt);
+ #endif
+@@ -2345,7 +2331,7 @@ static void LzmaEnc_Construct(CLzmaEnc *
+ {
+ CLzmaEncProps props;
+ LzmaEncProps_Init(&props);
+- LzmaEnc_SetProps(p, &props);
++ LzmaEnc_SetProps((CLzmaEncHandle)(void *)p, &props);
+ }
+
+ #ifndef LZMA_LOG_BSR
+@@ -2376,7 +2362,7 @@ static void LzmaEnc_FreeLits(CLzmaEnc *p
+
+ static void LzmaEnc_Destruct(CLzmaEnc *p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ MatchFinderMt_Destruct(&p->matchFinderMt, allocBig);
+ #endif
+
+@@ -2387,21 +2373,22 @@ static void LzmaEnc_Destruct(CLzmaEnc *p
+
+ void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- LzmaEnc_Destruct((CLzmaEnc *)p, alloc, allocBig);
++ // GET_CLzmaEnc_p
++ LzmaEnc_Destruct(p, alloc, allocBig);
+ ISzAlloc_Free(alloc, p);
+ }
+
+
+-MY_NO_INLINE
++Z7_NO_INLINE
+ static SRes LzmaEnc_CodeOneBlock(CLzmaEnc *p, UInt32 maxPackSize, UInt32 maxUnpackSize)
+ {
+ UInt32 nowPos32, startPos32;
+ if (p->needInit)
+ {
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ if (p->mtMode)
+ {
+- RINOK(MatchFinderMt_InitMt(&p->matchFinderMt));
++ RINOK(MatchFinderMt_InitMt(&p->matchFinderMt))
+ }
+ #endif
+ p->matchFinder.Init(p->matchFinderObj);
+@@ -2410,7 +2397,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+
+ if (p->finished)
+ return p->result;
+- RINOK(CheckErrors(p));
++ RINOK(CheckErrors(p))
+
+ nowPos32 = (UInt32)p->nowPos64;
+ startPos32 = nowPos32;
+@@ -2473,7 +2460,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ const Byte *data;
+ unsigned state;
+
+- RC_BIT_0(&p->rc, probs);
++ RC_BIT_0(&p->rc, probs)
+ p->rc.range = range;
+ data = p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+ probs = LIT_PROBS(nowPos32, *(data - 1));
+@@ -2487,53 +2474,53 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ }
+ else
+ {
+- RC_BIT_1(&p->rc, probs);
++ RC_BIT_1(&p->rc, probs)
+ probs = &p->isRep[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+
+ if (dist < LZMA_NUM_REPS)
+ {
+- RC_BIT_1(&p->rc, probs);
++ RC_BIT_1(&p->rc, probs)
+ probs = &p->isRepG0[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 0)
+ {
+- RC_BIT_0(&p->rc, probs);
++ RC_BIT_0(&p->rc, probs)
+ probs = &p->isRep0Long[p->state][posState];
+ RC_BIT_PRE(&p->rc, probs)
+ if (len != 1)
+ {
+- RC_BIT_1_BASE(&p->rc, probs);
++ RC_BIT_1_BASE(&p->rc, probs)
+ }
+ else
+ {
+- RC_BIT_0_BASE(&p->rc, probs);
++ RC_BIT_0_BASE(&p->rc, probs)
+ p->state = kShortRepNextStates[p->state];
+ }
+ }
+ else
+ {
+- RC_BIT_1(&p->rc, probs);
++ RC_BIT_1(&p->rc, probs)
+ probs = &p->isRepG1[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 1)
+ {
+- RC_BIT_0_BASE(&p->rc, probs);
++ RC_BIT_0_BASE(&p->rc, probs)
+ dist = p->reps[1];
+ }
+ else
+ {
+- RC_BIT_1(&p->rc, probs);
++ RC_BIT_1(&p->rc, probs)
+ probs = &p->isRepG2[p->state];
+ RC_BIT_PRE(&p->rc, probs)
+ if (dist == 2)
+ {
+- RC_BIT_0_BASE(&p->rc, probs);
++ RC_BIT_0_BASE(&p->rc, probs)
+ dist = p->reps[2];
+ }
+ else
+ {
+- RC_BIT_1_BASE(&p->rc, probs);
++ RC_BIT_1_BASE(&p->rc, probs)
+ dist = p->reps[3];
+ p->reps[3] = p->reps[2];
+ }
+@@ -2557,7 +2544,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ else
+ {
+ unsigned posSlot;
+- RC_BIT_0(&p->rc, probs);
++ RC_BIT_0(&p->rc, probs)
+ p->rc.range = range;
+ p->state = kMatchNextStates[p->state];
+
+@@ -2571,7 +2558,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ p->reps[0] = dist + 1;
+
+ p->matchPriceCount++;
+- GetPosSlot(dist, posSlot);
++ GetPosSlot(dist, posSlot)
+ // RcTree_Encode_PosSlot(&p->rc, p->posSlotEncoder[GetLenToPosState(len)], posSlot);
+ {
+ UInt32 sym = (UInt32)posSlot + (1 << kNumPosSlotBits);
+@@ -2582,7 +2569,7 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ CLzmaProb *prob = probs + (sym >> kNumPosSlotBits);
+ UInt32 bit = (sym >> (kNumPosSlotBits - 1)) & 1;
+ sym <<= 1;
+- RC_BIT(&p->rc, prob, bit);
++ RC_BIT(&p->rc, prob, bit)
+ }
+ while (sym < (1 << kNumPosSlotBits * 2));
+ p->rc.range = range;
+@@ -2626,10 +2613,10 @@ static SRes LzmaEnc_CodeOneBlock(CLzmaEn
+ {
+ unsigned m = 1;
+ unsigned bit;
+- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+- bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit); m = (m << 1) + bit;
+- bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit);
++ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
++ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
++ bit = dist & 1; dist >>= 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit) m = (m << 1) + bit;
++ bit = dist & 1; RC_BIT(&p->rc, p->posAlignEncoder + m, bit)
+ p->rc.range = range;
+ // p->alignPriceCount++;
+ }
+@@ -2704,17 +2691,17 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U
+ if (!RangeEnc_Alloc(&p->rc, alloc))
+ return SZ_ERROR_MEM;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ p->mtMode = (p->multiThread && !p->fastMode && (MFB.btMode != 0));
+ #endif
+
+ {
+- unsigned lclp = p->lc + p->lp;
++ const unsigned lclp = p->lc + p->lp;
+ if (!p->litProbs || !p->saveState.litProbs || p->lclp != lclp)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+- p->litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
+- p->saveState.litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((UInt32)0x300 << lclp) * sizeof(CLzmaProb));
++ p->litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((size_t)0x300 * sizeof(CLzmaProb)) << lclp);
++ p->saveState.litProbs = (CLzmaProb *)ISzAlloc_Alloc(alloc, ((size_t)0x300 * sizeof(CLzmaProb)) << lclp);
+ if (!p->litProbs || !p->saveState.litProbs)
+ {
+ LzmaEnc_FreeLits(p, alloc);
+@@ -2748,15 +2735,14 @@ static SRes LzmaEnc_Alloc(CLzmaEnc *p, U
+ (numFastBytes + LZMA_MATCH_LEN_MAX + 1)
+ */
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ if (p->mtMode)
+ {
+ RINOK(MatchFinderMt_Create(&p->matchFinderMt, dictSize, beforeSize,
+ p->numFastBytes, LZMA_MATCH_LEN_MAX + 1 /* 18.04 */
+- , allocBig));
++ , allocBig))
+ p->matchFinderObj = &p->matchFinderMt;
+- MFB.bigHash = (Byte)(
+- (p->dictSize > kBigHashDicLimit && MFB.hashMask >= 0xFFFFFF) ? 1 : 0);
++ MFB.bigHash = (Byte)(MFB.hashMask >= 0xFFFFFF ? 1 : 0);
+ MatchFinderMt_CreateVTable(&p->matchFinderMt, &p->matchFinder);
+ }
+ else
+@@ -2816,8 +2802,8 @@ static void LzmaEnc_Init(CLzmaEnc *p)
+ }
+
+ {
+- UInt32 num = (UInt32)0x300 << (p->lp + p->lc);
+- UInt32 k;
++ const size_t num = (size_t)0x300 << (p->lp + p->lc);
++ size_t k;
+ CLzmaProb *probs = p->litProbs;
+ for (k = 0; k < num; k++)
+ probs[k] = kProbInitValue;
+@@ -2872,59 +2858,53 @@ static SRes LzmaEnc_AllocAndInit(CLzmaEn
+
+ p->finished = False;
+ p->result = SZ_OK;
+- RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig));
++ p->nowPos64 = 0;
++ p->needInit = 1;
++ RINOK(LzmaEnc_Alloc(p, keepWindowSize, alloc, allocBig))
+ LzmaEnc_Init(p);
+ LzmaEnc_InitPrices(p);
+- p->nowPos64 = 0;
+ return SZ_OK;
+ }
+
+-static SRes LzmaEnc_Prepare(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream,
++static SRes LzmaEnc_Prepare(CLzmaEncHandle p,
++ ISeqOutStreamPtr outStream,
++ ISeqInStreamPtr inStream,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
+- MFB.stream = inStream;
+- p->needInit = 1;
++ // GET_CLzmaEnc_p
++ MatchFinder_SET_STREAM(&MFB, inStream)
+ p->rc.outStream = outStream;
+ return LzmaEnc_AllocAndInit(p, 0, alloc, allocBig);
+ }
+
+-SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle pp,
+- ISeqInStream *inStream, UInt32 keepWindowSize,
++SRes LzmaEnc_PrepareForLzma2(CLzmaEncHandle p,
++ ISeqInStreamPtr inStream, UInt32 keepWindowSize,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
+- MFB.stream = inStream;
+- p->needInit = 1;
++ // GET_CLzmaEnc_p
++ MatchFinder_SET_STREAM(&MFB, inStream)
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+ }
+
+-static void LzmaEnc_SetInputBuf(CLzmaEnc *p, const Byte *src, SizeT srcLen)
+-{
+- MFB.directInput = 1;
+- MFB.bufferBase = (Byte *)src;
+- MFB.directInputRem = srcLen;
+-}
+-
+-SRes LzmaEnc_MemPrepare(CLzmaEncHandle pp, const Byte *src, SizeT srcLen,
+- UInt32 keepWindowSize, ISzAllocPtr alloc, ISzAllocPtr allocBig)
++SRes LzmaEnc_MemPrepare(CLzmaEncHandle p,
++ const Byte *src, SizeT srcLen,
++ UInt32 keepWindowSize,
++ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
+- LzmaEnc_SetInputBuf(p, src, srcLen);
+- p->needInit = 1;
+-
+- LzmaEnc_SetDataSize(pp, srcLen);
++ // GET_CLzmaEnc_p
++ MatchFinder_SET_DIRECT_INPUT_BUF(&MFB, src, srcLen)
++ LzmaEnc_SetDataSize(p, srcLen);
+ return LzmaEnc_AllocAndInit(p, keepWindowSize, alloc, allocBig);
+ }
+
+-void LzmaEnc_Finish(CLzmaEncHandle pp)
++void LzmaEnc_Finish(CLzmaEncHandle p)
+ {
+- #ifndef _7ZIP_ST
+- CLzmaEnc *p = (CLzmaEnc *)pp;
++ #ifndef Z7_ST
++ // GET_CLzmaEnc_p
+ if (p->mtMode)
+ MatchFinderMt_ReleaseStream(&p->matchFinderMt);
+ #else
+- UNUSED_VAR(pp);
++ UNUSED_VAR(p)
+ #endif
+ }
+
+@@ -2933,13 +2913,13 @@ typedef struct
+ {
+ ISeqOutStream vt;
+ Byte *data;
+- SizeT rem;
++ size_t rem;
+ BoolInt overflow;
+ } CLzmaEnc_SeqOutStreamBuf;
+
+-static size_t SeqOutStreamBuf_Write(const ISeqOutStream *pp, const void *data, size_t size)
++static size_t SeqOutStreamBuf_Write(ISeqOutStreamPtr pp, const void *data, size_t size)
+ {
+- CLzmaEnc_SeqOutStreamBuf *p = CONTAINER_FROM_VTBL(pp, CLzmaEnc_SeqOutStreamBuf, vt);
++ Z7_CONTAINER_FROM_VTBL_TO_DECL_VAR_pp_vt_p(CLzmaEnc_SeqOutStreamBuf)
+ if (p->rem < size)
+ {
+ size = p->rem;
+@@ -2956,25 +2936,25 @@ static size_t SeqOutStreamBuf_Write(cons
+
+
+ /*
+-UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle pp)
++UInt32 LzmaEnc_GetNumAvailableBytes(CLzmaEncHandle p)
+ {
+- const CLzmaEnc *p = (CLzmaEnc *)pp;
++ GET_const_CLzmaEnc_p
+ return p->matchFinder.GetNumAvailableBytes(p->matchFinderObj);
+ }
+ */
+
+-const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle pp)
++const Byte *LzmaEnc_GetCurBuf(CLzmaEncHandle p)
+ {
+- const CLzmaEnc *p = (CLzmaEnc *)pp;
++ // GET_const_CLzmaEnc_p
+ return p->matchFinder.GetPointerToCurrentPos(p->matchFinderObj) - p->additionalOffset;
+ }
+
+
+ // (desiredPackSize == 0) is not allowed
+-SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
++SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle p, BoolInt reInit,
+ Byte *dest, size_t *destLen, UInt32 desiredPackSize, UInt32 *unpackSize)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)pp;
++ // GET_CLzmaEnc_p
+ UInt64 nowPos64;
+ SRes res;
+ CLzmaEnc_SeqOutStreamBuf outStream;
+@@ -3006,12 +2986,12 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHan
+ }
+
+
+-MY_NO_INLINE
+-static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgress *progress)
++Z7_NO_INLINE
++static SRes LzmaEnc_Encode2(CLzmaEnc *p, ICompressProgressPtr progress)
+ {
+ SRes res = SZ_OK;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ Byte allocaDummy[0x300];
+ allocaDummy[0] = 0;
+ allocaDummy[1] = allocaDummy[0];
+@@ -3033,7 +3013,7 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p,
+ }
+ }
+
+- LzmaEnc_Finish(p);
++ LzmaEnc_Finish((CLzmaEncHandle)(void *)p);
+
+ /*
+ if (res == SZ_OK && !Inline_MatchFinder_IsFinishedOK(&MFB))
+@@ -3045,21 +3025,22 @@ static SRes LzmaEnc_Encode2(CLzmaEnc *p,
+ }
+
+
+-SRes LzmaEnc_Encode(CLzmaEncHandle pp, ISeqOutStream *outStream, ISeqInStream *inStream, ICompressProgress *progress,
++SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream, ICompressProgressPtr progress,
+ ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- RINOK(LzmaEnc_Prepare(pp, outStream, inStream, alloc, allocBig));
+- return LzmaEnc_Encode2((CLzmaEnc *)pp, progress);
++ // GET_CLzmaEnc_p
++ RINOK(LzmaEnc_Prepare(p, outStream, inStream, alloc, allocBig))
++ return LzmaEnc_Encode2(p, progress);
+ }
+
+
+-SRes LzmaEnc_WriteProperties(CLzmaEncHandle pp, Byte *props, SizeT *size)
++SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *props, SizeT *size)
+ {
+ if (*size < LZMA_PROPS_SIZE)
+ return SZ_ERROR_PARAM;
+ *size = LZMA_PROPS_SIZE;
+ {
+- const CLzmaEnc *p = (const CLzmaEnc *)pp;
++ // GET_CLzmaEnc_p
+ const UInt32 dictSize = p->dictSize;
+ UInt32 v;
+ props[0] = (Byte)((p->pb * 5 + p->lp) * 9 + p->lc);
+@@ -3083,23 +3064,24 @@ SRes LzmaEnc_WriteProperties(CLzmaEncHan
+ while (v < dictSize);
+ }
+
+- SetUi32(props + 1, v);
++ SetUi32(props + 1, v)
+ return SZ_OK;
+ }
+ }
+
+
+-unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle pp)
++unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p)
+ {
+- return (unsigned)((CLzmaEnc *)pp)->writeEndMark;
++ // GET_CLzmaEnc_p
++ return (unsigned)p->writeEndMark;
+ }
+
+
+-SRes LzmaEnc_MemEncode(CLzmaEncHandle pp, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+- int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
++SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
++ int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+ SRes res;
+- CLzmaEnc *p = (CLzmaEnc *)pp;
++ // GET_CLzmaEnc_p
+
+ CLzmaEnc_SeqOutStreamBuf outStream;
+
+@@ -3111,7 +3093,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
+ p->writeEndMark = writeEndMark;
+ p->rc.outStream = &outStream.vt;
+
+- res = LzmaEnc_MemPrepare(pp, src, srcLen, 0, alloc, allocBig);
++ res = LzmaEnc_MemPrepare(p, src, srcLen, 0, alloc, allocBig);
+
+ if (res == SZ_OK)
+ {
+@@ -3120,7 +3102,7 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
+ res = SZ_ERROR_FAIL;
+ }
+
+- *destLen -= outStream.rem;
++ *destLen -= (SizeT)outStream.rem;
+ if (outStream.overflow)
+ return SZ_ERROR_OUTPUT_EOF;
+ return res;
+@@ -3129,9 +3111,9 @@ SRes LzmaEnc_MemEncode(CLzmaEncHandle pp
+
+ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
++ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig)
+ {
+- CLzmaEnc *p = (CLzmaEnc *)LzmaEnc_Create(alloc);
++ CLzmaEncHandle p = LzmaEnc_Create(alloc);
+ SRes res;
+ if (!p)
+ return SZ_ERROR_MEM;
+@@ -3151,10 +3133,10 @@ SRes LzmaEncode(Byte *dest, SizeT *destL
+
+
+ /*
+-#ifndef _7ZIP_ST
+-void LzmaEnc_GetLzThreads(CLzmaEncHandle pp, HANDLE lz_threads[2])
++#ifndef Z7_ST
++void LzmaEnc_GetLzThreads(CLzmaEncHandle p, HANDLE lz_threads[2])
+ {
+- const CLzmaEnc *p = (CLzmaEnc *)pp;
++ GET_const_CLzmaEnc_p
+ lz_threads[0] = p->matchFinderMt.hashSync.thread;
+ lz_threads[1] = p->matchFinderMt.btSync.thread;
+ }
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.h b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.h
new file mode 100644
index 0000000000..eb91c64fe7
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaEnc.h
@@ -0,0 +1,76 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaEnc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaEnc.h
+@@ -1,8 +1,8 @@
+ /* LzmaEnc.h -- LZMA Encoder
+-2019-10-30 : Igor Pavlov : Public domain */
++2023-04-13 : Igor Pavlov : Public domain */
+
+-#ifndef __LZMA_ENC_H
+-#define __LZMA_ENC_H
++#ifndef ZIP7_INC_LZMA_ENC_H
++#define ZIP7_INC_LZMA_ENC_H
+
+ #include "7zTypes.h"
+
+@@ -10,7 +10,7 @@ EXTERN_C_BEGIN
+
+ #define LZMA_PROPS_SIZE 5
+
+-typedef struct _CLzmaEncProps
++typedef struct
+ {
+ int level; /* 0 <= level <= 9 */
+ UInt32 dictSize; /* (1 << 12) <= dictSize <= (1 << 27) for 32-bit version
+@@ -23,10 +23,13 @@ typedef struct _CLzmaEncProps
+ int fb; /* 5 <= fb <= 273, default = 32 */
+ int btMode; /* 0 - hashChain Mode, 1 - binTree mode - normal, default = 1 */
+ int numHashBytes; /* 2, 3 or 4, default = 4 */
++ unsigned numHashOutBits; /* default = ? */
+ UInt32 mc; /* 1 <= mc <= (1 << 30), default = 32 */
+ unsigned writeEndMark; /* 0 - do not write EOPM, 1 - write EOPM, default = 0 */
+ int numThreads; /* 1 or 2, default = 2 */
+
++ // int _pad;
++
+ UInt64 reduceSize; /* estimated size of data that will be compressed. default = (UInt64)(Int64)-1.
+ Encoder uses this value to reduce dictionary size */
+
+@@ -51,7 +54,9 @@ SRes:
+ SZ_ERROR_THREAD - error in multithreading functions (only for Mt version)
+ */
+
+-typedef void * CLzmaEncHandle;
++typedef struct CLzmaEnc CLzmaEnc;
++typedef CLzmaEnc * CLzmaEncHandle;
++// Z7_DECLARE_HANDLE(CLzmaEncHandle)
+
+ CLzmaEncHandle LzmaEnc_Create(ISzAllocPtr alloc);
+ void LzmaEnc_Destroy(CLzmaEncHandle p, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+@@ -61,17 +66,17 @@ void LzmaEnc_SetDataSize(CLzmaEncHandle
+ SRes LzmaEnc_WriteProperties(CLzmaEncHandle p, Byte *properties, SizeT *size);
+ unsigned LzmaEnc_IsWriteEndMark(CLzmaEncHandle p);
+
+-SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStream *outStream, ISeqInStream *inStream,
+- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
++SRes LzmaEnc_Encode(CLzmaEncHandle p, ISeqOutStreamPtr outStream, ISeqInStreamPtr inStream,
++ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+ SRes LzmaEnc_MemEncode(CLzmaEncHandle p, Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+- int writeEndMark, ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
++ int writeEndMark, ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+
+
+ /* ---------- One Call Interface ---------- */
+
+ SRes LzmaEncode(Byte *dest, SizeT *destLen, const Byte *src, SizeT srcLen,
+ const CLzmaEncProps *props, Byte *propsEncoded, SizeT *propsSize, int writeEndMark,
+- ICompressProgress *progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
++ ICompressProgressPtr progress, ISzAllocPtr alloc, ISzAllocPtr allocBig);
+
+ EXTERN_C_END
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.c b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.c
new file mode 100644
index 0000000000..fb5399d26c
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.c
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaLib.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaLib.c
+@@ -1,12 +1,14 @@
+ /* LzmaLib.c -- LZMA library wrapper
+-2015-06-13 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
++
++#include "Precomp.h"
+
+ #include "Alloc.h"
+ #include "LzmaDec.h"
+ #include "LzmaEnc.h"
+ #include "LzmaLib.h"
+
+-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
++Z7_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
+ unsigned char *outProps, size_t *outPropsSize,
+ int level, /* 0 <= level <= 9, default = 5 */
+ unsigned dictSize, /* use (1 << N) or (3 << N). 4 KB < dictSize <= 128 MB */
+@@ -32,7 +34,7 @@ MY_STDAPI LzmaCompress(unsigned char *de
+ }
+
+
+-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
++Z7_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t *srcLen,
+ const unsigned char *props, size_t propsSize)
+ {
+ ELzmaStatus status;
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.h b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.h
new file mode 100644
index 0000000000..03926887a9
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_LzmaLib.h
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/LzmaLib.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/LzmaLib.h
+@@ -1,14 +1,14 @@
+ /* LzmaLib.h -- LZMA library interface
+-2021-04-03 : Igor Pavlov : Public domain */
++2023-04-02 : Igor Pavlov : Public domain */
+
+-#ifndef __LZMA_LIB_H
+-#define __LZMA_LIB_H
++#ifndef ZIP7_INC_LZMA_LIB_H
++#define ZIP7_INC_LZMA_LIB_H
+
+ #include "7zTypes.h"
+
+ EXTERN_C_BEGIN
+
+-#define MY_STDAPI int MY_STD_CALL
++#define Z7_STDAPI int Z7_STDCALL
+
+ #define LZMA_PROPS_SIZE 5
+
+@@ -100,7 +100,7 @@ Returns:
+ SZ_ERROR_THREAD - errors in multithreading functions (only for Mt version)
+ */
+
+-MY_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
++Z7_STDAPI LzmaCompress(unsigned char *dest, size_t *destLen, const unsigned char *src, size_t srcLen,
+ unsigned char *outProps, size_t *outPropsSize, /* *outPropsSize must be = 5 */
+ int level, /* 0 <= level <= 9, default = 5 */
+ unsigned dictSize, /* default = (1 << 24) */
+@@ -130,7 +130,7 @@ Returns:
+ SZ_ERROR_INPUT_EOF - it needs more bytes in input buffer (src)
+ */
+
+-MY_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
++Z7_STDAPI LzmaUncompress(unsigned char *dest, size_t *destLen, const unsigned char *src, SizeT *srcLen,
+ const unsigned char *props, size_t propsSize);
+
+ EXTERN_C_END
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Precomp.h b/electron34/patches/patch-third__party_lzma__sdk_C_Precomp.h
new file mode 100644
index 0000000000..6d6e84fc17
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Precomp.h
@@ -0,0 +1,141 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Precomp.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Precomp.h
+@@ -1,10 +1,127 @@
+-/* Precomp.h -- StdAfx
+-2013-11-12 : Igor Pavlov : Public domain */
++/* Precomp.h -- precompilation file
++2024-01-25 : Igor Pavlov : Public domain */
+
+-#ifndef __7Z_PRECOMP_H
+-#define __7Z_PRECOMP_H
++#ifndef ZIP7_INC_PRECOMP_H
++#define ZIP7_INC_PRECOMP_H
++
++/*
++ this file must be included before another *.h files and before <windows.h>.
++ this file is included from the following files:
++ C\*.c
++ C\Util\*\Precomp.h <- C\Util\*\*.c
++ CPP\Common\Common.h <- *\StdAfx.h <- *\*.cpp
++
++ this file can set the following macros:
++ Z7_LARGE_PAGES 1
++ Z7_LONG_PATH 1
++ Z7_WIN32_WINNT_MIN 0x0500 (or higher) : we require at least win2000+ for 7-Zip
++ _WIN32_WINNT 0x0500 (or higher)
++ WINVER _WIN32_WINNT
++ UNICODE 1
++ _UNICODE 1
++*/
+
+ #include "Compiler.h"
+-/* #include "7zTypes.h" */
++
++#ifdef _MSC_VER
++// #pragma warning(disable : 4206) // nonstandard extension used : translation unit is empty
++#if _MSC_VER >= 1912
++// #pragma warning(disable : 5039) // pointer or reference to potentially throwing function passed to 'extern "C"' function under - EHc.Undefined behavior may occur if this function throws an exception.
++#endif
++#endif
++
++/*
++// for debug:
++#define UNICODE 1
++#define _UNICODE 1
++#define _WIN32_WINNT 0x0500 // win2000
++#ifndef WINVER
++ #define WINVER _WIN32_WINNT
++#endif
++*/
++
++#ifdef _WIN32
++/*
++ this "Precomp.h" file must be included before <windows.h>,
++ if we want to define _WIN32_WINNT before <windows.h>.
++*/
++
++#ifndef Z7_LARGE_PAGES
++#ifndef Z7_NO_LARGE_PAGES
++#define Z7_LARGE_PAGES 1
++#endif
++#endif
++
++#ifndef Z7_LONG_PATH
++#ifndef Z7_NO_LONG_PATH
++#define Z7_LONG_PATH 1
++#endif
++#endif
++
++#ifndef Z7_DEVICE_FILE
++#ifndef Z7_NO_DEVICE_FILE
++// #define Z7_DEVICE_FILE 1
++#endif
++#endif
++
++// we don't change macros if included after <windows.h>
++#ifndef _WINDOWS_
++
++#ifndef Z7_WIN32_WINNT_MIN
++ #if defined(_M_ARM64) || defined(__aarch64__)
++ // #define Z7_WIN32_WINNT_MIN 0x0a00 // win10
++ #define Z7_WIN32_WINNT_MIN 0x0600 // vista
++ #elif defined(_M_ARM) && defined(_M_ARMT) && defined(_M_ARM_NT)
++ // #define Z7_WIN32_WINNT_MIN 0x0602 // win8
++ #define Z7_WIN32_WINNT_MIN 0x0600 // vista
++ #elif defined(_M_X64) || defined(_M_AMD64) || defined(__x86_64__) || defined(_M_IA64)
++ #define Z7_WIN32_WINNT_MIN 0x0503 // win2003
++ // #elif defined(_M_IX86) || defined(__i386__)
++ // #define Z7_WIN32_WINNT_MIN 0x0500 // win2000
++ #else // x86 and another(old) systems
++ #define Z7_WIN32_WINNT_MIN 0x0500 // win2000
++ // #define Z7_WIN32_WINNT_MIN 0x0502 // win2003 // for debug
++ #endif
++#endif // Z7_WIN32_WINNT_MIN
++
++
++#ifndef Z7_DO_NOT_DEFINE_WIN32_WINNT
++#ifdef _WIN32_WINNT
++ // #error Stop_Compiling_Bad_WIN32_WINNT
++#else
++ #ifndef Z7_NO_DEFINE_WIN32_WINNT
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++ #define _WIN32_WINNT Z7_WIN32_WINNT_MIN
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++ #endif
++#endif // _WIN32_WINNT
++
++#ifndef WINVER
++ #define WINVER _WIN32_WINNT
++#endif
++#endif // Z7_DO_NOT_DEFINE_WIN32_WINNT
++
++
++#ifndef _MBCS
++#ifndef Z7_NO_UNICODE
++// UNICODE and _UNICODE are used by <windows.h> and by 7-zip code.
++
++#ifndef UNICODE
++#define UNICODE 1
++#endif
++
++#ifndef _UNICODE
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++#define _UNICODE 1
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++#endif
++
++#endif // Z7_NO_UNICODE
++#endif // _MBCS
++#endif // _WINDOWS_
++
++// #include "7zWindows.h"
++
++#endif // _WIN32
+
+ #endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_RotateDefs.h b/electron34/patches/patch-third__party_lzma__sdk_C_RotateDefs.h
new file mode 100644
index 0000000000..9f58b6d8ce
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_RotateDefs.h
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/RotateDefs.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/RotateDefs.h
+@@ -1,14 +1,14 @@
+ /* RotateDefs.h -- Rotate functions
+-2015-03-25 : Igor Pavlov : Public domain */
++2023-06-18 : Igor Pavlov : Public domain */
+
+-#ifndef __ROTATE_DEFS_H
+-#define __ROTATE_DEFS_H
++#ifndef ZIP7_INC_ROTATE_DEFS_H
++#define ZIP7_INC_ROTATE_DEFS_H
+
+ #ifdef _MSC_VER
+
+ #include <stdlib.h>
+
+-/* don't use _rotl with MINGW. It can insert slow call to function. */
++/* don't use _rotl with old MINGW. It can insert slow call to function. */
+
+ /* #if (_MSC_VER >= 1200) */
+ #pragma intrinsic(_rotl)
+@@ -18,12 +18,32 @@
+ #define rotlFixed(x, n) _rotl((x), (n))
+ #define rotrFixed(x, n) _rotr((x), (n))
+
++#if (_MSC_VER >= 1300)
++#define Z7_ROTL64(x, n) _rotl64((x), (n))
++#define Z7_ROTR64(x, n) _rotr64((x), (n))
++#else
++#define Z7_ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
++#define Z7_ROTR64(x, n) (((x) >> (n)) | ((x) << (64 - (n))))
++#endif
++
+ #else
+
+ /* new compilers can translate these macros to fast commands. */
+
++#if defined(__clang__) && (__clang_major__ >= 4) \
++ || defined(__GNUC__) && (__GNUC__ >= 5)
++/* GCC 4.9.0 and clang 3.5 can recognize more correct version: */
++#define rotlFixed(x, n) (((x) << (n)) | ((x) >> (-(n) & 31)))
++#define rotrFixed(x, n) (((x) >> (n)) | ((x) << (-(n) & 31)))
++#define Z7_ROTL64(x, n) (((x) << (n)) | ((x) >> (-(n) & 63)))
++#define Z7_ROTR64(x, n) (((x) >> (n)) | ((x) << (-(n) & 63)))
++#else
++/* for old GCC / clang: */
+ #define rotlFixed(x, n) (((x) << (n)) | ((x) >> (32 - (n))))
+ #define rotrFixed(x, n) (((x) >> (n)) | ((x) << (32 - (n))))
++#define Z7_ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
++#define Z7_ROTR64(x, n) (((x) >> (n)) | ((x) << (64 - (n))))
++#endif
+
+ #endif
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.c b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.c
new file mode 100644
index 0000000000..0b7bc0a010
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.c
@@ -0,0 +1,564 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Sha256.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Sha256.c
+@@ -1,65 +1,60 @@
+ /* Sha256.c -- SHA-256 Hash
+-2021-04-01 : Igor Pavlov : Public domain
++: Igor Pavlov : Public domain
+ This code is based on public domain code from Wei Dai's Crypto++ library. */
+
+ #include "Precomp.h"
+
+ #include <string.h>
+
+-#include "CpuArch.h"
+-#include "RotateDefs.h"
+ #include "Sha256.h"
+-
+-#if defined(_MSC_VER) && (_MSC_VER < 1900)
+-// #define USE_MY_MM
+-#endif
++#include "RotateDefs.h"
++#include "CpuArch.h"
+
+ #ifdef MY_CPU_X86_OR_AMD64
+- #ifdef _MSC_VER
+- #if _MSC_VER >= 1200
+- #define _SHA_SUPPORTED
+- #endif
+- #elif defined(__clang__)
+- #if (__clang_major__ >= 8) // fix that check
+- #define _SHA_SUPPORTED
+- #endif
+- #elif defined(__GNUC__)
+- #if (__GNUC__ >= 8) // fix that check
+- #define _SHA_SUPPORTED
+- #endif
+- #elif defined(__INTEL_COMPILER)
+- #if (__INTEL_COMPILER >= 1800) // fix that check
+- #define _SHA_SUPPORTED
+- #endif
++ #if defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30800) \
++ || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 50100) \
++ || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900) \
++ || defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1600) \
++ || defined(_MSC_VER) && (_MSC_VER >= 1200)
++ #define Z7_COMPILER_SHA256_SUPPORTED
+ #endif
+-// TODO(crbug.com/1338627): Enable ARM optimizations
+-#elif 0 // defined(MY_CPU_ARM_OR_ARM64)
+- #ifdef _MSC_VER
+- #if _MSC_VER >= 1910
+- #define _SHA_SUPPORTED
++#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
++
++ #if defined(__ARM_FEATURE_SHA2) \
++ || defined(__ARM_FEATURE_CRYPTO)
++ #define Z7_COMPILER_SHA256_SUPPORTED
++ #else
++ #if defined(MY_CPU_ARM64) \
++ || defined(__ARM_ARCH) && (__ARM_ARCH >= 4) \
++ || defined(Z7_MSC_VER_ORIGINAL)
++ #if defined(__ARM_FP) && \
++ ( defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30800) \
++ || defined(__GNUC__) && (__GNUC__ >= 6) \
++ ) \
++ || defined(Z7_MSC_VER_ORIGINAL) && (_MSC_VER >= 1910)
++ #if defined(MY_CPU_ARM64) \
++ || !defined(Z7_CLANG_VERSION) \
++ || defined(__ARM_NEON) && \
++ (Z7_CLANG_VERSION < 170000 || \
++ Z7_CLANG_VERSION > 170001)
++ #define Z7_COMPILER_SHA256_SUPPORTED
+ #endif
+- #elif defined(__clang__)
+- #if (__clang_major__ >= 8) // fix that check
+- #define _SHA_SUPPORTED
+ #endif
+- #elif defined(__GNUC__)
+- #if (__GNUC__ >= 6) // fix that check
+- #define _SHA_SUPPORTED
+ #endif
+ #endif
+ #endif
+
+-void MY_FAST_CALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks);
++void Z7_FASTCALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks);
+
+-#ifdef _SHA_SUPPORTED
+- void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
++#ifdef Z7_COMPILER_SHA256_SUPPORTED
++ void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
+
+- static SHA256_FUNC_UPDATE_BLOCKS g_FUNC_UPDATE_BLOCKS = Sha256_UpdateBlocks;
+- static SHA256_FUNC_UPDATE_BLOCKS g_FUNC_UPDATE_BLOCKS_HW;
++ static SHA256_FUNC_UPDATE_BLOCKS g_SHA256_FUNC_UPDATE_BLOCKS = Sha256_UpdateBlocks;
++ static SHA256_FUNC_UPDATE_BLOCKS g_SHA256_FUNC_UPDATE_BLOCKS_HW;
+
+- #define UPDATE_BLOCKS(p) p->func_UpdateBlocks
++ #define SHA256_UPDATE_BLOCKS(p) p->v.vars.func_UpdateBlocks
+ #else
+- #define UPDATE_BLOCKS(p) Sha256_UpdateBlocks
++ #define SHA256_UPDATE_BLOCKS(p) Sha256_UpdateBlocks
+ #endif
+
+
+@@ -67,16 +62,16 @@ BoolInt Sha256_SetFunction(CSha256 *p, u
+ {
+ SHA256_FUNC_UPDATE_BLOCKS func = Sha256_UpdateBlocks;
+
+- #ifdef _SHA_SUPPORTED
++ #ifdef Z7_COMPILER_SHA256_SUPPORTED
+ if (algo != SHA256_ALGO_SW)
+ {
+ if (algo == SHA256_ALGO_DEFAULT)
+- func = g_FUNC_UPDATE_BLOCKS;
++ func = g_SHA256_FUNC_UPDATE_BLOCKS;
+ else
+ {
+ if (algo != SHA256_ALGO_HW)
+ return False;
+- func = g_FUNC_UPDATE_BLOCKS_HW;
++ func = g_SHA256_FUNC_UPDATE_BLOCKS_HW;
+ if (!func)
+ return False;
+ }
+@@ -86,24 +81,25 @@ BoolInt Sha256_SetFunction(CSha256 *p, u
+ return False;
+ #endif
+
+- p->func_UpdateBlocks = func;
++ p->v.vars.func_UpdateBlocks = func;
+ return True;
+ }
+
+
+ /* define it for speed optimization */
+
+-#ifdef _SFX
++#ifdef Z7_SFX
+ #define STEP_PRE 1
+ #define STEP_MAIN 1
+ #else
+ #define STEP_PRE 2
+ #define STEP_MAIN 4
+- // #define _SHA256_UNROLL
++ // #define Z7_SHA256_UNROLL
+ #endif
+
++#undef Z7_SHA256_BIG_W
+ #if STEP_MAIN != 16
+- #define _SHA256_BIG_W
++ #define Z7_SHA256_BIG_W
+ #endif
+
+
+@@ -111,7 +107,7 @@ BoolInt Sha256_SetFunction(CSha256 *p, u
+
+ void Sha256_InitState(CSha256 *p)
+ {
+- p->count = 0;
++ p->v.vars.count = 0;
+ p->state[0] = 0x6a09e667;
+ p->state[1] = 0xbb67ae85;
+ p->state[2] = 0x3c6ef372;
+@@ -122,21 +118,28 @@ void Sha256_InitState(CSha256 *p)
+ p->state[7] = 0x5be0cd19;
+ }
+
++
++
++
++
++
++
++
+ void Sha256_Init(CSha256 *p)
+ {
+- p->func_UpdateBlocks =
+- #ifdef _SHA_SUPPORTED
+- g_FUNC_UPDATE_BLOCKS;
++ p->v.vars.func_UpdateBlocks =
++ #ifdef Z7_COMPILER_SHA256_SUPPORTED
++ g_SHA256_FUNC_UPDATE_BLOCKS;
+ #else
+ NULL;
+ #endif
+ Sha256_InitState(p);
+ }
+
+-#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x, 22))
+-#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x, 25))
++#define S0(x) (rotrFixed(x, 2) ^ rotrFixed(x,13) ^ rotrFixed(x,22))
++#define S1(x) (rotrFixed(x, 6) ^ rotrFixed(x,11) ^ rotrFixed(x,25))
+ #define s0(x) (rotrFixed(x, 7) ^ rotrFixed(x,18) ^ (x >> 3))
+-#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >> 10))
++#define s1(x) (rotrFixed(x,17) ^ rotrFixed(x,19) ^ (x >>10))
+
+ #define Ch(x,y,z) (z^(x&(y^z)))
+ #define Maj(x,y,z) ((x&y)|(z&(x|y)))
+@@ -146,7 +149,7 @@ void Sha256_Init(CSha256 *p)
+
+ #define blk2_main(j, i) s1(w(j, (i)-2)) + w(j, (i)-7) + s0(w(j, (i)-15))
+
+-#ifdef _SHA256_BIG_W
++#ifdef Z7_SHA256_BIG_W
+ // we use +i instead of +(i) to change the order to solve CLANG compiler warning for signed/unsigned.
+ #define w(j, i) W[(size_t)(j) + i]
+ #define blk2(j, i) (w(j, i) = w(j, (i)-16) + blk2_main(j, i))
+@@ -177,7 +180,7 @@ void Sha256_Init(CSha256 *p)
+ #define R1_PRE(i) T1( W_PRE, i)
+ #define R1_MAIN(i) T1( W_MAIN, i)
+
+-#if (!defined(_SHA256_UNROLL) || STEP_MAIN < 8) && (STEP_MAIN >= 4)
++#if (!defined(Z7_SHA256_UNROLL) || STEP_MAIN < 8) && (STEP_MAIN >= 4)
+ #define R2_MAIN(i) \
+ R1_MAIN(i) \
+ R1_MAIN(i + 1) \
+@@ -186,7 +189,7 @@ void Sha256_Init(CSha256 *p)
+
+
+
+-#if defined(_SHA256_UNROLL) && STEP_MAIN >= 8
++#if defined(Z7_SHA256_UNROLL) && STEP_MAIN >= 8
+
+ #define T4( a,b,c,d,e,f,g,h, wx, i) \
+ h += S1(e) + Ch(e,f,g) + K[(i)+(size_t)(j)] + wx(i); \
+@@ -224,14 +227,10 @@ void Sha256_Init(CSha256 *p)
+
+ #endif
+
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
+
+-// static
+-extern MY_ALIGN(64)
+-const UInt32 SHA256_K_ARRAY[64];
+-
+-MY_ALIGN(64)
+-const UInt32 SHA256_K_ARRAY[64] = {
++extern
++MY_ALIGN(64) const UInt32 SHA256_K_ARRAY[64];
++MY_ALIGN(64) const UInt32 SHA256_K_ARRAY[64] = {
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5,
+ 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3,
+@@ -250,27 +249,29 @@ const UInt32 SHA256_K_ARRAY[64] = {
+ 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2
+ };
+
+-#define K SHA256_K_ARRAY
+
+
+-MY_NO_INLINE
+-void MY_FAST_CALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks)
++
++
++#define K SHA256_K_ARRAY
++
++Z7_NO_INLINE
++void Z7_FASTCALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks)
+ {
+ UInt32 W
+- #ifdef _SHA256_BIG_W
++#ifdef Z7_SHA256_BIG_W
+ [64];
+- #else
++#else
+ [16];
+- #endif
+-
++#endif
+ unsigned j;
+-
+ UInt32 a,b,c,d,e,f,g,h;
+-
+- #if !defined(_SHA256_UNROLL) || (STEP_MAIN <= 4) || (STEP_PRE <= 4)
++#if !defined(Z7_SHA256_UNROLL) || (STEP_MAIN <= 4) || (STEP_PRE <= 4)
+ UInt32 tmp;
+- #endif
++#endif
+
++ if (numBlocks == 0) return;
++
+ a = state[0];
+ b = state[1];
+ c = state[2];
+@@ -280,7 +281,7 @@ void MY_FAST_CALL Sha256_UpdateBlocks(UI
+ g = state[6];
+ h = state[7];
+
+- while (numBlocks)
++ do
+ {
+
+ for (j = 0; j < 16; j += STEP_PRE)
+@@ -298,12 +299,12 @@ void MY_FAST_CALL Sha256_UpdateBlocks(UI
+
+ #else
+
+- R1_PRE(0);
++ R1_PRE(0)
+ #if STEP_PRE >= 2
+- R1_PRE(1);
++ R1_PRE(1)
+ #if STEP_PRE >= 4
+- R1_PRE(2);
+- R1_PRE(3);
++ R1_PRE(2)
++ R1_PRE(3)
+ #endif
+ #endif
+
+@@ -312,32 +313,32 @@ void MY_FAST_CALL Sha256_UpdateBlocks(UI
+
+ for (j = 16; j < 64; j += STEP_MAIN)
+ {
+- #if defined(_SHA256_UNROLL) && STEP_MAIN >= 8
++ #if defined(Z7_SHA256_UNROLL) && STEP_MAIN >= 8
+
+ #if STEP_MAIN < 8
+- R4_MAIN(0);
++ R4_MAIN(0)
+ #else
+- R8_MAIN(0);
++ R8_MAIN(0)
+ #if STEP_MAIN == 16
+- R8_MAIN(8);
++ R8_MAIN(8)
+ #endif
+ #endif
+
+ #else
+
+- R1_MAIN(0);
++ R1_MAIN(0)
+ #if STEP_MAIN >= 2
+- R1_MAIN(1);
++ R1_MAIN(1)
+ #if STEP_MAIN >= 4
+- R2_MAIN(2);
++ R2_MAIN(2)
+ #if STEP_MAIN >= 8
+- R2_MAIN(4);
+- R2_MAIN(6);
++ R2_MAIN(4)
++ R2_MAIN(6)
+ #if STEP_MAIN >= 16
+- R2_MAIN(8);
+- R2_MAIN(10);
+- R2_MAIN(12);
+- R2_MAIN(14);
++ R2_MAIN(8)
++ R2_MAIN(10)
++ R2_MAIN(12)
++ R2_MAIN(14)
+ #endif
+ #endif
+ #endif
+@@ -354,40 +355,27 @@ void MY_FAST_CALL Sha256_UpdateBlocks(UI
+ g += state[6]; state[6] = g;
+ h += state[7]; state[7] = h;
+
+- data += 64;
+- numBlocks--;
++ data += SHA256_BLOCK_SIZE;
+ }
+-
+- /* Wipe variables */
+- /* memset(W, 0, sizeof(W)); */
++ while (--numBlocks);
+ }
+
+-#undef S0
+-#undef S1
+-#undef s0
+-#undef s1
+-#undef K
+
+-#define Sha256_UpdateBlock(p) UPDATE_BLOCKS(p)(p->state, p->buffer, 1)
++#define Sha256_UpdateBlock(p) SHA256_UPDATE_BLOCKS(p)(p->state, p->buffer, 1)
+
+ void Sha256_Update(CSha256 *p, const Byte *data, size_t size)
+ {
+ if (size == 0)
+ return;
+-
+ {
+- unsigned pos = (unsigned)p->count & 0x3F;
+- unsigned num;
+-
+- p->count += size;
+-
+- num = 64 - pos;
++ const unsigned pos = (unsigned)p->v.vars.count & (SHA256_BLOCK_SIZE - 1);
++ const unsigned num = SHA256_BLOCK_SIZE - pos;
++ p->v.vars.count += size;
+ if (num > size)
+ {
+ memcpy(p->buffer + pos, data, size);
+ return;
+ }
+-
+ if (pos != 0)
+ {
+ size -= num;
+@@ -397,9 +385,10 @@ void Sha256_Update(CSha256 *p, const Byt
+ }
+ }
+ {
+- size_t numBlocks = size >> 6;
+- UPDATE_BLOCKS(p)(p->state, data, numBlocks);
+- size &= 0x3F;
++ const size_t numBlocks = size >> 6;
++ // if (numBlocks)
++ SHA256_UPDATE_BLOCKS(p)(p->state, data, numBlocks);
++ size &= SHA256_BLOCK_SIZE - 1;
+ if (size == 0)
+ return;
+ data += (numBlocks << 6);
+@@ -410,78 +399,94 @@ void Sha256_Update(CSha256 *p, const Byt
+
+ void Sha256_Final(CSha256 *p, Byte *digest)
+ {
+- unsigned pos = (unsigned)p->count & 0x3F;
+- unsigned i;
+-
++ unsigned pos = (unsigned)p->v.vars.count & (SHA256_BLOCK_SIZE - 1);
+ p->buffer[pos++] = 0x80;
+-
+- if (pos > (64 - 8))
++ if (pos > (SHA256_BLOCK_SIZE - 4 * 2))
+ {
+- while (pos != 64) { p->buffer[pos++] = 0; }
+- // memset(&p->buf.buffer[pos], 0, 64 - pos);
++ while (pos != SHA256_BLOCK_SIZE) { p->buffer[pos++] = 0; }
++ // memset(&p->buf.buffer[pos], 0, SHA256_BLOCK_SIZE - pos);
+ Sha256_UpdateBlock(p);
+ pos = 0;
+ }
+-
+- /*
+- if (pos & 3)
++ memset(&p->buffer[pos], 0, (SHA256_BLOCK_SIZE - 4 * 2) - pos);
+ {
+- p->buffer[pos] = 0;
+- p->buffer[pos + 1] = 0;
+- p->buffer[pos + 2] = 0;
+- pos += 3;
+- pos &= ~3;
++ const UInt64 numBits = p->v.vars.count << 3;
++ SetBe32(p->buffer + SHA256_BLOCK_SIZE - 4 * 2, (UInt32)(numBits >> 32))
++ SetBe32(p->buffer + SHA256_BLOCK_SIZE - 4 * 1, (UInt32)(numBits))
+ }
++ Sha256_UpdateBlock(p);
++#if 1 && defined(MY_CPU_BE)
++ memcpy(digest, p->state, SHA256_DIGEST_SIZE);
++#else
+ {
+- for (; pos < 64 - 8; pos += 4)
+- *(UInt32 *)(&p->buffer[pos]) = 0;
++ unsigned i;
++ for (i = 0; i < 8; i += 2)
++ {
++ const UInt32 v0 = p->state[i];
++ const UInt32 v1 = p->state[(size_t)i + 1];
++ SetBe32(digest , v0)
++ SetBe32(digest + 4, v1)
++ digest += 4 * 2;
++ }
+ }
+- */
+
+- memset(&p->buffer[pos], 0, (64 - 8) - pos);
+
+- {
+- UInt64 numBits = (p->count << 3);
+- SetBe32(p->buffer + 64 - 8, (UInt32)(numBits >> 32));
+- SetBe32(p->buffer + 64 - 4, (UInt32)(numBits));
+- }
+-
+- Sha256_UpdateBlock(p);
+
+- for (i = 0; i < 8; i += 2)
+- {
+- UInt32 v0 = p->state[i];
+- UInt32 v1 = p->state[(size_t)i + 1];
+- SetBe32(digest , v0);
+- SetBe32(digest + 4, v1);
+- digest += 8;
+- }
+-
++
++#endif
+ Sha256_InitState(p);
+ }
+
+
+-void Sha256Prepare()
++void Sha256Prepare(void)
+ {
+- #ifdef _SHA_SUPPORTED
++#ifdef Z7_COMPILER_SHA256_SUPPORTED
+ SHA256_FUNC_UPDATE_BLOCKS f, f_hw;
+ f = Sha256_UpdateBlocks;
+ f_hw = NULL;
+- #ifdef MY_CPU_X86_OR_AMD64
+- #ifndef USE_MY_MM
++#ifdef MY_CPU_X86_OR_AMD64
+ if (CPU_IsSupported_SHA()
+ && CPU_IsSupported_SSSE3()
+- // && CPU_IsSupported_SSE41()
+ )
+- #endif
+- #else
++#else
+ if (CPU_IsSupported_SHA2())
+- #endif
++#endif
+ {
+ // printf("\n========== HW SHA256 ======== \n");
+ f = f_hw = Sha256_UpdateBlocks_HW;
+ }
+- g_FUNC_UPDATE_BLOCKS = f;
+- g_FUNC_UPDATE_BLOCKS_HW = f_hw;
+- #endif
++ g_SHA256_FUNC_UPDATE_BLOCKS = f;
++ g_SHA256_FUNC_UPDATE_BLOCKS_HW = f_hw;
++#endif
+ }
++
++#undef U64C
++#undef K
++#undef S0
++#undef S1
++#undef s0
++#undef s1
++#undef Ch
++#undef Maj
++#undef W_MAIN
++#undef W_PRE
++#undef w
++#undef blk2_main
++#undef blk2
++#undef T1
++#undef T4
++#undef T8
++#undef R1_PRE
++#undef R1_MAIN
++#undef R2_MAIN
++#undef R4
++#undef R4_PRE
++#undef R4_MAIN
++#undef R8
++#undef R8_PRE
++#undef R8_MAIN
++#undef STEP_PRE
++#undef STEP_MAIN
++#undef Z7_SHA256_BIG_W
++#undef Z7_SHA256_UNROLL
++#undef Z7_COMPILER_SHA256_SUPPORTED
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.h b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.h
new file mode 100644
index 0000000000..8bca6112a0
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256.h
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Sha256.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Sha256.h
+@@ -1,8 +1,8 @@
+ /* Sha256.h -- SHA-256 Hash
+-2021-01-01 : Igor Pavlov : Public domain */
++: Igor Pavlov : Public domain */
+
+-#ifndef __7Z_SHA256_H
+-#define __7Z_SHA256_H
++#ifndef ZIP7_INC_SHA256_H
++#define ZIP7_INC_SHA256_H
+
+ #include "7zTypes.h"
+
+@@ -14,7 +14,10 @@ EXTERN_C_BEGIN
+ #define SHA256_BLOCK_SIZE (SHA256_NUM_BLOCK_WORDS * 4)
+ #define SHA256_DIGEST_SIZE (SHA256_NUM_DIGEST_WORDS * 4)
+
+-typedef void (MY_FAST_CALL *SHA256_FUNC_UPDATE_BLOCKS)(UInt32 state[8], const Byte *data, size_t numBlocks);
++
++
++
++typedef void (Z7_FASTCALL *SHA256_FUNC_UPDATE_BLOCKS)(UInt32 state[8], const Byte *data, size_t numBlocks);
+
+ /*
+ if (the system supports different SHA256 code implementations)
+@@ -32,9 +35,16 @@ typedef void (MY_FAST_CALL *SHA256_FUNC_
+
+ typedef struct
+ {
+- SHA256_FUNC_UPDATE_BLOCKS func_UpdateBlocks;
+- UInt64 count;
+- UInt64 __pad_2[2];
++ union
++ {
++ struct
++ {
++ SHA256_FUNC_UPDATE_BLOCKS func_UpdateBlocks;
++ UInt64 count;
++ } vars;
++ UInt64 _pad_64bit[4];
++ void *_pad_align_ptr[2];
++ } v;
+ UInt32 state[SHA256_NUM_DIGEST_WORDS];
+
+ Byte buffer[SHA256_BLOCK_SIZE];
+@@ -62,7 +72,7 @@ void Sha256_Final(CSha256 *p, Byte *dige
+
+
+
+-// void MY_FAST_CALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks);
++// void Z7_FASTCALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks);
+
+ /*
+ call Sha256Prepare() once at program start.
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Sha256Opt.c b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256Opt.c
new file mode 100644
index 0000000000..d14b6f1325
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Sha256Opt.c
@@ -0,0 +1,535 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Sha256Opt.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Sha256Opt.c
+@@ -1,71 +1,53 @@
+ /* Sha256Opt.c -- SHA-256 optimized code for SHA-256 hardware instructions
+-2021-04-01 : Igor Pavlov : Public domain */
++: Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+-
+-#if defined(_MSC_VER)
+-#if (_MSC_VER < 1900) && (_MSC_VER >= 1200)
+-// #define USE_MY_MM
+-#endif
+-#endif
+-
++#include "Compiler.h"
+ #include "CpuArch.h"
+
++// #define Z7_USE_HW_SHA_STUB // for debug
+ #ifdef MY_CPU_X86_OR_AMD64
+- #if defined(__clang__)
+- #if (__clang_major__ >= 8) // fix that check
++ #if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1600) // fix that check
+ #define USE_HW_SHA
+- #ifndef __SHA__
+- #define ATTRIB_SHA __attribute__((__target__("sha,ssse3")))
+- #if defined(_MSC_VER)
+- // SSSE3: for clang-cl:
+- #include <tmmintrin.h>
+- #define __SHA__
+- #endif
+- #endif
+-
+- #endif
+- #elif defined(__GNUC__)
+- #if (__GNUC__ >= 8) // fix that check
++ #elif defined(Z7_LLVM_CLANG_VERSION) && (Z7_LLVM_CLANG_VERSION >= 30800) \
++ || defined(Z7_APPLE_CLANG_VERSION) && (Z7_APPLE_CLANG_VERSION >= 50100) \
++ || defined(Z7_GCC_VERSION) && (Z7_GCC_VERSION >= 40900)
+ #define USE_HW_SHA
+- #ifndef __SHA__
++ #if !defined(__INTEL_COMPILER)
++ // icc defines __GNUC__, but icc doesn't support __attribute__(__target__)
++ #if !defined(__SHA__) || !defined(__SSSE3__)
+ #define ATTRIB_SHA __attribute__((__target__("sha,ssse3")))
+- // #pragma GCC target("sha,ssse3")
+ #endif
+- #endif
+- #elif defined(__INTEL_COMPILER)
+- #if (__INTEL_COMPILER >= 1800) // fix that check
+- #define USE_HW_SHA
+- #endif
++ #endif
+ #elif defined(_MSC_VER)
+- #ifdef USE_MY_MM
+- #define USE_VER_MIN 1300
+- #else
+- #define USE_VER_MIN 1910
+- #endif
+- #if _MSC_VER >= USE_VER_MIN
++ #if (_MSC_VER >= 1900)
+ #define USE_HW_SHA
++ #else
++ #define Z7_USE_HW_SHA_STUB
+ #endif
+ #endif
+ // #endif // MY_CPU_X86_OR_AMD64
++#ifndef USE_HW_SHA
++ // #define Z7_USE_HW_SHA_STUB // for debug
++#endif
+
+ #ifdef USE_HW_SHA
+
+ // #pragma message("Sha256 HW")
+-// #include <wmmintrin.h>
+
+-#if !defined(_MSC_VER) || (_MSC_VER >= 1900)
+-#include <immintrin.h>
+-#else
+-#include <emmintrin.h>
+
+-#if defined(_MSC_VER) && (_MSC_VER >= 1600)
+-// #include <intrin.h>
+-#endif
+
+-#ifdef USE_MY_MM
+-#include "My_mm.h"
+-#endif
++
++// sse/sse2/ssse3:
++#include <tmmintrin.h>
++// sha*:
++#include <immintrin.h>
++
++#if defined (__clang__) && defined(_MSC_VER)
++ #if !defined(__SHA__)
++ #include <shaintrin.h>
++ #endif
++#else
+
+ #endif
+
+@@ -94,60 +76,44 @@ SHA:
+ extern
+ MY_ALIGN(64)
+ const UInt32 SHA256_K_ARRAY[64];
+-
+ #define K SHA256_K_ARRAY
+
+
+-#define ADD_EPI32(dest, src) dest = _mm_add_epi32(dest, src);
+-#define SHA256_MSG1(dest, src) dest = _mm_sha256msg1_epu32(dest, src);
+-#define SHA25G_MSG2(dest, src) dest = _mm_sha256msg2_epu32(dest, src);
+-
++#define ADD_EPI32(dest, src) dest = _mm_add_epi32(dest, src);
++#define SHA256_MSG1(dest, src) dest = _mm_sha256msg1_epu32(dest, src);
++#define SHA256_MSG2(dest, src) dest = _mm_sha256msg2_epu32(dest, src);
+
+ #define LOAD_SHUFFLE(m, k) \
+ m = _mm_loadu_si128((const __m128i *)(const void *)(data + (k) * 16)); \
+ m = _mm_shuffle_epi8(m, mask); \
+
+-#define SM1(g0, g1, g2, g3) \
+- SHA256_MSG1(g3, g0); \
+-
+-#define SM2(g0, g1, g2, g3) \
+- tmp = _mm_alignr_epi8(g1, g0, 4); \
+- ADD_EPI32(g2, tmp); \
+- SHA25G_MSG2(g2, g1); \
+-
+-// #define LS0(k, g0, g1, g2, g3) LOAD_SHUFFLE(g0, k)
+-// #define LS1(k, g0, g1, g2, g3) LOAD_SHUFFLE(g1, k+1)
++#define NNN(m0, m1, m2, m3)
+
++#define SM1(m1, m2, m3, m0) \
++ SHA256_MSG1(m0, m1); \
+
+-#define NNN(g0, g1, g2, g3)
+-
++#define SM2(m2, m3, m0, m1) \
++ ADD_EPI32(m0, _mm_alignr_epi8(m3, m2, 4)) \
++ SHA256_MSG2(m0, m3); \
+
+ #define RND2(t0, t1) \
+ t0 = _mm_sha256rnds2_epu32(t0, t1, msg);
+
+-#define RND2_0(m, k) \
+- msg = _mm_add_epi32(m, *(const __m128i *) (const void *) &K[(k) * 4]); \
+- RND2(state0, state1); \
+- msg = _mm_shuffle_epi32(msg, 0x0E); \
+
+
+-#define RND2_1 \
++#define R4(k, m0, m1, m2, m3, OP0, OP1) \
++ msg = _mm_add_epi32(m0, *(const __m128i *) (const void *) &K[(k) * 4]); \
++ RND2(state0, state1); \
++ msg = _mm_shuffle_epi32(msg, 0x0E); \
++ OP0(m0, m1, m2, m3) \
+ RND2(state1, state0); \
+-
+-
+-// We use scheme with 3 rounds ahead for SHA256_MSG1 / 2 rounds ahead for SHA256_MSG2
+-
+-#define R4(k, g0, g1, g2, g3, OP0, OP1) \
+- RND2_0(g0, k); \
+- OP0(g0, g1, g2, g3); \
+- RND2_1; \
+- OP1(g0, g1, g2, g3); \
++ OP1(m0, m1, m2, m3) \
+
+ #define R16(k, OP0, OP1, OP2, OP3, OP4, OP5, OP6, OP7) \
+- R4 ( (k)*4+0, m0, m1, m2, m3, OP0, OP1 ) \
+- R4 ( (k)*4+1, m1, m2, m3, m0, OP2, OP3 ) \
+- R4 ( (k)*4+2, m2, m3, m0, m1, OP4, OP5 ) \
+- R4 ( (k)*4+3, m3, m0, m1, m2, OP6, OP7 ) \
++ R4 ( (k)*4+0, m0,m1,m2,m3, OP0, OP1 ) \
++ R4 ( (k)*4+1, m1,m2,m3,m0, OP2, OP3 ) \
++ R4 ( (k)*4+2, m2,m3,m0,m1, OP4, OP5 ) \
++ R4 ( (k)*4+3, m3,m0,m1,m2, OP6, OP7 ) \
+
+ #define PREPARE_STATE \
+ tmp = _mm_shuffle_epi32(state0, 0x1B); /* abcd */ \
+@@ -157,15 +123,16 @@ const UInt32 SHA256_K_ARRAY[64];
+ state1 = _mm_unpackhi_epi64(state1, tmp); /* abef */ \
+
+
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
+ #ifdef ATTRIB_SHA
+ ATTRIB_SHA
+ #endif
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
+ {
+ const __m128i mask = _mm_set_epi32(0x0c0d0e0f, 0x08090a0b, 0x04050607, 0x00010203);
+- __m128i tmp;
+- __m128i state0, state1;
++
++
++ __m128i tmp, state0, state1;
+
+ if (numBlocks == 0)
+ return;
+@@ -192,13 +159,13 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+
+
+
+- R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 );
+- R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
+- R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
+- R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN );
++ R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 )
++ R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
++ R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
++ R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN )
+
+- ADD_EPI32(state0, state0_save);
+- ADD_EPI32(state1, state1_save);
++ ADD_EPI32(state0, state0_save)
++ ADD_EPI32(state1, state1_save)
+
+ data += 64;
+ }
+@@ -212,19 +179,28 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+
+ #endif // USE_HW_SHA
+
+-#elif defined(MY_CPU_ARM_OR_ARM64)
++#elif defined(MY_CPU_ARM_OR_ARM64) && defined(MY_CPU_LE)
+
+- #if defined(__clang__)
+- #if (__clang_major__ >= 8) // fix that check
++ #if defined(__ARM_FEATURE_SHA2) \
++ || defined(__ARM_FEATURE_CRYPTO)
++ #define USE_HW_SHA
++ #else
++ #if defined(MY_CPU_ARM64) \
++ || defined(__ARM_ARCH) && (__ARM_ARCH >= 4) \
++ || defined(Z7_MSC_VER_ORIGINAL)
++ #if defined(__ARM_FP) && \
++ ( defined(Z7_CLANG_VERSION) && (Z7_CLANG_VERSION >= 30800) \
++ || defined(__GNUC__) && (__GNUC__ >= 6) \
++ ) \
++ || defined(Z7_MSC_VER_ORIGINAL) && (_MSC_VER >= 1910)
++ #if defined(MY_CPU_ARM64) \
++ || !defined(Z7_CLANG_VERSION) \
++ || defined(__ARM_NEON) && \
++ (Z7_CLANG_VERSION < 170000 || \
++ Z7_CLANG_VERSION > 170001)
+ #define USE_HW_SHA
+ #endif
+- #elif defined(__GNUC__)
+- #if (__GNUC__ >= 6) // fix that check
+- #define USE_HW_SHA
+ #endif
+- #elif defined(_MSC_VER)
+- #if _MSC_VER >= 1910
+- #define USE_HW_SHA
+ #endif
+ #endif
+
+@@ -232,63 +208,144 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+
+ // #pragma message("=== Sha256 HW === ")
+
++
+ #if defined(__clang__) || defined(__GNUC__)
++#if !defined(__ARM_FEATURE_SHA2) && \
++ !defined(__ARM_FEATURE_CRYPTO)
+ #ifdef MY_CPU_ARM64
++#if defined(__clang__)
++ #define ATTRIB_SHA __attribute__((__target__("crypto")))
++#else
+ #define ATTRIB_SHA __attribute__((__target__("+crypto")))
++#endif
+ #else
++#if defined(__clang__) && (__clang_major__ >= 1)
++ #define ATTRIB_SHA __attribute__((__target__("armv8-a,sha2")))
++#else
+ #define ATTRIB_SHA __attribute__((__target__("fpu=crypto-neon-fp-armv8")))
++#endif
+ #endif
++#endif
+ #else
+ // _MSC_VER
+ // for arm32
+ #define _ARM_USE_NEW_NEON_INTRINSICS
+ #endif
+
+-#if defined(_MSC_VER) && defined(MY_CPU_ARM64)
++#if defined(Z7_MSC_VER_ORIGINAL) && defined(MY_CPU_ARM64)
+ #include <arm64_neon.h>
+ #else
++
++#if defined(__clang__) && __clang_major__ < 16
++#if !defined(__ARM_FEATURE_SHA2) && \
++ !defined(__ARM_FEATURE_CRYPTO)
++// #pragma message("=== we set __ARM_FEATURE_CRYPTO 1 === ")
++ Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++ #define Z7_ARM_FEATURE_CRYPTO_WAS_SET 1
++// #if defined(__clang__) && __clang_major__ < 13
++ #define __ARM_FEATURE_CRYPTO 1
++// #else
++ #define __ARM_FEATURE_SHA2 1
++// #endif
++ Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++#endif
++#endif // clang
++
++#if defined(__clang__)
++
++#if defined(__ARM_ARCH) && __ARM_ARCH < 8
++ Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++// #pragma message("#define __ARM_ARCH 8")
++ #undef __ARM_ARCH
++ #define __ARM_ARCH 8
++ Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++#endif
++
++#endif // clang
++
+ #include <arm_neon.h>
++
++#if defined(Z7_ARM_FEATURE_CRYPTO_WAS_SET) && \
++ defined(__ARM_FEATURE_CRYPTO) && \
++ defined(__ARM_FEATURE_SHA2)
++Z7_DIAGNOSTIC_IGNORE_BEGIN_RESERVED_MACRO_IDENTIFIER
++ #undef __ARM_FEATURE_CRYPTO
++ #undef __ARM_FEATURE_SHA2
++ #undef Z7_ARM_FEATURE_CRYPTO_WAS_SET
++Z7_DIAGNOSTIC_IGNORE_END_RESERVED_MACRO_IDENTIFIER
++// #pragma message("=== we undefine __ARM_FEATURE_CRYPTO === ")
+ #endif
+
++#endif // Z7_MSC_VER_ORIGINAL
++
+ typedef uint32x4_t v128;
+ // typedef __n128 v128; // MSVC
+
+ #ifdef MY_CPU_BE
+- #define MY_rev32_for_LE(x)
++ #define MY_rev32_for_LE(x) x
+ #else
+- #define MY_rev32_for_LE(x) x = vreinterpretq_u32_u8(vrev32q_u8(vreinterpretq_u8_u32(x)))
++ #define MY_rev32_for_LE(x) vrev32q_u8(x)
+ #endif
+
+-#define LOAD_128(_p) (*(const v128 *)(const void *)(_p))
+-#define STORE_128(_p, _v) *(v128 *)(void *)(_p) = (_v)
++#if 1 // 0 for debug
++// for arm32: it works slower by some reason than direct code
++/*
++for arm32 it generates:
++MSVC-2022, GCC-9:
++ vld1.32 {d18,d19}, [r10]
++ vst1.32 {d4,d5}, [r3]
++ vld1.8 {d20-d21}, [r4]
++there is no align hint (like [r10:128]). So instruction allows unaligned access
++*/
++#define LOAD_128_32(_p) vld1q_u32(_p)
++#define LOAD_128_8(_p) vld1q_u8 (_p)
++#define STORE_128_32(_p, _v) vst1q_u32(_p, _v)
++#else
++/*
++for arm32:
++MSVC-2022:
++ vldm r10,{d18,d19}
++ vstm r3,{d4,d5}
++ does it require strict alignment?
++GCC-9:
++ vld1.64 {d30-d31}, [r0:64]
++ vldr d28, [r0, #16]
++ vldr d29, [r0, #24]
++ vst1.64 {d30-d31}, [r0:64]
++ vstr d28, [r0, #16]
++ vstr d29, [r0, #24]
++there is hint [r0:64], so does it requires 64-bit alignment.
++*/
++#define LOAD_128_32(_p) (*(const v128 *)(const void *)(_p))
++#define LOAD_128_8(_p) vreinterpretq_u8_u32(*(const v128 *)(const void *)(_p))
++#define STORE_128_32(_p, _v) *(v128 *)(void *)(_p) = (_v)
++#endif
+
+ #define LOAD_SHUFFLE(m, k) \
+- m = LOAD_128((data + (k) * 16)); \
+- MY_rev32_for_LE(m); \
++ m = vreinterpretq_u32_u8( \
++ MY_rev32_for_LE( \
++ LOAD_128_8(data + (k) * 16))); \
+
+ // K array must be aligned for 16-bytes at least.
+ extern
+ MY_ALIGN(64)
+ const UInt32 SHA256_K_ARRAY[64];
+-
+ #define K SHA256_K_ARRAY
+
+-
+ #define SHA256_SU0(dest, src) dest = vsha256su0q_u32(dest, src);
+-#define SHA25G_SU1(dest, src2, src3) dest = vsha256su1q_u32(dest, src2, src3);
++#define SHA256_SU1(dest, src2, src3) dest = vsha256su1q_u32(dest, src2, src3);
+
+-#define SM1(g0, g1, g2, g3) SHA256_SU0(g3, g0)
+-#define SM2(g0, g1, g2, g3) SHA25G_SU1(g2, g0, g1)
+-#define NNN(g0, g1, g2, g3)
++#define SM1(m0, m1, m2, m3) SHA256_SU0(m3, m0)
++#define SM2(m0, m1, m2, m3) SHA256_SU1(m2, m0, m1)
++#define NNN(m0, m1, m2, m3)
+
+-
+-#define R4(k, g0, g1, g2, g3, OP0, OP1) \
+- msg = vaddq_u32(g0, *(const v128 *) (const void *) &K[(k) * 4]); \
++#define R4(k, m0, m1, m2, m3, OP0, OP1) \
++ msg = vaddq_u32(m0, *(const v128 *) (const void *) &K[(k) * 4]); \
+ tmp = state0; \
+ state0 = vsha256hq_u32( state0, state1, msg ); \
+ state1 = vsha256h2q_u32( state1, tmp, msg ); \
+- OP0(g0, g1, g2, g3); \
+- OP1(g0, g1, g2, g3); \
++ OP0(m0, m1, m2, m3); \
++ OP1(m0, m1, m2, m3); \
+
+
+ #define R16(k, OP0, OP1, OP2, OP3, OP4, OP5, OP6, OP7) \
+@@ -298,19 +355,19 @@ const UInt32 SHA256_K_ARRAY[64];
+ R4 ( (k)*4+3, m3, m0, m1, m2, OP6, OP7 ) \
+
+
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
+ #ifdef ATTRIB_SHA
+ ATTRIB_SHA
+ #endif
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
+ {
+ v128 state0, state1;
+
+ if (numBlocks == 0)
+ return;
+
+- state0 = LOAD_128(&state[0]);
+- state1 = LOAD_128(&state[4]);
++ state0 = LOAD_128_32(&state[0]);
++ state1 = LOAD_128_32(&state[4]);
+
+ do
+ {
+@@ -326,10 +383,10 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+ LOAD_SHUFFLE (m2, 2)
+ LOAD_SHUFFLE (m3, 3)
+
+- R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 );
+- R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
+- R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 );
+- R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN );
++ R16 ( 0, NNN, NNN, SM1, NNN, SM1, SM2, SM1, SM2 )
++ R16 ( 1, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
++ R16 ( 2, SM1, SM2, SM1, SM2, SM1, SM2, SM1, SM2 )
++ R16 ( 3, SM1, SM2, NNN, SM2, NNN, NNN, NNN, NNN )
+
+ state0 = vaddq_u32(state0, state0_save);
+ state1 = vaddq_u32(state1, state1_save);
+@@ -338,8 +395,8 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+ }
+ while (--numBlocks);
+
+- STORE_128(&state[0], state0);
+- STORE_128(&state[4], state1);
++ STORE_128_32(&state[0], state0);
++ STORE_128_32(&state[4], state1);
+ }
+
+ #endif // USE_HW_SHA
+@@ -347,18 +404,19 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+ #endif // MY_CPU_ARM_OR_ARM64
+
+
+-#ifndef USE_HW_SHA
+-
++#if !defined(USE_HW_SHA) && defined(Z7_USE_HW_SHA_STUB)
+ // #error Stop_Compiling_UNSUPPORTED_SHA
+ // #include <stdlib.h>
+-
++// We can compile this file with another C compiler,
++// or we can compile asm version.
++// So we can generate real code instead of this stub function.
+ // #include "Sha256.h"
+-void MY_FAST_CALL Sha256_UpdateBlocks(UInt32 state[8], const Byte *data, size_t numBlocks);
+-
++// #if defined(_MSC_VER)
+ #pragma message("Sha256 HW-SW stub was used")
+-
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
+-void MY_FAST_CALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
++// #endif
++void Z7_FASTCALL Sha256_UpdateBlocks (UInt32 state[8], const Byte *data, size_t numBlocks);
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks);
++void Z7_FASTCALL Sha256_UpdateBlocks_HW(UInt32 state[8], const Byte *data, size_t numBlocks)
+ {
+ Sha256_UpdateBlocks(state, data, numBlocks);
+ /*
+@@ -369,5 +427,25 @@ void MY_FAST_CALL Sha256_UpdateBlocks_HW
+ return;
+ */
+ }
+-
+ #endif
++
++
++#undef K
++#undef RND2
++#undef MY_rev32_for_LE
++
++#undef NNN
++#undef LOAD_128
++#undef STORE_128
++#undef LOAD_SHUFFLE
++#undef SM1
++#undef SM2
++
++
++#undef R4
++#undef R16
++#undef PREPARE_STATE
++#undef USE_HW_SHA
++#undef ATTRIB_SHA
++#undef USE_VER_MIN
++#undef Z7_USE_HW_SHA_STUB
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn
new file mode 100644
index 0000000000..4a2693a942
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_BUILD.gn
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Util/SfxSetup/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Util/SfxSetup/BUILD.gn
+@@ -3,12 +3,8 @@
+ # found in the LICENSE file.
+
+ source_set("7zS2_source") {
+- sources = [
+- "Precomp.h",
+- "SfxSetup.c",
+- ]
++ sources = [ "SfxSetup.c" ]
+ defines = [
+- "_LZMA_PROB32",
+ "_WIN32",
+ ]
+ include_dirs = [
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_Precomp.h b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_Precomp.h
new file mode 100644
index 0000000000..5e5790bcce
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_Precomp.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Util/SfxSetup/Precomp.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Util/SfxSetup/Precomp.h
+@@ -1,10 +0,0 @@
+-/* Precomp.h -- StdAfx
+-2013-06-16 : Igor Pavlov : Public domain */
+-
+-#ifndef __7Z_PRECOMP_H
+-#define __7Z_PRECOMP_H
+-
+-#include "Compiler.h"
+-#include "7zTypes.h"
+-
+-#endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c
new file mode 100644
index 0000000000..2efe52b219
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_SfxSetup.c
@@ -0,0 +1,202 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Util/SfxSetup/SfxSetup.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Util/SfxSetup/SfxSetup.c
+@@ -1,5 +1,5 @@
+ /* SfxSetup.c - 7z SFX Setup
+-2019-02-02 : Igor Pavlov : Public domain */
++2024-01-24 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -11,6 +11,7 @@
+ #define _UNICODE
+ #endif
+
++// SHELLEXECUTEINFO
+ #include <windows.h>
+ #include <shellapi.h>
+
+@@ -18,17 +19,23 @@
+ #include <stdio.h>
+ #endif
+
+-#include "7z.h"
+-#include "7zAlloc.h"
+-#include "7zCrc.h"
+-#include "7zFile.h"
+-#include "CpuArch.h"
+-#include "DllSecur.h"
++#include "../../7z.h"
++#include "../../7zAlloc.h"
++#include "../../7zCrc.h"
++#include "../../7zFile.h"
++#include "../../CpuArch.h"
++#include "../../DllSecur.h"
+
+ #define k_EXE_ExtIndex 2
+
+ #define kInputBufSize ((size_t)1 << 18)
+
++
++#define wcscat lstrcatW
++#define wcslen (size_t)lstrlenW
++#define wcscpy lstrcpyW
++// wcsncpy() and lstrcpynW() work differently. We don't use them.
++
+ static const char * const kExts[] =
+ {
+ "bat"
+@@ -67,7 +74,7 @@ static unsigned FindExt(const wchar_t *s
+ return len;
+ }
+
+-#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) -= 0x20 : (c)))
++#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c)))
+
+ static unsigned FindItem(const char * const *items, unsigned num, const wchar_t *s, unsigned len)
+ {
+@@ -75,13 +82,13 @@ static unsigned FindItem(const char * co
+ for (i = 0; i < num; i++)
+ {
+ const char *item = items[i];
+- unsigned itemLen = (unsigned)strlen(item);
++ const unsigned itemLen = (unsigned)strlen(item);
+ unsigned j;
+ if (len != itemLen)
+ continue;
+ for (j = 0; j < len; j++)
+ {
+- unsigned c = (Byte)item[j];
++ const unsigned c = (Byte)item[j];
+ if (c != s[j] && MAKE_CHAR_UPPER(c) != s[j])
+ break;
+ }
+@@ -99,10 +106,20 @@ static BOOL WINAPI HandlerRoutine(DWORD
+ }
+ #endif
+
++
++#ifdef _CONSOLE
++static void PrintStr(const char *s)
++{
++ fputs(s, stdout);
++}
++#endif
++
+ static void PrintErrorMessage(const char *message)
+ {
+ #ifdef _CONSOLE
+- printf("\n7-Zip Error: %s\n", message);
++ PrintStr("\n7-Zip Error: ");
++ PrintStr(message);
++ PrintStr("\n");
+ #else
+ #ifdef UNDER_CE
+ WCHAR messageW[256 + 4];
+@@ -182,7 +199,7 @@ static WRes RemoveDirWithSubItems(WCHAR
+ WIN32_FIND_DATAW fd;
+ HANDLE handle;
+ WRes res = 0;
+- size_t len = wcslen(path);
++ const size_t len = wcslen(path);
+ wcscpy(path + len, L"*");
+ handle = FindFirstFileW(path, &fd);
+ path[len] = L'\0';
+@@ -231,7 +248,7 @@ static WRes RemoveDirWithSubItems(WCHAR
+ }
+
+ #ifdef _CONSOLE
+-int MY_CDECL main()
++int Z7_CDECL main(void)
+ #else
+ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
+ #ifdef UNDER_CE
+@@ -265,10 +282,10 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ #ifdef _CONSOLE
+ SetConsoleCtrlHandler(HandlerRoutine, TRUE);
+ #else
+- UNUSED_VAR(hInstance);
+- UNUSED_VAR(hPrevInstance);
+- UNUSED_VAR(lpCmdLine);
+- UNUSED_VAR(nCmdShow);
++ UNUSED_VAR(hInstance)
++ UNUSED_VAR(hPrevInstance)
++ UNUSED_VAR(lpCmdLine)
++ UNUSED_VAR(nCmdShow)
+ #endif
+
+ CrcGenerateTable();
+@@ -293,7 +310,7 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ BoolInt quoteMode = False;
+ for (;; cmdLineParams++)
+ {
+- wchar_t c = *cmdLineParams;
++ const wchar_t c = *cmdLineParams;
+ if (c == L'\"')
+ quoteMode = !quoteMode;
+ else if (c == 0 || (c == L' ' && !quoteMode))
+@@ -327,7 +344,7 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ unsigned k;
+ for (k = 0; k < 8; k++)
+ {
+- unsigned t = value & 0xF;
++ const unsigned t = value & 0xF;
+ value >>= 4;
+ s[7 - k] = (wchar_t)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
+ }
+@@ -389,7 +406,7 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ {
+ lookStream.bufSize = kInputBufSize;
+ lookStream.realStream = &archiveStream.vt;
+- LookToRead2_Init(&lookStream);
++ LookToRead2_INIT(&lookStream)
+ }
+ }
+
+@@ -458,11 +475,11 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ unsigned extLen;
+ const WCHAR *name = temp + nameStartPos;
+ unsigned len = (unsigned)wcslen(name);
+- unsigned nameLen = FindExt(temp + nameStartPos, &extLen);
+- unsigned extPrice = FindItem(kExts, sizeof(kExts) / sizeof(kExts[0]), name + len - extLen, extLen);
+- unsigned namePrice = FindItem(kNames, sizeof(kNames) / sizeof(kNames[0]), name, nameLen);
++ const unsigned nameLen = FindExt(temp + nameStartPos, &extLen);
++ const unsigned extPrice = FindItem(kExts, sizeof(kExts) / sizeof(kExts[0]), name + len - extLen, extLen);
++ const unsigned namePrice = FindItem(kNames, sizeof(kNames) / sizeof(kNames[0]), name, nameLen);
+
+- unsigned price = namePrice + extPrice * 64 + (nameStartPos == 0 ? 0 : (1 << 12));
++ const unsigned price = namePrice + extPrice * 64 + (nameStartPos == 0 ? 0 : (1 << 12));
+ if (minPrice > price)
+ {
+ minPrice = price;
+@@ -503,12 +520,13 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ #endif
+
+ {
+- SRes res2 = File_Close(&outFile);
++ const WRes res2 = File_Close(&outFile);
+ if (res != SZ_OK)
+ break;
+- if (res2 != SZ_OK)
++ if (res2 != 0)
+ {
+- res = res2;
++ errorMessage = "Can't close output file";
++ res = SZ_ERROR_FAIL;
+ break;
+ }
+ }
+@@ -553,7 +571,7 @@ int APIENTRY WinMain(HINSTANCE hInstance
+ WCHAR oldCurDir[MAX_PATH + 2];
+ oldCurDir[0] = 0;
+ {
+- DWORD needLen = GetCurrentDirectory(MAX_PATH + 1, oldCurDir);
++ const DWORD needLen = GetCurrentDirectory(MAX_PATH + 1, oldCurDir);
+ if (needLen == 0 || needLen > MAX_PATH)
+ oldCurDir[0] = 0;
+ SetCurrentDirectory(workCurDir);
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_chromium.patch b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_chromium.patch
new file mode 100644
index 0000000000..02d99afa73
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Util_SfxSetup_chromium.patch
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Util/SfxSetup/chromium.patch.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Util/SfxSetup/chromium.patch
+@@ -1,53 +0,0 @@
+-diff --git a/third_party/lzma_sdk/Util/SfxSetup/Precomp.h b/third_party/lzma_sdk/Util/SfxSetup/Precomp.h
+-index 588a66f7eb8c..177a205f6979 100644
+---- a/third_party/lzma_sdk/Util/SfxSetup/Precomp.h
+-+++ b/third_party/lzma_sdk/Util/SfxSetup/Precomp.h
+-@@ -4,7 +4,7 @@
+- #ifndef __7Z_PRECOMP_H
+- #define __7Z_PRECOMP_H
+-
+--#include "../../Compiler.h"
+--#include "../../7zTypes.h"
+-+#include "Compiler.h"
+-+#include "7zTypes.h"
+-
+- #endif
+-diff --git a/third_party/lzma_sdk/Util/SfxSetup/SfxSetup.c b/third_party/lzma_sdk/Util/SfxSetup/SfxSetup.c
+-index ef19aeac5450..45efac060bd6 100644
+---- a/third_party/lzma_sdk/Util/SfxSetup/SfxSetup.c
+-+++ b/third_party/lzma_sdk/Util/SfxSetup/SfxSetup.c
+-@@ -11,16 +11,19 @@
+- #define _UNICODE
+- #endif
+-
+-+#include <windows.h>
+-+#include <shellapi.h>
+-+
+- #ifdef _CONSOLE
+- #include <stdio.h>
+- #endif
+-
+--#include "../../7z.h"
+--#include "../../7zAlloc.h"
+--#include "../../7zCrc.h"
+--#include "../../7zFile.h"
+--#include "../../CpuArch.h"
+--#include "../../DllSecur.h"
+-+#include "7z.h"
+-+#include "7zAlloc.h"
+-+#include "7zCrc.h"
+-+#include "7zFile.h"
+-+#include "CpuArch.h"
+-+#include "DllSecur.h"
+-
+- #define k_EXE_ExtIndex 2
+-
+-@@ -125,7 +128,7 @@ static WRes MyCreateDir(const WCHAR *name)
+- #define kBufferSize (1 << 15)
+- #endif
+-
+--#define kSignatureSearchLimit (1 << 22)
+-+#define kSignatureSearchLimit (1 << 26)
+-
+- static BoolInt FindSignature(CSzFile *stream, UInt64 *resPos)
+- {
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Xz.c b/electron34/patches/patch-third__party_lzma__sdk_C_Xz.c
new file mode 100644
index 0000000000..7fa174feef
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Xz.c
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Xz.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Xz.c
+@@ -1,5 +1,5 @@
+ /* Xz.c - Xz
+-2021-02-09 : Igor Pavlov : Public domain */
++2024-03-01 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -52,6 +52,7 @@ void XzCheck_Init(CXzCheck *p, unsigned
+ case XZ_CHECK_CRC32: p->crc = CRC_INIT_VAL; break;
+ case XZ_CHECK_CRC64: p->crc64 = CRC64_INIT_VAL; break;
+ case XZ_CHECK_SHA256: Sha256_Init(&p->sha); break;
++ default: break;
+ }
+ }
+
+@@ -62,6 +63,7 @@ void XzCheck_Update(CXzCheck *p, const v
+ case XZ_CHECK_CRC32: p->crc = CrcUpdate(p->crc, data, size); break;
+ case XZ_CHECK_CRC64: p->crc64 = Crc64Update(p->crc64, data, size); break;
+ case XZ_CHECK_SHA256: Sha256_Update(&p->sha, (const Byte *)data, size); break;
++ default: break;
+ }
+ }
+
+@@ -70,7 +72,7 @@ int XzCheck_Final(CXzCheck *p, Byte *dig
+ switch (p->mode)
+ {
+ case XZ_CHECK_CRC32:
+- SetUi32(digest, CRC_GET_DIGEST(p->crc));
++ SetUi32(digest, CRC_GET_DIGEST(p->crc))
+ break;
+ case XZ_CHECK_CRC64:
+ {
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_Xz.h b/electron34/patches/patch-third__party_lzma__sdk_C_Xz.h
new file mode 100644
index 0000000000..24e26352fa
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_Xz.h
@@ -0,0 +1,164 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/Xz.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/Xz.h
+@@ -1,21 +1,24 @@
+ /* Xz.h - Xz interface
+-2021-04-01 : Igor Pavlov : Public domain */
++2024-01-26 : Igor Pavlov : Public domain */
+
+-#ifndef __XZ_H
+-#define __XZ_H
++#ifndef ZIP7_INC_XZ_H
++#define ZIP7_INC_XZ_H
+
+ #include "Sha256.h"
++#include "Delta.h"
+
+ EXTERN_C_BEGIN
+
+ #define XZ_ID_Subblock 1
+ #define XZ_ID_Delta 3
+-#define XZ_ID_X86 4
+-#define XZ_ID_PPC 5
+-#define XZ_ID_IA64 6
+-#define XZ_ID_ARM 7
+-#define XZ_ID_ARMT 8
++#define XZ_ID_X86 4
++#define XZ_ID_PPC 5
++#define XZ_ID_IA64 6
++#define XZ_ID_ARM 7
++#define XZ_ID_ARMT 8
+ #define XZ_ID_SPARC 9
++#define XZ_ID_ARM64 0xa
++#define XZ_ID_RISCV 0xb
+ #define XZ_ID_LZMA2 0x21
+
+ unsigned Xz_ReadVarInt(const Byte *p, size_t maxSize, UInt64 *value);
+@@ -53,7 +56,7 @@ typedef struct
+ #define XzBlock_HasUnsupportedFlags(p) (((p)->flags & ~(XZ_BF_NUM_FILTERS_MASK | XZ_BF_PACK_SIZE | XZ_BF_UNPACK_SIZE)) != 0)
+
+ SRes XzBlock_Parse(CXzBlock *p, const Byte *header);
+-SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, BoolInt *isIndex, UInt32 *headerSizeRes);
++SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStreamPtr inStream, BoolInt *isIndex, UInt32 *headerSizeRes);
+
+ /* ---------- xz stream ---------- */
+
+@@ -101,7 +104,7 @@ typedef UInt16 CXzStreamFlags;
+ unsigned XzFlags_GetCheckSize(CXzStreamFlags f);
+
+ SRes Xz_ParseHeader(CXzStreamFlags *p, const Byte *buf);
+-SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream);
++SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStreamPtr inStream);
+
+ typedef struct
+ {
+@@ -112,6 +115,7 @@ typedef struct
+ typedef struct
+ {
+ CXzStreamFlags flags;
++ // Byte _pad[6];
+ size_t numBlocks;
+ CXzBlockSizes *blocks;
+ UInt64 startOffset;
+@@ -134,7 +138,7 @@ typedef struct
+
+ void Xzs_Construct(CXzs *p);
+ void Xzs_Free(CXzs *p, ISzAllocPtr alloc);
+-SRes Xzs_ReadBackward(CXzs *p, ILookInStream *inStream, Int64 *startOffset, ICompressProgress *progress, ISzAllocPtr alloc);
++SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr inStream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc);
+
+ UInt64 Xzs_GetNumBlocks(const CXzs *p);
+ UInt64 Xzs_GetUnpackSize(const CXzs *p);
+@@ -160,9 +164,9 @@ typedef enum
+ } ECoderFinishMode;
+
+
+-typedef struct _IStateCoder
++typedef struct
+ {
+- void *p;
++ void *p; // state object;
+ void (*Free)(void *p, ISzAllocPtr alloc);
+ SRes (*SetProps)(void *p, const Byte *props, size_t propSize, ISzAllocPtr alloc);
+ void (*Init)(void *p);
+@@ -174,6 +178,20 @@ typedef struct _IStateCoder
+ } IStateCoder;
+
+
++typedef struct
++{
++ UInt32 methodId;
++ UInt32 delta;
++ UInt32 ip;
++ UInt32 X86_State;
++ Byte delta_State[DELTA_STATE_SIZE];
++} CXzBcFilterStateBase;
++
++typedef SizeT (*Xz_Func_BcFilterStateBase_Filter)(CXzBcFilterStateBase *p, Byte *data, SizeT size);
++
++SRes Xz_StateCoder_Bc_SetFromMethod_Func(IStateCoder *p, UInt64 id,
++ Xz_Func_BcFilterStateBase_Filter func, ISzAllocPtr alloc);
++
+
+ #define MIXCODER_NUM_FILTERS_MAX 4
+
+@@ -216,13 +234,13 @@ typedef enum
+ typedef struct
+ {
+ EXzState state;
+- UInt32 pos;
++ unsigned pos;
+ unsigned alignPos;
+ unsigned indexPreSize;
+
+ CXzStreamFlags streamFlags;
+
+- UInt32 blockHeaderSize;
++ unsigned blockHeaderSize;
+ UInt64 packSize;
+ UInt64 unpackSize;
+
+@@ -422,7 +440,7 @@ typedef struct
+ size_t outStep_ST; // size of output buffer for Single-Thread decoding
+ BoolInt ignoreErrors; // if set to 1, the decoder can ignore some errors and it skips broken parts of data.
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ unsigned numThreads; // the number of threads for Multi-Thread decoding. if (umThreads == 1) it will use Single-thread decoding
+ size_t inBufSize_MT; // size of small input data buffers for Multi-Thread decoding. Big number of such small buffers can be created
+ size_t memUseMax; // the limit of total memory usage for Multi-Thread decoding.
+@@ -432,8 +450,9 @@ typedef struct
+
+ void XzDecMtProps_Init(CXzDecMtProps *p);
+
+-
+-typedef void * CXzDecMtHandle;
++typedef struct CXzDecMt CXzDecMt;
++typedef CXzDecMt * CXzDecMtHandle;
++// Z7_DECLARE_HANDLE(CXzDecMtHandle)
+
+ /*
+ alloc : XzDecMt uses CAlignOffsetAlloc internally for addresses allocated by (alloc).
+@@ -503,14 +522,14 @@ SRes XzDecMt_Decode(CXzDecMtHandle p,
+ const CXzDecMtProps *props,
+ const UInt64 *outDataSize, // NULL means undefined
+ int finishMode, // 0 - partial unpacking is allowed, 1 - xz stream(s) must be finished
+- ISeqOutStream *outStream,
++ ISeqOutStreamPtr outStream,
+ // Byte *outBuf, size_t *outBufSize,
+- ISeqInStream *inStream,
++ ISeqInStreamPtr inStream,
+ // const Byte *inData, size_t inDataSize,
+ CXzStatInfo *stat, // out: decoding results and statistics
+ int *isMT, // out: 0 means that ST (Single-Thread) version was used
+ // 1 means that MT (Multi-Thread) version was used
+- ICompressProgress *progress);
++ ICompressProgressPtr progress);
+
+ EXTERN_C_END
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.c b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.c
new file mode 100644
index 0000000000..94ba8b68d9
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.c
@@ -0,0 +1,189 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/XzCrc64.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/XzCrc64.c
+@@ -1,5 +1,5 @@
+ /* XzCrc64.c -- CRC64 calculation
+-2017-05-23 : Igor Pavlov : Public domain */
++2023-12-08 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -8,45 +8,76 @@
+
+ #define kCrc64Poly UINT64_CONST(0xC96C5795D7870F42)
+
+-#ifdef MY_CPU_LE
+- #define CRC64_NUM_TABLES 4
++// for debug only : define Z7_CRC64_DEBUG_BE to test big-endian code in little-endian cpu
++// #define Z7_CRC64_DEBUG_BE
++#ifdef Z7_CRC64_DEBUG_BE
++#undef MY_CPU_LE
++#define MY_CPU_BE
++#endif
++
++#ifdef Z7_CRC64_NUM_TABLES
++ #define Z7_CRC64_NUM_TABLES_USE Z7_CRC64_NUM_TABLES
+ #else
+- #define CRC64_NUM_TABLES 5
+- #define CRC_UINT64_SWAP(v) \
+- ((v >> 56) \
+- | ((v >> 40) & ((UInt64)0xFF << 8)) \
+- | ((v >> 24) & ((UInt64)0xFF << 16)) \
+- | ((v >> 8) & ((UInt64)0xFF << 24)) \
+- | ((v << 8) & ((UInt64)0xFF << 32)) \
+- | ((v << 24) & ((UInt64)0xFF << 40)) \
+- | ((v << 40) & ((UInt64)0xFF << 48)) \
+- | ((v << 56)))
++ #define Z7_CRC64_NUM_TABLES_USE 12
++#endif
+
+- UInt64 MY_FAST_CALL XzCrc64UpdateT1_BeT4(UInt64 v, const void *data, size_t size, const UInt64 *table);
++#if Z7_CRC64_NUM_TABLES_USE < 1
++ #error Stop_Compiling_Bad_Z7_CRC_NUM_TABLES
+ #endif
+
++
++#if Z7_CRC64_NUM_TABLES_USE != 1
++
+ #ifndef MY_CPU_BE
+- UInt64 MY_FAST_CALL XzCrc64UpdateT4(UInt64 v, const void *data, size_t size, const UInt64 *table);
++ #define FUNC_NAME_LE_2(s) XzCrc64UpdateT ## s
++ #define FUNC_NAME_LE_1(s) FUNC_NAME_LE_2(s)
++ #define FUNC_NAME_LE FUNC_NAME_LE_1(Z7_CRC64_NUM_TABLES_USE)
++ UInt64 Z7_FASTCALL FUNC_NAME_LE (UInt64 v, const void *data, size_t size, const UInt64 *table);
++#endif
++#ifndef MY_CPU_LE
++ #define FUNC_NAME_BE_2(s) XzCrc64UpdateBeT ## s
++ #define FUNC_NAME_BE_1(s) FUNC_NAME_BE_2(s)
++ #define FUNC_NAME_BE FUNC_NAME_BE_1(Z7_CRC64_NUM_TABLES_USE)
++ UInt64 Z7_FASTCALL FUNC_NAME_BE (UInt64 v, const void *data, size_t size, const UInt64 *table);
++#endif
++
++#if defined(MY_CPU_LE)
++ #define FUNC_REF FUNC_NAME_LE
++#elif defined(MY_CPU_BE)
++ #define FUNC_REF FUNC_NAME_BE
++#else
++ #define FUNC_REF g_Crc64Update
++ static UInt64 (Z7_FASTCALL *FUNC_REF)(UInt64 v, const void *data, size_t size, const UInt64 *table);
+ #endif
+
+-typedef UInt64 (MY_FAST_CALL *CRC64_FUNC)(UInt64 v, const void *data, size_t size, const UInt64 *table);
++#endif
+
+-static CRC64_FUNC g_Crc64Update;
+-UInt64 g_Crc64Table[256 * CRC64_NUM_TABLES];
+
+-UInt64 MY_FAST_CALL Crc64Update(UInt64 v, const void *data, size_t size)
+-{
+- return g_Crc64Update(v, data, size, g_Crc64Table);
+-}
++MY_ALIGN(64)
++static UInt64 g_Crc64Table[256 * Z7_CRC64_NUM_TABLES_USE];
++
+
+-UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size)
++UInt64 Z7_FASTCALL Crc64Update(UInt64 v, const void *data, size_t size)
+ {
+- return g_Crc64Update(CRC64_INIT_VAL, data, size, g_Crc64Table) ^ CRC64_INIT_VAL;
++#if Z7_CRC64_NUM_TABLES_USE == 1
++ #define CRC64_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++ const UInt64 *table = g_Crc64Table;
++ const Byte *p = (const Byte *)data;
++ const Byte *lim = p + size;
++ for (; p != lim; p++)
++ v = CRC64_UPDATE_BYTE_2(v, *p);
++ return v;
++ #undef CRC64_UPDATE_BYTE_2
++#else
++ return FUNC_REF (v, data, size, g_Crc64Table);
++#endif
+ }
+
+-void MY_FAST_CALL Crc64GenerateTable()
++
++Z7_NO_INLINE
++void Z7_FASTCALL Crc64GenerateTable(void)
+ {
+- UInt32 i;
++ unsigned i;
+ for (i = 0; i < 256; i++)
+ {
+ UInt64 r = i;
+@@ -55,32 +86,55 @@ void MY_FAST_CALL Crc64GenerateTable()
+ r = (r >> 1) ^ (kCrc64Poly & ((UInt64)0 - (r & 1)));
+ g_Crc64Table[i] = r;
+ }
+- for (i = 256; i < 256 * CRC64_NUM_TABLES; i++)
++
++#if Z7_CRC64_NUM_TABLES_USE != 1
++#if 1 || 1 && defined(MY_CPU_X86) // low register count
++ for (i = 0; i < 256 * (Z7_CRC64_NUM_TABLES_USE - 1); i++)
+ {
+- UInt64 r = g_Crc64Table[(size_t)i - 256];
+- g_Crc64Table[i] = g_Crc64Table[r & 0xFF] ^ (r >> 8);
++ const UInt64 r0 = g_Crc64Table[(size_t)i];
++ g_Crc64Table[(size_t)i + 256] = g_Crc64Table[(Byte)r0] ^ (r0 >> 8);
+ }
+-
+- #ifdef MY_CPU_LE
+-
+- g_Crc64Update = XzCrc64UpdateT4;
++#else
++ for (i = 0; i < 256 * (Z7_CRC64_NUM_TABLES_USE - 1); i += 2)
++ {
++ UInt64 r0 = g_Crc64Table[(size_t)(i) ];
++ UInt64 r1 = g_Crc64Table[(size_t)(i) + 1];
++ r0 = g_Crc64Table[(Byte)r0] ^ (r0 >> 8);
++ r1 = g_Crc64Table[(Byte)r1] ^ (r1 >> 8);
++ g_Crc64Table[(size_t)i + 256 ] = r0;
++ g_Crc64Table[(size_t)i + 256 + 1] = r1;
++ }
++#endif
+
+- #else
++#ifndef MY_CPU_LE
+ {
+- #ifndef MY_CPU_BE
++#ifndef MY_CPU_BE
+ UInt32 k = 1;
+ if (*(const Byte *)&k == 1)
+- g_Crc64Update = XzCrc64UpdateT4;
++ FUNC_REF = FUNC_NAME_LE;
+ else
+- #endif
++#endif
+ {
+- for (i = 256 * CRC64_NUM_TABLES - 1; i >= 256; i--)
++#ifndef MY_CPU_BE
++ FUNC_REF = FUNC_NAME_BE;
++#endif
++ for (i = 0; i < 256 * Z7_CRC64_NUM_TABLES_USE; i++)
+ {
+- UInt64 x = g_Crc64Table[(size_t)i - 256];
+- g_Crc64Table[i] = CRC_UINT64_SWAP(x);
++ const UInt64 x = g_Crc64Table[i];
++ g_Crc64Table[i] = Z7_BSWAP64(x);
+ }
+- g_Crc64Update = XzCrc64UpdateT1_BeT4;
+ }
+ }
+- #endif
++#endif // ndef MY_CPU_LE
++#endif // Z7_CRC64_NUM_TABLES_USE != 1
+ }
++
++#undef kCrc64Poly
++#undef Z7_CRC64_NUM_TABLES_USE
++#undef FUNC_REF
++#undef FUNC_NAME_LE_2
++#undef FUNC_NAME_LE_1
++#undef FUNC_NAME_LE
++#undef FUNC_NAME_BE_2
++#undef FUNC_NAME_BE_1
++#undef FUNC_NAME_BE
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.h b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.h
new file mode 100644
index 0000000000..735d2b6764
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/XzCrc64.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/XzCrc64.h
+@@ -1,8 +1,8 @@
+ /* XzCrc64.h -- CRC64 calculation
+-2013-01-18 : Igor Pavlov : Public domain */
++2023-12-08 : Igor Pavlov : Public domain */
+
+-#ifndef __XZ_CRC64_H
+-#define __XZ_CRC64_H
++#ifndef ZIP7_INC_XZ_CRC64_H
++#define ZIP7_INC_XZ_CRC64_H
+
+ #include <stddef.h>
+
+@@ -10,16 +10,16 @@
+
+ EXTERN_C_BEGIN
+
+-extern UInt64 g_Crc64Table[];
++// extern UInt64 g_Crc64Table[];
+
+-void MY_FAST_CALL Crc64GenerateTable(void);
++void Z7_FASTCALL Crc64GenerateTable(void);
+
+ #define CRC64_INIT_VAL UINT64_CONST(0xFFFFFFFFFFFFFFFF)
+ #define CRC64_GET_DIGEST(crc) ((crc) ^ CRC64_INIT_VAL)
+-#define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++// #define CRC64_UPDATE_BYTE(crc, b) (g_Crc64Table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
+
+-UInt64 MY_FAST_CALL Crc64Update(UInt64 crc, const void *data, size_t size);
+-UInt64 MY_FAST_CALL Crc64Calc(const void *data, size_t size);
++UInt64 Z7_FASTCALL Crc64Update(UInt64 crc, const void *data, size_t size);
++// UInt64 Z7_FASTCALL Crc64Calc(const void *data, size_t size);
+
+ EXTERN_C_END
+
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64Opt.c b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64Opt.c
new file mode 100644
index 0000000000..4abbaec86f
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_XzCrc64Opt.c
@@ -0,0 +1,308 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/XzCrc64Opt.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/XzCrc64Opt.c
+@@ -1,71 +1,261 @@
+-/* XzCrc64Opt.c -- CRC64 calculation
+-2021-02-09 : Igor Pavlov : Public domain */
++/* XzCrc64Opt.c -- CRC64 calculation (optimized functions)
++2023-12-08 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+ #include "CpuArch.h"
+
++#if !defined(Z7_CRC64_NUM_TABLES) || Z7_CRC64_NUM_TABLES > 1
++
++// for debug only : define Z7_CRC64_DEBUG_BE to test big-endian code in little-endian cpu
++// #define Z7_CRC64_DEBUG_BE
++#ifdef Z7_CRC64_DEBUG_BE
++#undef MY_CPU_LE
++#define MY_CPU_BE
++#endif
++
++#if defined(MY_CPU_64BIT)
++#define Z7_CRC64_USE_64BIT
++#endif
++
++// the value Z7_CRC64_NUM_TABLES_USE must be defined to same value as in XzCrc64.c
++#ifdef Z7_CRC64_NUM_TABLES
++#define Z7_CRC64_NUM_TABLES_USE Z7_CRC64_NUM_TABLES
++#else
++#define Z7_CRC64_NUM_TABLES_USE 12
++#endif
++
++#if Z7_CRC64_NUM_TABLES_USE % 4 || \
++ Z7_CRC64_NUM_TABLES_USE < 4 || \
++ Z7_CRC64_NUM_TABLES_USE > 4 * 4
++ #error Stop_Compiling_Bad_CRC64_NUM_TABLES
++#endif
++
++
+ #ifndef MY_CPU_BE
+
+-#define CRC64_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++#define CRC64_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
++
++#if defined(Z7_CRC64_USE_64BIT) && (Z7_CRC64_NUM_TABLES_USE % 8 == 0)
++
++#define Q64LE(n, d) \
++ ( (table + ((n) * 8 + 7) * 0x100)[((d) ) & 0xFF] \
++ ^ (table + ((n) * 8 + 6) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 5) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 4) * 0x100)[((d) >> 3 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 3) * 0x100)[((d) >> 4 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 2) * 0x100)[((d) >> 5 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 1) * 0x100)[((d) >> 6 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 0) * 0x100)[((d) >> 7 * 8)] )
++
++#define R64(a) *((const UInt64 *)(const void *)p + (a))
++
++#else
++
++#define Q32LE(n, d) \
++ ( (table + ((n) * 4 + 3) * 0x100)[((d) ) & 0xFF] \
++ ^ (table + ((n) * 4 + 2) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 1) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 0) * 0x100)[((d) >> 3 * 8)] )
++
++#define R32(a) *((const UInt32 *)(const void *)p + (a))
++
++#endif
++
++
++#define CRC64_FUNC_PRE_LE2(step) \
++UInt64 Z7_FASTCALL XzCrc64UpdateT ## step (UInt64 v, const void *data, size_t size, const UInt64 *table)
++
++#define CRC64_FUNC_PRE_LE(step) \
++ CRC64_FUNC_PRE_LE2(step); \
++ CRC64_FUNC_PRE_LE2(step)
+
+-UInt64 MY_FAST_CALL XzCrc64UpdateT4(UInt64 v, const void *data, size_t size, const UInt64 *table);
+-UInt64 MY_FAST_CALL XzCrc64UpdateT4(UInt64 v, const void *data, size_t size, const UInt64 *table)
++CRC64_FUNC_PRE_LE(Z7_CRC64_NUM_TABLES_USE)
+ {
+ const Byte *p = (const Byte *)data;
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
++ const Byte *lim;
++ for (; size && ((unsigned)(ptrdiff_t)p & (7 - (Z7_CRC64_NUM_TABLES_USE & 4))) != 0; size--, p++)
+ v = CRC64_UPDATE_BYTE_2(v, *p);
+- for (; size >= 4; size -= 4, p += 4)
++ lim = p + size;
++ if (size >= Z7_CRC64_NUM_TABLES_USE)
+ {
+- UInt32 d = (UInt32)v ^ *(const UInt32 *)(const void *)p;
+- v = (v >> 32)
+- ^ (table + 0x300)[((d ) & 0xFF)]
+- ^ (table + 0x200)[((d >> 8) & 0xFF)]
+- ^ (table + 0x100)[((d >> 16) & 0xFF)]
+- ^ (table + 0x000)[((d >> 24))];
++ lim -= Z7_CRC64_NUM_TABLES_USE;
++ do
++ {
++#if Z7_CRC64_NUM_TABLES_USE == 4
++ const UInt32 d = (UInt32)v ^ R32(0);
++ v = (v >> 32) ^ Q32LE(0, d);
++#elif Z7_CRC64_NUM_TABLES_USE == 8
++#ifdef Z7_CRC64_USE_64BIT
++ v ^= R64(0);
++ v = Q64LE(0, v);
++#else
++ UInt32 v0, v1;
++ v0 = (UInt32)v ^ R32(0);
++ v1 = (UInt32)(v >> 32) ^ R32(1);
++ v = Q32LE(1, v0) ^ Q32LE(0, v1);
++#endif
++#elif Z7_CRC64_NUM_TABLES_USE == 12
++ UInt32 w;
++ UInt32 v0, v1;
++ v0 = (UInt32)v ^ R32(0);
++ v1 = (UInt32)(v >> 32) ^ R32(1);
++ w = R32(2);
++ v = Q32LE(0, w);
++ v ^= Q32LE(2, v0) ^ Q32LE(1, v1);
++#elif Z7_CRC64_NUM_TABLES_USE == 16
++#ifdef Z7_CRC64_USE_64BIT
++ UInt64 w;
++ UInt64 x;
++ w = R64(1); x = Q64LE(0, w);
++ v ^= R64(0); v = x ^ Q64LE(1, v);
++#else
++ UInt32 v0, v1;
++ UInt32 r0, r1;
++ v0 = (UInt32)v ^ R32(0);
++ v1 = (UInt32)(v >> 32) ^ R32(1);
++ r0 = R32(2);
++ r1 = R32(3);
++ v = Q32LE(1, r0) ^ Q32LE(0, r1);
++ v ^= Q32LE(3, v0) ^ Q32LE(2, v1);
++#endif
++#else
++#error Stop_Compiling_Bad_CRC64_NUM_TABLES
++#endif
++ p += Z7_CRC64_NUM_TABLES_USE;
++ }
++ while (p <= lim);
++ lim += Z7_CRC64_NUM_TABLES_USE;
+ }
+- for (; size > 0; size--, p++)
++ for (; p < lim; p++)
+ v = CRC64_UPDATE_BYTE_2(v, *p);
+ return v;
+ }
+
++#undef CRC64_UPDATE_BYTE_2
++#undef R32
++#undef R64
++#undef Q32LE
++#undef Q64LE
++#undef CRC64_FUNC_PRE_LE
++#undef CRC64_FUNC_PRE_LE2
++
+ #endif
+
+
++
++
+ #ifndef MY_CPU_LE
+
+-#define CRC_UINT64_SWAP(v) \
+- ((v >> 56) \
+- | ((v >> 40) & ((UInt64)0xFF << 8)) \
+- | ((v >> 24) & ((UInt64)0xFF << 16)) \
+- | ((v >> 8) & ((UInt64)0xFF << 24)) \
+- | ((v << 8) & ((UInt64)0xFF << 32)) \
+- | ((v << 24) & ((UInt64)0xFF << 40)) \
+- | ((v << 40) & ((UInt64)0xFF << 48)) \
+- | ((v << 56)))
++#define CRC64_UPDATE_BYTE_2_BE(crc, b) (table[((crc) >> 56) ^ (b)] ^ ((crc) << 8))
++
++#if defined(Z7_CRC64_USE_64BIT) && (Z7_CRC64_NUM_TABLES_USE % 8 == 0)
++
++#define Q64BE(n, d) \
++ ( (table + ((n) * 8 + 0) * 0x100)[(Byte)(d)] \
++ ^ (table + ((n) * 8 + 1) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 2) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 3) * 0x100)[((d) >> 3 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 4) * 0x100)[((d) >> 4 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 5) * 0x100)[((d) >> 5 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 6) * 0x100)[((d) >> 6 * 8) & 0xFF] \
++ ^ (table + ((n) * 8 + 7) * 0x100)[((d) >> 7 * 8)] )
++
++#ifdef Z7_CRC64_DEBUG_BE
++ #define R64BE(a) GetBe64a((const UInt64 *)(const void *)p + (a))
++#else
++ #define R64BE(a) *((const UInt64 *)(const void *)p + (a))
++#endif
++
++#else
++
++#define Q32BE(n, d) \
++ ( (table + ((n) * 4 + 0) * 0x100)[(Byte)(d)] \
++ ^ (table + ((n) * 4 + 1) * 0x100)[((d) >> 1 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 2) * 0x100)[((d) >> 2 * 8) & 0xFF] \
++ ^ (table + ((n) * 4 + 3) * 0x100)[((d) >> 3 * 8)] )
++
++#ifdef Z7_CRC64_DEBUG_BE
++ #define R32BE(a) GetBe32a((const UInt32 *)(const void *)p + (a))
++#else
++ #define R32BE(a) *((const UInt32 *)(const void *)p + (a))
++#endif
++
++#endif
+
+-#define CRC64_UPDATE_BYTE_2_BE(crc, b) (table[(Byte)((crc) >> 56) ^ (b)] ^ ((crc) << 8))
++#define CRC64_FUNC_PRE_BE2(step) \
++UInt64 Z7_FASTCALL XzCrc64UpdateBeT ## step (UInt64 v, const void *data, size_t size, const UInt64 *table)
+
+-UInt64 MY_FAST_CALL XzCrc64UpdateT1_BeT4(UInt64 v, const void *data, size_t size, const UInt64 *table);
+-UInt64 MY_FAST_CALL XzCrc64UpdateT1_BeT4(UInt64 v, const void *data, size_t size, const UInt64 *table)
++#define CRC64_FUNC_PRE_BE(step) \
++ CRC64_FUNC_PRE_BE2(step); \
++ CRC64_FUNC_PRE_BE2(step)
++
++CRC64_FUNC_PRE_BE(Z7_CRC64_NUM_TABLES_USE)
+ {
+ const Byte *p = (const Byte *)data;
+- table += 0x100;
+- v = CRC_UINT64_SWAP(v);
+- for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
++ const Byte *lim;
++ v = Z7_BSWAP64(v);
++ for (; size && ((unsigned)(ptrdiff_t)p & (7 - (Z7_CRC64_NUM_TABLES_USE & 4))) != 0; size--, p++)
+ v = CRC64_UPDATE_BYTE_2_BE(v, *p);
+- for (; size >= 4; size -= 4, p += 4)
++ lim = p + size;
++ if (size >= Z7_CRC64_NUM_TABLES_USE)
+ {
+- UInt32 d = (UInt32)(v >> 32) ^ *(const UInt32 *)(const void *)p;
+- v = (v << 32)
+- ^ (table + 0x000)[((d ) & 0xFF)]
+- ^ (table + 0x100)[((d >> 8) & 0xFF)]
+- ^ (table + 0x200)[((d >> 16) & 0xFF)]
+- ^ (table + 0x300)[((d >> 24))];
++ lim -= Z7_CRC64_NUM_TABLES_USE;
++ do
++ {
++#if Z7_CRC64_NUM_TABLES_USE == 4
++ const UInt32 d = (UInt32)(v >> 32) ^ R32BE(0);
++ v = (v << 32) ^ Q32BE(0, d);
++#elif Z7_CRC64_NUM_TABLES_USE == 12
++ const UInt32 d1 = (UInt32)(v >> 32) ^ R32BE(0);
++ const UInt32 d0 = (UInt32)(v ) ^ R32BE(1);
++ const UInt32 w = R32BE(2);
++ v = Q32BE(0, w);
++ v ^= Q32BE(2, d1) ^ Q32BE(1, d0);
++
++#elif Z7_CRC64_NUM_TABLES_USE == 8
++ #ifdef Z7_CRC64_USE_64BIT
++ v ^= R64BE(0);
++ v = Q64BE(0, v);
++ #else
++ const UInt32 d1 = (UInt32)(v >> 32) ^ R32BE(0);
++ const UInt32 d0 = (UInt32)(v ) ^ R32BE(1);
++ v = Q32BE(1, d1) ^ Q32BE(0, d0);
++ #endif
++#elif Z7_CRC64_NUM_TABLES_USE == 16
++ #ifdef Z7_CRC64_USE_64BIT
++ const UInt64 w = R64BE(1);
++ v ^= R64BE(0);
++ v = Q64BE(0, w) ^ Q64BE(1, v);
++ #else
++ const UInt32 d1 = (UInt32)(v >> 32) ^ R32BE(0);
++ const UInt32 d0 = (UInt32)(v ) ^ R32BE(1);
++ const UInt32 w1 = R32BE(2);
++ const UInt32 w0 = R32BE(3);
++ v = Q32BE(1, w1) ^ Q32BE(0, w0);
++ v ^= Q32BE(3, d1) ^ Q32BE(2, d0);
++ #endif
++#elif
++#error Stop_Compiling_Bad_CRC64_NUM_TABLES
++#endif
++ p += Z7_CRC64_NUM_TABLES_USE;
++ }
++ while (p <= lim);
++ lim += Z7_CRC64_NUM_TABLES_USE;
+ }
+- for (; size > 0; size--, p++)
++ for (; p < lim; p++)
+ v = CRC64_UPDATE_BYTE_2_BE(v, *p);
+- return CRC_UINT64_SWAP(v);
++ return Z7_BSWAP64(v);
+ }
+
++#undef CRC64_UPDATE_BYTE_2_BE
++#undef R32BE
++#undef R64BE
++#undef Q32BE
++#undef Q64BE
++#undef CRC64_FUNC_PRE_BE
++#undef CRC64_FUNC_PRE_BE2
++
++#endif
++#undef Z7_CRC64_NUM_TABLES_USE
+ #endif
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_XzDec.c b/electron34/patches/patch-third__party_lzma__sdk_C_XzDec.c
new file mode 100644
index 0000000000..90e5bcabdc
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_XzDec.c
@@ -0,0 +1,936 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/XzDec.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/XzDec.c
+@@ -1,5 +1,5 @@
+ /* XzDec.c -- Xz Decode
+-2021-09-04 : Igor Pavlov : Public domain */
++2024-03-01 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -67,7 +67,8 @@ unsigned Xz_ReadVarInt(const Byte *p, si
+ return 0;
+ }
+
+-/* ---------- BraState ---------- */
++
++/* ---------- XzBcFilterState ---------- */
+
+ #define BRA_BUF_SIZE (1 << 14)
+
+@@ -76,55 +77,60 @@ typedef struct
+ size_t bufPos;
+ size_t bufConv;
+ size_t bufTotal;
++ Byte *buf; // must be aligned for 4 bytes
++ Xz_Func_BcFilterStateBase_Filter filter_func;
++ // int encodeMode;
++ CXzBcFilterStateBase base;
++ // Byte buf[BRA_BUF_SIZE];
++} CXzBcFilterState;
+
+- int encodeMode;
+-
+- UInt32 methodId;
+- UInt32 delta;
+- UInt32 ip;
+- UInt32 x86State;
+- Byte deltaState[DELTA_STATE_SIZE];
+-
+- Byte buf[BRA_BUF_SIZE];
+-} CBraState;
+
+-static void BraState_Free(void *pp, ISzAllocPtr alloc)
++static void XzBcFilterState_Free(void *pp, ISzAllocPtr alloc)
+ {
+- ISzAlloc_Free(alloc, pp);
++ if (pp)
++ {
++ CXzBcFilterState *p = ((CXzBcFilterState *)pp);
++ ISzAlloc_Free(alloc, p->buf);
++ ISzAlloc_Free(alloc, pp);
++ }
+ }
+
+-static SRes BraState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAllocPtr alloc)
++
++static SRes XzBcFilterState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAllocPtr alloc)
+ {
+- CBraState *p = ((CBraState *)pp);
+- UNUSED_VAR(alloc);
++ CXzBcFilterStateBase *p = &((CXzBcFilterState *)pp)->base;
++ UNUSED_VAR(alloc)
+ p->ip = 0;
+ if (p->methodId == XZ_ID_Delta)
+ {
+ if (propSize != 1)
+ return SZ_ERROR_UNSUPPORTED;
+- p->delta = (unsigned)props[0] + 1;
++ p->delta = (UInt32)props[0] + 1;
+ }
+ else
+ {
+ if (propSize == 4)
+ {
+- UInt32 v = GetUi32(props);
++ const UInt32 v = GetUi32(props);
+ switch (p->methodId)
+ {
+ case XZ_ID_PPC:
+ case XZ_ID_ARM:
+ case XZ_ID_SPARC:
+- if ((v & 3) != 0)
++ case XZ_ID_ARM64:
++ if (v & 3)
+ return SZ_ERROR_UNSUPPORTED;
+ break;
+ case XZ_ID_ARMT:
+- if ((v & 1) != 0)
++ case XZ_ID_RISCV:
++ if (v & 1)
+ return SZ_ERROR_UNSUPPORTED;
+ break;
+ case XZ_ID_IA64:
+- if ((v & 0xF) != 0)
++ if (v & 0xf)
+ return SZ_ERROR_UNSUPPORTED;
+ break;
++ default: break;
+ }
+ p->ip = v;
+ }
+@@ -134,73 +140,91 @@ static SRes BraState_SetProps(void *pp,
+ return SZ_OK;
+ }
+
+-static void BraState_Init(void *pp)
++
++static void XzBcFilterState_Init(void *pp)
+ {
+- CBraState *p = ((CBraState *)pp);
++ CXzBcFilterState *p = ((CXzBcFilterState *)pp);
+ p->bufPos = p->bufConv = p->bufTotal = 0;
+- x86_Convert_Init(p->x86State);
+- if (p->methodId == XZ_ID_Delta)
+- Delta_Init(p->deltaState);
++ p->base.X86_State = Z7_BRANCH_CONV_ST_X86_STATE_INIT_VAL;
++ if (p->base.methodId == XZ_ID_Delta)
++ Delta_Init(p->base.delta_State);
+ }
+
+
+-#define CASE_BRA_CONV(isa) case XZ_ID_ ## isa: size = isa ## _Convert(data, size, p->ip, p->encodeMode); break;
++static const z7_Func_BranchConv g_Funcs_BranchConv_RISC_Dec[] =
++{
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_PPC),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_IA64),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_ARM),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_ARMT),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_SPARC),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_ARM64),
++ Z7_BRANCH_CONV_DEC_2 (BranchConv_RISCV)
++};
+
+-static SizeT BraState_Filter(void *pp, Byte *data, SizeT size)
++static SizeT XzBcFilterStateBase_Filter_Dec(CXzBcFilterStateBase *p, Byte *data, SizeT size)
+ {
+- CBraState *p = ((CBraState *)pp);
+ switch (p->methodId)
+ {
+ case XZ_ID_Delta:
+- if (p->encodeMode)
+- Delta_Encode(p->deltaState, p->delta, data, size);
+- else
+- Delta_Decode(p->deltaState, p->delta, data, size);
++ Delta_Decode(p->delta_State, p->delta, data, size);
+ break;
+ case XZ_ID_X86:
+- size = x86_Convert(data, size, p->ip, &p->x86State, p->encodeMode);
++ size = (SizeT)(z7_BranchConvSt_X86_Dec(data, size, p->ip, &p->X86_State) - data);
++ break;
++ default:
++ if (p->methodId >= XZ_ID_PPC)
++ {
++ const UInt32 i = p->methodId - XZ_ID_PPC;
++ if (i < Z7_ARRAY_SIZE(g_Funcs_BranchConv_RISC_Dec))
++ size = (SizeT)(g_Funcs_BranchConv_RISC_Dec[i](data, size, p->ip) - data);
++ }
+ break;
+- CASE_BRA_CONV(PPC)
+- CASE_BRA_CONV(IA64)
+- CASE_BRA_CONV(ARM)
+- CASE_BRA_CONV(ARMT)
+- CASE_BRA_CONV(SPARC)
+ }
+ p->ip += (UInt32)size;
+ return size;
+ }
+
+
+-static SRes BraState_Code2(void *pp,
++static SizeT XzBcFilterState_Filter(void *pp, Byte *data, SizeT size)
++{
++ CXzBcFilterState *p = ((CXzBcFilterState *)pp);
++ return p->filter_func(&p->base, data, size);
++}
++
++
++static SRes XzBcFilterState_Code2(void *pp,
+ Byte *dest, SizeT *destLen,
+ const Byte *src, SizeT *srcLen, int srcWasFinished,
+ ECoderFinishMode finishMode,
+ // int *wasFinished
+ ECoderStatus *status)
+ {
+- CBraState *p = ((CBraState *)pp);
++ CXzBcFilterState *p = ((CXzBcFilterState *)pp);
+ SizeT destRem = *destLen;
+ SizeT srcRem = *srcLen;
+- UNUSED_VAR(finishMode);
++ UNUSED_VAR(finishMode)
+
+ *destLen = 0;
+ *srcLen = 0;
+ // *wasFinished = False;
+ *status = CODER_STATUS_NOT_FINISHED;
+
+- while (destRem > 0)
++ while (destRem != 0)
+ {
+- if (p->bufPos != p->bufConv)
+ {
+ size_t size = p->bufConv - p->bufPos;
+- if (size > destRem)
+- size = destRem;
+- memcpy(dest, p->buf + p->bufPos, size);
+- p->bufPos += size;
+- *destLen += size;
+- dest += size;
+- destRem -= size;
+- continue;
++ if (size)
++ {
++ if (size > destRem)
++ size = destRem;
++ memcpy(dest, p->buf + p->bufPos, size);
++ p->bufPos += size;
++ *destLen += size;
++ dest += size;
++ destRem -= size;
++ continue;
++ }
+ }
+
+ p->bufTotal -= p->bufPos;
+@@ -220,7 +244,7 @@ static SRes BraState_Code2(void *pp,
+ if (p->bufTotal == 0)
+ break;
+
+- p->bufConv = BraState_Filter(pp, p->buf, p->bufTotal);
++ p->bufConv = p->filter_func(&p->base, p->buf, p->bufTotal);
+
+ if (p->bufConv == 0)
+ {
+@@ -240,27 +264,37 @@ static SRes BraState_Code2(void *pp,
+ }
+
+
+-SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAllocPtr alloc);
+-SRes BraState_SetFromMethod(IStateCoder *p, UInt64 id, int encodeMode, ISzAllocPtr alloc)
++#define XZ_IS_SUPPORTED_FILTER_ID(id) \
++ ((id) >= XZ_ID_Delta && (id) <= XZ_ID_RISCV)
++
++SRes Xz_StateCoder_Bc_SetFromMethod_Func(IStateCoder *p, UInt64 id,
++ Xz_Func_BcFilterStateBase_Filter func, ISzAllocPtr alloc)
+ {
+- CBraState *decoder;
+- if (id < XZ_ID_Delta || id > XZ_ID_SPARC)
++ CXzBcFilterState *decoder;
++ if (!XZ_IS_SUPPORTED_FILTER_ID(id))
+ return SZ_ERROR_UNSUPPORTED;
+- decoder = (CBraState *)p->p;
++ decoder = (CXzBcFilterState *)p->p;
+ if (!decoder)
+ {
+- decoder = (CBraState *)ISzAlloc_Alloc(alloc, sizeof(CBraState));
++ decoder = (CXzBcFilterState *)ISzAlloc_Alloc(alloc, sizeof(CXzBcFilterState));
+ if (!decoder)
+ return SZ_ERROR_MEM;
++ decoder->buf = ISzAlloc_Alloc(alloc, BRA_BUF_SIZE);
++ if (!decoder->buf)
++ {
++ ISzAlloc_Free(alloc, decoder);
++ return SZ_ERROR_MEM;
++ }
+ p->p = decoder;
+- p->Free = BraState_Free;
+- p->SetProps = BraState_SetProps;
+- p->Init = BraState_Init;
+- p->Code2 = BraState_Code2;
+- p->Filter = BraState_Filter;
++ p->Free = XzBcFilterState_Free;
++ p->SetProps = XzBcFilterState_SetProps;
++ p->Init = XzBcFilterState_Init;
++ p->Code2 = XzBcFilterState_Code2;
++ p->Filter = XzBcFilterState_Filter;
++ decoder->filter_func = func;
+ }
+- decoder->methodId = (UInt32)id;
+- decoder->encodeMode = encodeMode;
++ decoder->base.methodId = (UInt32)id;
++ // decoder->encodeMode = encodeMode;
+ return SZ_OK;
+ }
+
+@@ -279,9 +313,9 @@ static void SbState_Free(void *pp, ISzAl
+
+ static SRes SbState_SetProps(void *pp, const Byte *props, size_t propSize, ISzAllocPtr alloc)
+ {
+- UNUSED_VAR(pp);
+- UNUSED_VAR(props);
+- UNUSED_VAR(alloc);
++ UNUSED_VAR(pp)
++ UNUSED_VAR(props)
++ UNUSED_VAR(alloc)
+ return (propSize == 0) ? SZ_OK : SZ_ERROR_UNSUPPORTED;
+ }
+
+@@ -297,7 +331,7 @@ static SRes SbState_Code2(void *pp, Byte
+ {
+ CSbDec *p = (CSbDec *)pp;
+ SRes res;
+- UNUSED_VAR(srcWasFinished);
++ UNUSED_VAR(srcWasFinished)
+ p->dest = dest;
+ p->destLen = *destLen;
+ p->src = src;
+@@ -389,7 +423,7 @@ static SRes Lzma2State_Code2(void *pp, B
+ ELzmaStatus status2;
+ /* ELzmaFinishMode fm = (finishMode == LZMA_FINISH_ANY) ? LZMA_FINISH_ANY : LZMA_FINISH_END; */
+ SRes res;
+- UNUSED_VAR(srcWasFinished);
++ UNUSED_VAR(srcWasFinished)
+ if (spec->outBufMode)
+ {
+ SizeT dicPos = spec->decoder.decoder.dicPos;
+@@ -420,7 +454,7 @@ static SRes Lzma2State_SetFromMethod(ISt
+ p->Init = Lzma2State_Init;
+ p->Code2 = Lzma2State_Code2;
+ p->Filter = NULL;
+- Lzma2Dec_Construct(&spec->decoder);
++ Lzma2Dec_CONSTRUCT(&spec->decoder)
+ }
+ spec->outBufMode = False;
+ if (outBuf)
+@@ -510,26 +544,24 @@ static SRes MixCoder_SetFromMethod(CMixC
+ {
+ IStateCoder *sc = &p->coders[coderIndex];
+ p->ids[coderIndex] = methodId;
+- switch (methodId)
+- {
+- case XZ_ID_LZMA2: return Lzma2State_SetFromMethod(sc, outBuf, outBufSize, p->alloc);
+- #ifdef USE_SUBBLOCK
+- case XZ_ID_Subblock: return SbState_SetFromMethod(sc, p->alloc);
+- #endif
+- }
++ if (methodId == XZ_ID_LZMA2)
++ return Lzma2State_SetFromMethod(sc, outBuf, outBufSize, p->alloc);
++#ifdef USE_SUBBLOCK
++ if (methodId == XZ_ID_Subblock)
++ return SbState_SetFromMethod(sc, p->alloc);
++#endif
+ if (coderIndex == 0)
+ return SZ_ERROR_UNSUPPORTED;
+- return BraState_SetFromMethod(sc, methodId, 0, p->alloc);
++ return Xz_StateCoder_Bc_SetFromMethod_Func(sc, methodId,
++ XzBcFilterStateBase_Filter_Dec, p->alloc);
+ }
+
+
+ static SRes MixCoder_ResetFromMethod(CMixCoder *p, unsigned coderIndex, UInt64 methodId, Byte *outBuf, size_t outBufSize)
+ {
+ IStateCoder *sc = &p->coders[coderIndex];
+- switch (methodId)
+- {
+- case XZ_ID_LZMA2: return Lzma2State_ResetOutBuf(sc, outBuf, outBufSize);
+- }
++ if (methodId == XZ_ID_LZMA2)
++ return Lzma2State_ResetOutBuf(sc, outBuf, outBufSize);
+ return SZ_ERROR_UNSUPPORTED;
+ }
+
+@@ -568,7 +600,7 @@ static SRes MixCoder_Code(CMixCoder *p,
+ SizeT destLen2, srcLen2;
+ int wasFinished;
+
+- PRF_STR("------- MixCoder Single ----------");
++ PRF_STR("------- MixCoder Single ----------")
+
+ srcLen2 = srcLenOrig;
+ destLen2 = destLenOrig;
+@@ -615,14 +647,14 @@ static SRes MixCoder_Code(CMixCoder *p,
+ processed = coder->Filter(coder->p, p->outBuf, processed);
+ if (wasFinished || (destFinish && p->outWritten == destLenOrig))
+ processed = p->outWritten;
+- PRF_STR_INT("filter", i);
++ PRF_STR_INT("filter", i)
+ }
+ *destLen = processed;
+ }
+ return res;
+ }
+
+- PRF_STR("standard mix");
++ PRF_STR("standard mix")
+
+ if (p->numCoders != 1)
+ {
+@@ -772,14 +804,14 @@ static BoolInt Xz_CheckFooter(CXzStreamF
+ }
+
+ #define READ_VARINT_AND_CHECK(buf, pos, size, res) \
+- { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \
++ { const unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \
+ if (s == 0) return SZ_ERROR_ARCHIVE; \
+ pos += s; }
+
+
+ static BoolInt XzBlock_AreSupportedFilters(const CXzBlock *p)
+ {
+- unsigned numFilters = XzBlock_GetNumFilters(p) - 1;
++ const unsigned numFilters = XzBlock_GetNumFilters(p) - 1;
+ unsigned i;
+ {
+ const CXzFilter *f = &p->filters[numFilters];
+@@ -795,8 +827,7 @@ static BoolInt XzBlock_AreSupportedFilte
+ if (f->propsSize != 1)
+ return False;
+ }
+- else if (f->id < XZ_ID_Delta
+- || f->id > XZ_ID_SPARC
++ else if (!XZ_IS_SUPPORTED_FILTER_ID(f->id)
+ || (f->propsSize != 0 && f->propsSize != 4))
+ return False;
+ }
+@@ -821,22 +852,24 @@ SRes XzBlock_Parse(CXzBlock *p, const By
+ p->packSize = (UInt64)(Int64)-1;
+ if (XzBlock_HasPackSize(p))
+ {
+- READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize);
++ READ_VARINT_AND_CHECK(header, pos, headerSize, &p->packSize)
+ if (p->packSize == 0 || p->packSize + headerSize >= (UInt64)1 << 63)
+ return SZ_ERROR_ARCHIVE;
+ }
+
+ p->unpackSize = (UInt64)(Int64)-1;
+ if (XzBlock_HasUnpackSize(p))
+- READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize);
++ {
++ READ_VARINT_AND_CHECK(header, pos, headerSize, &p->unpackSize)
++ }
+
+ numFilters = XzBlock_GetNumFilters(p);
+ for (i = 0; i < numFilters; i++)
+ {
+ CXzFilter *filter = p->filters + i;
+ UInt64 size;
+- READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id);
+- READ_VARINT_AND_CHECK(header, pos, headerSize, &size);
++ READ_VARINT_AND_CHECK(header, pos, headerSize, &filter->id)
++ READ_VARINT_AND_CHECK(header, pos, headerSize, &size)
+ if (size > headerSize - pos || size > XZ_FILTER_PROPS_SIZE_MAX)
+ return SZ_ERROR_ARCHIVE;
+ filter->propsSize = (UInt32)size;
+@@ -894,20 +927,20 @@ static SRes XzDecMix_Init(CMixCoder *p,
+ MixCoder_Free(p);
+ for (i = 0; i < numFilters; i++)
+ {
+- RINOK(MixCoder_SetFromMethod(p, i, block->filters[numFilters - 1 - i].id, outBuf, outBufSize));
++ RINOK(MixCoder_SetFromMethod(p, i, block->filters[numFilters - 1 - i].id, outBuf, outBufSize))
+ }
+ p->numCoders = numFilters;
+ }
+ else
+ {
+- RINOK(MixCoder_ResetFromMethod(p, 0, block->filters[numFilters - 1].id, outBuf, outBufSize));
++ RINOK(MixCoder_ResetFromMethod(p, 0, block->filters[numFilters - 1].id, outBuf, outBufSize))
+ }
+
+ for (i = 0; i < numFilters; i++)
+ {
+ const CXzFilter *f = &block->filters[numFilters - 1 - i];
+ IStateCoder *sc = &p->coders[i];
+- RINOK(sc->SetProps(sc->p, f->props, f->propsSize, p->alloc));
++ RINOK(sc->SetProps(sc->p, f->props, f->propsSize, p->alloc))
+ }
+
+ MixCoder_Init(p);
+@@ -1001,7 +1034,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ SRes res;
+
+ ECoderFinishMode finishMode2 = finishMode;
+- BoolInt srcFinished2 = srcFinished;
++ BoolInt srcFinished2 = (BoolInt)srcFinished;
+ BoolInt destFinish = False;
+
+ if (p->block.packSize != (UInt64)(Int64)-1)
+@@ -1054,14 +1087,14 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ (*destLen) += destLen2;
+ p->unpackSize += destLen2;
+
+- RINOK(res);
++ RINOK(res)
+
+ if (*status != CODER_STATUS_FINISHED_WITH_MARK)
+ {
+ if (p->block.packSize == p->packSize
+ && *status == CODER_STATUS_NEEDS_MORE_INPUT)
+ {
+- PRF_STR("CODER_STATUS_NEEDS_MORE_INPUT");
++ PRF_STR("CODER_STATUS_NEEDS_MORE_INPUT")
+ *status = CODER_STATUS_NOT_SPECIFIED;
+ return SZ_ERROR_DATA;
+ }
+@@ -1078,7 +1111,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ if ((p->block.packSize != (UInt64)(Int64)-1 && p->block.packSize != p->packSize)
+ || (p->block.unpackSize != (UInt64)(Int64)-1 && p->block.unpackSize != p->unpackSize))
+ {
+- PRF_STR("ERROR: block.size mismatch");
++ PRF_STR("ERROR: block.size mismatch")
+ return SZ_ERROR_DATA;
+ }
+ }
+@@ -1094,7 +1127,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ return SZ_OK;
+ }
+
+- switch (p->state)
++ switch ((int)p->state)
+ {
+ case XZ_STATE_STREAM_HEADER:
+ {
+@@ -1109,7 +1142,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ }
+ else
+ {
+- RINOK(Xz_ParseHeader(&p->streamFlags, p->buf));
++ RINOK(Xz_ParseHeader(&p->streamFlags, p->buf))
+ p->numStartedStreams++;
+ p->indexSize = 0;
+ p->numBlocks = 0;
+@@ -1139,15 +1172,15 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ p->state = XZ_STATE_STREAM_INDEX;
+ break;
+ }
+- p->blockHeaderSize = ((UInt32)p->buf[0] << 2) + 4;
++ p->blockHeaderSize = ((unsigned)p->buf[0] << 2) + 4;
+ break;
+ }
+
+ if (p->pos != p->blockHeaderSize)
+ {
+- UInt32 cur = p->blockHeaderSize - p->pos;
++ unsigned cur = p->blockHeaderSize - p->pos;
+ if (cur > srcRem)
+- cur = (UInt32)srcRem;
++ cur = (unsigned)srcRem;
+ memcpy(p->buf + p->pos, src, cur);
+ p->pos += cur;
+ (*srcLen) += cur;
+@@ -1155,7 +1188,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ }
+ else
+ {
+- RINOK(XzBlock_Parse(&p->block, p->buf));
++ RINOK(XzBlock_Parse(&p->block, p->buf))
+ if (!XzBlock_AreSupportedFilters(&p->block))
+ return SZ_ERROR_UNSUPPORTED;
+ p->numTotalBlocks++;
+@@ -1168,7 +1201,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ p->headerParsedOk = True;
+ return SZ_OK;
+ }
+- RINOK(XzDecMix_Init(&p->decoder, &p->block, p->outBuf, p->outBufSize));
++ RINOK(XzDecMix_Init(&p->decoder, &p->block, p->outBuf, p->outBufSize))
+ }
+ break;
+ }
+@@ -1189,8 +1222,8 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ }
+ else
+ {
+- UInt32 checkSize = XzFlags_GetCheckSize(p->streamFlags);
+- UInt32 cur = checkSize - p->pos;
++ const unsigned checkSize = XzFlags_GetCheckSize(p->streamFlags);
++ unsigned cur = checkSize - p->pos;
+ if (cur != 0)
+ {
+ if (srcRem == 0)
+@@ -1199,7 +1232,7 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ return SZ_OK;
+ }
+ if (cur > srcRem)
+- cur = (UInt32)srcRem;
++ cur = (unsigned)srcRem;
+ memcpy(p->buf + p->pos, src, cur);
+ p->pos += cur;
+ (*srcLen) += cur;
+@@ -1288,9 +1321,9 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+
+ case XZ_STATE_STREAM_FOOTER:
+ {
+- UInt32 cur = XZ_STREAM_FOOTER_SIZE - p->pos;
++ unsigned cur = XZ_STREAM_FOOTER_SIZE - p->pos;
+ if (cur > srcRem)
+- cur = (UInt32)srcRem;
++ cur = (unsigned)srcRem;
+ memcpy(p->buf + p->pos, src, cur);
+ p->pos += cur;
+ (*srcLen) += cur;
+@@ -1325,6 +1358,8 @@ SRes XzUnpacker_Code(CXzUnpacker *p, Byt
+ }
+
+ case XZ_STATE_BLOCK: break; /* to disable GCC warning */
++
++ default: return SZ_ERROR_FAIL;
+ }
+ }
+ /*
+@@ -1389,7 +1424,7 @@ UInt64 XzUnpacker_GetExtraSize(const CXz
+
+
+
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+ #include "MtDec.h"
+ #endif
+
+@@ -1400,7 +1435,7 @@ void XzDecMtProps_Init(CXzDecMtProps *p)
+ p->outStep_ST = 1 << 20;
+ p->ignoreErrors = False;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ p->numThreads = 1;
+ p->inBufSize_MT = 1 << 18;
+ p->memUseMax = sizeof(size_t) << 28;
+@@ -1409,7 +1444,7 @@ void XzDecMtProps_Init(CXzDecMtProps *p)
+
+
+
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+
+ /* ---------- CXzDecMtThread ---------- */
+
+@@ -1448,7 +1483,7 @@ typedef struct
+
+ /* ---------- CXzDecMt ---------- */
+
+-typedef struct
++struct CXzDecMt
+ {
+ CAlignOffsetAlloc alignOffsetAlloc;
+ ISzAllocPtr allocMid;
+@@ -1456,9 +1491,9 @@ typedef struct
+ CXzDecMtProps props;
+ size_t unpackBlockMaxSize;
+
+- ISeqInStream *inStream;
+- ISeqOutStream *outStream;
+- ICompressProgress *progress;
++ ISeqInStreamPtr inStream;
++ ISeqOutStreamPtr outStream;
++ ICompressProgressPtr progress;
+
+ BoolInt finishMode;
+ BoolInt outSize_Defined;
+@@ -1481,7 +1516,7 @@ typedef struct
+ ECoderStatus status;
+ SRes codeRes;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ BoolInt mainDecoderWasCalled;
+ // int statErrorDefined;
+ int finishedDecoderIndex;
+@@ -1504,10 +1539,9 @@ typedef struct
+
+ BoolInt mtc_WasConstructed;
+ CMtDec mtc;
+- CXzDecMtThread coders[MTDEC__THREADS_MAX];
++ CXzDecMtThread coders[MTDEC_THREADS_MAX];
+ #endif
+-
+-} CXzDecMt;
++};
+
+
+
+@@ -1535,11 +1569,11 @@ CXzDecMtHandle XzDecMt_Create(ISzAllocPt
+
+ XzDecMtProps_Init(&p->props);
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ p->mtc_WasConstructed = False;
+ {
+ unsigned i;
+- for (i = 0; i < MTDEC__THREADS_MAX; i++)
++ for (i = 0; i < MTDEC_THREADS_MAX; i++)
+ {
+ CXzDecMtThread *coder = &p->coders[i];
+ coder->dec_created = False;
+@@ -1549,16 +1583,16 @@ CXzDecMtHandle XzDecMt_Create(ISzAllocPt
+ }
+ #endif
+
+- return p;
++ return (CXzDecMtHandle)p;
+ }
+
+
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+
+ static void XzDecMt_FreeOutBufs(CXzDecMt *p)
+ {
+ unsigned i;
+- for (i = 0; i < MTDEC__THREADS_MAX; i++)
++ for (i = 0; i < MTDEC_THREADS_MAX; i++)
+ {
+ CXzDecMtThread *coder = &p->coders[i];
+ if (coder->outBuf)
+@@ -1595,13 +1629,15 @@ static void XzDecMt_FreeSt(CXzDecMt *p)
+ }
+
+
+-void XzDecMt_Destroy(CXzDecMtHandle pp)
++// #define GET_CXzDecMt_p CXzDecMt *p = pp;
++
++void XzDecMt_Destroy(CXzDecMtHandle p)
+ {
+- CXzDecMt *p = (CXzDecMt *)pp;
++ // GET_CXzDecMt_p
+
+ XzDecMt_FreeSt(p);
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+
+ if (p->mtc_WasConstructed)
+ {
+@@ -1610,7 +1646,7 @@ void XzDecMt_Destroy(CXzDecMtHandle pp)
+ }
+ {
+ unsigned i;
+- for (i = 0; i < MTDEC__THREADS_MAX; i++)
++ for (i = 0; i < MTDEC_THREADS_MAX; i++)
+ {
+ CXzDecMtThread *t = &p->coders[i];
+ if (t->dec_created)
+@@ -1625,12 +1661,12 @@ void XzDecMt_Destroy(CXzDecMtHandle pp)
+
+ #endif
+
+- ISzAlloc_Free(p->alignOffsetAlloc.baseAlloc, pp);
++ ISzAlloc_Free(p->alignOffsetAlloc.baseAlloc, p);
+ }
+
+
+
+-#ifndef _7ZIP_ST
++#ifndef Z7_ST
+
+ static void XzDecMt_Callback_Parse(void *obj, unsigned coderIndex, CMtDecCallbackInfo *cc)
+ {
+@@ -1696,7 +1732,7 @@ static void XzDecMt_Callback_Parse(void
+ coder->dec.parseMode = True;
+ coder->dec.headerParsedOk = False;
+
+- PRF_STR_INT("Parse", srcSize2);
++ PRF_STR_INT("Parse", srcSize2)
+
+ res = XzUnpacker_Code(&coder->dec,
+ NULL, &destSize,
+@@ -1739,10 +1775,10 @@ static void XzDecMt_Callback_Parse(void
+ }
+ }
+ {
+- UInt64 packSize = block->packSize;
+- UInt64 packSizeAligned = packSize + ((0 - (unsigned)packSize) & 3);
+- UInt32 checkSize = XzFlags_GetCheckSize(coder->dec.streamFlags);
+- UInt64 blockPackSum = coder->inPreSize + packSizeAligned + checkSize;
++ const UInt64 packSize = block->packSize;
++ const UInt64 packSizeAligned = packSize + ((0 - (unsigned)packSize) & 3);
++ const unsigned checkSize = XzFlags_GetCheckSize(coder->dec.streamFlags);
++ const UInt64 blockPackSum = coder->inPreSize + packSizeAligned + checkSize;
+ // if (blockPackSum <= me->props.inBlockMax)
+ // unpackBlockMaxSize
+ {
+@@ -2071,7 +2107,7 @@ static SRes XzDecMt_Callback_Write(void
+ }
+ data += cur;
+ size -= cur;
+- // PRF_STR_INT("Written size =", size);
++ // PRF_STR_INT("Written size =", size)
+ if (size == 0)
+ break;
+ res = MtProgress_ProgressAdd(&me->mtc.mtProgress, 0, 0);
+@@ -2087,7 +2123,7 @@ static SRes XzDecMt_Callback_Write(void
+ return res;
+ }
+
+- RINOK(res);
++ RINOK(res)
+
+ if (coder->inPreSize != coder->inCodeSize
+ || coder->blockPackTotal != coder->inCodeSize)
+@@ -2106,13 +2142,13 @@ static SRes XzDecMt_Callback_Write(void
+ // (coder->state == MTDEC_PARSE_END) means that there are no other working threads
+ // so we can use mtc variables without lock
+
+- PRF_STR_INT("Write MTDEC_PARSE_END", me->mtc.inProcessed);
++ PRF_STR_INT("Write MTDEC_PARSE_END", me->mtc.inProcessed)
+
+ me->mtc.mtProgress.totalInSize = me->mtc.inProcessed;
+ {
+ CXzUnpacker *dec = &me->dec;
+
+- PRF_STR_INT("PostSingle", srcSize);
++ PRF_STR_INT("PostSingle", srcSize)
+
+ {
+ size_t srcProcessed = srcSize;
+@@ -2186,7 +2222,7 @@ static SRes XzDecMt_Callback_Write(void
+ me->mtc.crossEnd = srcSize;
+ }
+
+- PRF_STR_INT("XZ_STATE_STREAM_HEADER crossEnd = ", (unsigned)me->mtc.crossEnd);
++ PRF_STR_INT("XZ_STATE_STREAM_HEADER crossEnd = ", (unsigned)me->mtc.crossEnd)
+
+ return SZ_OK;
+ }
+@@ -2277,7 +2313,7 @@ static SRes XzDecMt_Callback_Write(void
+ UInt64 inDelta = me->mtc.inProcessed - inProgressPrev;
+ if (inDelta >= (1 << 22))
+ {
+- RINOK(MtProgress_Progress_ST(&me->mtc.mtProgress));
++ RINOK(MtProgress_Progress_ST(&me->mtc.mtProgress))
+ inProgressPrev = me->mtc.inProcessed;
+ }
+ }
+@@ -2331,7 +2367,7 @@ void XzStatInfo_Clear(CXzStatInfo *p)
+ */
+
+ static SRes XzDecMt_Decode_ST(CXzDecMt *p
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ , BoolInt tMode
+ #endif
+ , CXzStatInfo *stat)
+@@ -2343,11 +2379,11 @@ static SRes XzDecMt_Decode_ST(CXzDecMt *
+
+ CXzUnpacker *dec;
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ if (tMode)
+ {
+ XzDecMt_FreeOutBufs(p);
+- tMode = MtDec_PrepareRead(&p->mtc);
++ tMode = (BoolInt)MtDec_PrepareRead(&p->mtc);
+ }
+ #endif
+
+@@ -2400,7 +2436,7 @@ static SRes XzDecMt_Decode_ST(CXzDecMt *
+
+ if (inPos == inLim)
+ {
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ if (tMode)
+ {
+ inData = MtDec_Read(&p->mtc, &inLim);
+@@ -2577,19 +2613,19 @@ static void XzStatInfo_SetStat(const CXz
+
+
+
+-SRes XzDecMt_Decode(CXzDecMtHandle pp,
++SRes XzDecMt_Decode(CXzDecMtHandle p,
+ const CXzDecMtProps *props,
+ const UInt64 *outDataSize, int finishMode,
+- ISeqOutStream *outStream,
++ ISeqOutStreamPtr outStream,
+ // Byte *outBuf, size_t *outBufSize,
+- ISeqInStream *inStream,
++ ISeqInStreamPtr inStream,
+ // const Byte *inData, size_t inDataSize,
+ CXzStatInfo *stat,
+ int *isMT,
+- ICompressProgress *progress)
++ ICompressProgressPtr progress)
+ {
+- CXzDecMt *p = (CXzDecMt *)pp;
+- #ifndef _7ZIP_ST
++ // GET_CXzDecMt_p
++ #ifndef Z7_ST
+ BoolInt tMode;
+ #endif
+
+@@ -2610,7 +2646,7 @@ SRes XzDecMt_Decode(CXzDecMtHandle pp,
+ p->outSize = *outDataSize;
+ }
+
+- p->finishMode = finishMode;
++ p->finishMode = (BoolInt)finishMode;
+
+ // p->outSize = 457; p->outSize_Defined = True; p->finishMode = False; // for test
+
+@@ -2640,7 +2676,7 @@ SRes XzDecMt_Decode(CXzDecMtHandle pp,
+ */
+
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+
+ p->isBlockHeaderState_Parse = False;
+ p->isBlockHeaderState_Write = False;
+@@ -2782,7 +2818,7 @@ SRes XzDecMt_Decode(CXzDecMtHandle pp,
+ return res;
+ }
+
+- PRF_STR("----- decoding ST -----");
++ PRF_STR("----- decoding ST -----")
+ }
+
+ #endif
+@@ -2792,13 +2828,13 @@ SRes XzDecMt_Decode(CXzDecMtHandle pp,
+
+ {
+ SRes res = XzDecMt_Decode_ST(p
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ , tMode
+ #endif
+ , stat
+ );
+
+- #ifndef _7ZIP_ST
++ #ifndef Z7_ST
+ // we must set error code from MT decoding at first
+ if (p->mainErrorCode != SZ_OK)
+ stat->DecodeRes = p->mainErrorCode;
+@@ -2835,3 +2871,7 @@ SRes XzDecMt_Decode(CXzDecMtHandle pp,
+ return res;
+ }
+ }
++
++#undef PRF
++#undef PRF_STR
++#undef PRF_STR_INT_2
diff --git a/electron34/patches/patch-third__party_lzma__sdk_C_XzIn.c b/electron34/patches/patch-third__party_lzma__sdk_C_XzIn.c
new file mode 100644
index 0000000000..67bcabfea8
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_C_XzIn.c
@@ -0,0 +1,254 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/C/XzIn.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/C/XzIn.c
+@@ -1,5 +1,5 @@
+ /* XzIn.c - Xz input
+-2021-09-04 : Igor Pavlov : Public domain */
++2023-09-07 : Igor Pavlov : Public domain */
+
+ #include "Precomp.h"
+
+@@ -15,27 +15,29 @@
+ #define XZ_FOOTER_SIG_CHECK(p) ((p)[0] == XZ_FOOTER_SIG_0 && (p)[1] == XZ_FOOTER_SIG_1)
+
+
+-SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStream *inStream)
++SRes Xz_ReadHeader(CXzStreamFlags *p, ISeqInStreamPtr inStream)
+ {
+ Byte sig[XZ_STREAM_HEADER_SIZE];
+- RINOK(SeqInStream_Read2(inStream, sig, XZ_STREAM_HEADER_SIZE, SZ_ERROR_NO_ARCHIVE));
+- if (memcmp(sig, XZ_SIG, XZ_SIG_SIZE) != 0)
++ size_t processedSize = XZ_STREAM_HEADER_SIZE;
++ RINOK(SeqInStream_ReadMax(inStream, sig, &processedSize))
++ if (processedSize != XZ_STREAM_HEADER_SIZE
++ || memcmp(sig, XZ_SIG, XZ_SIG_SIZE) != 0)
+ return SZ_ERROR_NO_ARCHIVE;
+ return Xz_ParseHeader(p, sig);
+ }
+
+ #define READ_VARINT_AND_CHECK(buf, pos, size, res) \
+- { unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \
++ { const unsigned s = Xz_ReadVarInt(buf + pos, size - pos, res); \
+ if (s == 0) return SZ_ERROR_ARCHIVE; \
+ pos += s; }
+
+-SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStream *inStream, BoolInt *isIndex, UInt32 *headerSizeRes)
++SRes XzBlock_ReadHeader(CXzBlock *p, ISeqInStreamPtr inStream, BoolInt *isIndex, UInt32 *headerSizeRes)
+ {
+ Byte header[XZ_BLOCK_HEADER_SIZE_MAX];
+ unsigned headerSize;
+ *headerSizeRes = 0;
+- RINOK(SeqInStream_ReadByte(inStream, &header[0]));
+- headerSize = (unsigned)header[0];
++ RINOK(SeqInStream_ReadByte(inStream, &header[0]))
++ headerSize = header[0];
+ if (headerSize == 0)
+ {
+ *headerSizeRes = 1;
+@@ -45,20 +47,27 @@ SRes XzBlock_ReadHeader(CXzBlock *p, ISe
+
+ *isIndex = False;
+ headerSize = (headerSize << 2) + 4;
+- *headerSizeRes = headerSize;
+- RINOK(SeqInStream_Read(inStream, header + 1, headerSize - 1));
++ *headerSizeRes = (UInt32)headerSize;
++ {
++ size_t processedSize = headerSize - 1;
++ RINOK(SeqInStream_ReadMax(inStream, header + 1, &processedSize))
++ if (processedSize != headerSize - 1)
++ return SZ_ERROR_INPUT_EOF;
++ }
+ return XzBlock_Parse(p, header);
+ }
+
+ #define ADD_SIZE_CHECK(size, val) \
+- { UInt64 newSize = size + (val); if (newSize < size) return XZ_SIZE_OVERFLOW; size = newSize; }
++ { const UInt64 newSize = size + (val); if (newSize < size) return XZ_SIZE_OVERFLOW; size = newSize; }
+
+ UInt64 Xz_GetUnpackSize(const CXzStream *p)
+ {
+ UInt64 size = 0;
+ size_t i;
+ for (i = 0; i < p->numBlocks; i++)
+- ADD_SIZE_CHECK(size, p->blocks[i].unpackSize);
++ {
++ ADD_SIZE_CHECK(size, p->blocks[i].unpackSize)
++ }
+ return size;
+ }
+
+@@ -67,12 +76,14 @@ UInt64 Xz_GetPackSize(const CXzStream *p
+ UInt64 size = 0;
+ size_t i;
+ for (i = 0; i < p->numBlocks; i++)
+- ADD_SIZE_CHECK(size, (p->blocks[i].totalSize + 3) & ~(UInt64)3);
++ {
++ ADD_SIZE_CHECK(size, (p->blocks[i].totalSize + 3) & ~(UInt64)3)
++ }
+ return size;
+ }
+
+ /*
+-SRes XzBlock_ReadFooter(CXzBlock *p, CXzStreamFlags f, ISeqInStream *inStream)
++SRes XzBlock_ReadFooter(CXzBlock *p, CXzStreamFlags f, ISeqInStreamPtr inStream)
+ {
+ return SeqInStream_Read(inStream, p->check, XzFlags_GetCheckSize(f));
+ }
+@@ -93,7 +104,7 @@ static SRes Xz_ReadIndex2(CXzStream *p,
+
+ {
+ UInt64 numBlocks64;
+- READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64);
++ READ_VARINT_AND_CHECK(buf, pos, size, &numBlocks64)
+ numBlocks = (size_t)numBlocks64;
+ if (numBlocks != numBlocks64 || numBlocks * 2 > size)
+ return SZ_ERROR_ARCHIVE;
+@@ -110,8 +121,8 @@ static SRes Xz_ReadIndex2(CXzStream *p,
+ for (i = 0; i < numBlocks; i++)
+ {
+ CXzBlockSizes *block = &p->blocks[i];
+- READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize);
+- READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize);
++ READ_VARINT_AND_CHECK(buf, pos, size, &block->totalSize)
++ READ_VARINT_AND_CHECK(buf, pos, size, &block->unpackSize)
+ if (block->totalSize == 0)
+ return SZ_ERROR_ARCHIVE;
+ }
+@@ -122,7 +133,7 @@ static SRes Xz_ReadIndex2(CXzStream *p,
+ return (pos == size) ? SZ_OK : SZ_ERROR_ARCHIVE;
+ }
+
+-static SRes Xz_ReadIndex(CXzStream *p, ILookInStream *stream, UInt64 indexSize, ISzAllocPtr alloc)
++static SRes Xz_ReadIndex(CXzStream *p, ILookInStreamPtr stream, UInt64 indexSize, ISzAllocPtr alloc)
+ {
+ SRes res;
+ size_t size;
+@@ -142,14 +153,14 @@ static SRes Xz_ReadIndex(CXzStream *p, I
+ return res;
+ }
+
+-static SRes LookInStream_SeekRead_ForArc(ILookInStream *stream, UInt64 offset, void *buf, size_t size)
++static SRes LookInStream_SeekRead_ForArc(ILookInStreamPtr stream, UInt64 offset, void *buf, size_t size)
+ {
+- RINOK(LookInStream_SeekTo(stream, offset));
++ RINOK(LookInStream_SeekTo(stream, offset))
+ return LookInStream_Read(stream, buf, size);
+ /* return LookInStream_Read2(stream, buf, size, SZ_ERROR_NO_ARCHIVE); */
+ }
+
+-static SRes Xz_ReadBackward(CXzStream *p, ILookInStream *stream, Int64 *startOffset, ISzAllocPtr alloc)
++static SRes Xz_ReadBackward(CXzStream *p, ILookInStreamPtr stream, Int64 *startOffset, ISzAllocPtr alloc)
+ {
+ UInt64 indexSize;
+ Byte buf[XZ_STREAM_FOOTER_SIZE];
+@@ -159,7 +170,7 @@ static SRes Xz_ReadBackward(CXzStream *p
+ return SZ_ERROR_NO_ARCHIVE;
+
+ pos -= XZ_STREAM_FOOTER_SIZE;
+- RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE));
++ RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE))
+
+ if (!XZ_FOOTER_SIG_CHECK(buf + 10))
+ {
+@@ -174,7 +185,7 @@ static SRes Xz_ReadBackward(CXzStream *p
+
+ i = (pos > TEMP_BUF_SIZE) ? TEMP_BUF_SIZE : (size_t)pos;
+ pos -= i;
+- RINOK(LookInStream_SeekRead_ForArc(stream, pos, temp, i));
++ RINOK(LookInStream_SeekRead_ForArc(stream, pos, temp, i))
+ total += (UInt32)i;
+ for (; i != 0; i--)
+ if (temp[i - 1] != 0)
+@@ -193,7 +204,7 @@ static SRes Xz_ReadBackward(CXzStream *p
+ if (pos < XZ_STREAM_FOOTER_SIZE)
+ return SZ_ERROR_NO_ARCHIVE;
+ pos -= XZ_STREAM_FOOTER_SIZE;
+- RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE));
++ RINOK(LookInStream_SeekRead_ForArc(stream, pos, buf, XZ_STREAM_FOOTER_SIZE))
+ if (!XZ_FOOTER_SIG_CHECK(buf + 10))
+ return SZ_ERROR_NO_ARCHIVE;
+ }
+@@ -217,8 +228,8 @@ static SRes Xz_ReadBackward(CXzStream *p
+ return SZ_ERROR_ARCHIVE;
+
+ pos -= indexSize;
+- RINOK(LookInStream_SeekTo(stream, pos));
+- RINOK(Xz_ReadIndex(p, stream, indexSize, alloc));
++ RINOK(LookInStream_SeekTo(stream, pos))
++ RINOK(Xz_ReadIndex(p, stream, indexSize, alloc))
+
+ {
+ UInt64 totalSize = Xz_GetPackSize(p);
+@@ -227,7 +238,7 @@ static SRes Xz_ReadBackward(CXzStream *p
+ || pos < totalSize + XZ_STREAM_HEADER_SIZE)
+ return SZ_ERROR_ARCHIVE;
+ pos -= (totalSize + XZ_STREAM_HEADER_SIZE);
+- RINOK(LookInStream_SeekTo(stream, pos));
++ RINOK(LookInStream_SeekTo(stream, pos))
+ *startOffset = (Int64)pos;
+ }
+ {
+@@ -236,7 +247,7 @@ static SRes Xz_ReadBackward(CXzStream *p
+ SecToRead_CreateVTable(&secToRead);
+ secToRead.realStream = stream;
+
+- RINOK(Xz_ReadHeader(&headerFlags, &secToRead.vt));
++ RINOK(Xz_ReadHeader(&headerFlags, &secToRead.vt))
+ return (p->flags == headerFlags) ? SZ_OK : SZ_ERROR_ARCHIVE;
+ }
+ }
+@@ -274,7 +285,9 @@ UInt64 Xzs_GetUnpackSize(const CXzs *p)
+ UInt64 size = 0;
+ size_t i;
+ for (i = 0; i < p->num; i++)
+- ADD_SIZE_CHECK(size, Xz_GetUnpackSize(&p->streams[i]));
++ {
++ ADD_SIZE_CHECK(size, Xz_GetUnpackSize(&p->streams[i]))
++ }
+ return size;
+ }
+
+@@ -284,15 +297,17 @@ UInt64 Xzs_GetPackSize(const CXzs *p)
+ UInt64 size = 0;
+ size_t i;
+ for (i = 0; i < p->num; i++)
+- ADD_SIZE_CHECK(size, Xz_GetTotalSize(&p->streams[i]));
++ {
++ ADD_SIZE_CHECK(size, Xz_GetTotalSize(&p->streams[i]))
++ }
+ return size;
+ }
+ */
+
+-SRes Xzs_ReadBackward(CXzs *p, ILookInStream *stream, Int64 *startOffset, ICompressProgress *progress, ISzAllocPtr alloc)
++SRes Xzs_ReadBackward(CXzs *p, ILookInStreamPtr stream, Int64 *startOffset, ICompressProgressPtr progress, ISzAllocPtr alloc)
+ {
+ Int64 endOffset = 0;
+- RINOK(ILookInStream_Seek(stream, &endOffset, SZ_SEEK_END));
++ RINOK(ILookInStream_Seek(stream, &endOffset, SZ_SEEK_END))
+ *startOffset = endOffset;
+ for (;;)
+ {
+@@ -301,7 +316,7 @@ SRes Xzs_ReadBackward(CXzs *p, ILookInSt
+ Xz_Construct(&st);
+ res = Xz_ReadBackward(&st, stream, startOffset, alloc);
+ st.startOffset = (UInt64)*startOffset;
+- RINOK(res);
++ RINOK(res)
+ if (p->num == p->numAllocated)
+ {
+ const size_t newNum = p->num + p->num / 4 + 1;
+@@ -317,7 +332,7 @@ SRes Xzs_ReadBackward(CXzs *p, ILookInSt
+ p->streams[p->num++] = st;
+ if (*startOffset == 0)
+ break;
+- RINOK(LookInStream_SeekTo(stream, (UInt64)*startOffset));
++ RINOK(LookInStream_SeekTo(stream, (UInt64)*startOffset))
+ if (progress && ICompressProgress_Progress(progress, (UInt64)(endOffset - *startOffset), (UInt64)(Int64)-1) != SZ_OK)
+ return SZ_ERROR_PROGRESS;
+ }
diff --git a/electron34/patches/patch-third__party_lzma__sdk_DEPS b/electron34/patches/patch-third__party_lzma__sdk_DEPS
new file mode 100644
index 0000000000..098d375272
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_DEPS
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/DEPS.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/DEPS
+@@ -4,5 +4,6 @@
+
+ include_rules = [
+ "+base",
++ "+build",
+ "+testing",
+ ]
diff --git a/electron34/patches/patch-third__party_lzma__sdk_README.chromium b/electron34/patches/patch-third__party_lzma__sdk_README.chromium
new file mode 100644
index 0000000000..a62cb83bca
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_README.chromium
@@ -0,0 +1,73 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/README.chromium.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/README.chromium
+@@ -1,25 +1,19 @@
+ Name: LZMA SDK
+ Short Name: lzma
+ URL: http://www.7-zip.org/sdk.html
+-Version: 22.01
+-Date: 2022-07-15
+-License: Public Domain
++Version: 24.09
++Date: 2024-12-13
++License: LZMA-SDK-9.22
+ License File: LICENSE
+ Security Critical: yes
+ Shipped: yes
+-CPEPrefix: cpe:2.3:a:7-zip:7-zip:22.01:*:*:*:*:*:*:*
++CPEPrefix: cpe:2.3:a:7-zip:7-zip:24.09:*:*:*:*:*:*:*
+
+ Description:
+-This contains a part of LZMA SDK 22.01.
++This contains a part of LZMA SDK 24.09.
+
+ Local Modifications:
+-The original code can be found at https://7-zip.org/a/lzma2201.7z. Only parts
+-of this archive are copied here. More specifically:
+-
+-1/ C code required to open 7z archive files and uncompress LZMA
+-2/ 7za, 7zr, and 7zz executables, if Windows is specified as a target OS.
+-3/ source code for SfxSetup, a utility for creating self extracting archives
+-4/ C code required for xz decompression (split into its own static library)
++The original code can be found at https://7-zip.org/a/lzma2409.7z.
+
+ The 7z binaries are installed via a 3pp CIPD package into bin/ if Windows is
+ specified as a target OS in the .gclient file. There are two subdirectories in
+@@ -39,23 +33,12 @@ binaries. Supported platforms are:
+ extract files. 7zr is "lightweight" and only handles 7zip extensions. 7za can
+ handle a few more.
+
+-The patch in chromium.patch was applied to 7zCrc.c, CpuArch.c, LZFind.c and
+-Sha256.c to disable some ARM code that was failing to build in Android and
+-Fuschia as well as some of the AVX2 and SSE4 code for Windows. In Fuschia,
+-`#include <asm/hwcap.h>` is not available. In Android builds, `armv8-a+crc` is
+-not a known target architecture, even when the -march cflag is passed,
+-specifying the CPU type to use. In Windows, Chromium still supports SSE3,
+-so it is not be ready to transition to utilizing AVX2 and SSE4, yet. Added
+-.note.gnu.property section to arm64/7zAsm.s to suppress compiler error requiring
+-bti. Shortened segment names in Asm/x86/*.asm files to make the builds
+-deterministic. Resolved include paths as well.
+-
+-The patch in chromium_ubsan.patch fixes some undefined behavior, flagged by
+-UBSan, caused by invalid pointer casts in LZMA SDK.
+-
+-The patch in Util/SfxSetup/chromium.patch was applied so that:
+-
+-1/ Fix for includes file names, since the original code causes an include
+- file violation during git cl presubmit.
+-2/ Extended search range for 7z archive signature to accomodate
+- increased sfx binary size in debug builds.
++The purposes of the patch in chromium.patch are:
++1. Extend the search range for 7z archive signature to accomodate increased sfx
++ binary size in debug builds.
++2. Fix undefined behavior in CpuArch.h flagged by UBSan caused by invalid
++ pointer casts.
++3. Shorten segment names in Asm/x86/LzmaDecOpt.asm to make the build
++ deterministic.
++4. Remove files irrelevant to Chromium use.
++5. Remove AVX and SSE41 code in LzFind.
diff --git a/electron34/patches/patch-third__party_lzma__sdk_chromium.patch b/electron34/patches/patch-third__party_lzma__sdk_chromium.patch
new file mode 100644
index 0000000000..d44f59f8e6
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_chromium.patch
@@ -0,0 +1,192 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/chromium.patch.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/chromium.patch
+@@ -1,138 +1,46 @@
+-diff --git "a/lzma2107\\C/7zCrc.c" "b/third_party\\lzma_sdk/7zCrc.c"
+-index f186324ddc609..c0cc9bc7812e0 100644
+---- "a/lzma2107\\C/7zCrc.c"
+-+++ "b/third_party\\lzma_sdk/7zCrc.c"
+-@@ -78,20 +78,20 @@ UInt32 MY_FAST_CALL CrcUpdateT1(UInt32 v, const void *data, size_t size, const U
+- #if defined(_MSC_VER)
+- #if defined(MY_CPU_ARM64)
+- #if (_MSC_VER >= 1910)
+-- #define USE_ARM64_CRC
+-+ // #define USE_ARM64_CRC
+- #endif
+- #endif
+- #elif (defined(__clang__) && (__clang_major__ >= 3)) \
+- || (defined(__GNUC__) && (__GNUC__ > 4))
+- #if !defined(__ARM_FEATURE_CRC32)
+-- #define __ARM_FEATURE_CRC32 1
+-+ // #define __ARM_FEATURE_CRC32 1
+- #if (!defined(__clang__) || (__clang_major__ > 3)) // fix these numbers
+-- #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
+-+ // #define ATTRIB_CRC __attribute__((__target__("arch=armv8-a+crc")))
+- #endif
+- #endif
+- #if defined(__ARM_FEATURE_CRC32)
+-- #define USE_ARM64_CRC
+-- #include <arm_acle.h>
+-+ // #define USE_ARM64_CRC
+-+ // #include <arm_acle.h>
+- #endif
+- #endif
+-
+-diff --git "a/lzma2107\\C/CpuArch.c" "b/third_party\\lzma_sdk/CpuArch.c"
+-index fa9afe3970b3f..30451fba9b97b 100644
+---- "a/lzma2107\\C/CpuArch.c"
+-+++ "b/third_party\\lzma_sdk/CpuArch.c"
+-@@ -417,7 +417,9 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
+-
+- #include <sys/auxv.h>
+-
+-+#if !defined(ARMV8_OS_FUCHSIA)
+- #define USE_HWCAP
+-+#endif // !defined(ARMV8_OS_FUCHSIA)
+-
+- #ifdef USE_HWCAP
+-
+-diff --git "a/lzma2107\\C/LzFind.c" "b/third_party\\lzma_sdk/LzFind.c"
+-index 1b73c28484ccf..36f7330911435 100644
+---- "a/lzma2107\\C/LzFind.c"
+-+++ "b/third_party\\lzma_sdk/LzFind.c"
+-@@ -505,7 +505,7 @@ void MatchFinder_Init(CMatchFinder *p)
+- }
+-
+-
+--
+-+#if 0
+- #ifdef MY_CPU_X86_OR_AMD64
+- #if defined(__clang__) && (__clang_major__ >= 8) \
+- || defined(__GNUC__) && (__GNUC__ >= 8) \
+-@@ -549,6 +549,7 @@ void MatchFinder_Init(CMatchFinder *p)
+- #endif
+-
+- #endif
+-+#endif
+-
+- /*
+- #ifndef ATTRIB_SSE41
+-diff --git "a/lzma2107\\C/Sha256.c" "b/third_party\\lzma_sdk/Sha256.c"
+-index 8b3983ea7323d..21996848c9156 100644
+---- "a/lzma2107\\C/Sha256.c"
+-+++ "b/third_party\\lzma_sdk/Sha256.c"
+-@@ -32,7 +32,8 @@ This code is based on public domain code from Wei Dai's Crypto++ library. */
+- #define _SHA_SUPPORTED
+- #endif
+- #endif
+--#elif defined(MY_CPU_ARM_OR_ARM64)
+-+// TODO(crbug.com/1338627): Enable ARM optimizations
+-+#elif 0 // defined(MY_CPU_ARM_OR_ARM64)
+- #ifdef _MSC_VER
+- #if _MSC_VER >= 1910
+- #define _SHA_SUPPORTED
++diff -r /Users/waffles/Downloads/lzma2409/Asm/x86/LzmaDecOpt.asm ./Asm/x86/LzmaDecOpt.asm
++42c42,44
++< _TEXT$LZMADECOPT SEGMENT ALIGN(64) 'CODE'
++---
++> ; Make this deterministic
++> ; _TEXT$LZMADECOPT SEGMENT ALIGN(64) 'CODE'
++> LZMADEC SEGMENT ALIGN(64) 'CODE'
++1336c1338
++< _TEXT$LZMADECOPT ENDS
++---
++> LZMADEC ENDS
++diff -r /Users/waffles/Downloads/lzma2409/C/CpuArch.h ./C/CpuArch.h
++413c413,417
++<
++---
++> // Disable MY_CPU_LE_UNALIGN. Although the underlying ISA may be able to load
++> // unaligned words, doing so via pointer casts is undefined behavior in C and
++> // C++, under both strict aliasing and because it is invalid to construct
++> // unaligned pointers. Instead, load the bytes generically and leave optimizing
++> // this to the compiler.
++419,420c423,424
++< #define MY_CPU_LE_UNALIGN
++< #define MY_CPU_LE_UNALIGN_64
++---
++> // #define MY_CPU_LE_UNALIGN
++> // #define MY_CPU_LE_UNALIGN_64
++diff -r /Users/waffles/Downloads/lzma2409/C/LzFind.c ./C/LzFind.c
++598c598
++<
++---
++> #if 0
++642c642
++<
++---
++> #endif // #if 0
++diff -r /Users/waffles/Downloads/lzma2409/C/Util/SfxSetup/SfxSetup.c ./C/Util/SfxSetup/SfxSetup.c
++13a14,17
++> // SHELLEXECUTEINFO
++> #include <windows.h>
++> #include <shellapi.h>
++>
++144c148
++< #define kSignatureSearchLimit (1 << 22)
++---
++> #define kSignatureSearchLimit (1 << 26)
+
+-diff --git a/lzma2107/Asm/arm64/7zAsm.S b/third_party/lzma_sdk/Asm/arm64/7zAsm.S
+-index 67d650d9a7c22..aa30a9ef8bf34 100644
+---- a/lzma2107/Asm/arm64/7zAsm.S
+-+++ b/third_party/lzma_sdk/Asm/arm64/7zAsm.S
+-@@ -37,6 +37,19 @@
+- #define REG_ABI_PARAM_1 r1
+- #define REG_ABI_PARAM_2 r2
+-
+-+// The .note.gnu.property section is required because Chromium Android builds
+-+// utilize the linker flag force-bti.
+-+.pushsection .note.gnu.property, "a"
+-+.balign 8
+-+.long 4
+-+.long 0x10
+-+.long 0x5
+-+.asciz "GNU"
+-+.long 0xc0000000
+-+.long 4
+-+.long ((1 << 0 ) | (1 << 1))
+-+.long 0
+-+.popsection
+-
+- .macro p2_add reg:req, param:req
+- add \reg, \reg, \param
+-diff --git a/lzma2107/Asm/x86/7zAsm.asm b/third_party/lzma_sdk/Asm/x86/7zAsm.asm
+-index 9ca25bccd28cf..df2d4cf5820da 100644
+---- a/lzma2107/Asm/x86/7zAsm.asm
+-+++ b/third_party/lzma_sdk/Asm/x86/7zAsm.asm
+-@@ -47,7 +47,7 @@ MY_ASM_START macro
+- else
+- .386
+- .model flat
+-- _TEXT$00 SEGMENT PARA PUBLIC 'CODE'
+-+ SEVENZ SEGMENT PARA PUBLIC 'CODE'
+- endif
+- endm
+-
+-diff --git a/lzma2107/Asm/x86/LzmaDecOpt.asm b/third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm
+-index 7e08acc639743..ddbd88ffc2e95 100644
+---- a/lzma2107/Asm/x86/LzmaDecOpt.asm
+-+++ b/third_party/lzma_sdk/Asm/x86/LzmaDecOpt.asm
+-@@ -17,7 +17,7 @@ include 7zAsm.asm
+-
+- MY_ASM_START
+-
+--_TEXT$LZMADECOPT SEGMENT ALIGN(64) 'CODE'
+-+LZMADEC SEGMENT ALIGN(64) 'CODE'
+-
+- MY_ALIGN macro num:req
+- align num
+-@@ -1298,6 +1298,6 @@ fin:
+- MY_POP_PRESERVED_ABI_REGS
+- MY_ENDP
+-
+--_TEXT$LZMADECOPT ENDS
+-+LZMADEC ENDS
+-
+- end
diff --git a/electron34/patches/patch-third__party_lzma__sdk_chromium__ubsan.patch b/electron34/patches/patch-third__party_lzma__sdk_chromium__ubsan.patch
new file mode 100644
index 0000000000..6da7eb6015
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_chromium__ubsan.patch
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/chromium_ubsan.patch.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/chromium_ubsan.patch
+@@ -1,25 +0,0 @@
+-diff --git a/third_party/lzma_sdk/C/CpuArch.h b/third_party/lzma_sdk/C/CpuArch.h
+-index 4856fbb12a256..8cd55bea48dc6 100644
+---- a/third_party/lzma_sdk/C/CpuArch.h
+-+++ b/third_party/lzma_sdk/C/CpuArch.h
+-@@ -253,6 +253,12 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
+-
+-
+-
+-+// Disable MY_CPU_LE_UNALIGN. Although the underlying ISA may be able to load
+-+// unaligned words, doing so via pointer casts is undefined behavior in C and
+-+// C++, under both strict aliasing and because it is invalid to construct
+-+// unaligned pointers. Instead, load the bytes generically and leave optimizing
+-+// this to the compiler.
+-+#if 0
+- #ifdef MY_CPU_LE
+- #if defined(MY_CPU_X86_OR_AMD64) \
+- || defined(MY_CPU_ARM64)
+-@@ -264,6 +270,7 @@ MY_CPU_64BIT means that processor can work with 64-bit registers.
+- #define MY_CPU_LE_UNALIGN
+- #endif
+- #endif
+-+#endif
+-
+-
+- #ifdef MY_CPU_LE_UNALIGN
diff --git a/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader.cc b/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader.cc
new file mode 100644
index 0000000000..fc26014799
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/google/seven_zip_reader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/google/seven_zip_reader.cc
+@@ -209,7 +209,7 @@ Result SevenZipReaderImpl::Initialize(ba
+ look_stream_buffer_.reset(look_stream_.buf);
+
+ look_stream_.bufSize = kStreamBufferSize;
+- LookToRead2_Init(&look_stream_);
++ LookToRead2_INIT(&look_stream_);
+
+ // The destructor assumes that `stream_` is valid whenever `db_` is
+ // initialized.
diff --git a/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader__unittest.cc b/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader__unittest.cc
new file mode 100644
index 0000000000..2f21ede40b
--- /dev/null
+++ b/electron34/patches/patch-third__party_lzma__sdk_google_seven__zip__reader__unittest.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/lzma_sdk/google/seven_zip_reader_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/lzma_sdk/google/seven_zip_reader_unittest.cc
+@@ -47,6 +47,7 @@
+ #include "base/files/file_util.h"
+ #include "base/logging.h"
+ #include "base/path_service.h"
++#include "build/build_config.h"
+ #include "testing/gmock/include/gmock/gmock.h"
+ #include "testing/gtest/include/gtest/gtest.h"
+
+@@ -356,8 +357,15 @@ class SevenZipReaderFakeCrcTableTest : p
+ std::array<uint32_t, 2048> crc_table_;
+ };
+
++// TODO(crbug.com/388538957): Make this work on ARM64, which uses a different
++// number of tables and the crc32b instruction.
++#if defined(ARCH_CPU_ARM64)
++#define MAYBE_EmptyCrcWithFakeTable DISABLED_EmptyCrcWithFakeTable
++#else
++#define MAYBE_EmptyCrcWithFakeTable EmptyCrcWithFakeTable
++#endif
+ // This is useful functionality for the fuzzer, so we test it here.
+-TEST_F(SevenZipReaderFakeCrcTableTest, EmptyCrcWithFakeTable) {
++TEST_F(SevenZipReaderFakeCrcTableTest, MAYBE_EmptyCrcWithFakeTable) {
+ base::File file = OpenTestFile(FILE_PATH_LITERAL("fake_crc_table.7z"));
+ ASSERT_TRUE(file.IsValid());
+
diff --git a/electron34/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc b/electron34/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc
new file mode 100644
index 0000000000..5ec45cc851
--- /dev/null
+++ b/electron34/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/material_color_utilities/src/cpp/palettes/tones.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/material_color_utilities/src/cpp/palettes/tones.cc
+@@ -14,6 +14,8 @@
+ * limitations under the License.
+ */
+
++#include <cmath>
++
+ #include "cpp/palettes/tones.h"
+
+ #include <cmath>
diff --git a/electron34/patches/patch-third__party_nan_nan.h b/electron34/patches/patch-third__party_nan_nan.h
new file mode 100644
index 0000000000..1dba9f2d71
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_nan.h
@@ -0,0 +1,135 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/nan.h.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/nan.h
+@@ -47,6 +47,7 @@
+ #define NODE_18_0_MODULE_VERSION 108
+ #define NODE_19_0_MODULE_VERSION 111
+ #define NODE_20_0_MODULE_VERSION 115
++#define NODE_21_0_MODULE_VERSION 119
+
+ #ifdef _MSC_VER
+ # define NAN_HAS_CPLUSPLUS_11 (_MSC_VER >= 1800)
+@@ -203,9 +204,11 @@ typedef v8::String::ExternalOneByteStrin
+ template<typename T>
+ class NonCopyablePersistentTraits :
+ public v8::NonCopyablePersistentTraits<T> {};
++#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION <= 12 && V8_MINOR_VERSION < 5)
+ template<typename T>
+ class CopyablePersistentTraits :
+ public v8::CopyablePersistentTraits<T> {};
++#endif
+
+ template<typename T>
+ class PersistentBase :
+@@ -682,7 +685,13 @@ inline uv_loop_t* GetCurrentEventLoop()
+ v8::Isolate::GetCurrent()->SetAddHistogramSampleFunction(cb);
+ }
+
+-#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
++#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 11 || \
++ (V8_MAJOR_VERSION == 11 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
++ inline bool IdleNotification(int idle_time_in_ms) {
++ v8::Isolate::GetCurrent()->MemoryPressureNotification(v8::MemoryPressureLevel::kModerate);
++ return true;
++ }
++#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \
+ (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3))
+ inline bool IdleNotification(int idle_time_in_ms) {
+ return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
+@@ -2517,7 +2526,9 @@ NAN_DEPRECATED inline void SetAccessor(
+ , GetterCallback getter
+ , SetterCallback setter
+ , v8::Local<v8::Value> data
++#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
+ , v8::AccessControl settings
++#endif
+ , v8::PropertyAttribute attribute
+ , imp::Sig signature) {
+ HandleScope scope;
+@@ -2545,17 +2556,28 @@ NAN_DEPRECATED inline void SetAccessor(
+ obj->SetInternalField(imp::kDataIndex, data);
+ }
+
++#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
++ tpl->SetNativeDataProperty(
++ name
++ , getter_
++ , setter_
++ , obj
++ , attribute);
++#else
+ tpl->SetAccessor(
+ name
+ , getter_
+ , setter_
+ , obj
++#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
+ , settings
++#endif
+ , attribute
+ #if (NODE_MODULE_VERSION < NODE_16_0_MODULE_VERSION)
+ , signature
+ #endif
+ );
++#endif
+ }
+
+ inline void SetAccessor(
+@@ -2564,7 +2586,9 @@ inline void SetAccessor(
+ , GetterCallback getter
+ , SetterCallback setter = 0
+ , v8::Local<v8::Value> data = v8::Local<v8::Value>()
++#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
+ , v8::AccessControl settings = v8::DEFAULT
++#endif
+ , v8::PropertyAttribute attribute = v8::None) {
+ HandleScope scope;
+
+@@ -2591,14 +2615,25 @@ inline void SetAccessor(
+ obj->SetInternalField(imp::kDataIndex, data);
+ }
+
++#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
++ tpl->SetNativeDataProperty(
++ name
++ , getter_
++ , setter_
++ , obj
++ , attribute);
++#else
+ tpl->SetAccessor(
+ name
+ , getter_
+ , setter_
+ , obj
++#if (NODE_MODULE_VERSION < NODE_21_0_MODULE_VERSION)
+ , settings
++#endif
+ , attribute
+ );
++#endif
+ }
+
+ inline bool SetAccessor(
+@@ -2634,7 +2669,15 @@ inline bool SetAccessor(
+ , New<v8::External>(reinterpret_cast<void *>(setter)));
+ }
+
+-#if (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
++#if (NODE_MODULE_VERSION >= NODE_21_0_MODULE_VERSION)
++ return obj->SetNativeDataProperty(
++ GetCurrentContext()
++ , name
++ , getter_
++ , setter_
++ , dataobj
++ , attribute).FromMaybe(false);
++#elif (NODE_MODULE_VERSION >= NODE_6_0_MODULE_VERSION)
+ return obj->SetAccessor(
+ GetCurrentContext()
+ , name
diff --git a/electron34/patches/patch-third__party_nan_nan__callbacks__12__inl.h b/electron34/patches/patch-third__party_nan_nan__callbacks__12__inl.h
new file mode 100644
index 0000000000..278585da95
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_nan__callbacks__12__inl.h
@@ -0,0 +1,214 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/nan_callbacks_12_inl.h.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/nan_callbacks_12_inl.h
+@@ -255,7 +255,98 @@ typedef void (*NativeSetter)(
+ , const v8::PropertyCallbackInfo<void> &);
+ #endif
+
+-#if NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
++#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION
++static
++v8::Intercepted PropertyGetterCallbackWrapper(
++ v8::Local<v8::Name> property
++ , const v8::PropertyCallbackInfo<v8::Value> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Value>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ PropertyGetterCallback callback = reinterpret_cast<PropertyGetterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kPropertyGetterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(property.As<v8::String>(), cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativePropertyGetter)
++ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &);
++
++static
++v8::Intercepted PropertySetterCallbackWrapper(
++ v8::Local<v8::Name> property
++ , v8::Local<v8::Value> value
++ , const v8::PropertyCallbackInfo<void> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<void>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ PropertySetterCallback callback = reinterpret_cast<PropertySetterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kPropertySetterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(property.As<v8::String>(), value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo));
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativePropertySetter)(
++ v8::Local<v8::Name>
++ , v8::Local<v8::Value>
++ , const v8::PropertyCallbackInfo<void> &);
++
++static
++void PropertyEnumeratorCallbackWrapper(
++ const v8::PropertyCallbackInfo<v8::Array> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Array>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ PropertyEnumeratorCallback callback =
++ reinterpret_cast<PropertyEnumeratorCallback>(reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kPropertyEnumeratorIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(cbinfo);
++}
++
++typedef void (*NativePropertyEnumerator)
++ (const v8::PropertyCallbackInfo<v8::Array> &);
++
++static
++v8::Intercepted PropertyDeleterCallbackWrapper(
++ v8::Local<v8::Name> property
++ , const v8::PropertyCallbackInfo<v8::Boolean> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Boolean>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ PropertyDeleterCallback callback = reinterpret_cast<PropertyDeleterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kPropertyDeleterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(property.As<v8::String>(), cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (NativePropertyDeleter)
++ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Boolean> &);
++
++static
++v8::Intercepted PropertyQueryCallbackWrapper(
++ v8::Local<v8::Name> property
++ , const v8::PropertyCallbackInfo<v8::Integer> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Integer>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ PropertyQueryCallback callback = reinterpret_cast<PropertyQueryCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kPropertyQueryIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(property.As<v8::String>(), cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativePropertyQuery)
++ (v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Integer> &);
++#elif NODE_MODULE_VERSION > NODE_0_12_MODULE_VERSION
+ static
+ void PropertyGetterCallbackWrapper(
+ v8::Local<v8::Name> property
+@@ -431,6 +522,96 @@ typedef void (*NativePropertyQuery)
+ (v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer> &);
+ #endif
+
++#if NODE_MODULE_VERSION > NODE_21_0_MODULE_VERSION
++static
++v8::Intercepted IndexGetterCallbackWrapper(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Value>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ IndexGetterCallback callback = reinterpret_cast<IndexGetterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kIndexPropertyGetterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(index, cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativeIndexGetter)
++ (uint32_t, const v8::PropertyCallbackInfo<v8::Value> &);
++
++static
++v8::Intercepted IndexSetterCallbackWrapper(
++ uint32_t index
++ , v8::Local<v8::Value> value
++ , const v8::PropertyCallbackInfo<void> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<void>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ IndexSetterCallback callback = reinterpret_cast<IndexSetterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kIndexPropertySetterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(index, value, *reinterpret_cast<PropertyCallbackInfo<v8::Value>*>(&cbinfo));
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativeIndexSetter)(
++ uint32_t
++ , v8::Local<v8::Value>
++ , const v8::PropertyCallbackInfo<void> &);
++
++static
++void IndexEnumeratorCallbackWrapper(
++ const v8::PropertyCallbackInfo<v8::Array> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Array>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ IndexEnumeratorCallback callback = reinterpret_cast<IndexEnumeratorCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(
++ kIndexPropertyEnumeratorIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(cbinfo);
++}
++
++typedef void (*NativeIndexEnumerator)
++ (const v8::PropertyCallbackInfo<v8::Array> &);
++
++static
++v8::Intercepted IndexDeleterCallbackWrapper(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Boolean>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ IndexDeleterCallback callback = reinterpret_cast<IndexDeleterCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kIndexPropertyDeleterIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(index, cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativeIndexDeleter)
++ (uint32_t, const v8::PropertyCallbackInfo<v8::Boolean> &);
++
++static
++v8::Intercepted IndexQueryCallbackWrapper(
++ uint32_t index, const v8::PropertyCallbackInfo<v8::Integer> &info) {
++ v8::Local<v8::Object> obj = info.Data().As<v8::Object>();
++ PropertyCallbackInfo<v8::Integer>
++ cbinfo(info, obj->GetInternalField(kDataIndex).As<v8::Value>());
++ IndexQueryCallback callback = reinterpret_cast<IndexQueryCallback>(
++ reinterpret_cast<intptr_t>(
++ obj->GetInternalField(kIndexPropertyQueryIndex)
++ .As<v8::Value>().As<v8::External>()->Value()));
++ callback(index, cbinfo);
++ return v8::Intercepted::kYes;
++}
++
++typedef v8::Intercepted (*NativeIndexQuery)
++ (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
++#else
+ static
+ void IndexGetterCallbackWrapper(
+ uint32_t index, const v8::PropertyCallbackInfo<v8::Value> &info) {
+@@ -515,6 +696,8 @@ void IndexQueryCallbackWrapper(
+
+ typedef void (*NativeIndexQuery)
+ (uint32_t, const v8::PropertyCallbackInfo<v8::Integer> &);
++#endif
++
+ } // end of namespace imp
+
+ #endif // NAN_CALLBACKS_12_INL_H_
diff --git a/electron34/patches/patch-third__party_nan_nan__persistent__12__inl.h b/electron34/patches/patch-third__party_nan_nan__persistent__12__inl.h
new file mode 100644
index 0000000000..3c03fd738b
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_nan__persistent__12__inl.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/nan_persistent_12_inl.h.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/nan_persistent_12_inl.h
+@@ -129,4 +129,15 @@ class Global : public v8::UniquePersiste
+ };
+ #endif
+
++#if defined(V8_MAJOR_VERSION) && ((V8_MAJOR_VERSION >= 12 && V8_MINOR_VERSION >= 5) || V8_MAJOR_VERSION >= 13)
++template<typename T>
++struct CopyablePersistentTraits {
++ typedef v8::Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent;
++ static const bool kResetInDestructor = true;
++ template<typename S, typename M>
++ static inline void Copy(const v8::Persistent<S, M> &source,
++ CopyablePersistent *dest) {}
++};
++#endif
++
+ #endif // NAN_PERSISTENT_12_INL_H_
diff --git a/electron34/patches/patch-third__party_nan_nan__scriptorigin.h b/electron34/patches/patch-third__party_nan_nan__scriptorigin.h
new file mode 100644
index 0000000000..5424f69e1b
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_nan__scriptorigin.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/nan_scriptorigin.h.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/nan_scriptorigin.h
+@@ -11,7 +11,25 @@
+
+ class ScriptOrigin : public v8::ScriptOrigin {
+ public:
+-#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
++#if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 12 || \
++ (V8_MAJOR_VERSION == 12 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 6\
++ || (V8_MINOR_VERSION == 7 && defined(V8_BUILD_NUMBER) \
++ && V8_BUILD_NUMBER >= 1)))))
++ explicit ScriptOrigin(v8::Local<v8::Value> name) :
++ v8::ScriptOrigin(name) {}
++
++ ScriptOrigin(v8::Local<v8::Value> name
++ , v8::Local<v8::Integer> line) :
++ v8::ScriptOrigin(name
++ , To<int32_t>(line).FromMaybe(0)) {}
++
++ ScriptOrigin(v8::Local<v8::Value> name
++ , v8::Local<v8::Integer> line
++ , v8::Local<v8::Integer> column) :
++ v8::ScriptOrigin(name
++ , To<int32_t>(line).FromMaybe(0)
++ , To<int32_t>(column).FromMaybe(0)) {}
++#elif defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 9 || \
+ (V8_MAJOR_VERSION == 9 && (defined(V8_MINOR_VERSION) && (V8_MINOR_VERSION > 0\
+ || (V8_MINOR_VERSION == 0 && defined(V8_BUILD_NUMBER) \
+ && V8_BUILD_NUMBER >= 1)))))
diff --git a/electron34/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp b/electron34/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp
new file mode 100644
index 0000000000..29319131bc
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/test/cpp/indexedinterceptors.cpp.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/test/cpp/indexedinterceptors.cpp
+@@ -90,9 +90,9 @@ NAN_INDEX_SETTER(IndexedInterceptor::Pro
+ interceptor->buf
+ , *Nan::Utf8String(value)
+ , sizeof (interceptor->buf));
+- info.GetReturnValue().Set(info.This());
++ info.GetReturnValue().Set(True());
+ } else {
+- info.GetReturnValue().Set(info.This());
++ info.GetReturnValue().Set(True());
+ }
+ }
+
diff --git a/electron34/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp b/electron34/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp
new file mode 100644
index 0000000000..09f0d0acc5
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/test/cpp/namedinterceptors.cpp.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/test/cpp/namedinterceptors.cpp
+@@ -90,10 +90,8 @@ NAN_PROPERTY_SETTER(NamedInterceptor::Pr
+ interceptor->buf
+ , *Nan::Utf8String(value)
+ , sizeof (interceptor->buf));
+- info.GetReturnValue().Set(info.This());
+- } else {
+- info.GetReturnValue().Set(info.This());
+ }
++ info.GetReturnValue().Set(True());
+ }
+
+ NAN_PROPERTY_ENUMERATOR(NamedInterceptor::PropertyEnumerator) {
diff --git a/electron34/patches/patch-third__party_nan_test_cpp_news.cpp b/electron34/patches/patch-third__party_nan_test_cpp_news.cpp
new file mode 100644
index 0000000000..446d69fd6b
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_test_cpp_news.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/test/cpp/news.cpp.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/test/cpp/news.cpp
+@@ -115,7 +115,7 @@ NAN_METHOD(NewScript) {
+
+ NAN_METHOD(NewScript2) {
+ v8::ScriptOrigin origin(
+-#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION
++#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION
+ info.GetIsolate(),
+ #endif
+ New<v8::String>("x").ToLocalChecked());
+@@ -136,7 +136,7 @@ NAN_METHOD(CompileScript) {
+
+ NAN_METHOD(CompileScript2) {
+ v8::ScriptOrigin origin(
+-#if NODE_MODULE_VERSION >= NODE_18_0_MODULE_VERSION
++#if NODE_MODULE_VERSION >= NODE_17_0_MODULE_VERSION && NODE_MODULE_VERSION < NODE_20_0_MODULE_VERSION
+ info.GetIsolate(),
+ #endif
+ New<v8::String>("x").ToLocalChecked());
diff --git a/electron34/patches/patch-third__party_nan_test_js_accessors-test.js b/electron34/patches/patch-third__party_nan_test_js_accessors-test.js
new file mode 100644
index 0000000000..a9c6c37777
--- /dev/null
+++ b/electron34/patches/patch-third__party_nan_test_js_accessors-test.js
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nan/test/js/accessors-test.js.orig 2023-09-12 12:23:33.000000000 +0000
++++ third_party/nan/test/js/accessors-test.js
+@@ -11,7 +11,7 @@ const test = require('tap').test
+ , bindings = require('bindings')({ module_root: testRoot, bindings: 'accessors' });
+
+ test('accessors', function (t) {
+- t.plan(7)
++ t.plan(6)
+ var settergetter = bindings.create()
+ t.equal(settergetter.prop1, 'this is property 1')
+ t.ok(settergetter.prop2 === '')
+@@ -28,5 +28,4 @@ test('accessors', function (t) {
+ t.equal(derived.prop1, 'this is property 1')
+ derived.prop2 = 'setting a new value'
+ t.equal(derived.prop2, 'setting a new value')
+- t.equal(settergetter.prop2, 'setting a new value')
+ })
diff --git a/electron34/patches/patch-third__party_nasm_BUILD.gn b/electron34/patches/patch-third__party_nasm_BUILD.gn
new file mode 100644
index 0000000000..9acf772bf4
--- /dev/null
+++ b/electron34/patches/patch-third__party_nasm_BUILD.gn
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nasm/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/nasm/BUILD.gn
+@@ -63,6 +63,13 @@ config("nasm_config") {
+
+ defines = [ "HAVE_CONFIG_H" ]
+
++ _string_h_lines =
++ read_file("/usr/include/string.h", "list lines")
++ _mempcpy = filter_include(_string_h_lines, [ "*mempcpy*" ])
++ if (_mempcpy != []) {
++ defines += [ "HAVE_MEMPCPY=1" ]
++ }
++
+ if (is_clang) {
+ cflags = [
+ # The inline functions in NASM's headers flag this.
diff --git a/electron34/patches/patch-third__party_nasm_config_config-linux.h b/electron34/patches/patch-third__party_nasm_config_config-linux.h
new file mode 100644
index 0000000000..409b384deb
--- /dev/null
+++ b/electron34/patches/patch-third__party_nasm_config_config-linux.h
@@ -0,0 +1,108 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/nasm/config/config-linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/nasm/config/config-linux.h
+@@ -160,7 +160,7 @@
+
+ /* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
+ don't. */
+-#define HAVE_DECL_STRLCPY 0
++#define HAVE_DECL_STRLCPY 1
+
+ /* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
+ don't. */
+@@ -183,7 +183,7 @@
+ #define HAVE_DECL_STRSEP 1
+
+ /* Define to 1 if you have the <endian.h> header file. */
+-#define HAVE_ENDIAN_H 1
++/* #undef HAVE_ENDIAN_H */
+
+ /* Define to 1 if you have the `faccessat' function. */
+ #define HAVE_FACCESSAT 1
+@@ -327,16 +327,16 @@
+ #define HAVE_ISASCII 1
+
+ /* Define to 1 if you have the `iscntrl' function. */
+-/* #undef HAVE_ISCNTRL */
++#define HAVE_ISCNTRL 1
+
+ /* Define to 1 if you have the <machine/endian.h> header file. */
+-/* #undef HAVE_MACHINE_ENDIAN_H */
++#define HAVE_MACHINE_ENDIAN_H 1
+
+ /* Define to 1 if you have the <memory.h> header file. */
+ #define HAVE_MEMORY_H 1
+
+ /* Define to 1 if you have the `mempcpy' function. */
+-#define HAVE_MEMPCPY 1
++/* #undef HAVE_MEMPCPY */
+
+ /* Define to 1 if you have a working `mmap' system call. */
+ #define HAVE_MMAP 1
+@@ -357,7 +357,7 @@
+ #define HAVE_STDARG_H 1
+
+ /* Define to 1 if stdbool.h conforms to C99. */
+-/* #undef HAVE_STDBOOL_H */
++#define HAVE_STDBOOL_H 1
+
+ /* Define to 1 if your compiler supports C99 extern inline */
+ #define HAVE_STDC_INLINE 1
+@@ -384,7 +384,7 @@
+ #define HAVE_STRING_H 1
+
+ /* Define to 1 if you have the `strlcpy' function. */
+-/* #undef HAVE_STRLCPY */
++#define HAVE_STRLCPY 1
+
+ /* Define to 1 if you have the `strncasecmp' function. */
+ #define HAVE_STRNCASECMP 1
+@@ -411,7 +411,7 @@
+ #define HAVE_SYSCONF 1
+
+ /* Define to 1 if you have the <sys/endian.h> header file. */
+-/* #undef HAVE_SYS_ENDIAN_H */
++#define HAVE_SYS_ENDIAN_H 1
+
+ /* Define to 1 if you have the <sys/mman.h> header file. */
+ #define HAVE_SYS_MMAN_H 1
+@@ -486,13 +486,13 @@
+ /* #undef HAVE__STATI64 */
+
+ /* Define to 1 if you have the `__bswap_16' intrinsic function. */
+-#define HAVE___BSWAP_16 1
++/* #undef HAVE___BSWAP_16 */
+
+ /* Define to 1 if you have the `__bswap_32' intrinsic function. */
+-#define HAVE___BSWAP_32 1
++/* #undef HAVE___BSWAP_32 */
+
+ /* Define to 1 if you have the `__bswap_64' intrinsic function. */
+-#define HAVE___BSWAP_64 1
++/* #undef HAVE___BSWAP_64 */
+
+ /* Define to 1 if you have the `__builtin_bswap16' intrinsic function. */
+ #define HAVE___BUILTIN_BSWAP16 1
+@@ -620,7 +620,7 @@
+ /* Define to the equivalent of the C99 'restrict' keyword, or to
+ nothing if this is not supported. Do not define if restrict is
+ supported directly. */
+-#define restrict __restrict
++#define restrict __restrict__
+ /* Work around a bug in Sun C++: it does not support _Restrict or
+ __restrict__, even though the corresponding Sun C compiler ends up with
+ "#define restrict _Restrict" or "#define restrict __restrict__" in the
+@@ -637,7 +637,7 @@
+ /* Define if your snprintf function is not named snprintf. */
+ /* #undef snprintf */
+
+-/* Define if your typeof operator is not named typeof. */
++/* Define if your typeof operator is not named `typeof'. */
+ #define typeof __typeof
+
+ /* Define to the type of an unsigned integer type wide enough to hold a
diff --git a/electron34/patches/patch-third__party_node_node.gni b/electron34/patches/patch-third__party_node_node.gni
new file mode 100644
index 0000000000..c2cc4c8022
--- /dev/null
+++ b/electron34/patches/patch-third__party_node_node.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/node/node.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/node/node.gni
+@@ -22,7 +22,7 @@ template("node") {
+
+ # When use_remoteexec=true, node actions may run on remote
+ # Linux worker. So it should include linux node binary in inputs.
+- if (is_linux || is_chromeos || use_remoteexec) {
++ if ((is_linux || is_chromeos || use_remoteexec) && !is_bsd) {
+ inputs += [ "//third_party/node/linux/node-linux-x64/bin/node" ]
+ }
+ if (is_win && host_os == "win") {
diff --git a/electron34/patches/patch-third__party_node_node.py b/electron34/patches/patch-third__party_node_node.py
new file mode 100644
index 0000000000..3e81c7fb13
--- /dev/null
+++ b/electron34/patches/patch-third__party_node_node.py
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/node/node.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/node/node.py
+@@ -21,6 +21,9 @@ def GetBinaryPath():
+ return os_path.join(os_path.dirname(__file__), *{
+ 'Darwin': (darwin_path, darwin_name, 'bin', 'node'),
+ 'Linux': ('linux', 'node-linux-x64', 'bin', 'node'),
++ 'OpenBSD': ('openbsd', 'node-openbsd', 'bin', 'node'),
++ 'FreeBSD': ('freebsd', 'node-freebsd', 'bin', 'node'),
++ 'NetBSD': ('netbsd', 'node-netbsd', 'bin', 'node'),
+ 'Windows': ('win', 'node.exe'),
+ }[platform.system()])
+
diff --git a/electron34/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp b/electron34/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp
new file mode 100644
index 0000000000..445c246f68
--- /dev/null
+++ b/electron34/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/pdfium/core/fxge/cfx_fontmapper.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/pdfium/core/fxge/cfx_fontmapper.cpp
+@@ -157,7 +157,7 @@ constexpr AltFontFamily kAltFontFamilies
+ {"ForteMT", "Forte"},
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || defined(OS_ASMJS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || defined(OS_ASMJS) || BUILDFLAG(IS_BSD)
+ const char kNarrowFamily[] = "LiberationSansNarrow";
+ #elif BUILDFLAG(IS_ANDROID)
+ const char kNarrowFamily[] = "RobotoCondensed";
diff --git a/electron34/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp b/electron34/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp
new file mode 100644
index 0000000000..5690a0aebd
--- /dev/null
+++ b/electron34/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/pdfium/core/fxge/linux/fx_linux_impl.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/pdfium/core/fxge/linux/fx_linux_impl.cpp
+@@ -20,7 +20,7 @@
+ #include "core/fxge/fx_font.h"
+ #include "core/fxge/systemfontinfo_iface.h"
+
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !defined(OS_ASMJS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !defined(OS_ASMJS) && !BUILDFLAG(IS_BSD)
+ #error "Included on the wrong platform"
+ #endif
+
+@@ -173,10 +173,9 @@ class CLinuxPlatform : public CFX_GEModu
+ std::unique_ptr<SystemFontInfoIface> CreateDefaultSystemFontInfo() override {
+ auto pInfo = std::make_unique<CFX_LinuxFontInfo>();
+ if (!pInfo->ParseFontCfg(CFX_GEModule::Get()->GetUserFontPaths())) {
+- pInfo->AddPath("/usr/share/fonts");
+- pInfo->AddPath("/usr/share/X11/fonts/Type1");
+- pInfo->AddPath("/usr/share/X11/fonts/TTF");
+- pInfo->AddPath("/usr/local/share/fonts");
++ pInfo->AddPath("@X11BASE@/lib/X11/fonts/Type1");
++ pInfo->AddPath("@X11BASE@/lib/X11/fonts/TTF");
++ pInfo->AddPath("@PREFIX@/share/fonts");
+ }
+ return pInfo;
+ }
diff --git a/electron34/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp b/electron34/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp
new file mode 100644
index 0000000000..b17c46ef3e
--- /dev/null
+++ b/electron34/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/pdfium/fxjs/fx_date_helpers.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/pdfium/fxjs/fx_date_helpers.cpp
+@@ -39,6 +39,11 @@ double GetLocalTZA() {
+ return 0;
+ time_t t = 0;
+ FXSYS_time(&t);
++#ifdef __FreeBSD__
++ struct tm lt;
++ localtime_r(&t, <);
++ return (double)(-(lt.tm_gmtoff * 1000));
++#else
+ FXSYS_localtime(&t);
+ #if BUILDFLAG(IS_WIN)
+ // In gcc 'timezone' is a global variable declared in time.h. In VC++, that
+@@ -47,6 +52,7 @@ double GetLocalTZA() {
+ _get_timezone(&timezone);
+ #endif
+ return (double)(-(timezone * 1000));
++#endif // __FreeBSD__
+ }
+
+ int GetDaylightSavingTA(double d) {
diff --git a/electron34/patches/patch-third__party_pdfium_pdfium.gni b/electron34/patches/patch-third__party_pdfium_pdfium.gni
new file mode 100644
index 0000000000..06e4499d87
--- /dev/null
+++ b/electron34/patches/patch-third__party_pdfium_pdfium.gni
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/pdfium/pdfium.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/pdfium/pdfium.gni
+@@ -42,7 +42,7 @@ declare_args() {
+ # PDFium will use PartitionAlloc partitions to separate strings, scalars,
+ # etc. from other allocations. However, the use of PartitionAlloc for new or
+ # malloc is controlled by args in build_overrides/partition_alloc.gni.
+- pdf_use_partition_alloc = pdf_use_partition_alloc_override
++ pdf_use_partition_alloc = pdf_use_partition_alloc_override && use_partition_alloc_as_malloc
+
+ # Build PDFium to use Skia (experimental) for all PDFium graphics.
+ # If enabled, coexists in build with AGG graphics and the default
diff --git a/electron34/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp b/electron34/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp
new file mode 100644
index 0000000000..d5ec400b8a
--- /dev/null
+++ b/electron34/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/pdfium/xfa/fxfa/parser/cxfa_timezoneprovider.cpp
+@@ -6,12 +6,16 @@
+
+ #include "xfa/fxfa/parser/cxfa_timezoneprovider.h"
+
++#include <stdint.h>
+ #include <stdlib.h>
+ #include <time.h>
+
+ #include "build/build_config.h"
+
+ static bool g_bProviderTimeZoneSet = false;
++#if defined(OS_FREEBSD)
++static long g_lTimeZoneOffset = 0;
++#endif
+
+ #if BUILDFLAG(IS_WIN)
+ #define TIMEZONE _timezone
+@@ -24,9 +28,21 @@ static bool g_bProviderTimeZoneSet = fal
+ CXFA_TimeZoneProvider::CXFA_TimeZoneProvider() {
+ if (!g_bProviderTimeZoneSet) {
+ g_bProviderTimeZoneSet = true;
++#if defined(OS_FREEBSD)
++ time_t now = time(nullptr);
++ struct tm tm = {};
++
++ localtime_r(&now, &tm);
++ g_lTimeZoneOffset = tm.tm_gmtoff;
++#else
+ TZSET();
++#endif
+ }
++#if defined(OS_FREEBSD)
++ tz_minutes_ = static_cast<int8_t>((abs(g_lTimeZoneOffset) % 3600) / 60);
++#else
+ tz_minutes_ = TIMEZONE / -60;
++#endif
+ }
+
+ CXFA_TimeZoneProvider::~CXFA_TimeZoneProvider() = default;
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h
new file mode 100644
index 0000000000..7cb8080d23
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h
@@ -0,0 +1,72 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/base/build_config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/base/build_config.h
+@@ -27,6 +27,7 @@
+ #if defined(__ANDROID__)
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 1
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
+@@ -38,6 +39,7 @@
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 1
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 0
+@@ -51,9 +53,10 @@
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 1
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
+ #endif
+-#elif defined(__linux__)
++#elif defined(__linux__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 1
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 1
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
+@@ -64,6 +67,8 @@
+ #elif defined(_WIN32)
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FREEBSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 1
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
+@@ -74,6 +79,8 @@
+ #elif defined(__EMSCRIPTEN__)
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FREEBSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
+@@ -87,6 +94,8 @@
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_IOS() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FREEBSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WASM() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FUCHSIA() 1
+@@ -94,6 +103,8 @@
+ #elif defined(__native_client__)
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_ANDROID() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_LINUX() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_BSD() 0
++#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_FREEBSD() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_WIN() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_APPLE() 0
+ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_OS_MAC() 0
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h
new file mode 100644
index 0000000000..4d845eea5b
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/base/thread_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/base/thread_utils.h
+@@ -34,6 +34,7 @@ __declspec(dllimport) unsigned long __st
+ #include <sys/syscall.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <pthread.h>
+ #else
+ #include <pthread.h>
+ #endif
+@@ -46,6 +47,11 @@ using PlatformThreadId = pid_t;
+ inline PlatformThreadId GetThreadId() {
+ return gettid();
+ }
++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
++using PlatformThreadId = uint64_t;
++inline PlatformThreadId GetThreadId() {
++ return reinterpret_cast<uint64_t>(pthread_self());
++}
+ #elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)
+ using PlatformThreadId = pid_t;
+ inline PlatformThreadId GetThreadId() {
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_base_time.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_time.h
new file mode 100644
index 0000000000..7cc6c0071d
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_base_time.h
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/base/time.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/base/time.h
+@@ -199,6 +199,9 @@ inline TimeNanos GetTimeInternalNs(clock
+ // Return ns from boot. Conversely to GetWallTimeNs, this clock counts also time
+ // during suspend (when supported).
+ inline TimeNanos GetBootTimeNs() {
++#if defined(__FreeBSD__) || defined(__NetBSD__)
++ return GetTimeInternalNs(kWallTimeClockSource);
++#else
+ // Determine if CLOCK_BOOTTIME is available on the first call.
+ static const clockid_t kBootTimeClockSource = [] {
+ struct timespec ts = {};
+@@ -206,6 +209,7 @@ inline TimeNanos GetBootTimeNs() {
+ return res == 0 ? CLOCK_BOOTTIME : kWallTimeClockSource;
+ }();
+ return GetTimeInternalNs(kBootTimeClockSource);
++#endif
+ }
+
+ inline TimeNanos GetWallTimeNs() {
+@@ -213,7 +217,13 @@ inline TimeNanos GetWallTimeNs() {
+ }
+
+ inline TimeNanos GetWallTimeRawNs() {
++#if defined(__OpenBSD__) || defined(__NetBSD__)
++ return GetTimeInternalNs(CLOCK_MONOTONIC);
++#elif defined(__FreeBSD__)
++ return GetTimeInternalNs(CLOCK_MONOTONIC_FAST);
++#else
+ return GetTimeInternalNs(CLOCK_MONOTONIC_RAW);
++#endif
+ }
+
+ inline TimeNanos GetThreadCPUTimeNs() {
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h
new file mode 100644
index 0000000000..a9e12698b2
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/ext/base/event_fd.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/ext/base/event_fd.h
+@@ -55,6 +55,8 @@ class EventFd {
+ // On Mac and other non-Linux UNIX platforms a pipe-based fallback is used.
+ // The write end of the wakeup pipe.
+ ScopedFile write_fd_;
++#else
++ ScopedFile write_fd_;
+ #endif
+ };
+
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h
new file mode 100644
index 0000000000..e5f64de0ec
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/ext/base/sys_types.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/ext/base/sys_types.h
+@@ -33,11 +33,7 @@ using uid_t = int;
+ using pid_t = int;
+ #endif // !GCC
+
+-#if defined(_WIN64)
+-using ssize_t = int64_t;
+-#else
+-using ssize_t = long;
+-#endif // _WIN64
++using ssize_t = intptr_t;
+
+ #endif // OS_WIN
+
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h
new file mode 100644
index 0000000000..f0e5639737
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/ext/base/thread_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/ext/base/thread_utils.h
+@@ -41,9 +41,10 @@
+ namespace perfetto {
+ namespace base {
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
++ PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ // Sets the "comm" of the calling thread to the first 15 chars of the given
+ // string.
+ inline bool MaybeSetThreadName(const std::string& name) {
diff --git a/electron34/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h b/electron34/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h
new file mode 100644
index 0000000000..b0eae0a834
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/include/perfetto/tracing/internal/track_event_legacy.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/include/perfetto/tracing/internal/track_event_legacy.h
+@@ -249,7 +249,7 @@ class PERFETTO_EXPORT_COMPONENT LegacyTr
+ // are different. E.g. on Mac size_t is considered a different type from
+ // uint64_t even though it has the same size and signedness.
+ // Below we add overloads for those types that are known to cause ambiguity.
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) || defined(__OpenBSD__)
+ explicit LegacyTraceId(size_t raw_id) : raw_id_(raw_id) {}
+ explicit LegacyTraceId(intptr_t raw_id)
+ : raw_id_(static_cast<uint64_t>(raw_id)) {}
diff --git a/electron34/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto b/electron34/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto
new file mode 100644
index 0000000000..c43213f29c
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/protos/perfetto/trace/ftrace/v4l2.proto.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/protos/perfetto/trace/ftrace/v4l2.proto
+@@ -10,7 +10,7 @@ message V4l2QbufFtraceEvent {
+ optional uint32 field = 2;
+ optional uint32 flags = 3;
+ optional uint32 index = 4;
+- optional int32 minor = 5;
++ optional int32 gminor = 5;
+ optional uint32 sequence = 6;
+ optional uint32 timecode_flags = 7;
+ optional uint32 timecode_frames = 8;
+@@ -30,7 +30,7 @@ message V4l2DqbufFtraceEvent {
+ optional uint32 field = 2;
+ optional uint32 flags = 3;
+ optional uint32 index = 4;
+- optional int32 minor = 5;
++ optional int32 gminor = 5;
+ optional uint32 sequence = 6;
+ optional uint32 timecode_flags = 7;
+ optional uint32 timecode_frames = 8;
+@@ -48,7 +48,7 @@ message V4l2DqbufFtraceEvent {
+ message Vb2V4l2BufQueueFtraceEvent {
+ optional uint32 field = 1;
+ optional uint32 flags = 2;
+- optional int32 minor = 3;
++ optional int32 gminor = 3;
+ optional uint32 sequence = 4;
+ optional uint32 timecode_flags = 5;
+ optional uint32 timecode_frames = 6;
+@@ -65,7 +65,7 @@ message Vb2V4l2BufQueueFtraceEvent {
+ message Vb2V4l2BufDoneFtraceEvent {
+ optional uint32 field = 1;
+ optional uint32 flags = 2;
+- optional int32 minor = 3;
++ optional int32 gminor = 3;
+ optional uint32 sequence = 4;
+ optional uint32 timecode_flags = 5;
+ optional uint32 timecode_frames = 6;
+@@ -82,7 +82,7 @@ message Vb2V4l2BufDoneFtraceEvent {
+ message Vb2V4l2QbufFtraceEvent {
+ optional uint32 field = 1;
+ optional uint32 flags = 2;
+- optional int32 minor = 3;
++ optional int32 gminor = 3;
+ optional uint32 sequence = 4;
+ optional uint32 timecode_flags = 5;
+ optional uint32 timecode_frames = 6;
+@@ -99,7 +99,7 @@ message Vb2V4l2QbufFtraceEvent {
+ message Vb2V4l2DqbufFtraceEvent {
+ optional uint32 field = 1;
+ optional uint32 flags = 2;
+- optional int32 minor = 3;
++ optional int32 gminor = 3;
+ optional uint32 sequence = 4;
+ optional uint32 timecode_flags = 5;
+ optional uint32 timecode_frames = 6;
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_clock__snapshots.cc b/electron34/patches/patch-third__party_perfetto_src_base_clock__snapshots.cc
new file mode 100644
index 0000000000..673e7d1760
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_clock__snapshots.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/clock_snapshots.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/clock_snapshots.cc
+@@ -26,7 +26,8 @@ ClockSnapshotVector CaptureClockSnapshot
+ ClockSnapshotVector snapshot_data;
+ #if !PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) && \
+ !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) && \
+- !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_NACL) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ struct {
+ clockid_t id;
+ protos::pbzero::BuiltinClock type;
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_event__fd.cc b/electron34/patches/patch-third__party_perfetto_src_base_event__fd.cc
new file mode 100644
index 0000000000..c1b6bd23ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_event__fd.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/event_fd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/event_fd.cc
+@@ -22,7 +22,8 @@
+ #if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
+ #include <Windows.h>
+ #include <synchapi.h>
+-#elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#elif (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+ #include <sys/eventfd.h>
+ #include <unistd.h>
+@@ -57,7 +58,8 @@ void EventFd::Clear() {
+ PERFETTO_DFATAL("EventFd::Clear()");
+ }
+
+-#elif PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#elif (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+
+ EventFd::EventFd() {
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_periodic__task.cc b/electron34/patches/patch-third__party_perfetto_src_base_periodic__task.cc
new file mode 100644
index 0000000000..965054fadf
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_periodic__task.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/periodic_task.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/periodic_task.cc
+@@ -24,7 +24,7 @@
+ #include "perfetto/base/time.h"
+ #include "perfetto/ext/base/file_utils.h"
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ (PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) && __ANDROID_API__ >= 19)
+ #include <sys/timerfd.h>
+ #endif
+@@ -44,7 +44,7 @@ uint32_t GetNextDelayMs(const TimeMillis
+ }
+
+ ScopedPlatformHandle CreateTimerFd(const PeriodicTask::Args& args) {
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ (PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) && __ANDROID_API__ >= 19)
+ ScopedPlatformHandle tfd(
+ timerfd_create(CLOCK_BOOTTIME, TFD_CLOEXEC | TFD_NONBLOCK));
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_string__utils.cc b/electron34/patches/patch-third__party_perfetto_src_base_string__utils.cc
new file mode 100644
index 0000000000..24fc2fef0e
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_string__utils.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/string_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/string_utils.cc
+@@ -38,9 +38,10 @@ namespace base {
+
+ // Locale-independant as possible version of strtod.
+ double StrToD(const char* nptr, char** endptr) {
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
++ PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ static auto c_locale = newlocale(LC_ALL, "C", nullptr);
+ return strtod_l(nptr, endptr, c_locale);
+ #else
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc b/electron34/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc
new file mode 100644
index 0000000000..27f2c512f6
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/subprocess_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/subprocess_posix.cc
+@@ -35,7 +35,8 @@
+ #include <thread>
+ #include <tuple>
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+ #include <sys/prctl.h>
+ #endif
+@@ -64,7 +65,8 @@ struct ChildProcessArgs {
+ // Don't add any dynamic allocation in this function. This will be invoked
+ // under a fork(), potentially in a state where the allocator lock is held.
+ void __attribute__((noreturn)) ChildProcess(ChildProcessArgs* args) {
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
+ // In no case we want a child process to outlive its parent process. This is
+ // relevant for tests, so that a test failure/crash doesn't leave child
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc b/electron34/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc
new file mode 100644
index 0000000000..85fee64e90
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/test/vm_test_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/test/vm_test_utils.cc
+@@ -91,7 +91,7 @@ bool IsMapped(void* start, size_t size)
+ // Fuchsia doesn't yet support paging (b/119503290).
+ ignore_result(page_size);
+ return true;
+-#elif PERFETTO_BUILDFLAG(PERFETTO_OS_NACL)
++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_NACL) || PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ // mincore isn't available on NaCL.
+ ignore_result(page_size);
+ return true;
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc b/electron34/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc
new file mode 100644
index 0000000000..97f41a7934
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/thread_task_runner.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/thread_task_runner.cc
+@@ -27,8 +27,9 @@
+ #include "perfetto/ext/base/thread_utils.h"
+ #include "perfetto/ext/base/unix_task_runner.h"
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ #include <sys/prctl.h>
+ #endif
+
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_unix__socket.cc b/electron34/patches/patch-third__party_perfetto_src_base_unix__socket.cc
new file mode 100644
index 0000000000..5ec7e986cd
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_unix__socket.cc
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/unix_socket.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/unix_socket.cc
+@@ -44,7 +44,7 @@
+ #include <unistd.h>
+ #endif
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <sys/ucred.h>
+ #endif
+
+@@ -917,15 +917,27 @@ void UnixSocket::ReadPeerCredentialsPosi
+ return;
+ PERFETTO_CHECK(peer_cred_mode_ != SockPeerCredMode::kIgnore);
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if !defined(__FreeBSD__) && !defined(__NetBSD__) && PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
++ struct sockpeercred user_cred;
++#else
+ struct ucred user_cred;
++#endif
+ socklen_t len = sizeof(user_cred);
+ int fd = sock_raw_.fd();
+ int res = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &user_cred, &len);
+ PERFETTO_CHECK(res == 0);
+ peer_uid_ = user_cred.uid;
+ peer_pid_ = user_cred.pid;
++#elif defined(__NetBSD__)
++ struct unpcbid user_cred;
++ socklen_t len = sizeof(user_cred);
++ int fd = sock_raw_.fd();
++ int res = getsockopt(fd, 0, LOCAL_PEEREID, &user_cred, &len);
++ PERFETTO_CHECK(res == 0);
++ peer_uid_ = user_cred.unp_euid;
++ peer_pid_ = user_cred.unp_pid;
+ #elif PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
+ struct xucred user_cred;
+ socklen_t len = sizeof(user_cred);
diff --git a/electron34/patches/patch-third__party_perfetto_src_base_utils.cc b/electron34/patches/patch-third__party_perfetto_src_base_utils.cc
new file mode 100644
index 0000000000..6e679bad6b
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_base_utils.cc
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/base/utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/base/utils.cc
+@@ -38,8 +38,9 @@
+ #include <mach/vm_page_size.h>
+ #endif
+
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ #include <sys/prctl.h>
+
+ #ifndef PR_GET_TAGGED_ADDR_CTRL
+@@ -278,14 +279,22 @@ void Daemonize(std::function<int()> pare
+
+ std::string GetCurExecutablePath() {
+ std::string self_path;
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_FUCHSIA)
++ PERFETTO_BUILDFLAG(PERFETTO_OS_FUCHSIA)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ char buf[PATH_MAX];
+ ssize_t size = readlink("/proc/self/exe", buf, sizeof(buf));
+ PERFETTO_CHECK(size != -1);
+ // readlink does not null terminate.
+ self_path = std::string(buf, static_cast<size_t>(size));
++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
++ char *buf;
++ const char *cpath = "@PREFIX@/lib/@PKGBASE@/electron";
++ if ((buf = getenv("CHROME_EXE_PATH")) != NULL)
++ self_path = std::string(buf);
++ else
++ self_path = std::string(cpath);
+ #elif PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
+ uint32_t size = 0;
+ PERFETTO_CHECK(_NSGetExecutablePath(nullptr, &size));
+@@ -337,8 +346,9 @@ void AlignedFree(void* ptr) {
+ }
+
+ bool IsSyncMemoryTaggingEnabled() {
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ // Compute only once per lifetime of the process.
+ static bool cached_value = [] {
+ const int res = prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0);
diff --git a/electron34/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc b/electron34/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc
new file mode 100644
index 0000000000..ac0d4e3f27
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/trace_processor/importers/ftrace/v4l2_tracker.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/trace_processor/importers/ftrace/v4l2_tracker.cc
+@@ -62,7 +62,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kV4l2QbufFieldNumber: {
+ V4l2QbufFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = pb_evt.index();
+ evt.type = pb_evt.type();
+ evt.bytesused = pb_evt.bytesused();
+@@ -103,7 +103,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kV4l2DqbufFieldNumber: {
+ V4l2DqbufFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = pb_evt.index();
+ evt.type = pb_evt.type();
+ evt.bytesused = pb_evt.bytesused();
+@@ -149,7 +149,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kVb2V4l2BufQueueFieldNumber: {
+ Vb2V4l2BufQueueFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = std::nullopt;
+ evt.type = std::nullopt;
+ evt.bytesused = std::nullopt;
+@@ -180,7 +180,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kVb2V4l2BufDoneFieldNumber: {
+ Vb2V4l2BufDoneFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = std::nullopt;
+ evt.type = std::nullopt;
+ evt.bytesused = std::nullopt;
+@@ -211,7 +211,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kVb2V4l2QbufFieldNumber: {
+ Vb2V4l2QbufFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = std::nullopt;
+ evt.type = std::nullopt;
+ evt.bytesused = std::nullopt;
+@@ -242,7 +242,7 @@ void V4l2Tracker::ParseV4l2Event(uint64_
+ case FtraceEvent::kVb2V4l2DqbufFieldNumber: {
+ Vb2V4l2DqbufFtraceEvent::Decoder pb_evt(bytes.data, bytes.size);
+ BufferEvent evt;
+- evt.device_minor = pb_evt.minor();
++ evt.device_minor = pb_evt.gminor();
+ evt.index = std::nullopt;
+ evt.type = std::nullopt;
+ evt.bytesused = std::nullopt;
diff --git a/electron34/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc b/electron34/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc
new file mode 100644
index 0000000000..6aec115b12
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/tracing/ipc/memfd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/tracing/ipc/memfd.cc
+@@ -20,7 +20,8 @@
+
+ #define PERFETTO_MEMFD_ENABLED() \
+ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX)
++ (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD))
+
+ #if PERFETTO_MEMFD_ENABLED()
+
diff --git a/electron34/patches/patch-third__party_perfetto_src_tracing_platform__posix.cc b/electron34/patches/patch-third__party_perfetto_src_tracing_platform__posix.cc
new file mode 100644
index 0000000000..3355fae706
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_tracing_platform__posix.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/tracing/platform_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/tracing/platform_posix.cc
+@@ -110,12 +110,13 @@ std::unique_ptr<base::TaskRunner> Platfo
+ }
+
+ std::string PlatformPosix::GetCurrentProcessName() {
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ std::string cmdline;
+ base::ReadFile("/proc/self/cmdline", &cmdline);
+ return cmdline.substr(0, cmdline.find('\0'));
+-#elif PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE)
++#elif PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) || PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ return std::string(getprogname());
+ #else
+ return "unknown_producer";
diff --git a/electron34/patches/patch-third__party_perfetto_src_tracing_track.cc b/electron34/patches/patch-third__party_perfetto_src_tracing_track.cc
new file mode 100644
index 0000000000..027c8c326b
--- /dev/null
+++ b/electron34/patches/patch-third__party_perfetto_src_tracing_track.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/perfetto/src/tracing/track.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/perfetto/src/tracing/track.cc
+@@ -60,8 +60,9 @@ protos::gen::TrackDescriptor ProcessTrac
+ auto desc = Track::Serialize();
+ auto pd = desc.mutable_process();
+ pd->set_pid(static_cast<int32_t>(pid));
+-#if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
+- PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)
++#if (PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \
++ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID)) && \
++ !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ std::string cmdline;
+ if (base::ReadFile("/proc/self/cmdline", &cmdline)) {
+ // Since cmdline is a zero-terminated list of arguments, this ends up
+@@ -170,7 +171,7 @@ namespace internal {
+ namespace {
+
+ uint64_t GetProcessStartTime() {
+-#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN)
++#if !PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) && !PERFETTO_BUILDFLAG(PERFETTO_OS_BSD)
+ std::string stat;
+ if (!base::ReadFile("/proc/self/stat", &stat))
+ return 0u;
diff --git a/electron34/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h b/electron34/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h
new file mode 100644
index 0000000000..da403bcc05
--- /dev/null
+++ b/electron34/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/protobuf/src/google/protobuf/stubs/platform_macros.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/protobuf/src/google/protobuf/stubs/platform_macros.h
+@@ -122,7 +122,7 @@ GOOGLE_PROTOBUF_PLATFORM_ERROR
+
+ #undef GOOGLE_PROTOBUF_PLATFORM_ERROR
+
+-#if defined(GOOGLE_PROTOBUF_OS_ANDROID) || defined(GOOGLE_PROTOBUF_OS_IPHONE)
++#if defined(GOOGLE_PROTOBUF_OS_ANDROID) || defined(GOOGLE_PROTOBUF_OS_IPHONE) || defined(__OpenBSD__)
+ // Android ndk does not support the __thread keyword very well yet. Here
+ // we use pthread_key_create()/pthread_getspecific()/... methods for
+ // TLS support on android.
diff --git a/electron34/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h b/electron34/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h
new file mode 100644
index 0000000000..7fbdd4f6c5
--- /dev/null
+++ b/electron34/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/skia/src/gpu/ganesh/GrAutoLocaleSetter.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/skia/src/gpu/ganesh/GrAutoLocaleSetter.h
+@@ -27,7 +27,7 @@
+ #define HAVE_XLOCALE 0
+ #endif
+
+-#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION)
++#if defined(SK_BUILD_FOR_ANDROID) || defined(__UCLIBC__) || defined(_NEWLIB_VERSION) || defined(__NetBSD__)
+ #define HAVE_LOCALE_T 0
+ #else
+ #define HAVE_LOCALE_T 1
diff --git a/electron34/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp b/electron34/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp
new file mode 100644
index 0000000000..ced53387f3
--- /dev/null
+++ b/electron34/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/skia/src/ports/SkMemory_malloc.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/skia/src/ports/SkMemory_malloc.cpp
+@@ -15,7 +15,8 @@
+
+ #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
+ #include <malloc/malloc.h>
+-#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX)
++#elif defined(SK_BUILD_FOR_ANDROID) || defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && \
++ !defined(__NetBSD__)
+ #include <malloc.h>
+ #elif defined(SK_BUILD_FOR_WIN)
+ #include <malloc.h>
+@@ -126,7 +127,7 @@ size_t sk_malloc_size(void* addr, size_t
+ #elif defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 17
+ completeSize = malloc_usable_size(addr);
+ SkASSERT(completeSize >= size);
+- #elif defined(SK_BUILD_FOR_UNIX)
++ #elif defined(SK_BUILD_FOR_UNIX) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+ completeSize = malloc_usable_size(addr);
+ SkASSERT(completeSize >= size);
+ #elif defined(SK_BUILD_FOR_WIN)
diff --git a/electron34/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp b/electron34/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp
new file mode 100644
index 0000000000..0ad2824866
--- /dev/null
+++ b/electron34/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/skia/src/ports/SkOSFile_posix.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/skia/src/ports/SkOSFile_posix.cpp
+@@ -25,7 +25,7 @@
+ #endif
+
+ void sk_fsync(FILE* f) {
+-#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) && !defined(_NEWLIB_VERSION)
++#if !defined(SK_BUILD_FOR_ANDROID) && !defined(__UCLIBC__) && !defined(_NEWLIB_VERSION) && !defined(__OpenBSD__)
+ int fd = fileno(f);
+ fsync(fd);
+ #endif
diff --git a/electron34/patches/patch-third__party_speech-dispatcher_libspeechd__version.h b/electron34/patches/patch-third__party_speech-dispatcher_libspeechd__version.h
new file mode 100644
index 0000000000..6e90e5e553
--- /dev/null
+++ b/electron34/patches/patch-third__party_speech-dispatcher_libspeechd__version.h
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/speech-dispatcher/libspeechd_version.h.orig 2025-05-24 17:57:53.656605086 +0000
++++ third_party/speech-dispatcher/libspeechd_version.h
+@@ -0,0 +1,29 @@
++/*
++ * libspeechd_version.h - Shared library for easy access to Speech Dispatcher functions (header)
++ *
++ * Copyright (C) 2001, 2002, 2003, 2004 Brailcom, o.p.s.
++ *
++ * This is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1, or (at your option)
++ * any later version.
++ *
++ * This software is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this program. If not, see <https://www.gnu.org/licenses/>.
++ *
++ * Id: patch-third_party_speech-dispatcher_libspeechd_version_h,v 1.4 2024/03/22 13:10:56 robert
++ */
++
++#ifndef _LIBSPEECHD_VERSION_H
++#define _LIBSPEECHD_VERSION_H
++
++#define LIBSPEECHD_MAJOR_VERSION 0
++#define LIBSPEECHD_MINOR_VERSION 11
++#define LIBSPEECHD_MICRO_VERSION 5
++
++#endif /* ifndef _LIBSPEECHD_VERSION_H */
diff --git a/electron34/patches/patch-third__party_speech-dispatcher_speechd__types.h b/electron34/patches/patch-third__party_speech-dispatcher_speechd__types.h
new file mode 100644
index 0000000000..bf8a7f2cf5
--- /dev/null
+++ b/electron34/patches/patch-third__party_speech-dispatcher_speechd__types.h
@@ -0,0 +1,148 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/speech-dispatcher/speechd_types.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/speech-dispatcher/speechd_types.h
+@@ -119,4 +119,139 @@ typedef struct {
+ SPDVoice voice;
+ } SPDMsgSettings;
+
++/* TEMP_FAILURE_RETRY seems to be available only on Linux. For systems that
++ * don't have this macro we provide our own version. This code was taken from
++ * file "/usr/include/unistd.h" from Debian package "libc6-dev"
++ * version 2.3.2.ds1-20. */
++#ifndef TEMP_FAILURE_RETRY
++#define TEMP_FAILURE_RETRY(expression) \
++ (__extension__ \
++ ({ long int __result; \
++ do __result = (long int) (expression); \
++ while (__result == -1L && errno == EINTR); \
++ __result; }))
++#endif
++
++#endif /* not ifndef SPEECHD_TYPES */
++
++/*
++ * speechd_types.h - types for Speech Dispatcher
++ *
++ * Copyright (C) 2001, 2002, 2003 Brailcom, o.p.s.
++ *
++ * This is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1, or (at your option)
++ * any later version.
++ *
++ * This software is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ * Lesser General Public License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with this program. If not, see <https://www.gnu.org/licenses/>.
++ */
++
++#ifndef SPEECHD_TYPES_H
++#define SPEECHD_TYPES_H
++
++typedef enum {
++ SPD_PUNCT_ALL = 0,
++ SPD_PUNCT_NONE = 1,
++ SPD_PUNCT_SOME = 2,
++ SPD_PUNCT_MOST = 3
++} SPDPunctuation;
++
++typedef enum {
++ SPD_CAP_NONE = 0,
++ SPD_CAP_SPELL = 1,
++ SPD_CAP_ICON = 2
++} SPDCapitalLetters;
++
++typedef enum {
++ SPD_SPELL_OFF = 0,
++ SPD_SPELL_ON = 1
++} SPDSpelling;
++
++typedef enum {
++ SPD_MALE1 = 1,
++ SPD_MALE2 = 2,
++ SPD_MALE3 = 3,
++ SPD_FEMALE1 = 4,
++ SPD_FEMALE2 = 5,
++ SPD_FEMALE3 = 6,
++ SPD_CHILD_MALE = 7,
++ SPD_CHILD_FEMALE = 8,
++ SPD_UNSPECIFIED = -1
++} SPDVoiceType;
++
++typedef struct {
++ char *name; /* Name of the voice (id) */
++ char *language; /* 2/3-letter ISO language code,
++ * possibly followed by 2/3-letter ISO region code,
++ * e.g. en-US */
++ char *variant; /* a not-well defined string describing dialect etc. */
++} SPDVoice;
++
++typedef enum {
++ SPD_DATA_TEXT = 0,
++ SPD_DATA_SSML = 1
++} SPDDataMode;
++
++typedef enum {
++ SPD_IMPORTANT = 1,
++ SPD_MESSAGE = 2,
++ SPD_TEXT = 3,
++ SPD_NOTIFICATION = 4,
++ SPD_PROGRESS = 5
++} SPDPriority;
++
++typedef enum {
++ SPD_BEGIN = 1,
++ SPD_END = 2,
++ SPD_INDEX_MARKS = 4,
++ SPD_CANCEL = 8,
++ SPD_PAUSE = 16,
++ SPD_RESUME = 32,
++
++ SPD_ALL = 0x3f
++} SPDNotification;
++
++typedef enum {
++ SPD_EVENT_BEGIN,
++ SPD_EVENT_END,
++ SPD_EVENT_INDEX_MARK,
++ SPD_EVENT_CANCEL,
++ SPD_EVENT_PAUSE,
++ SPD_EVENT_RESUME
++} SPDNotificationType;
++
++typedef enum {
++ SORT_BY_TIME = 0,
++ SORT_BY_ALPHABET = 1
++} ESort;
++
++typedef enum {
++ SPD_MSGTYPE_TEXT = 0,
++ SPD_MSGTYPE_SOUND_ICON = 1,
++ SPD_MSGTYPE_CHAR = 2,
++ SPD_MSGTYPE_KEY = 3,
++ SPD_MSGTYPE_SPELL = 99
++} SPDMessageType;
++
++typedef struct {
++ signed int rate;
++ signed int pitch;
++ signed int pitch_range;
++ signed int volume;
++
++ SPDPunctuation punctuation_mode;
++ SPDSpelling spelling_mode;
++ SPDCapitalLetters cap_let_recogn;
++
++ SPDVoiceType voice_type;
++ SPDVoice voice;
++} SPDMsgSettings;
++
+ #endif /* not ifndef SPEECHD_TYPES */
diff --git a/electron34/patches/patch-third__party_sqlite_BUILD.gn b/electron34/patches/patch-third__party_sqlite_BUILD.gn
new file mode 100644
index 0000000000..9f0bf0863e
--- /dev/null
+++ b/electron34/patches/patch-third__party_sqlite_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/sqlite/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/sqlite/BUILD.gn
+@@ -142,7 +142,7 @@ config("sqlite_warnings") {
+ ]
+ }
+ }
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ cflags += [
+ # SQLite doesn't believe in compiler warnings, preferring testing.
+ # http://www.sqlite.org/faq.html#q17
diff --git a/electron34/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c b/electron34/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c
new file mode 100644
index 0000000000..02849323c6
--- /dev/null
+++ b/electron34/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/sqlite/src/amalgamation_dev/sqlite3.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/sqlite/src/amalgamation_dev/sqlite3.c
+@@ -20646,6 +20646,9 @@ SQLITE_PRIVATE int sqlite3HeapNearlyFull
+ ** The alloca() routine never returns NULL. This will cause code paths
+ ** that deal with sqlite3StackAlloc() failures to be unreachable.
+ */
++#if defined(__NetBSD__)
++# undef SQLITE_USE_ALLOCA
++#endif
+ #ifdef SQLITE_USE_ALLOCA
+ # define sqlite3StackAllocRaw(D,N) alloca(N)
+ # define sqlite3StackAllocRawNN(D,N) alloca(N)
diff --git a/electron34/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c b/electron34/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c
new file mode 100644
index 0000000000..b5d8de4a0f
--- /dev/null
+++ b/electron34/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/sqlite/src/amalgamation/sqlite3.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/sqlite/src/amalgamation/sqlite3.c
+@@ -14187,7 +14187,7 @@ struct fts5_api {
+ ** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit
+ ** it.
+ */
+-#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__)
++#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) && !defined(__FreeBSD__)
+ # define _XOPEN_SOURCE 600
+ #endif
+
+@@ -20633,6 +20633,9 @@ SQLITE_PRIVATE int sqlite3HeapNearlyFull
+ ** The alloca() routine never returns NULL. This will cause code paths
+ ** that deal with sqlite3StackAlloc() failures to be unreachable.
+ */
++#if defined(__NetBSD__)
++# undef SQLITE_USE_ALLOCA
++#endif
+ #ifdef SQLITE_USE_ALLOCA
+ # define sqlite3StackAllocRaw(D,N) alloca(N)
+ # define sqlite3StackAllocRawNN(D,N) alloca(N)
+@@ -45183,6 +45186,11 @@ static int unixRandomness(sqlite3_vfs *N
+ memset(zBuf, 0, nBuf);
+ randomnessPid = osGetpid(0);
+ #if !defined(SQLITE_TEST) && !defined(SQLITE_OMIT_RANDOMNESS)
++#if defined(__OpenBSD__)
++ {
++ arc4random_buf(zBuf, nBuf);
++ }
++#else
+ {
+ int fd, got;
+ fd = robust_open("/dev/urandom", O_RDONLY, 0);
+@@ -45199,6 +45207,7 @@ static int unixRandomness(sqlite3_vfs *N
+ }
+ }
+ #endif
++#endif
+ return nBuf;
+ }
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_.gitignore b/electron34/patches/patch-third__party_squirrel.mac_.gitignore
new file mode 100644
index 0000000000..2646847131
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_.gitignore
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/.gitignore.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/.gitignore
+@@ -1,6 +1,5 @@
+ # Xcode
+ .DS_Store
+-build/
+ *.pbxuser
+ !default.pbxuser
+ *.mode1v3
+@@ -16,3 +15,4 @@ profile
+ *.moved-aside
+ DerivedData
+ .idea/
++vendorXXX
diff --git a/electron34/patches/patch-third__party_squirrel.mac_BUILD.gn b/electron34/patches/patch-third__party_squirrel.mac_BUILD.gn
new file mode 100644
index 0000000000..b9a42ba552
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_BUILD.gn
@@ -0,0 +1,251 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/BUILD.gn.orig 2025-05-24 17:57:53.694329562 +0000
++++ third_party/squirrel.mac/BUILD.gn
+@@ -0,0 +1,242 @@
++assert(is_mac)
++
++import("//build/config/mac/rules.gni")
++import("build/xcrun.gni")
++import("filenames.gni")
++
++bundle_data("mantle_headers") {
++ sources = []
++ public_deps = []
++ sources += mantle_filenames.headers
++ outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
++}
++
++mac_framework_bundle("mantle_framework") {
++ output_name = "Mantle"
++ framework_version = "A"
++ framework_contents = [
++ "Headers",
++ "Resources",
++ ]
++ info_plist = "vendor/Mantle/Mantle/Info.plist"
++ extra_substitutions = [ "CURRENT_PROJECT_VERSION=0.0.0" ]
++
++ configs -= [
++ "//build/config/compiler:chromium_code",
++ "//build/config/gcc:symbol_visibility_hidden",
++ ]
++ configs += [ "//build/config/compiler:no_chromium_code" ]
++ public_deps = [ ":mantle_headers" ]
++ deps = []
++ frameworks = [
++ "CoreData.framework",
++ "Foundation.framework",
++ ]
++ sources = mantle_filenames.headers + mantle_filenames.sources
++
++ include_dirs = [
++ "vendor/Mantle/Mantle",
++ "vendor/Mantle/Mantle/extobjc",
++ ]
++
++ cflags_objc = [
++ "-fobjc-arc",
++ "-Wno-block-capture-autoreleasing",
++ ]
++
++ ldflags = [ "-Wl,-install_name,@rpath/$output_name.framework/$output_name" ]
++}
++
++dtrace_header_dir = "$target_gen_dir/dtrace"
++
++xcrun_action("reactiveobjc_signalprovider_dtrace") {
++ cmd = "dtrace"
++ inputs = [ "vendor/ReactiveObjC/ReactiveObjC/RACSignalProvider.d" ]
++ outputs = [ "$dtrace_header_dir/RACSignalProvider.h" ]
++ args = [
++ "-h",
++ "-s",
++ ] + rebase_path(inputs) + [ "-o" ] + rebase_path(outputs)
++}
++
++xcrun_action("reactiveobjc_disposableprovider_dtrace") {
++ cmd = "dtrace"
++ inputs =
++ [ "vendor/ReactiveObjC/ReactiveObjC/RACCompoundDisposableProvider.d" ]
++ outputs = [ "$dtrace_header_dir/RACCompoundDisposableProvider.h" ]
++ args = [
++ "-h",
++ "-s",
++ ] + rebase_path(inputs) + [ "-o" ] + rebase_path(outputs)
++}
++
++bundle_data("reactiveobjc_headers") {
++ sources = []
++ public_deps = []
++ sources += reactiveobjc_filenames.public_headers
++ outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
++}
++
++mac_framework_bundle("reactiveobjc_framework") {
++ output_name = "ReactiveObjC"
++ framework_version = "A"
++ framework_contents = [
++ "Headers",
++ "Resources",
++ ]
++ info_plist = "vendor/ReactiveObjC/ReactiveObjC/Info.plist"
++ extra_substitutions = [
++ "CURRENT_PROJECT_VERSION=0.0.0",
++ "PRODUCT_BUNDLE_IDENTIFIER=com.electron.reactive",
++ ]
++ defines = [
++ "BUILDING_RAC_FRAMEWORK=1",
++ "DTRACE_PROBES_DISABLED",
++ ]
++
++ configs -= [
++ "//build/config/compiler:chromium_code",
++ "//build/config/gcc:symbol_visibility_hidden",
++ ]
++ configs += [ "//build/config/compiler:no_chromium_code" ]
++ deps = [
++ ":reactiveobjc_disposableprovider_dtrace",
++ ":reactiveobjc_headers",
++ ":reactiveobjc_headers",
++ ":reactiveobjc_signalprovider_dtrace",
++ ]
++ frameworks = [
++ "AppKit.framework",
++ "Foundation.framework",
++ ]
++ sources =
++ reactiveobjc_filenames.public_headers +
++ reactiveobjc_filenames.private_headers + reactiveobjc_filenames.sources
++
++ include_dirs = [
++ "vendor/ReactiveObjC/ReactiveObjC",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc",
++ "$dtrace_header_dir",
++ ]
++
++ cflags_objc = [
++ "-fobjc-arc",
++ "-Wno-deprecated-declarations",
++ ]
++
++ ldflags = [ "-Wl,-install_name,@rpath/$output_name.framework/$output_name" ]
++}
++
++executable("squirrel_shipit") {
++ output_name = "ShipIt"
++ configs -= [ "//build/config/compiler:chromium_code" ]
++ configs += [ "//build/config/compiler:no_chromium_code" ]
++ sources = [
++ "Squirrel/NSBundle+SQRLVersionExtensions.h",
++ "Squirrel/NSBundle+SQRLVersionExtensions.m",
++ "Squirrel/NSError+SQRLVerbosityExtensions.h",
++ "Squirrel/NSError+SQRLVerbosityExtensions.m",
++ "Squirrel/NSProcessInfo+SQRLVersionExtensions.h",
++ "Squirrel/NSProcessInfo+SQRLVersionExtensions.m",
++ "Squirrel/RACSignal+SQRLTransactionExtensions.h",
++ "Squirrel/RACSignal+SQRLTransactionExtensions.m",
++ "Squirrel/SQRLCodeSignature.h",
++ "Squirrel/SQRLCodeSignature.m",
++ "Squirrel/SQRLInstaller+Private.h",
++ "Squirrel/SQRLInstaller.h",
++ "Squirrel/SQRLInstaller.m",
++ "Squirrel/SQRLInstallerOwnedBundle.h",
++ "Squirrel/SQRLInstallerOwnedBundle.m",
++ "Squirrel/SQRLShipItRequest.h",
++ "Squirrel/SQRLShipItRequest.m",
++ "Squirrel/SQRLTerminationListener.h",
++ "Squirrel/SQRLTerminationListener.m",
++ "Squirrel/ShipIt-main.m",
++ ]
++ deps = [
++ ":mantle_framework+link",
++ ":reactiveobjc_framework+link",
++ ]
++ frameworks = [
++ "AppKit.framework",
++ "Foundation.framework",
++ "IOKit.framework",
++ "Security.framework",
++ ]
++
++ cflags_objc = [
++ "-fobjc-weak",
++ "-Wno-unknown-warning-option",
++ "-Wno-block-capture-autoreleasing",
++ "-fobjc-arc",
++ ]
++
++ ldflags = [
++ "-rpath",
++ "@executable_path/../..",
++ "-rpath",
++ "@executable_path/../../../..",
++ ]
++
++ include_dirs = [ "vendor/ReactiveObjC/ReactiveObjC/extobjc" ]
++}
++
++bundle_data("squirrel_framework_shipit") {
++ sources = []
++ public_deps = [ ":squirrel_shipit" ]
++ sources += [ "$root_out_dir/ShipIt" ]
++ outputs = [ "{{bundle_contents_dir}}/Resources/{{source_file_part}}" ]
++}
++
++bundle_data("squirrel_framework_headers") {
++ sources = []
++ public_deps = []
++ sources += squirrel_filenames.headers
++ outputs = [ "{{bundle_contents_dir}}/Headers/{{source_file_part}}" ]
++}
++
++mac_framework_bundle("squirrel_framework") {
++ output_name = "Squirrel"
++ framework_version = "A"
++ framework_contents = [
++ "Headers",
++ "Resources",
++ ]
++ info_plist = "Squirrel/Squirrel-Info.plist"
++ extra_substitutions = [
++ "CURRENT_PROJECT_VERSION=0.0.0",
++ "PRODUCT_BUNDLE_IDENTIFIER=com.github.Squirrel",
++ ]
++
++ configs -= [
++ "//build/config/compiler:chromium_code",
++ "//build/config/gcc:symbol_visibility_hidden",
++ ]
++ configs += [ "//build/config/compiler:no_chromium_code" ]
++ public_deps = [
++ ":squirrel_framework_headers",
++ ":squirrel_framework_shipit",
++ ]
++ deps = [
++ ":mantle_framework+link",
++ ":reactiveobjc_framework+link",
++ ]
++ frameworks = [
++ "AppKit.framework",
++ "Foundation.framework",
++ "IOKit.framework",
++ "Security.framework",
++ "ServiceManagement.framework",
++ ]
++ sources = squirrel_filenames.headers + squirrel_filenames.sources
++
++ cflags_objc = [
++ "-fobjc-weak",
++ "-fobjc-arc",
++ "-Wno-block-capture-autoreleasing",
++ ]
++
++ ldflags = [ "-Wl,-install_name,@rpath/$output_name.framework/$output_name" ]
++
++ include_dirs = [ "vendor/ReactiveObjC/ReactiveObjC/extobjc" ]
++}
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h
new file mode 100644
index 0000000000..2e896ac311
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/RACSignal+SQRLTransactionExtensions.h.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/RACSignal+SQRLTransactionExtensions.h
+@@ -6,7 +6,7 @@
+ // Copyright (c) 2013 GitHub. All rights reserved.
+ //
+
+-#import <ReactiveCocoa/RACSignal.h>
++#import <ReactiveObjC/RACSignal.h>
+
+ @interface RACSignal (SQRLTransactionExtensions)
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m
new file mode 100644
index 0000000000..e93c61633a
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/RACSignal+SQRLTransactionExtensions.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/RACSignal+SQRLTransactionExtensions.m
+@@ -8,7 +8,7 @@
+
+ #import "RACSignal+SQRLTransactionExtensions.h"
+
+-#import <ReactiveCocoa/RACDisposable.h>
++#import <ReactiveObjC/RACDisposable.h>
+ #import <IOKit/pwr_mgt/IOPMLib.h>
+
+ // How long before power assertions time out.
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m
new file mode 100644
index 0000000000..c8a5795dc6
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLCodeSignature.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLCodeSignature.m
+@@ -10,8 +10,8 @@
+
+ #import "EXTKeyPathCoding.h"
+ #import "EXTScope.h"
+-#import <ReactiveCocoa/RACSignal+Operations.h>
+-#import <ReactiveCocoa/RACSubscriber.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
++#import <ReactiveObjC/RACSubscriber.h>
+ #import <Security/Security.h>
+
+ NSString * const SQRLCodeSignatureErrorDomain = @"SQRLCodeSignatureErrorDomain";
+@@ -124,7 +124,7 @@ const NSInteger SQRLCodeSignatureErrorCo
+ }
+
+ CFErrorRef validityError = NULL;
+- result = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSCheckAllArchitectures, (__bridge SecRequirementRef)self.requirement, &validityError);
++ result = SecStaticCodeCheckValidityWithErrors(staticCode, kSecCSCheckNestedCode | kSecCSStrictValidate | kSecCSCheckAllArchitectures, (__bridge SecRequirementRef)self.requirement, &validityError);
+ @onExit {
+ if (validityError != NULL) CFRelease(validityError);
+ };
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m
new file mode 100644
index 0000000000..4763e911a3
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLDirectoryManager.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLDirectoryManager.m
+@@ -8,7 +8,7 @@
+
+ #import "SQRLDirectoryManager.h"
+
+-#import <ReactiveCocoa/RACSignal+Operations.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
+
+ @implementation SQRLDirectoryManager
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m
new file mode 100644
index 0000000000..13475beaeb
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLDownloadedUpdate.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLDownloadedUpdate.m
+@@ -7,7 +7,7 @@
+ //
+
+ #import "SQRLDownloadedUpdate.h"
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+
+ @interface SQRLDownloadedUpdate ()
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h
new file mode 100644
index 0000000000..34ffc31208
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLInstaller.h.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLInstaller.h
+@@ -37,6 +37,9 @@ extern const NSInteger SQRLInstallerErro
+ // There was an error changing the file permissions of the update.
+ extern const NSInteger SQRLInstallerErrorChangingPermissions;
+
++// There was a running instance of the app just prior to the update attempt
++extern const NSInteger SQRLInstallerErrorAppStillRunning;
++
+ @class RACCommand;
+
+ // Performs the installation of an update, saving its intermediate state to user
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m
new file mode 100644
index 0000000000..e10bd2bc31
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m
@@ -0,0 +1,192 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLInstaller.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLInstaller.m
+@@ -9,13 +9,13 @@
+ #import "SQRLInstaller.h"
+
+ #import <libkern/OSAtomic.h>
+-#import "EXTScope.h"
+-#import <ReactiveCocoa/NSEnumerator+RACSequenceAdditions.h>
+-#import <ReactiveCocoa/NSObject+RACPropertySubscribing.h>
+-#import <ReactiveCocoa/RACCommand.h>
+-#import <ReactiveCocoa/RACSequence.h>
+-#import <ReactiveCocoa/RACSignal+Operations.h>
+-#import <ReactiveCocoa/RACSubscriber.h>
++#import <ReactiveObjC/EXTScope.h>
++#import <ReactiveObjC/NSEnumerator+RACSequenceAdditions.h>
++#import <ReactiveObjC/NSObject+RACPropertySubscribing.h>
++#import <ReactiveObjC/RACCommand.h>
++#import <ReactiveObjC/RACSequence.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
++#import <ReactiveObjC/RACSubscriber.h>
+ #import <sys/xattr.h>
+
+ #import "NSBundle+SQRLVersionExtensions.h"
+@@ -36,6 +36,7 @@ const NSInteger SQRLInstallerErrorMissin
+ const NSInteger SQRLInstallerErrorInvalidState = -6;
+ const NSInteger SQRLInstallerErrorMovingAcrossVolumes = -7;
+ const NSInteger SQRLInstallerErrorChangingPermissions = -8;
++const NSInteger SQRLInstallerErrorAppStillRunning = -9;
+
+ NSString * const SQRLShipItInstallationAttemptsKey = @"SQRLShipItInstallationAttempts";
+ NSString * const SQRLInstallerOwnedBundleKey = @"SQRLInstallerOwnedBundle";
+@@ -181,14 +182,40 @@ NSString * const SQRLInstallerOwnedBundl
+ id archiveData = CFBridgingRelease(CFPreferencesCopyValue((__bridge CFStringRef)SQRLInstallerOwnedBundleKey, (__bridge CFStringRef)self.applicationIdentifier, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost));
+ if (![archiveData isKindOfClass:NSData.class]) return nil;
+
+- SQRLInstallerOwnedBundle *ownedBundle = [NSKeyedUnarchiver unarchiveObjectWithData:archiveData];
+- if (![ownedBundle isKindOfClass:SQRLInstallerOwnedBundle.class]) return nil;
++ // unarchivedObjectOfClass:fromData:error: sets secureCoding to true and we don't
++ // archive data with secureCoding enabled - use our own unarchiver to work around that.
++ NSError *error;
++ NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingFromData:archiveData
++ error:&error];
++ unarchiver.requiresSecureCoding = NO;
++ SQRLInstallerOwnedBundle *ownedBundle = [unarchiver decodeObjectForKey:NSKeyedArchiveRootObjectKey];
++ [unarchiver finishDecoding];
++
++ if (error) {
++ NSLog(@"Error while unarchiving ownedBundle - %@", error.localizedDescription);
++ return nil;
++ }
++
++ if (!ownedBundle || ![ownedBundle isKindOfClass:SQRLInstallerOwnedBundle.class]) {
++ NSLog(@"Unknown error while unarchiving ownedBundle - did not conform to SQRLInstallerOwnedBundle");
++ return nil;
++ }
+
+ return ownedBundle;
+ }
+
+ - (void)setOwnedBundle:(SQRLInstallerOwnedBundle *)ownedBundle {
+- NSData *archiveData = (ownedBundle == nil ? nil : [NSKeyedArchiver archivedDataWithRootObject:ownedBundle]);
++ NSData *archiveData = nil;
++ if (ownedBundle != nil) {
++ NSError *error;
++ archiveData = [NSKeyedArchiver archivedDataWithRootObject:ownedBundle
++ requiringSecureCoding:NO
++ error:&error];
++
++ if (error)
++ NSLog(@"Couldn't archive ownedBundle - %@", error.localizedDescription);
++ }
++
+ CFPreferencesSetValue((__bridge CFStringRef)SQRLInstallerOwnedBundleKey, (__bridge CFPropertyListRef)archiveData, (__bridge CFStringRef)self.applicationIdentifier, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ CFPreferencesSynchronize((__bridge CFStringRef)self.applicationIdentifier, kCFPreferencesCurrentUser, kCFPreferencesCurrentHost);
+ }
+@@ -249,6 +276,7 @@ NSString * const SQRLInstallerOwnedBundl
+ ] reduce:^(NSURL *directoryURL, SQRLCodeSignature *codeSignature) {
+ NSURL *targetBundleURL = request.targetBundleURL;
+ NSURL *newBundleURL = [directoryURL URLByAppendingPathComponent:targetBundleURL.lastPathComponent];
++ [NSFileManager.defaultManager createDirectoryAtURL:newBundleURL withIntermediateDirectories:FALSE attributes:nil error:nil];
+
+ return [[SQRLInstallerOwnedBundle alloc] initWithOriginalURL:request.targetBundleURL temporaryURL:newBundleURL codeSignature:codeSignature];
+ }]
+@@ -285,6 +313,19 @@ NSString * const SQRLInstallerOwnedBundl
+ return [[[[self
+ renameIfNeeded:request updateBundleURL:updateBundleURL]
+ flattenMap:^(SQRLShipItRequest *request) {
++ // Final validation that the application is not running again;
++ NSArray *apps = [[NSRunningApplication runningApplicationsWithBundleIdentifier:request.bundleIdentifier] filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(NSRunningApplication *app, NSDictionary *bindings) {
++ return [[[app bundleURL] URLByStandardizingPath] isEqual:request.targetBundleURL];
++ }]];
++ if ([apps count] != 0) {
++ NSLog(@"Aborting update attempt because there are %lu running instances of the target app", [apps count]);
++ NSDictionary *errorInfo = @{
++ NSLocalizedDescriptionKey: NSLocalizedString(@"App Still Running Error", nil),
++ NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"All instances of the target application should be quit during the update process", nil),
++ };
++ return [RACSignal error:[NSError errorWithDomain:SQRLInstallerErrorDomain code:SQRLInstallerErrorAppStillRunning userInfo:errorInfo]];
++ }
++
+ return [[self acquireTargetBundleURLForRequest:request] concat:[RACSignal return:request]];
+ }]
+ flattenMap:^(SQRLShipItRequest *request) {
+@@ -481,10 +522,50 @@ NSString * const SQRLInstallerOwnedBundl
+ NSParameterAssert(targetURL != nil);
+ NSParameterAssert(sourceURL != nil);
+
++ NSLog(@"Moving bundle from %@ to %@", sourceURL, targetURL);
++
++ // If both the sourceURL and the targetURL exist we can try to skip a permissions check
++ // by moving Thing.app/Contents directly. This allows us to update applications without
++ // permission to write files into the parent directory of Thing.app
++ //
++ // There is no known case where these directories don't exist but in order to handle
++ // edge cases / race conditions we'll handle it anyway.
++ //
++ // This exists check is non-atomic with the rename call below but that's OK
++ BOOL canRenameContentsDirectly = FALSE;
++ // For now while this is tested at scale this new option is behind a user default, this
++ // can be set by applications wishing to test this feature at runtime. If it causes issues
++ // it can be opted out by individual users by setting this key to false explicitly.
++ // Once this has bene tested at scale it will become the default for all Squirrel.Mac
++ // users.
++ NSUserDefaults *defaults = [[NSUserDefaults alloc] init];
++ [defaults addSuiteNamed:_applicationIdentifier];
++ // In cases where this code is being executed under the ShipIt executable it's running
++ // under an application identifier equal to {parent_identifier}.ShipIt
++ // In this case we need to use the true parent identifier too as that is 99% of the time
++ // where the key will be set.
++ if ([_applicationIdentifier hasSuffix:@".ShipIt"]) {
++ [defaults addSuiteNamed:[_applicationIdentifier substringToIndex:[_applicationIdentifier length] - 7]];
++ }
++
++ if ([defaults boolForKey:@"SquirrelMacEnableDirectContentsWrite"]) {
++ canRenameContentsDirectly = [NSFileManager.defaultManager fileExistsAtPath:targetURL.path] && [NSFileManager.defaultManager fileExistsAtPath:sourceURL.path];
++
++ if (canRenameContentsDirectly) {
++ NSLog(@"Moving bundles via 'Contents' folder rename");
++ } else {
++ NSLog(@"Moving bundles directly as one of source / target does not exist. This is unexpected.");
++ }
++ } else {
++ NSLog(@"Moving bundles directly as SquirrelMacEnableDirectContentsWrite is disabled for app: %@", _applicationIdentifier);
++ }
++ NSURL *targetContentsURL = canRenameContentsDirectly ? [targetURL URLByAppendingPathComponent:@"Contents"] : targetURL;
++ NSURL *sourceContentsURL = canRenameContentsDirectly ? [sourceURL URLByAppendingPathComponent:@"Contents"] : sourceURL;
++
+ return [[[[RACSignal
+ defer:^{
+ // rename() is atomic, NSFileManager sucks.
+- if (rename(sourceURL.path.fileSystemRepresentation, targetURL.path.fileSystemRepresentation) == 0) {
++ if (rename(sourceContentsURL.path.fileSystemRepresentation, targetContentsURL.path.fileSystemRepresentation) == 0) {
+ return [RACSignal empty];
+ } else {
+ int code = errno;
+@@ -497,24 +578,24 @@ NSString * const SQRLInstallerOwnedBundl
+ }
+ }]
+ doCompleted:^{
+- NSLog(@"Moved bundle from %@ to %@", sourceURL, targetURL);
++ NSLog(@"Moved bundle contents from %@ to %@", sourceContentsURL, targetContentsURL);
+ }]
+ catch:^(NSError *error) {
+ if (![error.domain isEqual:NSPOSIXErrorDomain] || error.code != EXDEV) return [RACSignal error:error];
+
+ // If the locations lie on two different volumes, remove the
+ // destination by hand, then perform a move.
+- [NSFileManager.defaultManager removeItemAtURL:targetURL error:NULL];
++ [NSFileManager.defaultManager removeItemAtURL:targetContentsURL error:NULL];
+
+- if ([NSFileManager.defaultManager moveItemAtURL:sourceURL toURL:targetURL error:&error]) {
+- NSLog(@"Moved bundle across volumes from %@ to %@", sourceURL, targetURL);
++ if ([NSFileManager.defaultManager moveItemAtURL:sourceContentsURL toURL:targetContentsURL error:&error]) {
++ NSLog(@"Moved bundle contents across volumes from %@ to %@", sourceContentsURL, targetContentsURL);
+ return [RACSignal empty];
+ } else {
+- NSString *description = [NSString stringWithFormat:NSLocalizedString(@"Couldn't move bundle %@ across volumes to %@", nil), sourceURL, targetURL];
++ NSString *description = [NSString stringWithFormat:NSLocalizedString(@"Couldn't move bundle contents %@ across volumes to %@", nil), sourceContentsURL, targetContentsURL];
+ return [RACSignal error:[self errorByAddingDescription:description code:SQRLInstallerErrorMovingAcrossVolumes toError:error]];
+ }
+ }]
+- setNameWithFormat:@"%@ -installItemAtURL: %@ fromURL: %@", self, targetURL, sourceURL];
++ setNameWithFormat:@"%@ -installItemAtURL: %@ fromURL: %@", self, targetContentsURL, sourceContentsURL];
+ }
+
+ #pragma mark Quarantine Bit Removal
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m
new file mode 100644
index 0000000000..a2db3f57c4
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLShipItLauncher.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLShipItLauncher.m
+@@ -7,9 +7,9 @@
+ //
+
+ #import "SQRLShipItLauncher.h"
+-#import "EXTScope.h"
++#import <ReactiveObjC/EXTScope.h>
+ #import "SQRLDirectoryManager.h"
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+ #import <Security/Security.h>
+ #import <ServiceManagement/ServiceManagement.h>
+ #import <launch.h>
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m
new file mode 100644
index 0000000000..fcc1c139b5
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLShipItRequest.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLShipItRequest.m
+@@ -9,7 +9,7 @@
+ #import "SQRLShipItRequest.h"
+
+ #import "EXTKeyPathCoding.h"
+-#import <ReactiveCocoa/RACSignal+Operations.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
+
+ NSString * const SQRLShipItRequestErrorDomain = @"SQRLShipItRequestErrorDomain";
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m
new file mode 100644
index 0000000000..2fc2bb6e5f
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLTerminationListener.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLTerminationListener.m
+@@ -9,12 +9,12 @@
+ #import "SQRLTerminationListener.h"
+
+ #import "EXTKeyPathCoding.h"
+-#import <ReactiveCocoa/NSArray+RACSequenceAdditions.h>
+-#import <ReactiveCocoa/RACDisposable.h>
+-#import <ReactiveCocoa/RACScheduler.h>
+-#import <ReactiveCocoa/RACSequence.h>
+-#import <ReactiveCocoa/RACSignal+Operations.h>
+-#import <ReactiveCocoa/RACSubscriber.h>
++#import <ReactiveObjC/NSArray+RACSequenceAdditions.h>
++#import <ReactiveObjC/RACDisposable.h>
++#import <ReactiveObjC/RACScheduler.h>
++#import <ReactiveObjC/RACSequence.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
++#import <ReactiveObjC/RACSubscriber.h>
+
+ @interface SQRLTerminationListener ()
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m
new file mode 100644
index 0000000000..3756a9bf6e
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLUpdate.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLUpdate.m
+@@ -7,7 +7,7 @@
+ //
+
+ #import "SQRLUpdate.h"
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+
+ NSString * const SQRLUpdateJSONURLKey = @"url";
+ NSString * const SQRLUpdateJSONReleaseNotesKey = @"notes";
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h
new file mode 100644
index 0000000000..705a93625f
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLUpdater.h.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLUpdater.h
+@@ -7,7 +7,7 @@
+ //
+
+ #import <Foundation/Foundation.h>
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+
+ // Represents the current state of the updater.
+ //
+@@ -117,6 +117,10 @@ typedef enum {
+ // documentation for more information.
+ @property (atomic, strong) Class updateClass;
+
++// Publicly exposed for testing purposes, compares two version strings to see if it's
++// allowed. This assumes that the ElectronSquirrelPreventDowngrades flag is enabled.
+++ (bool) isVersionAllowedForUpdate:(NSString*)targetVersion from:(NSString*)currentVersion;
++
+ // Initializes an updater that will send the given request to check for updates.
+ //
+ // This is the designated initializer for this class.
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m
new file mode 100644
index 0000000000..5d1ae7a05e
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m
@@ -0,0 +1,123 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLUpdater.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLUpdater.m
+@@ -18,8 +18,8 @@
+ #import "SQRLUpdate.h"
+ #import "SQRLZipArchiver.h"
+ #import "SQRLShipItRequest.h"
+-#import <ReactiveCocoa/EXTScope.h>
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/EXTScope.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+ #import <sys/mount.h>
+
+ NSString * const SQRLUpdaterErrorDomain = @"SQRLUpdaterErrorDomain";
+@@ -42,6 +42,18 @@ const NSTimeInterval SQURLUpdaterZipDown
+ // followed by a random string of characters.
+ static NSString * const SQRLUpdaterUniqueTemporaryDirectoryPrefix = @"update.";
+
++BOOL isVersionStandard(NSString* version) {
++ NSCharacterSet *alphaNums = [NSCharacterSet decimalDigitCharacterSet];
++
++ NSArray* versionParts = [version componentsSeparatedByString:@"."];
++ BOOL versionBad = [versionParts count] != 3;
++ for (NSString* part in versionParts) {
++ versionBad = versionBad || [alphaNums isSupersetOfSet:[NSCharacterSet characterSetWithCharactersInString:part]];
++ }
++
++ return !versionBad;
++}
++
+ @interface SQRLUpdater ()
+
+ @property (atomic, readwrite) SQRLUpdaterState state;
+@@ -59,6 +71,8 @@ static NSString * const SQRLUpdaterUniqu
+ // Sends completed or error.
+ @property (nonatomic, strong, readonly) RACSignal *shipItLauncher;
+
+++ (bool) isVersionAllowedForUpdate:(NSString*)targetVersion from:(NSString*)currentVersion;
++
+ // Parses an update model from downloaded data.
+ //
+ // data - JSON data representing an update manifest. This must not be nil.
+@@ -329,7 +343,12 @@ static NSString * const SQRLUpdaterUniqu
+
+ BOOL targetWritable = [self canWriteToURL:targetURL];
+ BOOL parentWritable = [self canWriteToURL:targetURL.URLByDeletingLastPathComponent];
+- return [SQRLShipItLauncher launchPrivileged:!targetWritable || !parentWritable];
++ BOOL launchPrivileged = !targetWritable || !parentWritable;
++ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"SquirrelMacEnableDirectContentsWrite"]) {
++ // If SquirrelMacEnableDirectContentsWrite is enabled we don't care if the parent directory is writeable or not
++ BOOL launchPrivileged = !targetWritable;
++ }
++ return [SQRLShipItLauncher launchPrivileged:launchPrivileged];
+ }]
+ replayLazily]
+ setNameWithFormat:@"shipItLauncher"];
+@@ -367,6 +386,10 @@ static NSString * const SQRLUpdaterUniqu
+ connect];
+ }
+
+++ (bool) isVersionAllowedForUpdate:(NSString*)targetVersion from:(NSString*)currentVersion {
++ return [currentVersion compare:targetVersion options:NSNumericSearch] != NSOrderedDescending;
++}
++
+ - (RACSignal *)updateFromJSONData:(NSData *)data {
+ NSParameterAssert(data != nil);
+
+@@ -706,6 +729,50 @@ static NSString * const SQRLUpdaterUniqu
+ return [[[[self.signature
+ verifyBundleAtURL:updateBundle.bundleURL]
+ then:^{
++ NSRunningApplication *currentApplication = NSRunningApplication.currentApplication;
++ NSBundle *appBundle = [NSBundle bundleWithURL:currentApplication.bundleURL];
++ BOOL preventDowngrades = [[appBundle objectForInfoDictionaryKey:@"ElectronSquirrelPreventDowngrades"] boolValue];
++
++ if (preventDowngrades == YES) {
++ NSString* currentVersion = [appBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
++ NSString* updateVersion = [updateBundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
++ if (!currentVersion || !updateVersion) {
++ NSDictionary *errorInfo = @{
++ NSLocalizedDescriptionKey: NSLocalizedString(@"Cannot update to a bundle with a lower version number", nil),
++ NSLocalizedRecoverySuggestionErrorKey: NSLocalizedString(@"The application has ElectronSquirrelPreventDowngrades enabled and is missing a valid version string in either the current bundle or the target bundle", nil),
++ };
++ NSError *error = [NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:errorInfo];
++ return [RACSignal error:error];
++ }
++
++ if (!isVersionStandard(currentVersion)) {
++ NSDictionary *errorInfo = @{
++ NSLocalizedDescriptionKey: NSLocalizedString(@"Cannot update to a bundle with a lower version number", nil),
++ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:NSLocalizedString(@"The application has ElectronSquirrelPreventDowngrades enabled and is trying to update from '%@' which is not a valid version string", nil), currentVersion],
++ };
++ NSError *error = [NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:errorInfo];
++ return [RACSignal error:error];
++ }
++
++ if (!isVersionStandard(updateVersion)) {
++ NSDictionary *errorInfo = @{
++ NSLocalizedDescriptionKey: NSLocalizedString(@"Cannot update to a bundle with a lower version number", nil),
++ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:NSLocalizedString(@"The application has ElectronSquirrelPreventDowngrades enabled and is trying to update to '%@' which is not a valid version string", nil), updateVersion],
++ };
++ NSError *error = [NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:errorInfo];
++ return [RACSignal error:error];
++ }
++
++ if (![SQRLUpdater isVersionAllowedForUpdate:updateVersion from:currentVersion]) {
++ NSDictionary *errorInfo = @{
++ NSLocalizedDescriptionKey: NSLocalizedString(@"Cannot update to a bundle with a lower version number", nil),
++ NSLocalizedRecoverySuggestionErrorKey: [NSString stringWithFormat:NSLocalizedString(@"The application has ElectronSquirrelPreventDowngrades enabled and is trying to update from '%@' to '%@' which appears to be a downgrade", nil), currentVersion, updateVersion],
++ };
++ NSError *error = [NSError errorWithDomain:SQRLUpdaterErrorDomain code:SQRLUpdaterErrorMissingUpdateBundle userInfo:errorInfo];
++ return [RACSignal error:error];
++ }
++ }
++
+ SQRLDownloadedUpdate *downloadedUpdate = [[SQRLDownloadedUpdate alloc] initWithUpdate:update bundle:updateBundle];
+ return [RACSignal return:downloadedUpdate];
+ }]
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m
new file mode 100644
index 0000000000..80bb64141c
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/SQRLZipArchiver.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/SQRLZipArchiver.m
+@@ -7,8 +7,8 @@
+ //
+
+ #import "SQRLZipArchiver.h"
+-#import <ReactiveCocoa/EXTScope.h>
+-#import <ReactiveCocoa/ReactiveCocoa.h>
++#import <ReactiveObjC/EXTScope.h>
++#import <ReactiveObjC/ReactiveObjC.h>
+
+ NSString * const SQRLZipArchiverErrorDomain = @"SQRLZipArchiverErrorDomain";
+ NSString * const SQRLZipArchiverExitCodeErrorKey = @"SQRLZipArchiverExitCodeErrorKey";
+@@ -135,7 +135,7 @@ const NSInteger SQRLZipArchiverShellTask
+ return [RACSignal
+ zip:@[ self.taskTerminated, self.standardErrorData ]
+ reduce:^(NSNumber *exitStatus, NSData *errorData) {
+- if (exitStatus.intValue == 0) return [RACSignal empty];
++ if (exitStatus.intValue == 0) return [RACSignal return:self];
+
+ NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
+ userInfo[SQRLZipArchiverExitCodeErrorKey] = exitStatus;
diff --git a/electron34/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
new file mode 100644
index 0000000000..0e32d89374
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
@@ -0,0 +1,149 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/Squirrel/ShipIt-main.m.orig 2021-06-18 22:08:36.000000000 +0000
++++ third_party/squirrel.mac/Squirrel/ShipIt-main.m
+@@ -8,10 +8,13 @@
+
+ #import <Foundation/Foundation.h>
+
+-#import "EXTScope.h"
+-#import <ReactiveCocoa/RACCommand.h>
+-#import <ReactiveCocoa/RACSignal+Operations.h>
+-#import <ReactiveCocoa/RACScheduler.h>
++#import <ReactiveObjC/EXTScope.h>
++#import <ReactiveObjC/RACCommand.h>
++#import <ReactiveObjC/RACSignal+Operations.h>
++#import <ReactiveObjC/RACScheduler.h>
++
++#include <spawn.h>
++#include <sys/wait.h>
+
+ #import "NSError+SQRLVerbosityExtensions.h"
+ #import "RACSignal+SQRLTransactionExtensions.h"
+@@ -20,6 +23,20 @@
+ #import "SQRLTerminationListener.h"
+ #import "SQRLShipItRequest.h"
+
++extern char **environ;
++
++int responsibility_spawnattrs_setdisclaim(posix_spawnattr_t attrs, int disclaim)
++__attribute__((availability(macos,introduced=10.14),weak_import));
++
++#define CHECK_ERR(expr) \
++ { \
++ int err = (expr); \
++ if (err) { \
++ fprintf(stderr, "%s: %s", #expr, strerror(err)); \
++ exit(err); \
++ } \
++ }
++
+ // The maximum number of times ShipIt should run the same installation state, in
+ // an attempt to update.
+ //
+@@ -136,19 +153,47 @@ static void installRequest(RACSignal *re
+ NSString *exe = NSProcessInfo.processInfo.arguments[0];
+ NSLog(@"Launching new ShipIt at %@ with instructions to launch %@", exe, bundleURL);
+
+- NSTask *task = [[NSTask alloc] init];
+- [task setLaunchPath: exe];
+- [task setArguments: @[launchSignal, bundleURL.path]];
+- [task launch];
+- [task waitUntilExit];
++ posix_spawnattr_t attr;
++ CHECK_ERR(posix_spawnattr_init(&attr));
++
++ // Disclaim TCC responsibilities
++ if (responsibility_spawnattrs_setdisclaim)
++ CHECK_ERR(responsibility_spawnattrs_setdisclaim(&attr, 1));
++
++ pid_t pid = 0;
++
++ const char* launchPath = [exe fileSystemRepresentation];
++ const char* signal = [launchSignal fileSystemRepresentation];
++ const char* path = [bundleURL.path fileSystemRepresentation];
++ const char* args[] = { launchPath, signal, path, 0 };
++ int status = posix_spawn(&pid, [exe UTF8String], NULL, &attr, (char *const*)args, environ);
++ if (status == 0) {
++ NSLog(@"New ShipIt pid: %i", pid);
++ do {
++ if (waitpid(pid, &status, 0) != -1) {
++ NSLog(@"ShipIt status %d", WEXITSTATUS(status));
++ } else {
++ perror("waitpid");
++ exit(1);
++ }
++ } while (!WIFEXITED(status) && !WIFSIGNALED(status));
++ } else {
++ NSLog(@"posix_spawn: %s", strerror(status));
++ }
++
++ posix_spawnattr_destroy(&attr);
+
+ NSLog(@"New ShipIt exited");
+ } else {
+ NSLog(@"Attempting to launch app on lower than 11.0");
++// TODO: https://github.com/electron/electron/issues/43168
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ if (![NSWorkspace.sharedWorkspace launchApplicationAtURL:bundleURL options:NSWorkspaceLaunchDefault configuration:@{} error:&error]) {
+ NSLog(@"Could not launch application at %@: %@", bundleURL, error);
+ return;
+ }
++#pragma clang diagnostic pop
+
+ NSLog(@"Application launched at %@", bundleURL);
+ }
+@@ -158,8 +203,14 @@ static void installRequest(RACSignal *re
+ return action;
+ }]
+ subscribeError:^(NSError *error) {
+- NSLog(@"Installation error: %@", error);
+- exit(EXIT_FAILURE);
++ if ([[error domain] isEqual:SQRLInstallerErrorDomain] && [error code] == SQRLInstallerErrorAppStillRunning) {
++ NSLog(@"Installation cancelled: %@", error);
++ clearInstallationAttempts(applicationIdentifier);
++ exit(EXIT_SUCCESS);
++ } else {
++ NSLog(@"Installation error: %@", error);
++ exit(EXIT_FAILURE);
++ }
+ } completed:^{
+ exit(EXIT_SUCCESS);
+ }];
+@@ -172,7 +223,13 @@ int main(int argc, const char * argv[])
+ });
+
+ if (argc < 3) {
+- NSLog(@"Missing launchd job label or state path for ShipIt");
++ NSLog(@"Missing launchd job label or state path for ShipIt (%d)", argc);
++ if (argc >= 1) {
++ NSLog(@"Arg 1: {%s}", argv[0]);
++ }
++ if (argc >= 2) {
++ NSLog(@"Arg 2: {%s}", argv[1]);
++ }
+ return EXIT_FAILURE;
+ }
+
+@@ -182,12 +239,16 @@ int main(int argc, const char * argv[])
+
+ if (strcmp(jobLabel, [launchSignal UTF8String]) == 0) {
+ NSLog(@"Detected this as a launch request");
++// TODO: https://github.com/electron/electron/issues/43168
++#pragma clang diagnostic push
++#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ NSError *error;
+ if (![NSWorkspace.sharedWorkspace launchApplicationAtURL:shipItStateURL options:NSWorkspaceLaunchDefault configuration:@{} error:&error]) {
+ NSLog(@"Could not launch application at %@: %@", shipItStateURL, error);
+ } else {
+ NSLog(@"Successfully launched application at %@", shipItStateURL);
+ }
++#pragma clang diagnostic pop
+ exit(EXIT_SUCCESS);
+ } else {
+ NSLog(@"Detected this as an install request");
diff --git a/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.gni b/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.gni
new file mode 100644
index 0000000000..4f393f84af
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.gni
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/build/xcrun.gni.orig 2025-05-24 17:57:53.696499071 +0000
++++ third_party/squirrel.mac/build/xcrun.gni
+@@ -0,0 +1,18 @@
++template("xcrun_action") {
++ assert(defined(invoker.cmd), "Need cmd name to run")
++ assert(defined(invoker.args), "Need cmd argumets")
++ assert(defined(invoker.inputs), "Need inputs")
++ assert(defined(invoker.outputs), "Need outputs")
++
++ action(target_name) {
++ forward_variables_from(invoker,
++ [
++ "deps",
++ "public_deps",
++ "inputs",
++ "outputs",
++ ])
++ script = "//third_party/squirrel.mac/build/xcrun.py"
++ args = [ invoker.cmd ] + invoker.args
++ }
++}
diff --git a/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.py b/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.py
new file mode 100644
index 0000000000..3845e58d94
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_build_xcrun.py
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/build/xcrun.py.orig 2025-05-24 17:57:53.696634161 +0000
++++ third_party/squirrel.mac/build/xcrun.py
+@@ -0,0 +1,14 @@
++#!@PYTHONBIN@
++from __future__ import print_function
++import os
++import subprocess
++import sys
++
++SOURCE_ROOT = os.path.dirname(os.path.dirname(__file__))
++cmd = "xcrun"
++args = [cmd] + sys.argv[1:]
++try:
++ subprocess.check_output(args, stderr=subprocess.STDOUT)
++except subprocess.CalledProcessError as e:
++ print("xcrun script '" + ' '.join(sys.argv[1:]) + "' failed with code '" + str(e.returncode) + "':\n" + e.output)
++ sys.exit(e.returncode)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_filenames.gni b/electron34/patches/patch-third__party_squirrel.mac_filenames.gni
new file mode 100644
index 0000000000..9deb2dd436
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_filenames.gni
@@ -0,0 +1,252 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/filenames.gni.orig 2025-05-24 17:57:53.696767077 +0000
++++ third_party/squirrel.mac/filenames.gni
+@@ -0,0 +1,243 @@
++squirrel_filenames = {
++ headers = [
++ "Squirrel/NSBundle+SQRLVersionExtensions.h",
++ "Squirrel/NSError+SQRLVerbosityExtensions.h",
++ "Squirrel/NSProcessInfo+SQRLVersionExtensions.h",
++ "Squirrel/RACSignal+SQRLTransactionExtensions.h",
++ "Squirrel/SQRLAuthorization.h",
++ "Squirrel/SQRLCodeSignature.h",
++ "Squirrel/SQRLDirectoryManager.h",
++ "Squirrel/SQRLDownloadedUpdate.h",
++ "Squirrel/SQRLShipItLauncher.h",
++ "Squirrel/SQRLShipItRequest.h",
++ "Squirrel/SQRLUpdate.h",
++ "Squirrel/SQRLUpdater.h",
++ "Squirrel/SQRLZipArchiver.h",
++ "Squirrel/Squirrel.h",
++ ]
++
++ sources = [
++ "Squirrel/NSBundle+SQRLVersionExtensions.m",
++ "Squirrel/NSError+SQRLVerbosityExtensions.m",
++ "Squirrel/NSProcessInfo+SQRLVersionExtensions.m",
++ "Squirrel/RACSignal+SQRLTransactionExtensions.m",
++ "Squirrel/SQRLAuthorization.m",
++ "Squirrel/SQRLCodeSignature.m",
++ "Squirrel/SQRLDirectoryManager.m",
++ "Squirrel/SQRLDownloadedUpdate.h",
++ "Squirrel/SQRLDownloadedUpdate.m",
++ "Squirrel/SQRLShipItLauncher.h",
++ "Squirrel/SQRLShipItLauncher.m",
++ "Squirrel/SQRLShipItRequest.h",
++ "Squirrel/SQRLShipItRequest.m",
++ "Squirrel/SQRLUpdate.h",
++ "Squirrel/SQRLUpdate.m",
++ "Squirrel/SQRLUpdater.h",
++ "Squirrel/SQRLUpdater.m",
++ "Squirrel/SQRLZipArchiver.h",
++ "Squirrel/SQRLZipArchiver.m",
++ "Squirrel/Squirrel.h",
++ ]
++}
++
++mantle_filenames = {
++ headers = [
++ "vendor/Mantle/Mantle/MTLJSONAdapter.h",
++ "vendor/Mantle/Mantle/MTLModel+NSCoding.h",
++ "vendor/Mantle/Mantle/MTLModel.h",
++ "vendor/Mantle/Mantle/MTLReflection.h",
++ "vendor/Mantle/Mantle/MTLValueTransformer.h",
++ "vendor/Mantle/Mantle/Mantle.h",
++ "vendor/Mantle/Mantle/NSArray+MTLManipulationAdditions.h",
++ "vendor/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.h",
++ "vendor/Mantle/Mantle/NSError+MTLModelException.h",
++ "vendor/Mantle/Mantle/NSObject+MTLComparisonAdditions.h",
++ "vendor/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.h",
++ "vendor/Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.h",
++ "vendor/Mantle/Mantle/extobjc/MTLEXTKeyPathCoding.h",
++ "vendor/Mantle/Mantle/extobjc/MTLEXTRuntimeExtensions.h",
++ "vendor/Mantle/Mantle/extobjc/MTLEXTScope.h",
++ "vendor/Mantle/Mantle/extobjc/metamacros.h",
++ ]
++
++ sources = [
++ "vendor/Mantle/Mantle/MTLJSONAdapter.m",
++ "vendor/Mantle/Mantle/MTLModel+NSCoding.m",
++ "vendor/Mantle/Mantle/MTLModel.m",
++ "vendor/Mantle/Mantle/MTLReflection.m",
++ "vendor/Mantle/Mantle/MTLValueTransformer.m",
++ "vendor/Mantle/Mantle/NSArray+MTLManipulationAdditions.m",
++ "vendor/Mantle/Mantle/NSDictionary+MTLManipulationAdditions.m",
++ "vendor/Mantle/Mantle/NSError+MTLModelException.m",
++ "vendor/Mantle/Mantle/NSObject+MTLComparisonAdditions.m",
++ "vendor/Mantle/Mantle/NSValueTransformer+MTLInversionAdditions.m",
++ "vendor/Mantle/Mantle/NSValueTransformer+MTLPredefinedTransformerAdditions.m",
++ "vendor/Mantle/Mantle/extobjc/MTLEXTRuntimeExtensions.m",
++ "vendor/Mantle/Mantle/extobjc/MTLEXTScope.m",
++ ]
++}
++
++reactiveobjc_filenames = {
++ public_headers = [
++ "vendor/ReactiveObjC/ReactiveObjC/NSArray+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSControl+RACCommandSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSControl+RACTextSignalSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSData+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSDictionary+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSEnumerator+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSFileHandle+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSIndexSet+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSInvocation+RACTypeParsing.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSNotificationCenter+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACAppKitBindings.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACDeallocating.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACDescription.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACKVOWrapper.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACLifting.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACSelectorSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSOrderedSet+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSSet+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACKeyPathUtilities.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACSequenceAdditions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSText+RACSignalSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSURLConnection+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/NSUserDefaults+RACSupport.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACAnnotations.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACArraySequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACBehaviorSubject.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACBlockTrampoline.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACChannel.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACCommand.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACCompoundDisposable.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDelegateProxy.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDisposable.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDynamicSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDynamicSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEagerSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEmptySequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEmptySignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACErrorSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEvent.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACGroupedSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACImmediateScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACIndexSetSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOProxy.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOTrampoline.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACMulticastConnection+Private.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACMulticastConnection.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACPassthroughSubscriber.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler+Subclass.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACReplaySubject.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACReturnSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScheduler+Private.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScheduler+Subclass.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScopedDisposable.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSerialDisposable.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignal+Operations.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignal.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignalSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACStream+Private.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACStream.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACStringSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubject.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriber+Private.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriber.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriptingAssignmentTrampoline.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriptionScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTargetQueueScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTestScheduler.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTuple.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTupleSequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACUnarySequence.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACUnit.h",
++ "vendor/ReactiveObjC/ReactiveObjC/RACValueTransformer.h",
++ "vendor/ReactiveObjC/ReactiveObjC/ReactiveObjC.h",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc/EXTKeyPathCoding.h",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc/EXTRuntimeExtensions.h",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc/EXTScope.h",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc/metamacros.h",
++ ]
++
++ private_headers = []
++
++ sources = [
++ "vendor/ReactiveObjC/ReactiveObjC/NSArray+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSControl+RACCommandSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSControl+RACTextSignalSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSData+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSDictionary+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSEnumerator+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSFileHandle+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSIndexSet+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSInvocation+RACTypeParsing.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSNotificationCenter+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACAppKitBindings.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACDeallocating.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACDescription.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACKVOWrapper.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACLifting.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSObject+RACSelectorSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSOrderedSet+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSSet+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACKeyPathUtilities.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACSequenceAdditions.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSString+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSText+RACSignalSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSURLConnection+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/NSUserDefaults+RACSupport.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACArraySequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACBehaviorSubject.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACBlockTrampoline.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACChannel.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACCommand.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACCompoundDisposable.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDelegateProxy.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDisposable.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDynamicSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACDynamicSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEagerSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEmptySequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEmptySignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACErrorSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACEvent.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACGroupedSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACImmediateScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACIndexSetSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOProxy.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACKVOTrampoline.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACMulticastConnection.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACPassthroughSubscriber.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACReplaySubject.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACReturnSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACScopedDisposable.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSerialDisposable.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignal+Operations.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignal.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSignalSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACStream.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACStringSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubject.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriber.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriptingAssignmentTrampoline.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACSubscriptionScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTargetQueueScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTestScheduler.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTuple.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACTupleSequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACUnarySequence.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACUnit.m",
++ "vendor/ReactiveObjC/ReactiveObjC/RACValueTransformer.m",
++ "vendor/ReactiveObjC/ReactiveObjC/extobjc/EXTRuntimeExtensions.m",
++ ]
++}
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h b/electron34/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h
new file mode 100644
index 0000000000..3ff32fccc8
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/Mantle/Mantle/Mantle.h.orig 2016-02-15 11:44:36.000000000 +0000
++++ third_party/squirrel.mac/vendor/Mantle/Mantle/Mantle.h
+@@ -15,7 +15,6 @@ FOUNDATION_EXPORT double MantleVersionNu
+ FOUNDATION_EXPORT const unsigned char MantleVersionString[];
+
+ #import <Mantle/MTLJSONAdapter.h>
+-#import <Mantle/MTLManagedObjectAdapter.h>
+ #import <Mantle/MTLModel.h>
+ #import <Mantle/MTLModel+NSCoding.h>
+ #import <Mantle/MTLValueTransformer.h>
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m
new file mode 100644
index 0000000000..989c92100b
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSControl+RACTextSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSControl+RACTextSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSControl+RACTextSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDescription.h"
+ #import "RACDisposable.h"
+ #import "RACSignal.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m
new file mode 100644
index 0000000000..54017a5fbd
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSNotificationCenter+RACSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSNotificationCenter+RACSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSNotificationCenter+RACSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACSignal.h"
+ #import "RACSubscriber.h"
+ #import "RACDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m
new file mode 100644
index 0000000000..5466b87159
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACAppKitBindings.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACAppKitBindings.m
+@@ -7,8 +7,16 @@
+ //
+
+ #import "NSObject+RACAppKitBindings.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "RACChannel.h"
+ #import "RACCompoundDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m
new file mode 100644
index 0000000000..16995eff57
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACKVOWrapper.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACKVOWrapper.m
+@@ -7,8 +7,16 @@
+ //
+
+ #import "NSObject+RACKVOWrapper.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTRuntimeExtensions.h"
++#else
+ #import <ReactiveObjC/EXTRuntimeExtensions.h>
++#endif
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSString+RACKeyPathUtilities.h"
+ #import "RACCompoundDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m
new file mode 100644
index 0000000000..a41f7a42ac
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACLifting.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACLifting.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSObject+RACLifting.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSInvocation+RACTypeParsing.h"
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h
new file mode 100644
index 0000000000..53546df40d
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.h.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.h
+@@ -7,7 +7,11 @@
+ //
+
+ #import <Foundation/Foundation.h>
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "metamacros.h"
+
+ /// Creates a signal which observes `KEYPATH` on `TARGET` for changes.
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m
new file mode 100644
index 0000000000..28e97f936c
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACPropertySubscribing.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSObject+RACPropertySubscribing.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
+ #import "NSObject+RACKVOWrapper.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m
new file mode 100644
index 0000000000..2ce6afb905
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACSelectorSignal.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSObject+RACSelectorSignal.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSObject+RACSelectorSignal.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTRuntimeExtensions.h"
++#else
+ #import <ReactiveObjC/EXTRuntimeExtensions.h>
++#endif
+ #import "NSInvocation+RACTypeParsing.h"
+ #import "NSObject+RACDeallocating.h"
+ #import "RACCompoundDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m
new file mode 100644
index 0000000000..4b6e92e5e2
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSText+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSText+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSText+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDescription.h"
+ #import "RACDisposable.h"
+ #import "RACSignal.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m
new file mode 100644
index 0000000000..5a252c1f56
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSUserDefaults+RACSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/NSUserDefaults+RACSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "NSUserDefaults+RACSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSNotificationCenter+RACSupport.h"
+ #import "NSObject+RACDeallocating.h"
+ #import "RACChannel.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m
new file mode 100644
index 0000000000..0050b55501
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACCommand.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACCommand.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACCommand.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSArray+RACSequenceAdditions.h"
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m
new file mode 100644
index 0000000000..9f44b84add
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACDynamicSignal.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACDynamicSignal.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACDynamicSignal.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACCompoundDisposable.h"
+ #import "RACPassthroughSubscriber.h"
+ #import "RACScheduler+Private.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h
new file mode 100644
index 0000000000..5463d05b06
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.h.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.h
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACChannel.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "metamacros.h"
+
+ /// Creates a RACKVOChannel to the given key path. When the targeted object
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m
new file mode 100644
index 0000000000..b3541f491d
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACKVOChannel.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACKVOChannel.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACKVOWrapper.h"
+ #import "NSString+RACKeyPathUtilities.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m
new file mode 100644
index 0000000000..c8a381344d
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACQueueScheduler.m
+@@ -48,8 +48,8 @@
+ double frac = modf(date.timeIntervalSince1970, &seconds);
+
+ struct timespec walltime = {
+- .tv_sec = (time_t)fmin(fmax(seconds, LONG_MIN), LONG_MAX),
+- .tv_nsec = (long)fmin(fmax(frac * NSEC_PER_SEC, LONG_MIN), LONG_MAX)
++ .tv_sec = (time_t)fmin(fmax(seconds, LONG_MIN), (double)LONG_MAX),
++ .tv_nsec = (long)fmin(fmax(frac * NSEC_PER_SEC, LONG_MIN), (double)LONG_MAX)
+ };
+
+ return dispatch_walltime(&walltime, 0);
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m
new file mode 100644
index 0000000000..32d93cd056
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubject.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubject.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACSubject.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACCompoundDisposable.h"
+ #import "RACPassthroughSubscriber.h"
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m
new file mode 100644
index 0000000000..4ebb91be9b
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubscriber.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubscriber.m
+@@ -8,7 +8,11 @@
+
+ #import "RACSubscriber.h"
+ #import "RACSubscriber+Private.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACCompoundDisposable.h"
+
+ @interface RACSubscriber ()
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h
new file mode 100644
index 0000000000..2b7c18bc04
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubscriptingAssignmentTrampoline.h.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACSubscriptingAssignmentTrampoline.h
+@@ -7,7 +7,11 @@
+ //
+
+ #import <Foundation/Foundation.h>
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+
+ @class RACSignal<__covariant ValueType>;
+
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m
new file mode 100644
index 0000000000..455c0583c2
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACTestScheduler.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACTestScheduler.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACTestScheduler.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACCompoundDisposable.h"
+ #import "RACDisposable.h"
+ #import "RACScheduler+Private.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m
new file mode 100644
index 0000000000..20507599ba
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACTuple.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACTuple.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACTuple.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "RACTupleSequence.h"
+
+ @implementation RACTupleNil
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m
new file mode 100644
index 0000000000..80addd36f4
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACUnarySequence.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/RACUnarySequence.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "RACUnarySequence.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "NSObject+RACDescription.h"
+
+ @interface RACUnarySequence ()
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m
new file mode 100644
index 0000000000..a962ba4438
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIBarButtonItem+RACCommandSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIBarButtonItem+RACCommandSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIBarButtonItem+RACCommandSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "RACCommand.h"
+ #import "RACDisposable.h"
+ #import "RACSignal+Operations.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m
new file mode 100644
index 0000000000..f7b866c0da
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIButton+RACCommandSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIButton+RACCommandSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIButton+RACCommandSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "RACCommand.h"
+ #import "RACDisposable.h"
+ #import "RACSignal+Operations.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m
new file mode 100644
index 0000000000..8bd701b398
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIControl+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIControl+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIControl+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "RACCompoundDisposable.h"
+ #import "RACDisposable.h"
+ #import "RACSignal.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m
new file mode 100644
index 0000000000..266b9c76ed
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIDatePicker+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIDatePicker+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIDatePicker+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "UIControl+RACSignalSupportPrivate.h"
+
+ @implementation UIDatePicker (RACSignalSupport)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m
new file mode 100644
index 0000000000..a8f456d12b
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIGestureRecognizer+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIGestureRecognizer+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIGestureRecognizer+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
+ #import "RACCompoundDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m
new file mode 100644
index 0000000000..ab3d7891b3
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIRefreshControl+RACCommandSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIRefreshControl+RACCommandSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIRefreshControl+RACCommandSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "RACCommand.h"
+ #import "RACCompoundDisposable.h"
+ #import "RACDisposable.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m
new file mode 100644
index 0000000000..2d867bcc75
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISegmentedControl+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISegmentedControl+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UISegmentedControl+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "UIControl+RACSignalSupportPrivate.h"
+
+ @implementation UISegmentedControl (RACSignalSupport)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m
new file mode 100644
index 0000000000..1287cb3de9
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISlider+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISlider+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UISlider+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "UIControl+RACSignalSupportPrivate.h"
+
+ @implementation UISlider (RACSignalSupport)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m
new file mode 100644
index 0000000000..94418a04ab
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIStepper+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UIStepper+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UIStepper+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "UIControl+RACSignalSupportPrivate.h"
+
+ @implementation UIStepper (RACSignalSupport)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m
new file mode 100644
index 0000000000..4899260cf3
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISwitch+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UISwitch+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UISwitch+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
+ #import "UIControl+RACSignalSupportPrivate.h"
+
+ @implementation UISwitch (RACSignalSupport)
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m
new file mode 100644
index 0000000000..49b4c3594e
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UITextField+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UITextField+RACSignalSupport.m
+@@ -7,8 +7,16 @@
+ //
+
+ #import "UITextField+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTKeyPathCoding.h"
++#else
+ #import <ReactiveObjC/EXTKeyPathCoding.h>
++#endif
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
+ #import "RACSignal+Operations.h"
diff --git a/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m
new file mode 100644
index 0000000000..6d2cb14aa6
--- /dev/null
+++ b/electron34/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UITextView+RACSignalSupport.m.orig 2019-03-14 15:12:17.000000000 +0000
++++ third_party/squirrel.mac/vendor/ReactiveObjC/ReactiveObjC/UITextView+RACSignalSupport.m
+@@ -7,7 +7,11 @@
+ //
+
+ #import "UITextView+RACSignalSupport.h"
++#if defined(BUILDING_RAC_FRAMEWORK)
++#import "extobjc/EXTScope.h"
++#else
+ #import <ReactiveObjC/EXTScope.h>
++#endif
+ #import "NSObject+RACDeallocating.h"
+ #import "NSObject+RACDescription.h"
+ #import "RACDelegateProxy.h"
diff --git a/electron34/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp b/electron34/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp
new file mode 100644
index 0000000000..1851af7a37
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/src/Reactor/Debug.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/src/Reactor/Debug.cpp
+@@ -46,7 +46,8 @@ namespace {
+
+ bool IsUnderDebugger()
+ {
+-#if defined(PTRACE) && !defined(__APPLE__) && !defined(__MACH__)
++#if defined(PTRACE) && !defined(__APPLE__) && !defined(__MACH__) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
++ !defined(__NetBSD__)
+ static bool checked = false;
+ static bool res = false;
+
diff --git a/electron34/patches/patch-third__party_swiftshader_src_System_Configurator.cpp b/electron34/patches/patch-third__party_swiftshader_src_System_Configurator.cpp
new file mode 100644
index 0000000000..9e085e1417
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_src_System_Configurator.cpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/src/System/Configurator.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/src/System/Configurator.cpp
+@@ -38,6 +38,9 @@ namespace sw {
+
+ Configurator::Configurator(const std::string &filePath)
+ {
++#if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
++ return;
++#endif
+ std::fstream file(filePath, std::ios::in);
+ if(file.fail())
+ {
diff --git a/electron34/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp b/electron34/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp
new file mode 100644
index 0000000000..bb9694f830
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/src/System/Linux/MemFd.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/src/System/Linux/MemFd.cpp
+@@ -25,6 +25,7 @@
+ # define MFD_CLOEXEC 0x0001U
+ #endif
+
++#if !defined(__OpenBSD__) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+ #if __aarch64__
+ # define __NR_memfd_create 279
+ #elif __arm__
+@@ -36,6 +37,7 @@
+ #elif __x86_64__
+ # define __NR_memfd_create 319
+ #endif /* __NR_memfd_create__ */
++#endif
+
+ LinuxMemFd::~LinuxMemFd()
+ {
+@@ -63,13 +65,17 @@ bool LinuxMemFd::allocate(const char *na
+ {
+ close();
+
+-#ifndef __NR_memfd_create
++#if !defined(__NR_memfd_create) || defined(__OpenBSD__)
+ TRACE("memfd_create() not supported on this system!");
+ return false;
+ #else
+ // In the event of no system call this returns -1 with errno set
+ // as ENOSYS.
++#if defined(__FreeBSD__) || defined(__NetBSD__)
++ fd_ = memfd_create(name, MFD_CLOEXEC);
++#else
+ fd_ = syscall(__NR_memfd_create, name, MFD_CLOEXEC);
++#endif
+ if(fd_ < 0)
+ {
+ TRACE("memfd_create() returned %d: %s", errno, strerror(errno));
diff --git a/electron34/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp b/electron34/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp
new file mode 100644
index 0000000000..9827c265b3
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/src/Vulkan/VkSemaphoreExternalLinux.hpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/src/Vulkan/VkSemaphoreExternalLinux.hpp
+@@ -49,13 +49,17 @@ public:
+ {
+ pthread_mutexattr_t mattr;
+ pthread_mutexattr_init(&mattr);
++#if 0
+ pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
++#endif
+ pthread_mutex_init(&mutex, &mattr);
+ pthread_mutexattr_destroy(&mattr);
+
+ pthread_condattr_t cattr;
+ pthread_condattr_init(&cattr);
++#if 0
+ pthread_condattr_setpshared(&cattr, PTHREAD_PROCESS_SHARED);
++#endif
+ pthread_cond_init(&cond, &cattr);
+ pthread_condattr_destroy(&cattr);
+ }
diff --git a/electron34/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp b/electron34/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp
new file mode 100644
index 0000000000..2c6438f1e0
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/src/WSI/libXCB.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/src/WSI/libXCB.cpp
+@@ -57,7 +57,7 @@ LibXcbExports *LibXCB::loadExports()
+ }
+ else
+ {
+- libxcb = loadLibrary("libxcb.so.1");
++ libxcb = loadLibrary("libxcb.so");
+ }
+
+ if(getProcAddress(RTLD_DEFAULT, "xcb_shm_query_version")) // Search the global scope for pre-loaded XCB library.
+@@ -66,7 +66,7 @@ LibXcbExports *LibXCB::loadExports()
+ }
+ else
+ {
+- libshm = loadLibrary("libxcb-shm.so.0");
++ libshm = loadLibrary("libxcb-shm.so");
+ }
+
+ return LibXcbExports(libxcb, libshm);
diff --git a/electron34/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h b/electron34/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h
new file mode 100644
index 0000000000..7c40aa6ab6
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h
@@ -0,0 +1,180 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/third_party/llvm-10.0/configs/linux/include/llvm/Config/config.h
+@@ -29,7 +29,7 @@
+
+ /* Define to 1 if you have the declaration of `arc4random', and to 0 if you
+ don't. */
+-#define HAVE_DECL_ARC4RANDOM 0
++#define HAVE_DECL_ARC4RANDOM 1
+
+ /* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
+ don't. */
+@@ -53,7 +53,7 @@
+ #define HAVE_DLOPEN 1
+
+ /* Define if dladdr() is available on this platform. */
+-/* #undef HAVE_DLADDR */
++#define HAVE_DLADDR 1
+
+ /* Define to 1 if you have the <errno.h> header file. */
+ #define HAVE_ERRNO_H 1
+@@ -92,7 +92,7 @@
+ #define HAVE_ISATTY 1
+
+ /* Define to 1 if you have the `edit' library (-ledit). */
+-/* #undef HAVE_LIBEDIT */
++#define HAVE_LIBEDIT 1
+
+ /* Define to 1 if you have the `pfm' library (-lpfm). */
+ /* #undef HAVE_LIBPFM */
+@@ -110,13 +110,13 @@
+ /* #undef HAVE_PTHREAD_SETNAME_NP */
+
+ /* Define to 1 if you have the `z' library (-lz). */
+-/* #undef HAVE_LIBZ */
++#define HAVE_LIBZ 1
+
+ /* Define to 1 if you have the <link.h> header file. */
+-#define HAVE_LINK_H 1
++/* #undef HAVE_LINK_H */
+
+ /* Define to 1 if you have the `lseek64' function. */
+-#define HAVE_LSEEK64 1
++/* #undef HAVE_LSEEK64 */
+
+ /* Define to 1 if you have the <mach/mach.h> header file. */
+ /* #undef HAVE_MACH_MACH_H */
+@@ -125,7 +125,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+
+ /* Define to 1 if you have the <malloc/malloc.h> header file. */
+ /* #undef HAVE_MALLOC_MALLOC_H */
+@@ -134,10 +134,10 @@
+ /* #undef HAVE_MALLOC_ZONE_STATISTICS */
+
+ /* Define to 1 if you have the `posix_fallocate' function. */
+-#define HAVE_POSIX_FALLOCATE 1
++/* #undef HAVE_POSIX_FALLOCATE */
+
+ /* Define to 1 if you have the `posix_spawn' function. */
+-/* #undef HAVE_POSIX_SPAWN */
++#define HAVE_POSIX_SPAWN 1
+
+ /* Define to 1 if you have the `pread' function. */
+ #define HAVE_PREAD 1
+@@ -161,10 +161,10 @@
+ #define HAVE_SETENV 1
+
+ /* Define to 1 if you have the `sched_getaffinity' function. */
+-#define HAVE_SCHED_GETAFFINITY 1
++/* #undef HAVE_SCHED_GETAFFINITY */
+
+ /* Define to 1 if you have the `CPU_COUNT' macro. */
+-#define HAVE_CPU_COUNT 1
++/* #undef HAVE_CPU_COUNT */
+
+ /* Define to 1 if you have the `setrlimit' function. */
+ #define HAVE_SETRLIMIT 1
+@@ -182,7 +182,7 @@
+ #define HAVE_STRERROR_R 1
+
+ /* Define to 1 if you have the `sysconf' function. */
+-#define HAVE_SYSCONF 1
++/* #undef HAVE_SYSCONF */
+
+ /* Define to 1 if you have the <sys/ioctl.h> header file. */
+ #define HAVE_SYS_IOCTL_H 1
+@@ -209,7 +209,7 @@
+ #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+
+ /* Define to 1 if you have the <sys/types.h> header file. */
+-#define HAVE_SYS_TYPES_H 1
++/* #undef HAVE_SYS_TYPES_H */
+
+ /* Define if the setupterm() function is supported this platform. */
+ /* #undef HAVE_TERMINFO */
+@@ -218,16 +218,16 @@
+ /* #undef HAVE_LIBXAR */
+
+ /* Define to 1 if you have the <termios.h> header file. */
+-/* #undef HAVE_TERMIOS_H */
++#define HAVE_TERMIOS_H 1
+
+ /* Define to 1 if you have the <unistd.h> header file. */
+ #define HAVE_UNISTD_H 1
+
+ /* Define to 1 if you have the <valgrind/valgrind.h> header file. */
+-/* #undef HAVE_VALGRIND_VALGRIND_H */
++/* #define HAVE_VALGRIND_VALGRIND_H 1 */
+
+ /* Define to 1 if you have the <zlib.h> header file. */
+-/* #undef HAVE_ZLIB_H */
++#define HAVE_ZLIB_H 1
+
+ /* Have host's _alloca */
+ /* #undef HAVE__ALLOCA */
+@@ -292,30 +292,8 @@
+ /* Linker version detected at compile time. */
+ /* #undef HOST_LINK_VERSION */
+
+-/* Target triple LLVM will generate code for by default */
+-/* Doesn't use `cmakedefine` because it is allowed to be empty. */
+-#if defined(__x86_64__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "x86_64-unknown-linux-gnu"
+-#elif defined(__i386__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "i686-pc-linux-gnu"
+-#elif defined(__arm__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "armv7-linux-gnueabihf"
+-#elif defined(__aarch64__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "aarch64-linux-gnu"
+-#elif defined(__mips__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "mipsel-linux-gnu"
+-#elif defined(__mips64)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "mips64el-linux-gnuabi64"
+-#elif defined(__powerpc64__)
+-#define LLVM_DEFAULT_TARGET_TRIPLE "powerpc64le-unknown-linux-gnu"
+-#elif defined(__riscv) && __riscv_xlen == 64
+-#define LLVM_DEFAULT_TARGET_TRIPLE "riscv64-unknown-linux-gnu"
+-#else
+-#error "unknown architecture"
+-#endif
+-
+ /* Define if zlib compression is available */
+-#define LLVM_ENABLE_ZLIB 0
++/* #define LLVM_ENABLE_ZLIB 1 */
+
+ /* Define if overriding target triple is enabled */
+ /* #undef LLVM_TARGET_TRIPLE_ENV */
+@@ -339,10 +317,10 @@
+ #define PACKAGE_NAME "LLVM"
+
+ /* Define to the full name and version of this package. */
+-#define PACKAGE_STRING "LLVM 10.0.0"
++#define PACKAGE_STRING "LLVM 11.1.0"
+
+ /* Define to the version of this package. */
+-#define PACKAGE_VERSION "10.0.0"
++#define PACKAGE_VERSION "11.1.0"
+
+ /* Define to the vendor of this package. */
+ /* #undef PACKAGE_VENDOR */
+@@ -362,9 +340,6 @@
+ /* Whether GlobalISel rule coverage is being collected */
+ #define LLVM_GISEL_COV_ENABLED 0
+
+-/* Define if we have z3 and want to build it */
+-#define LLVM_WITH_Z3 1
+-
+ /* Define to the default GlobalISel coverage file prefix */
+ /* #undef LLVM_GISEL_COV_PREFIX */
+
diff --git a/electron34/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h b/electron34/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h
new file mode 100644
index 0000000000..55049259be
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/third_party/llvm-subzero/build/Linux/include/llvm/Config/config.h
+@@ -5,8 +5,6 @@
+ #include "llvm/Config/llvm-config.h"
+
+ /* For detecting __GLIBC__ usage */
+-#include <features.h>
+-
+ /* Bug report URL. */
+ #define BUG_REPORT_URL "http://llvm.org/bugs/"
+
+@@ -27,7 +25,7 @@
+
+ /* Define to 1 if you have the declaration of `arc4random', and to 0 if you
+ don't. */
+-#define HAVE_DECL_ARC4RANDOM 0
++#define HAVE_DECL_ARC4RANDOM 1
+
+ /* Define to 1 if you have the declaration of `FE_ALL_EXCEPT', and to 0 if you
+ don't. */
+@@ -124,7 +122,7 @@
+ #define HAVE_LINK_H 1
+
+ /* Define to 1 if you have the `lseek64' function. */
+-#define HAVE_LSEEK64 1
++/* #define HAVE_LSEEK64 */
+
+ /* Define to 1 if you have the <mach/mach.h> header file. */
+ /* #undef HAVE_MACH_MACH_H */
+@@ -133,7 +131,7 @@
+ /* #undef HAVE_MALLCTL */
+
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #define HAVE_MALLINFO */
+
+ /* Some projects using SwiftShader bypass cmake (eg Chromium via gn) */
+ /* so we need to check glibc version for the new API to be safe */
+@@ -163,7 +161,7 @@
+ /* #undef HAVE_NDIR_H */
+
+ /* Define to 1 if you have the `posix_fallocate' function. */
+-#define HAVE_POSIX_FALLOCATE 1
++/* #define HAVE_POSIX_FALLOCATE */
+
+ /* Define to 1 if you have the `posix_spawn' function. */
+ #define HAVE_POSIX_SPAWN 1
diff --git a/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp b/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp
new file mode 100644
index 0000000000..7a43a044a0
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/third_party/marl/src/memory.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/third_party/marl/src/memory.cpp
+@@ -19,7 +19,8 @@
+
+ #include <cstring>
+
+-#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__EMSCRIPTEN__)
++#if defined(__linux__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__EMSCRIPTEN__) || defined(__OpenBSD__) || \
++ defined(__NetBSD__)
+ #include <sys/mman.h>
+ #include <unistd.h>
+ namespace {
diff --git a/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp b/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp
new file mode 100644
index 0000000000..45d4b7c0eb
--- /dev/null
+++ b/electron34/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/swiftshader/third_party/marl/src/thread.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/swiftshader/third_party/marl/src/thread.cpp
+@@ -46,6 +46,9 @@
+ #include <unistd.h>
+ #include <thread>
+ #endif
++#if defined(__NetBSD__)
++#include <stdarg.h>
++#endif
+
+ namespace {
+
+@@ -444,7 +447,9 @@ void Thread::setName(const char* fmt, ..
+ pthread_setname_np(name);
+ #elif defined(__FreeBSD__)
+ pthread_set_name_np(pthread_self(), name);
+-#elif !defined(__Fuchsia__) && !defined(__EMSCRIPTEN__)
++#elif defined(__NetBSD__)
++ pthread_setname_np(pthread_self(), "%s", (void *)name);
++#elif !defined(__Fuchsia__) && !defined(__EMSCRIPTEN__) && !defined(__OpenBSD__) && !defined(__FreeBSD__)
+ pthread_setname_np(pthread_self(), name);
+ #endif
+
diff --git a/electron34/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn b/electron34/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn
new file mode 100644
index 0000000000..67a9e84d11
--- /dev/null
+++ b/electron34/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/test_fonts/fontconfig/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/test_fonts/fontconfig/BUILD.gn
+@@ -26,7 +26,11 @@ if (is_linux || is_chromeos) {
+
+ copy("fonts_conf") {
+ sources = [ "fonts.conf" ]
+- outputs = [ "$root_out_dir/etc/fonts/{{source_file_part}}" ]
++ if (is_freebsd) {
++ outputs = [ "$root_out_dir/usr/local/etc/fonts/{{source_file_part}}" ]
++ } else {
++ outputs = [ "$root_out_dir/etc/fonts/{{source_file_part}}" ]
++ }
+ }
+
+ if (current_toolchain == host_toolchain) {
+@@ -47,7 +51,11 @@ if (is_linux || is_chromeos) {
+ "//third_party/test_fonts",
+ ]
+ args = []
+- inputs = [ "$root_out_dir/etc/fonts/fonts.conf" ]
++ if (is_freebsd) {
++ inputs = [ "$root_out_dir/usr/local/etc/fonts/fonts.conf" ]
++ } else {
++ inputs = [ "$root_out_dir/etc/fonts/fonts.conf" ]
++ }
+ outputs = [
+ "$root_out_dir/fontconfig_caches/fb5c91b2895aa445d23aebf7f9e2189c-le64.cache-9",
+ "$root_out_dir/fontconfig_caches/CACHEDIR.TAG",
diff --git a/electron34/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc b/electron34/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc
new file mode 100644
index 0000000000..9cb834a1c5
--- /dev/null
+++ b/electron34/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/test_fonts/fontconfig/fontconfig_util_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/test_fonts/fontconfig/fontconfig_util_linux.cc
+@@ -2,6 +2,8 @@
+ // Use of this source code is governed by a BSD-style license that can be
+ // found in the LICENSE file.
+
++#include "build/build_config.h"
++
+ #include "third_party/test_fonts/fontconfig/fontconfig_util_linux.h"
+
+ #include <fontconfig/fontconfig.h>
+@@ -16,11 +18,15 @@
+ namespace test_fonts {
+
+ std::string GetSysrootDir() {
++#if BUILDFLAG(IS_BSD)
++ return std::string(".");
++#else
+ char buf[PATH_MAX + 1];
+ auto count = readlink("/proc/self/exe", buf, PATH_MAX);
+ assert(count > 0);
+ buf[count] = '\0';
+ return dirname(buf);
++#endif
+ }
+
+ void SetUpFontconfig() {
diff --git a/electron34/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc b/electron34/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc
new file mode 100644
index 0000000000..a918f9911c
--- /dev/null
+++ b/electron34/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/test_fonts/fontconfig/generate_fontconfig_caches.cc
+@@ -28,7 +28,7 @@ int main() {
+ // fontconfig cache.
+ // $ echo -n /test_fonts | md5sum
+ // fb5c91b2895aa445d23aebf7f9e2189c -
+- static const char kCacheKey[] = "fb5c91b2895aa445d23aebf7f9e2189c";
++ static const char kCacheKey[] = "cd4b5bc7-6cfc-41dc-8982-f2db624179ba";
+
+ // fontconfig writes the mtime of the test_fonts directory into the cache. It
+ // presumably checks this later to ensure that the cache is still up to date.
+@@ -56,7 +56,7 @@ int main() {
+ FcFini();
+
+ // Check existence of intended fontconfig cache file.
+- auto cache = fontconfig_caches + "/" + kCacheKey + "-le64.cache-9";
++ auto cache = fontconfig_caches + "/" + kCacheKey + "-x86_64.cache-" + FC_CACHE_VERSION;
+ bool cache_exists = access(cache.c_str(), F_OK) == 0;
+ return !cache_exists;
+ }
diff --git a/electron34/patches/patch-third__party_tflite_features.gni b/electron34/patches/patch-third__party_tflite_features.gni
new file mode 100644
index 0000000000..46fa5ab55c
--- /dev/null
+++ b/electron34/patches/patch-third__party_tflite_features.gni
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/tflite/features.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/tflite/features.gni
+@@ -9,8 +9,8 @@ declare_args() {
+ # This enables building TFLite with XNNPACK. Currently only available for
+ # Linux, macOS and Windows arm64/x64/x86 targets and ChromeOS non-ARM targets.
+ build_tflite_with_xnnpack =
+- (is_win || is_mac || is_linux || (is_chromeos && overlay_include_cbx)) &&
+- (current_cpu == "arm64" || current_cpu == "x64" || current_cpu == "x86")
++ ((is_win || is_mac || is_linux || (is_chromeos && overlay_include_cbx)) &&
++ (current_cpu == "arm64" || current_cpu == "x64" || current_cpu == "x86")) && !is_bsd
+
+ # Turns on TFLITE_WITH_RUY, using ruy as the gemm backend instead of gemmlowp.
+ build_tflite_with_ruy = true
diff --git a/electron34/patches/patch-third__party_unrar_src_crc.cpp b/electron34/patches/patch-third__party_unrar_src_crc.cpp
new file mode 100644
index 0000000000..7fad671ec9
--- /dev/null
+++ b/electron34/patches/patch-third__party_unrar_src_crc.cpp
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/unrar/src/crc.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/unrar/src/crc.cpp
+@@ -43,12 +43,18 @@ void InitCRC32(uint *CRCTab)
+ }
+
+ #ifdef USE_NEON_CRC32
+- #ifdef _APPLE
++ #if defined(_APPLE)
+ // getauxval isn't available in OS X
+ uint Value=0;
+ size_t Size=sizeof(Value);
+ int RetCode=sysctlbyname("hw.optional.armv8_crc32",&Value,&Size,NULL,0);
+ CRC_Neon=RetCode==0 && Value!=0;
++ #elif defined(__FreeBSD__)
++ // getauxval isn't available on FreeBSD
++ uint64 Reg=READ_SPECIALREG(id_aa64isar0_el1);
++ if (ID_AA64ISAR0_CRC32_VAL(Reg) == ID_AA64ISAR0_CRC32_BASE) {
++ CRC_Neon=true;
++ }
+ #else
+ CRC_Neon=(getauxval(AT_HWCAP) & HWCAP_CRC32)!=0;
+ #endif
diff --git a/electron34/patches/patch-third__party_unrar_src_crypt.cpp b/electron34/patches/patch-third__party_unrar_src_crypt.cpp
new file mode 100644
index 0000000000..46dc614b1b
--- /dev/null
+++ b/electron34/patches/patch-third__party_unrar_src_crypt.cpp
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/unrar/src/crypt.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/unrar/src/crypt.cpp
+@@ -116,6 +116,8 @@ void GetRnd(byte *RndBuf,size_t BufSize)
+ Success=CryptGenRandom(hProvider, (DWORD)BufSize, RndBuf) != FALSE;
+ CryptReleaseContext(hProvider, 0);
+ }
++#elif defined(__OpenBSD__)
++ arc4random_buf(RndBuf, BufSize);
+ #elif defined(_UNIX)
+ FILE *rndf = fopen("/dev/urandom", "r");
+ if (rndf!=NULL)
diff --git a/electron34/patches/patch-third__party_unrar_src_os.hpp b/electron34/patches/patch-third__party_unrar_src_os.hpp
new file mode 100644
index 0000000000..1860edb87e
--- /dev/null
+++ b/electron34/patches/patch-third__party_unrar_src_os.hpp
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/unrar/src/os.hpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/unrar/src/os.hpp
+@@ -162,10 +162,13 @@
+
+ #if defined(__aarch64__) && (defined(__ARM_FEATURE_CRYPTO) || defined(__ARM_FEATURE_CRC32))
+ #include <arm_neon.h>
+-#ifndef _APPLE
++#if !defined(_APPLE) && !defined(__FreeBSD__)
+ #include <sys/auxv.h>
+ #include <asm/hwcap.h>
+ #endif
++#ifdef __FreeBSD__
++#include <machine/armreg.h>
++#endif
+ #ifdef __ARM_FEATURE_CRYPTO
+ #define USE_NEON_AES
+ #endif
diff --git a/electron34/patches/patch-third__party_unrar_src_rijndael.cpp b/electron34/patches/patch-third__party_unrar_src_rijndael.cpp
new file mode 100644
index 0000000000..095b3dad92
--- /dev/null
+++ b/electron34/patches/patch-third__party_unrar_src_rijndael.cpp
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/unrar/src/rijndael.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/unrar/src/rijndael.cpp
+@@ -116,7 +116,7 @@ void Rijndael::Init(bool Encrypt,const b
+ #endif
+
+ #elif defined(USE_NEON_AES)
+- #ifdef _APPLE
++ #if defined(_APPLE)
+ // getauxval isn't available in OS X
+ uint Value=0;
+ size_t Size=sizeof(Value);
+@@ -126,6 +126,12 @@ void Rijndael::Init(bool Encrypt,const b
+ // because "hw.optional.arm.FEAT_AES" was missing in OS X 11, but AES
+ // still was supported by Neon.
+ AES_Neon=RetCode!=0 || Value!=0;
++ #elif defined(__FreeBSD__)
++ // getauxval isn't available on FreeBSD
++ uint64 Reg=READ_SPECIALREG(id_aa64isar0_el1);
++ if (ID_AA64ISAR0_AES_VAL(Reg) == ID_AA64ISAR0_AES_BASE) {
++ AES_Neon=true;
++ }
+ #else
+ AES_Neon=(getauxval(AT_HWCAP) & HWCAP_AES)!=0;
+ #endif
diff --git a/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h b/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h
new file mode 100644
index 0000000000..b29ddab240
--- /dev/null
+++ b/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
+@@ -2740,7 +2740,7 @@ static void* vma_aligned_alloc(size_t al
+
+ return memalign(alignment, size);
+ }
+-#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
++#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__)
+ #include <cstdlib>
+
+ #if defined(__APPLE__)
diff --git a/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp b/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp
new file mode 100644
index 0000000000..ad8a94836b
--- /dev/null
+++ b/electron34/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/vulkan-validation-layers/src/layers/vulkan/generated/vk_function_pointers.cpp.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/vulkan-validation-layers/src/layers/vulkan/generated/vk_function_pointers.cpp
+@@ -53,7 +53,8 @@ static void *get_proc_address(dl_handle
+ assert(name);
+ return (void *)GetProcAddress(library, name);
+ }
+-#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) || defined(__GNU__)
++#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__QNX__) || \
++ defined(__GNU__) || defined(__NetBSD__)
+
+ #include <dlfcn.h>
+
diff --git a/electron34/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h b/electron34/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h
new file mode 100644
index 0000000000..ff1db7907d
--- /dev/null
+++ b/electron34/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/vulkan_memory_allocator/include/vk_mem_alloc.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/vulkan_memory_allocator/include/vk_mem_alloc.h
+@@ -2760,7 +2760,7 @@ void* vma_aligned_alloc(size_t alignment
+
+ return memalign(alignment, size);
+ }
+-#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC))
++#elif defined(__APPLE__) || defined(__ANDROID__) || (defined(__linux__) && defined(__GLIBCXX__) && !defined(_GLIBCXX_HAVE_ALIGNED_ALLOC)) || defined(__OpenBSD__) || defined(__FreeBSD__)
+ #include <cstdlib>
+
+ #if defined(__APPLE__)
diff --git a/electron34/patches/patch-third__party_wayland_BUILD.gn b/electron34/patches/patch-third__party_wayland_BUILD.gn
new file mode 100644
index 0000000000..9ede57087d
--- /dev/null
+++ b/electron34/patches/patch-third__party_wayland_BUILD.gn
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/wayland/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/wayland/BUILD.gn
+@@ -24,6 +24,11 @@ if (!use_system_libwayland) {
+ "src/src",
+ ]
+
++ if (is_bsd) {
++ include_dirs += [ "/usr/local/include/libepoll-shim" ]
++ libs = [ "epoll-shim" ]
++ }
++
+ # Client/Server headers are automatically generated. Though, we still need
+ # to pass the path where these headers are located.
+ include_dirs += [ "$root_gen_dir/third_party/wayland/src/protocol" ]
diff --git a/electron34/patches/patch-third__party_wayland_include_config.h b/electron34/patches/patch-third__party_wayland_include_config.h
new file mode 100644
index 0000000000..43351f1b0f
--- /dev/null
+++ b/electron34/patches/patch-third__party_wayland_include_config.h
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/wayland/include/config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/wayland/include/config.h
+@@ -9,7 +9,14 @@
+
+ #define HAVE_BROKEN_MSG_CMSG_CLOEXEC 0
+
++#if defined(__FreeBSD__)
++#include <osreldate.h>
++#if defined(__FreeBSD_version) && __FreeBSD_version < 1300048
++#undef HAVE_MEMFD_CREATE
++#else
+ #define HAVE_MEMFD_CREATE
++#endif
++#endif
+
+ #define HAVE_MKOSTEMP
+
+@@ -25,7 +32,11 @@
+
+ #undef HAVE_SYS_PROCCTL_H
+
++#if defined(__FreeBSD__)
++#define HAVE_SYS_UCRED_H
++#else
+ #undef HAVE_SYS_UCRED_H
++#endif
+
+ #define HAVE_XUCRED_CR_PID 0
+
diff --git a/electron34/patches/patch-third__party_webrtc_BUILD.gn b/electron34/patches/patch-third__party_webrtc_BUILD.gn
new file mode 100644
index 0000000000..8b11f4572d
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_BUILD.gn
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/BUILD.gn
+@@ -218,6 +218,9 @@ config("common_inherited_config") {
+ if (is_linux || is_chromeos) {
+ defines += [ "WEBRTC_LINUX" ]
+ }
++ if (is_bsd) {
++ defines += [ "WEBRTC_BSD" ]
++ }
+ if (is_mac) {
+ defines += [ "WEBRTC_MAC" ]
+ }
diff --git a/electron34/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn b/electron34/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn
new file mode 100644
index 0000000000..bd0d89aa37
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/audio_device/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/audio_device/BUILD.gn
+@@ -330,7 +330,7 @@ rtc_library("audio_device_impl") {
+ if (rtc_use_dummy_audio_file_devices) {
+ defines += [ "WEBRTC_DUMMY_FILE_DEVICES" ]
+ } else {
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "linux/alsasymboltable_linux.cc",
+ "linux/alsasymboltable_linux.h",
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc
new file mode 100644
index 0000000000..e03966ef04
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/desktop_capturer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/desktop_capturer.cc
+@@ -113,7 +113,7 @@ std::unique_ptr<DesktopCapturer> Desktop
+ std::unique_ptr<DesktopCapturer> capturer;
+
+ #if defined(WEBRTC_USE_PIPEWIRE)
+- if (options.allow_pipewire() && DesktopCapturer::IsRunningUnderWayland()) {
++ if (options.allow_pipewire() && BaseCapturerPipeWire::IsSupported()) {
+ capturer = std::make_unique<BaseCapturerPipeWire>(
+ options, CaptureType::kAnyScreenContent);
+ }
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc
new file mode 100644
index 0000000000..f76801bab0
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/linux/wayland/base_capturer_pipewire.cc
+@@ -111,6 +111,7 @@ void BaseCapturerPipeWire::OnScreenCastR
+ void BaseCapturerPipeWire::OnScreenCastSessionClosed() {
+ if (!capturer_failed_) {
+ options_.screencast_stream()->StopScreenCastStream();
++ capturer_failed_ = true;
+ }
+ capturer_failed_ = true;
+ }
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
new file mode 100644
index 0000000000..e63c3f6eb0
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/linux/wayland/egl_dmabuf.cc
+@@ -10,11 +10,15 @@
+
+ #include "modules/desktop_capture/linux/wayland/egl_dmabuf.h"
+
++#if !defined(WEBRTC_BSD)
+ #include <asm/ioctl.h>
++#endif
+ #include <dlfcn.h>
+ #include <fcntl.h>
+ #include <libdrm/drm_fourcc.h>
++#if !defined(WEBRTC_BSD)
+ #include <linux/types.h>
++#endif
+ #include <spa/param/video/format-utils.h>
+ #include <unistd.h>
+ #include <xf86drm.h>
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc
new file mode 100644
index 0000000000..4c4b337e63
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/linux/x11/x_server_pixel_buffer.cc
+@@ -203,6 +203,12 @@ bool XServerPixelBuffer::Init(XAtomCache
+ void XServerPixelBuffer::InitShm(const XWindowAttributes& attributes) {
+ Visual* default_visual = attributes.visual;
+ int default_depth = attributes.depth;
++#if defined(__OpenBSD__)
++// pledge(2)
++ RTC_LOG(LS_WARNING) << "Unable to use shmget(2) while using pledge(2). "
++ "Performance may be degraded.";
++ return;
++#endif
+
+ int major, minor;
+ Bool have_pixmaps;
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc
new file mode 100644
index 0000000000..ebc96e4731
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/screen_capturer_linux.cc
+@@ -34,11 +34,10 @@ std::unique_ptr<DesktopCapturer> Desktop
+ #endif // defined(WEBRTC_USE_PIPEWIRE)
+
+ #if defined(WEBRTC_USE_X11)
+- if (!DesktopCapturer::IsRunningUnderWayland())
+- return ScreenCapturerX11::CreateRawScreenCapturer(options);
+-#endif // defined(WEBRTC_USE_X11)
+-
++ return ScreenCapturerX11::CreateRawScreenCapturer(options);
++#else
+ return nullptr;
++#endif // defined(WEBRTC_USE_X11)
+ }
+
+ } // namespace webrtc
diff --git a/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc
new file mode 100644
index 0000000000..658fb79e3e
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/desktop_capture/window_capturer_linux.cc
+@@ -34,11 +34,10 @@ std::unique_ptr<DesktopCapturer> Desktop
+ #endif // defined(WEBRTC_USE_PIPEWIRE)
+
+ #if defined(WEBRTC_USE_X11)
+- if (!DesktopCapturer::IsRunningUnderWayland())
+- return WindowCapturerX11::CreateRawWindowCapturer(options);
+-#endif // defined(WEBRTC_USE_X11)
+-
++ return WindowCapturerX11::CreateRawWindowCapturer(options);
++#else
+ return nullptr;
++#endif // defined(WEBRTC_USE_X11)
+ }
+
+ } // namespace webrtc
diff --git a/electron34/patches/patch-third__party_webrtc_modules_video__capture_linux_pipewire__session.cc b/electron34/patches/patch-third__party_webrtc_modules_video__capture_linux_pipewire__session.cc
new file mode 100644
index 0000000000..b492adcf4f
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_video__capture_linux_pipewire__session.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/video_capture/linux/pipewire_session.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/video_capture/linux/pipewire_session.cc
+@@ -87,7 +87,7 @@ PipeWireNode::PipeWireNode(PipeWireSessi
+ .param = OnNodeParam,
+ };
+
+- pw_node_add_listener(proxy_, &node_listener_, &node_events, this);
++ pw_node_add_listener(reinterpret_cast<pw_node*>(proxy_), &node_listener_, &node_events, this);
+ }
+
+ // static
+@@ -119,7 +119,7 @@ void PipeWireNode::OnNodeInfo(void* data
+ uint32_t id = info->params[i].id;
+ if (id == SPA_PARAM_EnumFormat &&
+ info->params[i].flags & SPA_PARAM_INFO_READ) {
+- pw_node_enum_params(that->proxy_, 0, id, 0, UINT32_MAX, nullptr);
++ pw_node_enum_params(reinterpret_cast<pw_node*>(that->proxy_), 0, id, 0, UINT32_MAX, nullptr);
+ break;
+ }
+ }
diff --git a/electron34/patches/patch-third__party_webrtc_modules_video__coding_codecs_av1_libaom__av1__encoder.cc b/electron34/patches/patch-third__party_webrtc_modules_video__coding_codecs_av1_libaom__av1__encoder.cc
new file mode 100644
index 0000000000..a86376c054
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_modules_video__coding_codecs_av1_libaom__av1__encoder.cc
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/modules/video_coding/codecs/av1/libaom_av1_encoder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/modules/video_coding/codecs/av1/libaom_av1_encoder.cc
+@@ -299,7 +299,9 @@ int LibaomAv1Encoder::InitEncode(const V
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_ENABLE_PALETTE, 0);
+ }
+
++#ifdef notyet
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_AUTO_TILES, 1);
++#endif
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_ROW_MT, 1);
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_ENABLE_OBMC, 0);
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_NOISE_SENSITIVITY, 0);
+@@ -332,8 +334,10 @@ int LibaomAv1Encoder::InitEncode(const V
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_MAX_REFERENCE_FRAMES, 3);
+
+ if (adaptive_max_consec_drops_) {
++#ifdef notyet
+ SET_ENCODER_PARAM_OR_RETURN_ERROR(AV1E_SET_MAX_CONSEC_FRAME_DROP_MS_CBR,
+ 250);
++#endif
+ }
+
+ return WEBRTC_VIDEO_CODEC_OK;
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_byte__order.h b/electron34/patches/patch-third__party_webrtc_rtc__base_byte__order.h
new file mode 100644
index 0000000000..2619c61e8b
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_byte__order.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/byte_order.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/byte_order.h
+@@ -90,6 +90,8 @@
+ #error WEBRTC_ARCH_BIG_ENDIAN or WEBRTC_ARCH_LITTLE_ENDIAN must be defined.
+ #endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN)
+
++#elif defined(WEBRTC_BSD)
++#include <sys/endian.h>
+ #elif defined(WEBRTC_POSIX)
+ #include <endian.h>
+ #else
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_ip__address.cc b/electron34/patches/patch-third__party_webrtc_rtc__base_ip__address.cc
new file mode 100644
index 0000000000..e4d2be654b
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_ip__address.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/ip_address.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/ip_address.cc
+@@ -14,7 +14,8 @@
+ #include <cstring>
+ #include <string>
+ #if defined(WEBRTC_POSIX)
+-#ifdef OPENBSD
++#if defined(WEBRTC_BSD)
++#include <sys/types.h>
+ #include <netinet/in_systm.h>
+ #endif
+ #ifndef __native_client__
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc b/electron34/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc
new file mode 100644
index 0000000000..a30ade76cc
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/net_test_helpers.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/net_test_helpers.cc
+@@ -21,6 +21,7 @@
+ #endif
+ #if defined(WEBRTC_POSIX) && !defined(__native_client__)
+ #include <arpa/inet.h>
++#include <sys/socket.h>
+ #if defined(WEBRTC_ANDROID)
+ #include "rtc_base/ifaddrs_android.h"
+ #else
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_network.cc b/electron34/patches/patch-third__party_webrtc_rtc__base_network.cc
new file mode 100644
index 0000000000..75201dcc0c
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_network.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/network.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/network.cc
+@@ -290,7 +290,12 @@ AdapterType GetAdapterTypeFromName(absl:
+ }
+ #endif
+
++#if defined(WEBRTC_BSD)
++ // Treat all other network interface names as ethernet on BSD
++ return ADAPTER_TYPE_ETHERNET;
++#else
+ return ADAPTER_TYPE_UNKNOWN;
++#endif
+ }
+
+ NetworkManager::EnumerationPermission NetworkManager::enumeration_permission()
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc b/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc
new file mode 100644
index 0000000000..5cffef6378
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc
@@ -0,0 +1,120 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/physical_socket_server.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/physical_socket_server.cc
+@@ -55,7 +55,7 @@
+ #include "rtc_base/time_utils.h"
+ #include "system_wrappers/include/field_trial.h"
+
+-#if defined(WEBRTC_LINUX)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
+ #include <linux/sockios.h>
+ #endif
+
+@@ -75,7 +75,7 @@ typedef void* SockOptArg;
+
+ #endif // WEBRTC_POSIX
+
+-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
++#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__) && !defined(WEBRTC_BSD)
+
+ int64_t GetSocketRecvTimestamp(int socket) {
+ struct timeval tv_ioctl;
+@@ -330,7 +330,7 @@ int PhysicalSocket::GetOption(Option opt
+ return -1;
+ }
+ if (opt == OPT_DONTFRAGMENT) {
+-#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && !defined(WEBRTC_BSD)
+ *value = (*value != IP_PMTUDISC_DONT) ? 1 : 0;
+ #endif
+ } else if (opt == OPT_DSCP) {
+@@ -359,7 +359,7 @@ int PhysicalSocket::SetOption(Option opt
+ if (TranslateOption(opt, &slevel, &sopt) == -1)
+ return -1;
+ if (opt == OPT_DONTFRAGMENT) {
+-#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && !defined(WEBRTC_BSD)
+ value = (value) ? IP_PMTUDISC_DO : IP_PMTUDISC_DONT;
+ #endif
+ } else if (opt == OPT_DSCP) {
+@@ -390,7 +390,7 @@ int PhysicalSocket::SetOption(Option opt
+ int PhysicalSocket::Send(const void* pv, size_t cb) {
+ int sent = DoSend(
+ s_, reinterpret_cast<const char*>(pv), static_cast<int>(cb),
+-#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && !defined(WEBRTC_BSD)
+ // Suppress SIGPIPE. Without this, attempting to send on a socket whose
+ // other end is closed will result in a SIGPIPE signal being raised to
+ // our process, which by default will terminate the process, which we
+@@ -419,7 +419,7 @@ int PhysicalSocket::SendTo(const void* b
+ size_t len = addr.ToSockAddrStorage(&saddr);
+ int sent =
+ DoSendTo(s_, static_cast<const char*>(buffer), static_cast<int>(length),
+-#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_ANDROID) && !defined(WEBRTC_BSD)
+ // Suppress SIGPIPE. See above for explanation.
+ MSG_NOSIGNAL,
+ #else
+@@ -699,7 +699,7 @@ int PhysicalSocket::TranslateOption(Opti
+ *slevel = IPPROTO_IP;
+ *sopt = IP_DONTFRAGMENT;
+ break;
+-#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
++#elif defined(WEBRTC_MAC) || defined(WEBRTC_BSD) || defined(__native_client__)
+ RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
+ return -1;
+ #elif defined(WEBRTC_POSIX)
+@@ -748,7 +748,7 @@ int PhysicalSocket::TranslateOption(Opti
+ return -1;
+ #endif
+ case OPT_RECV_ECN:
+-#if defined(WEBRTC_POSIX)
++#if defined(WEBRTC_POSIX) && defined(IP_RECVTOS)
+ if (family_ == AF_INET6) {
+ *slevel = IPPROTO_IPV6;
+ *sopt = IPV6_RECVTCLASS;
+@@ -768,10 +768,19 @@ int PhysicalSocket::TranslateOption(Opti
+ *sopt = SO_KEEPALIVE;
+ break;
+ case OPT_TCP_KEEPCNT:
++#if !defined(TCP_KEEPCNT)
++ RTC_LOG(LS_WARNING) << "Socket::OPT_TCP_KEEPCNT not supported.";
++ return -1;
++#else
+ *slevel = IPPROTO_TCP;
+ *sopt = TCP_KEEPCNT;
+ break;
++#endif
+ case OPT_TCP_KEEPIDLE:
++#if !defined(TCP_KEEPALIVE)
++ RTC_LOG(LS_WARNING) << "Socket::OPT_TCP_KEEPALIVE not supported.";
++ return -1;
++#else
+ *slevel = IPPROTO_TCP;
+ #if !defined(WEBRTC_MAC)
+ *sopt = TCP_KEEPIDLE;
+@@ -779,12 +788,18 @@ int PhysicalSocket::TranslateOption(Opti
+ *sopt = TCP_KEEPALIVE;
+ #endif
+ break;
++#endif
+ case OPT_TCP_KEEPINTVL:
++#if !defined(TCP_KEEPALIVE)
++ RTC_LOG(LS_WARNING) << "Socket::OPT_TCP_KEEPINTVL not supported.";
++ return -1;
++#else
+ *slevel = IPPROTO_TCP;
+ *sopt = TCP_KEEPINTVL;
+ break;
++#endif
+ case OPT_TCP_USER_TIMEOUT:
+-#if defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)
++#if (defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID)) && defined(TCP_USER_TIMEOUT)
+ *slevel = IPPROTO_TCP;
+ *sopt = TCP_USER_TIMEOUT;
+ break;
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h b/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h
new file mode 100644
index 0000000000..1bb93b895e
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/physical_socket_server.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/physical_socket_server.h
+@@ -18,7 +18,7 @@
+ #include "rtc_base/third_party/sigslot/sigslot.h"
+
+ #if defined(WEBRTC_POSIX)
+-#if defined(WEBRTC_LINUX)
++#if defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD)
+ // On Linux, use epoll.
+ #include <sys/epoll.h>
+
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc b/electron34/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc
new file mode 100644
index 0000000000..0d0beec42c
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/platform_thread_types.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/platform_thread_types.cc
+@@ -11,7 +11,9 @@
+ #include "rtc_base/platform_thread_types.h"
+
+ #if defined(WEBRTC_LINUX)
++#if !defined(WEBRTC_BSD)
+ #include <sys/prctl.h>
++#endif
+ #include <sys/syscall.h>
+ #endif
+
+@@ -44,6 +46,8 @@ PlatformThreadId CurrentThreadId() {
+ return gettid();
+ #elif defined(WEBRTC_FUCHSIA)
+ return zx_thread_self();
++#elif defined(WEBRTC_BSD)
++ return reinterpret_cast<uint64_t>(pthread_self());
+ #elif defined(WEBRTC_LINUX)
+ return syscall(__NR_gettid);
+ #elif defined(__EMSCRIPTEN__)
+@@ -74,6 +78,7 @@ bool IsThreadRefEqual(const PlatformThre
+ }
+
+ void SetCurrentThreadName(const char* name) {
++#if !defined(WEBRTC_BSD)
+ #if defined(WEBRTC_WIN)
+ // The SetThreadDescription API works even if no debugger is attached.
+ // The names set with this API also show up in ETW traces. Very handy.
+@@ -121,6 +126,7 @@ void SetCurrentThreadName(const char* na
+ name, strlen(name));
+ RTC_DCHECK_EQ(status, ZX_OK);
+ #endif
++#endif
+ }
+
+ } // namespace rtc
diff --git a/electron34/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h b/electron34/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h
new file mode 100644
index 0000000000..12b22c8398
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h
@@ -0,0 +1,29 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/rtc_base/third_party/sigslot/sigslot.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/rtc_base/third_party/sigslot/sigslot.h
+@@ -178,6 +178,10 @@ class multi_threaded_local {
+ #endif // _SIGSLOT_HAS_WIN32_THREADS
+
+ #ifdef _SIGSLOT_HAS_POSIX_THREADS
++#if defined(OS_FREEBSD)
++#pragma GCC diagnostic push
++#pragma GCC diagnostic ignored "-Wthread-safety-analysis"
++#endif
+ // The multi threading policies only get compiled in if they are enabled.
+ class multi_threaded_global {
+ public:
+@@ -201,6 +205,9 @@ class multi_threaded_local {
+ private:
+ pthread_mutex_t m_mutex;
+ };
++#if defined(OS_FREEBSD)
++#pragma GCC diagnostic pop
++#endif
+ #endif // _SIGSLOT_HAS_POSIX_THREADS
+
+ template <class mt_policy>
diff --git a/electron34/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn b/electron34/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn
new file mode 100644
index 0000000000..2fc24680a3
--- /dev/null
+++ b/electron34/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/webrtc/system_wrappers/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/webrtc/system_wrappers/BUILD.gn
+@@ -62,8 +62,6 @@ rtc_library("system_wrappers") {
+ if (!build_with_chromium) {
+ sources += [ "source/cpu_features_linux.cc" ]
+ }
+-
+- libs += [ "rt" ]
+ }
+
+ if (is_win) {
diff --git a/electron34/patches/patch-third__party_widevine_cdm_widevine.gni b/electron34/patches/patch-third__party_widevine_cdm_widevine.gni
new file mode 100644
index 0000000000..6325fa87e9
--- /dev/null
+++ b/electron34/patches/patch-third__party_widevine_cdm_widevine.gni
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/widevine/cdm/widevine.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/widevine/cdm/widevine.gni
+@@ -28,6 +28,9 @@ library_widevine_cdm_available =
+ (is_chromeos &&
+ (target_cpu == "x64" || target_cpu == "arm" || target_cpu == "arm64")) ||
+ (target_os == "linux" && target_cpu == "x64") ||
++ (target_os == "openbsd" && target_cpu == "x64") ||
++ (target_os == "freebsd" && target_cpu == "x64") ||
++ (target_os == "netbsd" && target_cpu == "x64") ||
+ (target_os == "mac" && (target_cpu == "x64" || target_cpu == "arm64")) ||
+ (target_os == "win" &&
+ (target_cpu == "x86" || target_cpu == "x64" || target_cpu == "arm64"))
diff --git a/electron34/patches/patch-third__party_zlib_BUILD.gn b/electron34/patches/patch-third__party_zlib_BUILD.gn
new file mode 100644
index 0000000000..ee871b1fa8
--- /dev/null
+++ b/electron34/patches/patch-third__party_zlib_BUILD.gn
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/zlib/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/zlib/BUILD.gn
+@@ -128,7 +128,7 @@ if (use_arm_neon_optimizations) {
+ defines = [ "CRC32_ARMV8_CRC32" ]
+ if (is_android) {
+ defines += [ "ARMV8_OS_ANDROID" ]
+- } else if (is_linux || is_chromeos) {
++ } else if ((is_linux || is_chromeos) && !is_bsd) {
+ defines += [ "ARMV8_OS_LINUX" ]
+ } else if (is_mac) {
+ defines += [ "ARMV8_OS_MACOS" ]
+@@ -138,6 +138,10 @@ if (use_arm_neon_optimizations) {
+ defines += [ "ARMV8_OS_FUCHSIA" ]
+ } else if (is_win) {
+ defines += [ "ARMV8_OS_WINDOWS" ]
++ } else if (is_openbsd) {
++ defines += [ "ARMV8_OS_OPENBSD" ]
++ } else if (is_freebsd) {
++ defines += [ "ARMV8_OS_FREEBSD" ]
+ } else {
+ assert(false, "Unsupported ARM OS")
+ }
+@@ -327,6 +331,10 @@ component("zlib") {
+ defines = []
+ deps = []
+
++ if (is_win) {
++ defines += [ "ZLIB_DLL" ]
++ }
++
+ if (!use_x86_x64_optimizations && !use_arm_neon_optimizations) {
+ # Apparently android_cronet bot builds with NEON disabled and
+ # we also should disable optimizations for iOS@x86 (a.k.a. simulator).
+@@ -413,7 +421,7 @@ static_library("minizip") {
+ ]
+ }
+
+- if (is_apple || is_android || is_nacl) {
++ if (is_apple || is_android || is_nacl || is_bsd) {
+ # Mac, Android and the BSDs don't have fopen64, ftello64, or fseeko64. We
+ # use fopen, ftell, and fseek instead on these systems.
+ defines = [ "USE_FILE32API" ]
diff --git a/electron34/patches/patch-third__party_zlib_cpu__features.c b/electron34/patches/patch-third__party_zlib_cpu__features.c
new file mode 100644
index 0000000000..8ec37394aa
--- /dev/null
+++ b/electron34/patches/patch-third__party_zlib_cpu__features.c
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/zlib/cpu_features.c.orig 2025-02-24 19:59:26.000000000 +0000
++++ third_party/zlib/cpu_features.c
+@@ -39,7 +39,8 @@ int ZLIB_INTERNAL riscv_cpu_enable_vclmu
+ #ifndef CPU_NO_SIMD
+
+ #if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || \
+- defined(ARMV8_OS_FUCHSIA) || defined(ARMV8_OS_IOS)
++ defined(ARMV8_OS_FUCHSIA) || defined(ARMV8_OS_IOS) || \
++ defined(ARMV8_OS_OPENBSD) || defined(ARMV8_OS_FREEBSD)
+ #include <pthread.h>
+ #endif
+
+@@ -56,6 +57,10 @@ int ZLIB_INTERNAL riscv_cpu_enable_vclmu
+ #include <windows.h>
+ #elif defined(ARMV8_OS_IOS)
+ #include <sys/sysctl.h>
++#elif defined(ARMV8_OS_OPENBSD)
++#include <sys/sysctl.h>
++#include <machine/cpu.h>
++#include <machine/armreg.h>
+ #elif !defined(_MSC_VER)
+ #include <pthread.h>
+ #else
+@@ -69,7 +74,8 @@ static void _cpu_check_features(void);
+ #if defined(ARMV8_OS_ANDROID) || defined(ARMV8_OS_LINUX) || \
+ defined(ARMV8_OS_MACOS) || defined(ARMV8_OS_FUCHSIA) || \
+ defined(X86_NOT_WINDOWS) || defined(ARMV8_OS_IOS) || \
+- defined(RISCV_RVV)
++ defined(RISCV_RVV) || defined(ARMV8_OS_OPENBSD) || \
++ defined(ARMV8_OS_FREEBSD)
+ #if !defined(ARMV8_OS_MACOS)
+ // _cpu_check_features() doesn't need to do anything on mac/arm since all
+ // features are known at build time, so don't call it.
+@@ -122,6 +128,17 @@ static void _cpu_check_features(void)
+ unsigned long features = getauxval(AT_HWCAP2);
+ arm_cpu_enable_crc32 = !!(features & HWCAP2_CRC32);
+ arm_cpu_enable_pmull = !!(features & HWCAP2_PMULL);
++#elif defined(ARMV8_OS_OPENBSD)
++ int isar0_mib[] = { CTL_MACHDEP, CPU_ID_AA64ISAR0 };
++ uint64_t cpu_id = 0;
++ size_t len = sizeof(cpu_id);
++ if (sysctl(isar0_mib, 2, &cpu_id, &len, NULL, 0) < 0)
++ return;
++ if (ID_AA64ISAR0_AES(cpu_id) >= ID_AA64ISAR0_AES_PMULL)
++ arm_cpu_enable_pmull = 1;
++
++ if (ID_AA64ISAR0_CRC32(cpu_id) >= ID_AA64ISAR0_CRC32_BASE)
++ arm_cpu_enable_crc32 = 1;
+ #elif defined(ARMV8_OS_FUCHSIA)
+ uint32_t features;
+ zx_status_t rc = zx_system_get_features(ZX_FEATURE_KIND_CPU, &features);
diff --git a/electron34/patches/patch-tools_clang_scripts_update.py b/electron34/patches/patch-tools_clang_scripts_update.py
new file mode 100644
index 0000000000..8db3341b8e
--- /dev/null
+++ b/electron34/patches/patch-tools_clang_scripts_update.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/clang/scripts/update.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/clang/scripts/update.py
+@@ -304,6 +304,8 @@ def GetDefaultHostOs():
+ 'win32': 'win',
+ }
+ default_host_os = _PLATFORM_HOST_OS_MAP.get(sys.platform, sys.platform)
++ if "host_os=mac" in os.environ.get('GCLIENT_EXTRA_ARGS', ''):
++ default_host_os = 'mac'
+ if default_host_os == 'mac' and platform.machine() == 'arm64':
+ default_host_os = 'mac-arm64'
+ return default_host_os
diff --git a/electron34/patches/patch-tools_generate__shim__headers_generate__shim__headers.py b/electron34/patches/patch-tools_generate__shim__headers_generate__shim__headers.py
new file mode 100644
index 0000000000..f9341cb784
--- /dev/null
+++ b/electron34/patches/patch-tools_generate__shim__headers_generate__shim__headers.py
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/generate_shim_headers/generate_shim_headers.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/generate_shim_headers/generate_shim_headers.py
+@@ -18,7 +18,7 @@ import sys
+
+
+ SHIM_TEMPLATE = """
+-#if defined(OFFICIAL_BUILD)
++#if defined(GOOGLE_CHROME_BUILD)
+ #error shim headers must not be used in official builds!
+ #endif
+ """
+@@ -65,6 +65,9 @@ def GeneratorMain(argv):
+ if options.outputs:
+ yield os.path.join(target_directory, header_filename)
+ if options.generate:
++ source_file = os.path.join(root, header_filename)
++ if os.path.exists(source_file):
++ os.unlink(source_file)
+ header_path = os.path.join(target_directory, header_filename)
+ header_dir = os.path.dirname(header_path)
+ if not os.path.exists(header_dir):
diff --git a/electron34/patches/patch-tools_generate__stubs_rules.gni b/electron34/patches/patch-tools_generate__stubs_rules.gni
new file mode 100644
index 0000000000..8f7c5d514d
--- /dev/null
+++ b/electron34/patches/patch-tools_generate__stubs_rules.gni
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/generate_stubs/rules.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/generate_stubs/rules.gni
+@@ -110,7 +110,6 @@ template("generate_stubs") {
+ "${target_gen_dir}/${invoker.output_name}.cc",
+ "${target_gen_dir}/${invoker.output_name}.h",
+ ]
+- libs = [ "dl" ]
+ include_dirs = [ target_gen_dir ]
+ if (defined(invoker.configs)) {
+ configs += invoker.configs
diff --git a/electron34/patches/patch-tools_gn_build_build__linux.ninja.template b/electron34/patches/patch-tools_gn_build_build__linux.ninja.template
new file mode 100644
index 0000000000..7d68ac369c
--- /dev/null
+++ b/electron34/patches/patch-tools_gn_build_build__linux.ninja.template
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gn/build/build_linux.ninja.template.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gn/build/build_linux.ninja.template
+@@ -5,7 +5,7 @@ rule cxx
+ deps = gcc
+
+ rule alink_thin
+- command = $ar rcsT $out $in
++ command = $ar rcs $out $in
+ description = AR $out
+
+ rule link
diff --git a/electron34/patches/patch-tools_gn_build_gen.py b/electron34/patches/patch-tools_gn_build_gen.py
new file mode 100644
index 0000000000..c6d5e9de94
--- /dev/null
+++ b/electron34/patches/patch-tools_gn_build_gen.py
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gn/build/gen.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gn/build/gen.py
+@@ -94,6 +94,12 @@ class Platform(object):
+ def is_solaris(self):
+ return self._platform == 'solaris'
+
++ def is_openbsd(self):
++ return self._platform == 'openbsd'
++
++ def is_freebsd(self):
++ return self._platform == 'freebsd'
++
+ def is_posix(self):
+ return self._platform in ['linux', 'freebsd', 'darwin', 'aix', 'openbsd', 'haiku', 'solaris', 'msys', 'netbsd', 'serenity']
+
+@@ -304,7 +310,7 @@ def WriteGenericNinja(path, static_libra
+ 'linux': 'build_linux.ninja.template',
+ 'freebsd': 'build_linux.ninja.template',
+ 'aix': 'build_aix.ninja.template',
+- 'openbsd': 'build_openbsd.ninja.template',
++ 'openbsd': 'build_linux.ninja.template',
+ 'haiku': 'build_haiku.ninja.template',
+ 'solaris': 'build_linux.ninja.template',
+ 'netbsd': 'build_linux.ninja.template',
+@@ -540,6 +546,9 @@ def WriteGNNinja(path, platform, host, o
+ if platform.is_posix() and not platform.is_haiku():
+ ldflags.append('-pthread')
+
++ if platform.is_openbsd():
++ libs.append('-lkvm')
++
+ if platform.is_mingw() or platform.is_msys():
+ cflags.extend(['-DUNICODE',
+ '-DNOMINMAX',
diff --git a/electron34/patches/patch-tools_gn_src_base_files_file__posix.cc b/electron34/patches/patch-tools_gn_src_base_files_file__posix.cc
new file mode 100644
index 0000000000..ebb0226365
--- /dev/null
+++ b/electron34/patches/patch-tools_gn_src_base_files_file__posix.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gn/src/base/files/file_posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gn/src/base/files/file_posix.cc
+@@ -359,7 +359,7 @@ void File::DoInitialize(const FilePath&
+ bool File::Flush() {
+ DCHECK(IsValid());
+
+-#if defined(OS_LINUX)
++#if defined(OS_LINUX) || defined(OS_BSD)
+ return !HANDLE_EINTR(fdatasync(file_.get()));
+ #else
+ return !HANDLE_EINTR(fsync(file_.get()));
diff --git a/electron34/patches/patch-tools_gn_src_gn_version.h b/electron34/patches/patch-tools_gn_src_gn_version.h
new file mode 100644
index 0000000000..7acb736fcc
--- /dev/null
+++ b/electron34/patches/patch-tools_gn_src_gn_version.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gn/src/gn/version.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gn/src/gn/version.h
+@@ -22,9 +22,9 @@ class Version {
+
+ static std::optional<Version> FromString(std::string s);
+
+- int major() const { return major_; }
+- int minor() const { return minor_; }
+- int patch() const { return patch_; }
++ int gmajor() const { return major_; }
++ int gminor() const { return minor_; }
++ int gpatch() const { return patch_; }
+
+ bool operator==(const Version& other) const;
+ bool operator<(const Version& other) const;
diff --git a/electron34/patches/patch-tools_gn_src_util_exe__path.cc b/electron34/patches/patch-tools_gn_src_util_exe__path.cc
new file mode 100644
index 0000000000..49c4fe5983
--- /dev/null
+++ b/electron34/patches/patch-tools_gn_src_util_exe__path.cc
@@ -0,0 +1,96 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gn/src/util/exe_path.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gn/src/util/exe_path.cc
+@@ -15,7 +15,7 @@
+ #include <windows.h>
+
+ #include "base/win/win_util.h"
+-#elif defined(OS_FREEBSD) || defined(OS_NETBSD)
++#elif defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_OPENBSD)
+ #include <limits.h>
+ #include <sys/sysctl.h>
+ #include <sys/types.h>
+@@ -26,6 +26,10 @@
+ #include <stdlib.h>
+ #endif
+
++#if defined(OS_OPENBSD)
++#include <kvm.h>
++#endif
++
+ #if defined(OS_MACOSX)
+
+ base::FilePath GetExePath() {
+@@ -104,6 +108,67 @@ base::FilePath GetExePath() {
+ return base::FilePath(raw);
+ }
+
++#elif defined(OS_OPENBSD)
++
++base::FilePath GetExePath() {
++ struct kinfo_file *files;
++ kvm_t *kd = NULL;
++ char errbuf[_POSIX2_LINE_MAX];
++ char **retvalargs;
++#define MAXTOKENS 2
++ char *tokens[MAXTOKENS];
++ static char retval[PATH_MAX];
++ int cnt;
++ size_t len;
++ struct stat sb;
++ pid_t cpid = getpid();
++
++ int mib[] = { CTL_KERN, KERN_PROC_ARGS, cpid, KERN_PROC_ARGV };
++
++ if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) {
++ retvalargs = static_cast<char**>(malloc(len));
++ if (!retvalargs)
++ goto out;
++
++ if (sysctl(mib, 4, retvalargs, &len, NULL, 0) < 0)
++ goto out;
++
++ char *cr = strdup(retvalargs[0]);
++ free(retvalargs);
++
++ *tokens = strtok(cr, ":");
++ if (tokens[0] == NULL)
++ goto out;
++
++ if (realpath(tokens[0], retval) == NULL)
++ goto out;
++
++ if (stat(retval, &sb) < 0)
++ goto out;
++
++ if ((kd = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
++ goto out;
++
++ if ((files = kvm_getfiles(kd, KERN_FILE_BYPID, cpid,
++ sizeof(struct kinfo_file), &cnt)) == NULL) {
++ kvm_close(kd);
++ goto out;
++ }
++
++ for (int i = 0; i < cnt; i++) {
++ if (files[i].fd_fd == KERN_FILE_TEXT &&
++ files[i].va_fsid == static_cast<uint32_t>(sb.st_dev) &&
++ files[i].va_fileid == sb.st_ino) {
++ kvm_close(kd);
++ return base::FilePath(retval);
++ }
++ }
++ }
++
++out:
++ return base::FilePath();
++}
++
+ #elif defined(OS_ZOS)
+
+ base::FilePath GetExePath() {
diff --git a/electron34/patches/patch-tools_grit_grit_node_base.py b/electron34/patches/patch-tools_grit_grit_node_base.py
new file mode 100644
index 0000000000..7ca2421517
--- /dev/null
+++ b/electron34/patches/patch-tools_grit_grit_node_base.py
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/grit/grit/node/base.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/grit/grit/node/base.py
+@@ -498,7 +498,8 @@ class Node:
+ value = defs
+
+ elif name == 'is_linux':
+- value = target_platform == 'linux'
++ value = (target_platform == 'linux'
++ or 'bsd' in target_platform)
+ elif name == 'is_chromeos':
+ value = target_platform == 'chromeos'
+ elif name == 'is_macosx':
diff --git a/electron34/patches/patch-tools_gritsettings_resource__ids.spec b/electron34/patches/patch-tools_gritsettings_resource__ids.spec
new file mode 100644
index 0000000000..9f8120e591
--- /dev/null
+++ b/electron34/patches/patch-tools_gritsettings_resource__ids.spec
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/gritsettings/resource_ids.spec.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/gritsettings/resource_ids.spec
+@@ -1385,6 +1385,11 @@
+ "<(SHARED_INTERMEDIATE_DIR)/third_party/blink/public/strings/permission_element_generated_strings.grd": {
+ "META": {"sizes": {"messages": [2000],}},
+ "messages": [10080],
++ },
++
++ "electron/electron_resources.grd": {
++ "messages": [31750],
++ "includes": [31950],
+ }
+
+ # END "everything else" section.
diff --git a/electron34/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py b/electron34/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py
new file mode 100644
index 0000000000..9ac17ced69
--- /dev/null
+++ b/electron34/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/json_schema_compiler/cpp_bundle_generator.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/json_schema_compiler/cpp_bundle_generator.py
+@@ -145,7 +145,7 @@ class CppBundleGenerator(object):
+ # BUILDFLAG(IS_CHROMEOS) && BUILDFLAG(IS_CHROMEOS_LACROS).
+ ifdefs.append('BUILDFLAG(IS_CHROMEOS_LACROS)')
+ elif platform == Platforms.LINUX:
+- ifdefs.append('BUILDFLAG(IS_LINUX)')
++ ifdefs.append('BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)')
+ elif platform == Platforms.MAC:
+ ifdefs.append('BUILDFLAG(IS_MAC)')
+ elif platform == Platforms.WIN:
diff --git a/electron34/patches/patch-tools_json__schema__compiler_feature__compiler.py b/electron34/patches/patch-tools_json__schema__compiler_feature__compiler.py
new file mode 100644
index 0000000000..2d77c191c6
--- /dev/null
+++ b/electron34/patches/patch-tools_json__schema__compiler_feature__compiler.py
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/json_schema_compiler/feature_compiler.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/json_schema_compiler/feature_compiler.py
+@@ -292,6 +292,9 @@ FEATURE_GRAMMAR = ({
+ 'linux': 'Feature::LINUX_PLATFORM',
+ 'mac': 'Feature::MACOSX_PLATFORM',
+ 'win': 'Feature::WIN_PLATFORM',
++ 'openbsd': 'Feature::LINUX_PLATFORM',
++ 'freebsd': 'Feature::LINUX_PLATFORM',
++ 'netbsd': 'Feature::LINUX_PLATFORM',
+ }
+ }
+ },
diff --git a/electron34/patches/patch-tools_licenses_licenses.py b/electron34/patches/patch-tools_licenses_licenses.py
new file mode 100644
index 0000000000..9a3a972dd5
--- /dev/null
+++ b/electron34/patches/patch-tools_licenses_licenses.py
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/licenses/licenses.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/licenses/licenses.py
+@@ -336,6 +336,31 @@ SPECIAL_CASES = {
+ "License": "Apache 2.0",
+ "License File": ["//third_party/dawn/third_party/khronos/LICENSE"],
+ },
++ os.path.join('third_party', 'electron_node'): {
++ "Name": "Node.js",
++ "URL": "https://github.com/nodejs/node",
++ "License": "MIT",
++ "License File": ["/third_party/electron_node/LICENSE"],
++ },
++ os.path.join('third_party', 'squirrel.mac'): {
++ "Name": "Squirrel",
++ "URL": "https://github.com/Squirrel/Squirrel.Mac",
++ "License": "MIT",
++ "License File": ["/third_party/squirrel.mac/LICENSE"],
++ },
++ os.path.join('third_party', 'squirrel.mac', 'vendor', 'mantle'): {
++ "Name": "Mantle",
++ "URL": "https://github.com/Mantle/Mantle",
++ "License": "MIT",
++ "License File": "/third_party/squirrel.mac/vendor/mantle/LICENSE.md",
++ },
++ os.path.join('third_party', 'squirrel.mac', 'vendor', 'ReactiveObjC'): {
++ "Name": "ReactiveObjC",
++ "URL": "https://github.com/ReactiveCocoa/ReactiveObjC",
++ "License": "MIT",
++ "License File":
++ ["/third_party/squirrel.mac/vendor/ReactiveObjC/LICENSE.md"],
++ },
+ }
+
+ # These buildtools/third_party directories only contain
diff --git a/electron34/patches/patch-tools_memory_partition__allocator_inspect__utils.h b/electron34/patches/patch-tools_memory_partition__allocator_inspect__utils.h
new file mode 100644
index 0000000000..1c012b9e99
--- /dev/null
+++ b/electron34/patches/patch-tools_memory_partition__allocator_inspect__utils.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/memory/partition_allocator/inspect_utils.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/memory/partition_allocator/inspect_utils.h
+@@ -61,7 +61,7 @@ class RemoteProcessMemoryReader {
+ const pid_t pid_;
+ bool is_valid_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedFD mem_fd_;
+ #elif BUILDFLAG(IS_MAC)
+ task_t task_;
diff --git a/electron34/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn b/electron34/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn
new file mode 100644
index 0000000000..f8fc7b697f
--- /dev/null
+++ b/electron34/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/perf/chrome_telemetry_build/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/perf/chrome_telemetry_build/BUILD.gn
+@@ -47,7 +47,7 @@ group("telemetry_chrome_test") {
+ data_deps += [ "//chrome:reorder_imports" ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ data_deps += [ "//third_party/breakpad:dump_syms" ]
+
+ # CrOS currently has issues with the locally compiled version of
+@@ -178,7 +178,7 @@ group("telemetry_chrome_test_without_chr
+ ]
+
+ # Cr-Fuchsia doesn't support breakpad.
+- if (!is_win && !is_fuchsia) {
++ if (!is_win && !is_fuchsia && !is_bsd) {
+ data_deps += [
+ # This is defined for Windows, but is unused by Telemetry on
+ # Windows, and including it can have issues when cross-compiling
diff --git a/electron34/patches/patch-tools_protoc__wrapper_protoc__wrapper.py b/electron34/patches/patch-tools_protoc__wrapper_protoc__wrapper.py
new file mode 100644
index 0000000000..57cf0d7f27
--- /dev/null
+++ b/electron34/patches/patch-tools_protoc__wrapper_protoc__wrapper.py
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/protoc_wrapper/protoc_wrapper.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/protoc_wrapper/protoc_wrapper.py
+@@ -183,15 +183,19 @@ def main(argv):
+ if not options.exclude_imports:
+ protoc_cmd += ["--include_imports"]
+
++ nenv = os.environ.copy()
++# nenv["PATH"] = "${WRKOBJDIR}/bin:" + nenv["PATH"]
++ nenv["LD_LIBRARY_PATH"] = "@WRKSRC@/out/Release"
++
+ dependency_file_data = None
+ if options.descriptor_set_out and options.descriptor_set_dependency_file:
+ protoc_cmd += ['--dependency_out', options.descriptor_set_dependency_file]
+- ret = subprocess.call(protoc_cmd)
++ ret = subprocess.call(protoc_cmd, env=nenv)
+
+ with open(options.descriptor_set_dependency_file, 'rb') as f:
+ dependency_file_data = f.read().decode('utf-8')
+
+- ret = subprocess.call(protoc_cmd)
++ ret = subprocess.call(protoc_cmd, env=nenv)
+ if ret != 0:
+ if ret <= -100:
+ # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier to
diff --git a/electron34/patches/patch-tools_v8__context__snapshot_BUILD.gn b/electron34/patches/patch-tools_v8__context__snapshot_BUILD.gn
new file mode 100644
index 0000000000..3bf91bd7ab
--- /dev/null
+++ b/electron34/patches/patch-tools_v8__context__snapshot_BUILD.gn
@@ -0,0 +1,61 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/v8_context_snapshot/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/v8_context_snapshot/BUILD.gn
+@@ -36,6 +36,42 @@ buildflag_header("buildflags") {
+ ]
+ }
+
++action("run_paxctl_v8_context_snapshot_generator") {
++ deps = [ ":v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
++
++ script = "//v8/tools/run-paxctl.py"
++ stamp = "$target_gen_dir/paxctl_stamp"
++ outputs = [ stamp ]
++
++ sources = []
++ data = []
++
++ args = [
++ rebase_path(stamp, root_build_dir),
++ "/usr/sbin/paxctl", "+m",
++ "./" + rebase_path(get_label_info(":v8_context_snapshot_generator", "root_out_dir") + "/v8_context_snapshot_generator",
++ root_build_dir),
++ ]
++}
++
++action("run_paxctl_v8_context_snapshot_generator") {
++ deps = [ ":v8_context_snapshot_generator($v8_snapshot_toolchain)" ]
++
++ script = "//v8/tools/run-paxctl.py"
++ stamp = "$target_gen_dir/paxctl_stamp"
++ outputs = [ stamp ]
++
++ sources = []
++ data = []
++
++ args = [
++ rebase_path(stamp, root_build_dir),
++ "/usr/sbin/paxctl", "+m",
++ "./" + rebase_path(get_label_info(":v8_context_snapshot_generator", "root_out_dir") + "/v8_context_snapshot_generator",
++ root_build_dir),
++ ]
++}
++
+ if (use_v8_context_snapshot) {
+ if (v8_snapshot_toolchain == current_toolchain) {
+ action("generate_v8_context_snapshot") {
+@@ -57,6 +93,9 @@ if (use_v8_context_snapshot) {
+ ":v8_context_snapshot_generator",
+ "//v8:run_mksnapshot_default",
+ ]
++ if (target_os == "netbsd") {
++ deps += [ ":run_paxctl_v8_context_snapshot_generator" ]
++ }
+
+ # TODO(sky): figure out why this doesn't work on android cross compile.
+ # In the case of compiling for the snapshot `shlib_extension` is ".so"
diff --git a/electron34/patches/patch-tools_variations_fieldtrial__to__struct.py b/electron34/patches/patch-tools_variations_fieldtrial__to__struct.py
new file mode 100644
index 0000000000..b789cf4dd0
--- /dev/null
+++ b/electron34/patches/patch-tools_variations_fieldtrial__to__struct.py
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- tools/variations/fieldtrial_to_struct.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ tools/variations/fieldtrial_to_struct.py
+@@ -41,6 +41,9 @@ _platforms = [
+ 'linux',
+ 'mac',
+ 'windows',
++ 'openbsd',
++ 'freebsd',
++ 'netbsd',
+ ]
+
+ _form_factors = [
diff --git a/electron34/patches/patch-ui_accelerated__widget__mac_BUILD.gn b/electron34/patches/patch-ui_accelerated__widget__mac_BUILD.gn
new file mode 100644
index 0000000000..971006be9e
--- /dev/null
+++ b/electron34/patches/patch-ui_accelerated__widget__mac_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accelerated_widget_mac/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accelerated_widget_mac/BUILD.gn
+@@ -67,6 +67,7 @@ component("accelerated_widget_mac") {
+ "//ui/gfx",
+ "//ui/gfx/geometry",
+ "//ui/gl",
++ "//electron/build/config:generate_mas_config",
+ ]
+ }
+
diff --git a/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h b/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h
new file mode 100644
index 0000000000..3b32eb66a8
--- /dev/null
+++ b/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accelerated_widget_mac/ca_layer_tree_coordinator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
+@@ -7,6 +7,7 @@
+
+ #include <queue>
+
++#include "electron/mas.h"
+ #include "ui/accelerated_widget_mac/accelerated_widget_mac_export.h"
+ #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h"
+ #include "ui/gfx/ca_layer_result.h"
+@@ -14,7 +15,9 @@
+ #include "ui/gl/gl_surface.h"
+ #include "ui/gl/presenter.h"
+
++#if !IS_MAS_BUILD()
+ @class CAContext;
++#endif
+ @class CALayer;
+
+ namespace ui {
+@@ -110,7 +113,9 @@ class ACCELERATED_WIDGET_MAC_EXPORT CALa
+ // both the current tree and the pending trees.
+ size_t presented_ca_layer_trees_max_length_ = 2;
+
++#if !IS_MAS_BUILD()
+ CAContext* __strong ca_context_;
++#endif
+
+ // The root CALayer to display the current frame. This does not change
+ // over the lifetime of the object.
diff --git a/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm b/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm
new file mode 100644
index 0000000000..03b68d4da8
--- /dev/null
+++ b/electron34/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
+@@ -10,6 +10,7 @@
+ #include "base/mac/mac_util.h"
+ #include "base/task/single_thread_task_runner.h"
+ #include "base/trace_event/trace_event.h"
++#include "electron/mas.h"
+ #include "ui/base/cocoa/animation_utils.h"
+ #include "ui/base/cocoa/remote_layer_api.h"
+ #include "ui/gfx/ca_layer_params.h"
+@@ -33,6 +34,7 @@ CALayerTreeCoordinator::CALayerTreeCoord
+ new_presentation_feedback_timestamps_(
+ new_presentation_feedback_timestamps),
+ buffer_presented_callback_(buffer_presented_callback) {
++#if !IS_MAS_BUILD()
+ if (allow_remote_layers_) {
+ root_ca_layer_ = [[CALayer alloc] init];
+ #if BUILDFLAG(IS_MAC)
+@@ -61,6 +63,7 @@ CALayerTreeCoordinator::CALayerTreeCoord
+ #endif
+ ca_context_.layer = root_ca_layer_;
+ }
++#endif
+ }
+
+ CALayerTreeCoordinator::~CALayerTreeCoordinator() = default;
+@@ -164,9 +167,13 @@ void CALayerTreeCoordinator::CommitPrese
+ TRACE_EVENT_INSTANT2("test_gpu", "SwapBuffers", TRACE_EVENT_SCOPE_THREAD,
+ "GLImpl", static_cast<int>(gl::GetGLImplementation()),
+ "width", pixel_size_.width());
++#if !IS_MAS_BUILD()
+ if (allow_remote_layers_) {
+ params.ca_context_id = [ca_context_ contextId];
+ } else {
++#else
++ if (true) {
++#endif
+ IOSurfaceRef io_surface = frame->layer_tree->GetContentIOSurface();
+ if (io_surface) {
+ DCHECK(!allow_remote_layers_);
diff --git a/electron34/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm b/electron34/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
new file mode 100644
index 0000000000..0e151d7af7
--- /dev/null
+++ b/electron34/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accelerated_widget_mac/display_ca_layer_tree.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accelerated_widget_mac/display_ca_layer_tree.mm
+@@ -12,6 +12,7 @@
+ #include "base/mac/mac_util.h"
+ #include "base/trace_event/trace_event.h"
+ #include "build/build_config.h"
++#include "electron/mas.h"
+ #include "ui/base/cocoa/animation_utils.h"
+ #include "ui/base/cocoa/remote_layer_api.h"
+ #include "ui/gfx/geometry/dip_util.h"
+@@ -121,6 +122,7 @@ void DisplayCALayerTree::UpdateCALayerTr
+ }
+
+ void DisplayCALayerTree::GotCALayerFrame(uint32_t ca_context_id) {
++#if !IS_MAS_BUILD()
+ // Early-out if the remote layer has not changed.
+ if (remote_layer_.contextId == ca_context_id) {
+ return;
+@@ -150,6 +152,9 @@ void DisplayCALayerTree::GotCALayerFrame
+ [io_surface_layer_ removeFromSuperlayer];
+ io_surface_layer_ = nil;
+ }
++#else
++ NOTREACHED() << "Remote layer is being used in MAS build";
++#endif
+ }
+
+ void DisplayCALayerTree::GotIOSurfaceFrame(
diff --git a/electron34/patches/patch-ui_accessibility_platform_BUILD.gn b/electron34/patches/patch-ui_accessibility_platform_BUILD.gn
new file mode 100644
index 0000000000..a4af13b5d5
--- /dev/null
+++ b/electron34/patches/patch-ui_accessibility_platform_BUILD.gn
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accessibility/platform/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accessibility/platform/BUILD.gn
+@@ -283,6 +283,7 @@ component("platform") {
+ "AppKit.framework",
+ "Foundation.framework",
+ ]
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_ios) {
diff --git a/electron34/patches/patch-ui_accessibility_platform_browser__accessibility__manager__mac.mm b/electron34/patches/patch-ui_accessibility_platform_browser__accessibility__manager__mac.mm
new file mode 100644
index 0000000000..f5cb909870
--- /dev/null
+++ b/electron34/patches/patch-ui_accessibility_platform_browser__accessibility__manager__mac.mm
@@ -0,0 +1,57 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accessibility/platform/browser_accessibility_manager_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accessibility/platform/browser_accessibility_manager_mac.mm
+@@ -13,13 +13,16 @@
+ #include "base/task/single_thread_task_runner.h"
+ #include "base/task/task_traits.h"
+ #include "base/time/time.h"
++#include "electron/mas.h"
+ #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
+ #include "ui/accessibility/ax_role_properties.h"
+ #include "ui/accessibility/platform/ax_platform_tree_manager_delegate.h"
+ #include "ui/accessibility/platform/ax_private_webkit_constants_mac.h"
+ #import "ui/accessibility/platform/browser_accessibility_cocoa.h"
+ #import "ui/accessibility/platform/browser_accessibility_mac.h"
++#if !IS_MAS_BUILD()
+ #include "ui/base/cocoa/remote_accessibility_api.h"
++#endif
+
+ namespace {
+
+@@ -227,6 +230,7 @@ void BrowserAccessibilityManagerMac::Fir
+ return;
+ }
+
++#if !IS_MAS_BUILD()
+ BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
+ if (root_manager) {
+ BrowserAccessibilityManagerMac* root_manager_mac =
+@@ -249,6 +253,7 @@ void BrowserAccessibilityManagerMac::Fir
+ return;
+ }
+ }
++#endif
+
+ // Use native VoiceOver support for live regions.
+ BrowserAccessibilityCocoa* retained_node = native_node;
+@@ -645,6 +650,7 @@ bool BrowserAccessibilityManagerMac::Sho
+ return window == [NSApp accessibilityFocusedWindow];
+ }
+
++#if !IS_MAS_BUILD()
+ // TODO(accessibility): We need a solution to the problem described below.
+ // If the window is NSAccessibilityRemoteUIElement, there are some challenges:
+ // 1. NSApp is the browser which spawned the PWA, and what it considers the
+@@ -673,6 +679,7 @@ bool BrowserAccessibilityManagerMac::Sho
+ if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) {
+ return true;
+ }
++#endif
+
+ return false;
+ }
diff --git a/electron34/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm b/electron34/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
new file mode 100644
index 0000000000..e512ae2e2c
--- /dev/null
+++ b/electron34/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/accessibility/platform/inspect/ax_transform_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/accessibility/platform/inspect/ax_transform_mac.mm
+@@ -11,6 +11,7 @@
+
+ #include "base/apple/foundation_util.h"
+ #include "base/strings/sys_string_conversions.h"
++#include "electron/mas.h"
+ #include "ui/accessibility/ax_range.h"
+ #include "ui/accessibility/platform/ax_platform_node.h"
+ #include "ui/accessibility/platform/ax_platform_node_cocoa.h"
+@@ -111,6 +112,7 @@ base::Value AXNSObjectToBaseValue(id val
+ }
+ }
+
++#if !IS_MAS_BUILD()
+ // AXTextMarker
+ if (IsAXTextMarker(value)) {
+ return AXTextMarkerToBaseValue(value, indexer);
+@@ -120,6 +122,7 @@ base::Value AXNSObjectToBaseValue(id val
+ if (IsAXTextMarkerRange(value)) {
+ return AXTextMarkerRangeToBaseValue(value, indexer);
+ }
++#endif
+
+ // Accessible object
+ if (AXElementWrapper::IsValidElement(value)) {
diff --git a/electron34/patches/patch-ui_aura_client_drag__drop__client.h b/electron34/patches/patch-ui_aura_client_drag__drop__client.h
new file mode 100644
index 0000000000..01d1d8b65e
--- /dev/null
+++ b/electron34/patches/patch-ui_aura_client_drag__drop__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/aura/client/drag_drop_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/aura/client/drag_drop_client.h
+@@ -44,7 +44,7 @@ class AURA_EXPORT DragDropClient {
+ int allowed_operations,
+ ui::mojom::DragEventSource source) = 0;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Updates the drag image. An empty |image| may be used to hide a previously
+ // set non-empty drag image, and a non-empty |image| shows the drag image
+ // again if it was previously hidden.
diff --git a/electron34/patches/patch-ui_aura_screen__ozone.cc b/electron34/patches/patch-ui_aura_screen__ozone.cc
new file mode 100644
index 0000000000..e280bf8930
--- /dev/null
+++ b/electron34/patches/patch-ui_aura_screen__ozone.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/aura/screen_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/aura/screen_ozone.cc
+@@ -107,7 +107,7 @@ display::Display ScreenOzone::GetPrimary
+ return platform_screen_->GetPrimaryDisplay();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ScreenOzone::ScreenSaverSuspenderOzone::ScreenSaverSuspenderOzone(
+ std::unique_ptr<ui::PlatformScreen::PlatformScreenSaverSuspender> suspender)
+ : suspender_(std::move(suspender)) {}
diff --git a/electron34/patches/patch-ui_aura_screen__ozone.h b/electron34/patches/patch-ui_aura_screen__ozone.h
new file mode 100644
index 0000000000..13a6e676f1
--- /dev/null
+++ b/electron34/patches/patch-ui_aura_screen__ozone.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/aura/screen_ozone.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/aura/screen_ozone.h
+@@ -44,7 +44,7 @@ class AURA_EXPORT ScreenOzone : public d
+ display::Display GetDisplayMatching(
+ const gfx::Rect& match_rect) const override;
+ display::Display GetPrimaryDisplay() const override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<display::Screen::ScreenSaverSuspender> SuspendScreenSaver()
+ override;
+ #endif // BUILDFLAG(IS_LINUX)
+@@ -68,7 +68,7 @@ class AURA_EXPORT ScreenOzone : public d
+ ui::PlatformScreen* platform_screen() { return platform_screen_.get(); }
+
+ private:
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class ScreenSaverSuspenderOzone
+ : public display::Screen::ScreenSaverSuspender {
+ public:
diff --git a/electron34/patches/patch-ui_base_BUILD.gn b/electron34/patches/patch-ui_base_BUILD.gn
new file mode 100644
index 0000000000..61cf5b828c
--- /dev/null
+++ b/electron34/patches/patch-ui_base_BUILD.gn
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/BUILD.gn
+@@ -357,6 +357,13 @@ component("base") {
+ ]
+ }
+
++ if (is_mas_build) {
++ sources -= [
++ "cocoa/remote_accessibility_api.h",
++ "cocoa/remote_accessibility_api.mm",
++ ]
++ }
++
+ if (is_ios) {
+ sources += [
+ "device_form_factor_ios.mm",
+@@ -500,6 +507,12 @@ component("base") {
+ "//url",
+ ]
+
++ if (is_mac) {
++ deps += [
++ "//electron/build/config:generate_mas_config"
++ ]
++ }
++
+ if (is_debug || dcheck_always_on) {
+ deps += [ "//third_party/re2" ]
+ }
diff --git a/electron34/patches/patch-ui_base_accelerators_accelerator.cc b/electron34/patches/patch-ui_base_accelerators_accelerator.cc
new file mode 100644
index 0000000000..a056081a74
--- /dev/null
+++ b/electron34/patches/patch-ui_base_accelerators_accelerator.cc
@@ -0,0 +1,66 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/accelerators/accelerator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/accelerators/accelerator.cc
+@@ -12,6 +12,7 @@
+ #include "base/i18n/rtl.h"
+ #include "base/notreached.h"
+ #include "base/strings/string_util.h"
++#include "base/strings/stringprintf.h"
+ #include "base/strings/utf_string_conversions.h"
+ #include "base/types/cxx23_to_underlying.h"
+ #include "build/build_config.h"
+@@ -188,6 +189,11 @@ std::u16string Accelerator::GetShortcutT
+ #endif
+
+ if (shortcut.empty()) {
++ // When a shifted char is explicitly specified, for example Ctrl+Plus,
++ // use the shifted char directly.
++ if (shifted_char) {
++ shortcut += *shifted_char;
++ } else {
+ #if BUILDFLAG(IS_WIN)
+ // Our fallback is to try translate the key code to a regular character
+ // unless it is one of digits (VK_0 to VK_9). Some keyboard
+@@ -212,6 +218,10 @@ std::u16string Accelerator::GetShortcutT
+ shortcut +=
+ static_cast<std::u16string::value_type>(base::ToUpperASCII(c));
+ #endif
++ }
++ if (key_code_ > VKEY_F1 && key_code_ <= VKEY_F24)
++ shortcut = base::UTF8ToUTF16(
++ base::StringPrintf("F%d", key_code_ - VKEY_F1 + 1));
+ }
+
+ #if BUILDFLAG(IS_MAC)
+@@ -396,7 +406,7 @@ std::u16string Accelerator::ApplyLongFor
+ const std::u16string& shortcut) const {
+ std::u16string result = shortcut;
+
+- if (IsShiftDown())
++ if (!shifted_char && IsShiftDown())
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_SHIFT_KEY);
+
+ // Note that we use 'else-if' in order to avoid using Ctrl+Alt as a shortcut.
+@@ -404,7 +414,7 @@ std::u16string Accelerator::ApplyLongFor
+ // more information.
+ if (IsCtrlDown())
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_CTRL_KEY);
+- else if (IsAltDown())
++ if (IsAltDown())
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_ALT_KEY);
+
+ if (IsCmdDown()) {
+@@ -414,7 +424,7 @@ std::u16string Accelerator::ApplyLongFor
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_SEARCH_KEY);
+ #elif BUILDFLAG(IS_WIN)
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_WINDOWS_KEY);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ result = ApplyModifierToAcceleratorString(result, IDS_APP_SUPER_KEY);
+ #else
+ NOTREACHED();
diff --git a/electron34/patches/patch-ui_base_accelerators_accelerator.h b/electron34/patches/patch-ui_base_accelerators_accelerator.h
new file mode 100644
index 0000000000..1ed2b88439
--- /dev/null
+++ b/electron34/patches/patch-ui_base_accelerators_accelerator.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/accelerators/accelerator.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/accelerators/accelerator.h
+@@ -16,6 +16,7 @@
+ #include <utility>
+
+ #include "base/component_export.h"
++#include "third_party/abseil-cpp/absl/types/optional.h"
+ #include "base/time/time.h"
+ #include "build/build_config.h"
+ #include "ui/events/event_constants.h"
+@@ -132,6 +133,8 @@ class COMPONENT_EXPORT(UI_BASE) Accelera
+ return interrupted_by_mouse_event_;
+ }
+
++ absl::optional<char16_t> shifted_char;
++
+ private:
+ friend class AcceleratorTestMac;
+ std::u16string ApplyLongFormModifiers(const std::u16string& shortcut) const;
diff --git a/electron34/patches/patch-ui_base_accelerators_accelerator__unittest.cc b/electron34/patches/patch-ui_base_accelerators_accelerator__unittest.cc
new file mode 100644
index 0000000000..264cf3cb4c
--- /dev/null
+++ b/electron34/patches/patch-ui_base_accelerators_accelerator__unittest.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/accelerators/accelerator_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/accelerators/accelerator_unittest.cc
+@@ -58,7 +58,7 @@ TEST(AcceleratorTest, MAYBE_GetShortcutT
+ #if BUILDFLAG(IS_MAC)
+ {VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, nullptr, u"⌃⌘T"},
+ #endif
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, u"Super+Ctrl+T", nullptr},
+ #endif
+ };
diff --git a/electron34/patches/patch-ui_base_accelerators_media__keys__listener.cc b/electron34/patches/patch-ui_base_accelerators_media__keys__listener.cc
new file mode 100644
index 0000000000..f392da9897
--- /dev/null
+++ b/electron34/patches/patch-ui_base_accelerators_media__keys__listener.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/accelerators/media_keys_listener.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/accelerators/media_keys_listener.cc
+@@ -13,7 +13,8 @@ MediaKeysListener::~MediaKeysListener()
+ // static
+ bool MediaKeysListener::IsMediaKeycode(KeyboardCode key_code) {
+ return key_code == VKEY_MEDIA_PLAY_PAUSE || key_code == VKEY_MEDIA_STOP ||
+- key_code == VKEY_MEDIA_PREV_TRACK || key_code == VKEY_MEDIA_NEXT_TRACK;
++ key_code == VKEY_MEDIA_PREV_TRACK || key_code == VKEY_MEDIA_NEXT_TRACK ||
++ key_code == VKEY_VOLUME_UP || key_code == VKEY_VOLUME_DOWN || key_code == VKEY_VOLUME_MUTE;
+ }
+
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm b/electron34/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm
new file mode 100644
index 0000000000..33b55101d9
--- /dev/null
+++ b/electron34/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/accelerators/media_keys_listener_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/accelerators/media_keys_listener_mac.mm
+@@ -32,6 +32,12 @@ KeyboardCode MediaKeyCodeToKeyboardCode(
+ case NX_KEYTYPE_NEXT:
+ case NX_KEYTYPE_FAST:
+ return VKEY_MEDIA_NEXT_TRACK;
++ case NX_KEYTYPE_SOUND_UP:
++ return VKEY_VOLUME_UP;
++ case NX_KEYTYPE_SOUND_DOWN:
++ return VKEY_VOLUME_DOWN;
++ case NX_KEYTYPE_MUTE:
++ return VKEY_VOLUME_MUTE;
+ }
+ return VKEY_UNKNOWN;
+ }
+@@ -190,7 +196,10 @@ CGEventRef MediaKeysListenerImpl::EventT
+ int key_code = (data1 & 0xFFFF0000) >> 16;
+ if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
+ key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
+- key_code != NX_KEYTYPE_REWIND) {
++ key_code != NX_KEYTYPE_REWIND &&
++ key_code != NX_KEYTYPE_SOUND_UP &&
++ key_code != NX_KEYTYPE_SOUND_DOWN &&
++ key_code != NX_KEYTYPE_MUTE) {
+ return event;
+ }
+
diff --git a/electron34/patches/patch-ui_base_clipboard_clipboard__constants.cc b/electron34/patches/patch-ui_base_clipboard_clipboard__constants.cc
new file mode 100644
index 0000000000..08e2b32eb4
--- /dev/null
+++ b/electron34/patches/patch-ui_base_clipboard_clipboard__constants.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/clipboard/clipboard_constants.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/clipboard/clipboard_constants.cc
+@@ -25,7 +25,7 @@ const char kMimeTypeOctetStream[] = "app
+ // Used for window dragging on some platforms.
+ const char kMimeTypeWindowDrag[] = "chromium/x-window-drag";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ const char kMimeTypeLinuxUtf8String[] = "UTF8_STRING";
+ const char kMimeTypeLinuxString[] = "STRING";
+ const char kMimeTypeLinuxText[] = "TEXT";
diff --git a/electron34/patches/patch-ui_base_clipboard_clipboard__constants.h b/electron34/patches/patch-ui_base_clipboard_clipboard__constants.h
new file mode 100644
index 0000000000..f02e2d2e14
--- /dev/null
+++ b/electron34/patches/patch-ui_base_clipboard_clipboard__constants.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/clipboard/clipboard_constants.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/clipboard/clipboard_constants.h
+@@ -41,7 +41,7 @@ extern const char kMimeTypeWindowDrag[];
+
+ // ----- LINUX & CHROMEOS & FUCHSIA MIME TYPES -----
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES)
+ extern const char kMimeTypeLinuxUtf8String[];
+ COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES)
diff --git a/electron34/patches/patch-ui_base_clipboard_clipboard__non__backed.cc b/electron34/patches/patch-ui_base_clipboard_clipboard__non__backed.cc
new file mode 100644
index 0000000000..2416c1c968
--- /dev/null
+++ b/electron34/patches/patch-ui_base_clipboard_clipboard__non__backed.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/clipboard/clipboard_non_backed.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/clipboard/clipboard_non_backed.cc
+@@ -461,7 +461,7 @@ ClipboardNonBacked::ClipboardNonBacked()
+ // so create internal clipboards for platform supported clipboard buffers.
+ constexpr ClipboardBuffer kClipboardBuffers[] = {
+ ClipboardBuffer::kCopyPaste,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ ClipboardBuffer::kSelection,
+ #endif
+ #if BUILDFLAG(IS_MAC)
diff --git a/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc b/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc
new file mode 100644
index 0000000000..f85b091939
--- /dev/null
+++ b/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/clipboard/scoped_clipboard_writer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/clipboard/scoped_clipboard_writer.cc
+@@ -227,6 +227,16 @@ void ScopedClipboardWriter::WriteData(co
+ }
+ }
+
++void ScopedClipboardWriter::WriteUnsafeRawData(const std::u16string& format,
++ mojo_base::BigBuffer data) {
++ static constexpr int kMaxRegisteredFormats = 100;
++ if (counter_ >= kMaxRegisteredFormats)
++ return;
++ counter_++;
++ platform_representations_.push_back(
++ {base::UTF16ToUTF8(format), std::move(data)});
++}
++
+ void ScopedClipboardWriter::Reset() {
+ objects_.clear();
+ platform_representations_.clear();
diff --git a/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h b/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h
new file mode 100644
index 0000000000..67fb678dcf
--- /dev/null
+++ b/electron34/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/clipboard/scoped_clipboard_writer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/clipboard/scoped_clipboard_writer.h
+@@ -88,6 +88,10 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD
+ // This is only used to write custom format data.
+ void WriteData(const std::u16string& format, mojo_base::BigBuffer data);
+
++ // write raw (non-pickled) data to the clipboard
++ void WriteUnsafeRawData(const std::u16string& format,
++ mojo_base::BigBuffer data);
++
+ void WriteImage(const SkBitmap& bitmap);
+
+ // Mark the data to be written as confidential.
diff --git a/electron34/patches/patch-ui_base_cocoa_remote__accessibility__api.h b/electron34/patches/patch-ui_base_cocoa_remote__accessibility__api.h
new file mode 100644
index 0000000000..a063891cbf
--- /dev/null
+++ b/electron34/patches/patch-ui_base_cocoa_remote__accessibility__api.h
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/cocoa/remote_accessibility_api.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/cocoa/remote_accessibility_api.h
+@@ -10,9 +10,12 @@
+ #include <vector>
+
+ #include "base/component_export.h"
++#include "electron/mas.h"
+
+ // NSAccessibilityRemoteUIElement is a private class in AppKit.
+
++#if !IS_MAS_BUILD()
++
+ @interface NSAccessibilityRemoteUIElement : NSObject
+ + (void)setRemoteUIApp:(BOOL)flag;
+ + (BOOL)isRemoteUIApp;
+@@ -38,4 +41,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAc
+
+ } // namespace ui
+
++#endif // MAS_BUILD
++
+ #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
diff --git a/electron34/patches/patch-ui_base_cocoa_remote__layer__api.h b/electron34/patches/patch-ui_base_cocoa_remote__layer__api.h
new file mode 100644
index 0000000000..fb83adfb00
--- /dev/null
+++ b/electron34/patches/patch-ui_base_cocoa_remote__layer__api.h
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/cocoa/remote_layer_api.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/cocoa/remote_layer_api.h
+@@ -9,6 +9,7 @@
+
+ #include "base/component_export.h"
+ #include "build/build_config.h"
++#include "electron/mas.h"
+
+ #if defined(__OBJC__)
+ #import <Foundation/Foundation.h>
+@@ -17,6 +18,7 @@
+
+ #if BUILDFLAG(IS_MAC)
+
++#if !IS_MAS_BUILD()
+ // The CGSConnectionID is used to create the CAContext in the process that is
+ // going to share the CALayers that it is rendering to another process to
+ // display.
+@@ -68,6 +70,8 @@ extern NSString* const kCAContextIgnores
+
+ #endif // __OBJC__
+
++#endif // MAS_BUILD
++
+ namespace ui {
+
+ // This function will check if all of the interfaces listed above are supported
diff --git a/electron34/patches/patch-ui_base_cocoa_remote__layer__api.mm b/electron34/patches/patch-ui_base_cocoa_remote__layer__api.mm
new file mode 100644
index 0000000000..1796aba62f
--- /dev/null
+++ b/electron34/patches/patch-ui_base_cocoa_remote__layer__api.mm
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/cocoa/remote_layer_api.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/cocoa/remote_layer_api.mm
+@@ -5,11 +5,13 @@
+ #include "ui/base/cocoa/remote_layer_api.h"
+
+ #include "base/feature_list.h"
++#include "electron/mas.h"
+
+ #include <objc/runtime.h>
+
+ namespace ui {
+
++#if !IS_MAS_BUILD()
+ namespace {
+ // Control use of cross-process CALayers to display content directly from the
+ // GPU process on Mac.
+@@ -17,8 +19,10 @@ BASE_FEATURE(kRemoteCoreAnimationAPI,
+ "RemoteCoreAnimationAPI",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ } // namespace
++#endif
+
+ bool RemoteLayerAPISupported() {
++#if !IS_MAS_BUILD()
+ if (!base::FeatureList::IsEnabled(kRemoteCoreAnimationAPI))
+ return false;
+
+@@ -55,6 +59,9 @@ bool RemoteLayerAPISupported() {
+
+ // If everything is there, we should be able to use the API.
+ return true;
++#else
++ return false;
++#endif // MAS_BUILD
+ }
+
+ } // namespace
diff --git a/electron34/patches/patch-ui_base_cursor_cursor__factory.cc b/electron34/patches/patch-ui_base_cursor_cursor__factory.cc
new file mode 100644
index 0000000000..bab9b7b94a
--- /dev/null
+++ b/electron34/patches/patch-ui_base_cursor_cursor__factory.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/cursor/cursor_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/cursor/cursor_factory.cc
+@@ -96,7 +96,7 @@ void CursorFactory::ObserveThemeChanges(
+ NOTIMPLEMENTED();
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+
+ // Returns a cursor name compatible with either X11 or the FreeDesktop.org
+ // cursor spec ([1] and [2]), followed by fallbacks that can work as
diff --git a/electron34/patches/patch-ui_base_cursor_cursor__factory.h b/electron34/patches/patch-ui_base_cursor_cursor__factory.h
new file mode 100644
index 0000000000..9c05d6ecc2
--- /dev/null
+++ b/electron34/patches/patch-ui_base_cursor_cursor__factory.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/cursor/cursor_factory.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/cursor/cursor_factory.h
+@@ -93,7 +93,7 @@ class COMPONENT_EXPORT(UI_BASE_CURSOR) C
+ base::ObserverList<CursorFactoryObserver>::Unchecked observers_;
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(UI_BASE_CURSOR)
+ std::vector<std::string> CursorNamesFromType(mojom::CursorType type);
+ #endif
diff --git a/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc b/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc
new file mode 100644
index 0000000000..6699827f03
--- /dev/null
+++ b/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/dragdrop/os_exchange_data_provider_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/dragdrop/os_exchange_data_provider_factory.cc
+@@ -7,7 +7,7 @@
+ #include "base/notreached.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include "ui/base/dragdrop/os_exchange_data_provider_factory_ozone.h"
+ #include "ui/base/dragdrop/os_exchange_data_provider_non_backed.h"
+ #elif BUILDFLAG(IS_APPLE)
+@@ -21,7 +21,7 @@ namespace ui {
+ // static
+ std::unique_ptr<OSExchangeDataProvider>
+ OSExchangeDataProviderFactory::CreateProvider() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The instance can be nullptr in tests that do not instantiate the platform,
+ // or on platforms that do not implement specific drag'n'drop. For them,
+ // falling back to the Aura provider should be fine.
diff --git a/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc b/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc
new file mode 100644
index 0000000000..18b48b87a1
--- /dev/null
+++ b/electron34/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/dragdrop/os_exchange_data_provider_non_backed.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/dragdrop/os_exchange_data_provider_non_backed.cc
+@@ -98,7 +98,7 @@ void OSExchangeDataProviderNonBacked::Se
+
+ std::optional<std::u16string> OSExchangeDataProviderNonBacked::GetString()
+ const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (HasFile()) {
+ // Various Linux file managers both pass a list of file:// URIs and set the
+ // string representation to the URI. We explicitly don't want to return use
diff --git a/electron34/patches/patch-ui_base_ime_dummy__text__input__client.cc b/electron34/patches/patch-ui_base_ime_dummy__text__input__client.cc
new file mode 100644
index 0000000000..beb89bc496
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_dummy__text__input__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/dummy_text_input_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/dummy_text_input_client.cc
+@@ -175,7 +175,7 @@ bool DummyTextInputClient::ShouldDoLearn
+ return false;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool DummyTextInputClient::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
diff --git a/electron34/patches/patch-ui_base_ime_dummy__text__input__client.h b/electron34/patches/patch-ui_base_ime_dummy__text__input__client.h
new file mode 100644
index 0000000000..b795399681
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_dummy__text__input__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/dummy_text_input_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/dummy_text_input_client.h
+@@ -73,7 +73,7 @@ class DummyTextInputClient : public Text
+ ukm::SourceId GetClientSourceForMetrics() const override;
+ bool ShouldDoLearning() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
diff --git a/electron34/patches/patch-ui_base_ime_fake__text__input__client.cc b/electron34/patches/patch-ui_base_ime_fake__text__input__client.cc
new file mode 100644
index 0000000000..7d00254edb
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_fake__text__input__client.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/fake_text_input_client.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/fake_text_input_client.cc
+@@ -227,7 +227,7 @@ bool FakeTextInputClient::ShouldDoLearni
+ return should_do_learning_;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool FakeTextInputClient::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
diff --git a/electron34/patches/patch-ui_base_ime_fake__text__input__client.h b/electron34/patches/patch-ui_base_ime_fake__text__input__client.h
new file mode 100644
index 0000000000..fb23791857
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_fake__text__input__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/fake_text_input_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/fake_text_input_client.h
+@@ -107,7 +107,7 @@ class FakeTextInputClient : public TextI
+ void SetTextEditCommandForNextKeyEvent(TextEditCommand command) override;
+ ukm::SourceId GetClientSourceForMetrics() const override;
+ bool ShouldDoLearning() override;
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
diff --git a/electron34/patches/patch-ui_base_ime_init_input__method__initializer.cc b/electron34/patches/patch-ui_base_ime_init_input__method__initializer.cc
new file mode 100644
index 0000000000..111f99553f
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_init_input__method__initializer.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/init/input_method_initializer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/init/input_method_initializer.cc
+@@ -8,7 +8,7 @@
+ #include "base/functional/callback.h"
+ #include "build/build_config.h"
+
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ #include "ui/base/ime/linux/fake_input_method_context.h"
+ #include "ui/base/ime/linux/linux_input_method_context_factory.h"
+ #elif BUILDFLAG(IS_WIN)
+@@ -31,7 +31,7 @@ void ShutdownInputMethod() {
+ }
+
+ void InitializeInputMethodForTesting() {
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ GetInputMethodContextFactoryForTest() =
+ base::BindRepeating([](LinuxInputMethodContextDelegate* delegate)
+ -> std::unique_ptr<LinuxInputMethodContext> {
+@@ -43,7 +43,7 @@ void InitializeInputMethodForTesting() {
+ }
+
+ void ShutdownInputMethodForTesting() {
+-#if defined(USE_AURA) && BUILDFLAG(IS_LINUX)
++#if defined(USE_AURA) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ // The function owns the factory (as a static variable that's returned by
+ // reference), so setting this to an empty factory will free the old one.
+ GetInputMethodContextFactoryForTest() = LinuxInputMethodContextFactory();
diff --git a/electron34/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc b/electron34/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc
new file mode 100644
index 0000000000..c83d55a00e
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/linux/linux_input_method_context_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/linux/linux_input_method_context_factory.cc
+@@ -9,7 +9,7 @@
+ #include "build/build_config.h"
+ #include "ui/base/ime/linux/fake_input_method_context.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #include "ui/linux/linux_ui_delegate.h"
+ #endif
+@@ -32,7 +32,7 @@ std::unique_ptr<LinuxInputMethodContext>
+ if (auto factory = GetInputMethodContextFactoryForTest())
+ return factory.Run(delegate);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Give the toolkit a chance to create the context.
+ if (auto* linux_ui = LinuxUi::instance()) {
+ if (auto context = linux_ui->CreateInputMethodContext(delegate))
diff --git a/electron34/patches/patch-ui_base_ime_text__input__client.h b/electron34/patches/patch-ui_base_ime_text__input__client.h
new file mode 100644
index 0000000000..6b27d8ac22
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ime_text__input__client.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ime/text_input_client.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ime/text_input_client.h
+@@ -331,7 +331,7 @@ class COMPONENT_EXPORT(UI_BASE_IME) Text
+ // fields that are considered 'private' (e.g. in incognito tabs).
+ virtual bool ShouldDoLearning() = 0;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Start composition over a given UTF-16 code range from existing text. This
+ // should only be used for composition scenario when IME wants to start
+ // composition on existing text. Returns whether the operation was successful.
diff --git a/electron34/patches/patch-ui_base_resource_resource__bundle.cc b/electron34/patches/patch-ui_base_resource_resource__bundle.cc
new file mode 100644
index 0000000000..e744b0fb3a
--- /dev/null
+++ b/electron34/patches/patch-ui_base_resource_resource__bundle.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/resource/resource_bundle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/resource/resource_bundle.cc
+@@ -924,7 +924,7 @@ void ResourceBundle::ReloadFonts() {
+ }
+
+ ResourceScaleFactor ResourceBundle::GetMaxResourceScaleFactor() const {
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return max_scale_factor_;
+ #else
+ return GetMaxSupportedResourceScaleFactor();
diff --git a/electron34/patches/patch-ui_base_test_skia__gold__pixel__diff.cc b/electron34/patches/patch-ui_base_test_skia__gold__pixel__diff.cc
new file mode 100644
index 0000000000..c4def07d6a
--- /dev/null
+++ b/electron34/patches/patch-ui_base_test_skia__gold__pixel__diff.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/test/skia_gold_pixel_diff.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/test/skia_gold_pixel_diff.cc
+@@ -112,7 +112,7 @@ const char* GetPlatformName() {
+ return "windows";
+ #elif BUILDFLAG(IS_APPLE)
+ return "macOS";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "linux";
+ #elif BUILDFLAG(IS_CHROMEOS)
+ return "ash";
diff --git a/electron34/patches/patch-ui_base_test_ui__controls.h b/electron34/patches/patch-ui_base_test_ui__controls.h
new file mode 100644
index 0000000000..0c87944511
--- /dev/null
+++ b/electron34/patches/patch-ui_base_test_ui__controls.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/test/ui_controls.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/test/ui_controls.h
+@@ -184,7 +184,7 @@ bool SendTouchEventsNotifyWhenDone(int a
+ base::OnceClosure task);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Forces the platform implementation to use screen coordinates, even if they're
+ // not really available, the next time that ui_controls::SendMouseMove() or
+ // ui_controls::SendMouseMoveNotifyWhenDone() is called, or some other method
diff --git a/electron34/patches/patch-ui_base_ui__base__features.cc b/electron34/patches/patch-ui_base_ui__base__features.cc
new file mode 100644
index 0000000000..fcdbef35cc
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ui__base__features.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ui_base_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ui_base_features.cc
+@@ -147,7 +147,7 @@ BASE_FEATURE(kWaylandUiScale,
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_OZONE)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // If this feature is enabled, users not specify --ozone-platform-hint switch
+ // will get --ozone-platform-hint=auto treatment. https://crbug.com/40250220.
+ COMPONENT_EXPORT(UI_BASE_FEATURES)
+@@ -247,7 +247,7 @@ BASE_FEATURE(kUiCompositorScrollWithLaye
+ // native apps on Windows.
+ BASE_FEATURE(kExperimentalFlingAnimation,
+ "ExperimentalFlingAnimation",
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -337,7 +337,7 @@ bool IsForcedColorsEnabled() {
+ BASE_FEATURE(kEyeDropper,
+ "EyeDropper",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron34/patches/patch-ui_base_ui__base__features.h b/electron34/patches/patch-ui_base_ui__base__features.h
new file mode 100644
index 0000000000..50116d24a4
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ui__base__features.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ui_base_features.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ui_base_features.h
+@@ -138,7 +138,7 @@ COMPONENT_EXPORT(UI_BASE_FEATURES)
+ BASE_DECLARE_FEATURE(kWaylandUiScale);
+ #endif // BUILDFLAG(IS_OZONE)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(UI_BASE_FEATURES)
+ BASE_DECLARE_FEATURE(kOverrideDefaultOzonePlatformHintToAuto);
+ #endif // BUILDFLAG(IS_LINUX)
diff --git a/electron34/patches/patch-ui_base_ui__base__switches.cc b/electron34/patches/patch-ui_base_ui__base__switches.cc
new file mode 100644
index 0000000000..5e86c6fac7
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ui__base__switches.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ui_base_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ui_base_switches.cc
+@@ -24,13 +24,13 @@ const char kDisableModalAnimations[] = "
+ const char kShowMacOverlayBorders[] = "show-mac-overlay-borders";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Specifies system font family name. Improves determenism when rendering
+ // pages in headless mode.
+ const char kSystemFontFamily[] = "system-font-family";
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Specify the toolkit used to construct the Linux GUI.
+ const char kUiToolkitFlag[] = "ui-toolkit";
+ // Disables GTK IME integration.
diff --git a/electron34/patches/patch-ui_base_ui__base__switches.h b/electron34/patches/patch-ui_base_ui__base__switches.h
new file mode 100644
index 0000000000..465c8810f4
--- /dev/null
+++ b/electron34/patches/patch-ui_base_ui__base__switches.h
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/ui_base_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/ui_base_switches.h
+@@ -22,11 +22,11 @@ COMPONENT_EXPORT(UI_BASE) extern const c
+ COMPONENT_EXPORT(UI_BASE) extern const char kShowMacOverlayBorders[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(UI_BASE) extern const char kSystemFontFamily[];
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ COMPONENT_EXPORT(UI_BASE) extern const char kUiToolkitFlag[];
+ COMPONENT_EXPORT(UI_BASE) extern const char kDisableGtkIme[];
+ #endif
diff --git a/electron34/patches/patch-ui_base_webui_web__ui__util.cc b/electron34/patches/patch-ui_base_webui_web__ui__util.cc
new file mode 100644
index 0000000000..28a88408c6
--- /dev/null
+++ b/electron34/patches/patch-ui_base_webui_web__ui__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/webui/web_ui_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/webui/web_ui_util.cc
+@@ -43,7 +43,7 @@ namespace {
+ constexpr float kMaxScaleFactor = 1000.0f;
+
+ std::string GetFontFamilyMd() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "Roboto, " + GetFontFamily();
+ #else
+ return GetFontFamily();
+@@ -218,7 +218,7 @@ void AppendWebUiCssTextDefaults(std::str
+ std::string GetFontFamily() {
+ std::string font_family = l10n_util::GetStringUTF8(IDS_WEB_FONT_FAMILY);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::string font_name = ui::ResourceBundle::GetSharedInstance()
+ .GetFont(ui::ResourceBundle::BaseFont)
+ .GetFontName();
diff --git a/electron34/patches/patch-ui_base_x_x11__cursor__factory.cc b/electron34/patches/patch-ui_base_x_x11__cursor__factory.cc
new file mode 100644
index 0000000000..9c64682e38
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__cursor__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_cursor_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_cursor_factory.cc
+@@ -13,7 +13,7 @@
+ #include "ui/gfx/geometry/point.h"
+ #include "ui/gfx/x/connection.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -70,7 +70,7 @@ scoped_refptr<PlatformCursor> X11CursorF
+ }
+
+ void X11CursorFactory::ObserveThemeChanges() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* linux_ui = LinuxUi::instance();
+ DCHECK(linux_ui);
+ cursor_theme_observation_.Observe(linux_ui);
diff --git a/electron34/patches/patch-ui_base_x_x11__cursor__factory.h b/electron34/patches/patch-ui_base_x_x11__cursor__factory.h
new file mode 100644
index 0000000000..471f1eca3a
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__cursor__factory.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_cursor_factory.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_cursor_factory.h
+@@ -20,7 +20,7 @@ namespace ui {
+ class X11Cursor;
+ class XCursorLoader;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class LinuxUi;
+ #endif
+
+@@ -62,7 +62,7 @@ class COMPONENT_EXPORT(UI_BASE_X) X11Cur
+ // initializing `cursor_loader_` will modify `default_cursors_`.
+ std::unique_ptr<XCursorLoader> cursor_loader_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<LinuxUi, CursorThemeManagerObserver>
+ cursor_theme_observation_{this};
+ #endif
diff --git a/electron34/patches/patch-ui_base_x_x11__cursor__loader.cc b/electron34/patches/patch-ui_base_x_x11__cursor__loader.cc
new file mode 100644
index 0000000000..c9d894d397
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__cursor__loader.cc
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_cursor_loader.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_cursor_loader.cc
+@@ -34,7 +34,7 @@
+ #include "ui/gfx/x/connection.h"
+ #include "ui/gfx/x/xproto.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -59,7 +59,11 @@ std::string CursorPathFromLibXcursor() {
+ void operator()(void* ptr) const { dlclose(ptr); }
+ };
+
++#if BUILDFLAG(IS_BSD)
++ std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so", RTLD_LAZY));
++#else
+ std::unique_ptr<void, DlCloser> lib(dlopen("libXcursor.so.1", RTLD_LAZY));
++#endif
+ if (!lib)
+ return "";
+
+@@ -170,7 +174,7 @@ scoped_refptr<base::RefCountedMemory> Re
+ const std::string& rm_xcursor_theme) {
+ constexpr const char kDefaultTheme[] = "default";
+ std::string themes[] = {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The toolkit theme has the highest priority.
+ LinuxUi::instance() ? LinuxUi::instance()->GetCursorThemeName()
+ : std::string(),
+@@ -359,7 +363,7 @@ uint32_t XCursorLoader::GetPreferredCurs
+ return size;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Let the toolkit have the next say.
+ auto* linux_ui = LinuxUi::instance();
+ size = linux_ui ? linux_ui->GetCursorThemeSize() : 0;
diff --git a/electron34/patches/patch-ui_base_x_x11__display__manager.cc b/electron34/patches/patch-ui_base_x_x11__display__manager.cc
new file mode 100644
index 0000000000..bdb958bf22
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__display__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_display_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_display_manager.cc
+@@ -16,7 +16,7 @@
+ #include "ui/gfx/x/randr.h"
+ #include "ui/gfx/x/xproto.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -92,7 +92,7 @@ void XDisplayManager::FetchDisplayList()
+ ? display::Display::GetForcedDeviceScaleFactor()
+ : 1.0f};
+ const auto* display_config = &empty_display_config;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (const auto* linux_ui = ui::LinuxUi::instance()) {
+ display_config = &linux_ui->display_config();
+ }
diff --git a/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.cc b/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.cc
new file mode 100644
index 0000000000..92d79016b2
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.cc
@@ -0,0 +1,84 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_global_shortcut_listener.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_global_shortcut_listener.cc
+@@ -36,11 +36,13 @@ const x11::ModMask kModifiersMasks[] = {
+
+ x11::ModMask GetNativeModifiers(bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
++ bool is_shift_down,
++ bool is_cmd_down) {
+ constexpr auto kNoMods = x11::ModMask{};
+ return (is_shift_down ? x11::ModMask::Shift : kNoMods) |
+ (is_ctrl_down ? x11::ModMask::Control : kNoMods) |
+- (is_alt_down ? x11::ModMask::c_1 : kNoMods);
++ (is_alt_down ? x11::ModMask::c_1 : kNoMods) |
++ (is_cmd_down ? x11::ModMask::c_4 : kNoMods);
+ }
+
+ } // namespace
+@@ -86,8 +88,9 @@ uint32_t XGlobalShortcutListener::Dispat
+ bool XGlobalShortcutListener::RegisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
+- auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down);
++ bool is_shift_down,
++ bool is_cmd_down) {
++ auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
+ auto keysym = XKeysymForWindowsKeyCode(key_code, false);
+ auto keycode = connection_->KeysymToKeycode(keysym);
+
+@@ -112,7 +115,7 @@ bool XGlobalShortcutListener::RegisterAc
+ }
+
+ registered_combinations_.insert(
+- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down));
++ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down));
+
+ return true;
+ }
+@@ -120,8 +123,9 @@ bool XGlobalShortcutListener::RegisterAc
+ void XGlobalShortcutListener::UnregisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
+- auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down);
++ bool is_shift_down,
++ bool is_cmd_down) {
++ auto modifiers = GetNativeModifiers(is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
+ auto keysym = XKeysymForWindowsKeyCode(key_code, false);
+ auto keycode = connection_->KeysymToKeycode(keysym);
+
+@@ -129,7 +133,7 @@ void XGlobalShortcutListener::Unregister
+ connection_->UngrabKey({keycode, x_root_window_, modifiers | mask});
+
+ registered_combinations_.erase(
+- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down));
++ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down));
+ }
+
+ void XGlobalShortcutListener::OnKeyPressEvent(const KeyEvent& event) {
+@@ -139,14 +143,15 @@ void XGlobalShortcutListener::OnKeyPress
+ const bool is_alt_down = event.flags() & EF_ALT_DOWN;
+ const bool is_ctrl_down = event.flags() & EF_CONTROL_DOWN;
+ const bool is_shift_down = event.flags() & EF_SHIFT_DOWN;
++ const bool is_cmd_down = event.flags() & EF_COMMAND_DOWN;
+
+ if (!base::Contains(
+ registered_combinations_,
+- Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down))) {
++ Accelerator(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down))) {
+ return;
+ }
+
+- OnKeyPressed(key_code, is_alt_down, is_ctrl_down, is_shift_down);
++ OnKeyPressed(key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
+ }
+
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.h b/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.h
new file mode 100644
index 0000000000..6a8d196a3f
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__global__shortcut__listener.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_global_shortcut_listener.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_global_shortcut_listener.h
+@@ -42,18 +42,21 @@ class COMPONENT_EXPORT(UI_BASE_X) XGloba
+ virtual void OnKeyPressed(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) = 0;
++ bool is_shift_down,
++ bool is_cmd_down) = 0;
+
+ void StartListening();
+ void StopListening();
+ bool RegisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down);
++ bool is_shift_down,
++ bool is_cmd_down);
+ void UnregisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down);
++ bool is_shift_down,
++ bool is_cmd_down);
+
+ private:
+ // Due to how system key grabbing works on X11, we have to be a bit greedy and
+@@ -62,7 +65,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XGloba
+ // and filter the incoming events against that registry before notifying the
+ // observer. This tuple describes the meaningful parts of the event; booleans
+ // 1, 2, and 3 hold states of Alt, Control, and Shift keys, respectively.
+- using Accelerator = std::tuple<KeyboardCode, bool, bool, bool>;
++ using Accelerator = std::tuple<KeyboardCode, bool, bool, bool, bool>;
+
+ // Invoked when a global shortcut is pressed.
+ void OnKeyPressEvent(const KeyEvent& event);
diff --git a/electron34/patches/patch-ui_base_x_x11__shm__image__pool.cc b/electron34/patches/patch-ui_base_x_x11__shm__image__pool.cc
new file mode 100644
index 0000000000..a5c56549ea
--- /dev/null
+++ b/electron34/patches/patch-ui_base_x_x11__shm__image__pool.cc
@@ -0,0 +1,77 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/base/x/x11_shm_image_pool.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/base/x/x11_shm_image_pool.cc
+@@ -16,6 +16,7 @@
+ #include "base/functional/callback.h"
+ #include "base/location.h"
+ #include "base/strings/string_util.h"
++#include "base/system/sys_info.h"
+ #include "build/build_config.h"
+ #include "net/base/url_util.h"
+ #include "ui/events/platform/platform_event_dispatcher.h"
+@@ -44,10 +45,14 @@ constexpr float kShmResizeShrinkThreshol
+ 1.0f / (kShmResizeThreshold * kShmResizeThreshold);
+
+ std::size_t MaxShmSegmentSizeImpl() {
++#if BUILDFLAG(IS_BSD)
++ return base::SysInfo::MaxSharedMemorySize();
++#else
+ struct shminfo info;
+ if (shmctl(0, IPC_INFO, reinterpret_cast<struct shmid_ds*>(&info)) == -1)
+ return 0;
+ return info.shmmax;
++#endif
+ }
+
+ std::size_t MaxShmSegmentSize() {
+@@ -56,14 +61,19 @@ std::size_t MaxShmSegmentSize() {
+ }
+
+ #if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_BSD)
+ bool IsRemoteHost(const std::string& name) {
+ if (name.empty())
+ return false;
+
+ return !net::HostStringIsLocalhost(name);
+ }
++#endif
+
+ bool ShouldUseMitShm(x11::Connection* connection) {
++#if BUILDFLAG(IS_BSD)
++ return false;
++#else
+ // MIT-SHM may be available on remote connetions, but it will be unusable. Do
+ // a best-effort check to see if the host is remote to disable the SHM
+ // codepath. It may be possible in contrived cases for there to be a
+@@ -92,6 +102,7 @@ bool ShouldUseMitShm(x11::Connection* co
+ return false;
+
+ return true;
++#endif
+ }
+ #endif // !BUILDFLAG(IS_CHROMEOS)
+
+@@ -182,7 +193,7 @@ bool XShmImagePool::Resize(const gfx::Si
+ shmctl(state.shmid, IPC_RMID, nullptr);
+ return false;
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, a shmid can still be attached after IPC_RMID if otherwise
+ // kept alive. Detach before XShmAttach to prevent a memory leak in case
+ // the process dies.
+@@ -201,7 +212,7 @@ bool XShmImagePool::Resize(const gfx::Si
+ return false;
+ state.shmseg = shmseg;
+ state.shmem_attached_to_server = true;
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // The Linux-specific shmctl behavior above may not be portable, so we're
+ // forced to do IPC_RMID after the server has attached to the segment.
+ shmctl(state.shmid, IPC_RMID, nullptr);
diff --git a/electron34/patches/patch-ui_color_color__id.h b/electron34/patches/patch-ui_color_color__id.h
new file mode 100644
index 0000000000..049e5406b0
--- /dev/null
+++ b/electron34/patches/patch-ui_color_color__id.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/color/color_id.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/color/color_id.h
+@@ -405,6 +405,10 @@
+ E_CPONLY(kColorRadioButtonForegroundUnchecked) \
+ E_CPONLY(kColorRadioButtonForegroundDisabled) \
+ E_CPONLY(kColorRadioButtonForegroundChecked) \
++ E_CPONLY(kColorResultsTableNormalBackground) \
++ E_CPONLY(kColorResultsTableHoveredBackground) \
++ E_CPONLY(kColorResultsTableNormalText) \
++ E_CPONLY(kColorResultsTableDimmedText) \
+ E_CPONLY(kColorSegmentedButtonBorder) \
+ E_CPONLY(kColorSegmentedButtonFocus) \
+ E_CPONLY(kColorSegmentedButtonForegroundChecked) \
+@@ -510,6 +514,7 @@
+ E_CPONLY(kColorTreeNodeForeground) \
+ E_CPONLY(kColorTreeNodeForegroundSelectedFocused) \
+ E_CPONLY(kColorTreeNodeForegroundSelectedUnfocused) \
++ E_CPONLY(kColorUnfocusedBorder) \
+ /* These colors are used to paint the controls defined in */ \
+ /* ui::NativeThemeBase::ControlColorId. */ \
+ E_CPONLY(kColorWebNativeControlAccent) \
+@@ -618,7 +623,7 @@
+ \
+ E_CPONLY(kColorCrosSysPositive) \
+ E_CPONLY(kColorCrosSysComplementVariant)
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define PLATFORM_SPECIFIC_COLOR_IDS \
+ E_CPONLY(kColorNativeButtonBorder)\
+ E_CPONLY(kColorNativeHeaderButtonBorderActive) \
diff --git a/electron34/patches/patch-ui_color_color__provider__utils.cc b/electron34/patches/patch-ui_color_color__provider__utils.cc
new file mode 100644
index 0000000000..98d323409f
--- /dev/null
+++ b/electron34/patches/patch-ui_color_color__provider__utils.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/color/color_provider_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/color/color_provider_utils.cc
+@@ -189,7 +189,7 @@ std::string_view SystemThemeName(ui::Sys
+ switch (system_theme) {
+ case ui::SystemTheme::kDefault:
+ return "kDefault";
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case ui::SystemTheme::kGtk:
+ return "kGtk";
+ case ui::SystemTheme::kQt:
diff --git a/electron34/patches/patch-ui_color_system__theme.h b/electron34/patches/patch-ui_color_system__theme.h
new file mode 100644
index 0000000000..655aff6e8c
--- /dev/null
+++ b/electron34/patches/patch-ui_color_system__theme.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/color/system_theme.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/color/system_theme.h
+@@ -15,7 +15,7 @@ namespace ui {
+ enum class SystemTheme {
+ // Classic theme, used in the default or users' chosen theme.
+ kDefault = 0,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kGtk = 1,
+ kQt = 2,
+ kMaxValue = kQt,
diff --git a/electron34/patches/patch-ui_color_ui__color__mixer.cc b/electron34/patches/patch-ui_color_ui__color__mixer.cc
new file mode 100644
index 0000000000..a7c965d5f6
--- /dev/null
+++ b/electron34/patches/patch-ui_color_ui__color__mixer.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/color/ui_color_mixer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/color/ui_color_mixer.cc
+@@ -181,6 +181,17 @@ void AddUiColorMixer(ColorProvider* prov
+ mixer[kColorProgressBarPaused] = {kColorDisabledForeground};
+ mixer[kColorRadioButtonForegroundChecked] = {kColorButtonForeground};
+ mixer[kColorRadioButtonForegroundUnchecked] = {kColorSecondaryForeground};
++ mixer[kColorResultsTableNormalBackground] = {SK_ColorWHITE};
++ mixer[kColorResultsTableHoveredBackground] =
++ SetAlpha(kColorResultsTableNormalText, 0x0D);
++ mixer[kColorResultsTableNormalText] = {SK_ColorBLACK};
++ mixer[kColorResultsTableDimmedText] = {SkColorSetRGB(0x64, 0x64, 0x64)};
++ if (dark_mode) {
++ mixer[kColorResultsTableNormalBackground] = {SkColorSetRGB(0x28, 0x28, 0x28)};
++ mixer[kColorResultsTableNormalText] = {SK_ColorWHITE};
++ mixer[kColorResultsTableDimmedText] =
++ SetAlpha(kColorResultsTableNormalText, 0x80);
++ }
+ mixer[kColorSeparator] = {kColorMidground};
+ mixer[kColorShadowBase] = {dark_mode ? SK_ColorBLACK : gfx::kGoogleGrey800};
+ mixer[kColorShadowValueAmbientShadowElevationThree] =
+@@ -276,6 +287,7 @@ void AddUiColorMixer(ColorProvider* prov
+ mixer[kColorTreeNodeForegroundSelectedFocused] = {kColorTreeNodeForeground};
+ mixer[kColorTreeNodeForegroundSelectedUnfocused] = {
+ kColorTreeNodeForegroundSelectedFocused};
++ mixer[kColorUnfocusedBorder] = {kColorMidground};
+ mixer[kColorWebNativeControlAccent] = {dark_mode
+ ? SkColorSetRGB(0x99, 0xC8, 0xFF)
+ : SkColorSetRGB(0x00, 0x75, 0xFF)};
diff --git a/electron34/patches/patch-ui_color_win_native__color__mixers__win.cc b/electron34/patches/patch-ui_color_win_native__color__mixers__win.cc
new file mode 100644
index 0000000000..71f0b5b880
--- /dev/null
+++ b/electron34/patches/patch-ui_color_win_native__color__mixers__win.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/color/win/native_color_mixers_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/color/win/native_color_mixers_win.cc
+@@ -171,6 +171,10 @@ void AddNativeUiColorMixer(ColorProvider
+ SetAlpha(kColorNotificationInputForeground, gfx::kGoogleGreyAlpha700);
+ mixer[kColorSliderTrack] = AlphaBlend(
+ kColorNativeHighlight, kColorNativeWindow, gfx::kGoogleGreyAlpha400);
++ mixer[kColorResultsTableHoveredBackground] = AlphaBlend(
++ kColorNativeHighlight, kColorNativeWindow, gfx::kGoogleGreyAlpha400);
++ mixer[kColorResultsTableDimmedText] = AlphaBlend(
++ kColorNativeWindowText, kColorNativeWindow, gfx::kGoogleGreyAlpha600);
+
+ // Window Background
+ mixer[kColorBubbleFooterBackground] = {kColorNativeWindow};
+@@ -179,6 +183,7 @@ void AddNativeUiColorMixer(ColorProvider
+ mixer[kColorFrameInactive] = {kColorNativeWindow};
+ mixer[kColorPrimaryBackground] = {kColorNativeWindow};
+ mixer[kColorTooltipBackground] = {kColorNativeWindow};
++ mixer[kColorResultsTableNormalBackground] = {kColorNativeWindow};
+
+ // Window Text
+ mixer[kColorAlertLowSeverity] = {kColorNativeWindowText};
+@@ -192,6 +197,7 @@ void AddNativeUiColorMixer(ColorProvider
+ mixer[kColorTableGroupingIndicator] = {kColorNativeWindowText};
+ mixer[kColorThrobber] = {kColorNativeWindowText};
+ mixer[kColorTooltipForeground] = {kColorNativeWindowText};
++ mixer[kColorResultsTableNormalText] = {kColorNativeWindowText};
+
+ // Hyperlinks
+ mixer[kColorLinkForegroundDefault] = {kColorNativeHotlight};
+@@ -234,6 +240,7 @@ void AddNativeUiColorMixer(ColorProvider
+ mixer[kColorTextfieldForeground] = {kColorNativeBtnText};
+ mixer[kColorTextfieldForegroundPlaceholder] = {kColorNativeBtnText};
+ mixer[kColorTextfieldForegroundDisabled] = {kColorNativeBtnText};
++ mixer[kColorUnfocusedBorder] = {kColorNativeBtnText};
+
+ // Highlight/Selected Background
+ mixer[kColorAccent] = {kColorNativeHighlight};
diff --git a/electron34/patches/patch-ui_compositor_compositor.cc b/electron34/patches/patch-ui_compositor_compositor.cc
new file mode 100644
index 0000000000..fe5eacc848
--- /dev/null
+++ b/electron34/patches/patch-ui_compositor_compositor.cc
@@ -0,0 +1,54 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/compositor/compositor.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/compositor/compositor.cc
+@@ -343,7 +343,8 @@ void Compositor::SetLayerTreeFrameSink(
+ if (display_private_) {
+ disabled_swap_until_resize_ = false;
+ display_private_->Resize(size());
+- display_private_->SetDisplayVisible(host_->IsVisible());
++ // Invisible display is throttling itself.
++ display_private_->SetDisplayVisible(background_throttling_ ? host_->IsVisible() : true);
+ display_private_->SetDisplayColorSpaces(display_color_spaces_);
+ display_private_->SetDisplayColorMatrix(
+ gfx::SkM44ToTransform(display_color_matrix_));
+@@ -554,7 +555,9 @@ void Compositor::SetVisible(bool visible
+ // updated then. We need to call this even if the visibility hasn't changed,
+ // for the same reason.
+ if (display_private_)
+- display_private_->SetDisplayVisible(visible);
++ // Invisible display is throttling itself.
++ display_private_->SetDisplayVisible(
++ background_throttling_ ? visible : true);
+
+ if (changed) {
+ observer_list_.Notify(&CompositorObserver::OnCompositorVisibilityChanged,
+@@ -912,7 +915,7 @@ void Compositor::OnResume() {
+ obs.ResetIfActive();
+ }
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void Compositor::OnCompleteSwapWithNewSize(const gfx::Size& size) {
+ observer_list_.Notify(
+ &CompositorObserver::OnCompositingCompleteSwapWithNewSize, this, size);
+@@ -1005,6 +1008,15 @@ void Compositor::MaybeUpdateObserveBegin
+ host_begin_frame_observer_->GetBoundRemote());
+ }
+
++void Compositor::SetBackgroundThrottling(bool background_throttling_enabled) {
++ background_throttling_ = background_throttling_enabled;
++ if (display_private_) {
++ // Invisible display is throttling itself.
++ display_private_->SetDisplayVisible(
++ background_throttling_ ? host_->IsVisible() : true);
++ }
++}
++
+ #if BUILDFLAG(IS_CHROMEOS)
+ void Compositor::SetSeamlessRefreshRates(
+ const std::vector<float>& seamless_refresh_rates) {
diff --git a/electron34/patches/patch-ui_compositor_compositor.h b/electron34/patches/patch-ui_compositor_compositor.h
new file mode 100644
index 0000000000..4ff0f1e119
--- /dev/null
+++ b/electron34/patches/patch-ui_compositor_compositor.h
@@ -0,0 +1,85 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/compositor/compositor.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/compositor/compositor.h
+@@ -89,6 +89,7 @@ namespace mojom {
+ class DisplayPrivate;
+ class ExternalBeginFrameController;
+ } // namespace mojom
++class HostDisplayClient;
+ class HostFrameSinkManager;
+ class LocalSurfaceId;
+ class RasterContextProvider;
+@@ -140,6 +141,16 @@ class COMPOSITOR_EXPORT ContextFactory {
+ virtual viz::HostFrameSinkManager* GetHostFrameSinkManager() = 0;
+ };
+
++class COMPOSITOR_EXPORT CompositorDelegate {
++ public:
++ virtual bool IsOffscreen() const = 0;
++ virtual std::unique_ptr<viz::HostDisplayClient> CreateHostDisplayClient(
++ ui::Compositor* compositor) = 0;
++
++ protected:
++ virtual ~CompositorDelegate() {}
++};
++
+ // Compositor object to take care of GPU painting.
+ // A Browser compositor object is responsible for generating the final
+ // displayable form of pixels comprising a single widget's contents. It draws an
+@@ -183,6 +194,9 @@ class COMPOSITOR_EXPORT Compositor : pub
+ // Schedules a redraw of the layer tree associated with this compositor.
+ void ScheduleDraw();
+
++ CompositorDelegate* delegate() const { return delegate_; }
++ void SetDelegate(CompositorDelegate* delegate) { delegate_ = delegate; }
++
+ // Sets the root of the layer tree drawn by this Compositor. The root layer
+ // must have no parent. The compositor's root layer is reset if the root layer
+ // is destroyed. NULL can be passed to reset the root layer, in which case the
+@@ -456,7 +470,7 @@ class COMPOSITOR_EXPORT Compositor : pub
+ // base::PowerSuspendObserver:
+ void OnResume() override;
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ void OnCompleteSwapWithNewSize(const gfx::Size& size);
+ #endif // BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
+
+@@ -495,6 +509,10 @@ class COMPOSITOR_EXPORT Compositor : pub
+
+ const cc::LayerTreeSettings& GetLayerTreeSettings() const;
+
++ // Sets |background_throttling_| responsible for suspending drawing
++ // and switching frames.
++ void SetBackgroundThrottling(bool background_throttling_enabled);
++
+ size_t saved_events_metrics_count_for_testing() const {
+ return host_->saved_events_metrics_count_for_testing();
+ }
+@@ -562,6 +580,8 @@ class COMPOSITOR_EXPORT Compositor : pub
+ simple_begin_frame_observers_;
+ std::unique_ptr<ui::HostBeginFrameObserver> host_begin_frame_observer_;
+
++ raw_ptr<CompositorDelegate> delegate_ = nullptr;
++
+ // The root of the Layer tree drawn by this compositor.
+ raw_ptr<Layer> root_layer_ = nullptr;
+
+@@ -641,6 +661,12 @@ class COMPOSITOR_EXPORT Compositor : pub
+ // See go/report-ux-metrics-at-painting for details.
+ bool animation_started_ = false;
+
++ // Background throttling is a default Chromium behaviour. It occurs
++ // when the |display_private_| is not visible by prevent drawing and swapping
++ // frames. When it is disabled we are keeping |display_private_| always
++ // visible in order to keep generating frames.
++ bool background_throttling_ = true;
++
+ TrackerId next_throughput_tracker_id_ = 1u;
+ struct TrackerState {
+ TrackerState();
diff --git a/electron34/patches/patch-ui_compositor_compositor__observer.h b/electron34/patches/patch-ui_compositor_compositor__observer.h
new file mode 100644
index 0000000000..56f0f7ad77
--- /dev/null
+++ b/electron34/patches/patch-ui_compositor_compositor__observer.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/compositor/compositor_observer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/compositor/compositor_observer.h
+@@ -52,7 +52,7 @@ class COMPOSITOR_EXPORT CompositorObserv
+ // Called when a child of the compositor is resizing.
+ virtual void OnCompositingChildResizing(Compositor* compositor) {}
+
+-#if BUILDFLAG(IS_LINUX) && BUILDFLAG(IS_OZONE_X11)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && BUILDFLAG(IS_OZONE_X11)
+ // Called when a swap with new size is completed.
+ virtual void OnCompositingCompleteSwapWithNewSize(ui::Compositor* compositor,
+ const gfx::Size& size) {}
diff --git a/electron34/patches/patch-ui_display_BUILD.gn b/electron34/patches/patch-ui_display_BUILD.gn
new file mode 100644
index 0000000000..b7903ad6eb
--- /dev/null
+++ b/electron34/patches/patch-ui_display_BUILD.gn
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/display/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/display/BUILD.gn
+@@ -125,6 +125,12 @@ component("display") {
+ "//ui/gfx/geometry",
+ ]
+
++ if (is_mac) {
++ deps += [
++ "//electron/build/config:generate_mas_config"
++ ]
++ }
++
+ if (is_ios) {
+ deps += [ "//build:ios_buildflags" ]
+ }
diff --git a/electron34/patches/patch-ui_display_mac_screen__mac.mm b/electron34/patches/patch-ui_display_mac_screen__mac.mm
new file mode 100644
index 0000000000..04a0e9454d
--- /dev/null
+++ b/electron34/patches/patch-ui_display_mac_screen__mac.mm
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/display/mac/screen_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/display/mac/screen_mac.mm
+@@ -30,6 +30,7 @@
+ #include "base/trace_event/trace_event.h"
+ #include "build/build_config.h"
+ #include "components/device_event_log/device_event_log.h"
++#include "electron/mas.h"
+ #include "ui/display/display.h"
+ #include "ui/display/display_change_notifier.h"
+ #include "ui/display/util/display_util.h"
+@@ -176,7 +177,17 @@ DisplayMac BuildDisplayForScreen(NSScree
+ display.set_color_depth(Display::kDefaultBitsPerPixel);
+ display.set_depth_per_component(Display::kDefaultBitsPerComponent);
+ }
++#if IS_MAS_BUILD()
++ // This is equivalent to the CGDisplayUsesForceToGray() API as at 2018-08-06,
++ // but avoids usage of the private API.
++ CFStringRef app = CFSTR("com.apple.CoreGraphics");
++ CFStringRef key = CFSTR("DisplayUseForcedGray");
++ Boolean key_valid = false;
++ display.set_is_monochrome(
++ CFPreferencesGetAppBooleanValue(key, app, &key_valid));
++#else
+ display.set_is_monochrome(CGDisplayUsesForceToGray());
++#endif
+
+ // Query the display's refresh rate.
+ if (@available(macos 12.0, *)) {
diff --git a/electron34/patches/patch-ui_display_screen.cc b/electron34/patches/patch-ui_display_screen.cc
new file mode 100644
index 0000000000..f7cdfa7bd0
--- /dev/null
+++ b/electron34/patches/patch-ui_display_screen.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/display/screen.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/display/screen.cc
+@@ -86,7 +86,7 @@ void Screen::SetDisplayForNewWindows(int
+ display_id_for_new_windows_ = display_id;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ Screen::ScreenSaverSuspender::~ScreenSaverSuspender() = default;
+
+ std::unique_ptr<Screen::ScreenSaverSuspender> Screen::SuspendScreenSaver() {
diff --git a/electron34/patches/patch-ui_display_screen.h b/electron34/patches/patch-ui_display_screen.h
new file mode 100644
index 0000000000..eb6712f176
--- /dev/null
+++ b/electron34/patches/patch-ui_display_screen.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/display/screen.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/display/screen.h
+@@ -140,7 +140,7 @@ class DISPLAY_EXPORT Screen {
+ // (both of which may or may not be `nearest_id`).
+ display::ScreenInfos GetScreenInfosNearestDisplay(int64_t nearest_id) const;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Object which suspends the platform-specific screensaver for the duration of
+ // its existence.
+ class ScreenSaverSuspender {
+@@ -243,7 +243,7 @@ class DISPLAY_EXPORT Screen {
+ int64_t display_id_for_new_windows_;
+ int64_t scoped_display_id_for_new_windows_ = display::kInvalidDisplayId;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ uint32_t screen_saver_suspension_count_ = 0;
+ #endif // BUILDFLAG(IS_LINUX)
+ };
diff --git a/electron34/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc b/electron34/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc
new file mode 100644
index 0000000000..5f3f6dfbea
--- /dev/null
+++ b/electron34/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/devices/x11/device_data_manager_x11.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/devices/x11/device_data_manager_x11.cc
+@@ -849,6 +849,7 @@ void DeviceDataManagerX11::SetDisabledKe
+ }
+
+ void DeviceDataManagerX11::DisableDevice(x11::Input::DeviceId deviceid) {
++ NOTIMPLEMENTED();
+ blocked_devices_.set(static_cast<uint32_t>(deviceid), true);
+ // TODO(rsadam@): Support blocking touchscreen devices.
+ std::vector<KeyboardDevice> keyboards = GetKeyboardDevices();
diff --git a/electron34/patches/patch-ui_events_event.cc b/electron34/patches/patch-ui_events_event.cc
new file mode 100644
index 0000000000..73f8431606
--- /dev/null
+++ b/electron34/patches/patch-ui_events_event.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/event.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/event.cc
+@@ -373,7 +373,7 @@ std::string LocatedEvent::ToString() con
+ MouseEvent::MouseEvent(const PlatformEvent& native_event)
+ : LocatedEvent(native_event),
+ changed_button_flags_(GetChangedMouseButtonFlagsFromNative(native_event)),
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ movement_(GetMouseMovementFromNative(native_event)),
+ #endif
+ pointer_details_(GetMousePointerDetailsFromNative(native_event)) {
+@@ -629,7 +629,7 @@ std::unique_ptr<Event> MouseWheelEvent::
+ return std::make_unique<MouseWheelEvent>(*this);
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // This value matches Windows, Fuchsia WHEEL_DELTA, and (roughly) Firefox on
+ // Linux.
+ // static
+@@ -889,7 +889,7 @@ void KeyEvent::InitializeNative() {
+ if (synthesize_key_repeat_enabled_ && IsRepeated(GetLastKeyEvent()))
+ SetFlags(flags() | EF_IS_REPEAT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ NormalizeFlags();
+ #elif BUILDFLAG(IS_WIN)
+ // Only Windows has native character events.
diff --git a/electron34/patches/patch-ui_events_event.h b/electron34/patches/patch-ui_events_event.h
new file mode 100644
index 0000000000..9837cfae2d
--- /dev/null
+++ b/electron34/patches/patch-ui_events_event.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/event.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/event.h
+@@ -587,6 +587,9 @@ class EVENTS_EXPORT MouseEvent : public
+
+ const PointerDetails& pointer_details() const { return pointer_details_; }
+
++ bool is_system_menu() const { return is_system_menu_; }
++ void set_is_system_menu(bool is_menu) { is_system_menu_ = is_menu; }
++
+ // Event:
+ std::string ToString() const override;
+ std::unique_ptr<Event> Clone() const override;
+@@ -619,6 +622,8 @@ class EVENTS_EXPORT MouseEvent : public
+
+ // Structure for holding pointer details for implementing PointerEvents API.
+ PointerDetails pointer_details_;
++
++ bool is_system_menu_ = false;
+ };
+
+ class ScrollEvent;
diff --git a/electron34/patches/patch-ui_events_event__switches.cc b/electron34/patches/patch-ui_events_event__switches.cc
new file mode 100644
index 0000000000..24ded5cc66
--- /dev/null
+++ b/electron34/patches/patch-ui_events_event__switches.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/event_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/event_switches.cc
+@@ -21,7 +21,7 @@ const char kCompensateForUnstablePinchZo
+ // value is a floating point number that is interpreted as a distance in pixels.
+ const char kTouchSlopDistance[] = "touch-slop-distance";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Tells chrome to interpret events from these devices as touch events. Only
+ // available with XInput 2 (i.e. X server 1.8 or above). The id's of the
+ // devices can be retrieved from 'xinput list'.
diff --git a/electron34/patches/patch-ui_events_event__switches.h b/electron34/patches/patch-ui_events_event__switches.h
new file mode 100644
index 0000000000..d95e2192db
--- /dev/null
+++ b/electron34/patches/patch-ui_events_event__switches.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/event_switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/event_switches.h
+@@ -13,7 +13,7 @@ namespace switches {
+ EVENTS_BASE_EXPORT extern const char kCompensateForUnstablePinchZoom[];
+ EVENTS_BASE_EXPORT extern const char kTouchSlopDistance[];
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ EVENTS_BASE_EXPORT extern const char kTouchDevices[];
+ EVENTS_BASE_EXPORT extern const char kPenDevices[];
+ #endif
diff --git a/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.cc b/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.cc
new file mode 100644
index 0000000000..3d09cd1ee8
--- /dev/null
+++ b/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/keycodes/dom/keycode_converter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/keycodes/dom/keycode_converter.cc
+@@ -18,7 +18,7 @@
+ #include "ui/events/keycodes/dom/dom_code.h"
+ #include "ui/events/keycodes/dom/dom_key.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ #include <linux/input.h>
+ #endif
+
+@@ -31,7 +31,7 @@ namespace {
+ #if BUILDFLAG(IS_WIN)
+ #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
+ { usb, win, code }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #define DOM_CODE(usb, evdev, xkb, win, mac, code, id) \
+ { usb, xkb, code }
+ #elif BUILDFLAG(IS_APPLE)
+@@ -70,7 +70,7 @@ struct DomKeyMapEntry {
+ #undef DOM_KEY_UNI
+ #undef DOM_KEY_MAP_DECLARATION_END
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+
+ // The offset between XKB Keycode and evdev code.
+ constexpr int kXkbKeycodeOffset = 8;
+@@ -191,7 +191,7 @@ int KeycodeConverter::DomCodeToNativeKey
+ return UsbKeycodeToNativeKeycode(static_cast<uint32_t>(code));
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ // static
+ DomCode KeycodeConverter::XkbKeycodeToDomCode(uint32_t xkb_keycode) {
+ // Currently XKB keycode is the native keycode.
diff --git a/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.h b/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.h
new file mode 100644
index 0000000000..f71a7e2dce
--- /dev/null
+++ b/electron34/patches/patch-ui_events_keycodes_dom_keycode__converter.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/keycodes/dom/keycode_converter.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/keycodes/dom/keycode_converter.h
+@@ -64,7 +64,7 @@ class KeycodeConverter {
+ // Convert a DomCode into a native keycode.
+ static int DomCodeToNativeKeycode(DomCode code);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FREEBSD)
+ // Convert a XKB keycode into a DomCode.
+ static DomCode XkbKeycodeToDomCode(uint32_t xkb_keycode);
+
diff --git a/electron34/patches/patch-ui_events_x_events__x__utils.cc b/electron34/patches/patch-ui_events_x_events__x__utils.cc
new file mode 100644
index 0000000000..8eadfbc35f
--- /dev/null
+++ b/electron34/patches/patch-ui_events_x_events__x__utils.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/events/x/events_x_utils.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/events/x/events_x_utils.cc
+@@ -591,6 +591,9 @@ gfx::Point EventLocationFromXEvent(const
+ gfx::Point EventSystemLocationFromXEvent(const x11::Event& xev) {
+ if (auto* crossing = xev.As<x11::CrossingEvent>())
+ return gfx::Point(crossing->root_x, crossing->root_y);
++ if (auto* crossing = xev.As<x11::Input::CrossingEvent>())
++ return gfx::Point(Fp1616ToDouble(crossing->root_x),
++ Fp1616ToDouble(crossing->root_y));
+ if (auto* button = xev.As<x11::ButtonEvent>())
+ return gfx::Point(button->root_x, button->root_y);
+ if (auto* motion = xev.As<x11::MotionNotifyEvent>())
diff --git a/electron34/patches/patch-ui_gfx_BUILD.gn b/electron34/patches/patch-ui_gfx_BUILD.gn
new file mode 100644
index 0000000000..a7540988c1
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_BUILD.gn
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/BUILD.gn
+@@ -329,6 +329,12 @@ component("gfx") {
+ "//ui/base:ui_data_pack",
+ ]
+
++ if (is_mac) {
++ deps += [
++ "//electron/build/config:generate_mas_config"
++ ]
++ }
++
+ if (!is_apple) {
+ sources += [
+ "platform_font_skia.cc",
+@@ -653,7 +659,7 @@ source_set("memory_buffer_sources") {
+ deps += [ "//build/config/linux/libdrm" ]
+ }
+
+- if (is_linux || is_chromeos || is_android) {
++ if ((is_linux || is_chromeos || is_android) && !is_bsd) {
+ deps += [ "//third_party/libsync" ]
+ }
+
diff --git a/electron34/patches/patch-ui_gfx_ca__layer__params.h b/electron34/patches/patch-ui_gfx_ca__layer__params.h
new file mode 100644
index 0000000000..64d8790a79
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_ca__layer__params.h
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/ca_layer_params.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/ca_layer_params.h
+@@ -7,6 +7,7 @@
+
+ #include "base/component_export.h"
+ #include "build/build_config.h"
++#include "ui/gfx/geometry/rect.h"
+ #include "ui/gfx/geometry/size.h"
+
+ #if BUILDFLAG(IS_APPLE)
+@@ -51,6 +52,8 @@ struct COMPONENT_EXPORT(GFX) CALayerPara
+ gfx::ScopedRefCountedIOSurfaceMachPort io_surface_mach_port;
+ #endif
+
++ gfx::Rect damage;
++
+ // The geometry of the frame.
+ gfx::Size pixel_size;
+ float scale_factor = 1.f;
diff --git a/electron34/patches/patch-ui_gfx_canvas__skia.cc b/electron34/patches/patch-ui_gfx_canvas__skia.cc
new file mode 100644
index 0000000000..8b46a4e3f9
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_canvas__skia.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/canvas_skia.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/canvas_skia.cc
+@@ -213,7 +213,7 @@ void Canvas::DrawStringRectWithFlags(con
+ Range range = StripAcceleratorChars(flags, &adjusted_text);
+ bool elide_text = ((flags & NO_ELLIPSIS) == 0);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On Linux, eliding really means fading the end of the string. But only
+ // for LTR text. RTL text is still elided (on the left) with "...".
+ if (elide_text) {
diff --git a/electron34/patches/patch-ui_gfx_font__fallback__linux.cc b/electron34/patches/patch-ui_gfx_font__fallback__linux.cc
new file mode 100644
index 0000000000..e5afb2f090
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_font__fallback__linux.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/font_fallback_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/font_fallback_linux.cc
+@@ -32,6 +32,8 @@
+ #include "ui/gfx/linux/fontconfig_util.h"
+ #include "ui/gfx/platform_font.h"
+
++#include <unistd.h>
++
+ namespace gfx {
+
+ namespace {
diff --git a/electron34/patches/patch-ui_gfx_font__render__params.h b/electron34/patches/patch-ui_gfx_font__render__params.h
new file mode 100644
index 0000000000..420c8fd538
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_font__render__params.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/font_render_params.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/font_render_params.h
+@@ -115,7 +115,7 @@ COMPONENT_EXPORT(GFX)
+ FontRenderParams GetFontRenderParams(const FontRenderParamsQuery& query,
+ std::string* family_out);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ // Clears GetFontRenderParams()'s cache. Intended to be called by tests that are
+ // changing Fontconfig's configuration.
+ COMPONENT_EXPORT(GFX) void ClearFontRenderParamsCacheForTest();
+@@ -125,7 +125,7 @@ COMPONENT_EXPORT(GFX) void ClearFontRend
+ COMPONENT_EXPORT(GFX) float GetFontRenderParamsDeviceScaleFactor();
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ // Sets the device scale factor for FontRenderParams to decide
+ // if it should enable subpixel positioning.
+ COMPONENT_EXPORT(GFX)
diff --git a/electron34/patches/patch-ui_gfx_font__render__params__linux.cc b/electron34/patches/patch-ui_gfx_font__render__params__linux.cc
new file mode 100644
index 0000000000..be588f0c0d
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_font__render__params__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/font_render_params_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/font_render_params_linux.cc
+@@ -24,7 +24,7 @@
+ #include "ui/gfx/linux/fontconfig_util.h"
+ #include "ui/gfx/switches.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -211,7 +211,7 @@ FontRenderParams GetFontRenderParams(con
+
+ // Start with the delegate's settings, but let Fontconfig have the final say.
+ FontRenderParams params;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (auto* linux_ui = ui::LinuxUi::instance()) {
+ params = linux_ui->GetDefaultFontRenderParams();
+ }
diff --git a/electron34/patches/patch-ui_gfx_font__util.cc b/electron34/patches/patch-ui_gfx_font__util.cc
new file mode 100644
index 0000000000..46066ecd4c
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_font__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/font_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/font_util.cc
+@@ -6,7 +6,7 @@
+
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <fontconfig/fontconfig.h>
+ #include "ui/gfx/linux/fontconfig_util.h"
+ #endif
+@@ -24,7 +24,7 @@ void InitializeFonts() {
+ // background (resources have not yet been granted to cast) since it prevents
+ // the long delay the user would have seen on first rendering.
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Early initialize FontConfig.
+ InitializeGlobalFontConfigAsync();
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
diff --git a/electron34/patches/patch-ui_gfx_gpu__memory__buffer.cc b/electron34/patches/patch-ui_gfx_gpu__memory__buffer.cc
new file mode 100644
index 0000000000..71fd2d1213
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_gpu__memory__buffer.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/gpu_memory_buffer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/gpu_memory_buffer.cc
+@@ -63,7 +63,7 @@ GpuMemoryBufferHandle GpuMemoryBufferHan
+ handle.region = region.Duplicate();
+ handle.offset = offset;
+ handle.stride = stride;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ handle.native_pixmap_handle = CloneHandleForIPC(native_pixmap_handle);
+ #elif BUILDFLAG(IS_APPLE)
+ handle.io_surface = io_surface;
diff --git a/electron34/patches/patch-ui_gfx_gpu__memory__buffer.h b/electron34/patches/patch-ui_gfx_gpu__memory__buffer.h
new file mode 100644
index 0000000000..db553486c4
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_gpu__memory__buffer.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/gpu_memory_buffer.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/gpu_memory_buffer.h
+@@ -15,7 +15,7 @@
+ #include "ui/gfx/generic_shared_memory_id.h"
+ #include "ui/gfx/geometry/rect.h"
+
+-#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "ui/gfx/native_pixmap_handle.h"
+ #elif BUILDFLAG(IS_APPLE)
+ #include "ui/gfx/mac/io_surface.h"
+@@ -76,7 +76,7 @@ struct COMPONENT_EXPORT(GFX) GpuMemoryBu
+ base::UnsafeSharedMemoryRegion region;
+ uint32_t offset = 0;
+ uint32_t stride = 0;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ NativePixmapHandle native_pixmap_handle;
+ #elif BUILDFLAG(IS_APPLE)
+ ScopedIOSurface io_surface;
diff --git a/electron34/patches/patch-ui_gfx_linux_dmabuf__uapi.h b/electron34/patches/patch-ui_gfx_linux_dmabuf__uapi.h
new file mode 100644
index 0000000000..14b9963787
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_linux_dmabuf__uapi.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/linux/dmabuf_uapi.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/linux/dmabuf_uapi.h
+@@ -5,12 +5,11 @@
+ #ifndef UI_GFX_LINUX_DMABUF_UAPI_H_
+ #define UI_GFX_LINUX_DMABUF_UAPI_H_
+
+-#include <linux/version.h>
++#include <sys/types.h>
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
+-#include <linux/dma-buf.h>
+-#else
+-#include <linux/types.h>
++typedef int32_t __s32;
++typedef uint32_t __u32;
++typedef uint64_t __u64;
+
+ struct dma_buf_sync {
+ __u64 flags;
+@@ -26,9 +25,7 @@ constexpr __u64 DMA_BUF_SYNC_END = 1 <<
+ constexpr char DMA_BUF_BASE = 'b';
+ constexpr unsigned long DMA_BUF_IOCTL_SYNC =
+ _IOW(DMA_BUF_BASE, 0, struct dma_buf_sync);
+-#endif
+
+-#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
+ struct dma_buf_export_sync_file {
+ __u32 flags;
+ __s32 fd;
+@@ -43,6 +40,5 @@ constexpr unsigned long DMA_BUF_IOCTL_EX
+ _IOWR(DMA_BUF_BASE, 2, struct dma_buf_export_sync_file);
+ constexpr unsigned long DMA_BUF_IOCTL_IMPORT_SYNC_FILE =
+ _IOW(DMA_BUF_BASE, 3, struct dma_buf_import_sync_file);
+-#endif
+
+ #endif // UI_GFX_LINUX_DMABUF_UAPI_H_
diff --git a/electron34/patches/patch-ui_gfx_linux_gbm__wrapper.cc b/electron34/patches/patch-ui_gfx_linux_gbm__wrapper.cc
new file mode 100644
index 0000000000..b67b2b03df
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_linux_gbm__wrapper.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/linux/gbm_wrapper.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/linux/gbm_wrapper.cc
+@@ -319,7 +319,7 @@ class Device final : public ui::GbmDevic
+ // of 1x1 BOs which are destroyed before creating the final BO creation used
+ // to instantiate the returned GbmBuffer.
+ gfx::Size size_for_verification =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Size(1, 1);
+ #else
+ requested_size;
diff --git a/electron34/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc b/electron34/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc
new file mode 100644
index 0000000000..fdafb3b768
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/buffer_types_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/buffer_types_mojom_traits.cc
+@@ -33,7 +33,7 @@ gfx::mojom::GpuMemoryBufferPlatformHandl
+ return gfx::mojom::GpuMemoryBufferPlatformHandle::NewSharedMemoryHandle(
+ std::move(handle.region));
+ case gfx::NATIVE_PIXMAP:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ return gfx::mojom::GpuMemoryBufferPlatformHandle::NewNativePixmapHandle(
+ std::move(handle.native_pixmap_handle));
+ #else
+@@ -115,7 +115,7 @@ bool StructTraits<gfx::mojom::GpuMemoryB
+ out->type = gfx::SHARED_MEMORY_BUFFER;
+ out->region = std::move(platform_handle->get_shared_memory_handle());
+ return true;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ case gfx::mojom::GpuMemoryBufferPlatformHandleDataView::Tag::
+ kNativePixmapHandle:
+ out->type = gfx::NATIVE_PIXMAP;
diff --git a/electron34/patches/patch-ui_gfx_mojom_ca__layer__params.mojom b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params.mojom
new file mode 100644
index 0000000000..098f05ee94
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params.mojom
@@ -0,0 +1,15 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/ca_layer_params.mojom.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/ca_layer_params.mojom
+@@ -18,5 +18,6 @@ struct CALayerParams {
+ bool is_empty;
+ CALayerContent content;
+ gfx.mojom.Size pixel_size;
++ gfx.mojom.Rect damage;
+ float scale_factor;
+ };
diff --git a/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc
new file mode 100644
index 0000000000..1043cf2f67
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/ca_layer_params_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/ca_layer_params_mojom_traits.cc
+@@ -52,6 +52,9 @@ bool StructTraits<gfx::mojom::CALayerPar
+ if (!data.ReadPixelSize(&out->pixel_size))
+ return false;
+
++ if (!data.ReadDamage(&out->damage))
++ return false;
++
+ out->scale_factor = data.scale_factor();
+ return true;
+ }
diff --git a/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h
new file mode 100644
index 0000000000..91cdbb5308
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/ca_layer_params_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/ca_layer_params_mojom_traits.h
+@@ -20,6 +20,10 @@ struct StructTraits<gfx::mojom::CALayerP
+ return ca_layer_params.pixel_size;
+ }
+
++ static gfx::Rect damage(const gfx::CALayerParams& ca_layer_params) {
++ return ca_layer_params.damage;
++ }
++
+ static float scale_factor(const gfx::CALayerParams& ca_layer_params) {
+ return ca_layer_params.scale_factor;
+ }
diff --git a/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc b/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc
new file mode 100644
index 0000000000..2fe6390e2f
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/native_handle_types_mojom_traits.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/native_handle_types_mojom_traits.cc
+@@ -8,11 +8,11 @@
+
+ namespace mojo {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ mojo::PlatformHandle StructTraits<
+ gfx::mojom::NativePixmapPlaneDataView,
+ gfx::NativePixmapPlane>::buffer_handle(gfx::NativePixmapPlane& plane) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return mojo::PlatformHandle(std::move(plane.fd));
+ #elif BUILDFLAG(IS_FUCHSIA)
+ return mojo::PlatformHandle(std::move(plane.vmo));
+@@ -28,7 +28,7 @@ bool StructTraits<
+ out->size = data.size();
+
+ mojo::PlatformHandle handle = data.TakeBufferHandle();
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (!handle.is_fd())
+ return false;
+ out->fd = handle.TakeFD();
+@@ -54,7 +54,7 @@ bool StructTraits<
+ gfx::mojom::NativePixmapHandleDataView,
+ gfx::NativePixmapHandle>::Read(gfx::mojom::NativePixmapHandleDataView data,
+ gfx::NativePixmapHandle* out) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ out->modifier = data.modifier();
+ out->supports_zero_copy_webgpu_import =
+ data.supports_zero_copy_webgpu_import();
diff --git a/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h b/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h
new file mode 100644
index 0000000000..49b53a1754
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/mojom/native_handle_types_mojom_traits.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/mojom/native_handle_types_mojom_traits.h
+@@ -16,7 +16,7 @@
+ #include "mojo/public/cpp/system/platform_handle.h"
+ #include "ui/gfx/mojom/native_handle_types.mojom-shared.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ #include "ui/gfx/native_pixmap_handle.h"
+ #endif
+
+@@ -26,7 +26,7 @@
+
+ namespace mojo {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OZONE) || BUILDFLAG(IS_BSD)
+ template <>
+ struct COMPONENT_EXPORT(GFX_NATIVE_HANDLE_TYPES_SHARED_MOJOM_TRAITS)
+ StructTraits<gfx::mojom::NativePixmapPlaneDataView,
+@@ -54,13 +54,13 @@ struct COMPONENT_EXPORT(GFX_NATIVE_HANDL
+ return pixmap_handle.planes;
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static uint64_t modifier(const gfx::NativePixmapHandle& pixmap_handle) {
+ return pixmap_handle.modifier;
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static bool supports_zero_copy_webgpu_import(
+ const gfx::NativePixmapHandle& pixmap_handle) {
+ return pixmap_handle.supports_zero_copy_webgpu_import;
diff --git a/electron34/patches/patch-ui_gfx_native__pixmap__handle.cc b/electron34/patches/patch-ui_gfx_native__pixmap__handle.cc
new file mode 100644
index 0000000000..5fd6fe72bd
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_native__pixmap__handle.cc
@@ -0,0 +1,68 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/native_pixmap_handle.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/native_pixmap_handle.cc
+@@ -11,7 +11,7 @@
+ #include "ui/gfx/buffer_format_util.h"
+ #include "ui/gfx/geometry/size.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <drm_fourcc.h>
+ #include <unistd.h>
+
+@@ -23,9 +23,13 @@
+ #include "base/fuchsia/fuchsia_logging.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include <unistd.h>
++#endif
++
+ namespace gfx {
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ static_assert(NativePixmapHandle::kNoModifier == DRM_FORMAT_MOD_INVALID,
+ "gfx::NativePixmapHandle::kNoModifier should be an alias for"
+ "DRM_FORMAT_MOD_INVALID");
+@@ -36,7 +40,7 @@ NativePixmapPlane::NativePixmapPlane() :
+ NativePixmapPlane::NativePixmapPlane(int stride,
+ int offset,
+ uint64_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ base::ScopedFD fd
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -47,7 +51,7 @@ NativePixmapPlane::NativePixmapPlane(int
+ : stride(stride),
+ offset(offset),
+ size(size)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ fd(std::move(fd))
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -75,7 +79,7 @@ NativePixmapHandle& NativePixmapHandle::
+ NativePixmapHandle CloneHandleForIPC(const NativePixmapHandle& handle) {
+ NativePixmapHandle clone;
+ for (auto& plane : handle.planes) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ DCHECK(plane.fd.is_valid());
+ // Combining the HANDLE_EINTR and ScopedFD's constructor causes the compiler
+ // to emit some very strange assembly that tends to cause FD ownership
+@@ -113,7 +117,7 @@ NativePixmapHandle CloneHandleForIPC(con
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ clone.modifier = handle.modifier;
+ clone.supports_zero_copy_webgpu_import =
+ handle.supports_zero_copy_webgpu_import;
diff --git a/electron34/patches/patch-ui_gfx_native__pixmap__handle.h b/electron34/patches/patch-ui_gfx_native__pixmap__handle.h
new file mode 100644
index 0000000000..d1630b8512
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_native__pixmap__handle.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/native_pixmap_handle.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/native_pixmap_handle.h
+@@ -14,7 +14,7 @@
+ #include "build/build_config.h"
+ #include "ui/gfx/buffer_types.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "base/files/scoped_file.h"
+ #endif
+
+@@ -34,7 +34,7 @@ struct COMPONENT_EXPORT(GFX) NativePixma
+ NativePixmapPlane(int stride,
+ int offset,
+ uint64_t size
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ ,
+ base::ScopedFD fd
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -55,7 +55,7 @@ struct COMPONENT_EXPORT(GFX) NativePixma
+ // This is necessary to map the buffers.
+ uint64_t size;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // File descriptor for the underlying memory object (usually dmabuf).
+ base::ScopedFD fd;
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -78,7 +78,7 @@ struct COMPONENT_EXPORT(GFX) NativePixma
+
+ std::vector<NativePixmapPlane> planes;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The modifier is retrieved from GBM library and passed to EGL driver.
+ // Generally it's platform specific, and we don't need to modify it in
+ // Chromium code. Also one per plane per entry.
diff --git a/electron34/patches/patch-ui_gfx_native__widget__types.h b/electron34/patches/patch-ui_gfx_native__widget__types.h
new file mode 100644
index 0000000000..4b8d5c6c0d
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_native__widget__types.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/native_widget_types.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/native_widget_types.h
+@@ -101,7 +101,7 @@ class ViewAndroid;
+ #endif
+ class SkBitmap;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern "C" {
+ struct _AtkObject;
+ using AtkObject = struct _AtkObject;
+@@ -214,7 +214,7 @@ using NativeViewAccessible = id;
+ #else
+ using NativeViewAccessible = struct objc_object*;
+ #endif
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Linux doesn't have a native font type.
+ using NativeViewAccessible = AtkObject*;
+ #else
diff --git a/electron34/patches/patch-ui_gfx_platform__font__mac.mm b/electron34/patches/patch-ui_gfx_platform__font__mac.mm
new file mode 100644
index 0000000000..38e6c4d747
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_platform__font__mac.mm
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/platform_font_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/platform_font_mac.mm
+@@ -19,6 +19,7 @@
+ #include "base/numerics/safe_conversions.h"
+ #include "base/strings/sys_string_conversions.h"
+ #include "base/strings/utf_string_conversions.h"
++#include "electron/mas.h"
+ #include "third_party/skia/include/ports/SkTypeface_mac.h"
+ #include "ui/gfx/canvas.h"
+ #include "ui/gfx/font.h"
+@@ -28,9 +29,11 @@ namespace gfx {
+
+ using Weight = Font::Weight;
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
+ }
++#endif
+
+ namespace {
+
+@@ -250,7 +253,13 @@ SystemFontTypeFromUndocumentedCTFontRefI
+ // TODO(avi, etienneb): Figure out this font stuff.
+ base::apple::ScopedCFTypeRef<CTFontDescriptorRef> descriptor(
+ CTFontCopyFontDescriptor(font));
++#if IS_MAS_BUILD()
++ CFNumberRef priority = (CFNumberRef)CTFontDescriptorCopyAttribute(descriptor.get(), (CFStringRef)kCTFontPriorityAttribute);
++ SInt64 v;
++ if (CFNumberGetValue(priority, kCFNumberSInt64Type, &v) && v == kCTFontPrioritySystem) {
++#else
+ if (CTFontDescriptorIsSystemUIFont(descriptor.get())) {
++#endif
+ // Assume it's the standard system font. The fact that this much is known is
+ // enough.
+ return PlatformFontMac::SystemFontType::kGeneral;
diff --git a/electron34/patches/patch-ui_gfx_platform__font__skia.cc b/electron34/patches/patch-ui_gfx_platform__font__skia.cc
new file mode 100644
index 0000000000..61131762e6
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_platform__font__skia.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/platform_font_skia.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/platform_font_skia.cc
+@@ -29,7 +29,7 @@
+ #include "ui/gfx/system_fonts_win.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -167,7 +167,7 @@ void PlatformFontSkia::EnsuresDefaultFon
+ weight = system_font.GetWeight();
+ #endif // BUILDFLAG(IS_WIN)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On Linux, LinuxUi is used to query the native toolkit (e.g.
+ // GTK) for the default UI font.
+ if (auto* linux_ui = ui::LinuxUi::instance()) {
diff --git a/electron34/patches/patch-ui_gfx_render__text__api__fuzzer.cc b/electron34/patches/patch-ui_gfx_render__text__api__fuzzer.cc
new file mode 100644
index 0000000000..ef4e7a7009
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_render__text__api__fuzzer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/render_text_api_fuzzer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/render_text_api_fuzzer.cc
+@@ -19,7 +19,7 @@
+ #include "ui/gfx/font_util.h"
+ #include "ui/gfx/render_text.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/test_fonts/fontconfig/fontconfig_util_linux.h"
+ #endif
+
+@@ -46,7 +46,7 @@ struct Environment {
+
+ CHECK(base::i18n::InitializeICU());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ test_fonts::SetUpFontconfig();
+ #endif
+ gfx::InitializeFonts();
diff --git a/electron34/patches/patch-ui_gfx_render__text__fuzzer.cc b/electron34/patches/patch-ui_gfx_render__text__fuzzer.cc
new file mode 100644
index 0000000000..8c27b918b3
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_render__text__fuzzer.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/render_text_fuzzer.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/render_text_fuzzer.cc
+@@ -17,7 +17,7 @@
+ #include "ui/gfx/canvas.h"
+ #include "ui/gfx/font_util.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include "third_party/test_fonts/fontconfig/fontconfig_util_linux.h"
+ #endif
+
+@@ -40,7 +40,7 @@ struct Environment {
+
+ CHECK(base::i18n::InitializeICU());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ test_fonts::SetUpFontconfig();
+ #endif
+ gfx::InitializeFonts();
diff --git a/electron34/patches/patch-ui_gfx_switches.cc b/electron34/patches/patch-ui_gfx_switches.cc
new file mode 100644
index 0000000000..94e8c574e1
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_switches.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/switches.cc
+@@ -32,7 +32,7 @@ const char kForcePrefersNoReducedMotion[
+ // Run in headless mode, i.e., without a UI or display server dependencies.
+ const char kHeadless[] = "headless";
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Which X11 display to connect to. Emulates the GTK+ "--display=" command line
+ // argument. In use only with Ozone/X11.
+ const char kX11Display[] = "display";
diff --git a/electron34/patches/patch-ui_gfx_switches.h b/electron34/patches/patch-ui_gfx_switches.h
new file mode 100644
index 0000000000..6f54e2d4ab
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_switches.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/switches.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/switches.h
+@@ -18,7 +18,7 @@ GFX_SWITCHES_EXPORT extern const char kF
+ GFX_SWITCHES_EXPORT extern const char kForcePrefersNoReducedMotion[];
+ GFX_SWITCHES_EXPORT extern const char kHeadless[];
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ GFX_SWITCHES_EXPORT extern const char kX11Display[];
+ GFX_SWITCHES_EXPORT extern const char kNoXshm[];
+ #endif
diff --git a/electron34/patches/patch-ui_gfx_x_atom__cache.cc b/electron34/patches/patch-ui_gfx_x_atom__cache.cc
new file mode 100644
index 0000000000..fb4fc5ca4a
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_x_atom__cache.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/x/atom_cache.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/x/atom_cache.cc
+@@ -155,6 +155,7 @@ constexpr auto kAtomsToCache = std::to_a
+ "application/octet-stream",
+ "application/vnd.chromium.test",
+ "chromium/filename",
++ "chromium/from-privileged",
+ "chromium/x-bookmark-entries",
+ "chromium/x-browser-actions",
+ "chromium/x-file-system-files",
diff --git a/electron34/patches/patch-ui_gfx_x_generated__protos_dri3.cc b/electron34/patches/patch-ui_gfx_x_generated__protos_dri3.cc
new file mode 100644
index 0000000000..41317118c1
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_x_generated__protos_dri3.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/x/generated_protos/dri3.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/x/generated_protos/dri3.cc
+@@ -27,6 +27,8 @@
+ #include <xcb/xcb.h>
+ #include <xcb/xcbext.h>
+
++#include <unistd.h>
++
+ #include "base/logging.h"
+ #include "base/posix/eintr_wrapper.h"
+ #include "ui/gfx/x/connection.h"
diff --git a/electron34/patches/patch-ui_gfx_x_generated__protos_shm.cc b/electron34/patches/patch-ui_gfx_x_generated__protos_shm.cc
new file mode 100644
index 0000000000..ba007c5ab2
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_x_generated__protos_shm.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/x/generated_protos/shm.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/x/generated_protos/shm.cc
+@@ -27,6 +27,8 @@
+ #include <xcb/xcb.h>
+ #include <xcb/xcbext.h>
+
++#include <unistd.h>
++
+ #include "base/logging.h"
+ #include "base/posix/eintr_wrapper.h"
+ #include "ui/gfx/x/connection.h"
diff --git a/electron34/patches/patch-ui_gfx_x_xlib__support.cc b/electron34/patches/patch-ui_gfx_x_xlib__support.cc
new file mode 100644
index 0000000000..0ca23baa66
--- /dev/null
+++ b/electron34/patches/patch-ui_gfx_x_xlib__support.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gfx/x/xlib_support.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gfx/x/xlib_support.cc
+@@ -39,10 +39,18 @@ void InitXlib() {
+ return;
+ }
+
++#if BUILDFLAG(IS_BSD)
++ CHECK(xlib_loader->Load("libX11.so"));
++#else
+ CHECK(xlib_loader->Load("libX11.so.6"));
++#endif
+
+ auto* xlib_xcb_loader = GetXlibXcbLoader();
++#if BUILDFLAG(IS_BSD)
++ CHECK(xlib_xcb_loader->Load("libX11-xcb.so"));
++#else
+ CHECK(xlib_xcb_loader->Load("libX11-xcb.so.1"));
++#endif
+
+ CHECK(xlib_loader->XInitThreads());
+
diff --git a/electron34/patches/patch-ui_gl_BUILD.gn b/electron34/patches/patch-ui_gl_BUILD.gn
new file mode 100644
index 0000000000..4438d48556
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_BUILD.gn
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/BUILD.gn
+@@ -166,7 +166,6 @@ component("gl") {
+ public_deps = [
+ ":gl_enums",
+ "//base",
+- "//third_party/mesa_headers",
+ "//ui/events/platform",
+ "//ui/gfx",
+ "//ui/gfx/geometry",
+@@ -314,7 +313,6 @@ component("gl") {
+ data_deps += [
+ "//third_party/angle:libEGL",
+ "//third_party/angle:libGLESv2",
+- "//third_party/mesa_headers",
+ ]
+ if (enable_swiftshader) {
+ data_deps += [
+@@ -539,7 +537,6 @@ test("gl_unittests") {
+
+ data_deps = [
+ "//testing/buildbot/filters:gl_unittests_filters",
+- "//third_party/mesa_headers",
+ ]
+
+ if (is_win) {
diff --git a/electron34/patches/patch-ui_gl_gl__context.cc b/electron34/patches/patch-ui_gl_gl__context.cc
new file mode 100644
index 0000000000..c89ba90d00
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_gl__context.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/gl_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/gl_context.cc
+@@ -516,7 +516,7 @@ bool GLContext::MakeVirtuallyCurrent(
+ DCHECK(virtual_context->IsCurrent(surface));
+
+ if (switched_real_contexts || virtual_context != current_virtual_context_) {
+-#if DCHECK_IS_ON()
++#if DCHECK_IS_ON() && !BUILDFLAG(IS_BSD)
+ GLenum error = glGetError();
+ // Accepting a context loss error here enables using debug mode to work on
+ // context loss handling in virtual context mode.
diff --git a/electron34/patches/patch-ui_gl_gl__fence.cc b/electron34/patches/patch-ui_gl_gl__fence.cc
new file mode 100644
index 0000000000..f4079f3762
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_gl__fence.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/gl_fence.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/gl_fence.cc
+@@ -17,7 +17,7 @@
+ #include "ui/gl/gl_surface_egl.h"
+ #include "ui/gl/gl_version_info.h"
+
+-#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #define USE_GL_FENCE_ANDROID_NATIVE_FENCE_SYNC
+ #include "ui/gl/gl_fence_android_native_fence_sync.h"
+ #endif
diff --git a/electron34/patches/patch-ui_gl_gl__implementation.cc b/electron34/patches/patch-ui_gl_gl__implementation.cc
new file mode 100644
index 0000000000..58eb3234c2
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_gl__implementation.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/gl_implementation.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/gl_implementation.cc
+@@ -252,7 +252,7 @@ GetRequestedGLImplementationFromCommandL
+ const base::CommandLine* command_line) {
+ bool overrideUseSoftwareGL =
+ command_line->HasSwitch(switches::kOverrideUseSoftwareGLForTests);
+-#if BUILDFLAG(IS_LINUX) || \
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_CHROMEOS_DEVICE))
+ if (std::getenv("RUNNING_UNDER_RR")) {
+ // https://rr-project.org/ is a Linux-only record-and-replay debugger that
diff --git a/electron34/patches/patch-ui_gl_gl__switches.cc b/electron34/patches/patch-ui_gl_gl__switches.cc
new file mode 100644
index 0000000000..2bbb48aa6e
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_gl__switches.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/gl_switches.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/gl_switches.cc
+@@ -11,7 +11,7 @@
+ #include "base/android/build_info.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <vulkan/vulkan_core.h>
+ #include "third_party/angle/src/gpu_info_util/SystemInfo.h" // nogncheck
+ #endif
+@@ -289,7 +289,7 @@ bool IsDefaultANGLEVulkan() {
+ base::android::SDK_VERSION_Q)
+ return false;
+ #endif // BUILDFLAG(IS_ANDROID)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ angle::SystemInfo system_info;
+ if (!angle::GetSystemInfoVulkan(&system_info))
+ return false;
+@@ -301,7 +301,7 @@ bool IsDefaultANGLEVulkan() {
+
+ const auto& active_gpu = system_info.gpus[system_info.activeGPUIndex];
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Vulkan 1.1 is required.
+ if (active_gpu.driverApiVersion < VK_VERSION_1_1)
+ return false;
diff --git a/electron34/patches/patch-ui_gl_sync__control__vsync__provider.cc b/electron34/patches/patch-ui_gl_sync__control__vsync__provider.cc
new file mode 100644
index 0000000000..1fb70630c5
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_sync__control__vsync__provider.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/sync_control_vsync_provider.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/sync_control_vsync_provider.cc
+@@ -11,7 +11,7 @@
+ #include "base/trace_event/trace_event.h"
+ #include "build/build_config.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // These constants define a reasonable range for a calculated refresh interval.
+ // Calculating refreshes out of this range will be considered a fatal error.
+ const int64_t kMinVsyncIntervalUs = base::Time::kMicrosecondsPerSecond / 400;
+@@ -26,7 +26,7 @@ const double kRelativeIntervalDifference
+ namespace gl {
+
+ SyncControlVSyncProvider::SyncControlVSyncProvider() : gfx::VSyncProvider() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // On platforms where we can't get an accurate reading on the refresh
+ // rate we fall back to the assumption that we're displaying 60 frames
+ // per second.
+@@ -48,7 +48,7 @@ bool SyncControlVSyncProvider::GetVSyncP
+ base::TimeTicks* timebase_out,
+ base::TimeDelta* interval_out) {
+ TRACE_EVENT0("gpu", "SyncControlVSyncProvider::GetVSyncParameters");
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // The actual clock used for the system time returned by
+ // eglGetSyncValuesCHROMIUM is unspecified. In practice, the clock used is
+ // likely to be either CLOCK_REALTIME or CLOCK_MONOTONIC, so we compare the
+@@ -160,7 +160,7 @@ bool SyncControlVSyncProvider::GetVSyncP
+ }
+
+ bool SyncControlVSyncProvider::SupportGetVSyncParametersIfAvailable() const {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron34/patches/patch-ui_gl_sync__control__vsync__provider.h b/electron34/patches/patch-ui_gl_sync__control__vsync__provider.h
new file mode 100644
index 0000000000..50c2ef3981
--- /dev/null
+++ b/electron34/patches/patch-ui_gl_sync__control__vsync__provider.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gl/sync_control_vsync_provider.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gl/sync_control_vsync_provider.h
+@@ -31,7 +31,7 @@ class SyncControlVSyncProvider : public
+ bool SupportGetVSyncParametersIfAvailable() const override;
+
+ static constexpr bool IsSupported() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
+@@ -46,7 +46,7 @@ class SyncControlVSyncProvider : public
+ virtual bool GetMscRate(int32_t* numerator, int32_t* denominator) = 0;
+
+ private:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ base::TimeTicks last_timebase_;
+ uint64_t last_media_stream_counter_ = 0;
+ base::TimeDelta last_good_interval_;
diff --git a/electron34/patches/patch-ui_gtk_gtk__compat.cc b/electron34/patches/patch-ui_gtk_gtk__compat.cc
new file mode 100644
index 0000000000..1fe6be8db8
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_gtk__compat.cc
@@ -0,0 +1,68 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/gtk_compat.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/gtk_compat.cc
+@@ -62,27 +62,38 @@ auto DlCast(void* symbol) {
+ }
+
+ void* GetLibGio() {
++#if BUILDFLAG(IS_BSD)
++ static void* libgio = DlOpen("libgio-2.0.so");
++#else
+ static void* libgio = DlOpen("libgio-2.0.so.0");
++#endif
+ return libgio;
+ }
+
+-void* GetLibGdkPixbuf() {
+- static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
+- return libgdk_pixbuf;
+-}
+-
+ void* GetLibGdk3() {
++#if BUILDFLAG(IS_BSD)
++ static void* libgdk3 = DlOpen("libgdk-3.so");
++#else
+ static void* libgdk3 = DlOpen("libgdk-3.so.0");
++#endif
+ return libgdk3;
+ }
+
+ void* GetLibGtk3(bool check = true) {
++#if BUILDFLAG(IS_BSD)
++ static void* libgtk3 = DlOpen("libgtk-3.so", check);
++#else
+ static void* libgtk3 = DlOpen("libgtk-3.so.0", check);
++#endif
+ return libgtk3;
+ }
+
+ void* GetLibGtk4(bool check = true) {
++#if BUILDFLAG(IS_BSD)
++ static void* libgtk4 = DlOpen("libgtk-4.so", check);
++#else
+ static void* libgtk4 = DlOpen("libgtk-4.so.1", check);
++#endif
+ return libgtk4;
+ }
+
+@@ -134,6 +145,15 @@ gfx::Insets InsetsFromGtkBorder(const Gt
+
+ } // namespace
+
++void* GetLibGdkPixbuf() {
++#if BUILDFLAG(IS_BSD)
++ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so");
++#else
++ static void* libgdk_pixbuf = DlOpen("libgdk_pixbuf-2.0.so.0");
++#endif
++ return libgdk_pixbuf;
++}
++
+ bool LoadGtk() {
+ static bool loaded = LoadGtkImpl();
+ return loaded;
diff --git a/electron34/patches/patch-ui_gtk_gtk__compat.h b/electron34/patches/patch-ui_gtk_gtk__compat.h
new file mode 100644
index 0000000000..e9b23c0a66
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_gtk__compat.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/gtk_compat.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/gtk_compat.h
+@@ -41,6 +41,9 @@ using SkColor = uint32_t;
+
+ namespace gtk {
+
++// Get handle to the currently loaded gdk_pixbuf library in the process.
++void* GetLibGdkPixbuf();
++
+ // Loads libgtk and related libraries and returns true on success.
+ bool LoadGtk();
+
diff --git a/electron34/patches/patch-ui_gtk_gtk__ui.cc b/electron34/patches/patch-ui_gtk_gtk__ui.cc
new file mode 100644
index 0000000000..8db030cbd8
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_gtk__ui.cc
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/gtk_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/gtk_ui.cc
+@@ -584,11 +584,12 @@ std::unique_ptr<ui::NavButtonProvider> G
+ }
+
+ ui::WindowFrameProvider* GtkUi::GetWindowFrameProvider(bool solid_frame,
+- bool tiled) {
+- auto& provider = frame_providers_[solid_frame][tiled];
++ bool tiled,
++ bool maximized) {
++ auto& provider = frame_providers_[solid_frame][tiled][maximized];
+ if (!provider) {
+ provider =
+- std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame, tiled);
++ std::make_unique<gtk::WindowFrameProviderGtk>(solid_frame, tiled, maximized);
+ }
+ return provider.get();
+ }
diff --git a/electron34/patches/patch-ui_gtk_gtk__ui.h b/electron34/patches/patch-ui_gtk_gtk__ui.h
new file mode 100644
index 0000000000..c7102a06bd
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_gtk__ui.h
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/gtk_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/gtk_ui.h
+@@ -110,7 +110,8 @@ class GtkUi : public ui::LinuxUiAndTheme
+ void SetAccentColor(std::optional<SkColor> accent_color) override;
+ std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
+ ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
+- bool tiled) override;
++ bool tiled,
++ bool maximized) override;
+
+ private:
+ using TintMap = std::map<int, color_utils::HSL>;
+@@ -199,7 +200,7 @@ class GtkUi : public ui::LinuxUiAndTheme
+ // while Chrome is running. This 2D array is indexed first by whether the
+ // frame is translucent (0) or solid(1), then by whether the frame is normal
+ // (0) or tiled (1).
+- std::unique_ptr<ui::WindowFrameProvider> frame_providers_[2][2];
++ std::unique_ptr<ui::WindowFrameProvider> frame_providers_[2][2][2];
+
+ // Objects to notify when the window frame button order changes.
+ base::ObserverList<ui::WindowButtonOrderObserver>::Unchecked
diff --git a/electron34/patches/patch-ui_gtk_printing_print__dialog__gtk.cc b/electron34/patches/patch-ui_gtk_printing_print__dialog__gtk.cc
new file mode 100644
index 0000000000..5cc9cab404
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_printing_print__dialog__gtk.cc
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/printing/print_dialog_gtk.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/printing/print_dialog_gtk.cc
+@@ -247,6 +247,24 @@ void PrintDialogGtk::UpdateSettings(
+
+ gtk_print_settings_set_n_copies(gtk_settings_, settings->copies());
+ gtk_print_settings_set_collate(gtk_settings_, settings->collate());
++
++ auto print_ranges = settings->ranges();
++ if (!print_ranges.empty()) {
++ // Tell the system that we only intend to print a subset of pages.
++ gtk_print_settings_set_print_pages(gtk_settings_, GTK_PRINT_PAGES_RANGES);
++
++ GtkPageRange* ranges;
++ ranges = g_new(GtkPageRange, print_ranges.size());
++ for (size_t i = 0; i < print_ranges.size(); i++) {
++ auto range = print_ranges[i];
++ ranges[i].start = range.from;
++ ranges[i].end = range.to;
++ }
++
++ gtk_print_settings_set_page_ranges(gtk_settings_, ranges, 1);
++ g_free(ranges);
++ }
++
+ if (settings->dpi_horizontal() > 0 && settings->dpi_vertical() > 0) {
+ gtk_print_settings_set_resolution_xy(
+ gtk_settings_, settings->dpi_horizontal(), settings->dpi_vertical());
+@@ -438,7 +456,7 @@ void PrintDialogGtk::ShowDialog(
+ GtkPrintCapabilities cap = static_cast<GtkPrintCapabilities>(
+ GTK_PRINT_CAPABILITY_GENERATE_PDF | GTK_PRINT_CAPABILITY_PAGE_SET |
+ GTK_PRINT_CAPABILITY_COPIES | GTK_PRINT_CAPABILITY_COLLATE |
+- GTK_PRINT_CAPABILITY_REVERSE);
++ GTK_PRINT_CAPABILITY_REVERSE | GTK_PRINT_CAPABILITY_GENERATE_PS);
+ gtk_print_unix_dialog_set_manual_capabilities(
+ GTK_PRINT_UNIX_DIALOG(dialog_.get()), cap);
+ gtk_print_unix_dialog_set_embed_page_setup(
diff --git a/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc b/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc
new file mode 100644
index 0000000000..80ba6d6f43
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc
@@ -0,0 +1,134 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/select_file_dialog_linux_gtk.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/select_file_dialog_linux_gtk.cc
+@@ -259,8 +259,12 @@ void SelectFileDialogLinuxGtk::SelectFil
+ case SELECT_EXISTING_FOLDER:
+ dialog = CreateSelectFolderDialog(type, title_string, default_path,
+ owning_window);
+- connect("response",
+- &SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse);
++ if (allow_multiple_selection())
++ connect("response",
++ &SelectFileDialogLinuxGtk::OnSelectMultiFolderDialogResponse);
++ else
++ connect("response",
++ &SelectFileDialogLinuxGtk::OnSelectSingleFolderDialogResponse);
+ break;
+ case SELECT_OPEN_FILE:
+ dialog = CreateFileOpenDialog(title_string, default_path, owning_window);
+@@ -407,9 +411,11 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ const std::string& title,
+ const base::FilePath& default_path,
+ gfx::NativeWindow parent) {
++ const char* accept_button_label =
++ button_label().empty() ? GetOpenLabel() : button_label().c_str();
+ GtkWidget* dialog = GtkFileChooserDialogNew(
+ title.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_OPEN, GetCancelLabel(),
+- GTK_RESPONSE_CANCEL, GetOpenLabel(), GTK_RESPONSE_ACCEPT);
++ GTK_RESPONSE_CANCEL, accept_button_label, GTK_RESPONSE_ACCEPT);
+ SetGtkTransientForAura(dialog, parent);
+ AddFilters(GTK_FILE_CHOOSER(dialog));
+
+@@ -425,6 +431,7 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ GtkFileChooserSetCurrentFolder(GTK_FILE_CHOOSER(dialog),
+ *last_opened_path());
+ }
++ gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), show_hidden());
+ return dialog;
+ }
+
+@@ -440,11 +447,15 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ ? l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE)
+ : l10n_util::GetStringUTF8(IDS_SELECT_FOLDER_DIALOG_TITLE);
+ }
+- std::string accept_button_label =
+- (type == SELECT_UPLOAD_FOLDER)
+- ? l10n_util::GetStringUTF8(
+- IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON)
+- : GetOpenLabel();
++
++ std::string accept_button_label = button_label();
++ if (accept_button_label.empty()) {
++ accept_button_label =
++ (type == SELECT_UPLOAD_FOLDER)
++ ? l10n_util::GetStringUTF8(
++ IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON)
++ : GetOpenLabel();
++ }
+
+ GtkWidget* dialog = GtkFileChooserDialogNew(
+ title_string.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+@@ -466,7 +477,8 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ gtk_file_filter_add_mime_type(only_folders, "inode/directory");
+ gtk_file_filter_add_mime_type(only_folders, "text/directory");
+ gtk_file_chooser_add_filter(chooser, only_folders);
+- gtk_file_chooser_set_select_multiple(chooser, FALSE);
++ gtk_file_chooser_set_select_multiple(chooser, allow_multiple_selection());
++ gtk_file_chooser_set_show_hidden(chooser, show_hidden());
+ return dialog;
+ }
+
+@@ -503,10 +515,11 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ std::string title_string =
+ !title.empty() ? title
+ : l10n_util::GetStringUTF8(IDS_SAVE_AS_DIALOG_TITLE);
+-
++ const char* accept_button_label =
++ button_label().empty() ? GetSaveLabel() : button_label().c_str();
+ GtkWidget* dialog = GtkFileChooserDialogNew(
+ title_string.c_str(), nullptr, GTK_FILE_CHOOSER_ACTION_SAVE,
+- GetCancelLabel(), GTK_RESPONSE_CANCEL, GetSaveLabel(),
++ GetCancelLabel(), GTK_RESPONSE_CANCEL, accept_button_label,
+ GTK_RESPONSE_ACCEPT);
+ SetGtkTransientForAura(dialog, parent);
+
+@@ -532,9 +545,10 @@ GtkWidget* SelectFileDialogLinuxGtk::Cre
+ gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dialog), FALSE);
+ // Overwrite confirmation is always enabled in GTK4.
+ if (!GtkCheckVersion(4)) {
+- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog),
+- TRUE);
++ gtk_file_chooser_set_do_overwrite_confirmation(
++ GTK_FILE_CHOOSER(dialog), show_overwrite_confirmation());
+ }
++ gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dialog), show_hidden());
+ return dialog;
+ }
+
+@@ -589,15 +603,29 @@ void SelectFileDialogLinuxGtk::OnSelectS
+ void SelectFileDialogLinuxGtk::OnSelectMultiFileDialogResponse(
+ GtkWidget* dialog,
+ int response_id) {
++ SelectMultiFileHelper(dialog, response_id, false);
++}
++
++void SelectFileDialogLinuxGtk::OnSelectMultiFolderDialogResponse(
++ GtkWidget* dialog,
++ int response_id) {
++ SelectMultiFileHelper(dialog, response_id, true);
++}
++
++void SelectFileDialogLinuxGtk::SelectMultiFileHelper(GtkWidget* dialog,
++ int response_id,
++ bool allow_folder) {
+ if (IsCancelResponse(response_id)) {
+ FileNotSelected(dialog);
+ return;
+ }
+
+ auto filenames = GtkFileChooserGetFilenames(dialog);
+- std::erase_if(filenames, [this](const base::FilePath& path) {
+- return CallDirectoryExistsOnUIThread(path);
++ std::erase_if(filenames, [this, &allow_folder](const base::FilePath& path) {
++ bool directory_exists = CallDirectoryExistsOnUIThread(path);
++ return !allow_folder && directory_exists;
+ });
++
+ if (filenames.empty()) {
+ FileNotSelected(dialog);
+ return;
diff --git a/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.h b/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.h
new file mode 100644
index 0000000000..a6f8dda3cf
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_select__file__dialog__linux__gtk.h
@@ -0,0 +1,31 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/select_file_dialog_linux_gtk.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/select_file_dialog_linux_gtk.h
+@@ -108,6 +108,12 @@ class SelectFileDialogLinuxGtk : public
+ gint response_id,
+ bool allow_folder);
+
++ // Common function for OnSelectMultiFileDialogResponse and
++ // OnSelectMultiFolderDialogResponse.
++ void SelectMultiFileHelper(GtkWidget* dialog,
++ gint response_id,
++ bool allow_folder);
++
+ // Common function for CreateFileOpenDialog and CreateMultiFileOpenDialog.
+ GtkWidget* CreateFileOpenHelper(const std::string& title,
+ const base::FilePath& default_path,
+@@ -122,6 +128,9 @@ class SelectFileDialogLinuxGtk : public
+ // Callback for when the user responds to a Open Multiple Files dialog.
+ void OnSelectMultiFileDialogResponse(GtkWidget* dialog, int response_id);
+
++ // Callback for when the user responds to a Select Multiple Folders dialog.
++ void OnSelectMultiFolderDialogResponse(GtkWidget* dialog, int response_id);
++
+ // Callback for when the file chooser gets destroyed.
+ void OnFileChooserDestroy(GtkWidget* dialog);
+
diff --git a/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.cc b/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.cc
new file mode 100644
index 0000000000..3266002026
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.cc
@@ -0,0 +1,104 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/window_frame_provider_gtk.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/window_frame_provider_gtk.cc
+@@ -29,20 +29,23 @@ constexpr int kMaxFrameSizeDip = 64;
+ // will get an incorrect hint as to which pixels are fully opaque.
+ constexpr int kMaxCornerRadiusDip = 32;
+
+-GtkCssContext WindowContext(bool solid_frame, bool tiled, bool focused) {
++GtkCssContext WindowContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
+ std::string selector = "window.background.";
+ selector += solid_frame ? "solid-csd" : "csd";
+ if (tiled) {
+ selector += ".tiled";
+ }
++ if (maximized) {
++ selector += ".maximized";
++ }
+ if (!focused) {
+ selector += ":inactive";
+ }
+ return AppendCssNodeToStyleContext({}, selector);
+ }
+
+-GtkCssContext DecorationContext(bool solid_frame, bool tiled, bool focused) {
+- auto context = WindowContext(solid_frame, tiled, focused);
++GtkCssContext DecorationContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
++ auto context = WindowContext(solid_frame, tiled, maximized, focused);
+ // GTK4 renders the decoration directly on the window.
+ if (!GtkCheckVersion(4)) {
+ context = AppendCssNodeToStyleContext(context, "decoration");
+@@ -61,8 +64,8 @@ GtkCssContext DecorationContext(bool sol
+ return context;
+ }
+
+-GtkCssContext HeaderContext(bool solid_frame, bool tiled, bool focused) {
+- auto context = WindowContext(solid_frame, tiled, focused);
++GtkCssContext HeaderContext(bool solid_frame, bool tiled, bool maximized, bool focused) {
++ auto context = WindowContext(solid_frame, tiled, maximized, focused);
+ context =
+ AppendCssNodeToStyleContext(context, "headerbar.header-bar.titlebar");
+ if (!focused) {
+@@ -117,8 +120,8 @@ int ComputeTopCornerRadius() {
+ // need to experimentally determine the corner radius by rendering a sample.
+ // Additionally, in GTK4, the headerbar corners get clipped by the window
+ // rather than the headerbar having its own rounded corners.
+- auto context = GtkCheckVersion(4) ? DecorationContext(false, false, false)
+- : HeaderContext(false, false, false);
++ auto context = GtkCheckVersion(4) ? DecorationContext(false, false, false, false)
++ : HeaderContext(false, false, false, false);
+ ApplyCssToContext(context, R"(window, headerbar {
+ background-image: none;
+ background-color: black;
+@@ -152,7 +155,7 @@ int ComputeTopCornerRadius() {
+ bool HeaderIsTranslucent() {
+ // The arbitrary square size to render a sample header.
+ constexpr int kHeaderSize = 32;
+- auto context = HeaderContext(false, false, false);
++ auto context = HeaderContext(false, false, false, false);
+ double opacity = GetOpacityFromContext(context);
+ if (opacity < 1.0) {
+ return true;
+@@ -186,8 +189,8 @@ WindowFrameProviderGtk::Asset& WindowFra
+
+ WindowFrameProviderGtk::Asset::~Asset() = default;
+
+-WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool tiled)
+- : solid_frame_(solid_frame), tiled_(tiled) {
++WindowFrameProviderGtk::WindowFrameProviderGtk(bool solid_frame, bool tiled, bool maximized)
++ : solid_frame_(solid_frame), tiled_(tiled), maximized_(maximized) {
+ GtkSettings* settings = gtk_settings_get_default();
+ // Unretained() is safe since WindowFrameProviderGtk will own the signals.
+ auto callback = base::BindRepeating(&WindowFrameProviderGtk::OnThemeChanged,
+@@ -337,7 +340,7 @@ void WindowFrameProviderGtk::PaintWindow
+
+ auto header =
+ PaintHeaderbar({client_bounds_px.width(), top_area_height_px},
+- HeaderContext(solid_frame_, tiled_, focused), scale);
++ HeaderContext(solid_frame_, tiled_, maximized_, focused), scale);
+ image = gfx::ImageSkia::CreateFrom1xBitmap(header);
+ // In GTK4, the headerbar gets clipped by the window.
+ if (GtkCheckVersion(4)) {
+@@ -366,7 +369,7 @@ WindowFrameProviderGtk::Asset& WindowFra
+
+ gfx::Rect frame_bounds_dip(kMaxFrameSizeDip, kMaxFrameSizeDip,
+ 2 * kMaxFrameSizeDip, 2 * kMaxFrameSizeDip);
+- auto focused_context = DecorationContext(solid_frame_, tiled_, true);
++ auto focused_context = DecorationContext(solid_frame_, tiled_, maximized_, true);
+ frame_bounds_dip.Inset(-GtkStyleContextGetPadding(focused_context));
+ frame_bounds_dip.Inset(-GtkStyleContextGetBorder(focused_context));
+ gfx::Size bitmap_size(BitmapSizePx(asset), BitmapSizePx(asset));
+@@ -374,7 +377,7 @@ WindowFrameProviderGtk::Asset& WindowFra
+ focused_context, scale);
+ asset.unfocused_bitmap =
+ PaintBitmap(bitmap_size, gfx::RectF(frame_bounds_dip),
+- DecorationContext(solid_frame_, tiled_, false), scale);
++ DecorationContext(solid_frame_, tiled_, maximized_, false), scale);
+
+ return asset;
+ }
diff --git a/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.h b/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.h
new file mode 100644
index 0000000000..94a9e8171f
--- /dev/null
+++ b/electron34/patches/patch-ui_gtk_window__frame__provider__gtk.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/gtk/window_frame_provider_gtk.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/gtk/window_frame_provider_gtk.h
+@@ -20,7 +20,7 @@ namespace gtk {
+
+ class WindowFrameProviderGtk : public ui::WindowFrameProvider {
+ public:
+- WindowFrameProviderGtk(bool solid_frame, bool tiled);
++ WindowFrameProviderGtk(bool solid_frame, bool tiled, bool maximized);
+
+ WindowFrameProviderGtk(const WindowFrameProviderGtk&) = delete;
+ WindowFrameProviderGtk& operator=(const WindowFrameProviderGtk&) = delete;
+@@ -65,6 +65,8 @@ class WindowFrameProviderGtk : public ui
+ // Input parameters used for drawing.
+ const bool solid_frame_;
+ const bool tiled_;
++ // Whether to draw the window decorations as maximized.
++ const bool maximized_;
+
+ // Scale-independent metric calculated based on the bitmaps.
+ std::optional<gfx::Insets> frame_thickness_dip_;
diff --git a/electron34/patches/patch-ui_linux_fallback__linux__ui.cc b/electron34/patches/patch-ui_linux_fallback__linux__ui.cc
new file mode 100644
index 0000000000..7d2b87612e
--- /dev/null
+++ b/electron34/patches/patch-ui_linux_fallback__linux__ui.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/linux/fallback_linux_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/linux/fallback_linux_ui.cc
+@@ -143,7 +143,8 @@ FallbackLinuxUi::CreateNavButtonProvider
+
+ ui::WindowFrameProvider* FallbackLinuxUi::GetWindowFrameProvider(
+ bool solid_frame,
+- bool tiled) {
++ bool tiled,
++ bool maximized) {
+ return nullptr;
+ }
+
diff --git a/electron34/patches/patch-ui_linux_fallback__linux__ui.h b/electron34/patches/patch-ui_linux_fallback__linux__ui.h
new file mode 100644
index 0000000000..b05cec288c
--- /dev/null
+++ b/electron34/patches/patch-ui_linux_fallback__linux__ui.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/linux/fallback_linux_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/linux/fallback_linux_ui.h
+@@ -67,7 +67,8 @@ class FallbackLinuxUi : public LinuxUiAn
+ void SetAccentColor(std::optional<SkColor> accent_color) override;
+ std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
+ ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
+- bool tiled) override;
++ bool tiled,
++ bool maximized) override;
+
+ private:
+ std::optional<gfx::FontRenderParams> default_font_render_params_;
diff --git a/electron34/patches/patch-ui_linux_linux__ui.h b/electron34/patches/patch-ui_linux_linux__ui.h
new file mode 100644
index 0000000000..c80d6edc7d
--- /dev/null
+++ b/electron34/patches/patch-ui_linux_linux__ui.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/linux/linux_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/linux/linux_ui.h
+@@ -306,7 +306,8 @@ class COMPONENT_EXPORT(LINUX_UI) LinuxUi
+ // The returned object is not owned by the caller and will remain alive until
+ // the process ends.
+ virtual WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
+- bool tiled) = 0;
++ bool tiled,
++ bool maximized) = 0;
+
+ protected:
+ LinuxUiTheme();
diff --git a/electron34/patches/patch-ui_menus_simple__menu__model.cc b/electron34/patches/patch-ui_menus_simple__menu__model.cc
new file mode 100644
index 0000000000..6b3c1ee3e4
--- /dev/null
+++ b/electron34/patches/patch-ui_menus_simple__menu__model.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/menus/simple_menu_model.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/menus/simple_menu_model.cc
+@@ -54,6 +54,11 @@ std::u16string SimpleMenuModel::Delegate
+ return std::u16string();
+ }
+
++std::u16string SimpleMenuModel::Delegate::GetSecondaryLabelForCommandId(
++ int command_id) const {
++ return std::u16string();
++}
++
+ ImageModel SimpleMenuModel::Delegate::GetIconForCommandId(
+ int command_id) const {
+ return ImageModel();
+@@ -347,6 +352,11 @@ void SimpleMenuModel::SetAcceleratorAt(s
+ MenuItemsChanged();
+ }
+
++void SimpleMenuModel::SetSecondaryLabel(size_t index, const std::u16string& secondary_label) {
++ items_[ValidateItemIndex(index)].secondary_label = secondary_label;
++ MenuItemsChanged();
++}
++
+ void SimpleMenuModel::SetMinorText(size_t index,
+ const std::u16string& minor_text) {
+ items_[ValidateItemIndex(index)].minor_text = minor_text;
+@@ -453,6 +463,12 @@ std::u16string SimpleMenuModel::GetLabel
+ return items_[ValidateItemIndex(index)].label;
+ }
+
++std::u16string SimpleMenuModel::GetSecondaryLabelAt(size_t index) const {
++ if (IsItemDynamicAt(index))
++ return delegate_->GetSecondaryLabelForCommandId(GetCommandIdAt(index));
++ return items_[ValidateItemIndex(index)].secondary_label;
++}
++
+ std::u16string SimpleMenuModel::GetMinorTextAt(size_t index) const {
+ return items_[ValidateItemIndex(index)].minor_text;
+ }
diff --git a/electron34/patches/patch-ui_menus_simple__menu__model.h b/electron34/patches/patch-ui_menus_simple__menu__model.h
new file mode 100644
index 0000000000..f15d89593c
--- /dev/null
+++ b/electron34/patches/patch-ui_menus_simple__menu__model.h
@@ -0,0 +1,42 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/menus/simple_menu_model.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/menus/simple_menu_model.h
+@@ -99,6 +99,7 @@ class COMPONENT_EXPORT(UI_MENUS) SimpleM
+ // Some command ids have labels and icons that change over time.
+ virtual bool IsItemForCommandIdDynamic(int command_id) const;
+ virtual std::u16string GetLabelForCommandId(int command_id) const;
++ virtual std::u16string GetSecondaryLabelForCommandId(int command_id) const;
+ // Gets the icon for the item with the specified id.
+ virtual ImageModel GetIconForCommandId(int command_id) const;
+
+@@ -224,6 +225,9 @@ class COMPONENT_EXPORT(UI_MENUS) SimpleM
+ // former is set).
+ void SetAcceleratorAt(size_t index, const ui::Accelerator& accelerator);
+
++ // Sets the secondary_label for the item at |index|.
++ void SetSecondaryLabel(size_t index, const std::u16string& secondary_label);
++
+ // Sets the minor text for the item at |index|.
+ void SetMinorText(size_t index, const std::u16string& minor_text);
+
+@@ -274,6 +278,7 @@ class COMPONENT_EXPORT(UI_MENUS) SimpleM
+ ui::MenuSeparatorType GetSeparatorTypeAt(size_t index) const override;
+ int GetCommandIdAt(size_t index) const override;
+ std::u16string GetLabelAt(size_t index) const override;
++ std::u16string GetSecondaryLabelAt(size_t index) const override;
+ std::u16string GetMinorTextAt(size_t index) const override;
+ ImageModel GetMinorIconAt(size_t index) const override;
+ bool IsItemDynamicAt(size_t index) const override;
+@@ -321,6 +326,7 @@ class COMPONENT_EXPORT(UI_MENUS) SimpleM
+ ItemType type = TYPE_COMMAND;
+ std::u16string label;
+ ui::Accelerator accelerator;
++ std::u16string secondary_label;
+ std::u16string minor_text;
+ ImageModel minor_icon;
+ ImageModel icon;
diff --git a/electron34/patches/patch-ui_message__center_views_message__popup__view.cc b/electron34/patches/patch-ui_message__center_views_message__popup__view.cc
new file mode 100644
index 0000000000..f7cbf77294
--- /dev/null
+++ b/electron34/patches/patch-ui_message__center_views_message__popup__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/message_center/views/message_popup_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/message_center/views/message_popup_view.cc
+@@ -153,7 +153,7 @@ std::unique_ptr<views::Widget> MessagePo
+ views::Widget::InitParams::CLIENT_OWNS_WIDGET,
+ views::Widget::InitParams::TYPE_POPUP);
+ params.z_order = ui::ZOrderLevel::kFloatingWindow;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Make the widget explicitly activatable as TYPE_POPUP is not activatable by
+ // default but we need focus for the inline reply textarea.
+ params.activatable = views::Widget::InitParams::Activatable::kYes;
diff --git a/electron34/patches/patch-ui_native__theme_native__theme.cc b/electron34/patches/patch-ui_native__theme_native__theme.cc
new file mode 100644
index 0000000000..ab785cede4
--- /dev/null
+++ b/electron34/patches/patch-ui_native__theme_native__theme.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/native_theme/native_theme.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/native_theme/native_theme.cc
+@@ -211,6 +211,8 @@ NativeTheme::NativeTheme(bool should_use
+ NativeTheme::~NativeTheme() = default;
+
+ bool NativeTheme::ShouldUseDarkColors() const {
++ if (theme_source() == ThemeSource::kForcedLight) return false;
++ if (theme_source() == ThemeSource::kForcedDark) return true;
+ return should_use_dark_colors_;
+ }
+
diff --git a/electron34/patches/patch-ui_native__theme_native__theme.h b/electron34/patches/patch-ui_native__theme_native__theme.h
new file mode 100644
index 0000000000..407b880c48
--- /dev/null
+++ b/electron34/patches/patch-ui_native__theme_native__theme.h
@@ -0,0 +1,49 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/native_theme/native_theme.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/native_theme/native_theme.h
+@@ -61,7 +61,7 @@ class NATIVE_THEME_EXPORT NativeTheme {
+ // The part to be painted / sized.
+ enum Part {
+ kCheckbox,
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ kFrameTopArea,
+ #endif
+ kInnerSpinButton,
+@@ -443,6 +443,23 @@ class NATIVE_THEME_EXPORT NativeTheme {
+ scoped_refptr<ColorProviderKey::ThemeInitializerSupplier> custom_theme,
+ bool use_custom_frame = true) const;
+
++
++ enum ThemeSource {
++ kSystem,
++ kForcedDark,
++ kForcedLight,
++ };
++
++ ThemeSource theme_source() const {
++ return theme_source_;
++ }
++
++ void set_theme_source(ThemeSource theme_source) {
++ bool original = ShouldUseDarkColors();
++ theme_source_ = theme_source;
++ if (ShouldUseDarkColors() != original) NotifyOnNativeThemeUpdated();
++ }
++
+ // Returns a shared instance of the native theme that should be used for web
+ // rendering. Do not use it in a normal application context (i.e. browser).
+ // The returned object should not be deleted by the caller. This function is
+@@ -680,6 +697,7 @@ class NATIVE_THEME_EXPORT NativeTheme {
+ PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference;
+ std::optional<base::TimeDelta> caret_blink_interval_;
+ bool use_overlay_scrollbars_ = false;
++ ThemeSource theme_source_ = ThemeSource::kSystem;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+ };
diff --git a/electron34/patches/patch-ui_native__theme_native__theme__base.cc b/electron34/patches/patch-ui_native__theme_native__theme__base.cc
new file mode 100644
index 0000000000..cfdf15788a
--- /dev/null
+++ b/electron34/patches/patch-ui_native__theme_native__theme__base.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/native_theme/native_theme_base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/native_theme/native_theme_base.cc
+@@ -237,7 +237,7 @@ void NativeThemeBase::Paint(cc::PaintCan
+ absl::get<ButtonExtraParams>(extra), color_scheme,
+ accent_color_opaque);
+ break;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ case kFrameTopArea:
+ PaintFrameTopArea(canvas, state, rect,
+ absl::get<FrameTopAreaExtraParams>(extra),
diff --git a/electron34/patches/patch-ui_native__theme_native__theme__features.cc b/electron34/patches/patch-ui_native__theme_native__theme__features.cc
new file mode 100644
index 0000000000..c74fa88b7f
--- /dev/null
+++ b/electron34/patches/patch-ui_native__theme_native__theme__features.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/native_theme/native_theme_features.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/native_theme/native_theme_features.cc
+@@ -56,7 +56,7 @@ namespace ui {
+
+ bool IsFluentOverlayScrollbarEnabled() {
+ // Fluent scrollbars are only used for some OSes due to UI design guidelines.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(features::kFluentOverlayScrollbar);
+ #else
+ return false;
+@@ -65,7 +65,7 @@ bool IsFluentOverlayScrollbarEnabled() {
+
+ bool IsFluentScrollbarEnabled() {
+ // Fluent scrollbars are only used for some OSes due to UI design guidelines.
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(features::kFluentScrollbar) ||
+ IsFluentOverlayScrollbarEnabled();
+ #else
diff --git a/electron34/patches/patch-ui_native__theme_native__theme__win.cc b/electron34/patches/patch-ui_native__theme_native__theme__win.cc
new file mode 100644
index 0000000000..680ad4eb47
--- /dev/null
+++ b/electron34/patches/patch-ui_native__theme_native__theme__win.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/native_theme/native_theme_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/native_theme/native_theme_win.cc
+@@ -678,6 +678,8 @@ bool NativeThemeWin::ShouldUseDarkColors
+ // ...unless --force-dark-mode was specified in which case caveat emptor.
+ if (InForcedColorsMode() && !IsForcedDarkMode())
+ return false;
++ if (theme_source() == ThemeSource::kForcedLight) return false;
++ if (theme_source() == ThemeSource::kForcedDark) return true;
+ return NativeTheme::ShouldUseDarkColors();
+ }
+
diff --git a/electron34/patches/patch-ui_ozone_common_egl__util.cc b/electron34/patches/patch-ui_ozone_common_egl__util.cc
new file mode 100644
index 0000000000..d3a01d6e89
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_common_egl__util.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/common/egl_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/common/egl_util.cc
+@@ -26,9 +26,9 @@ const base::FilePath::CharType kDefaultG
+ FILE_PATH_LITERAL("libGLESv2.so");
+ #else // BUILDFLAG(IS_FUCHSIA)
+ const base::FilePath::CharType kDefaultEglSoname[] =
+- FILE_PATH_LITERAL("libEGL.so.1");
++ FILE_PATH_LITERAL("libEGL.so");
+ const base::FilePath::CharType kDefaultGlesSoname[] =
+- FILE_PATH_LITERAL("libGLESv2.so.2");
++ FILE_PATH_LITERAL("libGLESv2.so");
+ #endif
+ const base::FilePath::CharType kAngleEglSoname[] =
+ FILE_PATH_LITERAL("libEGL.so");
diff --git a/electron34/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc b/electron34/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc
new file mode 100644
index 0000000000..b063da8d7a
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/headless/headless_surface_factory.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/headless/headless_surface_factory.cc
+@@ -34,7 +34,7 @@
+ #include "ui/ozone/platform/headless/headless_window_manager.h"
+ #include "ui/ozone/public/surface_ozone_canvas.h"
+
+-#if BUILDFLAG(ENABLE_VULKAN) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA))
++#if BUILDFLAG(ENABLE_VULKAN) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD))
+ #include "ui/ozone/platform/headless/vulkan_implementation_headless.h"
+ #endif
+
+@@ -281,7 +281,7 @@ std::unique_ptr<gpu::VulkanImplementatio
+ HeadlessSurfaceFactory::CreateVulkanImplementation(
+ bool use_swiftshader,
+ bool allow_protected_memory) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ return std::make_unique<VulkanImplementationHeadless>(use_swiftshader);
+ #else
+ return nullptr;
diff --git a/electron34/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc b/electron34/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc
new file mode 100644
index 0000000000..7449a37efe
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/headless/ozone_platform_headless.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/headless/ozone_platform_headless.cc
+@@ -103,7 +103,7 @@ class OzonePlatformHeadless : public Ozo
+ }
+
+ // Desktop Linux, not CastOS.
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CASTOS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CASTOS)
+ const PlatformProperties& GetPlatformProperties() override {
+ static base::NoDestructor<OzonePlatform::PlatformProperties> properties;
+ static bool initialized = false;
diff --git a/electron34/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc b/electron34/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc
new file mode 100644
index 0000000000..b07889d2b7
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/headless/vulkan_implementation_headless.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/headless/vulkan_implementation_headless.cc
+@@ -116,7 +116,7 @@ VulkanImplementationHeadless::ExportVkFe
+
+ VkExternalSemaphoreHandleTypeFlagBits
+ VulkanImplementationHeadless::GetExternalSemaphoreHandleType() {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT;
+ #else
+ return VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT;
+@@ -126,7 +126,7 @@ VulkanImplementationHeadless::GetExterna
+ bool VulkanImplementationHeadless::CanImportGpuMemoryBuffer(
+ gpu::VulkanDeviceQueue* device_queue,
+ gfx::GpuMemoryBufferType memory_buffer_type) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const auto& enabled_extensions = device_queue->enabled_extensions();
+ return gfx::HasExtension(enabled_extensions,
+ VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME) &&
+@@ -149,7 +149,7 @@ VulkanImplementationHeadless::CreateImag
+ VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
+ VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT;
+ auto tiling = VK_IMAGE_TILING_OPTIMAL;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (gmb_handle.native_pixmap_handle.modifier !=
+ gfx::NativePixmapHandle::kNoModifier) {
+ tiling = VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT;
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc b/electron34/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc
new file mode 100644
index 0000000000..3c909e4bd8
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/common/wayland_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/common/wayland_util.cc
+@@ -343,7 +343,7 @@ void TransformToWlArray(
+ }
+
+ base::TimeTicks EventMillisecondsToTimeTicks(uint32_t milliseconds) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40287874): `milliseconds` comes from Weston that
+ // uses timestamp from libinput, which is different from TimeTicks.
+ // Use EventTimeForNow(), for now.
+@@ -385,7 +385,7 @@ bool MaybeHandlePlatformEventForDrag(con
+ }
+
+ void RecordConnectionMetrics(wl_display* display) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ CHECK(display);
+
+ // These values are logged to metrics so must not be changed.
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc b/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc
new file mode 100644
index 0000000000..8eced66dca
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/emulate/wayland_input_emulate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/emulate/wayland_input_emulate.cc
+@@ -284,7 +284,7 @@ void WaylandInputEmulate::EmulateUpdateD
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void WaylandInputEmulate::ForceUseScreenCoordinatesOnce() {
+ force_use_screen_coordinates_once_ = true;
+ }
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h b/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h
new file mode 100644
index 0000000000..4498551188
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/emulate/wayland_input_emulate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/emulate/wayland_input_emulate.h
+@@ -68,7 +68,7 @@ class WaylandInputEmulate : public wl::W
+ uint32_t request_id);
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void ForceUseScreenCoordinatesOnce();
+ #endif
+
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc b/electron34/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc
new file mode 100644
index 0000000000..273c515e61
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/gpu/vulkan_implementation_wayland.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/gpu/vulkan_implementation_wayland.cc
+@@ -38,7 +38,11 @@ bool VulkanImplementationWayland::Initia
+
+ path = path.Append("libvk_swiftshader.so");
+ } else {
++#if BUILDFLAG(IS_BSD)
++ path = base::FilePath("libvulkan.so");
++#else
+ path = base::FilePath("libvulkan.so.1");
++#endif
+ }
+
+ return vulkan_instance_.Initialize(path, required_extensions, {});
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc
new file mode 100644
index 0000000000..d86e464eba
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_connection.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_connection.cc
+@@ -540,7 +540,7 @@ bool WaylandConnection::ShouldUseOverlay
+ // isn't present on any non-exo Wayland compositors.
+ bool should_use_overlay_delegation =
+ IsWaylandOverlayDelegationEnabled() && !fractional_scale_manager_v1();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Overlay delegation also requires a single-pixel-buffer protocol, which
+ // allows creation of non-backed solid color buffers. Even though only video
+ // overlays can be supported on Linux, these color buffers are still needed
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc
new file mode 100644
index 0000000000..fe15792ef0
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_input_method_context.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_input_method_context.cc
+@@ -60,7 +60,7 @@ namespace {
+ // Only enable the preedit string for sequence mode (i.e. when using dead keys
+ // or the Compose key) on Linux ozone/wayland (see b/220370007).
+ constexpr CharacterComposer::PreeditStringMode kPreeditStringMode =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ CharacterComposer::PreeditStringMode::kAlwaysEnabled;
+ #else
+ CharacterComposer::PreeditStringMode::kHexModeOnly;
+@@ -552,6 +552,7 @@ void WaylandInputMethodContext::OnPreedi
+ const gfx::Range& preedit_cursor) {
+ CompositionText composition_text;
+ composition_text.text = base::UTF8ToUTF16(text);
++ bool has_composition_style = false;
+ for (const auto& span : spans) {
+ auto start_offset = OffsetFromUTF8Offset(text, span.index);
+ if (!start_offset)
+@@ -562,9 +563,18 @@ void WaylandInputMethodContext::OnPreedi
+ const auto& style = span.style;
+ if (!style.has_value())
+ continue;
++ if (style->type == ImeTextSpan::Type::kComposition) {
++ has_composition_style = true;
++ }
+ composition_text.ime_text_spans.emplace_back(style->type, *start_offset,
+ *end_offset, style->thickness);
+ }
++ if (!composition_text.text.empty() && !has_composition_style) {
++ // If no explicit composition style is specified, add default composition
++ // style to the composition text.
++ composition_text.ime_text_spans.emplace_back(
++ ImeTextSpan::Type::kComposition, 0, composition_text.text.length());
++ }
+ if (!preedit_cursor.IsValid()) {
+ // This is the case if a preceding preedit_cursor event in text-input-v1 was
+ // not received or an explicit negative value was requested to hide the
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context__unittest.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context__unittest.cc
new file mode 100644
index 0000000000..ecffdbb019
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context__unittest.cc
@@ -0,0 +1,67 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_input_method_context_unittest.cc
+@@ -1174,6 +1174,34 @@ TEST_P(WaylandInputMethodContextTest, Se
+ });
+ }
+
++TEST_P(WaylandInputMethodContextTest, OnPreeditChangedDefaultCompositionStyle) {
++ constexpr std::string_view kPreeditString("PreeditString");
++ constexpr gfx::Range kSelection{7, 13};
++ input_method_context_->OnPreeditString(
++ kPreeditString,
++ // No composition style provided.
++ {{1,
++ 3,
++ {{ImeTextSpan::Type::kMisspellingSuggestion,
++ ImeTextSpan::Thickness::kNone}}}},
++ kSelection);
++ EXPECT_TRUE(input_method_context_delegate_->was_on_preedit_changed_called());
++ EXPECT_EQ(input_method_context_delegate_->last_preedit()->ime_text_spans,
++ (ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kMisspellingSuggestion,
++ 1, 4, ImeTextSpan::Thickness::kNone),
++ // Default composition should be applied.
++ ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
++ kPreeditString.size(),
++ ImeTextSpan::Thickness::kThin)}));
++ EXPECT_EQ(
++ input_method_context_->predicted_state_for_testing().surrounding_text,
++ u"PreeditString");
++ EXPECT_EQ(input_method_context_->predicted_state_for_testing().composition,
++ gfx::Range(0, kPreeditString.size()));
++ EXPECT_EQ(input_method_context_->predicted_state_for_testing().selection,
++ kSelection);
++}
++
+ TEST_P(WaylandInputMethodContextTest, OnPreeditChanged) {
+ constexpr std::string_view kPreeditString("PreeditString");
+ constexpr gfx::Range kSelection{7, 13};
+@@ -1181,13 +1209,19 @@ TEST_P(WaylandInputMethodContextTest, On
+ kPreeditString,
+ {{0,
+ static_cast<uint32_t>(kPreeditString.size()),
+- {{ImeTextSpan::Type::kComposition, ImeTextSpan::Thickness::kThin}}}},
++ {{ImeTextSpan::Type::kComposition, ImeTextSpan::Thickness::kThick}}},
++ {1,
++ 3,
++ {{ImeTextSpan::Type::kMisspellingSuggestion,
++ ImeTextSpan::Thickness::kNone}}}},
+ kSelection);
+ EXPECT_TRUE(input_method_context_delegate_->was_on_preedit_changed_called());
+ EXPECT_EQ(input_method_context_delegate_->last_preedit()->ime_text_spans,
+- ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
+- kPreeditString.size(),
+- ImeTextSpan::Thickness::kThin)});
++ (ImeTextSpans{ImeTextSpan(ImeTextSpan::Type::kComposition, 0,
++ kPreeditString.size(),
++ ImeTextSpan::Thickness::kThick),
++ ImeTextSpan(ImeTextSpan::Type::kMisspellingSuggestion,
++ 1, 4, ImeTextSpan::Thickness::kNone)}));
+ EXPECT_EQ(
+ input_method_context_->predicted_state_for_testing().surrounding_text,
+ u"PreeditString");
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc
new file mode 100644
index 0000000000..4b79df48b5
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_popup.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_popup.cc
+@@ -34,7 +34,7 @@ WaylandPopup::WaylandPopup(PlatformWindo
+ WaylandWindow* parent)
+ : WaylandWindow(delegate, connection) {
+ set_parent_window(parent);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/330384470): Whether the popup appear depends on whether
+ // anchor point is outside of the parent xdg_surface. On Mutter the popup will
+ // not show when outside.
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc
new file mode 100644
index 0000000000..14a70e3314
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_toplevel_window.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
+@@ -616,7 +616,7 @@ void WaylandToplevelWindow::HandleToplev
+ bool prev_suspended = is_suspended_;
+ is_suspended_ = window_states.is_suspended;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The tiled state affects the window geometry, so apply it here.
+ if (window_states.tiled_edges != tiled_state_) {
+ // This configure changes the decoration insets. We should adjust the
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h
new file mode 100644
index 0000000000..bad7c433f0
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_toplevel_window.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_toplevel_window.h
+@@ -252,7 +252,7 @@ class WaylandToplevelWindow : public Way
+ // The display ID to switch to in case the state is `kFullscreen`.
+ int64_t fullscreen_display_id_ = display::kInvalidDisplayId;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Contains the current state of the tiled edges.
+ WindowTiledEdges tiled_state_;
+ #endif
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc
new file mode 100644
index 0000000000..0df4f5c6c1
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc
@@ -0,0 +1,50 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_window.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_window.cc
+@@ -330,7 +330,7 @@ void WaylandWindow::OnPointerFocusChange
+ // Whenever the window gets the pointer focus back, the cursor shape must be
+ // updated. Otherwise, it is invalidated upon wl_pointer::leave and is not
+ // restored by the Wayland compositor.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (focused && async_cursor_) {
+ async_cursor_->AddCursorLoadedCallback(base::BindOnce(
+ &WaylandWindow::OnCursorLoaded, AsWeakPtr(), async_cursor_));
+@@ -611,7 +611,7 @@ bool WaylandWindow::ShouldUseNativeFrame
+ void WaylandWindow::SetCursor(scoped_refptr<PlatformCursor> platform_cursor) {
+ DCHECK(platform_cursor);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto async_cursor = WaylandAsyncCursor::FromPlatformCursor(platform_cursor);
+
+ if (async_cursor_ == async_cursor) {
+@@ -813,7 +813,7 @@ std::string WaylandWindow::WindowStates:
+ } else {
+ base::TrimString(states, " ", &states);
+ }
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ states += "; tiled_edges: ";
+ std::string tiled = "";
+ if (tiled_edges.left) {
+@@ -1318,12 +1318,12 @@ void WaylandWindow::UpdateCursorShape(sc
+ cursor->bitmaps(), hotspot_in_dips,
+ std::ceil(cursor->cursor_image_scale_factor()));
+ }
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+ cursor_ = cursor;
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void WaylandWindow::OnCursorLoaded(scoped_refptr<WaylandAsyncCursor> cursor,
+ scoped_refptr<BitmapCursor> bitmap_cursor) {
+ if (HasPointerFocus() && async_cursor_ == cursor && bitmap_cursor) {
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h
new file mode 100644
index 0000000000..71dc22edd5
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/wayland_window.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/wayland_window.h
+@@ -41,7 +41,7 @@
+ #include "ui/platform_window/platform_window_init_properties.h"
+ #include "ui/platform_window/wm/wm_drag_handler.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/platform/wayland/host/wayland_async_cursor.h"
+ #endif
+
+@@ -276,7 +276,7 @@ class WaylandWindow : public PlatformWin
+ bool is_floated = false;
+ bool is_pip = false;
+ bool is_suspended = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WindowTiledEdges tiled_edges;
+ #endif
+
+@@ -572,7 +572,7 @@ class WaylandWindow : public PlatformWin
+
+ void UpdateCursorShape(scoped_refptr<BitmapCursor> cursor);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void OnCursorLoaded(scoped_refptr<WaylandAsyncCursor> cursor,
+ scoped_refptr<BitmapCursor> bitmap_cursor);
+ #endif
+@@ -644,7 +644,7 @@ class WaylandWindow : public PlatformWin
+
+ wl::Object<zaura_surface> aura_surface_;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The current asynchronously loaded cursor (Linux specific).
+ scoped_refptr<WaylandAsyncCursor> async_cursor_;
+ #else
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc b/electron34/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc
new file mode 100644
index 0000000000..707f742615
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.cc
+@@ -256,6 +256,10 @@ void ZWPTextInputWrapperV1::SetSurroundi
+ // so if it exceeds 16 bits, it may be broken.
+ static constexpr size_t kSizeLimit = 60000;
+ if (HasAdvancedSurroundingTextSupport() && text.length() > kSizeLimit) {
++#if defined(__FreeBSD_version) && __FreeBSD_version < 1300048
++ PLOG(ERROR) << "memfd is not supported";
++ return;
++#else
+ base::ScopedFD memfd(memfd_create("surrounding_text", MFD_CLOEXEC));
+ if (!memfd.get()) {
+ PLOG(ERROR) << "Failed to create memfd";
+@@ -268,6 +272,7 @@ void ZWPTextInputWrapperV1::SetSurroundi
+ zcr_extended_text_input_v1_set_large_surrounding_text(
+ extended_obj_.get(), memfd.get(), text.length(),
+ selection_range.start(), selection_range.end());
++#endif
+ } else {
+ zwp_text_input_v1_set_surrounding_text(obj_.get(), text.c_str(),
+ selection_range.start(),
diff --git a/electron34/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc b/electron34/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc
new file mode 100644
index 0000000000..de3b1cff9f
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc
@@ -0,0 +1,60 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/wayland/ozone_platform_wayland.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/wayland/ozone_platform_wayland.cc
+@@ -69,13 +69,13 @@
+ #include "ui/events/ozone/layout/stub/stub_keyboard_layout_engine.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/platform/wayland/host/wayland_cursor_factory.h"
+ #else
+ #include "ui/ozone/common/bitmap_cursor_factory.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/ozone/platform/wayland/host/linux_ui_delegate_wayland.h"
+ #endif
+
+@@ -295,7 +295,7 @@ class OzonePlatformWayland : public Ozon
+
+ buffer_manager_connector_ = std::make_unique<WaylandBufferManagerConnector>(
+ connection_->buffer_manager_host());
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ cursor_factory_ = std::make_unique<WaylandCursorFactory>(connection_.get());
+ #else
+ cursor_factory_ = std::make_unique<BitmapCursorFactory>();
+@@ -305,7 +305,7 @@ class OzonePlatformWayland : public Ozon
+
+ supported_buffer_formats_ =
+ connection_->buffer_manager_host()->GetSupportedBufferFormats();
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ linux_ui_delegate_ =
+ std::make_unique<LinuxUiDelegateWayland>(connection_.get());
+ #endif
+@@ -371,7 +371,7 @@ class OzonePlatformWayland : public Ozon
+ properties->supports_global_screen_coordinates =
+ kDefaultScreenCoordinateEnabled;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40800718): Revisit (and maybe remove) once proper
+ // support, probably backed by org.freedesktop.portal.Screenshot.PickColor
+ // API is implemented. Note: this is restricted to Linux Desktop as Lacros
+@@ -573,7 +573,7 @@ class OzonePlatformWayland : public Ozon
+ DrmRenderNodePathFinder path_finder_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<LinuxUiDelegateWayland> linux_ui_delegate_;
+ #endif
+ };
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_BUILD.gn b/electron34/patches/patch-ui_ozone_platform_x11_BUILD.gn
new file mode 100644
index 0000000000..a443a19eb1
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_BUILD.gn
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/BUILD.gn
+@@ -6,7 +6,7 @@ import("//build/config/chromeos/ui_mode.
+ import("//gpu/vulkan/features.gni")
+ import("//ui/base/ui_features.gni")
+
+-visibility = [ "//ui/ozone/*" ]
++visibility = [ "//ui/ozone/*", "//electron:*" ]
+
+ assert(is_linux || is_chromeos)
+
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc b/electron34/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc
new file mode 100644
index 0000000000..45b0061399
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/ozone_platform_x11.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/ozone_platform_x11.cc
+@@ -193,6 +193,7 @@ class OzonePlatformX11 : public OzonePla
+ base::MessagePumpType::UI;
+ properties->supports_vulkan_swap_chain = true;
+ properties->skia_can_fall_back_to_x11 = true;
++ properties->electron_can_call_x11 = true;
+ properties->platform_shows_drag_image = false;
+ properties->supports_global_application_menus = true;
+ properties->app_modal_dialogs_use_event_blocker = true;
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc b/electron34/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc
new file mode 100644
index 0000000000..1f17259a4d
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc
@@ -0,0 +1,20 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/vulkan_implementation_x11.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/vulkan_implementation_x11.cc
+@@ -59,7 +59,11 @@ bool VulkanImplementationX11::Initialize
+
+ path = path.Append("libvk_swiftshader.so");
+ } else {
++#if BUILDFLAG(IS_BSD)
++ path = base::FilePath("libvulkan.so");
++#else
+ path = base::FilePath("libvulkan.so.1");
++#endif
+ }
+
+ return vulkan_instance_.Initialize(path, required_extensions, {});
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc b/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc
new file mode 100644
index 0000000000..22feb45b0b
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.cc
+@@ -26,27 +26,30 @@ void X11GlobalShortcutListenerOzone::Sto
+ bool X11GlobalShortcutListenerOzone::RegisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
++ bool is_shift_down,
++ bool is_cmd_down) {
+ return XGlobalShortcutListener::RegisterAccelerator(
+- key_code, is_alt_down, is_ctrl_down, is_shift_down);
++ key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
+ }
+
+ void X11GlobalShortcutListenerOzone::UnregisterAccelerator(
+ KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
++ bool is_shift_down,
++ bool is_cmd_down) {
+ return XGlobalShortcutListener::UnregisterAccelerator(
+- key_code, is_alt_down, is_ctrl_down, is_shift_down);
++ key_code, is_alt_down, is_ctrl_down, is_shift_down, is_cmd_down);
+ }
+
+ void X11GlobalShortcutListenerOzone::OnKeyPressed(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) {
++ bool is_shift_down,
++ bool is_cmd_down) {
+ if (delegate()) {
+ delegate()->OnKeyPressed(key_code, is_alt_down, is_ctrl_down,
+- is_shift_down);
++ is_shift_down, is_cmd_down);
+ }
+ }
+
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h b/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h
new file mode 100644
index 0000000000..7e162d1350
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h
@@ -0,0 +1,32 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/x11_global_shortcut_listener_ozone.h
+@@ -28,17 +28,20 @@ class X11GlobalShortcutListenerOzone : p
+ bool RegisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) override;
++ bool is_shift_down,
++ bool is_cmd_down) override;
+ void UnregisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) override;
++ bool is_shift_down,
++ bool is_cmd_down) override;
+
+ // ui::XGlobalShortcutListener:
+ void OnKeyPressed(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) override;
++ bool is_shift_down,
++ bool is_cmd_down) override;
+ };
+
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc b/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc
new file mode 100644
index 0000000000..562b8e602e
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/x11_screen_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/x11_screen_ozone.cc
+@@ -22,7 +22,7 @@
+ #include "ui/ozone/platform/x11/x11_window.h"
+ #include "ui/ozone/platform/x11/x11_window_manager.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -97,7 +97,7 @@ X11ScreenOzone::X11ScreenOzone()
+ window_manager_(X11WindowManager::GetInstance()),
+ x11_display_manager_(std::make_unique<XDisplayManager>(this)) {
+ DCHECK(window_manager_);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (auto* linux_ui = ui::LinuxUi::instance()) {
+ display_scale_factor_observer_.Observe(linux_ui);
+ }
+@@ -260,7 +260,7 @@ void X11ScreenOzone::OnEvent(const x11::
+ x11_display_manager_->OnEvent(xev);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void X11ScreenOzone::OnDeviceScaleFactorChanged() {
+ x11_display_manager_->DispatchDelayedDisplayListUpdate();
+ }
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h b/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h
new file mode 100644
index 0000000000..7fb5368a72
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h
@@ -0,0 +1,44 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/x11_screen_ozone.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/x11_screen_ozone.h
+@@ -16,7 +16,7 @@
+ #include "ui/gfx/x/event.h"
+ #include "ui/ozone/public/platform_screen.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/device_scale_factor_observer.h"
+ #include "ui/linux/linux_ui.h"
+ #endif
+@@ -29,7 +29,7 @@ class X11WindowManager;
+ class X11ScreenOzone : public PlatformScreen,
+ public x11::EventObserver,
+ public XDisplayManager::Delegate
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ,
+ public DeviceScaleFactorObserver
+ #endif
+@@ -97,7 +97,7 @@ class X11ScreenOzone : public PlatformSc
+ // ui::XDisplayManager::Delegate:
+ void OnXDisplayListUpdated() override;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // DeviceScaleFactorObserver:
+ void OnDeviceScaleFactorChanged() override;
+ #endif
+@@ -109,7 +109,7 @@ class X11ScreenOzone : public PlatformSc
+ // Indicates that |this| is initialized.
+ bool initialized_ = false;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<ui::LinuxUi, DeviceScaleFactorObserver>
+ display_scale_factor_observer_{this};
+ #endif
diff --git a/electron34/patches/patch-ui_ozone_platform_x11_x11__window.cc b/electron34/patches/patch-ui_ozone_platform_x11_x11__window.cc
new file mode 100644
index 0000000000..be6192d467
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_platform_x11_x11__window.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/platform/x11/x11_window.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/platform/x11/x11_window.cc
+@@ -1502,7 +1502,7 @@ void X11Window::OnXWindowStateChanged()
+ WindowTiledEdges tiled_state = GetTiledState();
+ if (tiled_state != tiled_state_) {
+ tiled_state_ = tiled_state;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ platform_window_delegate_->OnWindowTiledStateChanged(tiled_state);
+ UpdateDecorationInsets();
+ #endif
diff --git a/electron34/patches/patch-ui_ozone_public_ozone__platform.h b/electron34/patches/patch-ui_ozone_public_ozone__platform.h
new file mode 100644
index 0000000000..43e2cb0aa2
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_public_ozone__platform.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/public/ozone_platform.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/public/ozone_platform.h
+@@ -128,6 +128,10 @@ class COMPONENT_EXPORT(OZONE) OzonePlatf
+ // Linux only: determines if Skia can fall back to the X11 output device.
+ bool skia_can_fall_back_to_x11 = false;
+
++ // Linux only: determines is Electron can call selected X11 functions while
++ // it migrates to pure ozone abstractions.
++ bool electron_can_call_x11 = false;
++
+ // Wayland only: determines whether windows which are not top level ones
+ // should be given parents explicitly.
+ bool set_parent_for_non_top_level_windows = false;
diff --git a/electron34/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h b/electron34/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h
new file mode 100644
index 0000000000..ffa5670702
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/public/platform_global_shortcut_listener.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/public/platform_global_shortcut_listener.h
+@@ -20,7 +20,8 @@ class COMPONENT_EXPORT(OZONE_BASE) Platf
+ virtual void OnKeyPressed(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) = 0;
++ bool is_shift_down,
++ bool is_cmd_down) = 0;
+ // Called back when the platform implementation is destroyed.
+ virtual void OnPlatformListenerDestroyed() = 0;
+
+@@ -52,11 +53,13 @@ class COMPONENT_EXPORT(OZONE_BASE) Platf
+ virtual bool RegisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) = 0;
++ bool is_shift_down,
++ bool is_cmd_down) = 0;
+ virtual void UnregisterAccelerator(KeyboardCode key_code,
+ bool is_alt_down,
+ bool is_ctrl_down,
+- bool is_shift_down) = 0;
++ bool is_shift_down,
++ bool is_cmd_down) = 0;
+
+ protected:
+ PlatformGlobalShortcutListenerDelegate* delegate() { return delegate_; }
diff --git a/electron34/patches/patch-ui_ozone_test_mock__platform__window__delegate.h b/electron34/patches/patch-ui_ozone_test_mock__platform__window__delegate.h
new file mode 100644
index 0000000000..854fa4df7a
--- /dev/null
+++ b/electron34/patches/patch-ui_ozone_test_mock__platform__window__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/ozone/test/mock_platform_window_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/ozone/test/mock_platform_window_delegate.h
+@@ -35,7 +35,7 @@ class MockPlatformWindowDelegate : publi
+ MOCK_METHOD2(OnWindowStateChanged,
+ void(PlatformWindowState old_state,
+ PlatformWindowState new_state));
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MOCK_METHOD1(OnWindowTiledStateChanged,
+ void(WindowTiledEdges new_tiled_edges));
+ #endif
diff --git a/electron34/patches/patch-ui_platform__window_platform__window__delegate.cc b/electron34/patches/patch-ui_platform__window_platform__window__delegate.cc
new file mode 100644
index 0000000000..a8f34ff3c0
--- /dev/null
+++ b/electron34/patches/patch-ui_platform__window_platform__window__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/platform_window/platform_window_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/platform_window/platform_window_delegate.cc
+@@ -63,7 +63,7 @@ gfx::Insets PlatformWindowDelegate::Calc
+ return gfx::Insets();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void PlatformWindowDelegate::OnWindowTiledStateChanged(
+ WindowTiledEdges new_tiled_edges) {}
+ #endif
diff --git a/electron34/patches/patch-ui_platform__window_platform__window__delegate.h b/electron34/patches/patch-ui_platform__window_platform__window__delegate.h
new file mode 100644
index 0000000000..6f7dcc221e
--- /dev/null
+++ b/electron34/patches/patch-ui_platform__window_platform__window__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/platform_window/platform_window_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/platform_window/platform_window_delegate.h
+@@ -161,7 +161,7 @@ class COMPONENT_EXPORT(PLATFORM_WINDOW)
+ virtual void OnWindowStateChanged(PlatformWindowState old_state,
+ PlatformWindowState new_state) = 0;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Notifies the delegate that the tiled state of the window edges has changed.
+ virtual void OnWindowTiledStateChanged(WindowTiledEdges new_tiled_edges);
+ #endif
diff --git a/electron34/patches/patch-ui_platform__window_platform__window__init__properties.h b/electron34/patches/patch-ui_platform__window_platform__window__init__properties.h
new file mode 100644
index 0000000000..78035edb57
--- /dev/null
+++ b/electron34/patches/patch-ui_platform__window_platform__window__init__properties.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/platform_window/platform_window_init_properties.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/platform_window/platform_window_init_properties.h
+@@ -56,7 +56,7 @@ class WorkspaceExtensionDelegate;
+ class ScenicWindowDelegate;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ class X11ExtensionDelegate;
+ #endif
+
+@@ -121,7 +121,7 @@ struct COMPONENT_EXPORT(PLATFORM_WINDOW)
+
+ PlatformWindowShadowType shadow_type = PlatformWindowShadowType::kDefault;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool prefer_dark_theme = false;
+ raw_ptr<gfx::ImageSkia> icon = nullptr;
+ std::optional<SkColor> background_color;
diff --git a/electron34/patches/patch-ui_qt_BUILD.gn b/electron34/patches/patch-ui_qt_BUILD.gn
new file mode 100644
index 0000000000..078230db81
--- /dev/null
+++ b/electron34/patches/patch-ui_qt_BUILD.gn
@@ -0,0 +1,46 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/qt/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/qt/BUILD.gn
+@@ -20,7 +20,7 @@ config("qt_internal_config") {
+
+ # It's OK to depend on the system libstdc++ since it's a dependency of QT, so
+ # it will get loaded into the process anyway.
+- libs = [ "stdc++" ]
++ # libs = [ "stdc++" ]
+
+ configs = [
+ "//build/config/linux:runtime_library",
+@@ -101,10 +101,12 @@ template("qt_shim") {
+ }
+ }
+ }
+-qt_shim("qt5_shim") {
+- qt_version = "5"
+- if (!use_sysroot) {
+- moc_qt_path = "$moc_qt5_path"
++if (use_qt5) {
++ qt_shim("qt5_shim") {
++ qt_version = "5"
++ if (!use_sysroot) {
++ moc_qt_path = "$moc_qt5_path"
++ }
+ }
+ }
+ if (use_qt6) {
+@@ -122,7 +124,10 @@ component("qt") {
+ defines = [ "IS_QT_IMPL" ]
+
+ # qt_shim is in data_deps since we want to load it manually.
+- data_deps = [ ":qt5_shim" ]
++ data_deps = []
++ if (use_qt5) {
++ data_deps += [ ":qt5_shim" ]
++ }
+ if (use_qt6) {
+ data_deps += [ ":qt6_shim" ]
+ }
diff --git a/electron34/patches/patch-ui_qt_qt.gni b/electron34/patches/patch-ui_qt_qt.gni
new file mode 100644
index 0000000000..44990ae149
--- /dev/null
+++ b/electron34/patches/patch-ui_qt_qt.gni
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/qt/qt.gni.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/qt/qt.gni
+@@ -9,24 +9,17 @@ import("//build/config/sysroot.gni")
+ declare_args() {
+ # TODO(crbug.com/40260415): Allow QT in MSAN builds once QT is
+ # added to the instrumented libraries.
+- use_qt = is_linux && !is_castos && !is_msan
++ use_qt5 = use_sysroot && is_linux && !is_castos && !is_msan
++ use_qt6 = use_sysroot && is_linux && !is_castos && !is_msan
+ }
+
+ declare_args() {
+- if (!use_sysroot && use_qt) {
+- moc_qt5_path = ""
++ if (!use_sysroot && use_qt5) {
++ moc_qt5_path = "@QTDIR@/bin"
+ }
+-}
+-
+-declare_args() {
+- use_qt6 = use_qt && use_sysroot
+-}
+-
+-declare_args() {
+ if (!use_sysroot && use_qt6) {
+ moc_qt6_path = ""
+ }
+ }
+
+-# use_qt6 => use_qt
+-assert(!use_qt6 || use_qt)
++use_qt = use_qt5 || use_qt6
diff --git a/electron34/patches/patch-ui_qt_qt__ui.cc b/electron34/patches/patch-ui_qt_qt__ui.cc
new file mode 100644
index 0000000000..f426d48bb2
--- /dev/null
+++ b/electron34/patches/patch-ui_qt_qt__ui.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/qt/qt_ui.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/qt/qt_ui.cc
+@@ -436,7 +436,8 @@ std::unique_ptr<ui::NavButtonProvider> Q
+ }
+
+ ui::WindowFrameProvider* QtUi::GetWindowFrameProvider(bool solid_frame,
+- bool tiled) {
++ bool tiled,
++ bool maximized) {
+ // QT prefers server-side decorations.
+ return nullptr;
+ }
diff --git a/electron34/patches/patch-ui_qt_qt__ui.h b/electron34/patches/patch-ui_qt_qt__ui.h
new file mode 100644
index 0000000000..49ed5d088b
--- /dev/null
+++ b/electron34/patches/patch-ui_qt_qt__ui.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/qt/qt_ui.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/qt/qt_ui.h
+@@ -82,7 +82,8 @@ class QtUi : public ui::LinuxUiAndTheme,
+ void SetAccentColor(std::optional<SkColor>) override;
+ std::unique_ptr<ui::NavButtonProvider> CreateNavButtonProvider() override;
+ ui::WindowFrameProvider* GetWindowFrameProvider(bool solid_frame,
+- bool tiled) override;
++ bool tiled,
++ bool maximized) override;
+
+ // QtInterface::Delegate:
+ void FontChanged() override;
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog.h b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog.h
new file mode 100644
index 0000000000..495c46dabd
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog.h
+@@ -224,6 +224,21 @@ class SHELL_DIALOGS_EXPORT SelectFileDia
+ const GURL* caller = nullptr);
+ bool HasMultipleFileTypeChoices();
+
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
++ // Set the label used for the file select button.
++ virtual void SetButtonLabel(const std::string& label) = 0;
++
++ // Set whether a confirmation should be shown when attempting to overwrite an
++ // existing file.
++ virtual void SetOverwriteConfirmationShown(bool is_shown) = 0;
++
++ // Set whether hidden files should be shown.
++ virtual void SetHiddenShown(bool is_shown) = 0;
++
++ // Set whether multiple file/directory selections are allowed
++ virtual void SetMultipleSelectionsAllowed(bool is_allowed) = 0;
++#endif
++
+ protected:
+ friend class base::RefCountedThreadSafe<SelectFileDialog>;
+
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc
new file mode 100644
index 0000000000..f6d58744d5
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog_linux.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog_linux.cc
+@@ -37,4 +37,17 @@ bool SelectFileDialogLinux::CallDirector
+ return base::DirectoryExists(path);
+ }
+
++void SelectFileDialogLinux::SetButtonLabel(const std::string& label) {
++ button_label_ = label;
++}
++void SelectFileDialogLinux::SetOverwriteConfirmationShown(bool is_shown) {
++ show_overwrite_confirmation_ = is_shown;
++}
++void SelectFileDialogLinux::SetHiddenShown(bool is_shown) {
++ show_hidden_ = is_shown;
++}
++void SelectFileDialogLinux::SetMultipleSelectionsAllowed(bool is_allowed) {
++ allow_multiple_selection_ = is_allowed;
++}
++
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h
new file mode 100644
index 0000000000..bb79c4396f
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h
@@ -0,0 +1,45 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog_linux.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog_linux.h
+@@ -33,6 +33,12 @@ class SHELL_DIALOGS_EXPORT SelectFileDia
+ // BaseShellDialog implementation.
+ void ListenerDestroyed() override;
+
++ // SelectFileDialog:
++ void SetButtonLabel(const std::string& label) override;
++ void SetOverwriteConfirmationShown(bool is_shown) override;
++ void SetHiddenShown(bool is_shown) override;
++ void SetMultipleSelectionsAllowed(bool is_allowed) override;
++
+ protected:
+ explicit SelectFileDialogLinux(Listener* listener,
+ std::unique_ptr<ui::SelectFilePolicy> policy);
+@@ -77,6 +83,11 @@ class SHELL_DIALOGS_EXPORT SelectFileDia
+ *last_opened_path_ = last_opened_path;
+ }
+
++ const std::string& button_label() { return button_label_; }
++ bool show_overwrite_confirmation() { return show_overwrite_confirmation_; }
++ bool show_hidden() { return show_hidden_; }
++ bool allow_multiple_selection() { return allow_multiple_selection_; }
++
+ private:
+ // The file filters.
+ FileTypeInfo file_types_;
+@@ -92,6 +103,11 @@ class SHELL_DIALOGS_EXPORT SelectFileDia
+ // file so that we can display future dialogs with the same starting path.
+ static base::FilePath* last_saved_path_;
+ static base::FilePath* last_opened_path_;
++
++ std::string button_label_;
++ bool show_overwrite_confirmation_ = true;
++ bool show_hidden_ = false;
++ bool allow_multiple_selection_ = false;
+ };
+
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
new file mode 100644
index 0000000000..db7b255963
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
@@ -0,0 +1,117 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog_linux_kde.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_kde.cc
+@@ -8,6 +8,7 @@
+ #include <string_view>
+
+ #include "base/command_line.h"
++#include "base/files/file_util.h"
+ #include "base/functional/bind.h"
+ #include "base/functional/callback_helpers.h"
+ #include "base/logging.h"
+@@ -154,9 +155,20 @@ class SelectFileDialogLinuxKde : public
+ void OnSelectMultiFileDialogResponse(
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results);
++
++ // Common function for OnSelectSingleFolderDialogResponse and
++ // OnSelectMultiFileDialogResponse.
++ void SelectMultiFileDialogHelper(
++ bool allow_folder,
++ gfx::AcceleratedWidget parent,
++ std::unique_ptr<KDialogOutputParams> results);
++
+ void OnSelectSingleFolderDialogResponse(
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results);
++ void OnSelectMultiFolderDialogResponse(
++ gfx::AcceleratedWidget parent,
++ std::unique_ptr<KDialogOutputParams> results);
+
+ // Should be either DESKTOP_ENVIRONMENT_KDE3, KDE4, KDE5, or KDE6.
+ base::nix::DesktopEnvironment desktop_;
+@@ -413,10 +425,16 @@ void SelectFileDialogLinuxKde::GetKDialo
+ }
+ command_line->AppendSwitch(type);
+ // The path should never be empty. If it is, set it to PWD.
+- if (path.empty())
+- command_line->AppendArgPath(base::FilePath("."));
+- else
++ auto pwd = base::FilePath(".");
++ if (path.empty()) {
++ command_line->AppendArgPath(pwd);
++ } else if (path.IsAbsolute()) {
+ command_line->AppendArgPath(path);
++ } else {
++ // KDialog won't set the default name in the Name field for relative paths.
++ auto abs_path = base::MakeAbsoluteFilePathNoResolveSymbolicLinks(path);
++ command_line->AppendArgPath(abs_path.value_or(pwd));
++ }
+ // Depending on the type of the operation we need, get the path to the
+ // file/folder and set up mime type filters.
+ if (file_operation)
+@@ -461,6 +479,7 @@ void SelectFileDialogLinuxKde::CreateSel
+ int title_message_id = (type == SELECT_UPLOAD_FOLDER)
+ ? IDS_SELECT_UPLOAD_FOLDER_DIALOG_TITLE
+ : IDS_SELECT_FOLDER_DIALOG_TITLE;
++ bool multiple_selection = allow_multiple_selection();
+ pipe_task_runner_->PostTaskAndReplyWithResult(
+ FROM_HERE,
+ base::BindOnce(
+@@ -468,10 +487,12 @@ void SelectFileDialogLinuxKde::CreateSel
+ KDialogParams(
+ "--getexistingdirectory", GetTitle(title, title_message_id),
+ default_path.empty() ? *last_opened_path() : default_path, parent,
+- false, false)),
++ false, multiple_selection)),
+ base::BindOnce(
+- &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
+- parent));
++ multiple_selection
++ ? &SelectFileDialogLinuxKde::OnSelectMultiFolderDialogResponse
++ : &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse,
++ this, parent));
+ }
+
+ void SelectFileDialogLinuxKde::CreateFileOpenDialog(
+@@ -561,7 +582,8 @@ void SelectFileDialogLinuxKde::OnSelectS
+ SelectSingleFileHelper(true, std::move(results));
+ }
+
+-void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
++void SelectFileDialogLinuxKde::SelectMultiFileDialogHelper(
++ bool allow_folder,
+ gfx::AcceleratedWidget parent,
+ std::unique_ptr<KDialogOutputParams> results) {
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+@@ -579,7 +601,7 @@ void SelectFileDialogLinuxKde::OnSelectM
+ base::SplitStringPiece(results->output, "\n", base::KEEP_WHITESPACE,
+ base::SPLIT_WANT_NONEMPTY)) {
+ base::FilePath path(line);
+- if (CallDirectoryExistsOnUIThread(path))
++ if (!allow_folder && CallDirectoryExistsOnUIThread(path))
+ continue;
+ filenames_fp.push_back(path);
+ }
+@@ -591,4 +613,16 @@ void SelectFileDialogLinuxKde::OnSelectM
+ MultiFilesSelected(filenames_fp);
+ }
+
++void SelectFileDialogLinuxKde::OnSelectMultiFolderDialogResponse(
++ gfx::AcceleratedWidget parent,
++ std::unique_ptr<KDialogOutputParams> results) {
++ SelectMultiFileDialogHelper(true, parent, std::move(results));
++}
++
++void SelectFileDialogLinuxKde::OnSelectMultiFileDialogResponse(
++ gfx::AcceleratedWidget parent,
++ std::unique_ptr<KDialogOutputParams> results) {
++ SelectMultiFileDialogHelper(false, parent, std::move(results));
++}
++
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc
new file mode 100644
index 0000000000..4b327ecd95
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc
@@ -0,0 +1,146 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog_linux_portal.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_portal.cc
+@@ -11,6 +11,7 @@
+
+ #include <string_view>
+
++#include "base/command_line.h"
+ #include "base/functional/bind.h"
+ #include "base/logging.h"
+ #include "base/no_destructor.h"
+@@ -40,6 +41,8 @@ namespace {
+ constexpr char kXdgPortalService[] = "org.freedesktop.portal.Desktop";
+ constexpr char kXdgPortalObject[] = "/org/freedesktop/portal/desktop";
+
++// Version 4 includes support for current_folder option to the OpenFile method via
++// https://github.com/flatpak/xdg-desktop-portal/commit/71165a5.
+ constexpr int kXdgPortalRequiredVersion = 3;
+
+ constexpr char kXdgPortalRequestInterfaceName[] =
+@@ -66,6 +69,8 @@ constexpr int kFileChooserFilterKindGlob
+
+ constexpr char kFileUriPrefix[] = "file://";
+
++const char kXdgPortalRequiredVersionFlag[] = "xdg-portal-required-version";
++
+ struct FileChooserProperties : dbus::PropertySet {
+ dbus::Property<uint32_t> version;
+
+@@ -171,10 +176,18 @@ void SelectFileDialogLinuxPortal::StartA
+ if (GetAvailabilityTestCompletionFlag()->IsSet())
+ return;
+
++ auto* cmd = base::CommandLine::ForCurrentProcess();
++ unsigned int xdg_portal_required_version;
++ if (!base::StringToUint(cmd->GetSwitchValueASCII(kXdgPortalRequiredVersionFlag),
++ &xdg_portal_required_version)) {
++ xdg_portal_required_version = kXdgPortalRequiredVersion;
++ }
++
+ dbus_thread_linux::GetTaskRunner()->PostTask(
+ FROM_HERE,
+ base::BindOnce(
+- &SelectFileDialogLinuxPortal::CheckPortalAvailabilityOnBusThread));
++ &SelectFileDialogLinuxPortal::CheckPortalAvailabilityOnBusThread,
++ xdg_portal_required_version));
+ }
+
+ // static
+@@ -186,6 +199,11 @@ bool SelectFileDialogLinuxPortal::IsPort
+ }
+
+ // static
++int SelectFileDialogLinuxPortal::GetPortalVersion() {
++ return available_portal_version_;
++}
++
++// static
+ void SelectFileDialogLinuxPortal::DestroyPortalConnection() {
+ dbus_thread_linux::GetTaskRunner()->PostTask(
+ FROM_HERE, base::BindOnce(&DestroyBusOnBusThread));
+@@ -214,6 +232,8 @@ void SelectFileDialogLinuxPortal::Select
+ weak_factory_.GetWeakPtr()));
+ info_->type = type;
+ info_->main_task_runner = base::SequencedTaskRunner::GetCurrentDefault();
++ info_->button_label = button_label();
++ info_->allow_multiple_selection = allow_multiple_selection();
+
+ if (owning_window) {
+ if (auto* root = owning_window->GetRootWindow()) {
+@@ -260,7 +280,8 @@ bool SelectFileDialogLinuxPortal::HasMul
+ }
+
+ // static
+-void SelectFileDialogLinuxPortal::CheckPortalAvailabilityOnBusThread() {
++void SelectFileDialogLinuxPortal::CheckPortalAvailabilityOnBusThread(
++ unsigned int xdg_portal_required_version) {
+ DCHECK(dbus_thread_linux::GetTaskRunner()->RunsTasksInCurrentSequence());
+ base::AtomicFlag* availability_test_complete =
+ GetAvailabilityTestCompletionFlag();
+@@ -274,6 +295,7 @@ void SelectFileDialogLinuxPortal::CheckP
+ base::BindOnce(
+ [](scoped_refptr<dbus::Bus> bus,
+ base::AtomicFlag* availability_test_complete,
++ unsigned int xdg_portal_required_version,
+ std::optional<bool> name_has_owner) {
+ if (name_has_owner.value_or(false)) {
+ // The portal service has an owner, proceed to check the version.
+@@ -285,15 +307,22 @@ void SelectFileDialogLinuxPortal::CheckP
+ if (!properties.GetAndBlock(&properties.version)) {
+ LOG(ERROR) << "Failed to read portal version property";
+ } else if (properties.version.value() >=
+- kXdgPortalRequiredVersion) {
++ xdg_portal_required_version) {
+ is_portal_available_ = true;
++ available_portal_version_ = properties.version.value();
++ } else {
++ VLOG(1) << "File chooser portal available version: "
++ << properties.version.value();
++ available_portal_version_ = properties.version.value();
+ }
+ }
++ VLOG(1) << "File chooser portal expected version: "
++ << xdg_portal_required_version;
+ VLOG(1) << "File chooser portal available: "
+ << (is_portal_available_ ? "yes" : "no");
+ availability_test_complete->Set();
+ },
+- bus, availability_test_complete));
++ bus, availability_test_complete, xdg_portal_required_version));
+ }
+
+ // static
+@@ -471,7 +500,9 @@ void SelectFileDialogLinuxPortal::Dialog
+ response_handle_token);
+
+ if (type == SelectFileDialog::Type::SELECT_UPLOAD_FOLDER) {
+- AppendStringOption(&options_writer, kFileChooserOptionAcceptLabel,
++ const std::string accept_label =
++ button_label.empty() ? kFileChooserOptionAcceptLabel : button_label;
++ AppendStringOption(&options_writer, accept_label,
+ l10n_util::GetStringUTF8(
+ IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON));
+ }
+@@ -480,6 +511,8 @@ void SelectFileDialogLinuxPortal::Dialog
+ type == SelectFileDialog::Type::SELECT_UPLOAD_FOLDER ||
+ type == SelectFileDialog::Type::SELECT_EXISTING_FOLDER) {
+ AppendBoolOption(&options_writer, kFileChooserOptionDirectory, true);
++ AppendBoolOption(&options_writer, kFileChooserOptionMultiple,
++ allow_multiple_selection);
+ } else if (type == SelectFileDialog::Type::SELECT_OPEN_MULTI_FILE) {
+ AppendBoolOption(&options_writer, kFileChooserOptionMultiple, true);
+ }
+@@ -820,6 +853,7 @@ SelectFileDialogLinuxPortal::DialogInfo:
+ SelectFileDialogLinuxPortal::DialogInfo::~DialogInfo() = default;
+
+ bool SelectFileDialogLinuxPortal::is_portal_available_ = false;
++unsigned int SelectFileDialogLinuxPortal::available_portal_version_ = 0;
+ int SelectFileDialogLinuxPortal::handle_token_counter_ = 0;
+
+ } // namespace ui
diff --git a/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h
new file mode 100644
index 0000000000..29f798fe3e
--- /dev/null
+++ b/electron34/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h
@@ -0,0 +1,47 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/shell_dialogs/select_file_dialog_linux_portal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_portal.h
+@@ -47,6 +47,9 @@ class SelectFileDialogLinuxPortal : publ
+ // availability test has not yet completed.
+ static bool IsPortalAvailable();
+
++ // Get version of portal if available.
++ static int GetPortalVersion();
++
+ // Destroys the connection to the bus.
+ static void DestroyPortalConnection();
+
+@@ -120,6 +123,8 @@ class SelectFileDialogLinuxPortal : publ
+ Type type;
+ // The task runner the SelectFileImpl method was called on.
+ scoped_refptr<base::SequencedTaskRunner> main_task_runner;
++ std::string button_label;
++ bool allow_multiple_selection = false;
+
+ private:
+ friend class base::RefCountedThreadSafe<DialogInfo>;
+@@ -176,7 +181,8 @@ class SelectFileDialogLinuxPortal : publ
+ };
+
+ // D-Bus configuration and initialization.
+- static void CheckPortalAvailabilityOnBusThread();
++ static void CheckPortalAvailabilityOnBusThread(
++ unsigned int xdg_portal_required_version);
+
+ // Returns a flag, written by the D-Bus thread and read by the UI thread,
+ // indicating whether or not the availability test has completed.
+@@ -208,6 +214,9 @@ class SelectFileDialogLinuxPortal : publ
+ // Written by the D-Bus thread and read by the UI thread.
+ static bool is_portal_available_;
+
++ // Written by the D-Bus thread and read by the UI thread.
++ static unsigned int available_portal_version_;
++
+ // Used by the D-Bus thread to generate unique handle tokens.
+ static int handle_token_counter_;
+
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb
new file mode 100644
index 0000000000..11e7fbe031
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_bn.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_bn.xtb
+@@ -10,7 +10,7 @@
+ <translation id="IDS_WEB_FONT_FAMILY">Vrinda</translation>
+ <translation id="IDS_WEB_FONT_FAMILY_XP">Vrinda</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Lohit Bengali</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb
new file mode 100644
index 0000000000..b391494a5a
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_ja.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_ja.xtb
+@@ -12,7 +12,7 @@
+ <if expr="is_ios">
+ <translation id="IDS_WEB_FONT_FAMILY">Helvetica,Hiragino Kaku Gothic ProN,sans-serif</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">VL PGothic,Sazanami Gothic,Kochi Gothic,sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb
new file mode 100644
index 0000000000..67128ef3b7
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_ko.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_ko.xtb
+@@ -12,7 +12,7 @@
+ <if expr="is_ios">
+ <translation id="IDS_WEB_FONT_FAMILY">Helvetica,Apple SD Gothic Neo,AppleGothic,sans-serif</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Noto Sans CJK KR,NanumGothic,UnDotum,Baekmuk Gulim,sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb
new file mode 100644
index 0000000000..05690382fd
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_ml.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_ml.xtb
+@@ -9,7 +9,7 @@
+ <translation id="IDS_WEB_FONT_FAMILY">'Segoe UI',Arial,AnjaliOldLipi,Rachana,Kartika</translation>
+ <translation id="IDS_WEB_FONT_FAMILY_XP">Arial,AnjaliOldLipi,Rachana,Kartika</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Arial,AnjaliOldLipi,Rachana,Kartika,sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__th.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__th.xtb
new file mode 100644
index 0000000000..ec786f3048
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__th.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_th.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_th.xtb
+@@ -6,7 +6,7 @@
+ <translation id="IDS_WEB_FONT_FAMILY">Tahoma,sans-serif</translation>
+ <translation id="IDS_WEB_FONT_FAMILY_XP">Tahoma,sans-serif</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Norasi,Waree,Garuda,Loma,sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb
new file mode 100644
index 0000000000..482ae48a31
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_zh-CN.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_zh-CN.xtb
+@@ -12,7 +12,7 @@
+ <if expr="is_ios">
+ <translation id="IDS_WEB_FONT_FAMILY">Helvetica,PingFang SC,STHeiti,sans-serif</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Noto Sans CJK SC, WenQuanYi Zen Hei, sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb b/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb
new file mode 100644
index 0000000000..0631ab91a8
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/translations/app_locale_settings_zh-TW.xtb.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/translations/app_locale_settings_zh-TW.xtb
+@@ -12,7 +12,7 @@
+ <if expr="is_ios">
+ <translation id="IDS_WEB_FONT_FAMILY">Helvetica,PingFang TC,Heiti TC,sans-serif</translation>
+ </if>
+-<if expr="is_linux">
++<if expr="is_posix">
+ <translation id="IDS_WEB_FONT_FAMILY">Noto Sans CJK TC, WenQuanYi Zen Hei, sans-serif</translation>
+ </if>
+ <if expr="is_chromeos">
diff --git a/electron34/patches/patch-ui_strings_ui__strings.grd b/electron34/patches/patch-ui_strings_ui__strings.grd
new file mode 100644
index 0000000000..f80c25f020
--- /dev/null
+++ b/electron34/patches/patch-ui_strings_ui__strings.grd
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/strings/ui_strings.grd.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/strings/ui_strings.grd
+@@ -767,7 +767,7 @@ need to be translated for each locale.--
+ Win
+ </message>
+ </if>
+- <if expr="is_linux">
++ <if expr="is_posix">
+ <message name="IDS_APP_SUPER_KEY" desc="Windows key on Windows keyboards, and Command key on Mac keyboards.">
+ Super
+ </message>
diff --git a/electron34/patches/patch-ui_views_BUILD.gn b/electron34/patches/patch-ui_views_BUILD.gn
new file mode 100644
index 0000000000..b5c6dd9586
--- /dev/null
+++ b/electron34/patches/patch-ui_views_BUILD.gn
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/BUILD.gn
+@@ -713,6 +713,8 @@ component("views") {
+ "IOSurface.framework",
+ "QuartzCore.framework",
+ ]
++
++ deps += ["//electron/build/config:generate_mas_config"]
+ }
+
+ if (is_win) {
+@@ -1130,6 +1132,8 @@ source_set("test_support") {
+ "//ui/base/mojom:ui_base_types",
+ ]
+
++ deps += ["//electron/build/config:generate_mas_config"]
++
+ if (is_win) {
+ sources += [
+ "test/desktop_window_tree_host_win_test_api.cc",
diff --git a/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h b/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h
new file mode 100644
index 0000000000..fa6f179175
--- /dev/null
+++ b/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/cocoa/native_widget_mac_ns_window_host.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/cocoa/native_widget_mac_ns_window_host.h
+@@ -18,6 +18,7 @@
+ #include "components/remote_cocoa/browser/scoped_cg_window_id.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window.mojom.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/associated_receiver.h"
+ #include "mojo/public/cpp/bindings/associated_remote.h"
+ #include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
+@@ -32,7 +33,9 @@
+ #include "ui/views/window/dialog_observer.h"
+
+ @class NativeWidgetMacNSWindow;
++#if !IS_MAS_BUILD()
+ @class NSAccessibilityRemoteUIElement;
++#endif
+ @class NSView;
+
+ namespace remote_cocoa {
+@@ -483,10 +486,12 @@ class VIEWS_EXPORT NativeWidgetMacNSWind
+ mojo::AssociatedRemote<remote_cocoa::mojom::NativeWidgetNSWindow>
+ remote_ns_window_remote_;
+
++#if !IS_MAS_BUILD()
+ // Remote accessibility objects corresponding to the NSWindow and its root
+ // NSView.
+ NSAccessibilityRemoteUIElement* __strong remote_window_accessible_;
+ NSAccessibilityRemoteUIElement* __strong remote_view_accessible_;
++#endif
+
+ // Used to force the NSApplication's focused accessibility element to be the
+ // views::Views accessibility tree when the NSView for this is focused.
diff --git a/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm b/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
new file mode 100644
index 0000000000..abdc24970b
--- /dev/null
+++ b/electron34/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
@@ -0,0 +1,81 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/cocoa/native_widget_mac_ns_window_host.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/cocoa/native_widget_mac_ns_window_host.mm
+@@ -21,6 +21,7 @@
+ #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
+ #include "components/remote_cocoa/browser/ns_view_ids.h"
+ #include "components/remote_cocoa/browser/window.h"
++#include "electron/mas.h"
+ #include "mojo/public/cpp/bindings/self_owned_associated_receiver.h"
+ #include "ui/accelerated_widget_mac/window_resize_helper_mac.h"
+ #include "ui/accessibility/accessibility_features.h"
+@@ -349,7 +350,11 @@ gfx::NativeViewAccessible
+ NativeWidgetMacNSWindowHost::GetNativeViewAccessibleForNSView() const {
+ if (in_process_ns_window_bridge_)
+ return in_process_ns_window_bridge_->ns_view();
++#if !IS_MAS_BUILD()
+ return remote_view_accessible_;
++#else
++ return nullptr;
++#endif
+ }
+
+ gfx::NativeViewAccessible
+@@ -364,7 +369,11 @@ NativeWidgetMacNSWindowHost::GetNativeVi
+ return [in_process_ns_window_bridge_->ns_view() window];
+ }
+
++#if !IS_MAS_BUILD()
+ return remote_window_accessible_;
++#else
++ return nullptr;
++#endif
+ }
+
+ remote_cocoa::mojom::NativeWidgetNSWindow*
+@@ -1333,9 +1342,11 @@ void NativeWidgetMacNSWindowHost::OnWind
+ // for PWAs. However this breaks accessibility on in-process windows,
+ // so set it back to NO when a local window gains focus. See
+ // https://crbug.com/41485830.
++#if !IS_MAS_BUILD()
+ if (is_key && features::IsAccessibilityRemoteUIAppEnabled()) {
+ [NSAccessibilityRemoteUIElement setRemoteUIApp:!!application_host_];
+ }
++#endif
+ // Explicitly set the keyboard accessibility state on regaining key
+ // window status.
+ if (is_key && is_content_first_responder)
+@@ -1474,17 +1485,20 @@ void NativeWidgetMacNSWindowHost::OnFocu
+ void NativeWidgetMacNSWindowHost::SetRemoteAccessibilityTokens(
+ const std::vector<uint8_t>& window_token,
+ const std::vector<uint8_t>& view_token) {
++#if !IS_MAS_BUILD()
+ remote_window_accessible_ =
+ ui::RemoteAccessibility::GetRemoteElementFromToken(window_token);
+ remote_view_accessible_ =
+ ui::RemoteAccessibility::GetRemoteElementFromToken(view_token);
+ [remote_view_accessible_ setWindowUIElement:remote_window_accessible_];
+ [remote_view_accessible_ setTopLevelUIElement:remote_window_accessible_];
++#endif
+ }
+
+ bool NativeWidgetMacNSWindowHost::GetRootViewAccessibilityToken(
+ base::ProcessId* pid,
+ std::vector<uint8_t>* token) {
++#if !IS_MAS_BUILD()
+ *pid = getpid();
+ id element_id = GetNativeViewAccessible();
+
+@@ -1497,6 +1511,7 @@ bool NativeWidgetMacNSWindowHost::GetRoo
+ }
+
+ *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
++#endif
+ return true;
+ }
+
diff --git a/electron34/patches/patch-ui_views_controls_button_label__button.cc b/electron34/patches/patch-ui_views_controls_button_label__button.cc
new file mode 100644
index 0000000000..2550ade5d6
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_button_label__button.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/button/label_button.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/button/label_button.cc
+@@ -78,13 +78,6 @@ LabelButton::LabelButton(
+ SetTextInternal(text);
+ SetLayoutManager(std::make_unique<DelegatingLayoutManager>(this));
+ GetViewAccessibility().SetIsDefault(is_default_);
+-
+-#if BUILDFLAG(IS_WIN)
+- // Paint image(s) to a layer so that the canvas is snapped to pixel
+- // boundaries.
+- image_container_view()->SetPaintToLayer();
+- image_container_view()->layer()->SetFillsBoundsOpaquely(false);
+-#endif
+ }
+
+ LabelButton::~LabelButton() {
+@@ -508,10 +501,8 @@ void LabelButton::UpdateImage() {
+
+ void LabelButton::AddLayerToRegion(ui::Layer* new_layer,
+ views::LayerRegion region) {
+-#if !BUILDFLAG(IS_WIN)
+ image_container_view()->SetPaintToLayer();
+ image_container_view()->layer()->SetFillsBoundsOpaquely(false);
+-#endif
+ ink_drop_container()->SetVisible(true);
+ ink_drop_container()->AddLayerToRegion(new_layer, region);
+ }
+@@ -519,9 +510,7 @@ void LabelButton::AddLayerToRegion(ui::L
+ void LabelButton::RemoveLayerFromRegions(ui::Layer* old_layer) {
+ ink_drop_container()->RemoveLayerFromRegions(old_layer);
+ ink_drop_container()->SetVisible(false);
+-#if !BUILDFLAG(IS_WIN)
+ image_container_view()->DestroyLayer();
+-#endif
+ }
+
+ std::unique_ptr<ActionViewInterface> LabelButton::GetActionViewInterface() {
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__controller.cc b/electron34/patches/patch-ui_views_controls_menu_menu__controller.cc
new file mode 100644
index 0000000000..a25547c31c
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__controller.cc
@@ -0,0 +1,70 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_controller.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_controller.cc
+@@ -578,13 +578,20 @@ void MenuController::Run(Widget* parent,
+ MenuAnchorPosition position,
+ bool context_menu,
+ bool is_nested_drag,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures) {
+ exit_type_ = ExitType::kNone;
+ possible_drag_ = false;
+ drag_in_progress_ = false;
+ closing_event_time_ = base::TimeTicks();
+ menu_start_time_ = base::TimeTicks::Now();
+- menu_start_mouse_press_loc_ = gfx::Point();
++ // In some cases, the context menu is asynchronously created after the "mouse
++ // pressed event" is dispatched, so `RootView::current_event()` below is null.
++ // The mouse press location must be taken from the `anchor_bounds` for these
++ // cases.
++ menu_start_mouse_press_loc_ = source_type == ui::mojom::MenuSourceType::kMouse
++ ? anchor_bounds.origin()
++ : gfx::Point();
+
+ ui::Event* event = nullptr;
+ if (parent) {
+@@ -641,6 +648,14 @@ void MenuController::Run(Widget* parent,
+ // Set the selection, which opens the initial menu.
+ SetSelection(root, SELECTION_OPEN_SUBMENU | SELECTION_UPDATE_IMMEDIATELY);
+
++ if (source_type == ui::mojom::MenuSourceType::kKeyboard && context_menu && root->HasSubmenu()) {
++ // For context menus opened via the keyboard we select the first item by default
++ // to match accessibility expectations
++ MenuItemView* first_item = FindInitialSelectableMenuItem(root, INCREMENT_SELECTION_DOWN);
++ if (first_item)
++ SetSelection(first_item, SELECTION_UPDATE_IMMEDIATELY);
++ }
++
+ if (button_controller) {
+ pressed_lock_ = button_controller->TakeLock(
+ false, ui::LocatedEvent::FromIfValid(event));
+@@ -2292,19 +2307,15 @@ void MenuController::OpenMenuImpl(MenuIt
+ }
+ item->GetSubmenu()->ShowAt(params);
+
+- // Figure out if the mouse is under the menu; if so, remember the mouse
+- // location so we can ignore the first mouse move event(s) with that
+- // location. We do this after `ShowAt` because `ConvertFromScreen` doesn't
+- // work correctly if the widget isn't shown.
++ // Remember the mouse location so we can ignore the first mouse move
++ // event(s) with that location. We do this after `ShowAt` because
++ // `ConvertFromScreen` doesn't work correctly if the widget isn't shown.
+ if (item->GetSubmenu()->GetWidget()) {
+ const gfx::Point mouse_pos = ConvertFromScreen(
+ *item->submenu_,
+ display::Screen::GetScreen()->GetCursorScreenPoint());
+- MenuPart part_under_mouse = GetMenuPart(item->submenu_.get(), mouse_pos);
+- if (part_under_mouse.type != MenuPartType::kNone) {
+- menu_open_mouse_loc_ =
+- GetLocationInRootMenu(*item->submenu_, mouse_pos);
+- }
++ menu_open_mouse_loc_ =
++ GetLocationInRootMenu(*item->submenu_, mouse_pos);
+ }
+
+ item->GetSubmenu()->GetWidget()->SetNativeWindowProperty(
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__controller.h b/electron34/patches/patch-ui_views_controls_menu_menu__controller.h
new file mode 100644
index 0000000000..a474e8fa4d
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__controller.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_controller.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_controller.h
+@@ -138,6 +138,7 @@ class VIEWS_EXPORT MenuController final
+ MenuAnchorPosition position,
+ bool context_menu,
+ bool is_nested_drag,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures = gfx::NativeView());
+
+ bool for_drop() const { return for_drop_; }
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner.cc b/electron34/patches/patch-ui_views_controls_menu_menu__runner.cc
new file mode 100644
index 0000000000..64c9255b62
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner.cc
+@@ -90,7 +90,7 @@ void MenuRunner::RunMenuAt(
+ }
+
+ impl_->RunMenuAt(parent, button_controller, bounds, anchor, run_types_,
+- native_view_for_gestures, corners,
++ source_type, native_view_for_gestures, corners,
+ std::move(show_menu_host_duration_histogram));
+ }
+
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.cc b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.cc
new file mode 100644
index 0000000000..093c508a06
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl.cc
+@@ -115,6 +115,7 @@ void MenuRunnerImpl::RunMenuAt(
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) {
+@@ -189,7 +190,7 @@ void MenuRunnerImpl::RunMenuAt(
+ controller->Run(parent, button_controller, menu_.get(), bounds, anchor,
+ (run_types & MenuRunner::CONTEXT_MENU) != 0,
+ (run_types & MenuRunner::NESTED_DRAG) != 0,
+- native_view_for_gestures);
++ source_type, native_view_for_gestures);
+ }
+
+ void MenuRunnerImpl::Cancel() {
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.h
new file mode 100644
index 0000000000..7e62af30f3
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl.h
+@@ -14,6 +14,7 @@
+ #include "base/memory/raw_ptr.h"
+ #include "base/memory/weak_ptr.h"
+ #include "base/time/time.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_controller_delegate.h"
+ #include "ui/views/controls/menu/menu_runner_impl_interface.h"
+ #include "ui/views/views_export.h"
+@@ -52,6 +53,7 @@ class VIEWS_EXPORT MenuRunnerImpl : publ
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners = std::nullopt,
+ std::optional<std::string> show_menu_host_duration_histogram =
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc
new file mode 100644
index 0000000000..ad9a1b29df
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_adapter.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_adapter.cc
+@@ -35,11 +35,12 @@ void MenuRunnerImplAdapter::RunMenuAt(
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) {
+ impl_->RunMenuAt(parent, button_controller, bounds, anchor, types,
+- native_view_for_gestures);
++ source_type, native_view_for_gestures);
+ }
+
+ void MenuRunnerImplAdapter::Cancel() {
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h
new file mode 100644
index 0000000000..84e34fa56d
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_adapter.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_adapter.h
+@@ -11,6 +11,7 @@
+ #include <string>
+
+ #include "base/memory/raw_ptr.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_runner_impl_interface.h"
+ #include "ui/views/views_export.h"
+
+@@ -43,6 +44,7 @@ class VIEWS_EXPORT MenuRunnerImplAdapter
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners = std::nullopt,
+ std::optional<std::string> show_menu_host_duration_histogram =
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h
new file mode 100644
index 0000000000..b0ab13828a
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_cocoa.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_cocoa.h
+@@ -10,6 +10,7 @@
+
+ #include "base/functional/callback.h"
+ #include "base/time/time.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_runner_impl_interface.h"
+
+ @class MenuControllerCocoa;
+@@ -42,6 +43,7 @@ class VIEWS_EXPORT MenuRunnerImplCocoa :
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) override;
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm
new file mode 100644
index 0000000000..909b0cb1d1
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_cocoa.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_cocoa.mm
+@@ -69,6 +69,7 @@ void MenuRunnerImplCocoa::RunMenuAt(
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) {
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h
new file mode 100644
index 0000000000..86fd117c7b
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_interface.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_interface.h
+@@ -9,6 +9,7 @@
+ #include <string>
+
+ #include "base/functional/callback_forward.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_runner.h"
+
+ namespace gfx {
+@@ -46,6 +47,7 @@ class MenuRunnerImplInterface {
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners = std::nullopt,
+ std::optional<std::string> show_menu_host_duration_histogram =
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h
new file mode 100644
index 0000000000..53ebed2ea5
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_mac.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_mac.h
+@@ -15,6 +15,7 @@
+ #include "components/remote_cocoa/common/menu.mojom.h"
+ #include "mojo/public/cpp/bindings/receiver.h"
+ #include "mojo/public/cpp/bindings/receiver_set.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_runner_impl_interface.h"
+
+ namespace views::internal {
+@@ -39,6 +40,7 @@ class VIEWS_EXPORT MenuRunnerImplMac : p
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) override;
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm
new file mode 100644
index 0000000000..e4576cc2d8
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm
@@ -0,0 +1,27 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_mac.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_mac.mm
+@@ -46,6 +46,7 @@ void MenuRunnerImplMac::RunMenuAt(
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) {
+@@ -59,8 +60,8 @@ void MenuRunnerImplMac::RunMenuAt(
+ }
+ }
+ implementation_->RunMenuAt(parent, button_controller, bounds, anchor,
+- run_types, native_view_for_gestures, corners,
+- show_menu_host_duration_histogram);
++ run_types, source_type, native_view_for_gestures,
++ corners, show_menu_host_duration_histogram);
+ }
+
+ void MenuRunnerImplMac::Cancel() {
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h
new file mode 100644
index 0000000000..ab547b786c
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_remote_cocoa.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_remote_cocoa.h
+@@ -15,6 +15,7 @@
+ #include "components/remote_cocoa/common/menu.mojom.h"
+ #include "mojo/public/cpp/bindings/receiver.h"
+ #include "mojo/public/cpp/bindings/receiver_set.h"
++#include "ui/base/mojom/menu_source_type.mojom.h"
+ #include "ui/views/controls/menu/menu_runner_impl_interface.h"
+
+ namespace views {
+@@ -57,6 +58,7 @@ class VIEWS_EXPORT MenuRunnerImplRemoteC
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) override;
diff --git a/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm
new file mode 100644
index 0000000000..b6b6036448
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/menu/menu_runner_impl_remote_cocoa.mm.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/menu/menu_runner_impl_remote_cocoa.mm
+@@ -69,6 +69,7 @@ void MenuRunnerImplRemoteCocoa::RunMenuA
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::mojom::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures,
+ std::optional<gfx::RoundedCornersF> corners,
+ std::optional<std::string> show_menu_host_duration_histogram) {
diff --git a/electron34/patches/patch-ui_views_controls_prefix__selector.cc b/electron34/patches/patch-ui_views_controls_prefix__selector.cc
new file mode 100644
index 0000000000..5f54e22c10
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_prefix__selector.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/prefix_selector.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/prefix_selector.cc
+@@ -192,7 +192,7 @@ bool PrefixSelector::ShouldDoLearning()
+ return false;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool PrefixSelector::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
diff --git a/electron34/patches/patch-ui_views_controls_prefix__selector.h b/electron34/patches/patch-ui_views_controls_prefix__selector.h
new file mode 100644
index 0000000000..f4e24d96ee
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_prefix__selector.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/prefix_selector.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/prefix_selector.h
+@@ -91,7 +91,7 @@ class VIEWS_EXPORT PrefixSelector : publ
+ ukm::SourceId GetClientSourceForMetrics() const override;
+ bool ShouldDoLearning() override;
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
diff --git a/electron34/patches/patch-ui_views_controls_textfield_textfield.cc b/electron34/patches/patch-ui_views_controls_textfield_textfield.cc
new file mode 100644
index 0000000000..b21f1d15cc
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_textfield_textfield.cc
@@ -0,0 +1,70 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/textfield/textfield.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/textfield/textfield.cc
+@@ -86,7 +86,7 @@
+ #include "base/win/win_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ime/linux/text_edit_command_auralinux.h"
+ #include "ui/base/ime/text_input_flags.h"
+ #include "ui/linux/linux_ui.h"
+@@ -181,7 +181,7 @@ bool IsControlKeyModifier(int flags) {
+ // Control-modified key combination, but we cannot extend it to other platforms
+ // as Control has different meanings and behaviors.
+ // https://crrev.com/2580483002/#msg46
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return flags & ui::EF_CONTROL_DOWN;
+ #else
+ return false;
+@@ -762,7 +762,7 @@ bool Textfield::OnKeyPressed(const ui::K
+ if (!textfield)
+ return handled;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ auto* linux_ui = ui::LinuxUi::instance();
+ std::vector<ui::TextEditCommandAuraLinux> commands;
+ if (!handled && linux_ui &&
+@@ -945,7 +945,7 @@ void Textfield::AboutToRequestFocusFromT
+ }
+
+ bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Skip any accelerator handling that conflicts with custom keybindings.
+ auto* linux_ui = ui::LinuxUi::instance();
+ std::vector<ui::TextEditCommandAuraLinux> commands;
+@@ -2010,7 +2010,7 @@ bool Textfield::ShouldDoLearning() {
+ return false;
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/41452689): Implement this method to support Korean IME
+ // reconversion feature on native text fields (e.g. find bar).
+ bool Textfield::SetCompositionFromExistingText(
+@@ -2516,14 +2516,14 @@ ui::TextEditCommand Textfield::GetComman
+ #endif
+ return ui::TextEditCommand::DELETE_BACKWARD;
+ }
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Only erase by line break on Linux and ChromeOS.
+ if (shift)
+ return ui::TextEditCommand::DELETE_TO_BEGINNING_OF_LINE;
+ #endif
+ return ui::TextEditCommand::DELETE_WORD_BACKWARD;
+ case ui::VKEY_DELETE:
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Only erase by line break on Linux and ChromeOS.
+ if (shift && control)
+ return ui::TextEditCommand::DELETE_TO_END_OF_LINE;
diff --git a/electron34/patches/patch-ui_views_controls_textfield_textfield.h b/electron34/patches/patch-ui_views_controls_textfield_textfield.h
new file mode 100644
index 0000000000..269475d0ab
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_textfield_textfield.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/textfield/textfield.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/textfield/textfield.h
+@@ -47,7 +47,7 @@
+ #include "ui/views/view_observer.h"
+ #include "ui/views/word_lookup_client.h"
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #include <vector>
+ #endif
+
+@@ -475,7 +475,7 @@ class VIEWS_EXPORT Textfield : public Vi
+ // Set whether the text should be used to improve typing suggestions.
+ void SetShouldDoLearning(bool value) { should_do_learning_ = value; }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ bool SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) override;
diff --git a/electron34/patches/patch-ui_views_controls_webview_BUILD.gn b/electron34/patches/patch-ui_views_controls_webview_BUILD.gn
new file mode 100644
index 0000000000..91ce33c683
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_webview_BUILD.gn
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/webview/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/webview/BUILD.gn
+@@ -46,6 +46,12 @@ component("webview") {
+ "//url",
+ ]
+
++ if (is_mac) {
++ deps += [
++ "//electron/build/config:generate_mas_config",
++ ]
++ }
++
+ public_deps = [
+ "//base",
+ "//content/public/browser",
diff --git a/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.cc b/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.cc
new file mode 100644
index 0000000000..5f730c9f0d
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.cc
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/webview/web_dialog_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/webview/web_dialog_view.cc
+@@ -449,8 +449,7 @@ bool WebDialogView::IsWebContentsCreatio
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) {
++ const content::mojom::CreateNewWindowParams& params) {
+ if (delegate_)
+ return delegate_->HandleShouldOverrideWebContentsCreation();
+ return false;
diff --git a/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.h b/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.h
new file mode 100644
index 0000000000..8c5f864df1
--- /dev/null
+++ b/electron34/patches/patch-ui_views_controls_webview_web__dialog__view.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/controls/webview/web_dialog_view.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/controls/webview/web_dialog_view.h
+@@ -167,8 +167,7 @@ class WEBVIEW_EXPORT WebDialogView : pub
+ content::SiteInstance* source_site_instance,
+ content::mojom::WindowContainerType window_container_type,
+ const GURL& opener_url,
+- const std::string& frame_name,
+- const GURL& target_url) override;
++ const content::mojom::CreateNewWindowParams& params) override;
+ void RequestMediaAccessPermission(
+ content::WebContents* web_contents,
+ const content::MediaStreamRequest& request,
diff --git a/electron34/patches/patch-ui_views_corewm_tooltip__aura.cc b/electron34/patches/patch-ui_views_corewm_tooltip__aura.cc
new file mode 100644
index 0000000000..4194a97631
--- /dev/null
+++ b/electron34/patches/patch-ui_views_corewm_tooltip__aura.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/corewm/tooltip_aura.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/corewm/tooltip_aura.cc
+@@ -38,7 +38,7 @@ static constexpr int kTooltipMaxWidth =
+
+ // TODO(varkha): Update if native widget can be transparent on Linux.
+ bool CanUseTranslucentTooltipWidget() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
diff --git a/electron34/patches/patch-ui_views_examples_widget__example.cc b/electron34/patches/patch-ui_views_examples_widget__example.cc
new file mode 100644
index 0000000000..55f022b601
--- /dev/null
+++ b/electron34/patches/patch-ui_views_examples_widget__example.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/examples/widget_example.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/examples/widget_example.cc
+@@ -50,7 +50,7 @@ void WidgetExample::CreateExampleView(Vi
+ modal_button->SetCallback(
+ base::BindRepeating(&WidgetExample::CreateDialogWidget,
+ base::Unretained(this), modal_button, true));
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Windows does not support TYPE_CONTROL top-level widgets.
+ LabelButton* control_button = BuildButton(
+ container, GetStringUTF16(IDS_WIDGET_CHILD_WIDGET_BUTTON_LABEL));
diff --git a/electron34/patches/patch-ui_views_focus_focus__manager.cc b/electron34/patches/patch-ui_views_focus_focus__manager.cc
new file mode 100644
index 0000000000..7f086fb978
--- /dev/null
+++ b/electron34/patches/patch-ui_views_focus_focus__manager.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/focus/focus_manager.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/focus/focus_manager.cc
+@@ -582,7 +582,7 @@ bool FocusManager::RedirectAcceleratorTo
+ if (!focus_manager->IsAcceleratorRegistered(accelerator))
+ return false;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Processing an accelerator can delete things. Because we
+ // need these objects afterwards on Linux, save widget_ as weak pointer and
+ // save the close_on_deactivate property value of widget_delegate in a
+@@ -597,7 +597,7 @@ bool FocusManager::RedirectAcceleratorTo
+ const bool accelerator_processed =
+ focus_manager->ProcessAccelerator(accelerator);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Need to manually close the bubble widget on Linux. On Linux when the
+ // bubble is shown, the main widget remains active. Because of that when
+ // focus is set to the main widget to process accelerator, the main widget
diff --git a/electron34/patches/patch-ui_views_style_platform__style.cc b/electron34/patches/patch-ui_views_style_platform__style.cc
new file mode 100644
index 0000000000..57700ec3fe
--- /dev/null
+++ b/electron34/patches/patch-ui_views_style_platform__style.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/style/platform_style.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/style/platform_style.cc
+@@ -16,7 +16,7 @@
+ #include "ui/views/controls/focusable_border.h"
+ #include "ui/views/controls/scrollbar/scroll_bar_views.h"
+
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/views/controls/scrollbar/overlay_scroll_bar.h"
+ #endif
+
+@@ -49,7 +49,7 @@ const View::FocusBehavior PlatformStyle:
+ // Linux clips bubble windows that extend outside their parent window
+ // bounds.
+ const bool PlatformStyle::kAdjustBubbleIfOffscreen =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #else
+ true;
+@@ -58,7 +58,7 @@ const bool PlatformStyle::kAdjustBubbleI
+ // static
+ std::unique_ptr<ScrollBar> PlatformStyle::CreateScrollBar(
+ ScrollBar::Orientation orientation) {
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return std::make_unique<OverlayScrollBar>(orientation);
+ #else
+ return std::make_unique<ScrollBarViews>(orientation);
diff --git a/electron34/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc b/electron34/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc
new file mode 100644
index 0000000000..b5c4c366c9
--- /dev/null
+++ b/electron34/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/test/ui_controls_factory_desktop_aura_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/test/ui_controls_factory_desktop_aura_ozone.cc
+@@ -237,7 +237,7 @@ bool SendMouseClick(MouseButton type, gf
+ window_hint);
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ void ForceUseScreenCoordinatesOnce() {
+ g_ozone_ui_controls_test_helper->ForceUseScreenCoordinatesOnce();
diff --git a/electron34/patches/patch-ui_views_views__delegate.cc b/electron34/patches/patch-ui_views_views__delegate.cc
new file mode 100644
index 0000000000..39518b15be
--- /dev/null
+++ b/electron34/patches/patch-ui_views_views__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/views_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/views_delegate.cc
+@@ -89,7 +89,7 @@ bool ViewsDelegate::IsWindowInMetro(gfx:
+ return false;
+ }
+ #elif BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ gfx::ImageSkia* ViewsDelegate::GetDefaultWindowIcon() const {
+ return nullptr;
+ }
diff --git a/electron34/patches/patch-ui_views_views__delegate.h b/electron34/patches/patch-ui_views_views__delegate.h
new file mode 100644
index 0000000000..90af16ecd1
--- /dev/null
+++ b/electron34/patches/patch-ui_views_views__delegate.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/views_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/views_delegate.h
+@@ -139,7 +139,7 @@ class VIEWS_EXPORT ViewsDelegate {
+ // environment.
+ virtual bool IsWindowInMetro(gfx::NativeWindow window) const;
+ #elif BUILDFLAG(ENABLE_DESKTOP_AURA) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD))
+ virtual gfx::ImageSkia* GetDefaultWindowIcon() const;
+ #endif
+
diff --git a/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc
new file mode 100644
index 0000000000..99b53657ef
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc
+@@ -204,7 +204,7 @@ DragOperation DesktopDragDropClientOzone
+ return selected_operation_;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void DesktopDragDropClientOzone::UpdateDragImage(const gfx::ImageSkia& image,
+ const gfx::Vector2d& offset) {
+ DCHECK(drag_handler_);
diff --git a/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h
new file mode 100644
index 0000000000..3daa216b31
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h
+@@ -67,7 +67,7 @@ class VIEWS_EXPORT DesktopDragDropClient
+ // The offset of |drag_widget_| relative to the mouse position.
+ gfx::Vector2d offset;
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // The last received drag location. The drag widget is moved asynchronously
+ // so its position is updated when the UI thread has time for that. When
+ // the first change to the location happens, a call to UpdateDragWidget()
+@@ -88,7 +88,7 @@ class VIEWS_EXPORT DesktopDragDropClient
+ const gfx::Point& root_location,
+ int allowed_operations,
+ ui::mojom::DragEventSource source) override;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void UpdateDragImage(const gfx::ImageSkia& image,
+ const gfx::Vector2d& offset) override;
+ #endif
diff --git a/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc
new file mode 100644
index 0000000000..7cd9f45e26
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc
@@ -0,0 +1,35 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+@@ -50,7 +50,7 @@
+ #include "ui/wm/core/window_util.h"
+ #include "ui/wm/public/window_move_client.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone_linux.h"
+ #endif
+
+@@ -342,7 +342,7 @@ std::unique_ptr<aura::client::DragDropCl
+ DesktopWindowTreeHostPlatform::CreateDragDropClient() {
+ ui::WmDragHandler* drag_handler = ui::GetWmDragHandler(*(platform_window()));
+ std::unique_ptr<DesktopDragDropClientOzone> drag_drop_client =
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::make_unique<DesktopDragDropClientOzoneLinux>(window(), drag_handler);
+ #else
+ std::make_unique<DesktopDragDropClientOzone>(window(), drag_handler);
+@@ -1149,7 +1149,7 @@ bool DesktopWindowTreeHostPlatform::Rota
+ // DesktopWindowTreeHost:
+
+ // Linux subclasses this host and adds some Linux specific bits.
+-#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+ // static
+ DesktopWindowTreeHost* DesktopWindowTreeHost::Create(
+ internal::NativeWidgetDelegate* native_widget_delegate,
diff --git a/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc
new file mode 100644
index 0000000000..1250657d9c
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc
@@ -0,0 +1,28 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+@@ -583,7 +583,7 @@ void DesktopWindowTreeHostWin::SetOpacit
+ void DesktopWindowTreeHostWin::SetAspectRatio(
+ const gfx::SizeF& aspect_ratio,
+ const gfx::Size& excluded_margin) {
+- DCHECK(!aspect_ratio.IsEmpty());
++ DCHECK_NE(aspect_ratio.height(), 0);
+ message_handler_->SetAspectRatio(aspect_ratio.width() / aspect_ratio.height(),
+ excluded_margin);
+ }
+@@ -1282,6 +1282,10 @@ void DesktopWindowTreeHostWin::HandleHea
+ window()->SetProperty(aura::client::kHeadlessBoundsKey, bounds);
+ }
+
++bool DesktopWindowTreeHostWin::HandleMouseEventForCaption(UINT message) const {
++ return false;
++}
++
+ DesktopNativeCursorManager*
+ DesktopWindowTreeHostWin::GetSingletonDesktopNativeCursorManager() {
+ return new DesktopNativeCursorManagerWin();
diff --git a/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h
new file mode 100644
index 0000000000..5adb7b994a
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+@@ -266,6 +266,7 @@ class VIEWS_EXPORT DesktopWindowTreeHost
+ void HandleWindowSizeUnchanged() override;
+ void HandleWindowScaleFactorChanged(float window_scale_factor) override;
+ void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) override;
++ bool HandleMouseEventForCaption(UINT message) const override;
+
+ Widget* GetWidget();
+ const Widget* GetWidget() const;
diff --git a/electron34/patches/patch-ui_views_widget_root__view.cc b/electron34/patches/patch-ui_views_widget_root__view.cc
new file mode 100644
index 0000000000..0c37fb0cbb
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_root__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/root_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/root_view.cc
+@@ -165,7 +165,7 @@ class AnnounceTextView : public View {
+ #if BUILDFLAG(IS_CHROMEOS)
+ // On ChromeOS, kAlert role can invoke an unnecessary event on reparenting.
+ GetViewAccessibility().SetRole(ax::mojom::Role::kStaticText);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40658933): Use live regions (do not use alerts).
+ // May require setting kLiveStatus, kContainerLiveStatus to "polite".
+ GetViewAccessibility().SetRole(ax::mojom::Role::kAlert);
diff --git a/electron34/patches/patch-ui_views_widget_widget.cc b/electron34/patches/patch-ui_views_widget_widget.cc
new file mode 100644
index 0000000000..237ace7245
--- /dev/null
+++ b/electron34/patches/patch-ui_views_widget_widget.cc
@@ -0,0 +1,26 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/widget/widget.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/widget/widget.cc
+@@ -60,7 +60,7 @@
+ #include "ui/views/window/custom_frame_view.h"
+ #include "ui/views/window/dialog_delegate.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/linux/linux_ui.h"
+ #endif
+
+@@ -2201,7 +2201,7 @@ const ui::NativeTheme* Widget::GetNative
+ if (parent_)
+ return parent_->GetNativeTheme();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (auto* linux_ui_theme = ui::LinuxUiTheme::GetForWindow(GetNativeWindow()))
+ return linux_ui_theme->GetNativeTheme();
+ #endif
diff --git a/electron34/patches/patch-ui_views_win_hwnd__message__handler.cc b/electron34/patches/patch-ui_views_win_hwnd__message__handler.cc
new file mode 100644
index 0000000000..03775aa2e1
--- /dev/null
+++ b/electron34/patches/patch-ui_views_win_hwnd__message__handler.cc
@@ -0,0 +1,194 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/win/hwnd_message_handler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/win/hwnd_message_handler.cc
+@@ -656,7 +656,8 @@ void HWNDMessageHandler::Show(ui::mojom:
+ SetWindowPlacement(hwnd(), &placement);
+ native_show_state = SW_SHOWMAXIMIZED;
+ } else {
+- const bool is_maximized = IsMaximized();
++ const bool is_maximized_or_arranged =
++ IsMaximized() || IsWindowArranged(hwnd());
+
+ // Use SW_SHOW/SW_SHOWNA instead of SW_SHOWNORMAL/SW_SHOWNOACTIVATE so that
+ // the window is not restored to its original position if it is maximized.
+@@ -666,7 +667,8 @@ void HWNDMessageHandler::Show(ui::mojom:
+ // position, some do not. See crbug.com/1296710
+ switch (show_state) {
+ case ui::mojom::WindowShowState::kInactive:
+- native_show_state = is_maximized ? SW_SHOWNA : SW_SHOWNOACTIVATE;
++ native_show_state =
++ is_maximized_or_arranged ? SW_SHOWNA : SW_SHOWNOACTIVATE;
+ break;
+ case ui::mojom::WindowShowState::kMaximized:
+ native_show_state = SW_SHOWMAXIMIZED;
+@@ -677,9 +679,11 @@ void HWNDMessageHandler::Show(ui::mojom:
+ case ui::mojom::WindowShowState::kNormal:
+ if ((GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_TRANSPARENT) ||
+ (GetWindowLong(hwnd(), GWL_EXSTYLE) & WS_EX_NOACTIVATE)) {
+- native_show_state = is_maximized ? SW_SHOWNA : SW_SHOWNOACTIVATE;
++ native_show_state =
++ is_maximized_or_arranged ? SW_SHOWNA : SW_SHOWNOACTIVATE;
+ } else {
+- native_show_state = is_maximized ? SW_SHOW : SW_SHOWNORMAL;
++ native_show_state =
++ is_maximized_or_arranged ? SW_SHOW : SW_SHOWNORMAL;
+ }
+ break;
+ case ui::mojom::WindowShowState::kFullscreen:
+@@ -908,13 +912,13 @@ void HWNDMessageHandler::FrameTypeChange
+
+ void HWNDMessageHandler::PaintAsActiveChanged() {
+ if (!delegate_->HasNonClientView() || !delegate_->CanActivate() ||
+- !delegate_->HasFrame() ||
++ (!delegate_->HasFrame() && !is_translucent_) ||
+ (delegate_->GetFrameMode() == FrameMode::CUSTOM_DRAWN)) {
+ return;
+ }
+
+ DefWindowProcWithRedrawLock(WM_NCACTIVATE, delegate_->ShouldPaintAsActive(),
+- 0);
++ delegate_->HasFrame() ? 0 : -1);
+ }
+
+ void HWNDMessageHandler::SetWindowIcons(const gfx::ImageSkia& window_icon,
+@@ -961,8 +965,11 @@ void HWNDMessageHandler::SetFullscreen(b
+
+ void HWNDMessageHandler::SetAspectRatio(float aspect_ratio,
+ const gfx::Size& excluded_margin) {
+- // If the aspect ratio is not in the valid range, do nothing.
+- DCHECK_GT(aspect_ratio, 0.0f);
++ // If the aspect ratio is 0, reset it to null.
++ if (aspect_ratio == 0.0f) {
++ aspect_ratio_.reset();
++ return;
++ }
+
+ aspect_ratio_ = aspect_ratio;
+
+@@ -1733,7 +1740,23 @@ LRESULT HWNDMessageHandler::OnCreate(CRE
+ SendMessage(hwnd(), WM_CHANGEUISTATE, MAKELPARAM(UIS_CLEAR, UISF_HIDEFOCUS),
+ 0);
+
+- if (!delegate_->HasFrame()) {
++ LONG is_popup =
++ GetWindowLong(hwnd(), GWL_STYLE) & static_cast<LONG>(WS_POPUP);
++
++ // For transparent windows, Electron removes the WS_CAPTION style,
++ // so we continue to remove it here. If we didn't, an opaque rectangle
++ // would show up.
++ // For non-transparent windows, Electron keeps the WS_CAPTION style,
++ // so we don't remove it in that case. If we did, a Windows 7 frame
++ // would show up.
++ // We also need this block for frameless popup windows. When the user opens
++ // a dropdown in an Electron app, the internal popup menu from
++ // third_party/blink/renderer/core/html/forms/internal_popup_menu.h
++ // is rendered. That menu is actually an HTML page inside of a frameless popup window.
++ // A new popup window is created every time the user opens the dropdown,
++ // and this code path is run. The code block below runs SendFrameChanged,
++ // which gives the dropdown options the proper layout.
++ if (!delegate_->HasFrame() && (is_translucent_ || is_popup)) {
+ SetWindowLong(hwnd(), GWL_STYLE,
+ GetWindowLong(hwnd(), GWL_STYLE) & ~WS_CAPTION);
+ SendFrameChanged();
+@@ -2237,17 +2260,18 @@ LRESULT HWNDMessageHandler::OnNCActivate
+ if (IsVisible())
+ delegate_->SchedulePaint();
+
+- // Calling DefWindowProc is only necessary if there's a system frame being
+- // drawn. Otherwise it can draw an incorrect title bar and cause visual
+- // corruption.
+- if (!delegate_->HasFrame() ||
++ // If the window is translucent, it may have the Mica background.
++ // In that case, it's necessary to call |DefWindowProc|, but we can
++ // pass -1 in the lParam to prevent any non-client area elements from
++ // being displayed.
++ if ((!delegate_->HasFrame() && !is_translucent_) ||
+ delegate_->GetFrameMode() == FrameMode::CUSTOM_DRAWN) {
+ SetMsgHandled(TRUE);
+ return TRUE;
+ }
+
+ return DefWindowProcWithRedrawLock(WM_NCACTIVATE, paint_as_active || active,
+- 0);
++ delegate_->HasFrame() ? 0 : -1);
+ }
+
+ LRESULT HWNDMessageHandler::OnNCCalcSize(BOOL mode, LPARAM l_param) {
+@@ -3039,15 +3063,19 @@ LRESULT HWNDMessageHandler::HandleMouseE
+ SetMsgHandled(FALSE);
+ // We must let Windows handle the caption buttons if it's drawing them, or
+ // they won't work.
++ bool simulate_mouse_event_for_caption = false;
+ if (delegate_->GetFrameMode() == FrameMode::SYSTEM_DRAWN &&
+ (hittest == HTCLOSE || hittest == HTMINBUTTON ||
+ hittest == HTMAXBUTTON)) {
+- SetMsgHandled(FALSE);
++ simulate_mouse_event_for_caption =
++ delegate_->HandleMouseEventForCaption(message);
++ if (!simulate_mouse_event_for_caption)
++ SetMsgHandled(FALSE);
+ }
+ // Let resize events fall through. Ignore everything else, as we're either
+ // letting Windows handle it above or we've already handled the equivalent
+ // touch message.
+- if (!IsHitTestOnResizeHandle(hittest))
++ if (!IsHitTestOnResizeHandle(hittest) && !simulate_mouse_event_for_caption)
+ return 0;
+ }
+
+@@ -3075,7 +3103,17 @@ LRESULT HWNDMessageHandler::HandleMouseE
+ w_param = static_cast<WPARAM>(SendMessage(
+ hwnd(), WM_NCHITTEST, 0, MAKELPARAM(screen_point.x, screen_point.y)));
+ if (w_param == HTCAPTION || w_param == HTSYSMENU) {
+- ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
++ LONG message_time = GetMessageTime();
++ CHROME_MSG msg = {hwnd(),
++ message,
++ w_param,
++ l_param,
++ static_cast<DWORD>(message_time),
++ {CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param)}};
++ ui::MouseEvent event(msg);
++ event.set_is_system_menu(true);
++ if (!delegate_->HandleMouseEvent(&event))
++ ShowSystemMenuAtScreenPixelLocation(hwnd(), gfx::Point(screen_point));
+ return 0;
+ }
+ } else if (message == WM_NCLBUTTONDOWN &&
+@@ -3593,14 +3631,29 @@ void HWNDMessageHandler::SizeWindowToAsp
+ delegate_->GetMinMaxSize(&min_window_size, &max_window_size);
+ min_window_size = delegate_->DIPToScreenSize(min_window_size);
+ max_window_size = delegate_->DIPToScreenSize(max_window_size);
++ // Add the native frame border size to the minimum and maximum size if the
++ // view reports its size as the client size.
++ if (delegate_->WidgetSizeIsClientSize()) {
++ RECT client_rect, rect;
++ GetClientRect(hwnd(), &client_rect);
++ GetWindowRect(hwnd(), &rect);
++ CR_DEFLATE_RECT(&rect, &client_rect);
++ min_window_size.Enlarge(rect.right - rect.left,
++ rect.bottom - rect.top);
++ // Either axis may be zero, so enlarge them independently.
++ if (max_window_size.width())
++ max_window_size.Enlarge(rect.right - rect.left, 0);
++ if (max_window_size.height())
++ max_window_size.Enlarge(0, rect.bottom - rect.top);
++ }
+
+ std::optional<gfx::Size> max_size_param;
+ if (!max_window_size.IsEmpty())
+ max_size_param = max_window_size;
+
+- gfx::SizeRectToAspectRatioWithExcludedMargin(
++ gfx::SizeRectToAspectRatio(
+ GetWindowResizeEdge(param), aspect_ratio_.value(), min_window_size,
+- max_size_param, excluded_margin_, *window_rect);
++ max_size_param, window_rect);
+ }
+
+ POINT HWNDMessageHandler::GetCursorPos() const {
diff --git a/electron34/patches/patch-ui_views_win_hwnd__message__handler__delegate.h b/electron34/patches/patch-ui_views_win_hwnd__message__handler__delegate.h
new file mode 100644
index 0000000000..7e25e5611b
--- /dev/null
+++ b/electron34/patches/patch-ui_views_win_hwnd__message__handler__delegate.h
@@ -0,0 +1,19 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/win/hwnd_message_handler_delegate.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/win/hwnd_message_handler_delegate.h
+@@ -255,6 +255,10 @@ class VIEWS_EXPORT HWNDMessageHandlerDel
+ // Called when the headless window bounds has changed.
+ virtual void HandleHeadlessWindowBoundsChanged(const gfx::Rect& bounds) = 0;
+
++ // Called when synthetic mouse event is generated for touch event on
++ // caption buttons.
++ virtual bool HandleMouseEventForCaption(UINT message) const = 0;
++
+ protected:
+ virtual ~HWNDMessageHandlerDelegate() = default;
+ };
diff --git a/electron34/patches/patch-ui_views_window_custom__frame__view.cc b/electron34/patches/patch-ui_views_window_custom__frame__view.cc
new file mode 100644
index 0000000000..4304572e60
--- /dev/null
+++ b/electron34/patches/patch-ui_views_window_custom__frame__view.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/window/custom_frame_view.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/window/custom_frame_view.cc
+@@ -265,7 +265,7 @@ int CustomFrameView::NonClientTopBorderH
+ int CustomFrameView::CaptionButtonY() const {
+ // Maximized buttons start at window top so that even if their images aren't
+ // drawn flush with the screen edge, they still obey Fitts' Law.
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return FrameBorderThickness();
+ #else
+ return frame_->IsMaximized() ? FrameBorderThickness() : kFrameShadowThickness;
diff --git a/electron34/patches/patch-ui_views_window_dialog__delegate.cc b/electron34/patches/patch-ui_views_window_dialog__delegate.cc
new file mode 100644
index 0000000000..8cf8ab2b3f
--- /dev/null
+++ b/electron34/patches/patch-ui_views_window_dialog__delegate.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/window/dialog_delegate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/window/dialog_delegate.cc
+@@ -105,7 +105,7 @@ Widget* DialogDelegate::CreateDialogWidg
+
+ // static
+ bool DialogDelegate::CanSupportCustomFrame(gfx::NativeView parent) {
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
+ // The new style doesn't support unparented dialogs on Linux desktop.
+ return parent != nullptr;
diff --git a/electron34/patches/patch-ui_views_window_frame__background.cc b/electron34/patches/patch-ui_views_window_frame__background.cc
new file mode 100644
index 0000000000..6c1c370c65
--- /dev/null
+++ b/electron34/patches/patch-ui_views_window_frame__background.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/window/frame_background.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/window/frame_background.cc
+@@ -110,7 +110,7 @@ void FrameBackground::PaintMaximized(gfx
+ int width) const {
+ // Fill the top with the frame color first so we have a constant background
+ // for areas not covered by the theme image.
+-#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ BUILDFLAG(ENABLE_DESKTOP_AURA)
+ ui::NativeTheme::FrameTopAreaExtraParams frame_top_area;
+ frame_top_area.use_custom_frame = use_custom_frame_;
diff --git a/electron34/patches/patch-ui_views_window_frame__caption__button.cc b/electron34/patches/patch-ui_views_window_frame__caption__button.cc
new file mode 100644
index 0000000000..c7d1e50eb7
--- /dev/null
+++ b/electron34/patches/patch-ui_views_window_frame__caption__button.cc
@@ -0,0 +1,40 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/window/frame_caption_button.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/window/frame_caption_button.cc
+@@ -107,7 +107,7 @@ FrameCaptionButton::FrameCaptionButton(P
+ FrameCaptionButton::~FrameCaptionButton() = default;
+
+ // static
+-SkColor FrameCaptionButton::GetButtonColor(SkColor background_color) {
++SkColor FrameCaptionButton::GetAccessibleButtonColor(SkColor background_color) {
+ // Use IsDark() to change target colors instead of PickContrastingColor(), so
+ // that DefaultFrameHeader::GetTitleColor() (which uses different target
+ // colors) can change between light/dark targets at the same time. It looks
+@@ -124,6 +124,22 @@ SkColor FrameCaptionButton::GetButtonCol
+ .color;
+ }
+
++SkColor FrameCaptionButton::GetButtonColor(SkColor background_color) {
++ // If the button color has been overridden, return that.
++ if (button_color_ != SkColor())
++ return button_color_;
++
++ return GetAccessibleButtonColor(background_color);
++}
++
++void FrameCaptionButton::SetButtonColor(SkColor button_color) {
++ if (button_color_ == button_color)
++ return;
++
++ button_color_ = button_color;
++ MaybeRefreshIconAndInkdropBaseColor();
++}
++
+ // static
+ float FrameCaptionButton::GetInactiveButtonColorAlphaRatio() {
+ return 0.38f;
diff --git a/electron34/patches/patch-ui_views_window_frame__caption__button.h b/electron34/patches/patch-ui_views_window_frame__caption__button.h
new file mode 100644
index 0000000000..b98b5e6a2f
--- /dev/null
+++ b/electron34/patches/patch-ui_views_window_frame__caption__button.h
@@ -0,0 +1,36 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- ui/views/window/frame_caption_button.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ ui/views/window/frame_caption_button.h
+@@ -44,8 +44,18 @@ class VIEWS_EXPORT FrameCaptionButton :
+ FrameCaptionButton& operator=(const FrameCaptionButton&) = delete;
+ ~FrameCaptionButton() override;
+
++ // Gets the color to use for a frame caption button with accessible contrast
++ // to the given background color.
++ static SkColor GetAccessibleButtonColor(SkColor background_color);
++
+ // Gets the color to use for a frame caption button.
+- static SkColor GetButtonColor(SkColor background_color);
++ SkColor GetButtonColor(SkColor background_color);
++
++ // Sets the color to use for a frame caption button.
++ // The color is by default calculated to be an accessible contrast
++ // to the background color, so you should keep that in mind when
++ // overriding that behavior.
++ void SetButtonColor(SkColor button_color);
+
+ // Gets the alpha ratio for the colors of inactive frame caption buttons.
+ static float GetInactiveButtonColorAlphaRatio();
+@@ -134,6 +144,7 @@ class VIEWS_EXPORT FrameCaptionButton :
+ // TODO(b/292154873): Store the foreground color instead of the background
+ // color for the SkColor type.
+ absl::variant<ui::ColorId, SkColor> color_ = gfx::kPlaceholderColor;
++ SkColor button_color_ = SkColor();
+
+ // Whether the button should be painted as active.
+ bool paint_as_active_ = false;
diff --git a/electron34/patches/patch-url_url__util.cc b/electron34/patches/patch-url_url__util.cc
new file mode 100644
index 0000000000..186a3c0fe4
--- /dev/null
+++ b/electron34/patches/patch-url_url__util.cc
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- url/url_util.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ url/url_util.cc
+@@ -135,6 +135,9 @@ struct SchemeRegistry {
+ kMaterializedViewScheme,
+ };
+
++ // Embedder schemes that have V8 code cache enabled in js and wasm scripts.
++ std::vector<std::string> code_cache_schemes = {};
++
+ // Schemes with a predefined default custom handler.
+ std::vector<SchemeWithHandler> predefined_handler_schemes;
+
+@@ -717,6 +720,15 @@ const std::vector<std::string>& GetEmpty
+ return GetSchemeRegistry().empty_document_schemes;
+ }
+
++void AddCodeCacheScheme(const char* new_scheme) {
++ DoAddScheme(new_scheme,
++ &GetSchemeRegistryWithoutLocking()->code_cache_schemes);
++}
++
++const std::vector<std::string>& GetCodeCacheSchemes() {
++ return GetSchemeRegistry().code_cache_schemes;
++}
++
+ void AddPredefinedHandlerScheme(const char* new_scheme, const char* handler) {
+ DoAddSchemeWithHandler(
+ new_scheme, handler,
diff --git a/electron34/patches/patch-url_url__util.h b/electron34/patches/patch-url_url__util.h
new file mode 100644
index 0000000000..3f4cbdd1be
--- /dev/null
+++ b/electron34/patches/patch-url_url__util.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- url/url_util.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ url/url_util.h
+@@ -115,6 +115,15 @@ COMPONENT_EXPORT(URL) const std::vector<
+ COMPONENT_EXPORT(URL) void AddEmptyDocumentScheme(const char* new_scheme);
+ COMPONENT_EXPORT(URL) const std::vector<std::string>& GetEmptyDocumentSchemes();
+
++// Adds an application-defined scheme to the list of schemes that have V8 code
++// cache enabled for the js and wasm scripts.
++// The WebUI schemes (chrome/chrome-untrusted) do not belong to this list, as
++// they are treated as a separate cache type for security purpose.
++// The http(s) schemes do not belong to this list neither, they always have V8
++// code cache enabled.
++COMPONENT_EXPORT(URL) void AddCodeCacheScheme(const char* new_scheme);
++COMPONENT_EXPORT(URL) const std::vector<std::string>& GetCodeCacheSchemes();
++
+ // Adds a scheme with a predefined default handler.
+ //
+ // This pair of strings must be normalized protocol handler parameters as
diff --git a/electron34/patches/patch-v8_BUILD.gn b/electron34/patches/patch-v8_BUILD.gn
new file mode 100644
index 0000000000..9c51c5d44d
--- /dev/null
+++ b/electron34/patches/patch-v8_BUILD.gn
@@ -0,0 +1,139 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/BUILD.gn.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/BUILD.gn
+@@ -929,6 +929,9 @@ external_v8_defines = [
+ "V8_TARGET_OS_MACOS",
+ "V8_TARGET_OS_WIN",
+ "V8_TARGET_OS_CHROMEOS",
++ "V8_TARGET_OS_OPENBSD",
++ "V8_TARGET_OS_FREEBSD",
++ "V8_TARGET_OS_NETBSD",
+ ]
+
+ enabled_external_v8_defines = [
+@@ -1005,6 +1008,15 @@ if (target_os == "android") {
+ } else if (target_os == "chromeos") {
+ enabled_external_v8_defines += [ "V8_HAVE_TARGET_OS" ]
+ enabled_external_v8_defines += [ "V8_TARGET_OS_CHROMEOS" ]
++} else if (target_os == "openbsd") {
++ enabled_external_v8_defines += [ "V8_HAVE_TARGET_OS" ]
++ enabled_external_v8_defines += [ "V8_TARGET_OS_OPENBSD" ]
++} else if (target_os == "freebsd") {
++ enabled_external_v8_defines += [ "V8_HAVE_TARGET_OS" ]
++ enabled_external_v8_defines += [ "V8_TARGET_OS_FREEBSD" ]
++} else if (target_os == "netbsd") {
++ enabled_external_v8_defines += [ "V8_HAVE_TARGET_OS" ]
++ enabled_external_v8_defines += [ "V8_TARGET_OS_NETBSD" ]
+ }
+
+ disabled_external_v8_defines = external_v8_defines - enabled_external_v8_defines
+@@ -2447,6 +2459,23 @@ action("generate_bytecode_builtins_list"
+ ]
+ }
+
++action("run_paxctl_mksnapshot") {
++ deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
++
++ script = "tools/run-paxctl.py"
++ stamp = "$target_gen_dir/paxctl_stamp"
++ outputs = [ stamp ]
++
++ sources = []
++ data = []
++
++ args = [
++ rebase_path(stamp, root_build_dir), "/usr/sbin/paxctl", "+m", "./" + rebase_path(get_label_info(":mksnapshot($v8_snapshot_toolchain)",
++ "root_out_dir") + "/mksnapshot",
++ root_build_dir),
++ ]
++}
++
+ # Template to generate different V8 snapshots based on different runtime flags.
+ # Can be invoked with run_mksnapshot(<name>). The target will resolve to
+ # run_mksnapshot_<name>. If <name> is "default", no file suffixes will be used.
+@@ -2465,7 +2494,11 @@ template("run_mksnapshot") {
+ suffix = "_$name"
+ }
+ action("run_mksnapshot_" + name) {
+- deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
++ if (target_os == "netbsd") {
++ deps = [ ":mksnapshot($v8_snapshot_toolchain)", ":run_paxctl_mksnapshot" ]
++ } else {
++ deps = [ ":mksnapshot($v8_snapshot_toolchain)" ]
++ }
+ if (v8_verify_deterministic_mksnapshot) {
+ # We archive the snapshot executable when verifying snapshot
+ # determinism to ease debugging.
+@@ -2572,6 +2605,12 @@ template("run_mksnapshot") {
+ if (!v8_enable_builtins_profiling && v8_enable_builtins_reordering) {
+ args += [ "--reorder-builtins" ]
+ }
++
++ if (v8_current_cpu == "x86") {
++ args -= [
++ "--abort-on-bad-builtin-profile-data",
++ ]
++ }
+ }
+
+ if (v8_enable_turboshaft_csa) {
+@@ -4666,7 +4705,7 @@ v8_header_set("v8_internal_headers") {
+ # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both
+ # based on Darwin and thus POSIX-compliant to a similar degree.
+ if (is_linux || is_chromeos || is_mac || is_ios ||
+- target_os == "freebsd") {
++ target_os == "freebsd" || target_os == "netbsd") {
+ sources += [ "src/trap-handler/handler-inside-posix.h" ]
+ } else if (is_win) {
+ sources += [ "src/trap-handler/handler-inside-win.h" ]
+@@ -6030,7 +6069,7 @@ v8_source_set("v8_base_without_compiler"
+ # iOS Xcode simulator builds run on an x64 target. iOS and macOS are both
+ # based on Darwin and thus POSIX-compliant to a similar degree.
+ if (is_linux || is_chromeos || is_mac || is_ios ||
+- target_os == "freebsd") {
++ target_os == "freebsd" || target_os == "netbsd") {
+ sources += [
+ "src/trap-handler/handler-inside-posix.cc",
+ "src/trap-handler/handler-outside-posix.cc",
+@@ -6645,7 +6684,7 @@ v8_component("v8_libbase") {
+ }
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [
+ "src/base/debug/stack_trace_posix.cc",
+ "src/base/platform/platform-linux.cc",
+@@ -6656,6 +6695,27 @@ v8_component("v8_libbase") {
+ "dl",
+ "rt",
+ ]
++ } else if (is_openbsd) {
++ sources += [
++ "src/base/debug/stack_trace_posix.cc",
++ "src/base/platform/platform-openbsd.cc",
++ ]
++ libs = [ "execinfo" ]
++ } else if (is_netbsd) {
++ sources += [
++ "src/base/debug/stack_trace_posix.cc",
++ "src/base/platform/platform-openbsd.cc",
++ ]
++ libs = [
++ "rt",
++ "execinfo",
++ ]
++ } else if (is_freebsd) {
++ sources += [
++ "src/base/debug/stack_trace_posix.cc",
++ "src/base/platform/platform-freebsd.cc",
++ ]
++ libs = [ "execinfo" ]
+ } else if (current_os == "aix") {
+ sources += [
+ "src/base/debug/stack_trace_posix.cc",
diff --git a/electron34/patches/patch-v8_include_v8-fast-api-calls.h b/electron34/patches/patch-v8_include_v8-fast-api-calls.h
new file mode 100644
index 0000000000..9dea09fbba
--- /dev/null
+++ b/electron34/patches/patch-v8_include_v8-fast-api-calls.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/include/v8-fast-api-calls.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/include/v8-fast-api-calls.h
+@@ -340,7 +340,7 @@ struct V8_DEPRECATE_SOON(
+ };
+
+ template <typename T>
+-struct V8_DEPRECATED(
++struct V8_DEPRECATE_SOON(
+ "When an API function expects a TypedArray as a parameter, the type in the "
+ "signature should be `v8::Local<v8::Value>` instead of "
+ "FastApiTypedArray<>. The API function then has to type-check the "
diff --git a/electron34/patches/patch-v8_include_v8-internal.h b/electron34/patches/patch-v8_include_v8-internal.h
new file mode 100644
index 0000000000..20bb5d8ad0
--- /dev/null
+++ b/electron34/patches/patch-v8_include_v8-internal.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/include/v8-internal.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/include/v8-internal.h
+@@ -231,7 +231,7 @@ using SandboxedPointer_t = Address;
+ #ifdef V8_ENABLE_SANDBOX
+
+ // Size of the sandbox, excluding the guard regions surrounding it.
+-#if defined(V8_TARGET_OS_ANDROID)
++#if (defined(V8_TARGET_OS_ANDROID) || defined(V8_TARGET_OS_OPENBSD))
+ // On Android, most 64-bit devices seem to be configured with only 39 bits of
+ // virtual address space for userspace. As such, limit the sandbox to 128GB (a
+ // quarter of the total available address space).
diff --git a/electron34/patches/patch-v8_include_v8-microtask-queue.h b/electron34/patches/patch-v8_include_v8-microtask-queue.h
new file mode 100644
index 0000000000..e98a67c252
--- /dev/null
+++ b/electron34/patches/patch-v8_include_v8-microtask-queue.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/include/v8-microtask-queue.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/include/v8-microtask-queue.h
+@@ -97,6 +97,9 @@ class V8_EXPORT MicrotaskQueue {
+ */
+ virtual int GetMicrotasksScopeDepth() const = 0;
+
++ virtual void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) = 0;
++ virtual v8::MicrotasksPolicy microtasks_policy() const = 0;
++
+ MicrotaskQueue(const MicrotaskQueue&) = delete;
+ MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
+
diff --git a/electron34/patches/patch-v8_include_v8-object.h b/electron34/patches/patch-v8_include_v8-object.h
new file mode 100644
index 0000000000..2c0bd1e4af
--- /dev/null
+++ b/electron34/patches/patch-v8_include_v8-object.h
@@ -0,0 +1,39 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/include/v8-object.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/include/v8-object.h
+@@ -22,6 +22,8 @@ class Function;
+ class FunctionTemplate;
+ template <typename T>
+ class PropertyCallbackInfo;
++class Module;
++class UnboundScript;
+
+ /**
+ * A private symbol
+@@ -532,6 +534,21 @@ class V8_EXPORT Object : public Value {
+ index);
+ }
+
++ /**
++ * Warning: These are Node.js-specific extentions used to avoid breaking
++ * changes in Node.js v20.x. They do not exist in V8 upstream and will
++ * not exist in Node.js v21.x. Node.js embedders and addon authors should
++ * not use them from v20.x.
++ */
++#ifndef NODE_WANT_INTERNALS
++ V8_DEPRECATED("This extention should only be used by Node.js core")
++#endif
++ void SetInternalFieldForNodeCore(int index, Local<Module> value);
++#ifndef NODE_WANT_INTERNALS
++ V8_DEPRECATED("This extention should only be used by Node.js core")
++#endif
++ void SetInternalFieldForNodeCore(int index, Local<UnboundScript> value);
++
+ /** Same as above, but works for TracedReference. */
+ V8_INLINE static void* GetAlignedPointerFromInternalField(
+ const BasicTracedReference<Object>& object, int index) {
diff --git a/electron34/patches/patch-v8_include_v8config.h b/electron34/patches/patch-v8_include_v8config.h
new file mode 100644
index 0000000000..da3fbdbb3a
--- /dev/null
+++ b/electron34/patches/patch-v8_include_v8config.h
@@ -0,0 +1,64 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/include/v8config.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/include/v8config.h
+@@ -201,6 +201,9 @@ path. Add it with -I<path> to the comman
+ && !defined(V8_TARGET_OS_FUCHSIA) \
+ && !defined(V8_TARGET_OS_IOS) \
+ && !defined(V8_TARGET_OS_LINUX) \
++ && !defined(V8_TARGET_OS_OPENBSD) \
++ && !defined(V8_TARGET_OS_FREEBSD) \
++ && !defined(V8_TARGET_OS_NETBSD) \
+ && !defined(V8_TARGET_OS_MACOS) \
+ && !defined(V8_TARGET_OS_WIN) \
+ && !defined(V8_TARGET_OS_CHROMEOS)
+@@ -213,6 +216,9 @@ path. Add it with -I<path> to the comman
+ || defined(V8_TARGET_OS_FUCHSIA) \
+ || defined(V8_TARGET_OS_IOS) \
+ || defined(V8_TARGET_OS_LINUX) \
++ || defined(V8_TARGET_OS_OPENBSD) \
++ || defined(V8_TARGET_OS_FREEBSD) \
++ || defined(V8_TARGET_OS_NETBSD) \
+ || defined(V8_TARGET_OS_MACOS) \
+ || defined(V8_TARGET_OS_WIN) \
+ || defined(V8_TARGET_OS_CHROMEOS)
+@@ -236,6 +242,27 @@ path. Add it with -I<path> to the comman
+ # define V8_TARGET_OS_LINUX
+ #endif
+
++#ifdef V8_OS_OPENBSD
++# define V8_TARGET_OS_OPENBSD
++# define V8_TARGET_OS_BSD
++#endif
++
++#ifdef V8_OS_FREEBSD
++# define V8_TARGET_OS_OPENBSD
++# define V8_TARGET_OS_BSD
++#endif
++
++#ifdef V8_OS_NETBSD
++# define V8_TARGET_OS_OPENBSD
++# define V8_TARGET_OS_NETBSD
++# define V8_TARGET_OS_BSD
++#endif
++
++#ifdef V8_OS_NETBSD
++# define V8_TARGET_OS_NETBSD
++# define V8_TARGET_OS_BSD
++#endif
++
+ #ifdef V8_OS_MACOS
+ # define V8_TARGET_OS_MACOS
+ #endif
+@@ -382,6 +409,7 @@ path. Add it with -I<path> to the comman
+ #if (defined(_M_X64) || defined(__x86_64__) /* x64 (everywhere) */ \
+ || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */ \
+ && !defined(_WIN32))) /* not on windows */ \
++ && !defined(__OpenBSD__) /* not on OpenBSD */ \
+ && !defined(COMPONENT_BUILD) /* no component build */\
+ && __clang_major__ >= 17 /* clang >= 17 */
+ # define V8_HAS_ATTRIBUTE_PRESERVE_MOST (__has_attribute(preserve_most))
diff --git a/electron34/patches/patch-v8_src_api_api.cc b/electron34/patches/patch-v8_src_api_api.cc
new file mode 100644
index 0000000000..e7ed879e8f
--- /dev/null
+++ b/electron34/patches/patch-v8_src_api_api.cc
@@ -0,0 +1,62 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/api/api.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/api/api.cc
+@@ -152,7 +152,7 @@
+ #include "src/wasm/wasm-serialization.h"
+ #endif // V8_ENABLE_WEBASSEMBLY
+
+-#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD
++#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD || V8_OS_OPENBSD || V8_OS_NETBSD
+ #include <signal.h>
+ #include <unistd.h>
+
+@@ -6418,14 +6418,33 @@ Local<Data> v8::Object::SlowGetInternalF
+ i::Cast<i::JSObject>(*obj)->GetEmbedderField(index), isolate));
+ }
+
+-void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
+- auto obj = Utils::OpenDirectHandle(this);
++template<typename T>
++void SetInternalFieldImpl(v8::Object* receiver, int index, v8::Local<T> value) {
++ auto obj = Utils::OpenDirectHandle(receiver);
+ const char* location = "v8::Object::SetInternalField()";
+ if (!InternalFieldOK(obj, index, location)) return;
+ auto val = Utils::OpenDirectHandle(*value);
+ i::Cast<i::JSObject>(obj)->SetEmbedderField(index, *val);
+ }
+
++void v8::Object::SetInternalField(int index, v8::Local<Data> value) {
++ SetInternalFieldImpl(this, index, value);
++}
++
++/**
++ * These are Node.js-specific extentions used to avoid breaking changes in
++ * Node.js v20.x.
++ */
++void v8::Object::SetInternalFieldForNodeCore(int index,
++ v8::Local<Module> value) {
++ SetInternalFieldImpl(this, index, value);
++}
++
++void v8::Object::SetInternalFieldForNodeCore(int index,
++ v8::Local<UnboundScript> value) {
++ SetInternalFieldImpl(this, index, value);
++}
++
+ void* v8::Object::SlowGetAlignedPointerFromInternalField(v8::Isolate* isolate,
+ int index) {
+ auto obj = Utils::OpenDirectHandle(this);
+@@ -6571,7 +6590,7 @@ bool v8::V8::Initialize(const int build_
+ return true;
+ }
+
+-#if V8_OS_LINUX || V8_OS_DARWIN
++#if V8_OS_LINUX || V8_OS_DARWIN || V8_OS_FREEBSD || V8_OS_OPENBSD|| V8_OS_NETBSD
+ bool TryHandleWebAssemblyTrapPosix(int sig_code, siginfo_t* info,
+ void* context) {
+ #if V8_ENABLE_WEBASSEMBLY && V8_TRAP_HANDLER_SUPPORTED
diff --git a/electron34/patches/patch-v8_src_base_atomicops.h b/electron34/patches/patch-v8_src_base_atomicops.h
new file mode 100644
index 0000000000..fcdc527395
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_atomicops.h
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/atomicops.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/atomicops.h
+@@ -57,10 +57,10 @@ using Atomic64 = SbAtomic64;
+ using Atomic8 = char;
+ using Atomic16 = int16_t;
+ using Atomic32 = int32_t;
+-#if defined(V8_HOST_ARCH_64_BIT)
++#if defined(V8_HOST_ARCH_64_BIT) || defined(V8_OS_OPENBSD)
+ // We need to be able to go between Atomic64 and AtomicWord implicitly. This
+ // means Atomic64 and AtomicWord should be the same type on 64-bit.
+-#if defined(__ILP32__)
++#if defined(__ILP32__) && !defined(V8_OS_OPENBSD)
+ using Atomic64 = int64_t;
+ #else
+ using Atomic64 = intptr_t;
+@@ -266,7 +266,7 @@ inline Atomic32 SeqCst_Load(volatile con
+ std::memory_order_seq_cst);
+ }
+
+-#if defined(V8_HOST_ARCH_64_BIT)
++#if defined(V8_HOST_ARCH_64_BIT) || defined(V8_OS_OPENBSD)
+
+ inline Atomic64 Relaxed_CompareAndSwap(volatile Atomic64* ptr,
+ Atomic64 old_value, Atomic64 new_value) {
diff --git a/electron34/patches/patch-v8_src_base_platform_memory.h b/electron34/patches/patch-v8_src_base_platform_memory.h
new file mode 100644
index 0000000000..449df030cc
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_platform_memory.h
@@ -0,0 +1,24 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/platform/memory.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/platform/memory.h
+@@ -21,13 +21,13 @@
+ #include <malloc/malloc.h>
+ #elif V8_OS_OPENBSD
+ #include <sys/malloc.h>
+-#elif V8_OS_ZOS
++#elif (V8_OS_ZOS || V8_OS_BSD)
+ #include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+
+-#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_ZOS && !V8_OS_OPENBSD) || V8_OS_WIN
++#if (V8_OS_POSIX && !V8_OS_AIX && !V8_OS_SOLARIS && !V8_OS_ZOS && !V8_OS_BSD) || V8_OS_WIN
+ #define V8_HAS_MALLOC_USABLE_SIZE 1
+ #endif
+
diff --git a/electron34/patches/patch-v8_src_base_platform_platform-freebsd.cc b/electron34/patches/patch-v8_src_base_platform_platform-freebsd.cc
new file mode 100644
index 0000000000..0dbc2dfcd3
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_platform_platform-freebsd.cc
@@ -0,0 +1,38 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/platform/platform-freebsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/platform/platform-freebsd.cc
+@@ -43,14 +43,10 @@ TimezoneCache* OS::CreateTimezoneCache()
+ return new PosixDefaultTimezoneCache();
+ }
+
+-static unsigned StringToLong(char* buffer) {
+- return static_cast<unsigned>(strtol(buffer, nullptr, 16));
+-}
+-
+ std::vector<OS::SharedLibraryAddress> OS::GetSharedLibraryAddresses() {
+ std::vector<SharedLibraryAddress> result;
+ int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_VMMAP, getpid()};
+- size_t miblen = sizeof(mib) / sizeof(mib[0]);
++ unsigned int miblen = sizeof(mib) / sizeof(mib[0]);
+ size_t buffer_size;
+ if (sysctl(mib, miblen, nullptr, &buffer_size, nullptr, 0) == 0) {
+ // Overallocate the buffer by 1/3 to account for concurrent
+@@ -82,8 +78,13 @@ std::vector<OS::SharedLibraryAddress> OS
+ lib_name = std::string(path);
+ }
+ result.push_back(SharedLibraryAddress(
++#if defined(__i386__) || defined(OS_FREEBSD)
++ lib_name, static_cast<uintptr_t>(map->kve_start),
++ static_cast<uintptr_t>(map->kve_end)));
++#else
+ lib_name, reinterpret_cast<uintptr_t>(map->kve_start),
+ reinterpret_cast<uintptr_t>(map->kve_end)));
++#endif
+ }
+
+ start += ssize;
diff --git a/electron34/patches/patch-v8_src_base_platform_platform-openbsd.cc b/electron34/patches/patch-v8_src_base_platform_platform-openbsd.cc
new file mode 100644
index 0000000000..6391cf61c7
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_platform_platform-openbsd.cc
@@ -0,0 +1,53 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/platform/platform-openbsd.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/platform/platform-openbsd.cc
+@@ -6,6 +6,9 @@
+ // POSIX-compatible parts, the implementation is in platform-posix.cc.
+
+ #include <pthread.h>
++#if !defined(__NetBSD__)
++#include <pthread_np.h>
++#endif
+ #include <semaphore.h>
+ #include <signal.h>
+ #include <stdlib.h>
+@@ -122,6 +125,34 @@ void OS::SignalCodeMovingGC() {
+
+ void OS::AdjustSchedulingParams() {}
+
++// static
++Stack::StackSlot Stack::ObtainCurrentThreadStackStart() {
++#if defined(__NetBSD__)
++ pthread_attr_t attr;
++ int error;
++ pthread_attr_init(&attr);
++ error = pthread_attr_get_np(pthread_self(), &attr);
++ if (!error) {
++ void* base;
++ size_t size;
++ error = pthread_attr_getstack(&attr, &base, &size);
++ CHECK(!error);
++ pthread_attr_destroy(&attr);
++ return reinterpret_cast<uint8_t*>(base) + size;
++ }
++ pthread_attr_destroy(&attr);
++ return nullptr;
++#else
++ stack_t ss;
++ void *base;
++ if (pthread_stackseg_np(pthread_self(), &ss) != 0)
++ return nullptr;
++
++ base = (void*)((size_t) ss.ss_sp - ss.ss_size);
++ return reinterpret_cast<uint8_t*>(base) + ss.ss_size;
++#endif
++}
++
+ std::optional<OS::MemoryRange> OS::GetFirstFreeMemoryRangeWithin(
+ OS::Address boundary_start, OS::Address boundary_end, size_t minimum_size,
+ size_t alignment) {
diff --git a/electron34/patches/patch-v8_src_base_platform_platform-posix.cc b/electron34/patches/patch-v8_src_base_platform_platform-posix.cc
new file mode 100644
index 0000000000..1b8ad900e3
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_platform_platform-posix.cc
@@ -0,0 +1,101 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/platform/platform-posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/platform/platform-posix.cc
+@@ -27,6 +27,9 @@
+ defined(__NetBSD__) || defined(__OpenBSD__)
+ #include <sys/sysctl.h> // for sysctl
+ #endif
++#if defined(__NetBSD__)
++#include <lwp.h>
++#endif
+
+ #if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
+ #define LOG_TAG "v8"
+@@ -75,9 +78,11 @@
+ #include <sys/syscall.h>
+ #endif
+
+-#if V8_OS_FREEBSD || V8_OS_DARWIN || V8_OS_OPENBSD || V8_OS_SOLARIS
++#if V8_OS_FREEBSD || V8_OS_DARWIN || V8_OS_BSD || V8_OS_SOLARIS
++#ifndef MAP_ANONYMOUS
+ #define MAP_ANONYMOUS MAP_ANON
+ #endif
++#endif
+
+ #if defined(V8_OS_SOLARIS)
+ #if (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__)
+@@ -314,6 +319,13 @@ void OS::SetRandomMmapSeed(int64_t seed)
+ }
+ }
+
++#if V8_OS_OPENBSD
++// Allow OpenBSD's mmap to select a random address on OpenBSD
++// static
++void* OS::GetRandomMmapAddr() {
++ return nullptr;
++}
++#else
+ // static
+ void* OS::GetRandomMmapAddr() {
+ uintptr_t raw_addr;
+@@ -412,6 +424,7 @@ void* OS::GetRandomMmapAddr() {
+ #endif
+ return reinterpret_cast<void*>(raw_addr);
+ }
++#endif
+
+ // TODO(bbudge) Move Cygwin and Fuchsia stuff into platform-specific files.
+ #if !V8_OS_CYGWIN && !V8_OS_FUCHSIA
+@@ -700,7 +713,7 @@ void OS::DestroySharedMemoryHandle(Platf
+ #if !V8_OS_ZOS
+ // static
+ bool OS::HasLazyCommits() {
+-#if V8_OS_AIX || V8_OS_LINUX || V8_OS_DARWIN
++#if V8_OS_AIX || V8_OS_LINUX || V8_OS_DARWIN || V8_OS_BSD
+ return true;
+ #else
+ // TODO(bbudge) Return true for all POSIX platforms.
+@@ -855,6 +868,8 @@ int OS::GetCurrentThreadId() {
+ return static_cast<int>(thread_self());
+ #elif V8_OS_FUCHSIA
+ return static_cast<int>(zx_thread_self());
++#elif V8_OS_NETBSD
++ return static_cast<int>(_lwp_self());
+ #elif V8_OS_SOLARIS
+ return static_cast<int>(pthread_self());
+ #elif V8_OS_ZOS
+@@ -1156,7 +1171,11 @@ Thread::Thread(const Options& options)
+ stack_size_(options.stack_size()),
+ priority_(options.priority()),
+ start_semaphore_(nullptr) {
++#if !defined(V8_OS_NETBSD)
+ const int min_stack_size = static_cast<int>(PTHREAD_STACK_MIN);
++#else
++ const int min_stack_size = static_cast<int>(sysconf(_SC_THREAD_STACK_MIN));
++#endif
+ if (stack_size_ > 0) stack_size_ = std::max(stack_size_, min_stack_size);
+ set_name(options.name());
+ }
+@@ -1171,7 +1190,7 @@ static void SetThreadName(const char* na
+ pthread_set_name_np(pthread_self(), name);
+ #elif V8_OS_NETBSD
+ static_assert(Thread::kMaxThreadNameLength <= PTHREAD_MAX_NAMELEN_NP);
+- pthread_setname_np(pthread_self(), "%s", name);
++ pthread_setname_np(pthread_self(), "%s", (void *)name);
+ #elif V8_OS_DARWIN
+ // pthread_setname_np is only available in 10.6 or later, so test
+ // for it at runtime.
+@@ -1346,7 +1365,7 @@ void Thread::SetThreadLocal(LocalStorage
+ // keep this version in POSIX as most Linux-compatible derivatives will
+ // support it. MacOS and FreeBSD are different here.
+ #if !defined(V8_OS_FREEBSD) && !defined(V8_OS_DARWIN) && !defined(_AIX) && \
+- !defined(V8_OS_SOLARIS)
++ !defined(V8_OS_SOLARIS) && !defined(V8_OS_OPENBSD) && !defined(V8_OS_NETBSD)
+
+ namespace {
+ #if DEBUG
diff --git a/electron34/patches/patch-v8_src_base_small-vector.h b/electron34/patches/patch-v8_src_base_small-vector.h
new file mode 100644
index 0000000000..9b02383f7d
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_small-vector.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/small-vector.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/small-vector.h
+@@ -22,7 +22,7 @@ template <typename T, size_t kSize, type
+ class SmallVector {
+ // Currently only support trivially copyable and trivially destructible data
+ // types, as it uses memcpy to copy elements and never calls destructors.
+- ASSERT_TRIVIALLY_COPYABLE(T);
++ // XXX FREEBSD ASSERT_TRIVIALLY_COPYABLE(T);
+ static_assert(std::is_trivially_destructible<T>::value);
+
+ public:
diff --git a/electron34/patches/patch-v8_src_base_strings.h b/electron34/patches/patch-v8_src_base_strings.h
new file mode 100644
index 0000000000..7a4108ddc2
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_strings.h
@@ -0,0 +1,18 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/strings.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/strings.h
+@@ -8,6 +8,9 @@
+ #include "src/base/base-export.h"
+ #include "src/base/macros.h"
+ #include "src/base/vector.h"
++#if defined(__NetBSD__)
++#include <stdarg.h>
++#endif
+
+ namespace v8 {
+ namespace base {
diff --git a/electron34/patches/patch-v8_src_base_sys-info.cc b/electron34/patches/patch-v8_src_base_sys-info.cc
new file mode 100644
index 0000000000..2cbdeb807f
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_sys-info.cc
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/sys-info.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/sys-info.cc
+@@ -35,8 +35,12 @@ namespace base {
+
+ // static
+ int SysInfo::NumberOfProcessors() {
++#if V8_OS_OPENBSD || V8_OS_NETBSD
+ #if V8_OS_OPENBSD
++ int mib[2] = {CTL_HW, HW_NCPUONLINE};
++#else
+ int mib[2] = {CTL_HW, HW_NCPU};
++#endif
+ int ncpu = 0;
+ size_t len = sizeof(ncpu);
+ if (sysctl(mib, arraysize(mib), &ncpu, &len, nullptr, 0) != 0) {
diff --git a/electron34/patches/patch-v8_src_base_utils_random-number-generator.cc b/electron34/patches/patch-v8_src_base_utils_random-number-generator.cc
new file mode 100644
index 0000000000..9264a9d9ad
--- /dev/null
+++ b/electron34/patches/patch-v8_src_base_utils_random-number-generator.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/base/utils/random-number-generator.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/base/utils/random-number-generator.cc
+@@ -56,7 +56,7 @@ RandomNumberGenerator::RandomNumberGener
+ DCHECK_EQ(0, result);
+ USE(result);
+ SetSeed((static_cast<int64_t>(first_half) << 32) + second_half);
+-#elif V8_OS_DARWIN || V8_OS_FREEBSD || V8_OS_OPENBSD
++#elif V8_OS_DARWIN || V8_OS_FREEBSD || V8_OS_OPENBSD || V8_OS_NETBSD
+ // Despite its prefix suggests it is not RC4 algorithm anymore.
+ // It always succeeds while having decent performance and
+ // no file descriptor involved.
diff --git a/electron34/patches/patch-v8_src_builtins_x64_builtins-x64.cc b/electron34/patches/patch-v8_src_builtins_x64_builtins-x64.cc
new file mode 100644
index 0000000000..070469b858
--- /dev/null
+++ b/electron34/patches/patch-v8_src_builtins_x64_builtins-x64.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/builtins/x64/builtins-x64.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/builtins/x64/builtins-x64.cc
+@@ -1830,7 +1830,7 @@ static void Generate_InterpreterEnterByt
+ times_system_pointer_size, 0));
+
+ // Jump to the interpreter entry, and call kJavaScriptCallCodeStartRegister.
+- __ jmp(rbx);
++ __ jmp(rbx, /*notrack=*/true);
+ }
+
+ void Builtins::Generate_InterpreterEnterAtNextBytecode(MacroAssembler* masm) {
diff --git a/electron34/patches/patch-v8_src_compiler_escape-analysis.cc b/electron34/patches/patch-v8_src_compiler_escape-analysis.cc
new file mode 100644
index 0000000000..cace98faf0
--- /dev/null
+++ b/electron34/patches/patch-v8_src_compiler_escape-analysis.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/compiler/escape-analysis.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/compiler/escape-analysis.cc
+@@ -622,6 +622,16 @@ void ReduceNode(const Operator* op, Esca
+ Node* value = current->ValueInput(1);
+ const VirtualObject* vobject = current->GetVirtualObject(object);
+ Variable var;
++ if (value->opcode() == IrOpcode::kTrustedHeapConstant) {
++ // TODO(dmercadier): enable escaping objects containing
++ // TrustedHeapConstants. This is currently disabled because it leads to
++ // bugs when Trusted HeapConstant and regular HeapConstant flow into the
++ // same Phi, which can then be marked as Compressed, messing up the
++ // tagging of the Trusted HeapConstant.
++ current->SetEscaped(object);
++ current->SetEscaped(value);
++ break;
++ }
+ // BoundedSize fields cannot currently be materialized by the deoptimizer,
+ // so we must not dematerialze them.
+ if (vobject && !vobject->HasEscaped() &&
diff --git a/electron34/patches/patch-v8_src_diagnostics_perf-jit.cc b/electron34/patches/patch-v8_src_diagnostics_perf-jit.cc
new file mode 100644
index 0000000000..3a7431bd43
--- /dev/null
+++ b/electron34/patches/patch-v8_src_diagnostics_perf-jit.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/diagnostics/perf-jit.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/diagnostics/perf-jit.cc
+@@ -31,7 +31,7 @@
+ #include "src/flags/flags.h"
+
+ // Only compile the {LinuxPerfJitLogger} on Linux.
+-#if V8_OS_LINUX
++#if defined(V8_OS_LINUX) || defined(V8_OS_BSD)
+
+ #include <fcntl.h>
+ #include <sys/mman.h>
diff --git a/electron34/patches/patch-v8_src_diagnostics_perf-jit.h b/electron34/patches/patch-v8_src_diagnostics_perf-jit.h
new file mode 100644
index 0000000000..3d237a91fb
--- /dev/null
+++ b/electron34/patches/patch-v8_src_diagnostics_perf-jit.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/diagnostics/perf-jit.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/diagnostics/perf-jit.h
+@@ -31,7 +31,7 @@
+ #include "include/v8config.h"
+
+ // {LinuxPerfJitLogger} is only implemented on Linux.
+-#if V8_OS_LINUX
++#if defined(V8_OS_LINUX) || defined(V8_OS_BSD)
+
+ #include "src/logging/log.h"
+
diff --git a/electron34/patches/patch-v8_src_execution_isolate.cc b/electron34/patches/patch-v8_src_execution_isolate.cc
new file mode 100644
index 0000000000..b3a3baf320
--- /dev/null
+++ b/electron34/patches/patch-v8_src_execution_isolate.cc
@@ -0,0 +1,33 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/execution/isolate.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/execution/isolate.cc
+@@ -170,6 +170,10 @@
+ #include "src/execution/simulator-base.h"
+ #endif
+
++#if defined(V8_OS_OPENBSD)
++#include <sys/mman.h>
++#endif
++
+ extern "C" const uint8_t v8_Default_embedded_blob_code_[];
+ extern "C" uint32_t v8_Default_embedded_blob_code_size_;
+ extern "C" const uint8_t v8_Default_embedded_blob_data_[];
+@@ -4990,6 +4994,13 @@ void Isolate::InitializeDefaultEmbeddedB
+ const uint8_t* data = DefaultEmbeddedBlobData();
+ uint32_t data_size = DefaultEmbeddedBlobDataSize();
+
++#if defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32)
++ if (code_size > 0) {
++ mprotect(reinterpret_cast<void *>(const_cast<uint8_t *>(code)),
++ code_size, PROT_READ | PROT_EXEC);
++ }
++#endif
++
+ if (StickyEmbeddedBlobCode() != nullptr) {
+ base::MutexGuard guard(current_embedded_blob_refcount_mutex_.Pointer());
+ // Check again now that we hold the lock.
diff --git a/electron34/patches/patch-v8_src_execution_microtask-queue.h b/electron34/patches/patch-v8_src_execution_microtask-queue.h
new file mode 100644
index 0000000000..f59dc37936
--- /dev/null
+++ b/electron34/patches/patch-v8_src_execution_microtask-queue.h
@@ -0,0 +1,21 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/execution/microtask-queue.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/execution/microtask-queue.h
+@@ -93,10 +93,10 @@ class V8_EXPORT_PRIVATE MicrotaskQueue f
+ }
+ #endif
+
+- void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) {
++ void set_microtasks_policy(v8::MicrotasksPolicy microtasks_policy) override {
+ microtasks_policy_ = microtasks_policy;
+ }
+- v8::MicrotasksPolicy microtasks_policy() const { return microtasks_policy_; }
++ v8::MicrotasksPolicy microtasks_policy() const override { return microtasks_policy_; }
+
+ intptr_t capacity() const { return capacity_; }
+ intptr_t size() const { return size_; }
diff --git a/electron34/patches/patch-v8_src_flags_flags.cc b/electron34/patches/patch-v8_src_flags_flags.cc
new file mode 100644
index 0000000000..6eb777cdb8
--- /dev/null
+++ b/electron34/patches/patch-v8_src_flags_flags.cc
@@ -0,0 +1,30 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/flags/flags.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/flags/flags.cc
+@@ -16,6 +16,10 @@
+ #include <set>
+ #include <sstream>
+
++#if V8_OS_OPENBSD
++#include <sys/mman.h>
++#endif
++
+ #include "src/base/functional.h"
+ #include "src/base/lazy-instance.h"
+ #include "src/base/platform/platform.h"
+@@ -816,6 +820,10 @@ void FlagList::FreezeFlags() {
+ // Note that for string flags we only protect the pointer itself, but not the
+ // string storage. TODO(12887): Fix this.
+ base::OS::SetDataReadOnly(&v8_flags, sizeof(v8_flags));
++#if V8_OS_OPENBSD
++ if (mimmutable(&v8_flags, sizeof(v8_flags)) == -1)
++ FATAL("unable to set immutability of v8_flags");
++#endif
+ }
+
+ // static
diff --git a/electron34/patches/patch-v8_src_libsampler_sampler.cc b/electron34/patches/patch-v8_src_libsampler_sampler.cc
new file mode 100644
index 0000000000..1bb4917691
--- /dev/null
+++ b/electron34/patches/patch-v8_src_libsampler_sampler.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/libsampler/sampler.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/libsampler/sampler.cc
+@@ -519,6 +519,16 @@ void SignalHandler::FillRegisterState(vo
+ state->pc = reinterpret_cast<void*>(mcontext.__gregs[_REG_PC]);
+ state->sp = reinterpret_cast<void*>(mcontext.__gregs[_REG_SP]);
+ state->fp = reinterpret_cast<void*>(mcontext.__gregs[_REG_FP]);
++#elif V8_HOST_ARCH_ARM64
++#ifdef __CHERI_PURE_CAPABILITY__
++ state->pc = reinterpret_cast<void*>(mcontext.mc_capregs.cap_elr);
++ state->sp = reinterpret_cast<void*>(mcontext.mc_capregs.cap_sp);
++ state->fp = reinterpret_cast<void*>(mcontext.mc_capregs.cap_x[29]);
++#else // !__CHERI_PURE_CAPABILITY__
++ state->pc = reinterpret_cast<void*>(mcontext.mc_gpregs.gp_elr);
++ state->sp = reinterpret_cast<void*>(mcontext.mc_gpregs.gp_sp);
++ state->fp = reinterpret_cast<void*>(mcontext.mc_gpregs.gp_x[29]);
++#endif // __CHERI_PURE_CAPABILITY__
+ #endif // V8_HOST_ARCH_*
+ #elif V8_OS_NETBSD
+ #if V8_HOST_ARCH_IA32
diff --git a/electron34/patches/patch-v8_src_maglev_maglev-graph-builder.cc b/electron34/patches/patch-v8_src_maglev_maglev-graph-builder.cc
new file mode 100644
index 0000000000..7697aa149d
--- /dev/null
+++ b/electron34/patches/patch-v8_src_maglev_maglev-graph-builder.cc
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/maglev/maglev-graph-builder.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/maglev/maglev-graph-builder.cc
+@@ -12171,7 +12171,13 @@ ValueNode* MaglevGraphBuilder::BuildInli
+ CreateHeapNumber(node->Cast<Float64Constant>()->value()),
+ allocation_type);
+ } else {
+- node = GetTaggedValue(node);
++ ValueNode* new_node = GetTaggedValue(node);
++ if (new_node != node && new_node->properties().can_allocate()) {
++ // TODO(olivf): Remove this and instead always clear when we
++ // emit an allocating instruction.
++ ClearCurrentAllocationBlock();
++ }
++ node = new_node;
+ }
+ values[i] = node;
+ }
diff --git a/electron34/patches/patch-v8_src_sandbox_sandbox.cc b/electron34/patches/patch-v8_src_sandbox_sandbox.cc
new file mode 100644
index 0000000000..116e799f0d
--- /dev/null
+++ b/electron34/patches/patch-v8_src_sandbox_sandbox.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/sandbox/sandbox.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/sandbox/sandbox.cc
+@@ -50,7 +50,7 @@ static Address DetermineAddressSpaceLimi
+ }
+ #endif // V8_TARGET_ARCH_X64
+
+-#if defined(V8_TARGET_ARCH_ARM64) && defined(V8_TARGET_OS_ANDROID)
++#if defined(V8_TARGET_ARCH_ARM64) && (defined(V8_TARGET_OS_ANDROID) || defined(V8_TARGET_OS_OPENBSD))
+ // On Arm64 Android assume a 40-bit virtual address space (39 bits for
+ // userspace and kernel each) as that appears to be the most common
+ // configuration and there seems to be no easy way to retrieve the actual
diff --git a/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc
new file mode 100644
index 0000000000..cd16c1b1ae
--- /dev/null
+++ b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/snapshot/embedded/platform-embedded-file-writer-base.cc
+@@ -148,6 +148,8 @@ EmbeddedTargetOs ToEmbeddedTargetOs(cons
+ return EmbeddedTargetOs::kStarboard;
+ } else if (string == "zos") {
+ return EmbeddedTargetOs::kZOS;
++ } else if (string == "openbsd") {
++ return EmbeddedTargetOs::kOpenBSD;
+ } else {
+ return EmbeddedTargetOs::kGeneric;
+ }
diff --git a/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h
new file mode 100644
index 0000000000..e47cbb0247
--- /dev/null
+++ b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h
@@ -0,0 +1,16 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/snapshot/embedded/platform-embedded-file-writer-base.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
+@@ -36,6 +36,7 @@ enum class EmbeddedTargetOs {
+ kWin,
+ kStarboard,
+ kZOS,
++ kOpenBSD,
+ kGeneric, // Everything not covered above falls in here.
+ };
+
diff --git a/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc
new file mode 100644
index 0000000000..4ed54ee20c
--- /dev/null
+++ b/electron34/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc
@@ -0,0 +1,48 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/snapshot/embedded/platform-embedded-file-writer-generic.cc
+@@ -9,6 +9,10 @@
+
+ #include "src/objects/instruction-stream.h"
+
++#if V8_OS_OPENBSD
++#include <sys/param.h>
++#endif
++
+ namespace v8 {
+ namespace internal {
+
+@@ -35,6 +39,10 @@ const char* DirectiveAsString(DataDirect
+ void PlatformEmbeddedFileWriterGeneric::SectionText() {
+ if (target_os_ == EmbeddedTargetOs::kChromeOS) {
+ fprintf(fp_, ".section .text.hot.embedded\n");
++#if !defined(V8_TARGET_ARCH_IA32)
++ } else if (target_os_ == EmbeddedTargetOs::kOpenBSD) {
++ fprintf(fp_, ".section .openbsd.mutable,\"a\"\n");
++#endif
+ } else {
+ fprintf(fp_, ".section .text\n");
+ }
+@@ -66,6 +74,8 @@ void PlatformEmbeddedFileWriterGeneric::
+ // On these architectures and platforms, we remap the builtins, so need these
+ // to be aligned on a page boundary.
+ fprintf(fp_, ".balign 4096\n");
++#elif defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32)
++ fprintf(fp_, ".balign %d\n", PAGE_SIZE);
+ #elif V8_TARGET_ARCH_X64
+ // On x64 use 64-bytes code alignment to allow 64-bytes loop header alignment.
+ static_assert(64 >= kCodeAlignment);
+@@ -86,6 +96,8 @@ void PlatformEmbeddedFileWriterGeneric::
+ (V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_ARM64)
+ // Since the builtins are remapped, need to pad until the next page boundary.
+ fprintf(fp_, ".balign 4096\n");
++#elif defined(V8_OS_OPENBSD) && !defined(V8_TARGET_ARCH_IA32)
++ fprintf(fp_, ".balign %d\n", PAGE_SIZE);
+ #endif
+ }
+
diff --git a/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.cc b/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.cc
new file mode 100644
index 0000000000..0f8db0f83f
--- /dev/null
+++ b/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.cc
@@ -0,0 +1,43 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/trap-handler/handler-inside-posix.cc.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/trap-handler/handler-inside-posix.cc
+@@ -27,7 +27,7 @@
+
+ #include <signal.h>
+
+-#if defined(V8_OS_LINUX) || defined(V8_OS_FREEBSD)
++#if defined(V8_OS_LINUX) || defined(V8_OS_FREEBSD) || defined(V8_OS_NETBSD)
+ #include <ucontext.h>
+ #elif V8_OS_DARWIN
+ #include <sys/ucontext.h>
+@@ -61,6 +61,10 @@ namespace trap_handler {
+ #define CONTEXT_REG(reg, REG) &uc->uc_mcontext->__ss.__##reg
+ #elif V8_OS_FREEBSD
+ #define CONTEXT_REG(reg, REG) &uc->uc_mcontext.mc_##reg
++#elif V8_OS_OPENBSD
++#define CONTEXT_REG(reg, REG) &uc->sc_##reg
++#elif V8_OS_NETBSD
++#define CONTEXT_REG(reg, REG) &uc->uc_mcontext.__gregs[_REG_##REG]
+ #else
+ #error "Unsupported platform."
+ #endif
+@@ -80,8 +84,12 @@ bool IsKernelGeneratedSignal(siginfo_t*
+ // si_code at its default of 0 for signals that don’t originate in hardware.
+ // The other conditions are only relevant for Linux.
+ return info->si_code > 0 && info->si_code != SI_USER &&
+- info->si_code != SI_QUEUE && info->si_code != SI_TIMER &&
+- info->si_code != SI_ASYNCIO && info->si_code != SI_MESGQ;
++ info->si_code != SI_QUEUE && info->si_code != SI_TIMER
++#ifdef V8_OS_OPENBSD
++ ;
++#else
++ && info->si_code != SI_ASYNCIO && info->si_code != SI_MESGQ;
++#endif
+ }
+
+ class UnmaskOobSignalScope {
diff --git a/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.h b/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.h
new file mode 100644
index 0000000000..66ed96900f
--- /dev/null
+++ b/electron34/patches/patch-v8_src_trap-handler_handler-inside-posix.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/trap-handler/handler-inside-posix.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/trap-handler/handler-inside-posix.h
+@@ -13,7 +13,7 @@ namespace v8 {
+ namespace internal {
+ namespace trap_handler {
+
+-#if V8_OS_LINUX || V8_OS_FREEBSD
++#if V8_OS_LINUX || V8_OS_FREEBSD || V8_OS_OPENBSD || V8_OS_NETBSD
+ constexpr int kOobSignal = SIGSEGV;
+ #elif V8_OS_DARWIN
+ constexpr int kOobSignal = SIGBUS;
diff --git a/electron34/patches/patch-v8_src_trap-handler_trap-handler.h b/electron34/patches/patch-v8_src_trap-handler_trap-handler.h
new file mode 100644
index 0000000000..b30b17e703
--- /dev/null
+++ b/electron34/patches/patch-v8_src_trap-handler_trap-handler.h
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/trap-handler/trap-handler.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/trap-handler/trap-handler.h
+@@ -20,7 +20,7 @@ namespace trap_handler {
+ // X64 on Linux, Windows, MacOS, FreeBSD.
+ #if V8_HOST_ARCH_X64 && V8_TARGET_ARCH_X64 && \
+ ((V8_OS_LINUX && !V8_OS_ANDROID) || V8_OS_WIN || V8_OS_DARWIN || \
+- V8_OS_FREEBSD)
++ V8_OS_FREEBSD || V8_OS_OPENBSD || V8_OS_NETBSD)
+ #define V8_TRAP_HANDLER_SUPPORTED true
+ // Arm64 (non-simulator) on Linux, Windows, MacOS.
+ #elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_ARM64 && \
diff --git a/electron34/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h b/electron34/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h
new file mode 100644
index 0000000000..ccca3d1dbe
--- /dev/null
+++ b/electron34/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h
@@ -0,0 +1,134 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/src/wasm/baseline/ia32/liftoff-assembler-ia32-inl.h.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/src/wasm/baseline/ia32/liftoff-assembler-ia32-inl.h
+@@ -579,7 +579,7 @@ void LiftoffAssembler::StoreTaggedPointe
+ }
+
+ void LiftoffAssembler::Load(LiftoffRegister dst, Register src_addr,
+- Register offset_reg, uint32_t offset_imm,
++ Register offset_reg, uintptr_t offset_imm,
+ LoadType type, uint32_t* protected_load_pc,
+ bool /* is_load_mem */, bool /* i64_offset */,
+ bool needs_shift) {
+@@ -659,7 +659,7 @@ void LiftoffAssembler::Load(LiftoffRegis
+ }
+
+ void LiftoffAssembler::Store(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister src,
++ uintptr_t offset_imm, LiftoffRegister src,
+ StoreType type, LiftoffRegList pinned,
+ uint32_t* protected_store_pc,
+ bool /* is_store_mem */, bool /* i64_offset */) {
+@@ -738,7 +738,7 @@ void LiftoffAssembler::Store(Register ds
+ }
+
+ void LiftoffAssembler::AtomicLoad(LiftoffRegister dst, Register src_addr,
+- Register offset_reg, uint32_t offset_imm,
++ Register offset_reg, uintptr_t offset_imm,
+ LoadType type, LiftoffRegList /* pinned */,
+ bool /* i64_offset */) {
+ if (type.value() != LoadType::kI64Load) {
+@@ -756,7 +756,7 @@ void LiftoffAssembler::AtomicLoad(Liftof
+ }
+
+ void LiftoffAssembler::AtomicStore(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister src,
++ uintptr_t offset_imm, LiftoffRegister src,
+ StoreType type, LiftoffRegList pinned,
+ bool /* i64_offset */) {
+ DCHECK_LE(offset_imm, std::numeric_limits<int32_t>::max());
+@@ -826,7 +826,7 @@ enum Binop { kAdd, kSub, kAnd, kOr, kXor
+
+ inline void AtomicAddOrSubOrExchange32(LiftoffAssembler* lasm, Binop binop,
+ Register dst_addr, Register offset_reg,
+- uint32_t offset_imm,
++ uintptr_t offset_imm,
+ LiftoffRegister value,
+ LiftoffRegister result, StoreType type) {
+ DCHECK_EQ(value, result);
+@@ -894,7 +894,7 @@ inline void AtomicAddOrSubOrExchange32(L
+ }
+
+ inline void AtomicBinop32(LiftoffAssembler* lasm, Binop op, Register dst_addr,
+- Register offset_reg, uint32_t offset_imm,
++ Register offset_reg, uintptr_t offset_imm,
+ LiftoffRegister value, LiftoffRegister result,
+ StoreType type) {
+ DCHECK_EQ(value, result);
+@@ -1009,7 +1009,7 @@ inline void AtomicBinop32(LiftoffAssembl
+ }
+
+ inline void AtomicBinop64(LiftoffAssembler* lasm, Binop op, Register dst_addr,
+- Register offset_reg, uint32_t offset_imm,
++ Register offset_reg, uintptr_t offset_imm,
+ LiftoffRegister value, LiftoffRegister result) {
+ // We need {ebx} here, which is the root register. As the root register it
+ // needs special treatment. As we use {ebx} directly in the code below, we
+@@ -1105,7 +1105,7 @@ inline void AtomicBinop64(LiftoffAssembl
+ } // namespace liftoff
+
+ void LiftoffAssembler::AtomicAdd(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister value,
++ uintptr_t offset_imm, LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+ if (type.value() == StoreType::kI64Store) {
+@@ -1119,7 +1119,7 @@ void LiftoffAssembler::AtomicAdd(Registe
+ }
+
+ void LiftoffAssembler::AtomicSub(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister value,
++ uintptr_t offset_imm, LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+ if (type.value() == StoreType::kI64Store) {
+@@ -1132,7 +1132,7 @@ void LiftoffAssembler::AtomicSub(Registe
+ }
+
+ void LiftoffAssembler::AtomicAnd(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister value,
++ uintptr_t offset_imm, LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+ if (type.value() == StoreType::kI64Store) {
+@@ -1146,7 +1146,7 @@ void LiftoffAssembler::AtomicAnd(Registe
+ }
+
+ void LiftoffAssembler::AtomicOr(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister value,
++ uintptr_t offset_imm, LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+ if (type.value() == StoreType::kI64Store) {
+@@ -1160,7 +1160,7 @@ void LiftoffAssembler::AtomicOr(Register
+ }
+
+ void LiftoffAssembler::AtomicXor(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm, LiftoffRegister value,
++ uintptr_t offset_imm, LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+ if (type.value() == StoreType::kI64Store) {
+@@ -1174,7 +1174,7 @@ void LiftoffAssembler::AtomicXor(Registe
+ }
+
+ void LiftoffAssembler::AtomicExchange(Register dst_addr, Register offset_reg,
+- uint32_t offset_imm,
++ uintptr_t offset_imm,
+ LiftoffRegister value,
+ LiftoffRegister result, StoreType type,
+ bool /* i64_offset */) {
+@@ -1189,7 +1189,7 @@ void LiftoffAssembler::AtomicExchange(Re
+ }
+
+ void LiftoffAssembler::AtomicCompareExchange(
+- Register dst_addr, Register offset_reg, uint32_t offset_imm,
++ Register dst_addr, Register offset_reg, uintptr_t offset_imm,
+ LiftoffRegister expected, LiftoffRegister new_value, LiftoffRegister result,
+ StoreType type, bool /* i64_offset */) {
+ // We expect that the offset has already been added to {dst_addr}, and no
diff --git a/electron34/patches/patch-v8_tools_run-paxctl.py b/electron34/patches/patch-v8_tools_run-paxctl.py
new file mode 100644
index 0000000000..736168d64b
--- /dev/null
+++ b/electron34/patches/patch-v8_tools_run-paxctl.py
@@ -0,0 +1,25 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/tools/run-paxctl.py.orig 2025-05-24 17:57:53.772207672 +0000
++++ v8/tools/run-paxctl.py
+@@ -0,0 +1,16 @@
++#!@PYTHONBIN@
++# Copyright 2014 the V8 project authors. All rights reserved.
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++"""This program wraps an arbitrary command since gn currently can only execute
++scripts."""
++
++import subprocess
++import sys
++import os
++
++with open(sys.argv[1], 'w'):
++ os.utime(sys.argv[1], None)
++
++sys.exit(subprocess.call(sys.argv[2:]))
diff --git a/electron34/patches/patch-v8_tools_run.py b/electron34/patches/patch-v8_tools_run.py
new file mode 100644
index 0000000000..26ee443f3a
--- /dev/null
+++ b/electron34/patches/patch-v8_tools_run.py
@@ -0,0 +1,17 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/tools/run.py.orig 2025-02-24 19:59:26.000000000 +0000
++++ v8/tools/run.py
+@@ -21,7 +21,7 @@ if cmd and cmd[0] == '--redirect-stdout'
+ kwargs = dict(stdout=subprocess.PIPE)
+ cmd = cmd[2:]
+
+-process = subprocess.Popen(cmd, **kwargs)
++process = subprocess.Popen(cmd, env={"LD_LIBRARY_PATH":"@WRKSRC@/out/Release"}, **kwargs)
+ stdout, _ = process.communicate()
+ if stdout_file:
+ with stdout_file.open('w') as f:
diff --git a/electron34/platform.mk b/electron34/platform.mk
new file mode 100644
index 0000000000..8c198d8f8b
--- /dev/null
+++ b/electron34/platform.mk
@@ -0,0 +1,118 @@
+# $NetBSD$
+#
+# NODE_GYP
+# Absolute path for node-gyp.
+#
+
+ELECTRON_VER= 34.5.6
+ELECTRON_MAJOR= ${ELECTRON_VER:tu:C/\\.[[:digit:]\.]*//}
+NODE_VERSION_DEFAULT= 20
+ELECTRON= electron${ELECTRON_MAJOR}
+
+# Package-settable variable
+# Values:
+# - "bundled" if the package bundles electron libraries
+# - "dependency" if the package uses electron as dependency
+USE_ELECTRON?= electronpkg
+
+.include "../../mk/bsd.prefs.mk"
+
+PACKAGE_NAME= ${PKGPATH:C/.*\///}
+
+.if !empty(USE_ELECTRON:Melectronpkg) && empty(PACKAGE_NAME:M${ELECTRON})
+PKG_FAIL_REASON+= "USE_ELECTRON is not defined for ${PKGPATH}."
+PKG_FAIL_REASON+= "Should be \"bundled\" or \"dependency\"."
+.elif !empty(PACKAGE_NAME:M${ELECTRON}) && empty(USE_ELECTRON:Melectronpkg)
+PKG_FAIL_REASON+= "USE_ELECTRON is defined for ${PKGPATH} package."
+.endif
+
+TOOL_DEPENDS+= nodejs-${NODE_VERSION_DEFAULT}.*:../../lang/nodejs${NODE_VERSION_DEFAULT}
+.if ${USE_ELECTRON} == "dependency"
+DEPENDS+= ${ELECTRON}>=${ELECTRON_VER}:../../wip/${ELECTRON}
+.elif ${USE_ELECTRON} == "bundled"
+TOOL_DEPENDS+= ${ELECTRON}>=${ELECTRON_VER}:../../wip/${ELECTRON}
+.endif
+
+.for c_arch in x86_64 aarch64
+ONLY_FOR_PLATFORM+= NetBSD-1[0-9].*-${c_arch}
+ONLY_FOR_PLATFORM+= Linux-*-${c_arch}
+ONLY_FOR_PLATFORM+= Darwin-*-${c_arch}
+ONLY_FOR_PLATFORM+= FreeBSD-*-${c_arch}
+.endfor
+
+ELECTRONBIN= ${PREFIX}/lib/${ELECTRON}/electron
+NODE_GYP= ${PREFIX}/lib/node_modules/npm/bin/node-gyp-bin/node-gyp
+
+FILES_SUBST+= ELECTRON=${ELECTRON}
+FILES_SUBST+= ELECTRONBIN=${ELECTRONBIN}
+PLIST_SUBST+= ELECTRON_MAJOR=${ELECTRON_MAJOR}
+
+.if ${USE_ELECTRON} == "bundled" || ${USE_ELECTRON} == "electronpkg"
+
+PLIST_VARS+= swiftshader
+. if ${MACHINE_ARCH} == "x86_64"
+PLIST.swiftshader= yes
+. endif
+
+.include "../../archivers/bzip2/buildlink3.mk"
+.include "../../audio/libopus/buildlink3.mk"
+.include "../../audio/speech-dispatcher/buildlink3.mk"
+.include "../../audio/speex/buildlink3.mk"
+.include "../../devel/dconf/buildlink3.mk"
+.include "../../devel/libatomic/buildlink3.mk"
+.include "../../devel/libepoll-shim/buildlink3.mk"
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../devel/libusb1/buildlink3.mk"
+.include "../../devel/nspr/buildlink3.mk"
+.include "../../devel/nss/buildlink3.mk"
+.include "../../fonts/fontconfig/buildlink3.mk"
+.include "../../fonts/harfbuzz/buildlink3.mk"
+.include "../../graphics/cairo/buildlink3.mk"
+.include "../../graphics/freetype2/buildlink3.mk"
+.include "../../graphics/hicolor-icon-theme/buildlink3.mk"
+.include "../../graphics/libexif/buildlink3.mk"
+.include "../../graphics/libwebp/buildlink3.mk"
+.include "../../graphics/png/buildlink3.mk"
+.include "../../lang/compiler-rt/buildlink3.mk"
+.include "../../lang/python/tool.mk"
+.include "../../lang/rust/rust.mk"
+.include "../../misc/usbids/buildlink3.mk"
+.include "../../mk/jpeg.buildlink3.mk" # libjpeg-turbo
+.include "../../multimedia/dav1d/buildlink3.mk"
+.include "../../multimedia/libaom/buildlink3.mk"
+.include "../../multimedia/libvpx/buildlink3.mk"
+.include "../../multimedia/openh264/buildlink3.mk"
+.include "../../net/libcares/buildlink3.mk"
+.include "../../print/libcups/buildlink3.mk"
+.include "../../security/libgnome-keyring/buildlink3.mk"
+.include "../../security/libsecret/buildlink3.mk"
+.include "../../security/libgcrypt/buildlink3.mk"
+.include "../../sysutils/dbus/buildlink3.mk"
+.include "../../sysutils/dbus-glib/buildlink3.mk"
+.include "../../sysutils/libnotify/buildlink3.mk"
+.include "../../sysutils/pciutils/buildlink3.mk"
+# Use -lpciutils instead of -lpci for pkgsrc.
+BUILDLINK_TRANSFORM+= l:pci:pciutils
+.include "../../textproc/expat/buildlink3.mk"
+.include "../../textproc/icu/buildlink3.mk"
+.include "../../textproc/jsoncpp/buildlink3.mk"
+.include "../../textproc/libxml2/buildlink3.mk"
+.include "../../textproc/libxslt/buildlink3.mk"
+.include "../../www/nghttp2/buildlink3.mk"
+.include "../../x11/gtk3/buildlink3.mk"
+.include "../../x11/xorgproto/buildlink3.mk"
+.include "../../x11/libdrm/buildlink3.mk"
+.include "../../x11/libX11/buildlink3.mk"
+.include "../../x11/libxcb/buildlink3.mk"
+.include "../../x11/libXcomposite/buildlink3.mk"
+.include "../../x11/libXcursor/buildlink3.mk"
+.include "../../x11/libXdamage/buildlink3.mk"
+.include "../../x11/libXext/buildlink3.mk"
+.include "../../x11/libXfixes/buildlink3.mk"
+.include "../../x11/libXi/buildlink3.mk"
+.include "../../x11/libXrandr/buildlink3.mk"
+.include "../../x11/libXrender/buildlink3.mk"
+.include "../../x11/libXScrnSaver/buildlink3.mk"
+.include "../../x11/libXtst/buildlink3.mk"
+.include "../../x11/qt6-qtbase/buildlink3.mk"
+.endif
Home |
Main Index |
Thread Index |
Old Index