pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
electron32: import package
Module Name: pkgsrc-wip
Committed By: kikadf <kikadf.01%gmail.com@localhost>
Pushed By: kikadf
Date: Mon Jan 6 14:01:42 2025 +0100
Changeset: 4d8192863ea7ec1c150f6d8b256df5004af35355
Modified Files:
Makefile
Added Files:
electron32/DESCR
electron32/Makefile
electron32/PLIST
electron32/TODO
electron32/distinfo
electron32/options.mk
electron32/patches/patch-.gitignore
electron32/patches/patch-.gn
electron32/patches/patch-BUILD.gn
electron32/patches/patch-apps_ui_views_app__window__frame__view.cc
electron32/patches/patch-ash_display_mirror__window__controller.cc
electron32/patches/patch-base_BUILD.gn
electron32/patches/patch-base_allocator_dispatcher_tls.h
electron32/patches/patch-base_allocator_partition__allocator_partition__alloc.gni
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_oom.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
electron32/patches/patch-base_atomicops.h
electron32/patches/patch-base_base__paths__posix.cc
electron32/patches/patch-base_compiler__specific.h
electron32/patches/patch-base_debug_debugger__posix.cc
electron32/patches/patch-base_debug_elf__reader.cc
electron32/patches/patch-base_debug_proc__maps__linux.cc
electron32/patches/patch-base_debug_stack__trace.cc
electron32/patches/patch-base_debug_stack__trace__posix.cc
electron32/patches/patch-base_enterprise__util__mac.mm
electron32/patches/patch-base_features.cc
electron32/patches/patch-base_files_dir__reader__linux.h
electron32/patches/patch-base_files_dir__reader__posix.h
electron32/patches/patch-base_files_file__path__watcher.h
electron32/patches/patch-base_files_file__path__watcher__bsd.cc
electron32/patches/patch-base_files_file__path__watcher__kqueue.cc
electron32/patches/patch-base_files_file__path__watcher__kqueue.h
electron32/patches/patch-base_files_file__path__watcher__unittest.cc
electron32/patches/patch-base_files_file__util__posix.cc
electron32/patches/patch-base_files_file__util__unittest.cc
electron32/patches/patch-base_files_important__file__writer__cleaner.cc
electron32/patches/patch-base_files_scoped__file.cc
electron32/patches/patch-base_functional_callback__helpers.h
electron32/patches/patch-base_functional_unretained__traits.h
electron32/patches/patch-base_i18n_icu__util.cc
electron32/patches/patch-base_linux__util.cc
electron32/patches/patch-base_logging__unittest.cc
electron32/patches/patch-base_memory_discardable__memory.cc
electron32/patches/patch-base_memory_discardable__memory__internal.h
electron32/patches/patch-base_memory_madv__free__discardable__memory__posix.cc
electron32/patches/patch-base_memory_platform__shared__memory__region.h
electron32/patches/patch-base_memory_platform__shared__memory__region__posix.cc
electron32/patches/patch-base_message__loop_message__pump__glib.cc
electron32/patches/patch-base_native__library__posix.cc
electron32/patches/patch-base_native__library__unittest.cc
electron32/patches/patch-base_posix_can__lower__nice__to.cc
electron32/patches/patch-base_posix_sysctl.cc
electron32/patches/patch-base_posix_unix__domain__socket.cc
electron32/patches/patch-base_posix_unix__domain__socket__unittest.cc
electron32/patches/patch-base_process_internal__linux.h
electron32/patches/patch-base_process_kill.h
electron32/patches/patch-base_process_kill__posix.cc
electron32/patches/patch-base_process_launch.h
electron32/patches/patch-base_process_launch__mac.cc
electron32/patches/patch-base_process_launch__posix.cc
electron32/patches/patch-base_process_memory__linux.cc
electron32/patches/patch-base_process_process__handle.cc
electron32/patches/patch-base_process_process__handle.h
electron32/patches/patch-base_process_process__handle__freebsd.cc
electron32/patches/patch-base_process_process__handle__netbsd.cc
electron32/patches/patch-base_process_process__handle__openbsd.cc
electron32/patches/patch-base_process_process__info__mac.cc
electron32/patches/patch-base_process_process__iterator.h
electron32/patches/patch-base_process_process__iterator__freebsd.cc
electron32/patches/patch-base_process_process__iterator__netbsd.cc
electron32/patches/patch-base_process_process__iterator__openbsd.cc
electron32/patches/patch-base_process_process__metrics.cc
electron32/patches/patch-base_process_process__metrics.h
electron32/patches/patch-base_process_process__metrics__freebsd.cc
electron32/patches/patch-base_process_process__metrics__netbsd.cc
electron32/patches/patch-base_process_process__metrics__openbsd.cc
electron32/patches/patch-base_process_process__metrics__posix.cc
electron32/patches/patch-base_process_process__metrics__unittest.cc
electron32/patches/patch-base_process_process__posix.cc
electron32/patches/patch-base_process_process__unittest.cc
electron32/patches/patch-base_profiler_module__cache.cc
electron32/patches/patch-base_profiler_sampling__profiler__thread__token.cc
electron32/patches/patch-base_profiler_sampling__profiler__thread__token.h
electron32/patches/patch-base_profiler_stack__base__address__posix.cc
electron32/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc
electron32/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc
electron32/patches/patch-base_profiler_thread__delegate__posix.cc
electron32/patches/patch-base_rand__util.h
electron32/patches/patch-base_rand__util__posix.cc
electron32/patches/patch-base_strings_safe__sprintf__unittest.cc
electron32/patches/patch-base_synchronization_lock__impl.h
electron32/patches/patch-base_syslog__logging.cc
electron32/patches/patch-base_system_sys__info.cc
electron32/patches/patch-base_system_sys__info.h
electron32/patches/patch-base_system_sys__info__freebsd.cc
electron32/patches/patch-base_system_sys__info__netbsd.cc
electron32/patches/patch-base_system_sys__info__openbsd.cc
electron32/patches/patch-base_system_sys__info__posix.cc
electron32/patches/patch-base_system_sys__info__unittest.cc
electron32/patches/patch-base_task_thread__pool_environment__config__unittest.cc
electron32/patches/patch-base_test_launcher_test__launcher.cc
electron32/patches/patch-base_test_test__file__util__linux.cc
electron32/patches/patch-base_test_test__file__util__posix.cc
electron32/patches/patch-base_threading_hang__watcher.cc
electron32/patches/patch-base_threading_platform__thread.h
electron32/patches/patch-base_threading_platform__thread__bsd.cc
electron32/patches/patch-base_threading_platform__thread__internal__posix.cc
electron32/patches/patch-base_threading_platform__thread__posix.cc
electron32/patches/patch-base_threading_platform__thread__unittest.cc
electron32/patches/patch-base_threading_thread__restrictions.h
electron32/patches/patch-base_trace__event_builtin__categories.h
electron32/patches/patch-base_trace__event_malloc__dump__provider.cc
electron32/patches/patch-base_trace__event_memory__dump__manager.cc
electron32/patches/patch-base_trace__event_process__memory__dump.cc
electron32/patches/patch-base_tracing_trace__time.cc
electron32/patches/patch-base_tracing_trace__time.h
electron32/patches/patch-base_version__info_version__info.h
electron32/patches/patch-build_config_BUILD.gn
electron32/patches/patch-build_config_BUILDCONFIG.gn
electron32/patches/patch-build_config_clang_BUILD.gn
electron32/patches/patch-build_config_compiler_BUILD.gn
electron32/patches/patch-build_config_linux_BUILD.gn
electron32/patches/patch-build_config_linux_atk_BUILD.gn
electron32/patches/patch-build_config_linux_atspi2_BUILD.gn
electron32/patches/patch-build_config_linux_gtk_BUILD.gn
electron32/patches/patch-build_config_linux_pkg-config.py
electron32/patches/patch-build_config_ozone.gni
electron32/patches/patch-build_config_rust.gni
electron32/patches/patch-build_config_v8__target__cpu.gni
electron32/patches/patch-build_detect__host__arch.py
electron32/patches/patch-build_gn__run__binary.py
electron32/patches/patch-build_linux_chrome.map
electron32/patches/patch-build_linux_strip__binary.py
electron32/patches/patch-build_linux_unbundle_icu.gn
electron32/patches/patch-build_linux_unbundle_libevent.gn
electron32/patches/patch-build_linux_unbundle_libusb.gn
electron32/patches/patch-build_rust_rust__bindgen.gni
electron32/patches/patch-build_rust_std_BUILD.gn
electron32/patches/patch-build_toolchain_freebsd_BUILD.gn
electron32/patches/patch-build_toolchain_gcc__solink__wrapper.py
electron32/patches/patch-build_toolchain_gcc__toolchain.gni
electron32/patches/patch-build_toolchain_netbsd_BUILD.gn
electron32/patches/patch-build_toolchain_openbsd_BUILD.gn
electron32/patches/patch-build_toolchain_toolchain.gni
electron32/patches/patch-build_toolchain_win_rc_rc.py
electron32/patches/patch-buildtools_reclient__cfgs_.gitignore
electron32/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py
electron32/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg
electron32/patches/patch-buildtools_third__party_libc++_BUILD.gn
electron32/patches/patch-buildtools_third__party_libc++_____config__site
electron32/patches/patch-buildtools_third__party_libc++abi_BUILD.gn
electron32/patches/patch-cc_BUILD.gn
electron32/patches/patch-cc_base_features.cc
electron32/patches/patch-chrome_BUILD.gn
electron32/patches/patch-chrome_app_chrome__command__ids.h
electron32/patches/patch-chrome_app_chrome__main.cc
electron32/patches/patch-chrome_app_chrome__main__delegate.cc
electron32/patches/patch-chrome_browser_BUILD.gn
electron32/patches/patch-chrome_browser_about__flags.cc
electron32/patches/patch-chrome_browser_accessibility_page__colors.cc
electron32/patches/patch-chrome_browser_after__startup__task__utils.cc
electron32/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
electron32/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
electron32/patches/patch-chrome_browser_background_background__mode__manager.cc
electron32/patches/patch-chrome_browser_background_background__mode__optimizer.cc
electron32/patches/patch-chrome_browser_browser__features.cc
electron32/patches/patch-chrome_browser_browser__process__impl.cc
electron32/patches/patch-chrome_browser_browser__process__impl.h
electron32/patches/patch-chrome_browser_chrome__browser__field__trials.cc
electron32/patches/patch-chrome_browser_chrome__browser__field__trials.h
electron32/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
electron32/patches/patch-chrome_browser_chrome__browser__main.cc
electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
electron32/patches/patch-chrome_browser_chrome__browser__main__linux.cc
electron32/patches/patch-chrome_browser_chrome__browser__main__linux.h
electron32/patches/patch-chrome_browser_chrome__browser__main__posix.cc
electron32/patches/patch-chrome_browser_chrome__content__browser__client.cc
electron32/patches/patch-chrome_browser_chrome__content__browser__client.h
electron32/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
electron32/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
electron32/patches/patch-chrome_browser_defaults.cc
electron32/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
electron32/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h
electron32/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc
electron32/patches/patch-chrome_browser_download_download__commands.cc
electron32/patches/patch-chrome_browser_download_download__commands.h
electron32/patches/patch-chrome_browser_download_download__file__picker.cc
electron32/patches/patch-chrome_browser_download_download__item__model.cc
electron32/patches/patch-chrome_browser_download_download__prefs.cc
electron32/patches/patch-chrome_browser_download_download__prefs.h
electron32/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
electron32/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
electron32/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
electron32/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
electron32/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h
electron32/patches/patch-chrome_browser_extensions_BUILD.gn
electron32/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
electron32/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
electron32/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
electron32/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc
electron32/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
electron32/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
electron32/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
electron32/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
electron32/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
electron32/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
electron32/patches/patch-chrome_browser_extensions_external__provider__impl.cc
electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc
electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.h
electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc
electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h
electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc
electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc
electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
electron32/patches/patch-chrome_browser_first__run_first__run__dialog.h
electron32/patches/patch-chrome_browser_first__run_first__run__internal.h
electron32/patches/patch-chrome_browser_flag__descriptions.cc
electron32/patches/patch-chrome_browser_flag__descriptions.h
electron32/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
electron32/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
electron32/patches/patch-chrome_browser_global__desktop__features.cc
electron32/patches/patch-chrome_browser_global__desktop__features.h
electron32/patches/patch-chrome_browser_headless_headless__mode__util.cc
electron32/patches/patch-chrome_browser_intranet__redirect__detector.h
electron32/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
electron32/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc
electron32/patches/patch-chrome_browser_media_audio__service__util.cc
electron32/patches/patch-chrome_browser_media_offscreen__tab.cc
electron32/patches/patch-chrome_browser_media_offscreen__tab.h
electron32/patches/patch-chrome_browser_media_router_discovery_BUILD.gn
electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h
electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc
electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h
electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc
electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h
electron32/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc
electron32/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
electron32/patches/patch-chrome_browser_memory__details.cc
electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
electron32/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
electron32/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc
electron32/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
electron32/patches/patch-chrome_browser_metrics_power_process__monitor.cc
electron32/patches/patch-chrome_browser_metrics_power_process__monitor.h
electron32/patches/patch-chrome_browser_net_profile__network__context__service.cc
electron32/patches/patch-chrome_browser_net_proxy__config__monitor.cc
electron32/patches/patch-chrome_browser_net_proxy__config__monitor.h
electron32/patches/patch-chrome_browser_net_system__network__context__manager.cc
electron32/patches/patch-chrome_browser_net_system__network__context__manager.h
electron32/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
electron32/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
electron32/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc
electron32/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc
electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h
electron32/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
electron32/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
electron32/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc
electron32/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc
electron32/patches/patch-chrome_browser_platform__util__linux.cc
electron32/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc
electron32/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc
electron32/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
electron32/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
electron32/patches/patch-chrome_browser_policy_device__management__service__configuration.cc
electron32/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
electron32/patches/patch-chrome_browser_predictors_preconnect__manager.cc
electron32/patches/patch-chrome_browser_predictors_preconnect__manager.h
electron32/patches/patch-chrome_browser_prefs_browser__prefs.cc
electron32/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
electron32/patches/patch-chrome_browser_printing_print__backend__service__manager.cc
electron32/patches/patch-chrome_browser_printing_print__job.cc
electron32/patches/patch-chrome_browser_printing_print__view__manager__base.cc
electron32/patches/patch-chrome_browser_printing_print__view__manager__base.h
electron32/patches/patch-chrome_browser_printing_printer__query.cc
electron32/patches/patch-chrome_browser_process__singleton.h
electron32/patches/patch-chrome_browser_process__singleton__posix.cc
electron32/patches/patch-chrome_browser_process__singleton__win.cc
electron32/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
electron32/patches/patch-chrome_browser_profiles_profile__impl.cc
electron32/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc
electron32/patches/patch-chrome_browser_profiles_profile__selections.cc
electron32/patches/patch-chrome_browser_profiles_profiles__state.cc
electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.cc
electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.h
electron32/patches/patch-chrome_browser_renderer__preferences__util.cc
electron32/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
electron32/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
electron32/patches/patch-chrome_browser_resources_signin_signin__shared.css
electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_deep__scanning__utils.cc
electron32/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
electron32/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
electron32/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
electron32/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
electron32/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
electron32/patches/patch-chrome_browser_sessions_session__restore.cc
electron32/patches/patch-chrome_browser_sharing_sharing__device__registration.cc
electron32/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
electron32/patches/patch-chrome_browser_shortcuts_icon__badging.cc
electron32/patches/patch-chrome_browser_signin_signin__util.cc
electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc
electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h
electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc
electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.h
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc
electron32/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
electron32/patches/patch-chrome_browser_sync_chrome__sync__client.cc
electron32/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc
electron32/patches/patch-chrome_browser_sync_sync__service__factory.cc
electron32/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc
electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.cc
electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.h
electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
electron32/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
electron32/patches/patch-chrome_browser_task__manager_task__manager__observer.h
electron32/patches/patch-chrome_browser_themes_theme__helper.cc
electron32/patches/patch-chrome_browser_themes_theme__service.cc
electron32/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc
electron32/patches/patch-chrome_browser_themes_theme__service__factory.cc
electron32/patches/patch-chrome_browser_ui_actions_chrome__action__id.h
electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.cc
electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.h
electron32/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc
electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
electron32/patches/patch-chrome_browser_ui_browser.cc
electron32/patches/patch-chrome_browser_ui_browser.h
electron32/patches/patch-chrome_browser_ui_browser__command__controller.cc
electron32/patches/patch-chrome_browser_ui_browser__commands.cc
electron32/patches/patch-chrome_browser_ui_browser__ui__prefs.cc
electron32/patches/patch-chrome_browser_ui_browser__view__prefs.cc
electron32/patches/patch-chrome_browser_ui_chrome__pages.cc
electron32/patches/patch-chrome_browser_ui_chrome__pages.h
electron32/patches/patch-chrome_browser_ui_color_BUILD.gn
electron32/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc
electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h
electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc
electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h
electron32/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
electron32/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
electron32/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
electron32/patches/patch-chrome_browser_ui_sad__tab.cc
electron32/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc
electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
electron32/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc
electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
electron32/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc
electron32/patches/patch-chrome_browser_ui_tab__helpers.cc
electron32/patches/patch-chrome_browser_ui_tabs_features.cc
electron32/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc
electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.cc
electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
electron32/patches/patch-chrome_browser_ui_test_popup__browsertest.cc
electron32/patches/patch-chrome_browser_ui_test_test__browser__ui.cc
electron32/patches/patch-chrome_browser_ui_ui__features.cc
electron32/patches/patch-chrome_browser_ui_ui__features.h
electron32/patches/patch-chrome_browser_ui_views_accelerator__table.cc
electron32/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
electron32/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h
electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
electron32/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.h
electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
electron32/patches/patch-chrome_browser_ui_views_frame_browser__view.cc
electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
electron32/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
electron32/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc
electron32/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc
electron32/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
electron32/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc
electron32/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc
electron32/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
electron32/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc
electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
electron32/patches/patch-chrome_browser_ui_views_tabs_tab.cc
electron32/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
electron32/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
electron32/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
electron32/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
electron32/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
electron32/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
electron32/patches/patch-chrome_browser_ui_webui_about_about__ui.cc
electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc
electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h
electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h
electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc
electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h
electron32/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
electron32/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
electron32/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc
electron32/patches/patch-chrome_browser_ui_webui_management_management__ui.cc
electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h
electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h
electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
electron32/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
electron32/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
electron32/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc
electron32/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc
electron32/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
electron32/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc
electron32/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc
electron32/patches/patch-chrome_browser_web__applications_extension__status__utils.h
electron32/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc
electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
electron32/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
electron32/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
electron32/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
electron32/patches/patch-chrome_browser_web__applications_web__app__helpers.cc
electron32/patches/patch-chrome_browser_web__applications_web__app__install__info.h
electron32/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
electron32/patches/patch-chrome_browser_webauthn_enclave__manager.cc
electron32/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc
electron32/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc
electron32/patches/patch-chrome_browser_win_chrome__process__finder.cc
electron32/patches/patch-chrome_browser_win_chrome__process__finder.h
electron32/patches/patch-chrome_browser_win_titlebar__config.cc
electron32/patches/patch-chrome_common_channel__info.h
electron32/patches/patch-chrome_common_channel__info__posix.cc
electron32/patches/patch-chrome_common_chrome__features.cc
electron32/patches/patch-chrome_common_chrome__features.h
electron32/patches/patch-chrome_common_chrome__paths.cc
electron32/patches/patch-chrome_common_chrome__paths.h
electron32/patches/patch-chrome_common_chrome__paths__internal.h
electron32/patches/patch-chrome_common_chrome__switches.cc
electron32/patches/patch-chrome_common_chrome__switches.h
electron32/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
electron32/patches/patch-chrome_common_media_cdm__host__file__path.cc
electron32/patches/patch-chrome_common_media_cdm__registration.cc
electron32/patches/patch-chrome_common_media_cdm__registration.h
electron32/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
electron32/patches/patch-chrome_common_pref__names.h
electron32/patches/patch-chrome_common_url__constants.h
electron32/patches/patch-chrome_common_webui__url__constants.cc
electron32/patches/patch-chrome_common_webui__url__constants.h
electron32/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc
electron32/patches/patch-chrome_enterprise__companion_lock.cc
electron32/patches/patch-chrome_renderer_pepper_chrome__renderer__pepper__host__factory.cc
electron32/patches/patch-chrome_renderer_pepper_pepper__helper.h
electron32/patches/patch-chrome_services_printing_print__backend__service__impl.cc
electron32/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc
electron32/patches/patch-chrome_test_BUILD.gn
electron32/patches/patch-chrome_test_base_scoped__channel__override__posix.cc
electron32/patches/patch-chrome_test_chromedriver_chrome__launcher.cc
electron32/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
electron32/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc
electron32/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
electron32/patches/patch-chrome_updater_configurator.cc
electron32/patches/patch-chrome_updater_lock.cc
electron32/patches/patch-chrome_updater_util_posix__util.cc
electron32/patches/patch-chrome_utility_services.cc
electron32/patches/patch-chromecast_browser_cast__browser__main__parts.cc
electron32/patches/patch-chromecast_browser_cast__content__browser__client.cc
electron32/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
electron32/patches/patch-chromecast_media_base_default__monotonic__clock.cc
electron32/patches/patch-components_autofill_core_browser_payments__data__manager.cc
electron32/patches/patch-components_autofill_core_common_autofill__features.cc
electron32/patches/patch-components_autofill_core_common_autofill__payments__features.cc
electron32/patches/patch-components_autofill_core_common_autofill__payments__features.h
electron32/patches/patch-components_commerce_core_commerce__feature__list.cc
electron32/patches/patch-components_constrained__window_constrained__window__views.cc
electron32/patches/patch-components_content__settings_core_browser_website__settings__registry.cc
electron32/patches/patch-components_cookie__config_cookie__store__util.cc
electron32/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py
electron32/patches/patch-components_crash_core_app_BUILD.gn
electron32/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc
electron32/patches/patch-components_crash_core_app_crash__reporter__client.cc
electron32/patches/patch-components_crash_core_app_crash__reporter__client.h
electron32/patches/patch-components_crash_core_app_crashpad__handler__main.cc
electron32/patches/patch-components_crash_core_app_crashpad__linux.cc
electron32/patches/patch-components_crash_core_app_crashpad__mac.mm
electron32/patches/patch-components_crash_core_app_crashpad__win.cc
electron32/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
electron32/patches/patch-components_crash_core_common_BUILD.gn
electron32/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h
electron32/patches/patch-components_device__signals_core_browser_signals__aggregator.h
electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h
electron32/patches/patch-components_device__signals_core_browser_user__permission__service.h
electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc
electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h
electron32/patches/patch-components_device__signals_core_common_signals__features.cc
electron32/patches/patch-components_device__signals_core_common_signals__features.h
electron32/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc
electron32/patches/patch-components_device__signals_test_signals__contract.cc
electron32/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc
electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h
electron32/patches/patch-components_embedder__support_user__agent__utils.cc
electron32/patches/patch-components_embedder__support_user__agent__utils__unittest.cc
electron32/patches/patch-components_enterprise_watermarking_watermark.cc
electron32/patches/patch-components_eye__dropper_eye__dropper__view.cc
electron32/patches/patch-components_feature__engagement_public_event__constants.cc
electron32/patches/patch-components_feature__engagement_public_event__constants.h
electron32/patches/patch-components_feature__engagement_public_feature__configurations.cc
electron32/patches/patch-components_feature__engagement_public_feature__constants.cc
electron32/patches/patch-components_feature__engagement_public_feature__constants.h
electron32/patches/patch-components_feature__engagement_public_feature__list.cc
electron32/patches/patch-components_feature__engagement_public_feature__list.h
electron32/patches/patch-components_feed_core_proto_v2_wire_version.proto
electron32/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc
electron32/patches/patch-components_feed_core_v2_proto__util.cc
electron32/patches/patch-components_feed_core_v2_proto__util__unittest.cc
electron32/patches/patch-components_feed_core_v2_test_proto__printer.cc
electron32/patches/patch-components_flags__ui_flags__state.cc
electron32/patches/patch-components_gwp__asan_BUILD.gn
electron32/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
electron32/patches/patch-components_gwp__asan_client_gwp__asan.cc
electron32/patches/patch-components_gwp__asan_client_gwp__asan__features.cc
electron32/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
electron32/patches/patch-components_live__caption_caption__util.cc
electron32/patches/patch-components_live__caption_caption__util.h
electron32/patches/patch-components_media__router_common_media__source.cc
electron32/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
electron32/patches/patch-components_metrics_drive__metrics__provider__linux.cc
electron32/patches/patch-components_metrics_metrics__log.cc
electron32/patches/patch-components_metrics_motherboard.cc
electron32/patches/patch-components_named__mojo__ipc__server_connection__info.h
electron32/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
electron32/patches/patch-components_named__system__lock_lock.h
electron32/patches/patch-components_neterror_resources_neterror.js
electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator.cc
electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc
electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc
electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h
electron32/patches/patch-components_optimization__guide_core_optimization__guide__util.cc
electron32/patches/patch-components_os__crypt_sync_BUILD.gn
electron32/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
electron32/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc
electron32/patches/patch-components_os__crypt_sync_os__crypt.h
electron32/patches/patch-components_paint__preview_browser_paint__preview__client.cc
electron32/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
electron32/patches/patch-components_paint__preview_common_proto_paint__preview.proto
electron32/patches/patch-components_paint__preview_player_player__compositor__delegate.cc
electron32/patches/patch-components_password__manager_core_browser_features_password__features.cc
electron32/patches/patch-components_password__manager_core_browser_features_password__features.h
electron32/patches/patch-components_password__manager_core_browser_password__form__manager.cc
electron32/patches/patch-components_password__manager_core_browser_password__manager.cc
electron32/patches/patch-components_password__manager_core_browser_password__manager__client.h
electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.cc
electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.h
electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
electron32/patches/patch-components_password__manager_core_browser_password__store_login__database.cc
electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
electron32/patches/patch-components_password__manager_core_browser_password__store_password__store__built__in__backend.cc
electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc
electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h
electron32/patches/patch-components_password__manager_core_common_password__manager__pref__names.h
electron32/patches/patch-components_performance__manager_public_features.h
electron32/patches/patch-components_permissions_prediction__service_prediction__common.cc
electron32/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc
electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc
electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc
electron32/patches/patch-components_policy_core_common_policy__loader__common.cc
electron32/patches/patch-components_policy_core_common_policy__paths.cc
electron32/patches/patch-components_policy_core_common_policy__utils.cc
electron32/patches/patch-components_policy_tools_generate__policy__source.py
electron32/patches/patch-components_power__metrics_BUILD.gn
electron32/patches/patch-components_power__metrics_energy__metrics__provider.cc
electron32/patches/patch-components_printing_browser_print__manager.cc
electron32/patches/patch-components_printing_browser_print__manager.h
electron32/patches/patch-components_printing_common_print.mojom
electron32/patches/patch-components_printing_renderer_print__render__frame__helper.cc
electron32/patches/patch-components_printing_renderer_print__render__frame__helper.h
electron32/patches/patch-components_remote__cocoa_app__shim_BUILD.gn
electron32/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
electron32/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm
electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h
electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
electron32/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
electron32/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
electron32/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
electron32/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
electron32/patches/patch-components_safe__browsing_core_common_features.cc
electron32/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
electron32/patches/patch-components_search__engines_template__url__service.cc
electron32/patches/patch-components_security__interstitials_content_utils.cc
electron32/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
electron32/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
electron32/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc
electron32/patches/patch-components_soda_soda__util.cc
electron32/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc
electron32/patches/patch-components_storage__monitor_BUILD.gn
electron32/patches/patch-components_storage__monitor_removable__device__constants.cc
electron32/patches/patch-components_storage__monitor_removable__device__constants.h
electron32/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc
electron32/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
electron32/patches/patch-components_supervised__user_core_browser_supervised__user__service.cc
electron32/patches/patch-components_supervised__user_core_common_features.cc
electron32/patches/patch-components_supervised__user_core_common_features.h
electron32/patches/patch-components_supervised__user_core_common_pref__names.h
electron32/patches/patch-components_sync__device__info_local__device__info__util.cc
electron32/patches/patch-components_sync__device__info_local__device__info__util__linux.cc
electron32/patches/patch-components_sync_base_sync__util.cc
electron32/patches/patch-components_system__cpu_cpu__probe.cc
electron32/patches/patch-components_translate_core_common_translate__util.cc
electron32/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc
electron32/patches/patch-components_update__client_update__query__params.cc
electron32/patches/patch-components_upload__list_upload__list.cc
electron32/patches/patch-components_upload__list_upload__list.h
electron32/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
electron32/patches/patch-components_user__education_views_help__bubble__view.cc
electron32/patches/patch-components_variations_service_variations__service.cc
electron32/patches/patch-components_visited__url__ranking_public_url__visit__util.cc
electron32/patches/patch-components_viz_common_features.cc
electron32/patches/patch-components_viz_common_features.h
electron32/patches/patch-components_viz_host_host__display__client.cc
electron32/patches/patch-components_viz_host_host__display__client.h
electron32/patches/patch-components_viz_host_layered__window__updater__impl.cc
electron32/patches/patch-components_viz_host_layered__window__updater__impl.h
electron32/patches/patch-components_viz_service_BUILD.gn
electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider.h
electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc
electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h
electron32/patches/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc
electron32/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc
electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h
electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc
electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h
electron32/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc
electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.cc
electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.h
electron32/patches/patch-components_viz_service_display_skia__renderer.cc
electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
electron32/patches/patch-components_viz_test_fake__display__client.cc
electron32/patches/patch-components_viz_test_fake__display__client.h
electron32/patches/patch-components_viz_test_mock__display__client.h
electron32/patches/patch-components_viz_test_test__output__surface__provider.cc
electron32/patches/patch-components_viz_test_test__output__surface__provider.h
electron32/patches/patch-components_webrtc_media__stream__devices__controller.cc
electron32/patches/patch-components_webrtc_media__stream__devices__controller.h
electron32/patches/patch-content_app_BUILD.gn
electron32/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
electron32/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
electron32/patches/patch-content_app_content__main.cc
electron32/patches/patch-content_app_content__main__runner__impl.cc
electron32/patches/patch-content_browser_BUILD.gn
electron32/patches/patch-content_browser_accessibility_browser__accessibility__manager__mac.mm
electron32/patches/patch-content_browser_audio_audio__service.cc
electron32/patches/patch-content_browser_browser__child__process__host__impl.cc
electron32/patches/patch-content_browser_browser__child__process__host__impl.h
electron32/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
electron32/patches/patch-content_browser_browser__main__loop.cc
electron32/patches/patch-content_browser_child__process__launcher.h
electron32/patches/patch-content_browser_child__process__launcher__helper.h
electron32/patches/patch-content_browser_child__process__launcher__helper__linux.cc
electron32/patches/patch-content_browser_child__process__launcher__helper__mac.cc
electron32/patches/patch-content_browser_child__process__launcher__helper__win.cc
electron32/patches/patch-content_browser_child__thread__type__switcher__linux.cc
electron32/patches/patch-content_browser_code__cache_generated__code__cache.cc
electron32/patches/patch-content_browser_code__cache_generated__code__cache.h
electron32/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc
electron32/patches/patch-content_browser_compositor_viz__process__transport__factory.cc
electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc
electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h
electron32/patches/patch-content_browser_devtools_protocol_system__info__handler.cc
electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h
electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc
electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h
electron32/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
electron32/patches/patch-content_browser_font__access_font__enumeration__data__source.cc
electron32/patches/patch-content_browser_gpu_compositor__util.cc
electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc
electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.h
electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h
electron32/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
electron32/patches/patch-content_browser_gpu_gpu__process__host.cc
electron32/patches/patch-content_browser_media_capture_desktop__capture__device.cc
electron32/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc
electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc
electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h
electron32/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
electron32/patches/patch-content_browser_media_frameless__media__interface__proxy.h
electron32/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc
electron32/patches/patch-content_browser_network__service__instance__impl.cc
electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.cc
electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.h
electron32/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc
electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.cc
electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.h
electron32/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
electron32/patches/patch-content_browser_ppapi__plugin__sandboxed__process__launcher__delegate.cc
electron32/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc
electron32/patches/patch-content_browser_renderer__host_delegated__frame__host.cc
electron32/patches/patch-content_browser_renderer__host_input_input__device__change__observer.cc
electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc
electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h
electron32/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc
electron32/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
electron32/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc
electron32/patches/patch-content_browser_renderer__host_navigation__request.cc
electron32/patches/patch-content_browser_renderer__host_navigator.cc
electron32/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
electron32/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc
electron32/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc
electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.cc
electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.h
electron32/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc
electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.cc
electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc
electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h
electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc
electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h
electron32/patches/patch-content_browser_renderer__host_text__input__manager.cc
electron32/patches/patch-content_browser_renderer__host_text__input__manager.h
electron32/patches/patch-content_browser_sandbox__host__linux.cc
electron32/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h
electron32/patches/patch-content_browser_service__process__host__impl.cc
electron32/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc
electron32/patches/patch-content_browser_site__instance__impl.cc
electron32/patches/patch-content_browser_utility__process__host.cc
electron32/patches/patch-content_browser_utility__process__host.h
electron32/patches/patch-content_browser_utility__process__host__receiver__bindings.cc
electron32/patches/patch-content_browser_utility__sandbox__delegate.cc
electron32/patches/patch-content_browser_utility__sandbox__delegate.h
electron32/patches/patch-content_browser_v8__snapshot__files.cc
electron32/patches/patch-content_browser_web__contents_web__contents__impl.cc
electron32/patches/patch-content_browser_web__contents_web__contents__impl.h
electron32/patches/patch-content_browser_web__contents_web__contents__view__aura.cc
electron32/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc
electron32/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc
electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc
electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.h
electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h
electron32/patches/patch-content_child_BUILD.gn
electron32/patches/patch-content_child_child__process.cc
electron32/patches/patch-content_child_child__process.h
electron32/patches/patch-content_common_BUILD.gn
electron32/patches/patch-content_common_features.cc
electron32/patches/patch-content_common_features.h
electron32/patches/patch-content_common_font__list__unittest.cc
electron32/patches/patch-content_common_frame.mojom
electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h
electron32/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h
electron32/patches/patch-content_common_mojo__core__library__support.cc
electron32/patches/patch-content_common_sandbox__init__win.cc
electron32/patches/patch-content_common_url__schemes.cc
electron32/patches/patch-content_common_user__agent.cc
electron32/patches/patch-content_gpu_gpu__child__thread.cc
electron32/patches/patch-content_gpu_gpu__main.cc
electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
electron32/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc
electron32/patches/patch-content_public_app_content__main__delegate.cc
electron32/patches/patch-content_public_app_content__main__delegate.h
electron32/patches/patch-content_public_browser_content__browser__client.cc
electron32/patches/patch-content_public_browser_content__browser__client.h
electron32/patches/patch-content_public_browser_desktop__media__id.h
electron32/patches/patch-content_public_browser_platform__notification__service.h
electron32/patches/patch-content_public_browser_render__view__host.h
electron32/patches/patch-content_public_browser_service__process__host.cc
electron32/patches/patch-content_public_browser_service__process__host.h
electron32/patches/patch-content_public_browser_service__process__info.h
electron32/patches/patch-content_public_browser_web__contents.h
electron32/patches/patch-content_public_browser_web__contents__delegate.cc
electron32/patches/patch-content_public_browser_web__contents__delegate.h
electron32/patches/patch-content_public_browser_web__contents__observer.h
electron32/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h
electron32/patches/patch-content_public_common_content__client.h
electron32/patches/patch-content_public_common_content__features.cc
electron32/patches/patch-content_public_common_content__switches.cc
electron32/patches/patch-content_public_common_content__switches.h
electron32/patches/patch-content_public_common_sandbox__init__win.h
electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc
electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h
electron32/patches/patch-content_public_common_zygote_features.gni
electron32/patches/patch-content_public_gpu_content__gpu__client.h
electron32/patches/patch-content_public_renderer_content__renderer__client.h
electron32/patches/patch-content_public_renderer_render__frame__observer.h
electron32/patches/patch-content_renderer_BUILD.gn
electron32/patches/patch-content_renderer_render__frame__impl.cc
electron32/patches/patch-content_renderer_render__frame__impl.h
electron32/patches/patch-content_renderer_render__process__impl.cc
electron32/patches/patch-content_renderer_render__thread__impl.cc
electron32/patches/patch-content_renderer_renderer__blink__platform__impl.cc
electron32/patches/patch-content_renderer_renderer__blink__platform__impl.h
electron32/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc
electron32/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
electron32/patches/patch-content_renderer_theme__helper__mac.mm
electron32/patches/patch-content_shell_BUILD.gn
electron32/patches/patch-content_shell_app_shell__main__delegate.cc
electron32/patches/patch-content_shell_browser_shell__browser__main__parts.cc
electron32/patches/patch-content_shell_browser_shell__paths.cc
electron32/patches/patch-content_shell_renderer_shell__content__renderer__client.cc
electron32/patches/patch-content_shell_utility_shell__content__utility__client.cc
electron32/patches/patch-content_test_BUILD.gn
electron32/patches/patch-content_test_mock__platform__notification__service.cc
electron32/patches/patch-content_test_mock__platform__notification__service.h
electron32/patches/patch-content_test_test__page__broadcast.h
electron32/patches/patch-content_utility_services.cc
electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
electron32/patches/patch-content_utility_utility__main.cc
electron32/patches/patch-content_utility_utility__thread__impl.cc
electron32/patches/patch-content_web__test_BUILD.gn
electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.cc
electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.h
electron32/patches/patch-content_zygote_BUILD.gn
electron32/patches/patch-content_zygote_zygote__linux.cc
electron32/patches/patch-content_zygote_zygote__main__linux.cc
electron32/patches/patch-device_bluetooth_BUILD.gn
electron32/patches/patch-device_bluetooth_bluetooth__adapter.cc
electron32/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
electron32/patches/patch-device_bluetooth_cast__bluetooth.gni
electron32/patches/patch-device_fido_fido__discovery__factory.cc
electron32/patches/patch-device_gamepad_BUILD.gn
electron32/patches/patch-device_gamepad_gamepad__provider.cc
electron32/patches/patch-device_gamepad_hid__writer__linux.cc
electron32/patches/patch-electron_BUILD.gn
electron32/patches/patch-electron_build_args_all.gn
electron32/patches/patch-electron_build_args_release.gn
electron32/patches/patch-electron_default__app_default__app.ts
electron32/patches/patch-electron_filenames.gni
electron32/patches/patch-electron_lib_browser_api_app.ts
electron32/patches/patch-electron_lib_browser_api_dialog.ts
electron32/patches/patch-electron_lib_browser_api_menu-item-roles.ts
electron32/patches/patch-electron_lib_browser_api_power-monitor.ts
electron32/patches/patch-electron_lib_browser_init.ts
electron32/patches/patch-electron_lib_browser_rpc-server.ts
electron32/patches/patch-electron_lib_renderer_api_clipboard.ts
electron32/patches/patch-electron_script_lib_config.py
electron32/patches/patch-electron_script_lib_utils.js
electron32/patches/patch-electron_script_spec-runner.js
electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.cc
electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.h
electron32/patches/patch-electron_shell_app_electron__main__delegate.cc
electron32/patches/patch-electron_shell_app_node__main.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__app.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.h
electron32/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h
electron32/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc
electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.h
electron32/patches/patch-electron_shell_browser_api_process__metric.h
electron32/patches/patch-electron_shell_browser_browser.cc
electron32/patches/patch-electron_shell_browser_browser.h
electron32/patches/patch-electron_shell_browser_browser__linux.cc
electron32/patches/patch-electron_shell_browser_browser__process__impl.cc
electron32/patches/patch-electron_shell_browser_browser__process__impl.h
electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.cc
electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.h
electron32/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
electron32/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
electron32/patches/patch-electron_shell_browser_native__window.cc
electron32/patches/patch-electron_shell_browser_native__window__views.cc
electron32/patches/patch-electron_shell_browser_native__window__views.h
electron32/patches/patch-electron_shell_browser_net_system__network__context__manager.cc
electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc
electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.h
electron32/patches/patch-electron_shell_browser_printing_printing__utils.cc
electron32/patches/patch-electron_shell_browser_relauncher__linux.cc
electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc
electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h
electron32/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc
electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.cc
electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.h
electron32/patches/patch-electron_shell_browser_ui_views_submenu__button.cc
electron32/patches/patch-electron_shell_common_api_electron__api__clipboard.cc
electron32/patches/patch-electron_shell_common_api_electron__api__native__image.cc
electron32/patches/patch-electron_shell_common_api_electron__api__native__image.h
electron32/patches/patch-electron_shell_common_api_electron__bindings.cc
electron32/patches/patch-electron_shell_common_electron__command__line.cc
electron32/patches/patch-electron_shell_common_electron__command__line.h
electron32/patches/patch-electron_shell_common_electron__paths.h
electron32/patches/patch-electron_shell_common_gin__converters_std__converter.h
electron32/patches/patch-electron_shell_common_node__bindings.cc
electron32/patches/patch-electron_shell_common_node__bindings__linux.cc
electron32/patches/patch-electron_shell_common_platform__util.h
electron32/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
electron32/patches/patch-electron_spec_api-app-spec.ts
electron32/patches/patch-electron_spec_api-browser-window-spec.ts
electron32/patches/patch-electron_spec_api-clipboard-spec.ts
electron32/patches/patch-electron_spec_api-content-tracing-spec.ts
electron32/patches/patch-electron_spec_api-crash-reporter-spec.ts
electron32/patches/patch-electron_spec_api-desktop-capturer-spec.ts
electron32/patches/patch-electron_spec_api-menu-spec.ts
electron32/patches/patch-electron_spec_api-native-image-spec.ts
electron32/patches/patch-electron_spec_api-net-log-spec.ts
electron32/patches/patch-electron_spec_api-notification-dbus-spec.ts
electron32/patches/patch-electron_spec_api-power-monitor-spec.ts
electron32/patches/patch-electron_spec_api-process-spec.ts
electron32/patches/patch-electron_spec_api-protocol-spec.ts
electron32/patches/patch-electron_spec_api-safe-storage-spec.ts
electron32/patches/patch-electron_spec_api-screen-spec.ts
electron32/patches/patch-electron_spec_api-shell-spec.ts
electron32/patches/patch-electron_spec_api-subframe-spec.ts
electron32/patches/patch-electron_spec_api-tray-spec.ts
electron32/patches/patch-electron_spec_api-utility-process-spec.ts
electron32/patches/patch-electron_spec_api-web-frame-main-spec.ts
electron32/patches/patch-electron_spec_chromium-spec.ts
electron32/patches/patch-electron_spec_crash-spec.ts
electron32/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
electron32/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
electron32/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
electron32/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
electron32/patches/patch-electron_spec_node-spec.ts
electron32/patches/patch-electron_spec_version-bump-spec.ts
electron32/patches/patch-electron_spec_visibility-state-spec.ts
electron32/patches/patch-electron_spec_webview-spec.ts
electron32/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
electron32/patches/patch-extensions_browser_api_management_management__api.cc
electron32/patches/patch-extensions_browser_api_messaging_message__service.cc
electron32/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc
electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h
electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc
electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h
electron32/patches/patch-extensions_browser_script__injection__tracker.cc
electron32/patches/patch-extensions_common_api___permission__features.json
electron32/patches/patch-extensions_common_api_runtime.json
electron32/patches/patch-extensions_common_command.cc
electron32/patches/patch-extensions_common_features_feature.cc
electron32/patches/patch-extensions_renderer_bindings_api__binding__util.cc
electron32/patches/patch-extensions_renderer_bindings_argument__spec.cc
electron32/patches/patch-extensions_renderer_script__injection.cc
electron32/patches/patch-extensions_shell_app_shell__main__delegate.cc
electron32/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
electron32/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc
electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc
electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.h
electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc
electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.h
electron32/patches/patch-gin_converter.cc
electron32/patches/patch-gin_converter.h
electron32/patches/patch-gin_isolate__holder.cc
electron32/patches/patch-gin_object__template__builder.cc
electron32/patches/patch-gin_object__template__builder.h
electron32/patches/patch-gin_public_gin__embedders.h
electron32/patches/patch-gin_public_isolate__holder.h
electron32/patches/patch-gin_public_v8__platform.h
electron32/patches/patch-gin_v8__initializer.cc
electron32/patches/patch-gin_v8__initializer.h
electron32/patches/patch-gin_v8__platform.cc
electron32/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc
electron32/patches/patch-google__apis_google__api__keys-inc.cc
electron32/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc
electron32/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
electron32/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
electron32/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
electron32/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
electron32/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
electron32/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
electron32/patches/patch-gpu_config_gpu__control__list.cc
electron32/patches/patch-gpu_config_gpu__finch__features.cc
electron32/patches/patch-gpu_config_gpu__info__collector.cc
electron32/patches/patch-gpu_config_gpu__test__config.cc
electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h
electron32/patches/patch-gpu_ipc_service_BUILD.gn
electron32/patches/patch-gpu_ipc_service_gpu__init.cc
electron32/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
electron32/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h
electron32/patches/patch-gpu_ipc_service_x__util.h
electron32/patches/patch-gpu_vulkan_generate__bindings.py
electron32/patches/patch-gpu_vulkan_semaphore__handle.cc
electron32/patches/patch-gpu_vulkan_vulkan__device__queue.cc
electron32/patches/patch-gpu_vulkan_vulkan__device__queue.h
electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.cc
electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.h
electron32/patches/patch-gpu_vulkan_vulkan__image.h
electron32/patches/patch-gpu_vulkan_vulkan__util.cc
electron32/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
electron32/patches/patch-headless_lib_browser_headless__content__browser__client.h
electron32/patches/patch-headless_lib_browser_headless__request__context__manager.cc
electron32/patches/patch-headless_lib_browser_headless__web__contents__impl.cc
electron32/patches/patch-headless_lib_headless__content__main__delegate.cc
electron32/patches/patch-ipc_ipc__channel.h
electron32/patches/patch-ipc_ipc__channel__common.cc
electron32/patches/patch-ipc_ipc__channel__mojo.cc
electron32/patches/patch-ipc_ipc__message__utils.cc
electron32/patches/patch-ipc_ipc__message__utils.h
electron32/patches/patch-media_BUILD.gn
electron32/patches/patch-media_audio_BUILD.gn
electron32/patches/patch-media_audio_alsa_audio__manager__alsa.cc
electron32/patches/patch-media_audio_apple_audio__low__latency__input.cc
electron32/patches/patch-media_audio_audio__input__device.cc
electron32/patches/patch-media_audio_audio__output__proxy__unittest.cc
electron32/patches/patch-media_audio_mac_audio__manager__mac.cc
electron32/patches/patch-media_audio_pulse_pulse__util.cc
electron32/patches/patch-media_audio_sndio_audio__manager__sndio.cc
electron32/patches/patch-media_audio_sndio_audio__manager__sndio.h
electron32/patches/patch-media_audio_sndio_sndio__input.cc
electron32/patches/patch-media_audio_sndio_sndio__input.h
electron32/patches/patch-media_audio_sndio_sndio__output.cc
electron32/patches/patch-media_audio_sndio_sndio__output.h
electron32/patches/patch-media_base_audio__latency.cc
electron32/patches/patch-media_base_libaom__thread__wrapper.cc
electron32/patches/patch-media_base_libvpx__thread__wrapper.cc
electron32/patches/patch-media_base_media__switches.cc
electron32/patches/patch-media_base_media__switches.h
electron32/patches/patch-media_base_user__input__monitor__unittest.cc
electron32/patches/patch-media_base_video__frame.cc
electron32/patches/patch-media_base_video__frame.h
electron32/patches/patch-media_capture_video__capture__types.h
electron32/patches/patch-media_capture_video_create__video__capture__device__factory.cc
electron32/patches/patch-media_capture_video_fake__video__capture__device__factory.cc
electron32/patches/patch-media_capture_video_file__video__capture__device__factory.cc
electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc
electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.h
electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc
electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h
electron32/patches/patch-media_capture_video_linux_v4l2__capture__device.h
electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h
electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
electron32/patches/patch-media_capture_video_linux_video__capture__device__linux.cc
electron32/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
electron32/patches/patch-media_capture_video_video__capture__device__client.cc
electron32/patches/patch-media_cdm_cdm__paths__unittest.cc
electron32/patches/patch-media_cdm_library__cdm_cdm__paths.gni
electron32/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py
electron32/patches/patch-media_ffmpeg_scripts_robo__lib_config.py
electron32/patches/patch-media_gpu_buffer__validation.cc
electron32/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc
electron32/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
electron32/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
electron32/patches/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc
electron32/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc
electron32/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc
electron32/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
electron32/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc
electron32/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc
electron32/patches/patch-media_media__options.gni
electron32/patches/patch-media_mojo_mojom_stable_BUILD.gn
electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
electron32/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc
electron32/patches/patch-media_video_fake__gpu__memory__buffer.cc
electron32/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
electron32/patches/patch-media_video_video__encode__accelerator__adapter.cc
electron32/patches/patch-media_video_video__encode__accelerator__adapter__test.cc
electron32/patches/patch-media_webrtc_audio__processor.cc
electron32/patches/patch-media_webrtc_helpers.cc
electron32/patches/patch-media_webrtc_helpers__unittests.cc
electron32/patches/patch-mojo_core_BUILD.gn
electron32/patches/patch-mojo_core_channel.cc
electron32/patches/patch-mojo_core_embedder_features.h
electron32/patches/patch-mojo_public_c_system_thunks.cc
electron32/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc
electron32/patches/patch-mojo_public_tools_bindings_mojom.gni
electron32/patches/patch-net_BUILD.gn
electron32/patches/patch-net_base_features.cc
electron32/patches/patch-net_base_mock__network__change__notifier.cc
electron32/patches/patch-net_base_mock__network__change__notifier.h
electron32/patches/patch-net_base_network__change__notifier.cc
electron32/patches/patch-net_base_network__change__notifier.h
electron32/patches/patch-net_base_network__change__notifier__passive.cc
electron32/patches/patch-net_base_network__interfaces__posix.h
electron32/patches/patch-net_base_sockaddr__util__posix.cc
electron32/patches/patch-net_base_sockaddr__util__posix__unittest.cc
electron32/patches/patch-net_cert_cert__verify__proc.h
electron32/patches/patch-net_disk__cache_simple_simple__file__tracker.cc
electron32/patches/patch-net_dns_BUILD.gn
electron32/patches/patch-net_dns_address__info.cc
electron32/patches/patch-net_dns_address__sorter__posix.cc
electron32/patches/patch-net_dns_dns__config__service__posix.cc
electron32/patches/patch-net_dns_dns__reloader.cc
electron32/patches/patch-net_dns_dns__util.cc
electron32/patches/patch-net_dns_host__resolver__proc.cc
electron32/patches/patch-net_dns_public_BUILD.gn
electron32/patches/patch-net_dns_public_resolv__reader.cc
electron32/patches/patch-net_dns_public_resolv__reader.h
electron32/patches/patch-net_dns_public_scoped__res__state.cc
electron32/patches/patch-net_dns_public_scoped__res__state.h
electron32/patches/patch-net_filter_zstd__source__stream.cc
electron32/patches/patch-net_http_http__auth__gssapi__posix.cc
electron32/patches/patch-net_http_http__auth__gssapi__posix.h
electron32/patches/patch-net_http_http__auth__handler__negotiate.cc
electron32/patches/patch-net_http_http__auth__preferences.cc
electron32/patches/patch-net_http_http__auth__preferences.h
electron32/patches/patch-net_http_http__network__session.cc
electron32/patches/patch-net_proxy__resolution_proxy__config__service.cc
electron32/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc
electron32/patches/patch-net_socket_socket__posix.cc
electron32/patches/patch-net_socket_socks5__client__socket.cc
electron32/patches/patch-net_socket_tcp__socket__posix.cc
electron32/patches/patch-net_socket_udp__socket__posix.cc
electron32/patches/patch-net_socket_udp__socket__unittest.cc
electron32/patches/patch-net_third__party_quiche_BUILD.gn
electron32/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
electron32/patches/patch-net_tools_net__watcher_net__watcher.cc
electron32/patches/patch-net_traffic__annotation_network__traffic__annotation.h
electron32/patches/patch-net_url__request_static__http__user__agent__settings.h
electron32/patches/patch-net_url__request_url__request__context.cc
electron32/patches/patch-net_url__request_url__request__context.h
electron32/patches/patch-net_url__request_url__request__context__builder.cc
electron32/patches/patch-pdf_pdfium_pdfium__engine.cc
electron32/patches/patch-ppapi_buildflags_buildflags.gni
electron32/patches/patch-ppapi_tests_test__utils.h
electron32/patches/patch-printing_backend_cups__ipp__helper.cc
electron32/patches/patch-printing_backend_print__backend__cups.cc
electron32/patches/patch-printing_mojom_printing__context__mojom__traits.cc
electron32/patches/patch-printing_mojom_printing__context__mojom__traits.h
electron32/patches/patch-printing_print__settings.cc
electron32/patches/patch-printing_print__settings.h
electron32/patches/patch-printing_print__settings__conversion.cc
electron32/patches/patch-printing_printing__context.cc
electron32/patches/patch-printing_printing__context.h
electron32/patches/patch-printing_printing__context__linux.cc
electron32/patches/patch-printing_printing__context__mac.h
electron32/patches/patch-printing_printing__context__mac.mm
electron32/patches/patch-printing_printing__context__system__dialog__win.cc
electron32/patches/patch-printing_printing__features.cc
electron32/patches/patch-printing_printing__features.h
electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
electron32/patches/patch-remoting_base_chromoting__event.cc
electron32/patches/patch-remoting_base_host__settings.cc
electron32/patches/patch-remoting_client_display_sys__opengl.h
electron32/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc
electron32/patches/patch-remoting_host_base_desktop__environment__options.cc
electron32/patches/patch-remoting_host_base_switches.cc
electron32/patches/patch-remoting_host_base_switches.h
electron32/patches/patch-remoting_host_basic__desktop__environment.cc
electron32/patches/patch-remoting_host_chromoting__host.cc
electron32/patches/patch-remoting_host_chromoting__host.h
electron32/patches/patch-remoting_host_chromoting__host__context.cc
electron32/patches/patch-remoting_host_chromoting__host__services__client.cc
electron32/patches/patch-remoting_host_client__session.cc
electron32/patches/patch-remoting_host_crash_crash__file__uploader.cc
electron32/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc
electron32/patches/patch-remoting_host_desktop__capturer__proxy.cc
electron32/patches/patch-remoting_host_desktop__capturer__wrapper.cc
electron32/patches/patch-remoting_host_evaluate__capability.cc
electron32/patches/patch-remoting_host_host__attributes.cc
electron32/patches/patch-remoting_host_host__details.cc
electron32/patches/patch-remoting_host_host__main.cc
electron32/patches/patch-remoting_host_ipc__constants.cc
electron32/patches/patch-remoting_host_it2me_it2me__host.cc
electron32/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc
electron32/patches/patch-remoting_host_me2me__desktop__environment.cc
electron32/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc
electron32/patches/patch-remoting_host_policy__watcher.cc
electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc
electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc
electron32/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc
electron32/patches/patch-remoting_host_remoting__me2me__host.cc
electron32/patches/patch-remoting_host_setup_start__host__main.cc
electron32/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc
electron32/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc
electron32/patches/patch-remoting_protocol_webrtc__video__stream.cc
electron32/patches/patch-sandbox_BUILD.gn
electron32/patches/patch-sandbox_features.gni
electron32/patches/patch-sandbox_linux_BUILD.gn
electron32/patches/patch-sandbox_linux_services_init__process__reaper.cc
electron32/patches/patch-sandbox_linux_services_libc__interceptor.cc
electron32/patches/patch-sandbox_mac_BUILD.gn
electron32/patches/patch-sandbox_mac_sandbox__compiler.cc
electron32/patches/patch-sandbox_mac_sandbox__logging.cc
electron32/patches/patch-sandbox_mac_seatbelt.cc
electron32/patches/patch-sandbox_mac_seatbelt__extension.cc
electron32/patches/patch-sandbox_mac_system__services.cc
electron32/patches/patch-sandbox_policy_BUILD.gn
electron32/patches/patch-sandbox_policy_features.cc
electron32/patches/patch-sandbox_policy_features.h
electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
electron32/patches/patch-sandbox_policy_mac_sandbox__mac.mm
electron32/patches/patch-sandbox_policy_mojom_sandbox.mojom
electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc
electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
electron32/patches/patch-sandbox_policy_sandbox.cc
electron32/patches/patch-sandbox_policy_sandbox.h
electron32/patches/patch-sandbox_policy_sandbox__type.cc
electron32/patches/patch-sandbox_policy_switches.cc
electron32/patches/patch-sandbox_policy_switches.h
electron32/patches/patch-sandbox_policy_win_sandbox__win.cc
electron32/patches/patch-sandbox_policy_win_sandbox__win.h
electron32/patches/patch-services_audio_audio__sandbox__hook__linux.cc
electron32/patches/patch-services_audio_audio__sandbox__hook__linux.h
electron32/patches/patch-services_device_BUILD.gn
electron32/patches/patch-services_device_geolocation_location__provider__manager.cc
electron32/patches/patch-services_device_hid_BUILD.gn
electron32/patches/patch-services_device_hid_hid__connection__fido.cc
electron32/patches/patch-services_device_hid_hid__connection__fido.h
electron32/patches/patch-services_device_hid_hid__connection__freebsd.cc
electron32/patches/patch-services_device_hid_hid__connection__freebsd.h
electron32/patches/patch-services_device_hid_hid__service.cc
electron32/patches/patch-services_device_hid_hid__service__fido.cc
electron32/patches/patch-services_device_hid_hid__service__fido.h
electron32/patches/patch-services_device_hid_hid__service__freebsd.cc
electron32/patches/patch-services_device_hid_hid__service__freebsd.h
electron32/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h
electron32/patches/patch-services_device_public_mojom_BUILD.gn
electron32/patches/patch-services_device_serial_BUILD.gn
electron32/patches/patch-services_device_serial_serial__device__enumerator.cc
electron32/patches/patch-services_device_serial_serial__io__handler__posix.cc
electron32/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc
electron32/patches/patch-services_device_usb_BUILD.gn
electron32/patches/patch-services_device_usb_usb__service.cc
electron32/patches/patch-services_device_usb_usb__service__fake.cc
electron32/patches/patch-services_device_usb_usb__service__fake.h
electron32/patches/patch-services_device_usb_usb__service__impl.cc
electron32/patches/patch-services_network_BUILD.gn
electron32/patches/patch-services_network_network__context.cc
electron32/patches/patch-services_network_network__context.h
electron32/patches/patch-services_network_network__sandbox__hook__linux.cc
electron32/patches/patch-services_network_network__sandbox__hook__linux.h
electron32/patches/patch-services_network_network__service.cc
electron32/patches/patch-services_network_network__service.h
electron32/patches/patch-services_network_public_cpp_BUILD.gn
electron32/patches/patch-services_network_public_cpp_features.cc
electron32/patches/patch-services_network_public_cpp_resource__request.cc
electron32/patches/patch-services_network_public_cpp_resource__request.h
electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc
electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.h
electron32/patches/patch-services_network_public_mojom_BUILD.gn
electron32/patches/patch-services_network_public_mojom_network__context.mojom
electron32/patches/patch-services_network_public_mojom_url__request.mojom
electron32/patches/patch-services_network_public_mojom_url__response__head.mojom
electron32/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h
electron32/patches/patch-services_network_test_test__network__context.h
electron32/patches/patch-services_network_url__loader.cc
electron32/patches/patch-services_network_url__loader.h
electron32/patches/patch-services_on__device__model_on__device__model__service.h
electron32/patches/patch-services_on__device__model_pre__sandbox__init.cc
electron32/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc
electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn
electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h
electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc
electron32/patches/patch-services_screen__ai_public_cpp_utilities.cc
electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc
electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h
electron32/patches/patch-services_service__manager_BUILD.gn
electron32/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn
electron32/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc
electron32/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom
electron32/patches/patch-services_video__capture_video__capture__service__impl.cc
electron32/patches/patch-services_video__capture_video__capture__service__impl.h
electron32/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom
electron32/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom
electron32/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom
electron32/patches/patch-skia_ext_SkMemory__new__handler.cpp
electron32/patches/patch-skia_ext_font__utils.cc
electron32/patches/patch-skia_ext_platform__canvas.h
electron32/patches/patch-skia_ext_skcolorspace__trfn.cc
electron32/patches/patch-third__party_.gitignore
electron32/patches/patch-third__party_abseil-cpp_absl_base_config.h
electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc
electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc
electron32/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h
electron32/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc
electron32/patches/patch-third__party_afl_src_afl-fuzz.c
electron32/patches/patch-third__party_angle_BUILD.gn
electron32/patches/patch-third__party_angle_src_common_platform.h
electron32/patches/patch-third__party_angle_src_common_platform__helpers.h
electron32/patches/patch-third__party_angle_src_common_system__utils.cpp
electron32/patches/patch-third__party_angle_src_common_system__utils__linux.cpp
electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
electron32/patches/patch-third__party_angle_src_libANGLE_Display.cpp
electron32/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp
electron32/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp
electron32/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h
electron32/patches/patch-third__party_angle_util_BUILD.gn
electron32/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc
electron32/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc
electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h
electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h
electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h
electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h
electron32/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom
electron32/patches/patch-third__party_blink_public_mojom_page_page.mojom
electron32/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom
electron32/patches/patch-third__party_blink_public_platform_platform.h
electron32/patches/patch-third__party_blink_public_platform_web__vector.h
electron32/patches/patch-third__party_blink_public_web_web__blob.h
electron32/patches/patch-third__party_blink_public_web_web__document__loader.h
electron32/patches/patch-third__party_blink_public_web_web__local__frame.h
electron32/patches/patch-third__party_blink_public_web_web__local__frame__client.h
electron32/patches/patch-third__party_blink_public_web_web__message__port__converter.h
electron32/patches/patch-third__party_blink_public_web_web__script__execution__callback.h
electron32/patches/patch-third__party_blink_public_web_web__view.h
electron32/patches/patch-third__party_blink_public_web_web__window__features.h
electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc
electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc
electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h
electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc
electron32/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py
electron32/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py
electron32/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc
electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc
electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h
electron32/patches/patch-third__party_blink_renderer_core_BUILD.gn
electron32/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc
electron32/patches/patch-third__party_blink_renderer_core_editing_build.gni
electron32/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc
electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.cc
electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.h
electron32/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc
electron32/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc
electron32/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc
electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h
electron32/patches/patch-third__party_blink_renderer_core_frame_frame.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.h
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h
electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h
electron32/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc
electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h
electron32/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc
electron32/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc
electron32/patches/patch-third__party_blink_renderer_core_html_parser_html__srcset__parser.cc
electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc
electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__network__agent.cc
electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__page__agent.cc
electron32/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc
electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc
electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.h
electron32/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h
electron32/patches/patch-third__party_blink_renderer_core_loader_image__loader.cc
electron32/patches/patch-third__party_blink_renderer_core_loader_modulescript_module__script__loader.cc
electron32/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc
electron32/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc
electron32/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc
electron32/patches/patch-third__party_blink_renderer_core_testing_internals.cc
electron32/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc
electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h
electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc
electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc
electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc
electron32/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc
electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.cc
electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.h
electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.cc
electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.h
electron32/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc
electron32/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc
electron32/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc
electron32/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc
electron32/patches/patch-third__party_blink_renderer_platform_BUILD.gn
electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc
electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc
electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc
electron32/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc
electron32/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc
electron32/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc
electron32/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc
electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.cc
electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.h
electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc
electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h
electron32/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc
electron32/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
electron32/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc
electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc
electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc
electron32/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h
electron32/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h
electron32/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc
electron32/patches/patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.cc
electron32/patches/patch-third__party_boringssl_BUILD.gn
electron32/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c
electron32/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c
electron32/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c
electron32/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c
electron32/patches/patch-third__party_boringssl_src_include_openssl_cipher.h
electron32/patches/patch-third__party_boringssl_src_include_openssl_digest.h
electron32/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc
electron32/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc
electron32/patches/patch-third__party_brotli_common_platform.h
electron32/patches/patch-third__party_cpuinfo_cpuinfo.gni
electron32/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni
electron32/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn
electron32/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc
electron32/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h
electron32/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h
electron32/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc
electron32/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc
electron32/patches/patch-third__party_crc32c_BUILD.gn
electron32/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h
electron32/patches/patch-third__party_dawn_src_dawn_common_Platform.h
electron32/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp
electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness.cc
electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness__test.cc
electron32/patches/patch-third__party_dawn_src_tint_lang_spirv_writer_texture__builtin__test.cc
electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_address__space__layout__validation__test.cc
electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_validator.cc
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.dxc.hlsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.fxc.hlsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.glsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.dxc.hlsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.fxc.hlsl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.msl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.msl
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.spvasm
electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.wgsl
electron32/patches/patch-third__party_dawn_webgpu-cts_compat-expectations.txt
electron32/patches/patch-third__party_dawn_webgpu-cts_expectations.txt
electron32/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts
electron32/patches/patch-third__party_electron__node_BUILD.gn
electron32/patches/patch-third__party_electron__node_common.gypi
electron32/patches/patch-third__party_electron__node_configure.py
electron32/patches/patch-third__party_electron__node_deps_ada_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_base64_unofficial.gni
electron32/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_cares_include_ares__build.h
electron32/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h
electron32/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
electron32/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst
electron32/patches/patch-third__party_electron__node_deps_uv_include_uv.h
electron32/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h
electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h
electron32/patches/patch-third__party_electron__node_deps_uv_src_win_core.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_win_process.c
electron32/patches/patch-third__party_electron__node_deps_uv_src_win_util.c
electron32/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c
electron32/patches/patch-third__party_electron__node_deps_uv_test_test-list.h
electron32/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn
electron32/patches/patch-third__party_electron__node_lib_.eslintrc.yaml
electron32/patches/patch-third__party_electron__node_lib_child__process.js
electron32/patches/patch-third__party_electron__node_lib_internal_assert_utils.js
electron32/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js
electron32/patches/patch-third__party_electron__node_lib_internal_constants.js
electron32/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js
electron32/patches/patch-third__party_electron__node_lib_internal_http.js
electron32/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js
electron32/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js
electron32/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js
electron32/patches/patch-third__party_electron__node_lib_internal_url.js
electron32/patches/patch-third__party_electron__node_lib_internal_worker.js
electron32/patches/patch-third__party_electron__node_src_api_environment.cc
electron32/patches/patch-third__party_electron__node_src_base__object-inl.h
electron32/patches/patch-third__party_electron__node_src_base__object.h
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc
electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.h
electron32/patches/patch-third__party_electron__node_src_env-inl.h
electron32/patches/patch-third__party_electron__node_src_env.cc
electron32/patches/patch-third__party_electron__node_src_env.h
electron32/patches/patch-third__party_electron__node_src_handle__wrap.cc
electron32/patches/patch-third__party_electron__node_src_inspector_BUILD.gn
electron32/patches/patch-third__party_electron__node_src_module__wrap.cc
electron32/patches/patch-third__party_electron__node_src_module__wrap.h
electron32/patches/patch-third__party_electron__node_src_node.h
electron32/patches/patch-third__party_electron__node_src_node__binding.cc
electron32/patches/patch-third__party_electron__node_src_node__binding.h
electron32/patches/patch-third__party_electron__node_src_node__buffer.h
electron32/patches/patch-third__party_electron__node_src_node__builtins.cc
electron32/patches/patch-third__party_electron__node_src_node__builtins.h
electron32/patches/patch-third__party_electron__node_src_node__constants.cc
electron32/patches/patch-third__party_electron__node_src_node__contextify.cc
electron32/patches/patch-third__party_electron__node_src_node__contextify.h
electron32/patches/patch-third__party_electron__node_src_node__env__var.cc
electron32/patches/patch-third__party_electron__node_src_node__errors.cc
electron32/patches/patch-third__party_electron__node_src_node__errors.h
electron32/patches/patch-third__party_electron__node_src_node__external__reference.h
electron32/patches/patch-third__party_electron__node_src_node__file.cc
electron32/patches/patch-third__party_electron__node_src_node__file.h
electron32/patches/patch-third__party_electron__node_src_node__i18n.cc
electron32/patches/patch-third__party_electron__node_src_node__internals.h
electron32/patches/patch-third__party_electron__node_src_node__messaging.cc
electron32/patches/patch-third__party_electron__node_src_node__metadata.h
electron32/patches/patch-third__party_electron__node_src_node__options.cc
electron32/patches/patch-third__party_electron__node_src_node__options.h
electron32/patches/patch-third__party_electron__node_src_node__platform.cc
electron32/patches/patch-third__party_electron__node_src_node__platform.h
electron32/patches/patch-third__party_electron__node_src_node__process__object.cc
electron32/patches/patch-third__party_electron__node_src_node__serdes.cc
electron32/patches/patch-third__party_electron__node_src_node__trace__events.cc
electron32/patches/patch-third__party_electron__node_src_stream__base.cc
electron32/patches/patch-third__party_electron__node_src_stream__base.h
electron32/patches/patch-third__party_electron__node_src_tracing_agent.cc
electron32/patches/patch-third__party_electron__node_src_tracing_agent.h
electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc
electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc
electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h
electron32/patches/patch-third__party_electron__node_src_tracing_trace__event.h
electron32/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc
electron32/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc
electron32/patches/patch-third__party_electron__node_test_cctest_test__environment.cc
electron32/patches/patch-third__party_electron__node_test_common_assertSnapshot.js
electron32/patches/patch-third__party_electron__node_test_common_debugger.js
electron32/patches/patch-third__party_electron__node_test_common_globals.js
electron32/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js
electron32/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js
electron32/patches/patch-third__party_electron__node_test_parallel_parallel.status
electron32/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-private-decrypt-gh32240.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs
electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-console.mjs
electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs
electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs
electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getcertificate-x509.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-serdes.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js
electron32/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js
electron32/patches/patch-third__party_electron__node_test_sequential_sequential.status
electron32/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js
electron32/patches/patch-third__party_electron__node_test_wpt_status_streams.json
electron32/patches/patch-third__party_electron__node_tools_install.py
electron32/patches/patch-third__party_electron__node_tools_js2c.cc
electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg
electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg
electron32/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py
electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg
electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg
electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg
electron32/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg
electron32/patches/patch-third__party_ffmpeg_BUILD.gn
electron32/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h
electron32/patches/patch-third__party_ffmpeg_libavutil_cpu.c
electron32/patches/patch-third__party_ffmpeg_libavutil_mem.c
electron32/patches/patch-third__party_ffmpeg_libavutil_random__seed.c
electron32/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm
electron32/patches/patch-third__party_fontconfig_include_config.h
electron32/patches/patch-third__party_fontconfig_src_src_fccompat.c
electron32/patches/patch-third__party_ipcz_src_reference__drivers_random.cc
electron32/patches/patch-third__party_ipcz_src_standalone_base_logging.cc
electron32/patches/patch-third__party_leveldatabase_env__chromium.cc
electron32/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c
electron32/patches/patch-third__party_libc++_src_src_chrono.cpp
electron32/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp
electron32/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h
electron32/patches/patch-third__party_libdrm_src_xf86drmMode.c
electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h
electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h
electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h
electron32/patches/patch-third__party_libsync_src_include_sync_sync.h
electron32/patches/patch-third__party_libsync_src_sync.c
electron32/patches/patch-third__party_libusb_BUILD.gn
electron32/patches/patch-third__party_libusb_src_libusb_core.c
electron32/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c
electron32/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
electron32/patches/patch-third__party_lzma__sdk_C_CpuArch.c
electron32/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc
electron32/patches/patch-third__party_nan_nan.h
electron32/patches/patch-third__party_nan_nan__callbacks__12__inl.h
electron32/patches/patch-third__party_nan_nan__persistent__12__inl.h
electron32/patches/patch-third__party_nan_nan__scriptorigin.h
electron32/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp
electron32/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp
electron32/patches/patch-third__party_nan_test_cpp_news.cpp
electron32/patches/patch-third__party_nan_test_js_accessors-test.js
electron32/patches/patch-third__party_nasm_BUILD.gn
electron32/patches/patch-third__party_nasm_config_config-linux.h
electron32/patches/patch-third__party_node_node.gni
electron32/patches/patch-third__party_node_node.py
electron32/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp
electron32/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp
electron32/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp
electron32/patches/patch-third__party_pdfium_pdfium.gni
electron32/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp
electron32/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h
electron32/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h
electron32/patches/patch-third__party_perfetto_include_perfetto_base_time.h
electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h
electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h
electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h
electron32/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h
electron32/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto
electron32/patches/patch-third__party_perfetto_src_base_event__fd.cc
electron32/patches/patch-third__party_perfetto_src_base_periodic__task.cc
electron32/patches/patch-third__party_perfetto_src_base_string__utils.cc
electron32/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc
electron32/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc
electron32/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc
electron32/patches/patch-third__party_perfetto_src_base_unix__socket.cc
electron32/patches/patch-third__party_perfetto_src_base_utils.cc
electron32/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc
electron32/patches/patch-third__party_perfetto_src_tracing_core_clock__snapshots.cc
electron32/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc
electron32/patches/patch-third__party_perfetto_src_tracing_track.cc
electron32/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h
electron32/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h
electron32/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp
electron32/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp
electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.cpp
electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.h
electron32/patches/patch-third__party_skia_tests_RasterPipelineCodeGeneratorTest.cpp
electron32/patches/patch-third__party_speech-dispatcher_libspeechd__version.h
electron32/patches/patch-third__party_speech-dispatcher_speechd__types.h
electron32/patches/patch-third__party_sqlite_BUILD.gn
electron32/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c
electron32/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c
electron32/patches/patch-third__party_squirrel.mac_.gitignore
electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h
electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m
electron32/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
electron32/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m
electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m
electron32/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp
electron32/patches/patch-third__party_swiftshader_src_System_Configurator.cpp
electron32/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp
electron32/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp
electron32/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp
electron32/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h
electron32/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h
electron32/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp
electron32/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp
electron32/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn
electron32/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc
electron32/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc
electron32/patches/patch-third__party_tflite_features.gni
electron32/patches/patch-third__party_unrar_src_crypt.cpp
electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h
electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp
electron32/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h
electron32/patches/patch-third__party_wayland_BUILD.gn
electron32/patches/patch-third__party_wayland_include_config.h
electron32/patches/patch-third__party_webrtc_BUILD.gn
electron32/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc
electron32/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc
electron32/patches/patch-third__party_webrtc_rtc__base_byte__order.h
electron32/patches/patch-third__party_webrtc_rtc__base_ip__address.cc
electron32/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc
electron32/patches/patch-third__party_webrtc_rtc__base_network.cc
electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc
electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h
electron32/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc
electron32/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h
electron32/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn
electron32/patches/patch-third__party_widevine_cdm_widevine.gni
electron32/patches/patch-third__party_zlib_BUILD.gn
electron32/patches/patch-third__party_zlib_cpu__features.c
electron32/patches/patch-tools_clang_scripts_update.py
electron32/patches/patch-tools_generate__shim__headers_generate__shim__headers.py
electron32/patches/patch-tools_generate__stubs_rules.gni
electron32/patches/patch-tools_gn_build_build__linux.ninja.template
electron32/patches/patch-tools_gn_build_gen.py
electron32/patches/patch-tools_gn_src_base_files_file__posix.cc
electron32/patches/patch-tools_gn_src_gn_version.h
electron32/patches/patch-tools_gn_src_util_exe__path.cc
electron32/patches/patch-tools_grit_grit_node_base.py
electron32/patches/patch-tools_gritsettings_resource__ids.spec
electron32/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py
electron32/patches/patch-tools_json__schema__compiler_feature__compiler.py
electron32/patches/patch-tools_licenses_licenses.py
electron32/patches/patch-tools_memory_partition__allocator_inspect__utils.h
electron32/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn
electron32/patches/patch-tools_protoc__wrapper_protoc__wrapper.py
electron32/patches/patch-tools_v8__context__snapshot_BUILD.gn
electron32/patches/patch-tools_variations_fieldtrial__to__struct.py
electron32/patches/patch-ui_accelerated__widget__mac_BUILD.gn
electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h
electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm
electron32/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
electron32/patches/patch-ui_accessibility_platform_BUILD.gn
electron32/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
electron32/patches/patch-ui_aura_client_drag__drop__client.h
electron32/patches/patch-ui_aura_screen__ozone.cc
electron32/patches/patch-ui_aura_screen__ozone.h
electron32/patches/patch-ui_base_BUILD.gn
electron32/patches/patch-ui_base_accelerators_accelerator.cc
electron32/patches/patch-ui_base_accelerators_accelerator.h
electron32/patches/patch-ui_base_accelerators_accelerator__unittest.cc
electron32/patches/patch-ui_base_accelerators_media__keys__listener.cc
electron32/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm
electron32/patches/patch-ui_base_clipboard_clipboard__constants.cc
electron32/patches/patch-ui_base_clipboard_clipboard__constants.h
electron32/patches/patch-ui_base_clipboard_clipboard__non__backed.cc
electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc
electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h
electron32/patches/patch-ui_base_cocoa_remote__accessibility__api.h
electron32/patches/patch-ui_base_cocoa_remote__layer__api.h
electron32/patches/patch-ui_base_cocoa_remote__layer__api.mm
electron32/patches/patch-ui_base_cursor_cursor__factory.cc
electron32/patches/patch-ui_base_cursor_cursor__factory.h
electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc
electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc
electron32/patches/patch-ui_base_ime_dummy__text__input__client.cc
electron32/patches/patch-ui_base_ime_dummy__text__input__client.h
electron32/patches/patch-ui_base_ime_fake__text__input__client.cc
electron32/patches/patch-ui_base_ime_fake__text__input__client.h
electron32/patches/patch-ui_base_ime_init_input__method__initializer.cc
electron32/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc
electron32/patches/patch-ui_base_ime_text__input__client.h
electron32/patches/patch-ui_base_models_simple__menu__model.cc
electron32/patches/patch-ui_base_models_simple__menu__model.h
electron32/patches/patch-ui_base_resource_resource__bundle.cc
electron32/patches/patch-ui_base_test_skia__gold__pixel__diff.cc
electron32/patches/patch-ui_base_test_ui__controls.h
electron32/patches/patch-ui_base_ui__base__features.cc
electron32/patches/patch-ui_base_ui__base__features.h
electron32/patches/patch-ui_base_ui__base__switches.cc
electron32/patches/patch-ui_base_ui__base__switches.h
electron32/patches/patch-ui_base_webui_web__ui__util.cc
electron32/patches/patch-ui_base_x_x11__cursor__factory.cc
electron32/patches/patch-ui_base_x_x11__cursor__factory.h
electron32/patches/patch-ui_base_x_x11__cursor__loader.cc
electron32/patches/patch-ui_base_x_x11__display__manager.cc
electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.cc
electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.h
electron32/patches/patch-ui_base_x_x11__shm__image__pool.cc
electron32/patches/patch-ui_color_color__id.h
electron32/patches/patch-ui_color_color__provider__utils.cc
electron32/patches/patch-ui_color_system__theme.h
electron32/patches/patch-ui_color_ui__color__mixer.cc
electron32/patches/patch-ui_color_win_native__color__mixers__win.cc
electron32/patches/patch-ui_compositor_compositor.cc
electron32/patches/patch-ui_compositor_compositor.h
electron32/patches/patch-ui_compositor_compositor__observer.h
electron32/patches/patch-ui_display_BUILD.gn
electron32/patches/patch-ui_display_mac_screen__mac.mm
electron32/patches/patch-ui_display_screen.cc
electron32/patches/patch-ui_display_screen.h
electron32/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc
electron32/patches/patch-ui_events_event.cc
electron32/patches/patch-ui_events_event__switches.cc
electron32/patches/patch-ui_events_event__switches.h
electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.cc
electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.h
electron32/patches/patch-ui_events_x_events__x__utils.cc
electron32/patches/patch-ui_gfx_BUILD.gn
electron32/patches/patch-ui_gfx_ca__layer__params.h
electron32/patches/patch-ui_gfx_canvas__skia.cc
electron32/patches/patch-ui_gfx_font__fallback__linux.cc
electron32/patches/patch-ui_gfx_font__render__params.h
electron32/patches/patch-ui_gfx_font__render__params__linux.cc
electron32/patches/patch-ui_gfx_font__util.cc
electron32/patches/patch-ui_gfx_gpu__memory__buffer.cc
electron32/patches/patch-ui_gfx_gpu__memory__buffer.h
electron32/patches/patch-ui_gfx_linux_dmabuf__uapi.h
electron32/patches/patch-ui_gfx_linux_gbm__wrapper.cc
electron32/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc
electron32/patches/patch-ui_gfx_mojom_ca__layer__params.mojom
electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc
electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h
electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc
electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h
electron32/patches/patch-ui_gfx_native__pixmap__handle.cc
electron32/patches/patch-ui_gfx_native__pixmap__handle.h
electron32/patches/patch-ui_gfx_native__widget__types.h
electron32/patches/patch-ui_gfx_platform__font__mac.mm
electron32/patches/patch-ui_gfx_platform__font__skia.cc
electron32/patches/patch-ui_gfx_render__text__api__fuzzer.cc
electron32/patches/patch-ui_gfx_render__text__fuzzer.cc
electron32/patches/patch-ui_gfx_switches.cc
electron32/patches/patch-ui_gfx_switches.h
electron32/patches/patch-ui_gfx_x_generated__protos_dri3.cc
electron32/patches/patch-ui_gfx_x_generated__protos_shm.cc
electron32/patches/patch-ui_gfx_x_xlib__support.cc
electron32/patches/patch-ui_gl_BUILD.gn
electron32/patches/patch-ui_gl_gl__context.cc
electron32/patches/patch-ui_gl_gl__fence.cc
electron32/patches/patch-ui_gl_gl__implementation.cc
electron32/patches/patch-ui_gl_gl__switches.cc
electron32/patches/patch-ui_gl_sync__control__vsync__provider.cc
electron32/patches/patch-ui_gl_sync__control__vsync__provider.h
electron32/patches/patch-ui_gtk_gtk__compat.cc
electron32/patches/patch-ui_gtk_gtk__compat.h
electron32/patches/patch-ui_gtk_gtk__ui.cc
electron32/patches/patch-ui_gtk_gtk__ui.h
electron32/patches/patch-ui_gtk_gtk__util.cc
electron32/patches/patch-ui_gtk_printing_print__dialog__gtk.cc
electron32/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc
electron32/patches/patch-ui_gtk_window__frame__provider__gtk.cc
electron32/patches/patch-ui_gtk_window__frame__provider__gtk.h
electron32/patches/patch-ui_linux_fallback__linux__ui.cc
electron32/patches/patch-ui_linux_fallback__linux__ui.h
electron32/patches/patch-ui_linux_linux__ui.h
electron32/patches/patch-ui_message__center_views_message__popup__view.cc
electron32/patches/patch-ui_native__theme_native__theme.cc
electron32/patches/patch-ui_native__theme_native__theme.h
electron32/patches/patch-ui_native__theme_native__theme__base.cc
electron32/patches/patch-ui_native__theme_native__theme__features.cc
electron32/patches/patch-ui_native__theme_native__theme__win.cc
electron32/patches/patch-ui_ozone_common_egl__util.cc
electron32/patches/patch-ui_ozone_common_features.cc
electron32/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc
electron32/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc
electron32/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc
electron32/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc
electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc
electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h
electron32/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.h
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h
electron32/patches/patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__impl.cc
electron32/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc
electron32/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc
electron32/patches/patch-ui_ozone_platform_x11_BUILD.gn
electron32/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc
electron32/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc
electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc
electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h
electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc
electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h
electron32/patches/patch-ui_ozone_platform_x11_x11__window.cc
electron32/patches/patch-ui_ozone_public_ozone__platform.h
electron32/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h
electron32/patches/patch-ui_ozone_test_mock__platform__window__delegate.h
electron32/patches/patch-ui_platform__window_platform__window__delegate.cc
electron32/patches/patch-ui_platform__window_platform__window__delegate.h
electron32/patches/patch-ui_platform__window_platform__window__init__properties.h
electron32/patches/patch-ui_qt_BUILD.gn
electron32/patches/patch-ui_qt_qt.gni
electron32/patches/patch-ui_shell__dialogs_select__file__dialog.h
electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc
electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h
electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc
electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h
electron32/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__th.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb
electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb
electron32/patches/patch-ui_strings_ui__strings.grd
electron32/patches/patch-ui_views_BUILD.gn
electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h
electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
electron32/patches/patch-ui_views_controls_menu_menu__controller.cc
electron32/patches/patch-ui_views_controls_menu_menu__controller.h
electron32/patches/patch-ui_views_controls_menu_menu__runner.cc
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.cc
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h
electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm
electron32/patches/patch-ui_views_controls_prefix__selector.cc
electron32/patches/patch-ui_views_controls_prefix__selector.h
electron32/patches/patch-ui_views_controls_textfield_textfield.cc
electron32/patches/patch-ui_views_controls_textfield_textfield.h
electron32/patches/patch-ui_views_controls_webview_BUILD.gn
electron32/patches/patch-ui_views_controls_webview_web__dialog__view.cc
electron32/patches/patch-ui_views_controls_webview_web__dialog__view.h
electron32/patches/patch-ui_views_corewm_tooltip__aura.cc
electron32/patches/patch-ui_views_examples_widget__example.cc
electron32/patches/patch-ui_views_focus_focus__manager.cc
electron32/patches/patch-ui_views_style_platform__style.cc
electron32/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc
electron32/patches/patch-ui_views_views__delegate.cc
electron32/patches/patch-ui_views_views__delegate.h
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc
electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h
electron32/patches/patch-ui_views_widget_root__view.cc
electron32/patches/patch-ui_views_widget_widget.cc
electron32/patches/patch-ui_views_win_hwnd__message__handler.cc
electron32/patches/patch-ui_views_win_hwnd__message__handler__delegate.h
electron32/patches/patch-ui_views_window_custom__frame__view.cc
electron32/patches/patch-ui_views_window_dialog__delegate.cc
electron32/patches/patch-ui_views_window_frame__background.cc
electron32/patches/patch-ui_views_window_frame__caption__button.cc
electron32/patches/patch-ui_views_window_frame__caption__button.h
electron32/patches/patch-url_url__util.cc
electron32/patches/patch-url_url__util.h
electron32/patches/patch-v8_BUILD.gn
electron32/patches/patch-v8_include_v8-internal.h
electron32/patches/patch-v8_include_v8-microtask-queue.h
electron32/patches/patch-v8_include_v8-object.h
electron32/patches/patch-v8_include_v8config.h
electron32/patches/patch-v8_src_api_api.cc
electron32/patches/patch-v8_src_base_atomicops.h
electron32/patches/patch-v8_src_base_platform_memory.h
electron32/patches/patch-v8_src_base_platform_platform-freebsd.cc
electron32/patches/patch-v8_src_base_platform_platform-openbsd.cc
electron32/patches/patch-v8_src_base_platform_platform-posix.cc
electron32/patches/patch-v8_src_base_small-vector.h
electron32/patches/patch-v8_src_base_strings.h
electron32/patches/patch-v8_src_base_sys-info.cc
electron32/patches/patch-v8_src_base_utils_random-number-generator.cc
electron32/patches/patch-v8_src_compiler_access-info.cc
electron32/patches/patch-v8_src_compiler_heap-refs.cc
electron32/patches/patch-v8_src_compiler_js-call-reducer.cc
electron32/patches/patch-v8_src_compiler_js-native-context-specialization.cc
electron32/patches/patch-v8_src_diagnostics_perf-jit.cc
electron32/patches/patch-v8_src_diagnostics_perf-jit.h
electron32/patches/patch-v8_src_execution_isolate.cc
electron32/patches/patch-v8_src_execution_microtask-queue.h
electron32/patches/patch-v8_src_flags_flags.cc
electron32/patches/patch-v8_src_maglev_maglev-graph-builder.cc
electron32/patches/patch-v8_src_runtime_runtime-wasm.cc
electron32/patches/patch-v8_src_sandbox_sandbox.cc
electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc
electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h
electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc
electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.cc
electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.h
electron32/patches/patch-v8_src_trap-handler_trap-handler.h
electron32/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h
electron32/patches/patch-v8_src_wasm_wasm-js.cc
electron32/patches/patch-v8_test_mjsunit_regress_wasm_regress-366635354.js
electron32/patches/patch-v8_test_mjsunit_wasm_regress-367818758.js
electron32/patches/patch-v8_tools_run-paxctl.py
electron32/patches/patch-v8_tools_run.py
Log Message:
electron32: import package
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=4d8192863ea7ec1c150f6d8b256df5004af35355
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
Makefile | 1 +
electron32/DESCR | 3 +
electron32/Makefile | 401 ++++
electron32/PLIST | 141 ++
electron32/TODO | 4 +
electron32/distinfo | 2170 ++++++++++++++++++++
electron32/options.mk | 63 +
electron32/patches/patch-.gitignore | 16 +
electron32/patches/patch-.gn | 17 +
electron32/patches/patch-BUILD.gn | 114 +
...patch-apps_ui_views_app__window__frame__view.cc | 17 +
...patch-ash_display_mirror__window__controller.cc | 20 +
electron32/patches/patch-base_BUILD.gn | 187 ++
.../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 +
...artition__allocator_src_partition__alloc_oom.cc | 62 +
...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 | 26 +
..._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 +
electron32/patches/patch-base_atomicops.h | 20 +
.../patches/patch-base_base__paths__posix.cc | 128 ++
electron32/patches/patch-base_compiler__specific.h | 18 +
.../patches/patch-base_debug_debugger__posix.cc | 106 +
electron32/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 | 30 +
electron32/patches/patch-base_features.cc | 34 +
.../patches/patch-base_files_dir__reader__linux.h | 45 +
.../patches/patch-base_files_dir__reader__posix.h | 26 +
.../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 +
electron32/patches/patch-base_i18n_icu__util.cc | 26 +
electron32/patches/patch-base_linux__util.cc | 23 +
electron32/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 +
...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 +
electron32/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 +
electron32/patches/patch-base_process_kill.h | 17 +
.../patches/patch-base_process_kill__posix.cc | 17 +
electron32/patches/patch-base_process_launch.h | 17 +
.../patches/patch-base_process_launch__mac.cc | 64 +
.../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 | 30 +
.../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 | 309 +++
.../patch-base_process_process__metrics__netbsd.cc | 184 ++
...patch-base_process_process__metrics__openbsd.cc | 240 +++
.../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 +
electron32/patches/patch-base_rand__util.h | 17 +
electron32/patches/patch-base_rand__util__posix.cc | 68 +
.../patch-base_strings_safe__sprintf__unittest.cc | 24 +
.../patch-base_synchronization_lock__impl.h | 29 +
electron32/patches/patch-base_syslog__logging.cc | 26 +
electron32/patches/patch-base_system_sys__info.cc | 17 +
electron32/patches/patch-base_system_sys__info.h | 26 +
.../patch-base_system_sys__info__freebsd.cc | 121 ++
.../patches/patch-base_system_sys__info__netbsd.cc | 100 +
.../patch-base_system_sys__info__openbsd.cc | 97 +
.../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 +
.../patches/patch-base_threading_hang__watcher.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 +
.../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 +
electron32/patches/patch-build_config_BUILD.gn | 19 +
.../patches/patch-build_config_BUILDCONFIG.gn | 64 +
.../patches/patch-build_config_clang_BUILD.gn | 17 +
.../patches/patch-build_config_compiler_BUILD.gn | 144 ++
.../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 +
.../patches/patch-build_config_linux_pkg-config.py | 17 +
electron32/patches/patch-build_config_ozone.gni | 29 +
electron32/patches/patch-build_config_rust.gni | 19 +
.../patches/patch-build_config_v8__target__cpu.gni | 19 +
.../patches/patch-build_detect__host__arch.py | 17 +
electron32/patches/patch-build_gn__run__binary.py | 17 +
electron32/patches/patch-build_linux_chrome.map | 19 +
.../patches/patch-build_linux_strip__binary.py | 16 +
.../patches/patch-build_linux_unbundle_icu.gn | 24 +
.../patches/patch-build_linux_unbundle_libevent.gn | 21 +
.../patches/patch-build_linux_unbundle_libusb.gn | 36 +
.../patches/patch-build_rust_rust__bindgen.gni | 25 +
electron32/patches/patch-build_rust_std_BUILD.gn | 16 +
.../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 +
electron32/patches/patch-cc_BUILD.gn | 25 +
electron32/patches/patch-cc_base_features.cc | 17 +
electron32/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 | 158 ++
electron32/patches/patch-chrome_browser_BUILD.gn | 31 +
.../patches/patch-chrome_browser_about__flags.cc | 299 +++
...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 | 26 +
.../patch-chrome_browser_browser__process__impl.cc | 35 +
.../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 | 95 +
.../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 | 167 ++
...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 +
...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 | 53 +
...nectors_reporting_realtime__reporting__client.h | 26 +
...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 +
.../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 | 44 +
...__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 | 26 +
...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 | 139 ++
...me__file__system__access__permission__context.h | 162 ++
...-chrome_browser_first__run_first__run__dialog.h | 17 +
...hrome_browser_first__run_first__run__internal.h | 17 +
.../patch-chrome_browser_flag__descriptions.cc | 134 ++
.../patch-chrome_browser_flag__descriptions.h | 124 ++
...e_browser_gcm_gcm__profile__service__factory.cc | 26 +
...__id_instance__id__profile__service__factory.cc | 26 +
...tch-chrome_browser_global__desktop__features.cc | 25 +
...atch-chrome_browser_global__desktop__features.h | 44 +
...chrome_browser_headless_headless__mode__util.cc | 26 +
...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 | 26 +
...chrome__browser__main__extra__parts__metrics.cc | 61 +
..._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 | 65 +
...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 | 260 +++
...y_device__management__service__configuration.cc | 26 +
...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 | 59 +
...tch-chrome_browser_process__singleton__posix.cc | 238 +++
...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 | 41 +
...atch-chrome_browser_profiles_profiles__state.cc | 35 +
...per__isolated__file__system__message__filter.cc | 107 +
...pper__isolated__file__system__message__filter.h | 50 +
...h-chrome_browser_renderer__preferences__util.cc | 35 +
...tch-chrome_browser_resources_pdf_pdf__viewer.ts | 56 +
...s_settings_autofill__page_passwords__shared.css | 17 +
...ome_browser_resources_signin_signin__shared.css | 17 +
...d__content__scanning_binary__upload__service.cc | 26 +
...oud__content__scanning_deep__scanning__utils.cc | 26 +
...dent__reporting_incident__reporting__service.cc | 17 +
...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 +
...rowser_sharing_sharing__device__registration.cc | 17 +
...ser_sharing_sharing__handler__registry__impl.cc | 26 +
...patch-chrome_browser_shortcuts_icon__badging.cc | 17 +
.../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 +
...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 +
...tch-chrome_browser_sync_chrome__sync__client.cc | 53 +
...rowser_sync_device__info__sync__client__impl.cc | 17 +
...h-chrome_browser_sync_sync__service__factory.cc | 35 +
...oup__sync_tab__group__sync__service__factory.cc | 17 +
...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 +
...h-chrome_browser_ui_ash_ash__web__view__impl.cc | 21 +
...ch-chrome_browser_ui_ash_ash__web__view__impl.h | 18 +
...ash_keyboard_chrome__keyboard__web__contents.cc | 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 +
...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 +
...wser_ui_task__manager_task__manager__columns.cc | 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 | 35 +
...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 | 22 +
...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 | 53 +
..._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 | 34 +
..._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 +
..._browser_ui_views_tabs_tab__drag__controller.cc | 62 +
...ui_views_tabs_tab__hover__card__bubble__view.cc | 17 +
...rome_browser_ui_views_tabs_tab__style__views.cc | 17 +
..._education_browser__user__education__service.cc | 17 +
...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 | 26 +
...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 +
...icate__manager_certificate__manager__handler.cc | 17 +
...i_certificate__manager_client__cert__sources.cc | 35 +
...ui_certificate__manager_client__cert__sources.h | 17 +
...i_webui_chrome__web__ui__controller__factory.cc | 120 ++
...i_connectors__internals_device__trust__utils.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 | 35 +
...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 | 17 +
...hrome_browser_ui_window__sizer_window__sizer.cc | 17 +
...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 | 62 +
.../patches/patch-chrome_common_chrome__features.h | 51 +
.../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 | 25 +
.../patches/patch-chrome_common_chrome__switches.h | 23 +
...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 +
...pper_chrome__renderer__pepper__host__factory.cc | 34 +
.../patch-chrome_renderer_pepper_pepper__helper.h | 23 +
...vices_printing_print__backend__service__impl.cc | 53 +
...services_speech_audio__source__fetcher__impl.cc | 17 +
electron32/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 +
.../patches/patch-chrome_updater_configurator.cc | 17 +
electron32/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 +
...utofill_core_browser_payments__data__manager.cc | 17 +
...ents_autofill_core_common_autofill__features.cc | 17 +
...ill_core_common_autofill__payments__features.cc | 26 +
...fill_core_common_autofill__payments__features.h | 17 +
...onents_commerce_core_commerce__feature__list.cc | 26 +
...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 +
...ents_metrics_drive__metrics__provider__linux.cc | 22 +
.../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 +
...rator_browser_network__session__configurator.cc | 17 +
...ser_network__session__configurator__unittest.cc | 17 +
...kground__loader_background__loader__contents.cc | 18 +
...ckground__loader_background__loader__contents.h | 18 +
...zation__guide_core_optimization__guide__util.cc | 17 +
.../patch-components_os__crypt_sync_BUILD.gn | 16 +
...nents_os__crypt_sync_keychain__password__mac.mm | 92 +
...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 | 17 +
...core_browser_password__manual__fallback__flow.h | 26 +
...core_browser_password__store_login__database.cc | 26 +
...ssword__store_login__database__async__helper.cc | 17 +
...er_password__store_login__database__unittest.cc | 17 +
...d__store_password__store__built__in__backend.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 +
...mponents_performance__manager_public_features.h | 17 +
...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 +
...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 | 168 ++
...rinting_renderer_print__render__frame__helper.h | 47 +
...tch-components_remote__cocoa_app__shim_BUILD.gn | 16 +
..._remote__cocoa_app__shim_application__bridge.mm | 36 +
...p__shim_browser__native__widget__window__mac.mm | 39 +
...him_native__widget__mac__frameless__nswindow.mm | 37 +
...cocoa_app__shim_native__widget__mac__nswindow.h | 24 +
...ocoa_app__shim_native__widget__mac__nswindow.mm | 63 +
...app__shim_native__widget__ns__window__bridge.mm | 21 +
...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 | 26 +
...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 +
...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 +
..._user_core_browser_supervised__user__service.cc | 17 +
...onents_supervised__user_core_common_features.cc | 51 +
...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_common_features.cc | 26 +
.../patches/patch-components_viz_common_features.h | 26 +
...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 | 66 +
...lay__embedder_output__surface__provider__impl.h | 28 +
...embedder_skia__output__device__buffer__queue.cc | 17 +
...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 +
electron32/patches/patch-content_app_BUILD.gn | 21 +
...emote__cocoa_ns__view__bridge__factory__impl.mm | 47 +
...ote__cocoa_render__widget__host__view__cocoa.mm | 78 +
.../patches/patch-content_app_content__main.cc | 51 +
...atch-content_app_content__main__runner__impl.cc | 194 ++
electron32/patches/patch-content_browser_BUILD.gn | 59 +
...ibility_browser__accessibility__manager__mac.mm | 50 +
.../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 | 57 +
...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 | 252 +++
...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 +
...i__plugin__process__host__receiver__bindings.cc | 26 +
...ugin__sandboxed__process__launcher__delegate.cc | 26 +
...owser_renderer__host_code__cache__host__impl.cc | 124 ++
...rowser_renderer__host_delegated__frame__host.cc | 17 +
...__host_input_input__device__change__observer.cc | 35 +
...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 +
...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 | 86 +
...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 | 40 +
...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 | 30 +
...nderer__host_render__widget__host__view__mac.mm | 82 +
...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 | 62 +
...ce__worker_service__worker__context__wrapper.cc | 57 +
.../patch-content_browser_site__instance__impl.cc | 17 +
...patch-content_browser_utility__process__host.cc | 161 ++
.../patch-content_browser_utility__process__host.h | 99 +
...r_utility__process__host__receiver__bindings.cc | 39 +
...h-content_browser_utility__sandbox__delegate.cc | 78 +
...ch-content_browser_utility__sandbox__delegate.h | 55 +
.../patch-content_browser_v8__snapshot__files.cc | 17 +
...nt_browser_web__contents_web__contents__impl.cc | 134 ++
...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 +
electron32/patches/patch-content_child_BUILD.gn | 22 +
.../patches/patch-content_child_child__process.cc | 35 +
.../patches/patch-content_child_child__process.h | 17 +
electron32/patches/patch-content_common_BUILD.gn | 50 +
.../patches/patch-content_common_features.cc | 26 +
electron32/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 +
...-content_common_mojo__core__library__support.cc | 17 +
.../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 +
electron32/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 | 27 +
...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 | 63 +
...content_public_browser_service__process__host.h | 79 +
...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 +
.../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 | 28 +
...common_sandboxed__process__launcher__delegate.h | 33 +
...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 +
electron32/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 | 36 +
.../patch-content_renderer_theme__helper__mac.mm | 40 +
electron32/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 +
electron32/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 | 105 +
...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 | 134 ++
.../patch-content_utility_utility__thread__impl.cc | 27 +
.../patches/patch-content_web__test_BUILD.gn | 17 +
..._browser_web__test__content__browser__client.cc | 17 +
...t_browser_web__test__content__browser__client.h | 17 +
electron32/patches/patch-content_zygote_BUILD.gn | 17 +
.../patches/patch-content_zygote_zygote__linux.cc | 21 +
.../patch-content_zygote_zygote__main__linux.cc | 64 +
electron32/patches/patch-device_bluetooth_BUILD.gn | 16 +
.../patch-device_bluetooth_bluetooth__adapter.cc | 17 +
...tch-device_bluetooth_bluetooth__adapter__mac.mm | 48 +
.../patch-device_bluetooth_cast__bluetooth.gni | 15 +
.../patch-device_fido_fido__discovery__factory.cc | 17 +
electron32/patches/patch-device_gamepad_BUILD.gn | 17 +
.../patch-device_gamepad_gamepad__provider.cc | 17 +
.../patch-device_gamepad_hid__writer__linux.cc | 17 +
electron32/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 | 18 +
electron32/patches/patch-electron_filenames.gni | 19 +
.../patches/patch-electron_lib_browser_api_app.ts | 18 +
.../patch-electron_lib_browser_api_dialog.ts | 18 +
...tch-electron_lib_browser_api_menu-item-roles.ts | 18 +
...patch-electron_lib_browser_api_power-monitor.ts | 18 +
.../patches/patch-electron_lib_browser_init.ts | 18 +
.../patch-electron_lib_browser_rpc-server.ts | 17 +
.../patch-electron_lib_renderer_api_clipboard.ts | 18 +
.../patches/patch-electron_script_lib_config.py | 20 +
.../patches/patch-electron_script_lib_utils.js | 17 +
.../patches/patch-electron_script_spec-runner.js | 18 +
..._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 | 67 +
...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 | 17 +
...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 | 206 ++
...-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 +
...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 +
...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 +
.../patches/patch-electron_spec_api-app-spec.ts | 147 ++
.../patch-electron_spec_api-browser-window-spec.ts | 198 ++
.../patch-electron_spec_api-clipboard-spec.ts | 38 +
...patch-electron_spec_api-content-tracing-spec.ts | 18 +
.../patch-electron_spec_api-crash-reporter-spec.ts | 68 +
...atch-electron_spec_api-desktop-capturer-spec.ts | 58 +
.../patches/patch-electron_spec_api-menu-spec.ts | 18 +
.../patch-electron_spec_api-native-image-spec.ts | 18 +
.../patch-electron_spec_api-net-log-spec.ts | 38 +
...tch-electron_spec_api-notification-dbus-spec.ts | 18 +
.../patch-electron_spec_api-power-monitor-spec.ts | 18 +
.../patch-electron_spec_api-process-spec.ts | 28 +
.../patch-electron_spec_api-protocol-spec.ts | 18 +
.../patch-electron_spec_api-safe-storage-spec.ts | 28 +
.../patches/patch-electron_spec_api-screen-spec.ts | 38 +
.../patches/patch-electron_spec_api-shell-spec.ts | 30 +
.../patch-electron_spec_api-subframe-spec.ts | 18 +
.../patches/patch-electron_spec_api-tray-spec.ts | 18 +
...patch-electron_spec_api-utility-process-spec.ts | 28 +
.../patch-electron_spec_api-web-frame-main-spec.ts | 18 +
.../patches/patch-electron_spec_chromium-spec.ts | 66 +
.../patches/patch-electron_spec_crash-spec.ts | 18 +
...c_fixtures_api_safe-storage_decrypt-app_main.js | 18 +
...c_fixtures_api_safe-storage_encrypt-app_main.js | 18 +
...spec_fixtures_crash-cases_safe-storage_index.js | 18 +
...n_spec_fixtures_native-addon_uv-dlopen_index.js | 17 +
.../patches/patch-electron_spec_node-spec.ts | 18 +
.../patch-electron_spec_version-bump-spec.ts | 18 +
.../patch-electron_spec_visibility-state-spec.ts | 18 +
.../patches/patch-electron_spec_webview-spec.ts | 18 +
..._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 | 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 | 17 +
..._shell_browser_shell__extensions__api__client.h | 26 +
...h-fuchsia__web_webengine_browser_frame__impl.cc | 18 +
...ch-fuchsia__web_webengine_browser_frame__impl.h | 18 +
electron32/patches/patch-gin_converter.cc | 37 +
electron32/patches/patch-gin_converter.h | 24 +
electron32/patches/patch-gin_isolate__holder.cc | 60 +
.../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 | 38 +
electron32/patches/patch-gin_public_v8__platform.h | 16 +
electron32/patches/patch-gin_v8__initializer.cc | 58 +
electron32/patches/patch-gin_v8__initializer.h | 34 +
electron32/patches/patch-gin_v8__platform.cc | 19 +
...h-google__apis_gcm_engine_heartbeat__manager.cc | 35 +
.../patch-google__apis_google__api__keys-inc.cc | 29 +
...mand__buffer_service_dawn__context__provider.cc | 17 +
..._command__buffer_service_gles2__cmd__decoder.cc | 17 +
...image_angle__vulkan__image__backing__factory.cc | 17 +
...e_shared__image_external__vk__image__backing.cc | 26 +
...service_shared__image_shared__image__factory.cc | 17 +
...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 | 26 +
.../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 +
electron32/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 +
...rvice_image__transport__surface__overlay__mac.h | 18 +
electron32/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 +
...ib_browser_headless__content__browser__client.h | 17 +
..._browser_headless__request__context__manager.cc | 17 +
...ss_lib_browser_headless__web__contents__impl.cc | 27 +
...adless_lib_headless__content__main__delegate.cc | 17 +
electron32/patches/patch-ipc_ipc__channel.h | 17 +
.../patches/patch-ipc_ipc__channel__common.cc | 17 +
electron32/patches/patch-ipc_ipc__channel__mojo.cc | 17 +
.../patches/patch-ipc_ipc__message__utils.cc | 17 +
electron32/patches/patch-ipc_ipc__message__utils.h | 17 +
electron32/patches/patch-media_BUILD.gn | 18 +
electron32/patches/patch-media_audio_BUILD.gn | 42 +
.../patch-media_audio_alsa_audio__manager__alsa.cc | 60 +
...media_audio_apple_audio__low__latency__input.cc | 32 +
.../patch-media_audio_audio__input__device.cc | 17 +
...h-media_audio_audio__output__proxy__unittest.cc | 20 +
.../patch-media_audio_mac_audio__manager__mac.cc | 17 +
.../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 | 147 ++
.../patches/patch-media_base_media__switches.h | 72 +
...ch-media_base_user__input__monitor__unittest.cc | 35 +
.../patches/patch-media_base_video__frame.cc | 53 +
electron32/patches/patch-media_base_video__frame.h | 53 +
.../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 | 98 +
...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 | 52 +
...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 +
...gpu_chromeos_native__pixmap__frame__resource.cc | 17 +
...a_gpu_chromeos_platform__video__frame__utils.cc | 35 +
...-media_gpu_chromeos_video__decoder__pipeline.cc | 35 +
...gpu_gpu__video__encode__accelerator__factory.cc | 17 +
...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 +
.../patch-media_gpu_vaapi_vaapi__video__decoder.cc | 17 +
.../patch-media_gpu_vaapi_vaapi__wrapper.cc | 17 +
electron32/patches/patch-media_media__options.gni | 25 +
.../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 +
...ia_video_video__encode__accelerator__adapter.cc | 26 +
...eo_video__encode__accelerator__adapter__test.cc | 17 +
.../patches/patch-media_webrtc_audio__processor.cc | 17 +
electron32/patches/patch-media_webrtc_helpers.cc | 25 +
.../patch-media_webrtc_helpers__unittests.cc | 44 +
electron32/patches/patch-mojo_core_BUILD.gn | 17 +
electron32/patches/patch-mojo_core_channel.cc | 20 +
.../patches/patch-mojo_core_embedder_features.h | 17 +
.../patches/patch-mojo_public_c_system_thunks.cc | 44 +
...ojo_public_cpp_platform_socket__utils__posix.cc | 17 +
.../patch-mojo_public_tools_bindings_mojom.gni | 30 +
electron32/patches/patch-net_BUILD.gn | 101 +
electron32/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 +
...net_disk__cache_simple_simple__file__tracker.cc | 26 +
electron32/patches/patch-net_dns_BUILD.gn | 58 +
electron32/patches/patch-net_dns_address__info.cc | 22 +
.../patch-net_dns_address__sorter__posix.cc | 16 +
.../patch-net_dns_dns__config__service__posix.cc | 42 +
electron32/patches/patch-net_dns_dns__reloader.cc | 25 +
electron32/patches/patch-net_dns_dns__util.cc | 17 +
.../patches/patch-net_dns_host__resolver__proc.cc | 19 +
electron32/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 +
.../patches/patch-ppapi_buildflags_buildflags.gni | 17 +
electron32/patches/patch-ppapi_tests_test__utils.h | 27 +
.../patch-printing_backend_cups__ipp__helper.cc | 17 +
.../patch-printing_backend_print__backend__cups.cc | 26 +
...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 +
.../patch-remoting_client_display_sys__opengl.h | 17 +
...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 +
...-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 | 175 ++
.../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 +
electron32/patches/patch-sandbox_BUILD.gn | 17 +
electron32/patches/patch-sandbox_features.gni | 17 +
electron32/patches/patch-sandbox_linux_BUILD.gn | 41 +
...sandbox_linux_services_init__process__reaper.cc | 21 +
...tch-sandbox_linux_services_libc__interceptor.cc | 27 +
electron32/patches/patch-sandbox_mac_BUILD.gn | 32 +
.../patches/patch-sandbox_mac_sandbox__compiler.cc | 26 +
.../patches/patch-sandbox_mac_sandbox__logging.cc | 32 +
electron32/patches/patch-sandbox_mac_seatbelt.cc | 169 ++
.../patch-sandbox_mac_seatbelt__extension.cc | 63 +
.../patches/patch-sandbox_mac_system__services.cc | 43 +
electron32/patches/patch-sandbox_policy_BUILD.gn | 56 +
.../patches/patch-sandbox_policy_features.cc | 29 +
electron32/patches/patch-sandbox_policy_features.h | 17 +
...atch-sandbox_policy_freebsd_sandbox__freebsd.cc | 254 +++
...patch-sandbox_policy_freebsd_sandbox__freebsd.h | 287 +++
.../patch-sandbox_policy_mac_sandbox__mac.mm | 19 +
.../patch-sandbox_policy_mojom_sandbox.mojom | 24 +
.../patch-sandbox_policy_netbsd_sandbox__netbsd.cc | 254 +++
.../patch-sandbox_policy_netbsd_sandbox__netbsd.h | 287 +++
...atch-sandbox_policy_openbsd_sandbox__openbsd.cc | 433 ++++
...patch-sandbox_policy_openbsd_sandbox__openbsd.h | 291 +++
electron32/patches/patch-sandbox_policy_sandbox.cc | 28 +
electron32/patches/patch-sandbox_policy_sandbox.h | 32 +
.../patches/patch-sandbox_policy_sandbox__type.cc | 121 ++
.../patches/patch-sandbox_policy_switches.cc | 32 +
electron32/patches/patch-sandbox_policy_switches.h | 31 +
.../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 +
electron32/patches/patch-services_device_BUILD.gn | 17 +
...vice_geolocation_location__provider__manager.cc | 17 +
.../patches/patch-services_device_hid_BUILD.gn | 43 +
...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 | 36 +
...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 +
...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 +
electron32/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 | 45 +
.../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 +
...video__capture_video__capture__service__impl.cc | 44 +
..._video__capture_video__capture__service__impl.h | 35 +
...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 +
electron32/patches/patch-skia_ext_font__utils.cc | 26 +
.../patches/patch-skia_ext_platform__canvas.h | 17 +
.../patches/patch-skia_ext_skcolorspace__trfn.cc | 17 +
electron32/patches/patch-third__party_.gitignore | 34 +
...atch-third__party_abseil-cpp_absl_base_config.h | 27 +
...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 | 53 +
...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 +
...erences_renderer__preferences__mojom__traits.cc | 17 +
..._preferences_web__preferences__mojom__traits.cc | 28 +
...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 +
...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 +
...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 +
..._renderer_core_css_font__face__set__document.cc | 51 +
...rd__party_blink_renderer_core_editing_build.gni | 24 +
...link_renderer_core_editing_editing__behavior.cc | 17 +
...link_renderer_core_editing_ime_edit__context.cc | 85 +
...blink_renderer_core_editing_ime_edit__context.h | 43 +
...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 | 91 +
..._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 +
...nderer_core_html_parser_html__srcset__parser.cc | 19 +
...erer_core_inspector_inspector__memory__agent.cc | 17 +
...rer_core_inspector_inspector__network__agent.cc | 18 +
...nderer_core_inspector_inspector__page__agent.cc | 18 +
...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 +
...rty_blink_renderer_core_loader_image__loader.cc | 18 +
...e_loader_modulescript_module__script__loader.cc | 30 +
...party_blink_renderer_core_paint_paint__layer.cc | 17 +
...uler__integration__tests_virtual__time__test.cc | 16 +
..._renderer_core_scroll_scrollbar__theme__aura.cc | 26 +
..._party_blink_renderer_core_testing_internals.cc | 30 +
...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 +
...peerconnection_webrtc__audio__renderer__test.cc | 17 +
...odules_serial_serial__port__underlying__sink.cc | 19 +
...modules_serial_serial__port__underlying__sink.h | 25 +
...ules_serial_serial__port__underlying__source.cc | 19 +
...dules_serial_serial__port__underlying__source.h | 33 +
...odules_webaudio_audio__worklet__thread__test.cc | 17 +
...odules_webgl_webgl__rendering__context__base.cc | 17 +
...rty_blink_renderer_modules_webgpu_gpu__queue.cc | 17 +
..._modules_websockets_websocket__channel__impl.cc | 38 +
...h-third__party_blink_renderer_platform_BUILD.gn | 17 +
...ink_renderer_platform_bindings_script__state.cc | 37 +
...link_renderer_platform_bindings_script__state.h | 38 +
...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 +
...er_platform_graphics_video__frame__submitter.cc | 17 +
...ion_partition__alloc__memory__dump__provider.cc | 34 +
...erer_platform_loader_fetch_resource__fetcher.cc | 55 +
...derer_platform_loader_fetch_resource__fetcher.h | 21 +
...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 | 71 +
...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 +
..._renderer_platform_wtf_text_text__codec__icu.cc | 24 +
.../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 +
...oringssl_src_crypto_fipsmodule_digest_digests.c | 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 +
...n_src_tint_lang_core_ir_transform_robustness.cc | 24 +
...tint_lang_core_ir_transform_robustness__test.cc | 339 +++
...int_lang_spirv_writer_texture__builtin__test.cc | 31 +
...ver_address__space__layout__validation__test.cc | 137 ++
...y_dawn_src_tint_lang_wgsl_resolver_validator.cc | 31 +
...arty_dawn_test_tint_bug_chromium_378541479.wgsl | 19 +
...t_bug_chromium_378541479.wgsl.expected.dxc.hlsl | 22 +
...t_bug_chromium_378541479.wgsl.expected.fxc.hlsl | 22 +
..._tint_bug_chromium_378541479.wgsl.expected.glsl | 36 +
...ug_chromium_378541479.wgsl.expected.ir.dxc.hlsl | 31 +
...ug_chromium_378541479.wgsl.expected.ir.fxc.hlsl | 31 +
...int_bug_chromium_378541479.wgsl.expected.ir.msl | 26 +
...t_tint_bug_chromium_378541479.wgsl.expected.msl | 18 +
...int_bug_chromium_378541479.wgsl.expected.spvasm | 79 +
..._tint_bug_chromium_378541479.wgsl.expected.wgsl | 19 +
...__party_dawn_webgpu-cts_compat-expectations.txt | 19 +
...h-third__party_dawn_webgpu-cts_expectations.txt | 19 +
...end_src_front__end_entrypoints_main_MainImpl.ts | 17 +
.../patch-third__party_electron__node_BUILD.gn | 426 ++++
.../patch-third__party_electron__node_common.gypi | 91 +
.../patch-third__party_electron__node_configure.py | 16 +
...h-third__party_electron__node_deps_ada_BUILD.gn | 31 +
...party_electron__node_deps_base64_unofficial.gni | 82 +
...third__party_electron__node_deps_cares_BUILD.gn | 210 ++
...electron__node_deps_cares_include_ares__build.h | 19 +
...__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 | 238 +++
..._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 +
...hird__party_electron__node_deps_uvwasi_BUILD.gn | 59 +
...-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 | 69 +
...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 +
...rd__party_electron__node_src_api_environment.cc | 44 +
...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 +
...rd__party_electron__node_src_inspector_BUILD.gn | 228 ++
...third__party_electron__node_src_module__wrap.cc | 96 +
...-third__party_electron__node_src_module__wrap.h | 49 +
.../patch-third__party_electron__node_src_node.h | 71 +
...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 | 431 ++++
...rd__party_electron__node_src_node__contextify.h | 76 +
...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 | 35 +
...third__party_electron__node_src_node__options.h | 17 +
...ird__party_electron__node_src_node__platform.cc | 96 +
...hird__party_electron__node_src_node__platform.h | 66 +
...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 +
...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 +
...ty_electron__node_test_common_assertSnapshot.js | 16 +
...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 +
..._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 +
..._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 | 38 +
..._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 +
...parallel_test-crypto-private-decrypt-gh32240.js | 17 +
...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 | 89 +
...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-console.mjs | 16 +
..._node_test_parallel_test-node-output-errors.mjs | 37 +
...e_test_parallel_test-node-output-v8-warning.mjs | 40 +
...e_test_parallel_test-tls-getcertificate-x509.js | 31 +
...ron__node_test_parallel_test-tls-getprotocol.js | 17 +
...ron__node_test_parallel_test-tls-write-error.js | 17 +
..._electron__node_test_parallel_test-v8-serdes.js | 31 +
...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 +
...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 +
...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 | 18 +
...libc++_src_src_filesystem_filesystem__clock.cpp | 18 +
...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_C_CpuArch.c | 50 +
...ial__color__utilities_src_cpp_palettes_tones.cc | 17 +
electron32/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 +
electron32/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 | 29 +
...-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 +
...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 | 32 +
...ce__processor_importers_ftrace_v4l2__tracker.cc | 62 +
...y_perfetto_src_tracing_core_clock__snapshots.cc | 18 +
...-third__party_perfetto_src_tracing_ipc_memfd.cc | 18 +
...atch-third__party_perfetto_src_tracing_track.cc | 17 +
...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 +
..._src_sksl_codegen_SkSLRasterPipelineBuilder.cpp | 77 +
...ia_src_sksl_codegen_SkSLRasterPipelineBuilder.h | 25 +
..._skia_tests_RasterPipelineCodeGeneratorTest.cpp | 97 +
...__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 +
..._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 | 120 ++
...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 | 21 +
...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_crypt.cpp | 17 +
...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 +
...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 +
electron32/patches/patch-tools_gn_build_gen.py | 40 +
.../patch-tools_gn_src_base_files_file__posix.cc | 17 +
electron32/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 | 46 +
...atch-tools_variations_fieldtrial__to__struct.py | 18 +
.../patch-ui_accelerated__widget__mac_BUILD.gn | 17 +
...ted__widget__mac_ca__layer__tree__coordinator.h | 28 +
...ed__widget__mac_ca__layer__tree__coordinator.mm | 38 +
...erated__widget__mac_display__ca__layer__tree.mm | 26 +
.../patch-ui_accessibility_platform_BUILD.gn | 16 +
...sibility_platform_inspect_ax__transform__mac.mm | 24 +
.../patch-ui_aura_client_drag__drop__client.h | 17 +
electron32/patches/patch-ui_aura_screen__ozone.cc | 17 +
electron32/patches/patch-ui_aura_screen__ozone.h | 26 +
electron32/patches/patch-ui_base_BUILD.gn | 30 +
.../patch-ui_base_accelerators_accelerator.cc | 66 +
.../patch-ui_base_accelerators_accelerator.h | 25 +
...h-ui_base_accelerators_accelerator__unittest.cc | 18 +
...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 | 24 +
.../patch-ui_base_cocoa_remote__layer__api.h | 25 +
.../patch-ui_base_cocoa_remote__layer__api.mm | 37 +
.../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_models_simple__menu__model.cc | 45 +
.../patch-ui_base_models_simple__menu__model.h | 42 +
.../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 +
electron32/patches/patch-ui_color_color__id.h | 36 +
.../patch-ui_color_color__provider__utils.cc | 17 +
electron32/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 | 52 +
.../patches/patch-ui_compositor_compositor.h | 85 +
.../patch-ui_compositor_compositor__observer.h | 17 +
electron32/patches/patch-ui_display_BUILD.gn | 19 +
.../patches/patch-ui_display_mac_screen__mac.mm | 26 +
electron32/patches/patch-ui_display_screen.cc | 17 +
electron32/patches/patch-ui_display_screen.h | 26 +
...vents_devices_x11_device__data__manager__x11.cc | 16 +
electron32/patches/patch-ui_events_event.cc | 35 +
.../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 +
electron32/patches/patch-ui_gfx_BUILD.gn | 25 +
.../patches/patch-ui_gfx_ca__layer__params.h | 25 +
electron32/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 +
electron32/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 | 34 +
.../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 +
electron32/patches/patch-ui_gfx_switches.cc | 17 +
electron32/patches/patch-ui_gfx_switches.h | 17 +
.../patch-ui_gfx_x_generated__protos_dri3.cc | 17 +
.../patch-ui_gfx_x_generated__protos_shm.cc | 17 +
electron32/patches/patch-ui_gfx_x_xlib__support.cc | 27 +
electron32/patches/patch-ui_gl_BUILD.gn | 41 +
electron32/patches/patch-ui_gl_gl__context.cc | 17 +
electron32/patches/patch-ui_gl_gl__fence.cc | 17 +
.../patches/patch-ui_gl_gl__implementation.cc | 17 +
electron32/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 +
electron32/patches/patch-ui_gtk_gtk__compat.cc | 68 +
electron32/patches/patch-ui_gtk_gtk__compat.h | 18 +
electron32/patches/patch-ui_gtk_gtk__ui.cc | 24 +
electron32/patches/patch-ui_gtk_gtk__ui.h | 27 +
electron32/patches/patch-ui_gtk_gtk__util.cc | 24 +
.../patch-ui_gtk_printing_print__dialog__gtk.cc | 42 +
...atch-ui_gtk_select__file__dialog__linux__gtk.cc | 87 +
.../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 +
electron32/patches/patch-ui_linux_linux__ui.h | 18 +
...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 +
.../patches/patch-ui_ozone_common_features.cc | 17 +
...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 | 17 +
...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__data__drag__controller.cc | 57 +
..._wayland_host_wayland__data__drag__controller.h | 16 +
...wayland_host_wayland__input__method__context.cc | 17 +
...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 +
...rm_wayland_host_xdg__toplevel__wrapper__impl.cc | 17 +
...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 +
electron32/patches/patch-ui_qt_BUILD.gn | 17 +
electron32/patches/patch-ui_qt_qt.gni | 17 +
.../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 | 17 +
..._dialogs_select__file__dialog__linux__portal.cc | 53 +
...__dialogs_select__file__dialog__linux__portal.h | 17 +
...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 | 20 +
electron32/patches/patch-ui_views_BUILD.gn | 25 +
...s_cocoa_native__widget__mac__ns__window__host.h | 31 +
..._cocoa_native__widget__mac__ns__window__host.mm | 73 +
...atch-ui_views_controls_menu_menu__controller.cc | 56 +
...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 | 16 +
...ws_controls_menu_menu__runner__impl__adapter.cc | 22 +
...ews_controls_menu_menu__runner__impl__adapter.h | 16 +
...views_controls_menu_menu__runner__impl__cocoa.h | 16 +
...iews_controls_menu_menu__runner__impl__cocoa.mm | 16 +
...s_controls_menu_menu__runner__impl__interface.h | 16 +
...i_views_controls_menu_menu__runner__impl__mac.h | 16 +
..._views_controls_menu_menu__runner__impl__mac.mm | 27 +
...ntrols_menu_menu__runner__impl__remote__cocoa.h | 16 +
...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 | 18 +
...-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 +
...e__host__platform__impl__interactive__uitest.cc | 17 +
...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 +
electron32/patches/patch-ui_views_widget_widget.cc | 26 +
.../patch-ui_views_win_hwnd__message__handler.cc | 141 ++
...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 +
electron32/patches/patch-url_url__util.cc | 34 +
electron32/patches/patch-url_url__util.h | 24 +
electron32/patches/patch-v8_BUILD.gn | 139 ++
electron32/patches/patch-v8_include_v8-internal.h | 17 +
.../patches/patch-v8_include_v8-microtask-queue.h | 18 +
electron32/patches/patch-v8_include_v8-object.h | 39 +
electron32/patches/patch-v8_include_v8config.h | 60 +
electron32/patches/patch-v8_src_api_api.cc | 62 +
electron32/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 | 110 +
.../patches/patch-v8_src_base_small-vector.h | 17 +
electron32/patches/patch-v8_src_base_strings.h | 18 +
electron32/patches/patch-v8_src_base_sys-info.cc | 21 +
...ch-v8_src_base_utils_random-number-generator.cc | 17 +
.../patches/patch-v8_src_compiler_access-info.cc | 16 +
.../patches/patch-v8_src_compiler_heap-refs.cc | 16 +
.../patch-v8_src_compiler_js-call-reducer.cc | 24 +
...rc_compiler_js-native-context-specialization.cc | 19 +
.../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 | 47 +
.../patch-v8_src_execution_microtask-queue.h | 21 +
electron32/patches/patch-v8_src_flags_flags.cc | 42 +
.../patch-v8_src_maglev_maglev-graph-builder.cc | 24 +
.../patches/patch-v8_src_runtime_runtime-wasm.cc | 35 +
electron32/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 ++
electron32/patches/patch-v8_src_wasm_wasm-js.cc | 23 +
..._test_mjsunit_regress_wasm_regress-366635354.js | 41 +
...patch-v8_test_mjsunit_wasm_regress-367818758.js | 230 +++
electron32/patches/patch-v8_tools_run-paxctl.py | 25 +
electron32/patches/patch-v8_tools_run.py | 17 +
2142 files changed, 79306 insertions(+)
diffs:
diff --git a/Makefile b/Makefile
index 651f4b3dce..a0ed460b5b 100644
--- a/Makefile
+++ b/Makefile
@@ -818,6 +818,7 @@ SUBDIR+= ekermit
SUBDIR+= eksctl
SUBDIR+= electricsheep
SUBDIR+= electricsheep-git
+SUBDIR+= electron32
SUBDIR+= elegent
SUBDIR+= elementary-calculator
SUBDIR+= elementary-code
diff --git a/electron32/DESCR b/electron32/DESCR
new file mode 100644
index 0000000000..2a86084420
--- /dev/null
+++ b/electron32/DESCR
@@ -0,0 +1,3 @@
+Chromium is an open-source browser project that aims to build a
+safer, faster, and more stable way for all Internet users to
+experience the web.
diff --git a/electron32/Makefile b/electron32/Makefile
new file mode 100644
index 0000000000..1f9665fb7c
--- /dev/null
+++ b/electron32/Makefile
@@ -0,0 +1,401 @@
+# $NetBSD$
+
+DISTNAME= electron32-${VERSION}
+# See ${WRKSRC}/electron/DEPS for versions
+VERSION= 32.2.7
+CHROMIUM_VERSION= 128.0.6613.186
+AUDIOIO_VERSION= 130.0
+NODE_VERSION= 20.18.1
+NAN_VERSION= e14bdcd1f72d62bca1d541b66da43130384ec213
+SQUIRREL_VERSION= 0e5d146ba13101a1302d59ea6e6e0b3cace4ae38
+REACTIVEOBJC_VERSION= 74ab5baccc6f7202c8ac69a8d1e152c29dc1ea76
+MANTLE_VERSION= 78d3966b3c331292ea29ec38661b25df0a245948
+ENGFLOW_VERSION= 955335c30a752e9ef7bff375baab5e0819b6c00d
+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
+SITES.${CHROMIUM_DISTFILE}.0= https://github.com/tagattie/FreeBSD-Electron/releases/download/v32.2.1/
+SITES.${CHROMIUM_DISTFILE}.1= https://github.com/tagattie/FreeBSD-Electron/releases/download/v32.2.1/
+SITES.${CHROMIUM_DISTFILE}.2= https://github.com/tagattie/FreeBSD-Electron/releases/download/v32.2.1/
+DISTFILES+= ${CHROMIUM_DISTFILES}
+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
+
+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+= nodejs-[0-9]*:../../lang/nodejs
+#TOOL_DEPENDS+= clang-[0-9]*:../../lang/clang # clang-format
+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 "../../mk/bsd.prefs.mk"
+.include "../../mk/compiler.mk"
+
+#ONLY_FOR_PLATFORM+= *-*-arm # not yet
+#ONLY_FOR_PLATFORM+= *-*-aarch64 # not yet
+#ONLY_FOR_PLATFORM+= *-*-i386 # not yet
+ONLY_FOR_PLATFORM+= *-*-x86_64
+
+# 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/rust/rust_bindgen.gni
+SUBST_FILES.path+= chrome/common/chrome_paths.cc
+SUBST_FILES.path+= chromium.sh
+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/perfetto/src/base/utils.cc
+SUBST_FILES.path+= ui/qt/qt.gni
+SUBST_FILES.path+= v8/tools/run-paxctl.py
+SUBST_VARS.path+= PREFIX PKG_SYSCONFBASE VARBASE QTDIR X11BASE PYTHONBIN
+
+SUBST_CLASSES+= man
+SUBST_STAGE.man= pre-configure
+SUBST_MESSAGE.man= Fixing manpage
+SUBST_FILES.man+= chrome/app/resources/manpage.1.in
+SUBST_SED.man+= -e 's,@@PACKAGE@@,chromium,g'
+SUBST_SED.man+= -e 's,@@MENUNAME@@,Chromium Web Browser,g'
+
+.include "options.mk"
+
+#SUBST_CLASSES+= pulse
+#SUBST_STAGE.pulse= pre-configure
+#SUBST_MESSAGE.pulse= Set BUILT_WITH_PULSE to ${WITH_PA} in chromium wrapper
+#SUBST_FILES.pulse+= chromium.sh
+#SUBST_SED.pulse+= -e 's,@PULSE@,${WITH_PA},g'
+
+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_log_error_not_reached=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+= optimize_webui=true
+GN_ARGS+= override_electron_version="${VERSION}"
+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_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/17/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}\"
+
+PLIST_VARS+= swiftshader
+.if ${MACHINE_ARCH} == "aarch64"
+FFMPEG_TARGET= arm64
+.elif ${MACHINE_ARCH} == "x86_64"
+PLIST.swiftshader= yes
+FFMPEG_TARGET= x64
+.elif ${MACHINE_ARCH} == "i386"
+EXTRA_LDFLAGS+= -Wl,--no-keep-memory
+PLIST.swiftshader= yes
+FFMPEG_TARGET= ia32
+.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
+ ${SED} -i.bak '/.*prepare.*husky.*/d' ${WRKSRC}/electron/package.json
+ cd ${WRKSRC}/electron && ${SETENV} yarn install --frozen-lockfile
+
+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+= libvulkan.so.1
+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_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/${CHROMIUM}
+.endfor
+
+.include "../../archivers/bzip2/buildlink3.mk"
+.include "../../audio/flac/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 "../../devel/re2/buildlink3.mk"
+.include "../../devel/snappy/buildlink3.mk"
+.include "../../devel/zlib/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"
+BUILDLINK_DEPMETHOD.clang= build
+.include "../../lang/clang/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 "../../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/desktop-file-utils/desktopdb.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 "../../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/qt5-qtbase/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/electron32/PLIST b/electron32/PLIST
new file mode 100644
index 0000000000..a7efa77ffe
--- /dev/null
+++ b/electron32/PLIST
@@ -0,0 +1,141 @@
+@comment $NetBSD$
+bin/chromedriver
+bin/chromium
+lib/chromium/chrome
+lib/chromium/chrome_100_percent.pak
+lib/chromium/chrome_200_percent.pak
+lib/chromium/headless_command_resources.pak
+lib/chromium/headless_lib_data.pak
+lib/chromium/headless_lib_strings.pak
+lib/chromium/libEGL.so
+lib/chromium/libGLESv2.so
+lib/chromium/libVkICD_mock_icd.so
+${PLIST.swiftshader}lib/chromium/libvk_swiftshader.so
+lib/chromium/libvulkan.so.1
+lib/chromium/locales/af.pak
+lib/chromium/locales/af.pak.info
+lib/chromium/locales/am.pak
+lib/chromium/locales/am.pak.info
+lib/chromium/locales/ar.pak
+lib/chromium/locales/ar.pak.info
+lib/chromium/locales/bg.pak
+lib/chromium/locales/bg.pak.info
+lib/chromium/locales/bn.pak
+lib/chromium/locales/bn.pak.info
+lib/chromium/locales/ca.pak
+lib/chromium/locales/ca.pak.info
+lib/chromium/locales/cs.pak
+lib/chromium/locales/cs.pak.info
+lib/chromium/locales/da.pak
+lib/chromium/locales/da.pak.info
+lib/chromium/locales/de.pak
+lib/chromium/locales/de.pak.info
+lib/chromium/locales/el.pak
+lib/chromium/locales/el.pak.info
+lib/chromium/locales/en-GB.pak
+lib/chromium/locales/en-GB.pak.info
+lib/chromium/locales/en-US.pak
+lib/chromium/locales/en-US.pak.info
+lib/chromium/locales/es-419.pak
+lib/chromium/locales/es-419.pak.info
+lib/chromium/locales/es.pak
+lib/chromium/locales/es.pak.info
+lib/chromium/locales/et.pak
+lib/chromium/locales/et.pak.info
+lib/chromium/locales/fa.pak
+lib/chromium/locales/fa.pak.info
+lib/chromium/locales/fi.pak
+lib/chromium/locales/fi.pak.info
+lib/chromium/locales/fil.pak
+lib/chromium/locales/fil.pak.info
+lib/chromium/locales/fr.pak
+lib/chromium/locales/fr.pak.info
+lib/chromium/locales/gu.pak
+lib/chromium/locales/gu.pak.info
+lib/chromium/locales/he.pak
+lib/chromium/locales/he.pak.info
+lib/chromium/locales/hi.pak
+lib/chromium/locales/hi.pak.info
+lib/chromium/locales/hr.pak
+lib/chromium/locales/hr.pak.info
+lib/chromium/locales/hu.pak
+lib/chromium/locales/hu.pak.info
+lib/chromium/locales/id.pak
+lib/chromium/locales/id.pak.info
+lib/chromium/locales/it.pak
+lib/chromium/locales/it.pak.info
+lib/chromium/locales/ja.pak
+lib/chromium/locales/ja.pak.info
+lib/chromium/locales/kn.pak
+lib/chromium/locales/kn.pak.info
+lib/chromium/locales/ko.pak
+lib/chromium/locales/ko.pak.info
+lib/chromium/locales/lt.pak
+lib/chromium/locales/lt.pak.info
+lib/chromium/locales/lv.pak
+lib/chromium/locales/lv.pak.info
+lib/chromium/locales/ml.pak
+lib/chromium/locales/ml.pak.info
+lib/chromium/locales/mr.pak
+lib/chromium/locales/mr.pak.info
+lib/chromium/locales/ms.pak
+lib/chromium/locales/ms.pak.info
+lib/chromium/locales/nb.pak
+lib/chromium/locales/nb.pak.info
+lib/chromium/locales/nl.pak
+lib/chromium/locales/nl.pak.info
+lib/chromium/locales/pl.pak
+lib/chromium/locales/pl.pak.info
+lib/chromium/locales/pt-BR.pak
+lib/chromium/locales/pt-BR.pak.info
+lib/chromium/locales/pt-PT.pak
+lib/chromium/locales/pt-PT.pak.info
+lib/chromium/locales/ro.pak
+lib/chromium/locales/ro.pak.info
+lib/chromium/locales/ru.pak
+lib/chromium/locales/ru.pak.info
+lib/chromium/locales/sk.pak
+lib/chromium/locales/sk.pak.info
+lib/chromium/locales/sl.pak
+lib/chromium/locales/sl.pak.info
+lib/chromium/locales/sr.pak
+lib/chromium/locales/sr.pak.info
+lib/chromium/locales/sv.pak
+lib/chromium/locales/sv.pak.info
+lib/chromium/locales/sw.pak
+lib/chromium/locales/sw.pak.info
+lib/chromium/locales/ta.pak
+lib/chromium/locales/ta.pak.info
+lib/chromium/locales/te.pak
+lib/chromium/locales/te.pak.info
+lib/chromium/locales/th.pak
+lib/chromium/locales/th.pak.info
+lib/chromium/locales/tr.pak
+lib/chromium/locales/tr.pak.info
+lib/chromium/locales/uk.pak
+lib/chromium/locales/uk.pak.info
+lib/chromium/locales/ur.pak
+lib/chromium/locales/ur.pak.info
+lib/chromium/locales/vi.pak
+lib/chromium/locales/vi.pak.info
+lib/chromium/locales/zh-CN.pak
+lib/chromium/locales/zh-CN.pak.info
+lib/chromium/locales/zh-TW.pak
+lib/chromium/locales/zh-TW.pak.info
+lib/chromium/resources.pak
+lib/chromium/resources/accessibility/reading_mode_gdocs_helper/content.js
+lib/chromium/resources/accessibility/reading_mode_gdocs_helper/gdocs_script.js
+lib/chromium/resources/accessibility/reading_mode_gdocs_helper_manifest.json
+lib/chromium/resources/inspector_overlay/inspector_overlay_resources.grd
+lib/chromium/resources/inspector_overlay/main.js
+lib/chromium/snapshot_blob.bin
+lib/chromium/v8_context_snapshot.bin
+${PLIST.swiftshader}lib/chromium/vk_swiftshader_icd.json
+man/man1/chromium.1
+share/applications/chromium-browser.desktop
+share/icons/hicolor/128x128/apps/chromium.png
+share/icons/hicolor/22_monox22_mono/apps/chromium.png
+share/icons/hicolor/24x24/apps/chromium.png
+share/icons/hicolor/256x256/apps/chromium.png
+share/icons/hicolor/48x48/apps/chromium.png
+share/icons/hicolor/64x64/apps/chromium.png
diff --git a/electron32/TODO b/electron32/TODO
new file mode 100644
index 0000000000..bd6e1062be
--- /dev/null
+++ b/electron32/TODO
@@ -0,0 +1,4 @@
+To Do:
+
+0) Build on NetBSD-10 amd64, should work on OpenBSD and FreeBSD
+1) Not usable yet
diff --git a/electron32/distinfo b/electron32/distinfo
new file mode 100644
index 0000000000..38e4bb8279
--- /dev/null
+++ b/electron32/distinfo
@@ -0,0 +1,2170 @@
+$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-128.0.6613.186.tar.xz.0) = 01f4a5eb94955698e4cccc73f5a3d78ff3526df621b72e7e499505a67d563a39
+SHA512 (chromium-128.0.6613.186.tar.xz.0) = 8eef070757656bf86cf811521e56b14151dde22d338540003ccb62bed97db3eee2afddf2ae0494baa47016778e49c147670643be27dca8d868157ab07715666a
+Size (chromium-128.0.6613.186.tar.xz.0) = 2000000000 bytes
+BLAKE2s (chromium-128.0.6613.186.tar.xz.1) = 2780b9fb7401bdebd36889fe2432a0ae22adfee777236141c06ef49006cb4727
+SHA512 (chromium-128.0.6613.186.tar.xz.1) = 124e7cdff10458164f4f69b3ccbbcabbe46c0a723f018a76aaa1af0cd8b35f533b4da6fd0d0eacaab40ebae64ae52870ea6c60c89a0170f72aaef733be328f02
+Size (chromium-128.0.6613.186.tar.xz.1) = 2000000000 bytes
+BLAKE2s (chromium-128.0.6613.186.tar.xz.2) = 81efd6f5c70b9ac1e28b0cb6def0f2d917493668c8d44a223f2192ec16053d3d
+SHA512 (chromium-128.0.6613.186.tar.xz.2) = d0042da4a2ffc329c732973e72cb6a0ab6625e3b933dd8e2f48c8036cd1c62e8ae06c65be5104926237d227e8a0988be44949ce193f773dd953d2e9f9e619f85
+Size (chromium-128.0.6613.186.tar.xz.2) = 766712880 bytes
+BLAKE2s (electron32-32.2.7.tar.gz) = a508e3a934992c0ea066c4c8d9af423fc09571c81155e560e971724113a05a25
+SHA512 (electron32-32.2.7.tar.gz) = d61dd5491409740f5318b8b1cce9aeaf9d93ab132311fff56077e804d7c8395edb1eb61049cc9f700b44f83b5a590af45b42666fd0079fcad2acba798be47382
+Size (electron32-32.2.7.tar.gz) = 14667125 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.18.1.tar.gz) = 6e6d743c5f2c0856fa3583d08cb7038dbfecc3ea4fcf3dfdfad1aab0a1d8deba
+SHA512 (nodejs-node-v20.18.1.tar.gz) = 631431abf99065de2529de155d54eb26d146142ab41ff94a1a838ca609d71e548ca456ecfea591d3bb76209132407095c2b63b509247d6d27d7e5d73dfcdc949
+Size (nodejs-node-v20.18.1.tar.gz) = 115585611 bytes
+SHA1 (patch-.gitignore) = ff6cd20aa0738a336d1cbc9cd74ce8a7035802cf
+SHA1 (patch-.gn) = a37a736638dd4dacb4c85fdeff6b55b4b1e8d648
+SHA1 (patch-BUILD.gn) = c3b3e955259dbf18c1f3a41a8bab367c9aabb612
+SHA1 (patch-apps_ui_views_app__window__frame__view.cc) = fb75ba24ef0da06180784605ebb865c89adfe0a6
+SHA1 (patch-ash_display_mirror__window__controller.cc) = 2b4415353f810a7a17142c35ccfdc1c1de1b44d3
+SHA1 (patch-base_BUILD.gn) = c9ccdc8e7b1c19bcb94b41b50c55f1a98d2d3e01
+SHA1 (patch-base_allocator_dispatcher_tls.h) = 306ed4368fbb196f1a07de10a0e9f10152160e69
+SHA1 (patch-base_allocator_partition__allocator_partition__alloc.gni) = e45b8233989af83d025d2cb66e9e397975143a5c
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn) = 9d88a86a25976cee838257b237000b0ad20105a5
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h) = 1316731efc1007716d6a4a39ec94a4f84505349b
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_oom.cc) = 223a9915019e81b83a9a16b5167ad36bdfc2f4f6
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h) = a3dca105a7bbb1036e728107b4606672fe9d9a2c
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h) = 30ddfd1434c0c7669ec6928476d4ac5978890f69
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc) = 5e99ae0406e21e08e292a211678fc83a2d52b8e5
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h) = 2fade1bfc9037d32a485f29404d76b081e68bfed
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc) = b0ac027b0a8b5b5203a734bd5b9df4092ccc5e4a
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc) = 44589877e283ce920db0fddaa762bcff4d671876
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc) = 778a800087f960c6216aaeb088d0d874d69cebef
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h) = a60db8f8431813059d29511d9821c95265b45c3e
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h) = 640f50c4f99f89dbb4fb8c0400dd37e58721e508
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc) = fb23b41b2c8a7fd79d4c6d397d0dcae76a6a25b9
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h) = 31f12bd955a8ee74e6028b02424fe11ee5268735
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h) = c184957f969a77eb885497495c506ea53426f74d
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h) = 452f57d94ff6e0ded3392d6bf957ac856aabd9c2
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc) = 9d461a1183c308801c53e28ef053c133287483f7
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc) = f3ce2c9c2c76d6b03b46ea63cb2c556d6b9065a5
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc) = 54a0f993e976910f22a44b412f9ba45ef1bc96d9
+SHA1 (patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc) = a9a566f1ddf552c374a50c083711b675e3124e30
+SHA1 (patch-base_atomicops.h) = 8a10b43e92cbbfd57b273603380bce145926ec18
+SHA1 (patch-base_base__paths__posix.cc) = fff563207ccde5925acf9f400f036c1788b769e5
+SHA1 (patch-base_compiler__specific.h) = b0326acd50b1df331b989d99f86ea3ba2ea33a69
+SHA1 (patch-base_debug_debugger__posix.cc) = b0992e39f6c78b9ad0a0de5238a04bf18d83623b
+SHA1 (patch-base_debug_elf__reader.cc) = 8bd90dcfcac52b352c9e9d5da52ac5ce5396df63
+SHA1 (patch-base_debug_proc__maps__linux.cc) = 540c39a6089a626007227d7b2eb421df43887031
+SHA1 (patch-base_debug_stack__trace.cc) = d3b119f98c29a0b8f62e42c68887b6fd071db3da
+SHA1 (patch-base_debug_stack__trace__posix.cc) = fe44292c29113a13e8810b11bb305d845cafa6d2
+SHA1 (patch-base_enterprise__util__mac.mm) = 7e7dafa59377c7e4eaad36a729bcb19d913a4945
+SHA1 (patch-base_features.cc) = dd34f6fdfb65d83b0eee640366253cfeeacff0ae
+SHA1 (patch-base_files_dir__reader__linux.h) = 65bdc31d77131ce4f40e772c1eab6772c5de28a5
+SHA1 (patch-base_files_dir__reader__posix.h) = 134ff825ab4f8ea73b6d9fe15e4d349c68790e26
+SHA1 (patch-base_files_file__path__watcher.h) = fe3d74e7f3e4138c1b57d34071730ca2f0c1019e
+SHA1 (patch-base_files_file__path__watcher__bsd.cc) = 53d4708ad135727aea26c5093cb0f541b341406e
+SHA1 (patch-base_files_file__path__watcher__kqueue.cc) = 787fa43dcb0b595ee86afb9637508edeebe303cc
+SHA1 (patch-base_files_file__path__watcher__kqueue.h) = b27685c96b300cc74a4506c9b1debe83899a7b0a
+SHA1 (patch-base_files_file__path__watcher__unittest.cc) = ff195702853254dcff75fe9bb316e04715fc65a5
+SHA1 (patch-base_files_file__util__posix.cc) = 95f6914fd157fab2027de42601f315f3a66cc81a
+SHA1 (patch-base_files_file__util__unittest.cc) = c392ff8f7f3c13c0ce995c7a1c223dc5e51c1b1e
+SHA1 (patch-base_files_important__file__writer__cleaner.cc) = eb332878c9dbae48bcae1752db3d7e07df65c6ba
+SHA1 (patch-base_files_scoped__file.cc) = c3b900f9da2d44c390d6c55503ee07e7a5c02d6e
+SHA1 (patch-base_functional_callback__helpers.h) = bad227b4e7a907c671072c8d7b52de342de70676
+SHA1 (patch-base_functional_unretained__traits.h) = bb6e3ff951f8a38f02f7e8033dc8ca2395df1ed1
+SHA1 (patch-base_i18n_icu__util.cc) = fd9e78e7f676b7abb9a7ca0292be3a0b2cb278d6
+SHA1 (patch-base_linux__util.cc) = a866365a3d5ae10d7b7292da05620b334e9b7591
+SHA1 (patch-base_logging__unittest.cc) = 8a1abd422831ea0156b2ec2b2bd6f5a2c0029712
+SHA1 (patch-base_memory_discardable__memory.cc) = 4c9662b93a8301d118012af20d22e917f601724a
+SHA1 (patch-base_memory_discardable__memory__internal.h) = c00f56448340ab3db601c0efb2c106e1bab08386
+SHA1 (patch-base_memory_madv__free__discardable__memory__posix.cc) = 4b61c9a768e35f00b668c0180ff1a30c13a20dd5
+SHA1 (patch-base_memory_platform__shared__memory__region.h) = c0594314de50cec0f9a0d39a908a436047d62d33
+SHA1 (patch-base_memory_platform__shared__memory__region__posix.cc) = 3dce7230618a9828b2bebd15a76accffe232e9a4
+SHA1 (patch-base_message__loop_message__pump__glib.cc) = 699125bead2718f08cbcd21fb16d52afa2f12b2b
+SHA1 (patch-base_native__library__posix.cc) = bf64b03872a2965cfb5e4858370dfe4045bcc58a
+SHA1 (patch-base_native__library__unittest.cc) = 6b88a18a0088d8e2550a2758ce6a6f66d94eb8d3
+SHA1 (patch-base_posix_can__lower__nice__to.cc) = 2247d688ecdba2b0db310e4fdc568d5a7f6a385c
+SHA1 (patch-base_posix_sysctl.cc) = b1dbfcd6a6a669e78a82e43d065e64feb1c94821
+SHA1 (patch-base_posix_unix__domain__socket.cc) = 8a0cd3b81b97ec6191ef0fbe49fb44f765e4d0b9
+SHA1 (patch-base_posix_unix__domain__socket__unittest.cc) = c79f6e018f50e857fc65aa6b22b181c87c384622
+SHA1 (patch-base_process_internal__linux.h) = 98ed39b6c861d8035060af9239d5949f9a418746
+SHA1 (patch-base_process_kill.h) = a5d1840664bf9228abcd1a484e904d474eb99e6b
+SHA1 (patch-base_process_kill__posix.cc) = ea25f32b04bef872a8a78714464ba65aff45726b
+SHA1 (patch-base_process_launch.h) = 49e8686b0d5aaeeda086f39b81a8d31467595db9
+SHA1 (patch-base_process_launch__mac.cc) = 556a19d7232d3e3744528496a767140984d31893
+SHA1 (patch-base_process_launch__posix.cc) = c2ca87d0f7f8c0f107c8f25050efbffe1a283c23
+SHA1 (patch-base_process_memory__linux.cc) = 02d1dbc034832857500fb74031b600cae21d9f68
+SHA1 (patch-base_process_process__handle.cc) = 12993483b867e107599fc68d9e408081d3a4ff74
+SHA1 (patch-base_process_process__handle.h) = 938fa0548a4c073bcd5dde61597fcdad8217b504
+SHA1 (patch-base_process_process__handle__freebsd.cc) = 7beadd9bacf3c193f8abd506e27cea5e4ee67391
+SHA1 (patch-base_process_process__handle__netbsd.cc) = b53811e1a31384263d91affdc70c7ebfeaaa94ef
+SHA1 (patch-base_process_process__handle__openbsd.cc) = efaaedc3a05abfd7955e87fb756434079b2aa632
+SHA1 (patch-base_process_process__info__mac.cc) = b3143603edc88facab41ad8bbcf7dfeacdc8d226
+SHA1 (patch-base_process_process__iterator.h) = 0efd71c056a5b0c3a839a8423d6b958aed7fb839
+SHA1 (patch-base_process_process__iterator__freebsd.cc) = f45f4cb763d490a1b7225a73a1470d303f3f2f51
+SHA1 (patch-base_process_process__iterator__netbsd.cc) = 7e050c9c116baac84db6318ac9a5b54275308338
+SHA1 (patch-base_process_process__iterator__openbsd.cc) = a8645dc80bbf09b183662fb1550a50045b3756e4
+SHA1 (patch-base_process_process__metrics.cc) = 9058fd84ebf87ea3e88a9cfcb521225a6681fdbe
+SHA1 (patch-base_process_process__metrics.h) = 7ef4841b11e58fe1d6f83656e1cd19fb2ae1461c
+SHA1 (patch-base_process_process__metrics__freebsd.cc) = 733cbd706a624aae5d8c3a35c2e93b8411727570
+SHA1 (patch-base_process_process__metrics__netbsd.cc) = 499de9219eddcfaf019fe2258d81eed083b77fd3
+SHA1 (patch-base_process_process__metrics__openbsd.cc) = 436895b046eac074f159593712194d336522cda6
+SHA1 (patch-base_process_process__metrics__posix.cc) = c971c29012de32d26b4f7c3c1b64eff8a82bb06b
+SHA1 (patch-base_process_process__metrics__unittest.cc) = 7b86090ec5c1459068429922a85314f6c6d9b413
+SHA1 (patch-base_process_process__posix.cc) = 6b9e34cb384e848b263cd3ae34b01160b0711a62
+SHA1 (patch-base_process_process__unittest.cc) = 88cbed74cae665ac99a841d16d55bd2a38f332b3
+SHA1 (patch-base_profiler_module__cache.cc) = 6f5aa2a5a7d3fa139cd839564c5ef8e9c18dd2d7
+SHA1 (patch-base_profiler_sampling__profiler__thread__token.cc) = 1384a4350e8a7af4e15224128962865033359413
+SHA1 (patch-base_profiler_sampling__profiler__thread__token.h) = bad85654e9412b063224574f3c8be97cec983d9f
+SHA1 (patch-base_profiler_stack__base__address__posix.cc) = cd4baf55419f3900ad907eddbe55c5f76d3953b1
+SHA1 (patch-base_profiler_stack__sampling__profiler__test__util.cc) = 87b066135bf76ea6c4d79f2b4c83051e733ee83c
+SHA1 (patch-base_profiler_stack__sampling__profiler__unittest.cc) = 01cda2d6e346cd63bad3f60b4041d14705e72d85
+SHA1 (patch-base_profiler_thread__delegate__posix.cc) = 3278f8b5081e1fe43423721326f60dc6d3394875
+SHA1 (patch-base_rand__util.h) = 48aaad6964dc08e804bce2b232429e279035af23
+SHA1 (patch-base_rand__util__posix.cc) = 3f51ab9c8d5d50cadf4d372305862d83da7e5140
+SHA1 (patch-base_strings_safe__sprintf__unittest.cc) = fcdb3b6993cd1080bc3f1add42e06021b8bffe21
+SHA1 (patch-base_synchronization_lock__impl.h) = 25fdd89847eec5e257b68d9bf2b2f0ac5f170030
+SHA1 (patch-base_syslog__logging.cc) = 3de4d20477e8841af61c7d9ec12990b029c302bf
+SHA1 (patch-base_system_sys__info.cc) = cb7c69a0f0b0bc785f2dac6c37f351e586f56ca2
+SHA1 (patch-base_system_sys__info.h) = d6109de6f6f1e8c3e9fd5dc53fd7ba27da8fdc0c
+SHA1 (patch-base_system_sys__info__freebsd.cc) = d740b46b61dbc614bd56ff86657a7ba64d8b793c
+SHA1 (patch-base_system_sys__info__netbsd.cc) = cea2337cad8f153fc6d77f1a39a24f26df3c3f37
+SHA1 (patch-base_system_sys__info__openbsd.cc) = 6fe6f6574aebacb583a7c4a5e278f7bb9db7ff0e
+SHA1 (patch-base_system_sys__info__posix.cc) = 383316fc83eb3de0ce958e2bf2d94e561662eaa4
+SHA1 (patch-base_system_sys__info__unittest.cc) = f3a59a3698aed9477190692a707f55c25a1ec1c7
+SHA1 (patch-base_task_thread__pool_environment__config__unittest.cc) = fce55a4468dac87803873fcc625599ab6bbc1d8d
+SHA1 (patch-base_test_launcher_test__launcher.cc) = 6f1a49da65e307c12529f13b25ec0583b5684a1f
+SHA1 (patch-base_test_test__file__util__linux.cc) = 6bfb6716096675b3bf331c61e1b01a7fafd0b3d9
+SHA1 (patch-base_test_test__file__util__posix.cc) = 77e6e562a2751bfb1a1bd5b84984114caa4cdadc
+SHA1 (patch-base_threading_hang__watcher.cc) = 087275ee8155d625d52d3a0481c79c2fcf1b6b5f
+SHA1 (patch-base_threading_platform__thread.h) = e4e5a239ffbafe64ce4c4ce49f99e4e6f86c8789
+SHA1 (patch-base_threading_platform__thread__bsd.cc) = 972d4ba4650ce85bb4a24c1818b9f244274667b4
+SHA1 (patch-base_threading_platform__thread__internal__posix.cc) = 1ee8d0d913d36ea93c3bb88bb5f5880d424eed0c
+SHA1 (patch-base_threading_platform__thread__posix.cc) = b56a70aadf0fd75fe23031f12f4ce295e0c89b24
+SHA1 (patch-base_threading_platform__thread__unittest.cc) = 61db87bec1b133414746313433b03bff01b99cb0
+SHA1 (patch-base_threading_thread__restrictions.h) = 324d5fde6e8687ef59c814f01ac9ec8bff7c5b2f
+SHA1 (patch-base_trace__event_builtin__categories.h) = 035c4b8398c18fa464c27919b5f2e6cc856be347
+SHA1 (patch-base_trace__event_malloc__dump__provider.cc) = e005e44151db9ab0f97a87064570b6930114a640
+SHA1 (patch-base_trace__event_memory__dump__manager.cc) = 67c97ef6595d6b02c7654d7c4c7466cc29d9681b
+SHA1 (patch-base_trace__event_process__memory__dump.cc) = cc90f837ecfb171de09484b32c31d9e160d801e1
+SHA1 (patch-base_tracing_trace__time.cc) = bd8358a01ef084806843f723507eedf69114767c
+SHA1 (patch-base_tracing_trace__time.h) = 5bba9746535e323d11c4135a7bf8bc2eaa3d65d8
+SHA1 (patch-base_version__info_version__info.h) = 0fdb7c982afa178c1ce451ff56567a8c088d0838
+SHA1 (patch-build_config_BUILD.gn) = 779f3181df5156893ee3292da9ab09801c9d9922
+SHA1 (patch-build_config_BUILDCONFIG.gn) = a955688910e4d56e9d4bd0d3b3396a8a4c05525f
+SHA1 (patch-build_config_clang_BUILD.gn) = 4e2a617202097a3e8a45d9b633b4d2bbdfb9b7d9
+SHA1 (patch-build_config_compiler_BUILD.gn) = beefb6a3f022634979d77130c68cc0c360f5deb0
+SHA1 (patch-build_config_linux_BUILD.gn) = 243c4e7626d5815592322badb4462ad10d0dda79
+SHA1 (patch-build_config_linux_atk_BUILD.gn) = b0c66146b7fc4d5ada011783db4968b3db91ffce
+SHA1 (patch-build_config_linux_atspi2_BUILD.gn) = bf4061a3ac609df744d76b1e060f02460c69cff4
+SHA1 (patch-build_config_linux_gtk_BUILD.gn) = 5895bcd922f3cf1cbf7c4d5d25626a022b33a789
+SHA1 (patch-build_config_linux_pkg-config.py) = 2f252e3b29bfcb6040a91d32e61fb2b37994171b
+SHA1 (patch-build_config_ozone.gni) = 05ce5667cf440fe7cc8206c5588519e05e638134
+SHA1 (patch-build_config_rust.gni) = 3f4b454d4d0640021df6c1aa9a9f0d326f2b5b54
+SHA1 (patch-build_config_v8__target__cpu.gni) = 7e3b1d2bf389876f0399a494ca968de63c18352b
+SHA1 (patch-build_detect__host__arch.py) = 570cf5393dd9e8e8513e276aa539374327dd60bd
+SHA1 (patch-build_gn__run__binary.py) = 1db6935223c0d84a8d759eb4e1dd91269ce6d54b
+SHA1 (patch-build_linux_chrome.map) = 4e6717709212d7d70f72532b452f7fcfbfc950d7
+SHA1 (patch-build_linux_strip__binary.py) = 614e3216fc266c09cc6b74b2e928dd550f8a483b
+SHA1 (patch-build_linux_unbundle_icu.gn) = a17f45eb381ab7b542370d470162adc7d5c4c32d
+SHA1 (patch-build_linux_unbundle_libevent.gn) = c1848b1374b6d2b4f288f1c7933642cb3c97606a
+SHA1 (patch-build_linux_unbundle_libusb.gn) = 9350cb247aab5ebd055a70b1f9242a27c42507bc
+SHA1 (patch-build_rust_rust__bindgen.gni) = cf7b05069ef162b7f934bda20a1b2ac28db4d2a2
+SHA1 (patch-build_rust_std_BUILD.gn) = f4ea1810e3942a121e8d5d9a49a3c603af0e55fc
+SHA1 (patch-build_toolchain_freebsd_BUILD.gn) = cc7d4d481af03c95f20268c5388d8df15a175d89
+SHA1 (patch-build_toolchain_gcc__solink__wrapper.py) = 4db751dcd6c3b9f75f4dbbd3a9de54981c858639
+SHA1 (patch-build_toolchain_gcc__toolchain.gni) = 467e24ee42f1a6b5a0227ff44719fdc9a7048561
+SHA1 (patch-build_toolchain_netbsd_BUILD.gn) = 95736ddd921a6f83fd9dc7a965d37694f29cd36a
+SHA1 (patch-build_toolchain_openbsd_BUILD.gn) = a0efe2ee55481a88e670ca8d93f3a4a523a94178
+SHA1 (patch-build_toolchain_toolchain.gni) = a28e50de5f7d6f9aef6247210e29184cbf35c91c
+SHA1 (patch-build_toolchain_win_rc_rc.py) = 825bf2e83c66bd606b2453111199b7f025b8a762
+SHA1 (patch-buildtools_reclient__cfgs_.gitignore) = bab57cd1945137ce1b290ca8eb22887770fa55d6
+SHA1 (patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py) = a070f6844d79bb524c4c5ede693dc178d3641738
+SHA1 (patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg) = 1455c9bd5b1e539a4d5da0fea0594bb911f0103f
+SHA1 (patch-buildtools_third__party_libc++_BUILD.gn) = 8eed92098f55d4a9845052734bc1e3e6d87f4c00
+SHA1 (patch-buildtools_third__party_libc++_____config__site) = 3e9a69f457ec264874286c9ec54fc566f3ad2cce
+SHA1 (patch-buildtools_third__party_libc++abi_BUILD.gn) = 57ed4223d8ef5d84f6a365a6cab4698fed79759e
+SHA1 (patch-cc_BUILD.gn) = dddd71d0bf5c38d98405e817c64215c75b3f4f55
+SHA1 (patch-cc_base_features.cc) = f7fdff41487125de647754aed751568444fb00f1
+SHA1 (patch-chrome_BUILD.gn) = fce5fe7628ab23d625f922b1841ce6b40f4cdb55
+SHA1 (patch-chrome_app_chrome__command__ids.h) = 5dadfce01760d5fd4976885cc5112271567ca3e6
+SHA1 (patch-chrome_app_chrome__main.cc) = a9caaf72ef553471e7de0f26a7f97e1f133de1ce
+SHA1 (patch-chrome_app_chrome__main__delegate.cc) = e6512f2da26c3b98d8580ff4906557c844d26707
+SHA1 (patch-chrome_browser_BUILD.gn) = 23d87293957498b7a20b9aac056860891b69ff1f
+SHA1 (patch-chrome_browser_about__flags.cc) = 973b3af2f842022bb284117a195597d5b9627f87
+SHA1 (patch-chrome_browser_accessibility_page__colors.cc) = 8dd97d7368d99c2bae1ccfcf26aa6e73e3803325
+SHA1 (patch-chrome_browser_after__startup__task__utils.cc) = 79df3642f744c6fe522ba444f8a611273727d16f
+SHA1 (patch-chrome_browser_apps_app__service_publishers_extension__apps.cc) = eb6fb7afd2feecf6a728a6e5d161f3be25cb4de5
+SHA1 (patch-chrome_browser_apps_platform__apps_platform__app__launch.cc) = 43146c6f7261cc558293408dc8bda294bc3dc8c9
+SHA1 (patch-chrome_browser_apps_platform__apps_platform__app__launch.h) = 1d45afcc4ef34d2d870437bd6e8a2cdcad9be57c
+SHA1 (patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc) = 1ddd29660e1df76625d31588d1e39e355045a98e
+SHA1 (patch-chrome_browser_background_background__mode__manager.cc) = 6fc40081a4b3d5667523111fc71d41a9b9abd16b
+SHA1 (patch-chrome_browser_background_background__mode__optimizer.cc) = 2195368fa01c8d41c96f44bb8b95b64758110665
+SHA1 (patch-chrome_browser_browser__features.cc) = 83289785dc6bd73d5e73cf3d1428cfbb03379b35
+SHA1 (patch-chrome_browser_browser__process__impl.cc) = f80b37d1fed565eb83fbe19d6d2b217ad411e013
+SHA1 (patch-chrome_browser_browser__process__impl.h) = 9738d2f69ccaca321771c2f64ec03f924084f410
+SHA1 (patch-chrome_browser_chrome__browser__field__trials.cc) = feabf5bbe818098b5d065dffed4f99d2e661c9a0
+SHA1 (patch-chrome_browser_chrome__browser__field__trials.h) = 16b93e651b6ff5dd01571d3b97f24f5fe3916ba6
+SHA1 (patch-chrome_browser_chrome__browser__interface__binders.cc) = 72752d6afcb05430a155846fa28630065c93939a
+SHA1 (patch-chrome_browser_chrome__browser__main.cc) = 34700bf04d413431014ee68fa3fd219c01b856cf
+SHA1 (patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc) = 8c7bf3ad1ea947178fafd248bcd97aab91c61de9
+SHA1 (patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc) = f8f9bf33b9a31dea01650d68e5da2e49b2bf7e67
+SHA1 (patch-chrome_browser_chrome__browser__main__linux.cc) = 0af5ac7eb5c9de59b8ec94b91a0dae20763018d1
+SHA1 (patch-chrome_browser_chrome__browser__main__linux.h) = 5e4c278a8dbd5e167329ba160788d38e9e76cb87
+SHA1 (patch-chrome_browser_chrome__browser__main__posix.cc) = c74d8211ecd7fc49952614c64326c980dbf03dc4
+SHA1 (patch-chrome_browser_chrome__content__browser__client.cc) = dfce2c7e4a0ac279aec2336ce78b4cf9439aebe9
+SHA1 (patch-chrome_browser_chrome__content__browser__client.h) = 2cfdb6128b53443604006c87d55d216b9d697235
+SHA1 (patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc) = 8c503271cde4eb06eb194c0e033c488209703f86
+SHA1 (patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc) = 156451a22f8c83e259cd3b8d38df029112bec0fe
+SHA1 (patch-chrome_browser_defaults.cc) = faac2a896a5ff4e59dc7f0d7164ead4b35b06d18
+SHA1 (patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc) = fbac82fee58d851851293468a82c3aa8fd20a504
+SHA1 (patch-chrome_browser_diagnostics_diagnostics__writer.h) = c5496ff46f600aad5673e6a21acd0a62b5ba86bf
+SHA1 (patch-chrome_browser_download_chrome__download__manager__delegate.cc) = f77444ae76140572ed7a1f487520810c2d79d4c0
+SHA1 (patch-chrome_browser_download_download__commands.cc) = d5fcd70dcc7adf5e0640b65d87793fb968e59b45
+SHA1 (patch-chrome_browser_download_download__commands.h) = 6f79c676665b05bed22b0d5fc57b39586be35449
+SHA1 (patch-chrome_browser_download_download__file__picker.cc) = 902c97fd75e8e32f64f005cb8fb774932bcf6bc4
+SHA1 (patch-chrome_browser_download_download__item__model.cc) = 7d8dc858a02445a423a1aaa20ebf857a804d4ed5
+SHA1 (patch-chrome_browser_download_download__prefs.cc) = a0edd2dee3abe180db9db07429486c0d9c07deab
+SHA1 (patch-chrome_browser_download_download__prefs.h) = 337283f91383ca7667c71146fd348de82ef9e9a7
+SHA1 (patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc) = 6ca70f2c8bca9c8e9e9c1f496b077d9701c17ff2
+SHA1 (patch-chrome_browser_enterprise_connectors_connectors__service.cc) = 95dde90547451e94f88e2b2076659b0690e362cf
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc) = d19fc6f8139d8fca5a5541f44ebabcab6ab72a2d
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc) = f9a31a92cda9e812b4769c263cefb0d3ef61a4f7
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc) = 352b15c2592309373d6ea70fd94253b75f6ae31e
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc) = 8bf652fd479897e539a05714a1e6883f4a1a8463
+SHA1 (patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc) = dbcf83db239fe48296181c69564c55bc0f7e3b38
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc) = c2f25792d342d0de23569a7feeca26876c296806
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc) = e193576c807401528399e1763225c2a9d3fbe04e
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc) = e832c4c2ef8ad420b3155d24e54d955091f62c8c
+SHA1 (patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h) = f233f116c175312a3c238342b78700b391f1d030
+SHA1 (patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc) = ee9af8157efe0503eed728118e1c0c88571ec07d
+SHA1 (patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc) = 75df1d36d61a143df8743e206788592d45e105ce
+SHA1 (patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc) = 5f793386d1ae4ab56f01490cfdf30ec5cda65ddf
+SHA1 (patch-chrome_browser_enterprise_signals_device__info__fetcher.cc) = 011628d2dc61c0283e3492ea2aae961f020614ca
+SHA1 (patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc) = 2b66886180a58f9ef6ef9d4f3e1cd66213524511
+SHA1 (patch-chrome_browser_enterprise_signin_enterprise__signin__service.h) = c3560fc9862274d58a2705dd0e9209f7b9327f82
+SHA1 (patch-chrome_browser_extensions_BUILD.gn) = fcb7a7371beef4226aa6069d268de9fb7a459791
+SHA1 (patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc) = 25660badab8b65d7866ec785d2d60b5ab0a97423
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc) = f97b036c52bd7162103797d90f4b629268c1c21d
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc) = 62a77057fa38214c3704449af96d50fc4a10be04
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h) = 532bc23c6cc90ef219daa6e144356a22d81f6863
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc) = 81cc91d9c5a91c57bf16e15f0ebbc5381b19e81f
+SHA1 (patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h) = 3b9f5034f40fbd366627754cc5044531e713f48f
+SHA1 (patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc) = dfff0bfbc9c967a69b84e248f66e40f0818f1176
+SHA1 (patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc) = 47762e7267243ab514da52c8e090797ff5de3945
+SHA1 (patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc) = af05c2eb091f98c3192047f08800e442027d54a7
+SHA1 (patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc) = 620e76d63e0f286fe3aad12106da789428192c2f
+SHA1 (patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc) = 5740fbe53fb5a367d5b14033c7e534c344b2ddcc
+SHA1 (patch-chrome_browser_extensions_api_settings__private_prefs__util.cc) = 0d3a8412c8abbeac8ddced593a994bc74f3470e4
+SHA1 (patch-chrome_browser_extensions_api_tabs_tabs__api.cc) = 13036b00ab7f5b7e5c1c9a2792c13908255bd0de
+SHA1 (patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc) = b465c959616846cce46608101cb53d7061d464ea
+SHA1 (patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc) = 380d911dfef0d32637f5816fbea358f37b62cb06
+SHA1 (patch-chrome_browser_extensions_external__provider__impl.cc) = 666e79f3b7481765bf57c0bdd1f3c065e82151c6
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener.cc) = 67424943383ff1e73d9f480b9cf8fb8d6d12022f
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener.h) = e4a492e549628b8a8801fe8498a8c7f030f74f0f
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc) = 924f7c59a286605e6d5e391f12f8eb8d3906699b
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__ozone.h) = 7ca23570d7d667780d6ddd4a012773250a591a51
+SHA1 (patch-chrome_browser_extensions_global__shortcut__listener__win.cc) = 1a68ddf1cd75c63d262933e452d1b3a1fe81d5c0
+SHA1 (patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc) = 509277048c56a01cf19ddeed98df9eedb679c02c
+SHA1 (patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h) = 2d8448f3b2857e3e6dedca83e46279f4608dd114
+SHA1 (patch-chrome_browser_first__run_first__run__dialog.h) = 3be12f2061e28bda17539d462c61582948eefa4e
+SHA1 (patch-chrome_browser_first__run_first__run__internal.h) = cafe6ebad96541f9b6b1b3bdff85b575aaf2c014
+SHA1 (patch-chrome_browser_flag__descriptions.cc) = 11ac2f2c58434ecc70574494aa960c7772f4a757
+SHA1 (patch-chrome_browser_flag__descriptions.h) = a9989bc7ee2aa312699610c52a5c0659ccce67b4
+SHA1 (patch-chrome_browser_gcm_gcm__profile__service__factory.cc) = 31094e1e199b46efbaa467bb471903a06e2fbdbd
+SHA1 (patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc) = 03d06083017d3a948baad94e71a8a89a2e3ebf4a
+SHA1 (patch-chrome_browser_global__desktop__features.cc) = 49d38876b91f758a4a197c6e3818076f3a34cb3f
+SHA1 (patch-chrome_browser_global__desktop__features.h) = 34374fe2f5bdf6acac9103233c3d4f26477949f8
+SHA1 (patch-chrome_browser_headless_headless__mode__util.cc) = ed997b405cbae620c024764d053b47a3ff754cb2
+SHA1 (patch-chrome_browser_intranet__redirect__detector.h) = 3290ec11b579b6ff866521623bbb1a643539360d
+SHA1 (patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc) = 888edcdcd10c004f728ea49bb7782f5c34072c11
+SHA1 (patch-chrome_browser_media__galleries_media__file__system__registry.cc) = 32feab2effff918e33649e19771883fe8e8fdcf5
+SHA1 (patch-chrome_browser_media_audio__service__util.cc) = 1c4a50ea942ef6231783e9ef92df1b5ae8fbecc0
+SHA1 (patch-chrome_browser_media_offscreen__tab.cc) = 75981d70fa02e6b0609d9bcfb942207df9dc7ed7
+SHA1 (patch-chrome_browser_media_offscreen__tab.h) = bc92b491812f2b21a06aac06083a5bb1f5b6c9f1
+SHA1 (patch-chrome_browser_media_router_discovery_BUILD.gn) = af260451eaa4da4ea5818bffb0a32ec765ae7936
+SHA1 (patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc) = a566f38d944e3d182eec205d7a0dfd9085f84591
+SHA1 (patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc) = c5d82102501e1f7df7ebab0d89b5a22215761c5c
+SHA1 (patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc) = 2eeed454e663c397abb4a0f98b7f48bd777e9f74
+SHA1 (patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h) = 98b0ec68ab4a2c6477d456e1658f59d2f44f685f
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list.h) = 2e801602514a4bc16b71121ea1d493ef546a5a65
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list__base.cc) = 0ece7ada85dae1e45bbb4977879308413ecc10be
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__list__base.h) = 1b97785987639181027f63436d030ec0ce66d035
+SHA1 (patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc) = e42be7c0778ee8e299250dced8b97c57f18d7f54
+SHA1 (patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc) = 8c2c154c27c12b4ebb56bb6614dfaf930dc26188
+SHA1 (patch-chrome_browser_media_webrtc_fake__desktop__media__list.h) = 80458386d9ad3ac609300e63ae52e8009f291bfe
+SHA1 (patch-chrome_browser_media_webrtc_native__desktop__media__list.cc) = 774cdd632f0d9bc984c1692804b88be5c6611b15
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc) = 6175162a5f0a8da066c1fd0720e5f0a0117f48e4
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc) = 72cbafe2536c68612267274fdf266b1ed4e3759a
+SHA1 (patch-chrome_browser_media_webrtc_webrtc__logging__controller.h) = cde544147c9b000f9e46c446cdd34780aa7fe394
+SHA1 (patch-chrome_browser_memory__details.cc) = 73dd0fb65ff16f610ff8adc351b3383be14acbe0
+SHA1 (patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc) = 7b12d688d3b1e1808f00dba168997e8934cc642a
+SHA1 (patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h) = 3e02684c8d6a448d230eabb6590c7b4c1e934771
+SHA1 (patch-chrome_browser_metrics_chrome__metrics__service__client.cc) = dc866a37b1185f13622b4b6718125a27795b1d20
+SHA1 (patch-chrome_browser_metrics_perf_cpu__identity.cc) = 3bc1694dcaf10b4c7bbc57644ece3a3b5da840f3
+SHA1 (patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc) = 53dc20915386cf36c4f7dcee489a025f587dba6e
+SHA1 (patch-chrome_browser_metrics_power_process__monitor.cc) = b0c1e2ee93c3b12f5087ade670fe1e35e7da3f65
+SHA1 (patch-chrome_browser_metrics_power_process__monitor.h) = f59bf04e89bc4bc2ac1ad6fcd3c61b601a039edf
+SHA1 (patch-chrome_browser_net_profile__network__context__service.cc) = 931662a791eed05ab2c17d6eec07bda0e5a92dd7
+SHA1 (patch-chrome_browser_net_proxy__config__monitor.cc) = 4aabf939a0f360b27434a554e72eb79509e66788
+SHA1 (patch-chrome_browser_net_proxy__config__monitor.h) = 2bf0cf183864ee707af45f7390628ef7a521014c
+SHA1 (patch-chrome_browser_net_system__network__context__manager.cc) = 5b1b1d8d382003597e4c9dc26f50d5bdda6ed605
+SHA1 (patch-chrome_browser_net_system__network__context__manager.h) = 396a58e2c63a429d2499a9766fddcee5ced98469
+SHA1 (patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc) = 2695476be02ed8c6870a5ba4ce557c86100daca1
+SHA1 (patch-chrome_browser_new__tab__page_new__tab__page__util.cc) = a8ac71a76bab67c8eacc5a618fadd4b791f20b06
+SHA1 (patch-chrome_browser_notifications_notification__display__service__impl.cc) = db46641c8613aebdacb5690d92eb464f0d06a937
+SHA1 (patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc) = 4a078db65e7fce21d732b71b5607249dd98e4259
+SHA1 (patch-chrome_browser_notifications_platform__notification__service__impl.cc) = 7084273db193cb094ef3cc46e71d47792f548c39
+SHA1 (patch-chrome_browser_notifications_platform__notification__service__impl.h) = ee7d09dca7d7fd6aec93981f65b0af8081dc9048
+SHA1 (patch-chrome_browser_password__manager_chrome__password__manager__client.cc) = 9c7421c9977cc1ffc15b3ffe3917cf378a90ef21
+SHA1 (patch-chrome_browser_password__manager_password__reuse__manager__factory.cc) = bae14d0990b438038527a74c3d950d6fa1c70535
+SHA1 (patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc) = 5f99810d3be703a2c0973a40cc4e3959ce02b2b4
+SHA1 (patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc) = 0a7ccfde6c3fac40d58903bc759d56a6582f096c
+SHA1 (patch-chrome_browser_platform__util__linux.cc) = d2879a937f6ad16d6d8ec3f883639852b715e246
+SHA1 (patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc) = f78403a44754ee1bc6816a7f26f47e920a4f46be
+SHA1 (patch-chrome_browser_policy_browser__signin__policy__handler.cc) = 4944f6fd8fd174248a89264592f2ae346c4f235d
+SHA1 (patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc) = 97b892167641a7ee2b89485aa9d8f0b706e3b1f3
+SHA1 (patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc) = 4f4c152752779a4c7e451f57a01dab08a45ba148
+SHA1 (patch-chrome_browser_policy_device__management__service__configuration.cc) = 7e044748a9e001d7fee9fd1ed74bd2991b9c46c4
+SHA1 (patch-chrome_browser_policy_policy__value__and__status__aggregator.cc) = cc6853dd2b413100530159b343cd8c80f9b68b52
+SHA1 (patch-chrome_browser_predictors_preconnect__manager.cc) = 1c1ee65aafd8ff45bebbd384b4989b1e7845fe22
+SHA1 (patch-chrome_browser_predictors_preconnect__manager.h) = 487078679ea3af2d78d3a9d0efb28a3343bb2622
+SHA1 (patch-chrome_browser_prefs_browser__prefs.cc) = 6d4f9b4474474940954ed28a30e024ef767db70c
+SHA1 (patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc) = 7c8bb1080e24803145a2da7105e185fe529606b8
+SHA1 (patch-chrome_browser_printing_print__backend__service__manager.cc) = 0dcf5d3d3d84ff6784601fece44fa13fcb7fe7b1
+SHA1 (patch-chrome_browser_printing_print__job.cc) = b34327bf5b9d48054c8a272ea1d4107bc318364b
+SHA1 (patch-chrome_browser_printing_print__view__manager__base.cc) = bab28467181eb85ec58b5e637fb2b0bca27cf229
+SHA1 (patch-chrome_browser_printing_print__view__manager__base.h) = 722a6340086ebcfa854b84a3c8370fb81f30d624
+SHA1 (patch-chrome_browser_printing_printer__query.cc) = c05eb2399e1de0333f6a8fafce71c15e5e54c135
+SHA1 (patch-chrome_browser_process__singleton.h) = f7319635ef83e5f3c0b8f09ab936f333592bad0a
+SHA1 (patch-chrome_browser_process__singleton__posix.cc) = 6fe2caa72ac8a1ff4e228a20f1beb616d870ef15
+SHA1 (patch-chrome_browser_process__singleton__win.cc) = 6a08882a039c3047a2cb1c7ab524e4a8eab2b24a
+SHA1 (patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc) = b969ad6162849239ca3861f9498aef753333a946
+SHA1 (patch-chrome_browser_profiles_profile__impl.cc) = 63bf43c3bd08016ff8c06e05b0dffe2c90dd40f1
+SHA1 (patch-chrome_browser_profiles_profile__keyed__service__factory.cc) = 86af337ad597aa6fbda1199aa2da3e73007ebd21
+SHA1 (patch-chrome_browser_profiles_profile__selections.cc) = d2893ff6a8352be9eaff711c9787f70a648c6d81
+SHA1 (patch-chrome_browser_profiles_profiles__state.cc) = 10de8c5f8dd692bc314ed83fdde05bf70e1e4b3b
+SHA1 (patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.cc) = 7be1201bcf3474e0e38aa73b0345177c9595d2e5
+SHA1 (patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.h) = 9493062f5c6ab6c4d03162a67a79f3d99eea6b16
+SHA1 (patch-chrome_browser_renderer__preferences__util.cc) = 444821e92e66bb1738ce784036251d943614b1ef
+SHA1 (patch-chrome_browser_resources_pdf_pdf__viewer.ts) = d8827da0a96f93c4792d8971fccaa8fa3c188a51
+SHA1 (patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css) = 22e1ea1d29b3600f61b58beb128f088ba96cbeda
+SHA1 (patch-chrome_browser_resources_signin_signin__shared.css) = 203b5edeeca77167796b9b47c50a1f0b6679d182
+SHA1 (patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc) = 3dd99276c0453430457051fefbda8979be317578
+SHA1 (patch-chrome_browser_safe__browsing_cloud__content__scanning_deep__scanning__utils.cc) = d8a832656255b82ce75fbf4575221c7fa7e6cb4d
+SHA1 (patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc) = b75bb5cddcce9bb836e3b471ad39c0dfb21a7599
+SHA1 (patch-chrome_browser_screen__ai_screen__ai__install__state.cc) = f30a792fff52ec775422cb01a0231b457b1bb4f0
+SHA1 (patch-chrome_browser_screen__ai_screen__ai__service__router.cc) = 879467d03451bf8a1ce95c865a36ac42ca177ade
+SHA1 (patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc) = da44048ea224d7d478ea3daac7e71a3801a390cc
+SHA1 (patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc) = 4173b70b498907cea24a16f9a061b3de82d533b4
+SHA1 (patch-chrome_browser_sessions_session__restore.cc) = c14b0cc95da92c40065c6128639977e056000044
+SHA1 (patch-chrome_browser_sharing_sharing__device__registration.cc) = 6877fa7f87bb7f0c2034e889a72ab1d263c69c74
+SHA1 (patch-chrome_browser_sharing_sharing__handler__registry__impl.cc) = 5f469990daaa591314c8f4dd68c8eda3c1cb3ba1
+SHA1 (patch-chrome_browser_shortcuts_icon__badging.cc) = d9cf613db1395a7206451ef90fa6ab88bab2e3dc
+SHA1 (patch-chrome_browser_signin_signin__util.cc) = 9a7e255437a8750300ea0e2effb89e7f66556758
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc) = 00852cd68f5dbd3a477da975b449fa9eace2768f
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h) = d7ebbc26ea5fe8c05c4c4997700398bbb298ef78
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__service.cc) = 4da4d0d79db141b14bda04bfca8ef1f8c26c789c
+SHA1 (patch-chrome_browser_spellchecker_spellcheck__service.h) = 46dd0d040c2d4051c9beb886c2952bbba6973d5b
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc) = 047d79e8d3041b91fa75bda53d0a1affa01d0fb2
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc) = a0398c4fa4f89b8173a1d531dbbd5cc48f4c8b2a
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h) = da593c0e8574c1dd827abfd5f65f83bdb9f6854c
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc) = 3015d6c95faf9121d1c2193da891efb65546a004
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc) = e19e3256e57797f56e80f8473010b8d4255e70c5
+SHA1 (patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc) = 14190a30a0e533f0a251fd2f3fb9fddfa4f4eb91
+SHA1 (patch-chrome_browser_sync_chrome__sync__client.cc) = dc60060940c1251b1ea17449fc8252e04254611f
+SHA1 (patch-chrome_browser_sync_device__info__sync__client__impl.cc) = f0b1d574a1f40b10ced1ee014435ba07048a991c
+SHA1 (patch-chrome_browser_sync_sync__service__factory.cc) = 88cbb970ce0c54479a8f50ebc8fc59b3a67b2b1c
+SHA1 (patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc) = 8b4c40c752d1412fdbff2d8b9d3f269c177a0284
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group.cc) = 0184219e119df1648023d0d237af6063c1a887ed
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group.h) = bd0099792f6c6e7689873d63417dacc9332b87db
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group__sampler.cc) = e37f9dd95610a1a5c7e9890516e20ec8f4491770
+SHA1 (patch-chrome_browser_task__manager_sampling_task__group__sampler.h) = 57ac66d9da0eed41d376ee22c98a88621e258a69
+SHA1 (patch-chrome_browser_task__manager_sampling_task__manager__impl.cc) = 99be14df47bf7a2453fdbc1aaf387a9e922c4563
+SHA1 (patch-chrome_browser_task__manager_task__manager__observer.h) = 480ef5f09fe06641aa2e72813551169761f1e804
+SHA1 (patch-chrome_browser_themes_theme__helper.cc) = 8ae82d63a0c9212cdd7f8290f1da6e55440ccde6
+SHA1 (patch-chrome_browser_themes_theme__service.cc) = f002c5676f110dcbca8a06bbeedb49034504f9be
+SHA1 (patch-chrome_browser_themes_theme__service__aura__linux.cc) = f3c737734fe454d138113370e5f42b48a7ca1b21
+SHA1 (patch-chrome_browser_themes_theme__service__factory.cc) = 42d70720d156aaefb7b7cfabaab9093e9fde8e35
+SHA1 (patch-chrome_browser_ui_actions_chrome__action__id.h) = 35482385e014edc9818bc88459c2e247116706bc
+SHA1 (patch-chrome_browser_ui_ash_ash__web__view__impl.cc) = 088979ede7e3d782195edcd4c7f28778ebc9590a
+SHA1 (patch-chrome_browser_ui_ash_ash__web__view__impl.h) = 062ff2e6aa000c53933ff7afd0c12175ec986f2c
+SHA1 (patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc) = 6e2df828f48dc09217392537fe092f74cc74d3c4
+SHA1 (patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc) = adf3033d0b24d6cf09b9ba57aacb70d030831ce9
+SHA1 (patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h) = d7adda6789300d84ef5824a1e9b80fcceee07739
+SHA1 (patch-chrome_browser_ui_browser.cc) = d751026d10b9f414834f34341780581b0e1116c7
+SHA1 (patch-chrome_browser_ui_browser.h) = 008850a097ba8f2f0a6de79e21fae04987e8a545
+SHA1 (patch-chrome_browser_ui_browser__command__controller.cc) = 8d9afd7960513dec5d247559e65c9e77e7221f58
+SHA1 (patch-chrome_browser_ui_browser__commands.cc) = fe7ad3581b3b621221b57e9ed16273e150c947bd
+SHA1 (patch-chrome_browser_ui_browser__ui__prefs.cc) = 82b1fe7e4ef4cfb2ce6d8bff9a4adaf426243a78
+SHA1 (patch-chrome_browser_ui_browser__view__prefs.cc) = 084616d14dcc641bde16910717660c688f1467f5
+SHA1 (patch-chrome_browser_ui_chrome__pages.cc) = eda630c7ee12bf07cf5ccd1ad2ab9d5c01c3e62b
+SHA1 (patch-chrome_browser_ui_chrome__pages.h) = 27d8bf945ed7926913e8d519dc732ba2eba72058
+SHA1 (patch-chrome_browser_ui_color_BUILD.gn) = 710378f16d64de2142f1ddf15b62875d5f0c6e96
+SHA1 (patch-chrome_browser_ui_color_native__chrome__color__mixer.cc) = c8a4448ba5b1d1eea9867424be64db9bbf49e072
+SHA1 (patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc) = 7ef4fe0a4ee8fc7c5739dd372b094d7f72f9fbe8
+SHA1 (patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h) = 40ee42438eeb52e7bb8965c76c50d4a4d2681ed9
+SHA1 (patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc) = 6dab0c34e35438c22ac357fefc8e554966b9a334
+SHA1 (patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h) = db96aa06802ea6ef0eb62a874fd568f8676dc75d
+SHA1 (patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc) = c6f0b12c2b6d481d020659ba4ccbd6a093f84c39
+SHA1 (patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc) = 6aabca96c2f70f5d95e80c3ac85936f449b1d834
+SHA1 (patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc) = ba9d0e94ee6fd67bb452c9ef52cdd09e4522b6a7
+SHA1 (patch-chrome_browser_ui_sad__tab.cc) = 292091174f16969dfd5925db6e0a58bf538b1d16
+SHA1 (patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h) = 2466df8ec0c17a84170e2e18563ae5abd373e9b2
+SHA1 (patch-chrome_browser_ui_signin_signin__view__controller.cc) = 765ea5e628805fc6e9ff935f7839a64a33346a41
+SHA1 (patch-chrome_browser_ui_signin_signin__view__controller__delegate.h) = 26f5600af805448b6920919cd9eafdb5cb0980be
+SHA1 (patch-chrome_browser_ui_startup_bad__flags__prompt.cc) = 0d1aa8738dff9347ec69c1eb4bc20f2b6feb7fa8
+SHA1 (patch-chrome_browser_ui_startup_startup__browser__creator.cc) = f615b01cf2199411440539f8851112064ec89221
+SHA1 (patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc) = 587521192912a200236f5a723fe05945ad33e498
+SHA1 (patch-chrome_browser_ui_startup_startup__tab__provider.cc) = bee8509dd8fe35c5151964ffb947214cd48161fc
+SHA1 (patch-chrome_browser_ui_tab__helpers.cc) = fd65e69386f69e5e9cb133039eda1d9d4803e32d
+SHA1 (patch-chrome_browser_ui_tabs_features.cc) = f7dbe361834a1f76c369aa32574b5f27cc40ccc2
+SHA1 (patch-chrome_browser_ui_tabs_tab__strip__prefs.cc) = 7a586ee4e24b01acfbc7667d64fa1ea0a531dfab
+SHA1 (patch-chrome_browser_ui_task__manager_task__manager__columns.cc) = 0a31f544ef4106194e87012186c670b5b8698ad6
+SHA1 (patch-chrome_browser_ui_task__manager_task__manager__table__model.cc) = 1bd57cf6a334624464639e37e216f616cf1103ca
+SHA1 (patch-chrome_browser_ui_test_popup__browsertest.cc) = 7e9ebeca99e56a36b0c3146525739792d371031f
+SHA1 (patch-chrome_browser_ui_test_test__browser__ui.cc) = dd4d7941d27c7e8a69b3adae0734aa56dd5e70cb
+SHA1 (patch-chrome_browser_ui_ui__features.cc) = ba2ad59e0c9c62301b9c43666a7d77e4a0564ffd
+SHA1 (patch-chrome_browser_ui_ui__features.h) = 6890d7c1a84cb59753aeebbda50cba6de662b903
+SHA1 (patch-chrome_browser_ui_views_accelerator__table.cc) = 1c34d26fd0b07f855c57b553f2ab86a84d7d7873
+SHA1 (patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc) = 11f29f05c43830ec35453819f0b3842c83a66971
+SHA1 (patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc) = e8de2521ac36ce1e7a5043d8029c1603cb9fddf5
+SHA1 (patch-chrome_browser_ui_views_chrome__views__delegate.h) = ec5073b626a6d8bba74a41bbc5313ee397820b03
+SHA1 (patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc) = 875944a93fbef70caff8e08714967436bbe933fc
+SHA1 (patch-chrome_browser_ui_views_compose_compose__dialog__view.cc) = e5b1faf23989b42feb3a3b86c06c6cea94a4a603
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame.cc) = 170581080e1e90d0385ece3bcbbdf67b52da5a7f
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame.h) = 193a0856a1367ec2907e04ced4c33d624cdfe3f7
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc) = 982df32e5d66f5183b891a6f6b9ca42098c666d7
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc) = 26f52fccdf44cd1641333e073307069316e45a04
+SHA1 (patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc) = 57234f4bdb2a5952cd59f4786e989dc8dd5fba60
+SHA1 (patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc) = cee95759adf3d22e0dd28d42b43fc0a43d18badb
+SHA1 (patch-chrome_browser_ui_views_frame_browser__view.cc) = bb9d9bf0db4071a8831aef9366c6c59a7cc1818c
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc) = 26e27808456cdbd8f0036d70a0cab3c34dad5a5a
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h) = 8746b3dbefac12d50a44a18fcb0f15009d4b1359
+SHA1 (patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h) = 9f908eefb802f6a2d2b3e026324e34e4b54d2b96
+SHA1 (patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc) = 99e65c32a0dd1168d9a979d4a0bd616b7a99779d
+SHA1 (patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h) = 39e460187509ab56deacef779108ad92ccffa3a4
+SHA1 (patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc) = 01b791281c8b7408026ffa851024e40931cf5ba4
+SHA1 (patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc) = 485fd3c4c626f21ed679c60be9a42e4a0e859a69
+SHA1 (patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc) = 0fc77b4f2c8bef70f36576597258bcaf44a50275
+SHA1 (patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc) = ec39d7fab3d576d70f948bfea55bb1845dd59ee9
+SHA1 (patch-chrome_browser_ui_views_hung__renderer__view.cc) = a81b317697d56186d56e158bb37a880bf05bdc81
+SHA1 (patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc) = 23418914715fe4824b6484309a07c0681649af2f
+SHA1 (patch-chrome_browser_ui_views_overlay_close__image__button.cc) = fd1bdb15cc37cdb043016fb3241072e061f1715f
+SHA1 (patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc) = fa5c184792dc4e3b1a2c6b8dad024ba44bf914ba
+SHA1 (patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc) = 5f9801a8a5dac95c60c4f81016505b9736fdd777
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__menu__view.cc) = 369c52976b002521b9136511899b6e691531e5d3
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc) = 06e35e90e2d8f374bcc1696c1a56b0fee9fd9293
+SHA1 (patch-chrome_browser_ui_views_profiles_profile__picker__view.cc) = ea7398f4bb22ef61f66e26258b8e3b1ad58b493f
+SHA1 (patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc) = cddec4fbb5a42d699370f974e6e9021564e70148
+SHA1 (patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h) = e9f89f3c85233b64a43b2931f5f6af7f2eaa0556
+SHA1 (patch-chrome_browser_ui_views_tabs_tab.cc) = 9e1b94c98e06a3239673e4ab2b597970c03819a8
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc) = 3cee693ffd1df417bcb4c11dd26e71acede8f25d
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc) = 44998a39a9ab92f866592b80e263e04845610d73
+SHA1 (patch-chrome_browser_ui_views_tabs_tab__style__views.cc) = 552bf96d2f20016bc8080961a46c7290029b1730
+SHA1 (patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc) = a714d6c6afdc09c9fedd75b7449e3d6a3e0afa2a
+SHA1 (patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc) = 015c2248b801fef556728b4e7389052bf971a21f
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__dialogs.h) = b9c6f9a34fd07df02484c4dd162682d372d8c99e
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc) = b6c86cd5383c8a63d92fe96313e14dd739cd54d8
+SHA1 (patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h) = 534d379a2f1a328d28e1a815e575bac5c09cc28f
+SHA1 (patch-chrome_browser_ui_webui_about_about__ui.cc) = 9e51ef8ada56fe03ea06d68c402b9e47d1fd3361
+SHA1 (patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc) = 932f65b84a99f53881783be5e59921885051a446
+SHA1 (patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h) = 57aa5f20905cf4d2594c42a70d118e718c1228f6
+SHA1 (patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc) = 6a172f1f6ed916efc1975ffd39f32d83a8ad6688
+SHA1 (patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h) = 9086c58313dabe6847d23c07b38ec3148055e6b1
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc) = c08bf69c088e0cb8d2df6e0d5b5138e11e08b988
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc) = cd23f540295cd404c5b5898454092851f36efc5b
+SHA1 (patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h) = cfb27b5d36d0f817f1ac6f68af2c17e18c8b6996
+SHA1 (patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc) = e2bbdc7cd93278c966be5ff1b004d3305f6c2f5e
+SHA1 (patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc) = dace4b6e58a289e442e1117fa5ab04e1959046c8
+SHA1 (patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc) = 7955c16ccd62c567d48871e2ef9843b52dc61813
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui.cc) = 4eccb20b31270ad0eab39b270ca0239e14738812
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__constants.cc) = 298561e5cb2823e7edb4dcb7d631f5450169d067
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__constants.h) = 3d0dfcd4ebeedfe2b5ec446e98f2296a5318a1a6
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__handler.cc) = f96a1b07120cb0ccd1183ccf0b368eb6ca88c1b4
+SHA1 (patch-chrome_browser_ui_webui_management_management__ui__handler.h) = a14e0611fe7bfc984811eac2c9c4fce6548e0ca2
+SHA1 (patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc) = 77de5ce3b092ca24847f4de09e4a25bbed01641b
+SHA1 (patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc) = 89b7b44d91d581c83d0984bd8fa330d7cfa129c3
+SHA1 (patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc) = d243b9dddc690d96afd895ea01708203087f1c06
+SHA1 (patch-chrome_browser_ui_webui_settings_appearance__handler.cc) = 6ab7c992de4f22573c2f66478e64c3c7d7700389
+SHA1 (patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc) = cce0eab8c2b6f08640ac2072d5deaf207737d68c
+SHA1 (patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc) = a9fc5796331d7fffb89c153bb11711a2fdbffda6
+SHA1 (patch-chrome_browser_ui_window__sizer_window__sizer.cc) = ef2b87c209083fbbd8bfe271ab71d4bdb29f7e13
+SHA1 (patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc) = 0ff1e595f05c4845c25b3846708365050c609b52
+SHA1 (patch-chrome_browser_web__applications_commands_launch__web__app__command.cc) = 9aa8bdf8cae85cef0d9bdf66df7de1cc3482d682
+SHA1 (patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc) = 48c39f900105ed7c96139490b06035c48ac3d0c0
+SHA1 (patch-chrome_browser_web__applications_extension__status__utils.h) = 66d37a802a6acb6760d046cb735f3b26c475622c
+SHA1 (patch-chrome_browser_web__applications_extensions_extension__status__utils.cc) = 3604524ce1f9e2996f33110e7dd8aea914d03d75
+SHA1 (patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc) = 49354690e146a7155b6d2b7dae78448b4cf047b1
+SHA1 (patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h) = f6f001a64359849bfbddb9b9adb5ddee133a03f9
+SHA1 (patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc) = c934ee6b30cca7a8866acbdf899cff1f339aa5c9
+SHA1 (patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc) = cc5018334ce7dcffbbd91e3817f9b8710b65c17d
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h) = ce14376d899df5c1814a9e70fa9a1c898945915a
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc) = 35b558977936e2c220e3dcb86207e07e843017ea
+SHA1 (patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h) = bcb9795672d8e40f2bdba1ab6c4ab91f4ef7cdb9
+SHA1 (patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc) = 6abc9d52b8aefb1c7522384324bbc91f788e7e77
+SHA1 (patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc) = 350ba793c983df4c53b183a8ac28d1bfba4bd5b7
+SHA1 (patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h) = 6578ea0b3107c6d2499168551987ffad2359785f
+SHA1 (patch-chrome_browser_web__applications_web__app__helpers.cc) = f13b41db8ad9d8179a21c57e6f52f36ddd4f17d7
+SHA1 (patch-chrome_browser_web__applications_web__app__install__info.h) = 0ee2cc539d11486d9c50c7bfdfc4cd95df6ac156
+SHA1 (patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc) = a479703dfbe19bb4c3771483a5e582d54af755b5
+SHA1 (patch-chrome_browser_webauthn_enclave__manager.cc) = 3fc2d5e8a96f4214b4776baf5630bbfd519d857b
+SHA1 (patch-chrome_browser_webauthn_gpm__user__verification__policy.cc) = babccfaa5bc59c2f7fa5567a7b7bf63dd4d13c40
+SHA1 (patch-chrome_browser_webauthn_unexportable__key__utils.cc) = 6dfbfdb5545ea6701e244853cb5698e22a5ae804
+SHA1 (patch-chrome_browser_win_chrome__process__finder.cc) = 6c27b9ef9918b8992a6e2b07399e76c7c399aa42
+SHA1 (patch-chrome_browser_win_chrome__process__finder.h) = 888fccf0a034ee96b9172815afb0fd77a367da8a
+SHA1 (patch-chrome_browser_win_titlebar__config.cc) = 919518a6c6f4a19c661de43391cdbe5da97f8e13
+SHA1 (patch-chrome_common_channel__info.h) = 22a83718d625e385d38c1b4e39689228f9fd53c4
+SHA1 (patch-chrome_common_channel__info__posix.cc) = 81848d35c52d7130af642ec7832280f563d4f534
+SHA1 (patch-chrome_common_chrome__features.cc) = 57e9a78242cb3d8a7fe1e346e7e252ab04c1de54
+SHA1 (patch-chrome_common_chrome__features.h) = f22942ba0bc900a828d1fec9d626066fa8f3c468
+SHA1 (patch-chrome_common_chrome__paths.cc) = a18a124bf51ec4ce64683cdcabd2657c3f07b924
+SHA1 (patch-chrome_common_chrome__paths.h) = 0ef3262a0eb574f4a58b9306edb1805216102993
+SHA1 (patch-chrome_common_chrome__paths__internal.h) = c492a3a5f3ddd055aca0b4c5328a30035cba83e2
+SHA1 (patch-chrome_common_chrome__switches.cc) = c91f91cf346dc7b9ea3a7b5093d86eca751c2bf3
+SHA1 (patch-chrome_common_chrome__switches.h) = 677bf0474cf938cb78dbcab4e69de15e96153e19
+SHA1 (patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc) = 9b69d214928309b0ff0cd3b4599fe4b78ad4eb97
+SHA1 (patch-chrome_common_media_cdm__host__file__path.cc) = db791b5d5b1ec6044ba9e51cef7281b42d758702
+SHA1 (patch-chrome_common_media_cdm__registration.cc) = 8c1af7d302bd04d90a61b3c7d8192adde67182d5
+SHA1 (patch-chrome_common_media_cdm__registration.h) = 8cfb1c7f55e383aebb0ebdb5cb75f071c6f376ea
+SHA1 (patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h) = 05d8ac8c8ef8df480d9ba4d6654a10ba28d215ee
+SHA1 (patch-chrome_common_pref__names.h) = 43b85fcb95bf139e30f25f20c09001474a818366
+SHA1 (patch-chrome_common_url__constants.h) = 93534a3b707a3556ce87e316d64ee0332b6cda07
+SHA1 (patch-chrome_common_webui__url__constants.cc) = 9be79093fcde8d6c42cf0640e4aa9b7efeedd819
+SHA1 (patch-chrome_common_webui__url__constants.h) = c23f1233dd2de7af0f39a5383c4f81e5918f32e2
+SHA1 (patch-chrome_enterprise__companion_enterprise__companion__client.cc) = 4f03f2fa232b3ef27df7e5836b2de2cc3ea48c5d
+SHA1 (patch-chrome_enterprise__companion_lock.cc) = 457cf259d3a4a650737e09b92c135c7d25d643d3
+SHA1 (patch-chrome_renderer_pepper_chrome__renderer__pepper__host__factory.cc) = 132d117870dd853e1ce7a742847301fce703c4cd
+SHA1 (patch-chrome_renderer_pepper_pepper__helper.h) = 0ba939303c30524baf6920b82422af15bb8a7b81
+SHA1 (patch-chrome_services_printing_print__backend__service__impl.cc) = 2ea100411382ceb471132f92b05241f5064a06f0
+SHA1 (patch-chrome_services_speech_audio__source__fetcher__impl.cc) = 35e4df8504042490ed8db54590b5df20f20acbaf
+SHA1 (patch-chrome_test_BUILD.gn) = ae5a1ec69bfb7c9db7d06fdf8cf6f43d1f6fd36b
+SHA1 (patch-chrome_test_base_scoped__channel__override__posix.cc) = 7c89e95d3ea2bd4560a933918706fd15edb76217
+SHA1 (patch-chrome_test_chromedriver_chrome__launcher.cc) = 04c5711bfdf505a84e602046db61d7fb13864b3b
+SHA1 (patch-chrome_test_chromedriver_chrome_chrome__finder.cc) = dff49553c9932fb04c5487d7119e41152986ba2c
+SHA1 (patch-chrome_test_chromedriver_key__converter__unittest.cc) = 67bb9145b98cc19f929c181ab3f57df2a2cb803a
+SHA1 (patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc) = 548cb3ab8d5e88ba71b10771c2db2865050e9324
+SHA1 (patch-chrome_updater_configurator.cc) = 9fcc81595cb5e119f3bdd9acb31d4fc94a915875
+SHA1 (patch-chrome_updater_lock.cc) = 8af81365e7050faf9caf9a091f89a44b14056dcc
+SHA1 (patch-chrome_updater_util_posix__util.cc) = acb82a963576c99503e52346794fc5e911ddca72
+SHA1 (patch-chrome_utility_services.cc) = 26d6365803a5117c473222565de755b0cfbaf794
+SHA1 (patch-chromecast_browser_cast__browser__main__parts.cc) = d16f35756b36a5e03fadfcece24375c7ce95fb39
+SHA1 (patch-chromecast_browser_cast__content__browser__client.cc) = 647f9678a1f50b6bf348340f07e3bcc581c2a25f
+SHA1 (patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc) = 31064135fda1ffcc33c492ccca1ead3a91be80f5
+SHA1 (patch-chromecast_media_base_default__monotonic__clock.cc) = f27974b405266bf0c30837a2134d5dd20654445b
+SHA1 (patch-components_autofill_core_browser_payments__data__manager.cc) = 57d19d8ca14d8fab97e11e8d524a1e408547ec55
+SHA1 (patch-components_autofill_core_common_autofill__features.cc) = ef4754fa4240f643d8d3f0bd92b47dc7c4c7fb6b
+SHA1 (patch-components_autofill_core_common_autofill__payments__features.cc) = a441c07fbc4edf49d2b09229727e052d7a859731
+SHA1 (patch-components_autofill_core_common_autofill__payments__features.h) = a3cbd0a2b26e5f452d626efba6649a26175e4324
+SHA1 (patch-components_commerce_core_commerce__feature__list.cc) = c7a578d9f82ca16d6f093044f53d24ab4c3f0b2e
+SHA1 (patch-components_constrained__window_constrained__window__views.cc) = 9d52d5638416a6e4f3215fadc06634b3db2c1f44
+SHA1 (patch-components_content__settings_core_browser_website__settings__registry.cc) = ddd10e59da2b7e7ab858abf1361f4cf2b0270267
+SHA1 (patch-components_cookie__config_cookie__store__util.cc) = d7495179cf2fa518522bd7b385a5647ac83752a8
+SHA1 (patch-components_crash_content_tools_generate__breakpad__symbols.py) = 33ff55b20432233fbb37dbe8bbf0095adfd57495
+SHA1 (patch-components_crash_core_app_BUILD.gn) = be043d5d53fa8b5f4c8666a4c7ec11121f4daeb0
+SHA1 (patch-components_crash_core_app_chrome__crashpad__handler.cc) = 7b454f9675b5351d86091f6a66caeef0e846040d
+SHA1 (patch-components_crash_core_app_crash__reporter__client.cc) = aab88da7c5439bb4679524c12d54d6fed0037cf3
+SHA1 (patch-components_crash_core_app_crash__reporter__client.h) = 0421a8dbbafac9b25e62cebfd468c346e05819ab
+SHA1 (patch-components_crash_core_app_crashpad__handler__main.cc) = 9ca0131f5cba90fc45d56b98494d16ba3d92783b
+SHA1 (patch-components_crash_core_app_crashpad__linux.cc) = c90c0c21498cf0f1462277c57a3207507644fafe
+SHA1 (patch-components_crash_core_app_crashpad__mac.mm) = 548917e0883aff5fe00064942730b973ec13a5c1
+SHA1 (patch-components_crash_core_app_crashpad__win.cc) = 5da961106193ff5628732f2a1d23b495678e6e88
+SHA1 (patch-components_crash_core_browser_crash__upload__list__crashpad.cc) = bfc7be370e5fef8b79909383b562f6aa3cbee6f2
+SHA1 (patch-components_crash_core_common_BUILD.gn) = d91c5fa21cf77022f29a77aeacbcd715cc993ac0
+SHA1 (patch-components_device__signals_core_browser_mock__signals__aggregator.h) = 24571c3384316a3274b8847a68ec8979ad9e4803
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator.h) = d110ee733452995c01b716f70bff2fdd6af3d379
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator__impl.cc) = 2dfb17a312a9aae79b76e1cc0fc648f8e17be3ec
+SHA1 (patch-components_device__signals_core_browser_signals__aggregator__impl.h) = 25466f04da1d491d56a59c30566c5599aaaa5e20
+SHA1 (patch-components_device__signals_core_browser_user__permission__service.h) = 42330ac1d15d077cad66682d57eecf2972d93f06
+SHA1 (patch-components_device__signals_core_browser_user__permission__service__impl.cc) = 95c602322374c733ff0263bb9f83f642aa222321
+SHA1 (patch-components_device__signals_core_browser_user__permission__service__impl.h) = 48cdc320ad59471c9fb65fcf84109124bad67b53
+SHA1 (patch-components_device__signals_core_common_signals__features.cc) = b33cc9e6ea379e6a96e14d684f4393e7941476d7
+SHA1 (patch-components_device__signals_core_common_signals__features.h) = 8e21da206c5363b23077379cac604f66f0428cef
+SHA1 (patch-components_device__signals_core_system__signals_platform__delegate.cc) = 48ca5c43bf94cfb7becfe5f0b1483a8856a6900e
+SHA1 (patch-components_device__signals_test_signals__contract.cc) = e43cb042ed470f60f337c5af6cf788f4130cc4a7
+SHA1 (patch-components_discardable__memory_service_discardable__shared__memory__manager.cc) = 8bf5ff867336fadcbaaf06ef1aa9ce679dc227e4
+SHA1 (patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc) = 6e929a36ff4498e776621a7c9f23cf2561b3f623
+SHA1 (patch-components_embedder__support_android_delegate_web__contents__delegate__android.h) = 15213166da4b24e56a59c25d9e1634e47a5c7f64
+SHA1 (patch-components_embedder__support_user__agent__utils.cc) = ce9317e6fef5c2085bb27df666ec302730ef5d1a
+SHA1 (patch-components_embedder__support_user__agent__utils__unittest.cc) = 942d0f6022386652da229da1af88394ec43382d1
+SHA1 (patch-components_enterprise_watermarking_watermark.cc) = 1836f8f06b0740ae3e997c847cec674dcfb84d29
+SHA1 (patch-components_eye__dropper_eye__dropper__view.cc) = b295603a3fb230345e9c465d3a3038a4d62e78f2
+SHA1 (patch-components_feature__engagement_public_event__constants.cc) = da4109ace00e6958b9b8edd3f0ab675b3aee3416
+SHA1 (patch-components_feature__engagement_public_event__constants.h) = 43568b7d4092537a881e8bc1c5feab8cef77c603
+SHA1 (patch-components_feature__engagement_public_feature__configurations.cc) = e4d7f6d2a269a1b151bb7cbbac7096ccf3f20851
+SHA1 (patch-components_feature__engagement_public_feature__constants.cc) = 09a1c1e79c76e1b6d3d6f68ada599933fd624fbb
+SHA1 (patch-components_feature__engagement_public_feature__constants.h) = 2ecc402df522c878f645d4f765fc9e03b706b8ba
+SHA1 (patch-components_feature__engagement_public_feature__list.cc) = bcb4ff35e480065a748774aad7e4150d99993ede
+SHA1 (patch-components_feature__engagement_public_feature__list.h) = d82643110889ae7d279211f37ea57e12d4ab7ee3
+SHA1 (patch-components_feed_core_proto_v2_wire_version.proto) = a1c97b9efdddcb43b8baa76f0a3684e51ea5bbca
+SHA1 (patch-components_feed_core_v2_feed__network__impl__unittest.cc) = 7a16c5e1504b252fca5ecf8281c7d7b9d5e9ed59
+SHA1 (patch-components_feed_core_v2_proto__util.cc) = 4b630f3b57c716b3433121ff341c852971f51696
+SHA1 (patch-components_feed_core_v2_proto__util__unittest.cc) = 81119f581d02c05366f83b5142bc2bc9c1e85a27
+SHA1 (patch-components_feed_core_v2_test_proto__printer.cc) = 72bb413fed23c448027fbfa31d32d88b9a85e0cb
+SHA1 (patch-components_flags__ui_flags__state.cc) = 15a8a3892f1513bdac6d89a0bf7bcbc29020bdf2
+SHA1 (patch-components_gwp__asan_BUILD.gn) = 45a9914c5b3fdffbe2d743a1558f168df9b237a5
+SHA1 (patch-components_gwp__asan_client_guarded__page__allocator__posix.cc) = fa8a35e91860d6c7f1c8b10ed664d0a731f54a00
+SHA1 (patch-components_gwp__asan_client_gwp__asan.cc) = ad99e7b8205d1789637a667b28fcb130b9a8b5f9
+SHA1 (patch-components_gwp__asan_client_gwp__asan__features.cc) = f2c62b60144f329d0c44e9c2c934fb7037041273
+SHA1 (patch-components_gwp__asan_crash__handler_crash__analyzer.cc) = 51b697b49cbe8670aaf9c0383afb10c3e140c6b2
+SHA1 (patch-components_live__caption_caption__util.cc) = b1425767efa2cb30c35e7e79444f4bb0946ab579
+SHA1 (patch-components_live__caption_caption__util.h) = 286e362db6aa430d1b8d6490728a86d4ab188345
+SHA1 (patch-components_media__router_common_media__source.cc) = 1025978e514259f7c2d5a4b5fea66b01435e8bbb
+SHA1 (patch-components_media__router_common_providers_cast_channel_cast__message__util.cc) = 524e7092b112214981fea6518d539944c833cdc6
+SHA1 (patch-components_metrics_drive__metrics__provider__linux.cc) = b776c38c39b9b47faaa3eafc3b7980fdb7720c9a
+SHA1 (patch-components_metrics_metrics__log.cc) = 0578b212acd889c48631320a205fe8258c7e8a7f
+SHA1 (patch-components_metrics_motherboard.cc) = ce7bfa3e9b78504bcc5f667bbf49136bca928a29
+SHA1 (patch-components_named__mojo__ipc__server_connection__info.h) = dbad47fc623f693a359bb066df1f74f08cfc2057
+SHA1 (patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc) = 436c700985b41ac4ec77ff9460254159fb1c1a79
+SHA1 (patch-components_named__system__lock_lock.h) = d0d482c2d5f32b5ac524448f2f1b6968264c3ce0
+SHA1 (patch-components_neterror_resources_neterror.js) = e067fe1b161778ec49fc1dbfd0aad1f380de0b96
+SHA1 (patch-components_network__session__configurator_browser_network__session__configurator.cc) = 570523d2440554754e2c0d016a46b9f6f86fc472
+SHA1 (patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc) = 5829d0573fb7920f3827cf660e97330e963e32f9
+SHA1 (patch-components_offline__pages_content_background__loader_background__loader__contents.cc) = 0c219f285e7e99b6173cbb5d29dcc18906cae0c7
+SHA1 (patch-components_offline__pages_content_background__loader_background__loader__contents.h) = 713e2bd3d307094393b309e066616af4f9859605
+SHA1 (patch-components_optimization__guide_core_optimization__guide__util.cc) = 2bf7c654dc510c906369706ed24358477ea5d37b
+SHA1 (patch-components_os__crypt_sync_BUILD.gn) = d5179e2d3aad76103e469650fdfb2ecdc5c99ba8
+SHA1 (patch-components_os__crypt_sync_keychain__password__mac.mm) = 331649ba974f7b1816f135a610b3fe8c5222708e
+SHA1 (patch-components_os__crypt_sync_libsecret__util__linux.cc) = 5b1d0b96f75858bf3abe6b00b68a2e349748d9e3
+SHA1 (patch-components_os__crypt_sync_os__crypt.h) = 5ceb590eadc3f7aed3ef4c3d621eee004955ab18
+SHA1 (patch-components_paint__preview_browser_paint__preview__client.cc) = 7984079f7225e87883a77f8a71bb038c49c796db
+SHA1 (patch-components_paint__preview_browser_paint__preview__client__unittest.cc) = e5c51687539bfef70a717b22fea7724f7ea00df6
+SHA1 (patch-components_paint__preview_common_proto_paint__preview.proto) = c407b3cb0c7ecce0679f56130c02b5dda1ecc80f
+SHA1 (patch-components_paint__preview_player_player__compositor__delegate.cc) = 98e3ba37131c91c2fb2288a38d22030095d396f9
+SHA1 (patch-components_password__manager_core_browser_features_password__features.cc) = 7534391ed7889bd47a81d1a21bdbae885491b5ec
+SHA1 (patch-components_password__manager_core_browser_features_password__features.h) = 24830b2d7bd6e40cdcd52361566cafa8244682ec
+SHA1 (patch-components_password__manager_core_browser_password__form__manager.cc) = e91e04e4f4677857b7ddf65095450d957fa100f0
+SHA1 (patch-components_password__manager_core_browser_password__manager.cc) = 765f56af160665d7b28e7f2d4292281f92edd843
+SHA1 (patch-components_password__manager_core_browser_password__manager__client.h) = d589b7109c9c20cdd752c2224b7a5bb9fe68a4ae
+SHA1 (patch-components_password__manager_core_browser_password__manager__switches.cc) = 22f31fb63a9b7dc660c43b1cc0851965c60a1846
+SHA1 (patch-components_password__manager_core_browser_password__manager__switches.h) = b8377c70fc881f5647cdf58030dee55b53f16151
+SHA1 (patch-components_password__manager_core_browser_password__manual__fallback__flow.cc) = c5013d020b047cc6fc87754e2f36c2688913c450
+SHA1 (patch-components_password__manager_core_browser_password__manual__fallback__flow.h) = bcbc685be1542de96b71891543ff4efbcf7b39a5
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database.cc) = e96d46461c05563c7bc9f2a720d3231cb1c22623
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc) = 3ded120a23d35d9bce3a353888c9881dde75743a
+SHA1 (patch-components_password__manager_core_browser_password__store_login__database__unittest.cc) = abd6d26c0ee00eee7249b96291131da3e96bc267
+SHA1 (patch-components_password__manager_core_browser_password__store_password__store__built__in__backend.cc) = d6bbf7546e48b095f2ebaf6dd674d74ce10bee9d
+SHA1 (patch-components_password__manager_core_browser_stub__password__manager__client.cc) = 5f64e37130d1b5e9624f4d33ce660bae00faac3b
+SHA1 (patch-components_password__manager_core_browser_stub__password__manager__client.h) = cb98cfefa2168dbee5f45a9bc1aafa55a6d146a1
+SHA1 (patch-components_password__manager_core_common_password__manager__pref__names.h) = 0afe85c0a667e70c629922bb432ab0094f87af30
+SHA1 (patch-components_performance__manager_public_features.h) = 52c2eba37ab640c859d5aef2675da2e2462895f4
+SHA1 (patch-components_permissions_prediction__service_prediction__common.cc) = 91f79bb3219f56299ade9f5c8c218ffa481cfe70
+SHA1 (patch-components_policy_core_browser_policy__pref__mapping__test.cc) = 6a99ef4993f4cf66db0f7ec2f9345e6bf8d4621c
+SHA1 (patch-components_policy_core_common_cloud_cloud__policy__client.cc) = 803ef7fe460ec82c32c6fb3095140c69b93fd38f
+SHA1 (patch-components_policy_core_common_cloud_cloud__policy__util.cc) = 18064c2a196c2142614fcdb4cf79b1f555ce0c4a
+SHA1 (patch-components_policy_core_common_policy__loader__common.cc) = 2e6957a725183312c0cfe0f6ce4e2055c46105bd
+SHA1 (patch-components_policy_core_common_policy__paths.cc) = ad737651d03eef7b2803d113a7b9c4dbe587934d
+SHA1 (patch-components_policy_core_common_policy__utils.cc) = 8b67dafa2c71c43dda7d1a10d25b73d7f1fe194c
+SHA1 (patch-components_policy_tools_generate__policy__source.py) = b79171df808ed966322109b9fb38240aac5747d6
+SHA1 (patch-components_power__metrics_BUILD.gn) = a8da578dc982151041c998addc6e6322a99a1755
+SHA1 (patch-components_power__metrics_energy__metrics__provider.cc) = b75860da51f85b43f6bfcbe42d539c5cf33900cc
+SHA1 (patch-components_printing_browser_print__manager.cc) = b9a5ef90bf071bd3851f1eb43a08fa50cfdc6e1f
+SHA1 (patch-components_printing_browser_print__manager.h) = de76c30673ff466ab352524a16cfdd122bbc1b07
+SHA1 (patch-components_printing_common_print.mojom) = a3cebba05c5daee56fdad36292834c3b0d0842c4
+SHA1 (patch-components_printing_renderer_print__render__frame__helper.cc) = 3da5c9dc1af95335623734de581700aa3ae5fe44
+SHA1 (patch-components_printing_renderer_print__render__frame__helper.h) = 09bb9fc403e1851860278787f925b138ccd1974a
+SHA1 (patch-components_remote__cocoa_app__shim_BUILD.gn) = 1477f31a5a7a7e3c5054465fd5f568208f7bb992
+SHA1 (patch-components_remote__cocoa_app__shim_application__bridge.mm) = 3e8a6e2c544a75ce4cf99f41bab5b596df5734f3
+SHA1 (patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm) = bc33fa13bf643212f6e4f0072887f33da2bb65e6
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm) = f0d21f80633e668494eafd80233c26b12351a458
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h) = 410851e0a3955417049fec0ecebe41e9dbe1aade
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm) = 44f86e77e019ad40c37290111c58c188ddfff254
+SHA1 (patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm) = 28caed0b120df2158650bd1d43a08ce42b6c6b14
+SHA1 (patch-components_safe__browsing_content_common_file__type__policies__unittest.cc) = 62da341641579c38359cdcf2b6120e54bce92b3e
+SHA1 (patch-components_safe__browsing_content_resources_gen__file__type__proto.py) = 06dadefe5a9524e4ccd60e06b679a6a116a09070
+SHA1 (patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc) = 3cea4a35d23422243766349a8e2820d9dffc24f2
+SHA1 (patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc) = 4a690e1ecd2cab5623e06d2bdeed7def9c121906
+SHA1 (patch-components_safe__browsing_core_common_features.cc) = 3ce2f0222382ba5df10724e14a968cdc3f23cfd4
+SHA1 (patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc) = 172e61206f78a95edcd9cc911af2069def45de03
+SHA1 (patch-components_search__engines_template__url__service.cc) = bed2fc543839ab370c8e6bc6ad63c1e8949f90e3
+SHA1 (patch-components_security__interstitials_content_utils.cc) = e56edc07ebde184f7babe94466fcb7c4d3c379b3
+SHA1 (patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc) = 813d1b679195ceb531e7fca92ec711a0a391928a
+SHA1 (patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc) = a4b7126ad863a2de2fad470a74e95811b23a1ae9
+SHA1 (patch-components_services_storage_dom__storage_dom__storage__constants.cc) = 06d0c3620ca3530d01989838b65bcfbfbaa27663
+SHA1 (patch-components_soda_soda__util.cc) = ecda3f170d54acd30ae82d387e675e77c29f55d6
+SHA1 (patch-components_startup__metric__utils_common_startup__metric__utils.cc) = f8608833e867fd28230195d39304b2be42d38dbd
+SHA1 (patch-components_storage__monitor_BUILD.gn) = 4754206fca44ff5277980b1f94a82762611c70d9
+SHA1 (patch-components_storage__monitor_removable__device__constants.cc) = a860fedee49911c07776da8a92ba3f4c15f0f778
+SHA1 (patch-components_storage__monitor_removable__device__constants.h) = 3d159cba35d3247b6d9f87c578f15c7e015b3833
+SHA1 (patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc) = f6fc88b3dabc658d1155cfa21c9b468c803d495c
+SHA1 (patch-components_supervised__user_core_browser_supervised__user__preferences.cc) = 70fb7cb7f7d10ae04b320d1b5556e3066f66384b
+SHA1 (patch-components_supervised__user_core_browser_supervised__user__service.cc) = 3692004ac027a3910a73e42c98cc736fc4378bd2
+SHA1 (patch-components_supervised__user_core_common_features.cc) = bd72b0fe90f9272a434ad12d3d8fc89f55187c9f
+SHA1 (patch-components_supervised__user_core_common_features.h) = af6d030831fab8ac8f75adc8252c957041cec1da
+SHA1 (patch-components_supervised__user_core_common_pref__names.h) = 086a79d6f07f477ec3268cc5de4ba8500121d694
+SHA1 (patch-components_sync__device__info_local__device__info__util.cc) = bbabf7bef7b134c9ca2cd122747b8ed490950eec
+SHA1 (patch-components_sync__device__info_local__device__info__util__linux.cc) = 0b277b9a140a59a4251b5d8390ef79b9c5184e6c
+SHA1 (patch-components_sync_base_sync__util.cc) = 694c6cafc572987487a6105aef01a98309a43d4d
+SHA1 (patch-components_system__cpu_cpu__probe.cc) = 0fa23a50deb03c3c311ff55ef27c8152dc4ca3fa
+SHA1 (patch-components_translate_core_common_translate__util.cc) = 0e012dc7c35c77780364f2af9789ff858d25a5b2
+SHA1 (patch-components_trusted__vault_trusted__vault__connection__impl.cc) = 7123863dc0158a3844c7d194a54afb2520eaa4a8
+SHA1 (patch-components_update__client_update__query__params.cc) = 5ae7dd3163e6f21edbe54d340d0eb61c28cd4ff9
+SHA1 (patch-components_upload__list_upload__list.cc) = e1694c29455c45fe40db529200b675fad884d3b5
+SHA1 (patch-components_upload__list_upload__list.h) = 2dba5205cf863281c8ce3b088ae3739d2e6f51ea
+SHA1 (patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc) = f104ae9f263cb66f9c934cf9d62693c95a07e9b7
+SHA1 (patch-components_user__education_views_help__bubble__view.cc) = a98c8b740b9587b3c1d939d5c51940745a3abfe8
+SHA1 (patch-components_variations_service_variations__service.cc) = f5a58151d2e1c74ada061e622e954f460fd980c0
+SHA1 (patch-components_visited__url__ranking_public_url__visit__util.cc) = 1111e35154cf9ddda1c5be87abaa4cdbb19af469
+SHA1 (patch-components_viz_common_features.cc) = 1299d9cfcd62a74811c65e1fa867b1b3801d3cbc
+SHA1 (patch-components_viz_common_features.h) = e1815deb7c71f9eae1076390a33a04bb852a8fdd
+SHA1 (patch-components_viz_host_host__display__client.cc) = 22727fd250994244043d08185c3d87fbb8c650f8
+SHA1 (patch-components_viz_host_host__display__client.h) = 9e2105703ecd6ad172ac9f50fed3a430217164d4
+SHA1 (patch-components_viz_host_layered__window__updater__impl.cc) = 32753a93b9d5a8959d7152a01b9dfc4fb1c408fb
+SHA1 (patch-components_viz_host_layered__window__updater__impl.h) = 8bd5eff9c4982929d6da553e4d52a81bdab4c539
+SHA1 (patch-components_viz_service_BUILD.gn) = 68feff61d6f04576291685cf10312914002275e9
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider.h) = cf54788218de1526c39a8d0a35ec90e0de50ea8e
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider__impl.cc) = 684b5a0e77c68069281ba5318d331b6614200f53
+SHA1 (patch-components_viz_service_display__embedder_output__surface__provider__impl.h) = 7109f692eebdf60238f430eb9082de5c58aae605
+SHA1 (patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc) = b8eff385acbadf1841aaa5179977e047de0aea79
+SHA1 (patch-components_viz_service_display__embedder_skia__output__surface__impl.cc) = f0c16bc9697ca1869db4735e6ed9b9644665200e
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__mac.cc) = d7c603561ff4a8ffc9d82024a04cbb95ddeedd5d
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__mac.h) = d950a491f420d9e4b85a56d5725d5c11a0e4453a
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__proxy.cc) = e863a48fdc896f1f0ff8197bbccc0f7c310b6969
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__proxy.h) = 69318681b6e57253733813125f34505a6190b6af
+SHA1 (patch-components_viz_service_display__embedder_software__output__device__win.cc) = bb8b725bb5f08379be6d6dd6056cd12f85358eac
+SHA1 (patch-components_viz_service_display__embedder_software__output__surface.cc) = 67e3c62527085409300dbbb52f3d4584d5d6bc4a
+SHA1 (patch-components_viz_service_display__embedder_software__output__surface.h) = a9a6448a2890ecdf5edf946d79f9ac15c324c119
+SHA1 (patch-components_viz_service_display_skia__renderer.cc) = e15b8eb039260ab52b19c966da2b724fc0676d20
+SHA1 (patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc) = 8c782435c2cf6e7f372c18738ff70eb6ecde2078
+SHA1 (patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h) = c6b2b264c5abe9626fafc6115e1ae50203a2d41b
+SHA1 (patch-components_viz_test_fake__display__client.cc) = 8dc74c108dd1aab5ce191f17b351ced91c1edfe1
+SHA1 (patch-components_viz_test_fake__display__client.h) = 0aec635c8e89d28795a93a9a5ed33c1ef15c01c0
+SHA1 (patch-components_viz_test_mock__display__client.h) = 89cca3fedcb63363559ec1d7469a2519b0077647
+SHA1 (patch-components_viz_test_test__output__surface__provider.cc) = b5d369049b91018537b1be67fb50f14dddc6c5bb
+SHA1 (patch-components_viz_test_test__output__surface__provider.h) = e60852cd98a1413708385cf452def084a72a26f6
+SHA1 (patch-components_webrtc_media__stream__devices__controller.cc) = 02fe62cd8cae53fc77578b332cc20f89c1ab8742
+SHA1 (patch-components_webrtc_media__stream__devices__controller.h) = cce513ab96bb0298fa2119f86b653abf5cc31ad1
+SHA1 (patch-content_app_BUILD.gn) = c10e3305442bd843165857f8b3c735f114927f52
+SHA1 (patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm) = 03b3ef5bfc20596fbff6febf87c72680dd06cf22
+SHA1 (patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm) = 6d9f60a43ba03bbfe392b9eef5c9fe0fceb79248
+SHA1 (patch-content_app_content__main.cc) = 14c1f3d9bb0dd2c4fafbc20e3103bad3e0f21f95
+SHA1 (patch-content_app_content__main__runner__impl.cc) = e8c8010099e423763e4e81390c99065e4a68d499
+SHA1 (patch-content_browser_BUILD.gn) = c5caeeba91a65c70ebca17ed64f591e8a0d66003
+SHA1 (patch-content_browser_accessibility_browser__accessibility__manager__mac.mm) = b77a49521e572e8b1d42c8c5242d206469d30149
+SHA1 (patch-content_browser_audio_audio__service.cc) = 11bbc768a8eb6f30da0364e2ae9fc50bcb42c16a
+SHA1 (patch-content_browser_browser__child__process__host__impl.cc) = 09d401a9284a4f3d436f9eb8b90ef0b021ebfd76
+SHA1 (patch-content_browser_browser__child__process__host__impl.h) = 475caf93443bd2f0f9dc358972187daecfcf7ab3
+SHA1 (patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc) = 16a11effda0ed0e2f7f1a6f47d07e69c1ae8cebf
+SHA1 (patch-content_browser_browser__main__loop.cc) = bdc514252c2b86d4b8ef3d366a92a4c2983a19a0
+SHA1 (patch-content_browser_child__process__launcher.h) = 341b0f0e1666640681861584a469bed89fa3e56d
+SHA1 (patch-content_browser_child__process__launcher__helper.h) = b82423e1579955705d85ded72cf3f793521996f6
+SHA1 (patch-content_browser_child__process__launcher__helper__linux.cc) = 34893464dc67620a21eb6f56c3d5c0569afb31b5
+SHA1 (patch-content_browser_child__process__launcher__helper__mac.cc) = 3cfe079b4b77bcf932622f72c6e50b18d5ae2b78
+SHA1 (patch-content_browser_child__process__launcher__helper__win.cc) = a5c0abdc83b22f4556b6951e4700a24c5b0798d6
+SHA1 (patch-content_browser_child__thread__type__switcher__linux.cc) = e031a8d8a5e412c7bf0bf7b644c3d96637428f76
+SHA1 (patch-content_browser_code__cache_generated__code__cache.cc) = 1ff14511cfdedb13a8e60372dffeb36abb30db96
+SHA1 (patch-content_browser_code__cache_generated__code__cache.h) = 616f659176318c6abba377592d73aec7d0c98cc6
+SHA1 (patch-content_browser_code__cache_generated__code__cache__browsertest.cc) = 7943cf7e854225c12f7adc85d391300ce57b8915
+SHA1 (patch-content_browser_compositor_viz__process__transport__factory.cc) = a68d3dd6a7553c040b3bcdc4320ca5498794834d
+SHA1 (patch-content_browser_devtools_devtools__frontend__host__impl.cc) = 06bd07e2379e90fde374be8d551baa72bba41108
+SHA1 (patch-content_browser_devtools_devtools__frontend__host__impl.h) = d14b88e0c17913346b93fa07c7ca3890f1288da2
+SHA1 (patch-content_browser_devtools_protocol_system__info__handler.cc) = 76e109248f5d85f19b1aedba9fde3278cbe5789d
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h) = 1d09e3829d61de6cc81e160263a3559e377dca8c
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc) = a9861e0dc9f20516376f9db89e2bff2e939091ca
+SHA1 (patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h) = be2f9bdb35e18d0afccbe0b16cadf1e8f69d4aac
+SHA1 (patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc) = efcdffecb1393f81e04988aa7c33312d6fe818a0
+SHA1 (patch-content_browser_font__access_font__enumeration__data__source.cc) = 2cdae6e5fceaf9e77b0e77ec30e606016cca07fc
+SHA1 (patch-content_browser_gpu_compositor__util.cc) = b0fd2d862b5f75c62dc8dfb1ca673ec6000075f5
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl.cc) = 3d72529d23f9b0133b66a7428c9dd9ad68d794f1
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl.h) = 51c90f796b663942668602860b98d617f472e87e
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl__private.cc) = 79d83d7d7befe5c416cea19d24633312a0e5b2a2
+SHA1 (patch-content_browser_gpu_gpu__data__manager__impl__private.h) = a1cc04961f00d87aa6a3b9b824c1d57ab662255c
+SHA1 (patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc) = 409e8676866436e4c113f38651e157c978194b72
+SHA1 (patch-content_browser_gpu_gpu__process__host.cc) = 70a1618cc9620f25fb62ac560c291a8c99acbc1c
+SHA1 (patch-content_browser_media_capture_desktop__capture__device.cc) = 3da321b6f8df0a84a2b39deef57f6f0921217ba3
+SHA1 (patch-content_browser_media_capture_desktop__capture__device__mac.cc) = fee0282f7180815c823d5918545508b2e98d488f
+SHA1 (patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc) = 998ab85ac3acdb8687b90785761f87d536aef13f
+SHA1 (patch-content_browser_media_capture_io__surface__capture__device__base__mac.h) = 86929e4be5b769cce9e26b544892cac5abf0d4e7
+SHA1 (patch-content_browser_media_capture_screen__capture__kit__device__mac.mm) = 03bdd8c6db026d195e7f2dce03618efe54c7bda1
+SHA1 (patch-content_browser_media_frameless__media__interface__proxy.h) = ba96aabcb58e29e0a8cfc2573ca48489b67a298f
+SHA1 (patch-content_browser_media_media__keys__listener__manager__impl.cc) = b699081aa3205029047ebea1ef06848ce61da236
+SHA1 (patch-content_browser_network__service__instance__impl.cc) = 162cf1d9d31caa2380a0deddd83301648203603c
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl.cc) = de913b0fd5d10ddbe395d61c6add68a06411a3c4
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl.h) = 837b6d7bda2c4a9e969636413945004de0e60de0
+SHA1 (patch-content_browser_notifications_blink__notification__service__impl__unittest.cc) = 7aec12d2f9bd15550c8c320a93fb60837fb0582e
+SHA1 (patch-content_browser_notifications_platform__notification__context__impl.cc) = f773d4fe2520958459d053a099ef2cf97591aead
+SHA1 (patch-content_browser_notifications_platform__notification__context__impl.h) = b47bf67a798473105f1d77c4d8590a24e289c277
+SHA1 (patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc) = cdf83ae7d3aaab9eab570c0377f35328e7a0806d
+SHA1 (patch-content_browser_ppapi__plugin__sandboxed__process__launcher__delegate.cc) = e6923ea336325dd4af59951507e7035b151bab7c
+SHA1 (patch-content_browser_renderer__host_code__cache__host__impl.cc) = d5b1885f2272260ef02214b4dbf39637c78100b5
+SHA1 (patch-content_browser_renderer__host_delegated__frame__host.cc) = 52775160dc6b4d4eae08d2881e6ed715f1a37e15
+SHA1 (patch-content_browser_renderer__host_input_input__device__change__observer.cc) = 078edbf587b9ba5f511b95f0dd6911043e131e38
+SHA1 (patch-content_browser_renderer__host_legacy__render__widget__host__win.cc) = 73e7c880f7438e8bc5d928e0a751fc3b5795a77a
+SHA1 (patch-content_browser_renderer__host_legacy__render__widget__host__win.h) = a8da8eca5559b2930bacffdf099c6f588c7f3462
+SHA1 (patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc) = d1b5dc4422f4140addc7cb85f3734a310e5f77b9
+SHA1 (patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc) = 46afb8b3e082b5dcd8b0d2cd3ebb57f36fe824d5
+SHA1 (patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc) = 4503248dacda854e0296ece52d2b429de2f0bc28
+SHA1 (patch-content_browser_renderer__host_navigation__request.cc) = 265ea91da9df1b0654dd7dd123928865854367f7
+SHA1 (patch-content_browser_renderer__host_navigator.cc) = 891ed2b5dbc1a2d6e3bdad4056cc2083bb59fe33
+SHA1 (patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc) = cd7cf8747ecb9e6bc082eea8dad8efc31e83904b
+SHA1 (patch-content_browser_renderer__host_render__frame__host__impl.cc) = 534a066bc71720fbc5498de5fe5e9ff2dbe401b1
+SHA1 (patch-content_browser_renderer__host_render__frame__host__manager.cc) = a190da69202fcdc29637277331f2243bda320214
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl.cc) = 5e65a66027cc51307189b0fb126426cbf56c93f8
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl.h) = 03abb631aa6bab495f07efd652dce410df37e93d
+SHA1 (patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc) = 91cda8fd1aebb04cec27660d7f12c264cea6107d
+SHA1 (patch-content_browser_renderer__host_render__view__host__impl.cc) = c5284e3db8504e4791ed8cc126d738fc55475154
+SHA1 (patch-content_browser_renderer__host_render__view__host__impl.h) = 5a6e3ec4d7a71a806e84ad8e6a0e1e085a0ff974
+SHA1 (patch-content_browser_renderer__host_render__widget__host__delegate.h) = 0508b941ecc0f9c1b91d7c914d86a1b93dc732fc
+SHA1 (patch-content_browser_renderer__host_render__widget__host__impl.cc) = cf54ab939a51c786d0d46c033e825c4781655e41
+SHA1 (patch-content_browser_renderer__host_render__widget__host__impl.h) = 2f52b6642c88c8e0ddc7aaa9c0e2adf0a67305f4
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__aura.cc) = 83c6e80d41ce660d56c0ad6c88d5a2ec4bb8066d
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__aura.h) = e157cea52a4ca3614c841c8f66f7c7ce539ce436
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__base.cc) = 698ec5c50a37cb557071c1d9d1abf263e769abf4
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__base.h) = 87c97e6b365f550f1c1c5e282b7c0fa15494a525
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc) = 64cc147a63c61926eb30ca91f14bd56f96224a05
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__mac.h) = 546e89a68aa4269f33f5ce13f82f093d6ccdbdd0
+SHA1 (patch-content_browser_renderer__host_render__widget__host__view__mac.mm) = 3b103cff91a7eb7ef8ab78b473f5bbe7c4424c62
+SHA1 (patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc) = 6f36fc6c1a79161bcdfed6e790e0f31432f20186
+SHA1 (patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h) = f7ec517854c5a7efd9b63754d72ef15830834111
+SHA1 (patch-content_browser_renderer__host_text__input__manager.cc) = 537b086d1ec119958869b82277f2a1cad9022691
+SHA1 (patch-content_browser_renderer__host_text__input__manager.h) = 2df6161d2d749a532e5b3ebf40b0480e813412be
+SHA1 (patch-content_browser_sandbox__host__linux.cc) = 428442ad37f9e736fb10163baaaedd0f994063cb
+SHA1 (patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc) = 5be22f66c55fdb85ee6f183728a5d3251f258e9d
+SHA1 (patch-content_browser_scheduler_responsiveness_native__event__observer.cc) = 38efd4c4c839a4f014e4dedaf09c2e70104c1065
+SHA1 (patch-content_browser_scheduler_responsiveness_native__event__observer.h) = 0ea311a82426f12d10f7846870a70b7c85ff39f3
+SHA1 (patch-content_browser_service__process__host__impl.cc) = b9830ec3e7b1c96b9615745653f5c3eff112e13d
+SHA1 (patch-content_browser_service__worker_service__worker__context__wrapper.cc) = c96349b6f49c9ce4747573f7b9d0264d439ae93b
+SHA1 (patch-content_browser_site__instance__impl.cc) = 652002847d93a0acf555962ee588973f75a2ecca
+SHA1 (patch-content_browser_utility__process__host.cc) = 6b406396c3fdf68f72f630588dd617c9f13ba168
+SHA1 (patch-content_browser_utility__process__host.h) = f754f6741b1746a1744a7174cfc9ab65006f8ba8
+SHA1 (patch-content_browser_utility__process__host__receiver__bindings.cc) = b809a17b3ef1991697802dcc4c0f46bfe07cb2cf
+SHA1 (patch-content_browser_utility__sandbox__delegate.cc) = 3406877da40efab271bafef6a538df3d4e452472
+SHA1 (patch-content_browser_utility__sandbox__delegate.h) = 1bf2d18dfb018f7084781d25dceeda09191b66fe
+SHA1 (patch-content_browser_v8__snapshot__files.cc) = f58fa05563705b30e9330d7fef79e881f41c4a91
+SHA1 (patch-content_browser_web__contents_web__contents__impl.cc) = 33bcbb42aedcc3e83f67997271952915db11c6af
+SHA1 (patch-content_browser_web__contents_web__contents__impl.h) = d096bb163619c9feb6cf7c1937b88599f04ad9ca
+SHA1 (patch-content_browser_web__contents_web__contents__view__aura.cc) = 38a4f22604b43816f560937815d84c0adc54a703
+SHA1 (patch-content_browser_web__contents_web__contents__view__aura__unittest.cc) = f52b3d420991c0757ecb83ceb76e629a7f4354de
+SHA1 (patch-content_browser_web__contents_web__contents__view__drag__security__info.cc) = 2622343243d7e13eac2bb2b1c2b64a6343f28c3b
+SHA1 (patch-content_browser_webui_web__ui__main__frame__observer.cc) = 57667694d76b7b04861c1616e8cba0a39beef305
+SHA1 (patch-content_browser_webui_web__ui__main__frame__observer.h) = 6f235ab79f671c3c03360cb7d79a2343260910e3
+SHA1 (patch-content_browser_zygote__host_zygote__host__impl__linux.cc) = f19986444bf99ec5af3ccb25145f1ae6f92bf905
+SHA1 (patch-content_browser_zygote__host_zygote__host__impl__linux.h) = af4fbb1921def16241117782301d3ee18920c98d
+SHA1 (patch-content_child_BUILD.gn) = 0a7bb230c7d2062448c65148929eed7ad93a127e
+SHA1 (patch-content_child_child__process.cc) = 786e5458d7ed733425b13a330e09939742ff04b0
+SHA1 (patch-content_child_child__process.h) = 64edf330e956bc5f74e578433c6382a328594e4b
+SHA1 (patch-content_common_BUILD.gn) = 79a8ee52cf98ef10668125d84f174f38057a1005
+SHA1 (patch-content_common_features.cc) = 55de966ce4468aa366d330b1dc40d977e11bb565
+SHA1 (patch-content_common_features.h) = 7c3a50a8aec76e29bdf7d04f844671a6fda239a5
+SHA1 (patch-content_common_font__list__unittest.cc) = 39a1210d33e99d95d2ca65f5151b49171e438a96
+SHA1 (patch-content_common_frame.mojom) = 96072dd0aaf7ad3947cdccafd9f1ac00141baaa2
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__bsd.cc) = 8462eb53e4fb39b3bbeb7dff5e4e1c5d05e0cf9d
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__bsd.h) = 10545b756f2e1fb26fb65a8cd763c79ff3e3204a
+SHA1 (patch-content_common_gpu__pre__sandbox__hook__linux.h) = 8a15c171fe3183f9be1df5e340df774c7a5e82b6
+SHA1 (patch-content_common_mojo__core__library__support.cc) = 807f9cf6feb0fb61b0c99a193f215c128469d41f
+SHA1 (patch-content_common_sandbox__init__win.cc) = 7a9ca804d70373aa817c70f784ef094253a677b6
+SHA1 (patch-content_common_url__schemes.cc) = 99fc5e70313208de7ac59cf27c2fe5e6208a0149
+SHA1 (patch-content_common_user__agent.cc) = 974d370bc14911d9cf8de68bb46bc771e6a3e17d
+SHA1 (patch-content_gpu_gpu__child__thread.cc) = e58da4ed0541676343d51ab7126f6eb9f4701485
+SHA1 (patch-content_gpu_gpu__main.cc) = 03d2a9a225a764bcbd9ec5fc499a5e9e5fb8457c
+SHA1 (patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc) = 37aabf5fc3f16d74aab66ce5d4a857ff55108099
+SHA1 (patch-content_ppapi__plugin_ppapi__blink__platform__impl.h) = a1772ce240849b7df6bb0a969abd3ded7156a314
+SHA1 (patch-content_ppapi__plugin_ppapi__plugin__main.cc) = ee744c63dfa6733a9a6d0a8f11eabf69911d71d1
+SHA1 (patch-content_public_app_content__main__delegate.cc) = 72dff33826d2b0a9b63bd563d5c22c0851e07d91
+SHA1 (patch-content_public_app_content__main__delegate.h) = 1d76a5562a9f5ecf3e83e89c2c4f4fb9179a3990
+SHA1 (patch-content_public_browser_content__browser__client.cc) = 7c459df5ce3dc938ba90e6df5016918d44d4dec3
+SHA1 (patch-content_public_browser_content__browser__client.h) = c1658bb8d6ca5443ccc19169ef28b5e83142c52a
+SHA1 (patch-content_public_browser_desktop__media__id.h) = 8cd5bfc33d343401cfb97e2bf933142a6ea76494
+SHA1 (patch-content_public_browser_platform__notification__service.h) = d90e7762892504389f80d16437ea8157d2b45e45
+SHA1 (patch-content_public_browser_render__view__host.h) = f36dff97948b398805a0249adf3844000da05bec
+SHA1 (patch-content_public_browser_service__process__host.cc) = e0d397cb01909a5f46688664cb062baab5547e74
+SHA1 (patch-content_public_browser_service__process__host.h) = 7cb6319d3cebc8aca01f55f24211b80e3824f959
+SHA1 (patch-content_public_browser_service__process__info.h) = 35a785cafe959f409ad3b5c9fe761619b7ac990e
+SHA1 (patch-content_public_browser_web__contents.h) = e1d02c631c3d20c4618d98f1b5d72702a1fa3a1f
+SHA1 (patch-content_public_browser_web__contents__delegate.cc) = 3ee800c8a30b24b57fc0bd010549a48bd9ac7227
+SHA1 (patch-content_public_browser_web__contents__delegate.h) = 4268524607905a08e8d99d7050c10158f9577b23
+SHA1 (patch-content_public_browser_web__contents__observer.h) = 54ef93dc46f14cf0a7f32f64368e9027e443b1f7
+SHA1 (patch-content_public_browser_zygote__host_zygote__host__linux.h) = 5585a8a5e577b89423708500314fa0ec59ec8283
+SHA1 (patch-content_public_common_content__client.h) = fa00fc010099edd295f95b741a72c1f440ba6b92
+SHA1 (patch-content_public_common_content__features.cc) = 6abc456b9b6fa8860b00cf6f0f2b4e6d0f378538
+SHA1 (patch-content_public_common_content__switches.cc) = a9701ccf921ab0cfeebf46c89642e72bed51c37a
+SHA1 (patch-content_public_common_content__switches.h) = 42eb4016ecc7dea653c3713ed8712d2888966708
+SHA1 (patch-content_public_common_sandbox__init__win.h) = 7aa901fcdfbb12513da1597a4d9d526c1fc3ba82
+SHA1 (patch-content_public_common_sandboxed__process__launcher__delegate.cc) = 34bc5717b9ac3d658adee15becd7c4dc19acabf2
+SHA1 (patch-content_public_common_sandboxed__process__launcher__delegate.h) = 94da25128cb84c7a07b2d07fcaea42291883185d
+SHA1 (patch-content_public_common_zygote_features.gni) = cce81b5ef284eb939cbd2dc341c5e29c5bc1ce2a
+SHA1 (patch-content_public_gpu_content__gpu__client.h) = 398bb304948d666b8359f0019b688b4376ef2c9b
+SHA1 (patch-content_public_renderer_content__renderer__client.h) = 708aed51167ea3e676584d2178287eb7023ed853
+SHA1 (patch-content_public_renderer_render__frame__observer.h) = 49ca3f37801a16007fefebb824d40a5b155a1510
+SHA1 (patch-content_renderer_BUILD.gn) = fc9d21dbdfdd7f7f2e5f9b770c4eb3926b97b5b7
+SHA1 (patch-content_renderer_render__frame__impl.cc) = 529d02ed6eabd357931dad394f7ac3649a35eb53
+SHA1 (patch-content_renderer_render__frame__impl.h) = 8789b10ebca9ceaea7883aa497910943465fc94b
+SHA1 (patch-content_renderer_render__process__impl.cc) = 454b46dd5d0869780c33bac3d2642ca92548c151
+SHA1 (patch-content_renderer_render__thread__impl.cc) = bea9986a08f7f31ff79ea6c300c0abb84629bf30
+SHA1 (patch-content_renderer_renderer__blink__platform__impl.cc) = 95671ef9f6aa7b42218342b178aa327578d05f80
+SHA1 (patch-content_renderer_renderer__blink__platform__impl.h) = 99caad63db7651195653dd55081ccc2ffbdce587
+SHA1 (patch-content_renderer_renderer__main__platform__delegate__linux.cc) = b04045e178456c4b4fa497254a67904db09128d8
+SHA1 (patch-content_renderer_renderer__main__platform__delegate__mac.mm) = 5e40268c0c40be4c903ea00ecbcacf64a63357e4
+SHA1 (patch-content_renderer_theme__helper__mac.mm) = 7b72c2095ac80dc6949db8534bc0dfec5a0d8bf3
+SHA1 (patch-content_shell_BUILD.gn) = bb510ff740f2e35cf67ecf3d1381d2a8fdbb075d
+SHA1 (patch-content_shell_app_shell__main__delegate.cc) = 39eb09817336d6981ce4047f4f0bc79f1e9a4aff
+SHA1 (patch-content_shell_browser_shell__browser__main__parts.cc) = 496470de56ed1bed6371a318b8d746b3f02c9403
+SHA1 (patch-content_shell_browser_shell__paths.cc) = c42338d4955f4bb160ee92cabe166f5aeff77e26
+SHA1 (patch-content_shell_renderer_shell__content__renderer__client.cc) = 847b7b194a6a5ff7b9aaebf9acb71dfc68759faa
+SHA1 (patch-content_shell_utility_shell__content__utility__client.cc) = e0fc685eb8d72ec331a1be629122d0a71f74d16d
+SHA1 (patch-content_test_BUILD.gn) = 84f19f01324e75c26b8477cc3261181d3aca0ea3
+SHA1 (patch-content_test_mock__platform__notification__service.cc) = 6e65091ed97bcb7e8b5f40e10e5e2f96abf726d2
+SHA1 (patch-content_test_mock__platform__notification__service.h) = 4041506df283b076bb9a77702ba026b70046ef20
+SHA1 (patch-content_test_test__page__broadcast.h) = faded5f0500cad48c1477bceebeffa3090eba596
+SHA1 (patch-content_utility_services.cc) = d35c8bae30dfe7fa9be25eae2e93ebadcb0c50c2
+SHA1 (patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc) = 0615601d67ef898e2d74f6069dfa8e2313e38e53
+SHA1 (patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h) = 913faacd7f344cbe029ae8fb0887e705254fa9c0
+SHA1 (patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc) = 59aa13b9791b681d9bb4446926fccb6e5aa64218
+SHA1 (patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h) = f225281bad1671646c7500b7a49708b5eb8f768e
+SHA1 (patch-content_utility_utility__main.cc) = 06e89400da3643d331d839067fc0ef1e908091b7
+SHA1 (patch-content_utility_utility__thread__impl.cc) = 027b0926e283c1b8f3e55a7264069a1f5d327629
+SHA1 (patch-content_web__test_BUILD.gn) = 96d96dbfb49961799d912ca6ed9fa0f7997fad81
+SHA1 (patch-content_web__test_browser_web__test__content__browser__client.cc) = 5eb0e8db816d0e5d05b39145a82effb5d3697ef0
+SHA1 (patch-content_web__test_browser_web__test__content__browser__client.h) = 54dd4d8d75efb074dbf7a85be0348436623b50f5
+SHA1 (patch-content_zygote_BUILD.gn) = a95eff3cc6524cdb4660c2b0d7b79136ca695a6d
+SHA1 (patch-content_zygote_zygote__linux.cc) = a519434aeeb6e0b00571b77fbb6f71f24d6cd751
+SHA1 (patch-content_zygote_zygote__main__linux.cc) = 5e9362ecd61c14784150830988e433fd67332f20
+SHA1 (patch-device_bluetooth_BUILD.gn) = bd17a042fbb53ebb9953f4bcfa27055d68261b15
+SHA1 (patch-device_bluetooth_bluetooth__adapter.cc) = 7be27aaadabe067d8ab2ee9476b9abbc32ca3fc0
+SHA1 (patch-device_bluetooth_bluetooth__adapter__mac.mm) = 800f49584ae12bbccc2da82ed69e346947e1f345
+SHA1 (patch-device_bluetooth_cast__bluetooth.gni) = 45c23aaacd78ec63b6dbded1c7268f0672251e15
+SHA1 (patch-device_fido_fido__discovery__factory.cc) = f424fd88a0f05b8fda7dd0f1d7553b89491a04a3
+SHA1 (patch-device_gamepad_BUILD.gn) = c04c16e767a770b959f5e8d5da7df64f6428c48c
+SHA1 (patch-device_gamepad_gamepad__provider.cc) = bda34e8690a652bfea2f5a67af303014f7007df2
+SHA1 (patch-device_gamepad_hid__writer__linux.cc) = 4223bd0c8f2c95969ac3c7b9a295639cadae1e6e
+SHA1 (patch-electron_BUILD.gn) = 3e5b5417104e552a5ecc833ab3e7b72b7fe51df5
+SHA1 (patch-electron_build_args_all.gn) = af145f58cd6780aae7576cf23b0fb8eca021f131
+SHA1 (patch-electron_build_args_release.gn) = 7a007404fe2344c74c211909f52a545450338ab9
+SHA1 (patch-electron_default__app_default__app.ts) = 5e19efcdd48a5fa2ebbbaa5180c3b3d048c6139b
+SHA1 (patch-electron_filenames.gni) = fd70ea325a38d0b8f97d4b130616c594c992e11e
+SHA1 (patch-electron_lib_browser_api_app.ts) = 5dc2346aaa9b3444d881a959b8c419ae2ef376fe
+SHA1 (patch-electron_lib_browser_api_dialog.ts) = 28085d44b9051a26a5a16942685563cf152ebf71
+SHA1 (patch-electron_lib_browser_api_menu-item-roles.ts) = 2c88fdb403c071cfa5ca5148ce1d649590792d86
+SHA1 (patch-electron_lib_browser_api_power-monitor.ts) = fda45223e79843fe85682577cdaf5a6c454d8858
+SHA1 (patch-electron_lib_browser_init.ts) = d04d1f6cd806c69dfc6a263824a03125939a203f
+SHA1 (patch-electron_lib_browser_rpc-server.ts) = 5a1b2e291bbabffb0b2f22333d11d5dee36939f2
+SHA1 (patch-electron_lib_renderer_api_clipboard.ts) = b613fa0d2f9d916df5efe17bca87f195c1053b35
+SHA1 (patch-electron_script_lib_config.py) = dc1f870b243fdbb90f22219c740a3ae41d13f4bd
+SHA1 (patch-electron_script_lib_utils.js) = 595e2d2486cd0008254c4c1efc76c000885f5fee
+SHA1 (patch-electron_script_spec-runner.js) = a72e883c07650e4add15630c729ce137638fb4df
+SHA1 (patch-electron_shell_app_electron__crash__reporter__client.cc) = cc4ac9cc95def983e9d17c82f06b790f7e79316c
+SHA1 (patch-electron_shell_app_electron__crash__reporter__client.h) = fc8595fba6edd2bf5673c7b47d2a3ba49e0f47e0
+SHA1 (patch-electron_shell_app_electron__main__delegate.cc) = 797c8dcd31b97920f9f83f74154491f4fe33b170
+SHA1 (patch-electron_shell_app_node__main.cc) = 876dd0e83c448a063f23616ba2d850329a4c16d1
+SHA1 (patch-electron_shell_browser_api_electron__api__app.cc) = 196f556be6cf0cd5ab51dfb58473a4f78cf284f1
+SHA1 (patch-electron_shell_browser_api_electron__api__base__window.cc) = 1ad6fb2e2ac95e0781079060dbfaec469038e4ab
+SHA1 (patch-electron_shell_browser_api_electron__api__base__window.h) = f5db5c5635c8c61a18c93e03ba681e2483de6188
+SHA1 (patch-electron_shell_browser_api_electron__api__crash__reporter.cc) = 6824d03d1ac845ba2d69caab65fa1134c77abb2b
+SHA1 (patch-electron_shell_browser_api_electron__api__desktop__capturer.cc) = 9ee7fa9d0797d46c01eef4db2269b4d87af56ad0
+SHA1 (patch-electron_shell_browser_api_electron__api__power__monitor.cc) = 37954d61818b7030cd832c37dafdd16fe70ee98d
+SHA1 (patch-electron_shell_browser_api_electron__api__power__monitor.h) = d5622afb6937e457e90b4d6522405a1971b49f5c
+SHA1 (patch-electron_shell_browser_api_electron__api__safe__storage.cc) = a9a8c81a7324386f30ed3262d5e5540e3f71d8ca
+SHA1 (patch-electron_shell_browser_api_electron__api__web__contents.cc) = ef108e659457dfb5e5681f1046ad7ee5e09714bc
+SHA1 (patch-electron_shell_browser_api_electron__api__web__contents.h) = 0934b231abbfc96034c7105e4be1e98cda6e7802
+SHA1 (patch-electron_shell_browser_api_process__metric.h) = 4a8142e7d4586ccb451e2fa1d4276bd00f05993f
+SHA1 (patch-electron_shell_browser_browser.cc) = d1adfeeeeaf513578a01837fceb0b5c4eb028dfb
+SHA1 (patch-electron_shell_browser_browser.h) = f71e11c38ff394b292832042b76fb0fca89a2202
+SHA1 (patch-electron_shell_browser_browser__linux.cc) = 4441a7860878c4215d93bfe63c06e50ed16a4bc4
+SHA1 (patch-electron_shell_browser_browser__process__impl.cc) = 1cefd32aad73fc35b869c1dd2517e49cc99d2a66
+SHA1 (patch-electron_shell_browser_browser__process__impl.h) = 04c3baa74484a4acd7b43495445626040c120869
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts.cc) = 9cd9b4d1a850ebe665fbd033ff8b09e638c18cbf
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts.h) = acb77d13df78ad11aaab29a32977bde1368bb1eb
+SHA1 (patch-electron_shell_browser_electron__browser__main__parts__posix.cc) = cbbfc18f5d9af31509e909bd84b852e3f913f5a6
+SHA1 (patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc) = 87ee0afb07aa743e03736583bee9bcf1eb691a25
+SHA1 (patch-electron_shell_browser_native__window.cc) = 5d7511c4b32a988534d7ad6450810f7d5c2e1dca
+SHA1 (patch-electron_shell_browser_native__window__views.cc) = e0e54ae782d5aabd1231db822cc61bffdef07629
+SHA1 (patch-electron_shell_browser_native__window__views.h) = dfe03b1330d6cd07eb5aa9dee102bd12e5394a04
+SHA1 (patch-electron_shell_browser_net_system__network__context__manager.cc) = c4c72a33773aec47d09206376b751f9bfd4f420f
+SHA1 (patch-electron_shell_browser_osr_osr__host__display__client.cc) = f90a5c58c67f178015f090ed68b7bbb19bca1d58
+SHA1 (patch-electron_shell_browser_osr_osr__host__display__client.h) = a842f10a5bfc4571e94860856bd9a251a7d73221
+SHA1 (patch-electron_shell_browser_printing_printing__utils.cc) = 34b8871a4ad9897b8ccb8ea1ac9459d88889ee16
+SHA1 (patch-electron_shell_browser_relauncher__linux.cc) = 8837e4dcc2eb52dfa9b591c65db4ecb42d87d34b
+SHA1 (patch-electron_shell_browser_ui_inspectable__web__contents.cc) = 5771f0ff5ad7c93375412f1489440e7157b2ca9a
+SHA1 (patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h) = 331b214f81d4faf871b47eb1430bb1a278291ddf
+SHA1 (patch-electron_shell_browser_ui_views_electron__views__delegate.cc) = 3d10a4315211369f918b530e0a0433c6c7110ba5
+SHA1 (patch-electron_shell_browser_ui_views_electron__views__delegate.h) = 6fb98b879620656538822acf6d16d5ff139e6514
+SHA1 (patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc) = c51827a6240d35195bf874014855f796ede69504
+SHA1 (patch-electron_shell_browser_ui_views_menu__bar.cc) = 8c3528dea12316d72a7f7f9375638cb48bfbf0f3
+SHA1 (patch-electron_shell_browser_ui_views_menu__bar.h) = 1e5cddd7b3e779744c9a3dd3118ae2d135ed4213
+SHA1 (patch-electron_shell_browser_ui_views_submenu__button.cc) = acc7b89a01d7e9133e221509fc8b94de6c264089
+SHA1 (patch-electron_shell_common_api_electron__api__clipboard.cc) = 93d468eb45bfde22f9c21e8428e5cd0c0fbe3fe8
+SHA1 (patch-electron_shell_common_api_electron__api__native__image.cc) = 8169509c3f36656e48c809996c36f58b7235c479
+SHA1 (patch-electron_shell_common_api_electron__api__native__image.h) = ac37de194a1962462a00a683cd303afb7311800b
+SHA1 (patch-electron_shell_common_api_electron__bindings.cc) = 0455182a54ee062d6a13f6500128788a10d13613
+SHA1 (patch-electron_shell_common_electron__command__line.cc) = 95207adf9138e7ec6e9b6d8fd4855b68e61e3241
+SHA1 (patch-electron_shell_common_electron__command__line.h) = 176b7c5ade4bee3258de1414f5c96482d03b52c9
+SHA1 (patch-electron_shell_common_electron__paths.h) = c0dc5d07655c7ad64835eaa0993a2fb047118ee8
+SHA1 (patch-electron_shell_common_gin__converters_std__converter.h) = 0f4d9e3f6c7d292b2ff13ca7698a591f00feb489
+SHA1 (patch-electron_shell_common_node__bindings.cc) = ddc196b2957ad420f291b6c3e154d3eff467595f
+SHA1 (patch-electron_shell_common_node__bindings__linux.cc) = ce1b7b11b8d70e5c95ee9710f9c4ef399e0bef28
+SHA1 (patch-electron_shell_common_platform__util.h) = 6820c8554d6f90dba3c6b45724c8f52aba3931f0
+SHA1 (patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc) = a66b602e7bb779f08a5ee644fe6862388e7400a8
+SHA1 (patch-electron_spec_api-app-spec.ts) = cb999c0566f36744cf28fc9034559cc71a61dcb4
+SHA1 (patch-electron_spec_api-browser-window-spec.ts) = baed0edb096d4bcedddda003529b35717789221b
+SHA1 (patch-electron_spec_api-clipboard-spec.ts) = 95b554171ab0a959e4cb27eb5b2fab2051f0a696
+SHA1 (patch-electron_spec_api-content-tracing-spec.ts) = e3242bbeea595935b3b16c5f02cc8be111987b73
+SHA1 (patch-electron_spec_api-crash-reporter-spec.ts) = 8de00525f8784ef90bc1db58895d1dfdc5185146
+SHA1 (patch-electron_spec_api-desktop-capturer-spec.ts) = ffd67e2d0d30e727406bd428cef9360d08689651
+SHA1 (patch-electron_spec_api-menu-spec.ts) = f7a3e7f1ed005c38aa8572933421f2c7f0e26a1d
+SHA1 (patch-electron_spec_api-native-image-spec.ts) = 8d50fe2ef33134416435618104401b7c53ec5233
+SHA1 (patch-electron_spec_api-net-log-spec.ts) = bd668caf7df29b04d299df7db06b587c8fa00ad9
+SHA1 (patch-electron_spec_api-notification-dbus-spec.ts) = 0b395900883464f47af1d1786a81cad127d07b39
+SHA1 (patch-electron_spec_api-power-monitor-spec.ts) = 3af019e043088769d2ba82cab0e8e27077c6b7a1
+SHA1 (patch-electron_spec_api-process-spec.ts) = 11e0094693d0783bdb48fa366dc08cf13ff4bbbc
+SHA1 (patch-electron_spec_api-protocol-spec.ts) = cdb46bac3c25554ec1bb7d19c59f5ac54cf0e9a3
+SHA1 (patch-electron_spec_api-safe-storage-spec.ts) = 2eb577da48e8f75ea90e1ec4d72b665f1eb360b9
+SHA1 (patch-electron_spec_api-screen-spec.ts) = 034ae09f2beda09e73e2ee1d0761c8fde132359a
+SHA1 (patch-electron_spec_api-shell-spec.ts) = 142a171c692b4d43ddfecbc5754928372372066e
+SHA1 (patch-electron_spec_api-subframe-spec.ts) = f3cad6dea856d93d274a961d054ea6f3c5eeb706
+SHA1 (patch-electron_spec_api-tray-spec.ts) = 4eddb5cfe0d8f65e891c6d67a279fb974a7f93c6
+SHA1 (patch-electron_spec_api-utility-process-spec.ts) = 15894f0183d7e1406bb6d58c356f34e7a69cc58f
+SHA1 (patch-electron_spec_api-web-frame-main-spec.ts) = ce2cf24879d7cdb29be1a8bbf250b0ff585c2834
+SHA1 (patch-electron_spec_chromium-spec.ts) = 5c787ab2208ea3b6f40270779d6c5633c050829d
+SHA1 (patch-electron_spec_crash-spec.ts) = 999ec8810095c873fd4d02346346059deb2d6c58
+SHA1 (patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js) = 1f166da1fae535bf7aac2b3127c6fb0e3d9493e6
+SHA1 (patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js) = f6d93e812bcf575bfc6ba279059f111f5183860c
+SHA1 (patch-electron_spec_fixtures_crash-cases_safe-storage_index.js) = f7d1f851a673409bcb21da6364396ca296bf788d
+SHA1 (patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js) = c55aca178f98e8add458b6697dab60bf22cc2faf
+SHA1 (patch-electron_spec_node-spec.ts) = 4ce4db8f743d00637944c864a63a048186d61876
+SHA1 (patch-electron_spec_version-bump-spec.ts) = ca45260a24f664dc1c4c86a6078a3cc0d1272076
+SHA1 (patch-electron_spec_visibility-state-spec.ts) = 1b3de9e6ae86d4eaa0ff185ddac0677c28381d0a
+SHA1 (patch-electron_spec_webview-spec.ts) = 4b583f55f08b0eea94f64f00ba961f2b75cf581a
+SHA1 (patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc) = 981cb4b26d13fe705d24035460a2316093b52795
+SHA1 (patch-extensions_browser_api_management_management__api.cc) = 66e0fe787b27feb285f41c63639775ba6dae716e
+SHA1 (patch-extensions_browser_api_messaging_message__service.cc) = 22322447a629841645853af1611d400475be5a36
+SHA1 (patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc) = ce9e122f60874565a648b3d44985d1237b40d62c
+SHA1 (patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc) = 2724f1e2f258cbc5d37d328d43444c87c442156d
+SHA1 (patch-extensions_browser_guest__view_extension__options_extension__options__guest.h) = 09fbf989b0e8ef459c194c478ceba9231f8a80b7
+SHA1 (patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc) = 9c66c15ed8e984482b762a50ad3035c87117c8ff
+SHA1 (patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h) = 6e6829269933830769cb4eeceb9c20ef398bdfe5
+SHA1 (patch-extensions_browser_script__injection__tracker.cc) = 89a77f8a32222607b49d1cc18a6ee602b7302dd3
+SHA1 (patch-extensions_common_api___permission__features.json) = 86a1213b6787c8964761f31c3220d41018e171c6
+SHA1 (patch-extensions_common_api_runtime.json) = e36c600416aa31850c0580e5bd377f32a474e957
+SHA1 (patch-extensions_common_command.cc) = 01411ed846cba1ab158d0b7031a8541d148b841f
+SHA1 (patch-extensions_common_features_feature.cc) = 2f98aa55f66c8a90643780a591df8b7ed9ea24e1
+SHA1 (patch-extensions_renderer_bindings_api__binding__util.cc) = 4b047307ade13e8e3f34dcea192ce288da1a4866
+SHA1 (patch-extensions_renderer_bindings_argument__spec.cc) = 08172acbe615b96e354f26be798889a478f26bf3
+SHA1 (patch-extensions_renderer_script__injection.cc) = fe7c39d6f4d10f3e6bc6747cb26a1b6288e310f3
+SHA1 (patch-extensions_shell_app_shell__main__delegate.cc) = a849b47171d75623235cd4ee0833c47c69012d64
+SHA1 (patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc) = 1af42e23aa2a926033ddd00120802c0be2906d62
+SHA1 (patch-extensions_shell_browser_shell__browser__main__parts.cc) = b5dd6678489e313699ce1549dff6621d224d6cad
+SHA1 (patch-extensions_shell_browser_shell__extensions__api__client.cc) = 05a050ec4869960d4eb0d149e1e5b75eef8025b0
+SHA1 (patch-extensions_shell_browser_shell__extensions__api__client.h) = dc1b7f2de3ab7b381f362a0cc4c314e77a2b598d
+SHA1 (patch-fuchsia__web_webengine_browser_frame__impl.cc) = 3e78d381c55132a297b28fc67a39f17ecbaeaa84
+SHA1 (patch-fuchsia__web_webengine_browser_frame__impl.h) = 9fca50f5806461eeeb2376e80714a9bce7f3b7b2
+SHA1 (patch-gin_converter.cc) = 275b2725fa00bda789d5bbdc1450f60b9e2a5fa3
+SHA1 (patch-gin_converter.h) = d168d891fbcb4403b1d2f4dc3b0d5e3b5ef84ed7
+SHA1 (patch-gin_isolate__holder.cc) = d1aacff38ff528b51024ccc064103b382869c39b
+SHA1 (patch-gin_object__template__builder.cc) = 0e9c19c22f92edc16b6d9b55d8117871c7af11b8
+SHA1 (patch-gin_object__template__builder.h) = 8dffa30388e52fe8a17a7301074902e2c6593e98
+SHA1 (patch-gin_public_gin__embedders.h) = 206a83300c35a816f2ea0d2b27eb6ac0ba3bc745
+SHA1 (patch-gin_public_isolate__holder.h) = e3fff391b95dcc467c4cad5f3245792e5e09e8b5
+SHA1 (patch-gin_public_v8__platform.h) = 3f43bd5665f4dff35aac20549ac0f18ec98d5db4
+SHA1 (patch-gin_v8__initializer.cc) = 13481318547245a9be28f7de0db4804e66444bd2
+SHA1 (patch-gin_v8__initializer.h) = adab723de4193b339cb0884b7a9141365c5790ae
+SHA1 (patch-gin_v8__platform.cc) = 26c243cafb36e55a60aea82ec8ce3e863d838614
+SHA1 (patch-google__apis_gcm_engine_heartbeat__manager.cc) = 2f3ab9026f5ea4a96754381e11bb89e2c7b587d8
+SHA1 (patch-google__apis_google__api__keys-inc.cc) = 4434e89e2c3483446e0c20f5a91abe70948dddb9
+SHA1 (patch-gpu_command__buffer_service_dawn__context__provider.cc) = 6e2c77661ec9479a794da4b3ed69191f0db04073
+SHA1 (patch-gpu_command__buffer_service_gles2__cmd__decoder.cc) = baa8037d8c3c9f9e19dbfcd7a08e5427a66a8179
+SHA1 (patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc) = 8c74ba63a556fd66010b5e7094ce9b819c507762
+SHA1 (patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc) = 1a3a690abedc2896518118a3c8b0c54aa6667058
+SHA1 (patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc) = cc2ba4de3fedf9476ab835032bfdb12d0833aa11
+SHA1 (patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc) = a08e269bb1441bebbee5cd6b9924175e9d57343b
+SHA1 (patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc) = e28eaf5f12242db5acf3b5f7bbfac174ce6dc4d1
+SHA1 (patch-gpu_command__buffer_service_webgpu__decoder__impl.cc) = 78026b76959a7df0bd909ecb7c96094fccfe318f
+SHA1 (patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc) = d75e942b99e16d3177149aed99f58a9ba4ab09c0
+SHA1 (patch-gpu_config_gpu__control__list.cc) = 5f34501ff97f806c2f36f3ffdc28a51d69a29d76
+SHA1 (patch-gpu_config_gpu__finch__features.cc) = ab204dba720c3dd0476087b48b1246131a4223f5
+SHA1 (patch-gpu_config_gpu__info__collector.cc) = 7a96fadb47b7d137a6f8b4cacb6fdd10316e5d37
+SHA1 (patch-gpu_config_gpu__test__config.cc) = 3f8f48a4fa0e9d870f8b0fe9fab0e101fa1e7238
+SHA1 (patch-gpu_ipc_common_gpu__memory__buffer__support.cc) = dd1256f2b9ceb485316bc9dd06d42e6b594f3336
+SHA1 (patch-gpu_ipc_common_gpu__memory__buffer__support.h) = 550ec547ea71215c1f3127b743a50955a7a42d85
+SHA1 (patch-gpu_ipc_service_BUILD.gn) = 8e64bc60967a6d0f1d73d6b81a7f5eff8fa5839b
+SHA1 (patch-gpu_ipc_service_gpu__init.cc) = 92f8ad75c1f700cdd43195486a68eb710abe8185
+SHA1 (patch-gpu_ipc_service_gpu__memory__buffer__factory.cc) = 51f2b23f92976157d41b0d2ba3521223216e18ab
+SHA1 (patch-gpu_ipc_service_image__transport__surface__overlay__mac.h) = f7228ed1d574205f0561ef6ca93b8328fc04515b
+SHA1 (patch-gpu_ipc_service_x__util.h) = c9e26a06499972e62b7009024ad109639497cbc9
+SHA1 (patch-gpu_vulkan_generate__bindings.py) = c5cbd31bb3a452bf0ef88607da9707c8677c13b6
+SHA1 (patch-gpu_vulkan_semaphore__handle.cc) = e03b6f376e76691ab3f1b9ad0984afd1cb09f886
+SHA1 (patch-gpu_vulkan_vulkan__device__queue.cc) = ac42f7dada596358192af4b1eb0dd030cf3f7999
+SHA1 (patch-gpu_vulkan_vulkan__device__queue.h) = 826398a28c694448b179b3372ae414cd42dbe925
+SHA1 (patch-gpu_vulkan_vulkan__function__pointers.cc) = 59a7da787df9b39648ed45c056a5b12f3046d6fc
+SHA1 (patch-gpu_vulkan_vulkan__function__pointers.h) = e59f0c3931ec429bbed375be42141c54b757c690
+SHA1 (patch-gpu_vulkan_vulkan__image.h) = 782aaed1f85c29e0a9d50fd06b3e8e096644e197
+SHA1 (patch-gpu_vulkan_vulkan__util.cc) = c73da00edac3138232bcbc7e9f6fa19a75d35fca
+SHA1 (patch-headless_lib_browser_headless__browser__main__parts__posix.cc) = 576ca02e70b3308d8bfc23dac80b0aae78403aea
+SHA1 (patch-headless_lib_browser_headless__content__browser__client.h) = 69827b767bd544c45e1557c772aba9998da7a972
+SHA1 (patch-headless_lib_browser_headless__request__context__manager.cc) = 88e83f9cd8d967f9e13c7da809e6132b13ae16e6
+SHA1 (patch-headless_lib_browser_headless__web__contents__impl.cc) = 58886fbd5a37b59389fb9b2d68a34b25728e3a59
+SHA1 (patch-headless_lib_headless__content__main__delegate.cc) = 12858179959e69faba6a6fd37857b8865a87b403
+SHA1 (patch-ipc_ipc__channel.h) = 9eecb74672b07f814e6076a63f11a63ac77c68e2
+SHA1 (patch-ipc_ipc__channel__common.cc) = 49a0f111b9aab4c85c37332dd48c769a59bf52ab
+SHA1 (patch-ipc_ipc__channel__mojo.cc) = e2cb8e042318cac58e9e226a5596c1bddc31fd8e
+SHA1 (patch-ipc_ipc__message__utils.cc) = 978ebb380d3c9f49a57e00cd009109158b85cfe1
+SHA1 (patch-ipc_ipc__message__utils.h) = 1f03a2769b2e039dfef9b632d029dcf783d5d5e3
+SHA1 (patch-media_BUILD.gn) = 5274a0fb7be76633254e18452588745e97d94329
+SHA1 (patch-media_audio_BUILD.gn) = 59c495681e68bab1b950d26a14a3e2a56ad10aa2
+SHA1 (patch-media_audio_alsa_audio__manager__alsa.cc) = d353caf13231076876e559725679ce050df6c0f5
+SHA1 (patch-media_audio_apple_audio__low__latency__input.cc) = 5de6b6eb2c2ee2d77f7614164a5aacc73f4d552c
+SHA1 (patch-media_audio_audio__input__device.cc) = 45e70373697d0fd1af9d7becca3473635cd57fa9
+SHA1 (patch-media_audio_audio__output__proxy__unittest.cc) = 8d6bcc0177ff4cd200f34a55cc50710236c3ae36
+SHA1 (patch-media_audio_mac_audio__manager__mac.cc) = f96d8d4ed9e854bc25924f83e90726caeaefd193
+SHA1 (patch-media_audio_pulse_pulse__util.cc) = ca7c701e5aa8c068f43e178f824e74c8c0985076
+SHA1 (patch-media_audio_sndio_audio__manager__sndio.cc) = 9ccbbe361f88cd137e54ad6ac5075e8fe323528e
+SHA1 (patch-media_audio_sndio_audio__manager__sndio.h) = 874337782272199ebb99ff8bb2acc122a8c1fa4d
+SHA1 (patch-media_audio_sndio_sndio__input.cc) = e25e5ba176c1a80cd8e502900e14ea21f49adc0b
+SHA1 (patch-media_audio_sndio_sndio__input.h) = 79e8d655fe199231b02906ff3d733766657fb85a
+SHA1 (patch-media_audio_sndio_sndio__output.cc) = cb606c54cdad247395538f680df529ae02659e90
+SHA1 (patch-media_audio_sndio_sndio__output.h) = ff3d94abac415935fb5c67fcc1678f966d2638a1
+SHA1 (patch-media_base_audio__latency.cc) = 7b544006bc4c3343261f864c1a83ae56a44a24d8
+SHA1 (patch-media_base_libaom__thread__wrapper.cc) = 233d1d9cda1caad238c99a4172345e25eab77c56
+SHA1 (patch-media_base_libvpx__thread__wrapper.cc) = 5bbdfc2c97ebe3c3728b743f1b50d2b1a3b05279
+SHA1 (patch-media_base_media__switches.cc) = 4a4035e0d60c5eb228e3938d2684f1a6987eb7b8
+SHA1 (patch-media_base_media__switches.h) = 352d952565cc82c913f107120ce836c1b9b9149d
+SHA1 (patch-media_base_user__input__monitor__unittest.cc) = 75ffea056eb65e5d87bae696baa425fa7ea3bf2d
+SHA1 (patch-media_base_video__frame.cc) = 9fb0a3fef2b568112009366547e9140cbf9eac4e
+SHA1 (patch-media_base_video__frame.h) = 06576ebeef82863043a1a1cbe584a3a33b9fc50a
+SHA1 (patch-media_capture_video__capture__types.h) = cd0142b7d3cc7dfa90fc4f071bc93c363f5cb65e
+SHA1 (patch-media_capture_video_create__video__capture__device__factory.cc) = 9496751bd6ff9fbd0d8e0744e46f9d69b114f308
+SHA1 (patch-media_capture_video_fake__video__capture__device__factory.cc) = eb0d7377331b7777eb183d7fc26343fa707d1973
+SHA1 (patch-media_capture_video_file__video__capture__device__factory.cc) = d9923bc26fcf2f562de87bad4533697d9c5c3197
+SHA1 (patch-media_capture_video_linux_fake__v4l2__impl.cc) = f1ef3d696d7c14354f2286e4d459d58589f701d6
+SHA1 (patch-media_capture_video_linux_fake__v4l2__impl.h) = d7c6f5bd7a47c222b20743c9200a17d2f65ad401
+SHA1 (patch-media_capture_video_linux_v4l2__capture__delegate.cc) = 4f6f13368cf159e3e65da0b2cad2bd2041473ac0
+SHA1 (patch-media_capture_video_linux_v4l2__capture__delegate.h) = 2047451a6577a19a915afade4584143e2dd2f66e
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device.h) = 30db98f11ddf7b469d0bdcb8f147b53a50074ba1
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device__impl.cc) = c8e67f159bc24e04ad2a522455a88434fc3a683e
+SHA1 (patch-media_capture_video_linux_v4l2__capture__device__impl.h) = 3ab946c163f167cddd6e3567e0691d82ba620f9b
+SHA1 (patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc) = e0a36043baf219264d7c2bbf8c6093bb3d7e898f
+SHA1 (patch-media_capture_video_linux_video__capture__device__factory__v4l2.h) = 2ccbcef4687c01fd73ae29e25cc26161a85448d9
+SHA1 (patch-media_capture_video_linux_video__capture__device__linux.cc) = 3c805d1a884fe77ce590688ca4a1d2b8ee6b95ac
+SHA1 (patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc) = e8926c2d03bdc159ec6d880394b00a1bb062974f
+SHA1 (patch-media_capture_video_video__capture__device__client.cc) = 2a3b9d1736a8c096791a0cfd4b5c55352d240d60
+SHA1 (patch-media_cdm_cdm__paths__unittest.cc) = 964c83660475756c8c722089d9d1aa416eefeeed
+SHA1 (patch-media_cdm_library__cdm_cdm__paths.gni) = e5fe75c8162136e4f374272f06d005ec326b0294
+SHA1 (patch-media_ffmpeg_scripts_build__ffmpeg.py) = 5929f64c0036a0621af5a80cd3c8555ad6afe0d8
+SHA1 (patch-media_ffmpeg_scripts_robo__lib_config.py) = 826ee3c34e767f1196ae08dd1977497d7a306399
+SHA1 (patch-media_gpu_buffer__validation.cc) = f39c640a30ce04353c6ce3362d2f0a57c99fe7f0
+SHA1 (patch-media_gpu_chromeos_gl__image__processor__backend.cc) = 59d13f1e445e55368fd96a0df193ae4b42187ddd
+SHA1 (patch-media_gpu_chromeos_libyuv__image__processor__backend.cc) = 6d60dda5efa6fe75f6135e0f0205dda28de468c6
+SHA1 (patch-media_gpu_chromeos_mailbox__video__frame__converter.cc) = 7dfc04276d65d12738a96ba4ff99138592069298
+SHA1 (patch-media_gpu_chromeos_native__pixmap__frame__resource.cc) = 808dd54dd13c285a2585862dc14e480867835333
+SHA1 (patch-media_gpu_chromeos_platform__video__frame__utils.cc) = a212555e2bef427e20c27e12800243ef75f21a66
+SHA1 (patch-media_gpu_chromeos_video__decoder__pipeline.cc) = d99246a492b9c9e2653cfc3d2e81605798ae02cf
+SHA1 (patch-media_gpu_gpu__video__encode__accelerator__factory.cc) = 7fb3f525035dd41e7acbdcc6d05ab89e46bd1ba1
+SHA1 (patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc) = 3f20636bc0534906194d9041ac7ea45431792153
+SHA1 (patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h) = 9ee49df428605d82a05f5d6a3773f7266e756373
+SHA1 (patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc) = 7d23d52326bce7bad65f2652b2b8c052ac0740b2
+SHA1 (patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h) = 9e886ca39313e3e858417b55c14a1b6a8f232c2c
+SHA1 (patch-media_gpu_vaapi_vaapi__video__decoder.cc) = 4c79e85f2cbe0b7f2a986c94776896ab0fcea429
+SHA1 (patch-media_gpu_vaapi_vaapi__wrapper.cc) = 2e850a103fb3242634153e80596c7d8b06111564
+SHA1 (patch-media_media__options.gni) = 787cc71d003dcb3dd722db28f62bbb177174c2c7
+SHA1 (patch-media_mojo_mojom_stable_BUILD.gn) = 855f2e60adef346ee9e1c4932342a4cd7a8f7800
+SHA1 (patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc) = d14c589808b2c055d51f47f5f3e790c784bdecee
+SHA1 (patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h) = a2985c8c2e6c27ff22ddfdba8c5622d74546356f
+SHA1 (patch-media_mojo_mojom_video__frame__mojom__traits.cc) = 2af58865bec78e8e3beaedc6e23487f05ad95f44
+SHA1 (patch-media_video_fake__gpu__memory__buffer.cc) = 30702624ceb85ae34c61dfbc5f625b8be1839ce3
+SHA1 (patch-media_video_gpu__memory__buffer__video__frame__pool.cc) = 9e648ea9ecb57de5f1ec677dd44d36160cf7de1a
+SHA1 (patch-media_video_video__encode__accelerator__adapter.cc) = eaf666bc0e77cbe28110c5b69b5d60ab53f630aa
+SHA1 (patch-media_video_video__encode__accelerator__adapter__test.cc) = b800b173cac98b9b008968809c46469c7ab33cc5
+SHA1 (patch-media_webrtc_audio__processor.cc) = 98c719a719aca59b67e50aa28998f4cadcedb40b
+SHA1 (patch-media_webrtc_helpers.cc) = e693a6d39b87c797aaf703944ac19d7d32e409be
+SHA1 (patch-media_webrtc_helpers__unittests.cc) = ea73c15c78cd3cf0f40e4d1bd33c6cab35b33ff6
+SHA1 (patch-mojo_core_BUILD.gn) = 22944dc894cc7ff64dd0f656b945acd594d3f609
+SHA1 (patch-mojo_core_channel.cc) = d47a73412cce7440e5710a63dc7dbed440ad5b4b
+SHA1 (patch-mojo_core_embedder_features.h) = 7243476dcf53f8f0c58c19dff3b22a64599ee5da
+SHA1 (patch-mojo_public_c_system_thunks.cc) = 107c34a753b434ba40d69407b959ca3ff84604e6
+SHA1 (patch-mojo_public_cpp_platform_socket__utils__posix.cc) = 16e178a17e3392fd80d9361a2f697783540c4626
+SHA1 (patch-mojo_public_tools_bindings_mojom.gni) = d29bdceafa1c29ae9fa50accf5b5c22cc23ea187
+SHA1 (patch-net_BUILD.gn) = d1c8462036d5bc5b2be4fa23b9af1249a9997350
+SHA1 (patch-net_base_features.cc) = 31aa7147a492ea850c81893985f1741bcf34aef4
+SHA1 (patch-net_base_mock__network__change__notifier.cc) = 81da630b1169f602ac31b9e5dd97cc468eb2b08b
+SHA1 (patch-net_base_mock__network__change__notifier.h) = 87dd273c8737ce96f10c07761db925d948bc3a41
+SHA1 (patch-net_base_network__change__notifier.cc) = f83d71dda378ba31acbd8f5f8d8024f73c0f8a68
+SHA1 (patch-net_base_network__change__notifier.h) = b9e2905cc48fa457e92ad1359a372e385be3f244
+SHA1 (patch-net_base_network__change__notifier__passive.cc) = 73b174d67e1a520f0dab9ec8935af3971b70b226
+SHA1 (patch-net_base_network__interfaces__posix.h) = 66d072f1c897421be1da518b7e24915ceef35852
+SHA1 (patch-net_base_sockaddr__util__posix.cc) = db3652417341bbe100e781c0dbfa0e19f3b943da
+SHA1 (patch-net_base_sockaddr__util__posix__unittest.cc) = 1ec156dcab48f78d691a30bd42b80b8e2de5348d
+SHA1 (patch-net_cert_cert__verify__proc.h) = 3bc25a5191663fd87b57b234d550649aefd7def6
+SHA1 (patch-net_disk__cache_simple_simple__file__tracker.cc) = d0341d44ff41c8257fb0d2d57c4def67543131fe
+SHA1 (patch-net_dns_BUILD.gn) = ce89ce4f9d23fff69d9c3a953799e77ae1b8b1f4
+SHA1 (patch-net_dns_address__info.cc) = b99e2abe864d0a252849e9a1642f11867600c07a
+SHA1 (patch-net_dns_address__sorter__posix.cc) = 3f9e7c3b8326ec998309faf0cfc52123631960f4
+SHA1 (patch-net_dns_dns__config__service__posix.cc) = 449c37ab1a32fb29a4aa0bd3686ee467a7d3f713
+SHA1 (patch-net_dns_dns__reloader.cc) = f49ee5d7af324145bdd5d0716a6953c1627edaf2
+SHA1 (patch-net_dns_dns__util.cc) = bde02401e767daa7aa4938541d94cd403ec1aa74
+SHA1 (patch-net_dns_host__resolver__proc.cc) = 35c60fab91c9358e320a25f10ee1e75ee1551d42
+SHA1 (patch-net_dns_public_BUILD.gn) = 0005ebc4117915b14c6a0789dadad6e62f98e6b4
+SHA1 (patch-net_dns_public_resolv__reader.cc) = e31052ad37b99cf63066900b8d5c59a9ab632b47
+SHA1 (patch-net_dns_public_resolv__reader.h) = 8b29f9420a09e07108c78b389514ec88020cfd0c
+SHA1 (patch-net_dns_public_scoped__res__state.cc) = a917411b912b88561cfaccb75b9841cf511978e5
+SHA1 (patch-net_dns_public_scoped__res__state.h) = ee26988df4ad5ae5cc99473e94d384b54eeb8fed
+SHA1 (patch-net_filter_zstd__source__stream.cc) = b939a12a69f4be3a72e407501f2d08ef5c65df70
+SHA1 (patch-net_http_http__auth__gssapi__posix.cc) = 11ccc7f4bc3824799b99144f9bce486b7b31e7be
+SHA1 (patch-net_http_http__auth__gssapi__posix.h) = 7def44f4809b220b547ee4280f06154ee96b3c5b
+SHA1 (patch-net_http_http__auth__handler__negotiate.cc) = 5e483159b26b9bbf0bc42109da6d1cfade12787f
+SHA1 (patch-net_http_http__auth__preferences.cc) = 16cb2d22b45ef474a96e42722ddc08e412cd213a
+SHA1 (patch-net_http_http__auth__preferences.h) = b86a1fbe112108202d5e1747a65069047ee80461
+SHA1 (patch-net_http_http__network__session.cc) = cfea64e0a5cdce45ed5858d23dc6944fd9dbd61e
+SHA1 (patch-net_proxy__resolution_proxy__config__service.cc) = b2bb083f97045e0d597a0a874807a01022f2e9b3
+SHA1 (patch-net_proxy__resolution_proxy__config__service__linux.cc) = b5143a265be575113b0307098799192b3e2d6df8
+SHA1 (patch-net_socket_socket__posix.cc) = 21ecd762749a02c5048840038c08d32afe3d3e82
+SHA1 (patch-net_socket_socks5__client__socket.cc) = 26768ac4a4199af4b5c8c575af6c1f3715239dfe
+SHA1 (patch-net_socket_tcp__socket__posix.cc) = e7ca3402dd1e56988e9359056eb0fa9978fab15e
+SHA1 (patch-net_socket_udp__socket__posix.cc) = 971a23b6e8ff61cefe07f77d2733a6237e113e87
+SHA1 (patch-net_socket_udp__socket__unittest.cc) = 1388359c742382db3aa8712c8f25caafc20efbdb
+SHA1 (patch-net_third__party_quiche_BUILD.gn) = 9daaa03de6f0e392c6434c9dc65443a8d9ac4f81
+SHA1 (patch-net_tools_cert__verify__tool_cert__verify__tool.cc) = 831874ebfeb277a3154bd6731923887f42988ce7
+SHA1 (patch-net_tools_net__watcher_net__watcher.cc) = cd5e12df383876f2a1b95a7180228c463c488019
+SHA1 (patch-net_traffic__annotation_network__traffic__annotation.h) = 96a135bc0bfc42e3bbed4eb5832914e1bd454aaf
+SHA1 (patch-net_url__request_static__http__user__agent__settings.h) = 6d41dbb65b3d0e776cc9617d4673f9c4d59edb02
+SHA1 (patch-net_url__request_url__request__context.cc) = 251117b68dad59d3d89abc617cd857d3a9b7565c
+SHA1 (patch-net_url__request_url__request__context.h) = 4ef0e30ebcd4ccb50e38cceaf98482413ac5b578
+SHA1 (patch-net_url__request_url__request__context__builder.cc) = 7f9e65eeefd5c610fa92ac22501f3678355f9d7e
+SHA1 (patch-pdf_pdfium_pdfium__engine.cc) = 858fcded4ef43ca9cceadbc1f5e42f47121953d1
+SHA1 (patch-ppapi_buildflags_buildflags.gni) = 00a11a456c2b77c03b9c23d0ca0aa9d3291e2dde
+SHA1 (patch-ppapi_tests_test__utils.h) = ce483a30e82f1db31d7d43c5643da141e03619f8
+SHA1 (patch-printing_backend_cups__ipp__helper.cc) = f96a582f4b71e81d41e6aa5390edd0b9084ce556
+SHA1 (patch-printing_backend_print__backend__cups.cc) = 032490310a33f0bda111ce791731ed403148dba6
+SHA1 (patch-printing_mojom_printing__context__mojom__traits.cc) = 33c9152650d9da210379fb5e9bdfd36719feb898
+SHA1 (patch-printing_mojom_printing__context__mojom__traits.h) = 46d63cf835739e4da095ac72e20a9af0b953096f
+SHA1 (patch-printing_print__settings.cc) = ae7d286593ab300c8c2602b548893642d5ce98b4
+SHA1 (patch-printing_print__settings.h) = 9a9ddc1b86e5f123c2e448e490b0135d79a22d7d
+SHA1 (patch-printing_print__settings__conversion.cc) = 1ea72ca2b0fadd3c50bacf7cfe4ee5a23aa269c1
+SHA1 (patch-printing_printing__context.cc) = 5f52e04e5ae41ba2d67be3a129ec024acc2e59c2
+SHA1 (patch-printing_printing__context.h) = 3851f5f2402b2e99b2e54e01abb88e52094f27a4
+SHA1 (patch-printing_printing__context__linux.cc) = 9ad2fe97b0c4cd98552c3ea080a071953fb665db
+SHA1 (patch-printing_printing__context__mac.h) = c9f5a1fe505ad4ba9326e5fc06cf97281e1dd87f
+SHA1 (patch-printing_printing__context__mac.mm) = 47a4ff86c3f3d9054751ed2ab74776cc1e7b56d1
+SHA1 (patch-printing_printing__context__system__dialog__win.cc) = 937121f0c264340e437affc9f27d742a7587da47
+SHA1 (patch-printing_printing__features.cc) = 346d8545af3e6c5969ead68bf731f168553881a7
+SHA1 (patch-printing_printing__features.h) = be2a6778aef58fdc8f2934ecde147bf58d7237af
+SHA1 (patch-printing_sandbox_print__backend__sandbox__hook__linux.cc) = 021df58912f37534e37246df46f638d1c5fc1670
+SHA1 (patch-printing_sandbox_print__backend__sandbox__hook__linux.h) = 95288e93a7f89fcc641aa07cafb517adf75c5b28
+SHA1 (patch-remoting_base_chromoting__event.cc) = 12bd303844635f06fcdfac4ba97e1a3b1c62f940
+SHA1 (patch-remoting_base_host__settings.cc) = 411c94aac279b0315af35f82bd47573d1f6e64a5
+SHA1 (patch-remoting_client_display_sys__opengl.h) = 053e5c159fbf390eb4efa5fb51007173f5542f29
+SHA1 (patch-remoting_codec_webrtc__video__encoder__vpx.cc) = 1111539367f51412d47442f230f658740ac951a9
+SHA1 (patch-remoting_host_base_desktop__environment__options.cc) = 9bd629b1fcc676cc955e65e209f4973c8ae79b78
+SHA1 (patch-remoting_host_base_switches.cc) = c37d128fcf9934ae2736b92cee961eb6d656bbc9
+SHA1 (patch-remoting_host_base_switches.h) = 5643fa3865941134aee9b505f1036b1e67203ba7
+SHA1 (patch-remoting_host_basic__desktop__environment.cc) = 401b823b436d92bae426ab4813a71f2007f4be05
+SHA1 (patch-remoting_host_chromoting__host.cc) = a77374d95fdb417407e90db5db642e1ca510818d
+SHA1 (patch-remoting_host_chromoting__host.h) = 04f2497f43efbaf5ba812a62718eae14ec0a4a27
+SHA1 (patch-remoting_host_chromoting__host__context.cc) = acc111190290efc4eaf72de218b18397041eec46
+SHA1 (patch-remoting_host_chromoting__host__services__client.cc) = 976933f3fdcc1c1326baaf0c5aa6ab3faf5e2d31
+SHA1 (patch-remoting_host_client__session.cc) = 32594d8e25041926615c77a2ccbcda7828010677
+SHA1 (patch-remoting_host_crash_crash__file__uploader.cc) = bfca4cd355c4145c3ccdf6e214abb2f950d098ca
+SHA1 (patch-remoting_host_desktop__and__cursor__conditional__composer.cc) = 63ceb31bd23e37c34725d9d12d2260d2cb2d8136
+SHA1 (patch-remoting_host_desktop__capturer__proxy.cc) = 6197afd8a44ae16fe7df7532b5164900ae78eb5f
+SHA1 (patch-remoting_host_desktop__capturer__wrapper.cc) = 2cf2de7554f8a7b94dd3046839490862f485ca9a
+SHA1 (patch-remoting_host_evaluate__capability.cc) = 2a3159fb3e6542e763bb9d0033dac4bed48f2209
+SHA1 (patch-remoting_host_host__attributes.cc) = 9ea13b1fa29322796e7caa48c8cd7f622bfd8bfa
+SHA1 (patch-remoting_host_host__details.cc) = e35e02b3df733395b5ae08f259e854aceac45350
+SHA1 (patch-remoting_host_host__main.cc) = 23e003777730ac5e4f0c454b610e601c394f2698
+SHA1 (patch-remoting_host_ipc__constants.cc) = b3da64e02bedcedfe84e4d4897538bf27f815dd7
+SHA1 (patch-remoting_host_it2me_it2me__host.cc) = b941f62e81d9a65bc019fc778d3dfd12da87a3e6
+SHA1 (patch-remoting_host_it2me_it2me__native__messaging__host__main.cc) = 931f73b26fbadbdc3ab2bb04bf798e8d4f3e4a9a
+SHA1 (patch-remoting_host_me2me__desktop__environment.cc) = 7e6ed732a5fed4f88ea6e68c2ae4ce5a0cf5d82b
+SHA1 (patch-remoting_host_mouse__cursor__monitor__proxy.cc) = c2ff2e8bf0d0ea7eef4261318162297bcf77a354
+SHA1 (patch-remoting_host_policy__watcher.cc) = 1f62a0b804723ff1219613dbbb08d398722ebda6
+SHA1 (patch-remoting_host_remote__open__url_remote__open__url__client.cc) = bbaff9e9d2b60a5b83ae8480a02ca7ecfa4008c7
+SHA1 (patch-remoting_host_remote__open__url_remote__open__url__util.cc) = 362d52268e783f93efd6157b2aebc6a049933e38
+SHA1 (patch-remoting_host_remote__open__url_url__forwarder__configurator.cc) = 8e52bf5ebb55307f7669e31be6bb848f01718ed0
+SHA1 (patch-remoting_host_remoting__me2me__host.cc) = a07e31d8d7a26b3a80c17da498b7dc167baf6913
+SHA1 (patch-remoting_host_setup_start__host__main.cc) = 79785a5823aeb98acf8189eba4f01020658bcf24
+SHA1 (patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc) = 8e0a1a842acd58901d0e2134657611c51c14ae62
+SHA1 (patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc) = ac81850b2acbd348abb6497e59af92225b5c4050
+SHA1 (patch-remoting_protocol_webrtc__video__stream.cc) = 810dbd9f26445765c98c436d0206542e876dcc2c
+SHA1 (patch-sandbox_BUILD.gn) = e756d3bdd6ebf201250fb4f95173b8268f4b9319
+SHA1 (patch-sandbox_features.gni) = 8485b2491ed3a7aa3c7896e0a5dfc6eb34dfa40a
+SHA1 (patch-sandbox_linux_BUILD.gn) = f7d0432b9171dc8443af4b170e1546ce3afe59e5
+SHA1 (patch-sandbox_linux_services_init__process__reaper.cc) = e8813bfe3ac5760dd4c57a61468586b91a655903
+SHA1 (patch-sandbox_linux_services_libc__interceptor.cc) = 78fa6da02ec117737464dc44b3b5edb418b32424
+SHA1 (patch-sandbox_mac_BUILD.gn) = d73a90e37437e22688b450f0f089528c7aa35eb1
+SHA1 (patch-sandbox_mac_sandbox__compiler.cc) = cffa3b5e72173d0fc57fca7c4a4d1b527b3320c2
+SHA1 (patch-sandbox_mac_sandbox__logging.cc) = d7997c2aa6cad9fe41af468c2174b12abf20343e
+SHA1 (patch-sandbox_mac_seatbelt.cc) = b42657167a333525cb49ebf7a5a6738f9f1e7cca
+SHA1 (patch-sandbox_mac_seatbelt__extension.cc) = 0a7445258ed98bf5a18b1bf3720fcea9012ecf62
+SHA1 (patch-sandbox_mac_system__services.cc) = 7e830999a024e9487a6bfc4d0a3c72ed618e2593
+SHA1 (patch-sandbox_policy_BUILD.gn) = 39bbbf63bdbd2ea2ce431bc416bb2249539db674
+SHA1 (patch-sandbox_policy_features.cc) = 6949af8feec57e1cb8632f422411dc3212bacea5
+SHA1 (patch-sandbox_policy_features.h) = 8ed89b22d6079de8492e38182be5b7d08871bd90
+SHA1 (patch-sandbox_policy_freebsd_sandbox__freebsd.cc) = dd4615a1e3cdb70017294b3899efc503f7446314
+SHA1 (patch-sandbox_policy_freebsd_sandbox__freebsd.h) = 85ffc3b1a96f8b0e30839263ac25e8d4a0d35722
+SHA1 (patch-sandbox_policy_mac_sandbox__mac.mm) = 96e9fdc382ae01c11e3047bdc733d750c8320451
+SHA1 (patch-sandbox_policy_mojom_sandbox.mojom) = 8b2ae8d7f7ab7e736b88a9b6a1d9c004a03cfa60
+SHA1 (patch-sandbox_policy_netbsd_sandbox__netbsd.cc) = e246bb0c7bb85ddc8f30585e703c505f512ffb41
+SHA1 (patch-sandbox_policy_netbsd_sandbox__netbsd.h) = e056d54f8de8f36befbfd76b38ae7b5bfcfaf5e8
+SHA1 (patch-sandbox_policy_openbsd_sandbox__openbsd.cc) = 2218e2deba943135602b42c26f3620bb0a5b4798
+SHA1 (patch-sandbox_policy_openbsd_sandbox__openbsd.h) = a3cda1a62a49c19b07b48e2f639c04961f23a57e
+SHA1 (patch-sandbox_policy_sandbox.cc) = c2dfc86bf3db15775475849be8d8d5547ea76656
+SHA1 (patch-sandbox_policy_sandbox.h) = 56f93ec2a863ab269268e0d8f56a36133191a92f
+SHA1 (patch-sandbox_policy_sandbox__type.cc) = b383680214263958b7207f6315a2d3173795f6b0
+SHA1 (patch-sandbox_policy_switches.cc) = e14e6a0316c4dadc4e9e47165d1b2e6c8c54f889
+SHA1 (patch-sandbox_policy_switches.h) = 91b4fd55deb9b28feb8daf06aae81b3794b5fe18
+SHA1 (patch-sandbox_policy_win_sandbox__win.cc) = a785eda487f9f69fdceac458254b124c2cf4a444
+SHA1 (patch-sandbox_policy_win_sandbox__win.h) = daeb8b039d290428eee75b0e62226a2824a7448e
+SHA1 (patch-services_audio_audio__sandbox__hook__linux.cc) = c1ce3a8e735bcf9440a2aff9240760509bc25949
+SHA1 (patch-services_audio_audio__sandbox__hook__linux.h) = e6e86db956f44b8c64c0fe4cf61b4a615baa1587
+SHA1 (patch-services_device_BUILD.gn) = 25ed2beb1b9988eb28b623f30de957dbc7aaebeb
+SHA1 (patch-services_device_geolocation_location__provider__manager.cc) = 4a1c4a03c6f524112c1e1188cd59c2e352c9fc0a
+SHA1 (patch-services_device_hid_BUILD.gn) = 71a1b5ac30601eebce7dbbcc70a8ba4c80b94a19
+SHA1 (patch-services_device_hid_hid__connection__fido.cc) = f9e72aecaee906768d3a0f2c500f55332b60c875
+SHA1 (patch-services_device_hid_hid__connection__fido.h) = b1807ffb5e2e379cbe00dfa3e8fe69de0747b07e
+SHA1 (patch-services_device_hid_hid__connection__freebsd.cc) = 48faaaaf297600d29e17470844e0bdaf48e419f1
+SHA1 (patch-services_device_hid_hid__connection__freebsd.h) = 4f1f3356226277ddc499c884ad49db76bf546e06
+SHA1 (patch-services_device_hid_hid__service.cc) = 9e12273b45eb933129544bd16df401f0ed5592b3
+SHA1 (patch-services_device_hid_hid__service__fido.cc) = 259b8789e1f292414951d1929183952139f3a5a9
+SHA1 (patch-services_device_hid_hid__service__fido.h) = 71f3c29b369d38dce489dd19378ab4e4b92fa990
+SHA1 (patch-services_device_hid_hid__service__freebsd.cc) = bfdafed410dde3d35266dfaac96f98a74f41be8f
+SHA1 (patch-services_device_hid_hid__service__freebsd.h) = f9225ce9d22b6c69732644c23d0448d46171f42b
+SHA1 (patch-services_device_public_cpp_generic__sensor_sensor__reading.h) = ac4d96b2538bb13cceb0c6f46124c69d6736f1b7
+SHA1 (patch-services_device_public_mojom_BUILD.gn) = 3d43e4d78eb82f9304447bb92eb338d186409511
+SHA1 (patch-services_device_serial_BUILD.gn) = 476da861408c36b899ae67909eeeac879f91fdf0
+SHA1 (patch-services_device_serial_serial__device__enumerator.cc) = b363c1dc5e3ac3425cf5f0c02efd72d09123e02e
+SHA1 (patch-services_device_serial_serial__io__handler__posix.cc) = a7b1513d9030a2c58b0b80f25917b59e791ec0cb
+SHA1 (patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc) = e34e9d0b855cb4afc3cc0457f265b848ab5c85f4
+SHA1 (patch-services_device_usb_BUILD.gn) = 683e7454f47f3dd7571f0baff8a267f1c21b1ae8
+SHA1 (patch-services_device_usb_usb__service.cc) = 92b7a209e07c4877311f98a8208eda3f2cb5531a
+SHA1 (patch-services_device_usb_usb__service__fake.cc) = bbc6db8d6ebcc8eb241014dd4865034c57ad4d98
+SHA1 (patch-services_device_usb_usb__service__fake.h) = 5709cf81c778a8953484f12ca079439e02844e37
+SHA1 (patch-services_device_usb_usb__service__impl.cc) = a7ba10a72251c5a237111cee4b307ffc7302665d
+SHA1 (patch-services_network_BUILD.gn) = a70f1f8b068d96797630b40a7bca785bc9e03eda
+SHA1 (patch-services_network_network__context.cc) = 4802950171d752d0d4f2d5a5e48024458ad8422d
+SHA1 (patch-services_network_network__context.h) = 3e23fc8c1abec441784c938933bceace03c33b81
+SHA1 (patch-services_network_network__sandbox__hook__linux.cc) = 6ffc2d2119abf9058cea1b572fdc852468527a84
+SHA1 (patch-services_network_network__sandbox__hook__linux.h) = 3b476406d7389991881efe08f807bd0365bbfe95
+SHA1 (patch-services_network_network__service.cc) = 187de5c734bc87749f8dd79d0be27f688364be7f
+SHA1 (patch-services_network_network__service.h) = 8b83ae71bb8ee4b42e42e88fd4a06e96a34a5b69
+SHA1 (patch-services_network_public_cpp_BUILD.gn) = c8a972f93b43714c234b0499def83f025dec1db9
+SHA1 (patch-services_network_public_cpp_features.cc) = eae4481deb4e323a1358ed9cb8f5dfe375d71dc7
+SHA1 (patch-services_network_public_cpp_resource__request.cc) = 416a0aff7fe88b804f99905046ce61400134906a
+SHA1 (patch-services_network_public_cpp_resource__request.h) = 842172a1782e63793fea9a4e2c27aa3418ee2ea8
+SHA1 (patch-services_network_public_cpp_url__request__mojom__traits.cc) = 4e15d651652cb2bb81a2c9a1aa1671666d81bd67
+SHA1 (patch-services_network_public_cpp_url__request__mojom__traits.h) = 2b953de7894347d2afb9ccb9cfdc4aba4fd042c0
+SHA1 (patch-services_network_public_mojom_BUILD.gn) = ba676a240e4f2ec70c6ef27e7dbdac347980dfb3
+SHA1 (patch-services_network_public_mojom_network__context.mojom) = 65f5af72403cc5251d37f23fa5db90e7de35e28f
+SHA1 (patch-services_network_public_mojom_url__request.mojom) = 68fab8efec352739d64e1ec2c4f02fb2bc5e551a
+SHA1 (patch-services_network_public_mojom_url__response__head.mojom) = da1641d32d5c80defed81383f4709c55c722ffa3
+SHA1 (patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h) = 93b2d0a6bafa7baa9f5db5448139f0c55ca7480a
+SHA1 (patch-services_network_test_test__network__context.h) = 09733a8e3c1042ae2881bde8db452e2b5635df6c
+SHA1 (patch-services_network_url__loader.cc) = c194b5cb9880cb5fb7a827e15659880824936aec
+SHA1 (patch-services_network_url__loader.h) = 2156fec97de7a25fe67058cf28b5330a580264fe
+SHA1 (patch-services_on__device__model_on__device__model__service.h) = f1554408d9c3abed46dcd52bf2508f0278942a3f
+SHA1 (patch-services_on__device__model_pre__sandbox__init.cc) = b3d8fe71488dd98b4bb4edcd4a81db7b6f19f2e6
+SHA1 (patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc) = bde2937373223282923ee297bf72656d059fdaa5
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn) = 8953bd4aff1547626b033f1729dc68082b28c756
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h) = 23a5d8eea30eeaaa6e6885621711088ab2762e91
+SHA1 (patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc) = 03c6e26fb0db06d32cae845fb7e2d8efe27fba76
+SHA1 (patch-services_screen__ai_public_cpp_utilities.cc) = 36218f2c6429aa833f6b872a24063d1723ad856d
+SHA1 (patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc) = f5bee8fb8637f006212a425006fa6f31cbe188f1
+SHA1 (patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h) = eff576ce9617098e14bcc3358bc1295cc7fee1bc
+SHA1 (patch-services_service__manager_BUILD.gn) = 5c547b575b927058b530c1d06eb1ad9d34f2528b
+SHA1 (patch-services_service__manager_public_cpp_service__executable_BUILD.gn) = 15d70cb553f774e4d8555cdbe4dec4d04457d9c3
+SHA1 (patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc) = 5e8aeea44de9420ebdf6328bbe65cbe93a9028e2
+SHA1 (patch-services_video__capture_public_mojom_video__capture__service.mojom) = 40dbbd3f4570df55da890a3c05dc8e0909200dcf
+SHA1 (patch-services_video__capture_video__capture__service__impl.cc) = 6fe7ad2c47d99cdc409212874bb4f4f1934d10e2
+SHA1 (patch-services_video__capture_video__capture__service__impl.h) = a0c821f0aabb3cd461c0524332ac2c740f93fbb0
+SHA1 (patch-services_viz_privileged_mojom_compositing_display__private.mojom) = 157e28f5e9a7a758554feeadf996a77d152a3435
+SHA1 (patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom) = daef38456f67fe4b063e74d010c11dd0da2b6986
+SHA1 (patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom) = c4d7f197704028b06c5c0287413751a80c52c453
+SHA1 (patch-skia_ext_SkMemory__new__handler.cpp) = aa2c51481b2761cba0d2361b722965500708607c
+SHA1 (patch-skia_ext_font__utils.cc) = 16381bbce0a9e8380978a16dd0ae3ab37aeee5f4
+SHA1 (patch-skia_ext_platform__canvas.h) = 1656cd137f1bdd846f46546d5c8ebff6ce338256
+SHA1 (patch-skia_ext_skcolorspace__trfn.cc) = afa37307bb15caebffe06c4d16cc6cf547ab0d6b
+SHA1 (patch-third__party_.gitignore) = 5bc63bdc85375109b7728043d36aaf675da91974
+SHA1 (patch-third__party_abseil-cpp_absl_base_config.h) = cbffc2a73d540f6764689f6209d7b2ec94cf6885
+SHA1 (patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc) = 3e61589273553ddf233788e7dd2c13d4ab122d7b
+SHA1 (patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc) = df95b238167536c17459023a4e533cfd33a821aa
+SHA1 (patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h) = f4faf4d9f02305113202a13764ef87846b86acc2
+SHA1 (patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc) = 26b3d30fe134801dfb0f6225cc5e1e30427f861a
+SHA1 (patch-third__party_afl_src_afl-fuzz.c) = 65153369a5585b9c90cb62b3c7756e0a93916c08
+SHA1 (patch-third__party_angle_BUILD.gn) = 203ee832ffd78829fde882492f28074f1263e180
+SHA1 (patch-third__party_angle_src_common_platform.h) = e7ef8303478d83c7628e90654b20e59722907d5f
+SHA1 (patch-third__party_angle_src_common_platform__helpers.h) = e46fcea5fa2e144251f71910378bbfe00300ee6a
+SHA1 (patch-third__party_angle_src_common_system__utils.cpp) = da0e358b29d99e6c2aa1ba28a062952bcb7b40c9
+SHA1 (patch-third__party_angle_src_common_system__utils__linux.cpp) = 179bcdc67d69a87e66aad3b3eff9fab291258857
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h) = 5a4d4a3695182099887def3a37eb489a3c4a760c
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp) = 889e6cd2a96cffac4f7c31d6c58c7b2e8876b50b
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp) = b4faad08d91433b42e9ac1898258f1d416082e59
+SHA1 (patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp) = 1ea2676b8d2b176bc16e03d9872c48e008dd7185
+SHA1 (patch-third__party_angle_src_libANGLE_Display.cpp) = 4d758c1dd5405e7272f150488f08527f3e3d3a41
+SHA1 (patch-third__party_angle_src_libANGLE_formatutils.cpp) = d54adfa19cf52fae17091f128f4194f56357ba2c
+SHA1 (patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp) = 866ccf25dbb6481f328e788915b0ef7896c77361
+SHA1 (patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h) = 462f787a5ce07faeafa27b6bd7f19e37ec63d8bc
+SHA1 (patch-third__party_angle_util_BUILD.gn) = d54949ce9577e01c9547b5cf9d8893cf384030c4
+SHA1 (patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc) = 79a983b708773d9aac4133cbce053b39e7029033
+SHA1 (patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc) = d19dbc85014ebb2f618433ad27ab7d2a9ef92364
+SHA1 (patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h) = 1fb3a21f63a86841cdf3d7d72d7d66d888b2d2bf
+SHA1 (patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h) = 497fe16e35b3270bf0bf001455d7db0518657452
+SHA1 (patch-third__party_blink_public_common_web__preferences_web__preferences.h) = 01561ea487155a523cf89a656d7b97ea5f438ba0
+SHA1 (patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h) = 3f6984424fc36ff9faa79140a971039cb082fc8e
+SHA1 (patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom) = c0fbc3daefddaa4c5b8d6322d1a9769c8c6dbce5
+SHA1 (patch-third__party_blink_public_mojom_page_page.mojom) = 264741a373dc502729166d5540706d5de8e41c4b
+SHA1 (patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom) = 90bb54a9019b3f915ec759a95ae1e0e2f35dab8c
+SHA1 (patch-third__party_blink_public_platform_platform.h) = faa1fa5e5c05bac10c67ca71361a9d03ebc203a7
+SHA1 (patch-third__party_blink_public_platform_web__vector.h) = 1a5eb6d3deee28dc577f88ace4594ef0c4fcbcda
+SHA1 (patch-third__party_blink_public_web_web__blob.h) = 217c3659748e98b1460f5e82a9b13c4c1f7f0598
+SHA1 (patch-third__party_blink_public_web_web__document__loader.h) = df0190ac5cc7ced481f32c6d092bcb18ea34681a
+SHA1 (patch-third__party_blink_public_web_web__local__frame.h) = 863edc192451ad477ec5fecf8d816150875151af
+SHA1 (patch-third__party_blink_public_web_web__local__frame__client.h) = d0ed4e1ba0800b5bd5237c41ccbc56702de1014d
+SHA1 (patch-third__party_blink_public_web_web__message__port__converter.h) = fa60d0e6cf3e8929875145a3b1410769d0e4bf6d
+SHA1 (patch-third__party_blink_public_web_web__script__execution__callback.h) = ff444ea3d8c0ff0b6174501049b0b2427e8c517b
+SHA1 (patch-third__party_blink_public_web_web__view.h) = 939927f9a502cfc54101f54bb80e7c25ee859efb
+SHA1 (patch-third__party_blink_public_web_web__window__features.h) = 7917bc233f403786252ad9377e2172b7ef165995
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc) = ec0afe864368f424f527cc982748b7a63d4ad6ff
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc) = 4d48c1249643acdf229e2437b9fb3f7ff1f359fe
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h) = 9d14da03872f9e20cdc2d7e4056b401506714de0
+SHA1 (patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc) = f5a1d745279f354549292225d435773be0758e9c
+SHA1 (patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py) = fbaff250c00d8a2ed30d912f7e5fce4dfaf59087
+SHA1 (patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py) = f037e3ddb011697d6cc0fd770a0210dc3597e423
+SHA1 (patch-third__party_blink_renderer_controller_blink__initializer.cc) = bdfda76f386eaba350e899ca3e8104700c2743ed
+SHA1 (patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc) = 0309dff294af075b5f9a8ab1e4fcdb07e7917d00
+SHA1 (patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h) = 8e535219a7b6a313befb67319bc0c5f12093257b
+SHA1 (patch-third__party_blink_renderer_core_BUILD.gn) = e5a2ed08dce5a8c9d200f39035607a5c64e978e9
+SHA1 (patch-third__party_blink_renderer_core_css_font__face__set__document.cc) = 7ced2595da670f04ef2f40ac7b49a64b04a6f1a7
+SHA1 (patch-third__party_blink_renderer_core_editing_build.gni) = 483320a5cc6282d9e92efb0332584521bf346628
+SHA1 (patch-third__party_blink_renderer_core_editing_editing__behavior.cc) = 44012778bd8c04a149424fcc8a292a3aba4530a8
+SHA1 (patch-third__party_blink_renderer_core_editing_ime_edit__context.cc) = 88af24cde14626f51207eb9e7a07218c3d087183
+SHA1 (patch-third__party_blink_renderer_core_editing_ime_edit__context.h) = 579e93be8286cf8eb931263c813bbef504e4a693
+SHA1 (patch-third__party_blink_renderer_core_execution__context_navigator__base.cc) = c8ac3bbeb38c917b62e64a91811da17128a421d3
+SHA1 (patch-third__party_blink_renderer_core_exported_web__blob.cc) = 71774313692282d5d3b00fb7eba148119b956a66
+SHA1 (patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc) = d9a870883440302f9f569918f70d05a45c686fc9
+SHA1 (patch-third__party_blink_renderer_core_exported_web__view__impl.cc) = 2af5d6c319e07a924022bdc54eed46cc3809a468
+SHA1 (patch-third__party_blink_renderer_core_exported_web__view__impl.h) = a3639141622ec77edb6fdf31cf8f58a5fbdc83ef
+SHA1 (patch-third__party_blink_renderer_core_frame_frame.cc) = de68f467cfc07f9e80ecab45a48e97c0ac265fad
+SHA1 (patch-third__party_blink_renderer_core_frame_local__dom__window.cc) = 08445461e24aeda938350285be9684df0781c5d6
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame.cc) = 7f40a05dbfac9c602153bbde7e7cfccc4a422adc
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame.h) = 9d305b2d3739ad6aa009853b14fe9817453ecf02
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client.h) = 101e0e3d1932c645a91fb444aecce32f1c543c75
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc) = 4ec441d206d77860ec1e90d5f362e158840a3349
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h) = 3888a43d168ecbcdb0a744bf889080712340bd48
+SHA1 (patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc) = 9b8939c0ee223d8658c8af21dd2050a3a7a6fac8
+SHA1 (patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc) = 139f27119722f00f54dd26208d654ac1fbd4a0c9
+SHA1 (patch-third__party_blink_renderer_core_frame_pausable__script__executor.h) = f675c0be0b5909012ecbec06e428ff6e62488b45
+SHA1 (patch-third__party_blink_renderer_core_frame_web__frame__test.cc) = 7c9c8cfcc31279b00feb8371e02c2fa31aa5c1d8
+SHA1 (patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc) = 49f1ff13cc912873f98e24c1655734b8e4bef047
+SHA1 (patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h) = 15ba6d7724b943500bbe8a0181d4ccb4f0970861
+SHA1 (patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc) = 0f9c0ea0c9cb775ffa959f777af5868e0b085292
+SHA1 (patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc) = 10f3df4215053162b8c8e299b892aee0abcd3bd8
+SHA1 (patch-third__party_blink_renderer_core_html_parser_html__srcset__parser.cc) = 5a4de5c81193431952a19c85a582f7f0aad83887
+SHA1 (patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc) = 61c24ce9cb9abae3e2f18383107b2a4724dd29c7
+SHA1 (patch-third__party_blink_renderer_core_inspector_inspector__network__agent.cc) = 818fe583b8713a1e9040858a50e0cec4774d78e7
+SHA1 (patch-third__party_blink_renderer_core_inspector_inspector__page__agent.cc) = 3c0b37a807fd9920aad049e318f8291e6522db91
+SHA1 (patch-third__party_blink_renderer_core_layout_layout__view.cc) = a24cbc65eb5dcdb27b470c1b0bb1638e6b926bb3
+SHA1 (patch-third__party_blink_renderer_core_loader_document__loader.cc) = 1e2159c470da740ac310e07a438dcd1b4272e2de
+SHA1 (patch-third__party_blink_renderer_core_loader_document__loader.h) = 9d7281bcd126ad93fb3d9e14b908042ccf8378d2
+SHA1 (patch-third__party_blink_renderer_core_loader_empty__clients.h) = 9f557b3350f0db5d5ba30365c7218282a95a5d80
+SHA1 (patch-third__party_blink_renderer_core_loader_image__loader.cc) = 1f5d826d1f38cfe7a0b72df708e7fc64e47d3601
+SHA1 (patch-third__party_blink_renderer_core_loader_modulescript_module__script__loader.cc) = fc6ca318e92014e72a1c79b6970d32702c6c7d63
+SHA1 (patch-third__party_blink_renderer_core_paint_paint__layer.cc) = 9a075692ca577998ed4bd42b364466ff00519a29
+SHA1 (patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc) = 29a06ca325a981a3016ae616933c3a1293a70e04
+SHA1 (patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc) = e0ec27687e5598a872b9ea4519860643256e1c56
+SHA1 (patch-third__party_blink_renderer_core_testing_internals.cc) = 0eba58956137490f755c25d67c5fdc5e46f204a9
+SHA1 (patch-third__party_blink_renderer_core_workers_worker__thread.cc) = c41497f9cbdda56e204cc004757a5edba3f190f0
+SHA1 (patch-third__party_blink_renderer_core_xml_xslt__processor.h) = fbbc9cb4ee20501fd03c4825da242d65fab537e7
+SHA1 (patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc) = 8b212ab0aacb5953e2df519b84a85d53ce54881e
+SHA1 (patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc) = bbc8ead2589da0c53462583afc153c10431aaf17
+SHA1 (patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc) = 7daced8e1a35cd73d8a8e8a8f4dea49a78cff056
+SHA1 (patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc) = df657598e8f44b25c78733498ddf8984f502556b
+SHA1 (patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.cc) = 9c3467373870d077da4ea2a1bf780043e25be414
+SHA1 (patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.h) = 06d49cdbeb33dd4fb6ffe28c96bdeef49b1900e2
+SHA1 (patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.cc) = 33112c564012f91832dcef8e9753f9efbf3414b9
+SHA1 (patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.h) = 08795a686c3c9f1919016756c2061f4d4815a372
+SHA1 (patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc) = 74d5dca91325d3b8a1bae2c6eabf37198d09c926
+SHA1 (patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc) = 15a4175f25d0a3e170ac50eab145821cf9cecfe5
+SHA1 (patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc) = d481536b06490652a3e6f25c176460e32ecc7919
+SHA1 (patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc) = 793c4789f3b49e01f255fcdc461a26b24b9c7870
+SHA1 (patch-third__party_blink_renderer_platform_BUILD.gn) = 78bfd68c38a3c5c45de95f8563f9c64271b66de1
+SHA1 (patch-third__party_blink_renderer_platform_bindings_script__state.cc) = 80c2e0d14f12e8a40b36d0cf717c7915d22478ab
+SHA1 (patch-third__party_blink_renderer_platform_bindings_script__state.h) = 4ae022636cc0df8172b7968ed2f43c51c96cd6e4
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__cache.cc) = cd345238b0496d894fc9c0f77b49fb999217475a
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__cache.h) = 6f756265909dca96437d54fb383620d4ea89a1d0
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__description.cc) = 052f6eadbed4e4f52c83062c2a9502d4a1706d6c
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__metrics.cc) = d9e76a25c0caf7bca3b6bb5e2cb2e05a87cef520
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc) = 2c8b19de60b6e084f1155c79803f942a506ecf5a
+SHA1 (patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc) = add3a5c744636f9c51edc6d1709abc13618ebebe
+SHA1 (patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc) = a47c6a8c6e7330179913bbad4f85f86665d2af71
+SHA1 (patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc) = c719f293d35dcd785f9a2dcd558e97b1c3db42f5
+SHA1 (patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc) = 6ff6d80cdad036ae988cca592702effbb4e4bf67
+SHA1 (patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc) = a3c1270355726918aaa31b5d869e20c9276ed05c
+SHA1 (patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.cc) = c8dc6e216bdab454e172c706625b44b4baecb6da
+SHA1 (patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.h) = c2d0557de1be4ddeef0fa1a91f1463b6200ebb33
+SHA1 (patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc) = c144d0711c7b8adf31c1db48aa31b744af84521b
+SHA1 (patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h) = ac657bbbd38d467372fb688946394600280fd895
+SHA1 (patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc) = dc62dc423f6bd3fe852e4026dce8f1e91fb77df3
+SHA1 (patch-third__party_blink_renderer_platform_runtime__enabled__features.json5) = d79a32af05cca5e0117d3db770958d4de102fb00
+SHA1 (patch-third__party_blink_renderer_platform_scheduler_common_thread.cc) = 64db0f4c15c656a243daa3236145e15789c341d9
+SHA1 (patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc) = 29dca478da24c52c4dacddfaa99e7b81b9827b69
+SHA1 (patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc) = 6a11adae2edc124d89f25d6bd7eea09719952cf0
+SHA1 (patch-third__party_blink_renderer_platform_wtf_container__annotations.h) = 9db3df4afab4a6c16cc59359b1dfb906a37183b0
+SHA1 (patch-third__party_blink_renderer_platform_wtf_math__extras.h) = 00f1f31e31715e4f9fcd5addb8f46af1ecc16c96
+SHA1 (patch-third__party_blink_renderer_platform_wtf_stack__util.cc) = 7cbfab6f41cd38a876e9eb1fbc8586fba8de49d3
+SHA1 (patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.cc) = ccf961f61cf8db75e9aa3ec5a46d28b8d4c846af
+SHA1 (patch-third__party_boringssl_BUILD.gn) = 11a033e2e43bc3398927c7d6c8d2b0cbe4babd38
+SHA1 (patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c) = 8fb8ccda0d34343e4f2a0ecfe252995c5430d992
+SHA1 (patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c) = e22f5562d349dd5f31589d60ff00387dc996eb9e
+SHA1 (patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c) = 8959c23dbfd6ee846a4201733d7250dc2ba4a231
+SHA1 (patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c) = dc6435c2e4723a752d116298f1bd7a98634b2483
+SHA1 (patch-third__party_boringssl_src_include_openssl_cipher.h) = 832cca04af27398c888410480d23304efb1d7435
+SHA1 (patch-third__party_boringssl_src_include_openssl_digest.h) = 2fe11759ce8d20e51b2e38135091576be9dc411a
+SHA1 (patch-third__party_boringssl_src_ssl_ssl__buffer.cc) = d041e560f84ed1cdfaece5350f9b9fc3a44f95ff
+SHA1 (patch-third__party_boringssl_src_ssl_ssl__lib.cc) = 1754786013ad77c6583a45d05c5ac41d4c51740b
+SHA1 (patch-third__party_brotli_common_platform.h) = e598ddc41b9a037f651df2c530cdf0b67a881a69
+SHA1 (patch-third__party_cpuinfo_cpuinfo.gni) = 9b9239ac0910b7489446c2b5273183747410807f
+SHA1 (patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni) = d56599c034256dcfbe5f70332686948221a1bab5
+SHA1 (patch-third__party_crashpad_crashpad_client_BUILD.gn) = 653baf600611d34172b1f42256c3c887bc47e654
+SHA1 (patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc) = 59475e8497a5b029e6d34be37c81fc836196c674
+SHA1 (patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc) = 15d7b241e24cef7577209816aa68cc683109bf12
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_address__types.h) = 757fd14a200b7203a16b2c3502e7d3247bf8dff7
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_capture__context.h) = fb1a7488af5a8b7e4af47679bc037f0e32db39e1
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_metrics.cc) = 84471901a6f4a17e9bb90bb8f6c95d6aa2af3438
+SHA1 (patch-third__party_crashpad_crashpad_util_misc_uuid.cc) = 7c220958f93cc022562ca66cf2ea37c98b684445
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc) = 416d18d676b87602870bdcad0926ba247060fc40
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc) = 93453d4d624951d7bf5ee087b587c753a5f1b506
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_signals.cc) = 00ec1e71a5ed966783b5af0d710bce50db67432f
+SHA1 (patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc) = 04df7b68bb692f4551dcbc6af5eab8cdfdb98215
+SHA1 (patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc) = 098ce08ac17227546e7b774b34f1482060b78c50
+SHA1 (patch-third__party_crc32c_BUILD.gn) = 1502c717cb8fd80ac7d3a441d64546a4c2fc46fa
+SHA1 (patch-third__party_dawn_include_dawn_native_VulkanBackend.h) = 9e5a209496c9cfa198afcbc6f6cbfb9aac1ddf06
+SHA1 (patch-third__party_dawn_src_dawn_common_Platform.h) = 94dc112146274eda0708f6028f99769bab891bb8
+SHA1 (patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp) = dd9d4cb154c78948d1dbc7aea87f3aca2d47481e
+SHA1 (patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness.cc) = f658c0fe13a0a7912224adc0dc56ee69bb36a8a7
+SHA1 (patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness__test.cc) = aaa2a1dd49a78009986aa8233f78089fc119243f
+SHA1 (patch-third__party_dawn_src_tint_lang_spirv_writer_texture__builtin__test.cc) = ade9b018b939dc278e01a1d511f80784033c4dd9
+SHA1 (patch-third__party_dawn_src_tint_lang_wgsl_resolver_address__space__layout__validation__test.cc) = 2177fa9b0483ce05e8d8a0a9a558079e24bd3d89
+SHA1 (patch-third__party_dawn_src_tint_lang_wgsl_resolver_validator.cc) = 65f540819d0cf329d59fd62427a73c0ace01f168
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl) = b3fb565a06b139a09ec2ce62b7469a267aa810ff
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.dxc.hlsl) = 31ef14d35253dffaaa1d12eec1eb292ba8ec4b68
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.fxc.hlsl) = 81ebc9bf9d4357f84f9501f3bf5f27a5dffafde8
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.glsl) = ddad08d1c2a2cc868aef11027dcb2be7f090e30f
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.dxc.hlsl) = 74b5722bd1987b018f7f5c721dcf01dca397ec8a
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.fxc.hlsl) = 054db691cda2a05cf641e341d460f93000e9f7f8
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.msl) = d5eccc4c534858c57240420234ecb50362eea1c8
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.msl) = 7b77b6f3091e0ffa5adeb60ead8370cdb4748c01
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.spvasm) = 92dca409fedabbfef876057f42c53b1e85ce1d45
+SHA1 (patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.wgsl) = 17c17c74e7d644a3b78fe2088c200d26d0cce50d
+SHA1 (patch-third__party_dawn_webgpu-cts_compat-expectations.txt) = 80a20bc6f8b3c54c145cb6fa58160267da6bbd78
+SHA1 (patch-third__party_dawn_webgpu-cts_expectations.txt) = 912bcd679c7837f4d6e017cf16fddef274535fc1
+SHA1 (patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts) = b1ef2668fb578770b926333f01bca31f94bc6440
+SHA1 (patch-third__party_electron__node_BUILD.gn) = 1c666d6618af401ba61234aff673d3e306780896
+SHA1 (patch-third__party_electron__node_common.gypi) = 830b7b2ae2b5c7b4a30f628db0b25d295321cf88
+SHA1 (patch-third__party_electron__node_configure.py) = 868c8bd809ecc8f73bb9e5f261b26fd8a9972a48
+SHA1 (patch-third__party_electron__node_deps_ada_BUILD.gn) = cd134f56fe95b0de934b38010d844eb2c9d70071
+SHA1 (patch-third__party_electron__node_deps_base64_unofficial.gni) = 65849b1241403f3b930036c78f9c1b732707a2f5
+SHA1 (patch-third__party_electron__node_deps_cares_BUILD.gn) = 49b0b4da7b129f54808449e520aefc9684fad80b
+SHA1 (patch-third__party_electron__node_deps_cares_include_ares__build.h) = 28adc24118153d9e38c34b8e08a4b5edb9ee2ca2
+SHA1 (patch-third__party_electron__node_deps_googletest_BUILD.gn) = 753fa1c7f55ee71854039d25ddbfe78f27f2c5d3
+SHA1 (patch-third__party_electron__node_deps_histogram_BUILD.gn) = 9c427f2e87d447aa9e91d40c5f5eb0312a23c246
+SHA1 (patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h) = aecb07b3a7f1f23151907f48e5fc81bdde00511f
+SHA1 (patch-third__party_electron__node_deps_llhttp_BUILD.gn) = daab4f1f20edf3a3b25f9390aa685777086824a4
+SHA1 (patch-third__party_electron__node_deps_nghttp2_BUILD.gn) = 1243e73189c724e381b6737b50b2a9654e5b7a7f
+SHA1 (patch-third__party_electron__node_deps_simdjson_BUILD.gn) = 445e3942f71eeca024e5c2e3c045af7160c17736
+SHA1 (patch-third__party_electron__node_deps_simdutf_BUILD.gn) = 0e1c70ae86647b0d423ea87ae5bcfc05a3960a01
+SHA1 (patch-third__party_electron__node_deps_uv_BUILD.gn) = f7b3a6cb43e4f3806156e042bf9d896ab5e10227
+SHA1 (patch-third__party_electron__node_deps_uv_docs_src_loop.rst) = 2eff20c5d160850506237fd8f7102f8835a6d34b
+SHA1 (patch-third__party_electron__node_deps_uv_include_uv.h) = 821477c1b9283eae2cee98249b939bff3ba7c29d
+SHA1 (patch-third__party_electron__node_deps_uv_include_uv_errno.h) = a892044172e4ec634f5747d9e03e716acca8d2f2
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_async.c) = fbcf87821fb9be02c96c8855eaa6fb5d1f7a9821
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_core.c) = 26b09e976ccdd7996338c2bbe5de1b6b4bd798fc
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_loop.c) = 7f102b80abea73c7ada4c74a166c56217cad042e
+SHA1 (patch-third__party_electron__node_deps_uv_src_unix_pipe.c) = 86bf75ae43b10a2da5416d466faf4b1cede659db
+SHA1 (patch-third__party_electron__node_deps_uv_src_uv-common.h) = 0d1e223534427f7fc3c5fa379dff7f02a0fd4281
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_core.c) = 20ffcfffd4daeb3be603522b7b30fa0b54695e95
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_process.c) = 37696817fb4ef4b7f581c8a99581a585ac3f79cb
+SHA1 (patch-third__party_electron__node_deps_uv_src_win_util.c) = 408d8e8078edb24b9186b52e516d80db82f4c2fb
+SHA1 (patch-third__party_electron__node_deps_uv_test_test-embed.c) = a1c52ee91f1895c5d2262734a4c6ebfdabfcd94f
+SHA1 (patch-third__party_electron__node_deps_uv_test_test-list.h) = 329a511cfd0ff170aba05c447484f5a729488ff1
+SHA1 (patch-third__party_electron__node_deps_uvwasi_BUILD.gn) = f9a327e6def09fe34947d12b3d25480b38ca5251
+SHA1 (patch-third__party_electron__node_lib_.eslintrc.yaml) = 2d1df53527d061013df14bb3894531c5948c7d37
+SHA1 (patch-third__party_electron__node_lib_child__process.js) = a75d0ccf0ea73c5e8ef990e580a50ddebbe74efa
+SHA1 (patch-third__party_electron__node_lib_internal_assert_utils.js) = aafb4750eb7d61d44c969e068119b175864c8d24
+SHA1 (patch-third__party_electron__node_lib_internal_bootstrap_node.js) = 3fd0f32f4101e8abc3430ba2ccdcf35f70f447b8
+SHA1 (patch-third__party_electron__node_lib_internal_constants.js) = 39c99c8fcef08d88bdb5fb0e4ef35d75c74e613e
+SHA1 (patch-third__party_electron__node_lib_internal_fs_watchers.js) = 358b40347b44d31c0f34afc03847fc2e88d876b5
+SHA1 (patch-third__party_electron__node_lib_internal_http.js) = af1cc70dde64412ac09fa3138d9ccbd278cd9cc6
+SHA1 (patch-third__party_electron__node_lib_internal_main_worker__thread.js) = 4f176695a775f14ad9aad6edbe4d0882ffaacd92
+SHA1 (patch-third__party_electron__node_lib_internal_modules_cjs_loader.js) = 530101ba22ec8fd6b787a2c940240d774d8ee778
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_get__format.js) = c2a167a92459a20cfeb40abd5b7e5d75225c81d7
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_load.js) = 7341f3e4207ecac42152d1c80d49bc6c65eda582
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_resolve.js) = abd078925f275bf799303dfa12ce633c895d3104
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_translators.js) = 808ec33f4131bcf76e5079828479ce01ace506d9
+SHA1 (patch-third__party_electron__node_lib_internal_modules_esm_utils.js) = 89fc7114a28ee307296bfd1978dc7ef6ba7d1d74
+SHA1 (patch-third__party_electron__node_lib_internal_modules_package__json__reader.js) = 4d70ca8b94d37402fd9a532690aa0d71b4199239
+SHA1 (patch-third__party_electron__node_lib_internal_modules_run__main.js) = c8781c48cfc30977f3eb3428f85ea3014034da6a
+SHA1 (patch-third__party_electron__node_lib_internal_process_pre__execution.js) = af2bbffb82b77f3ac7edb63e3931bb48fc8e4b44
+SHA1 (patch-third__party_electron__node_lib_internal_url.js) = 721f35b3e1fd79bb57469edc26b6885df7a151ca
+SHA1 (patch-third__party_electron__node_lib_internal_worker.js) = 72b5ac348faba352d93902723e3ca50f8f27a879
+SHA1 (patch-third__party_electron__node_src_api_environment.cc) = 94ca8a076560c36d6d7b5dfebed2d9faa3cd9205
+SHA1 (patch-third__party_electron__node_src_base__object-inl.h) = 13597292113944e95e383b407c3f06a65bfeecd0
+SHA1 (patch-third__party_electron__node_src_base__object.h) = a3e500d104a1e0c8d5f0ba1bc8754e3e81100551
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__cipher.cc) = b35e5a76a743dcb17541c03cb9b50e6091246b98
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__common.cc) = 04f7e2c0f29f7c3be501e472010bf28ff952e7a6
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__context.cc) = 999cec98fd81247d207bd59fb7a14e9bffefd747
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__dh.cc) = a7023a3cd09770b02efa4f91a6e48c000ba81286
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__dsa.cc) = e421483eb1e0195eaa145ece31fb9de355f42ff9
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__keys.cc) = c1be82dc59200156dc39126a0f96674d3fd14f33
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__random.cc) = 9901da3bb4fabda812e2dcc69416ab5ab59af974
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__rsa.cc) = 411ec8a90be99ca244f936869ee4715d597e4851
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__util.cc) = 92c0a098a1d1d18a975614e8852e7314d37a9aea
+SHA1 (patch-third__party_electron__node_src_crypto_crypto__util.h) = 39576f1cf77a7e87e363aaf2005ebd0e62333cd3
+SHA1 (patch-third__party_electron__node_src_env-inl.h) = 3a694aca4c947706476c35017ddff5aef5fefbf2
+SHA1 (patch-third__party_electron__node_src_env.cc) = 44c4595600d989a36b361d53d7825ab63605fdf3
+SHA1 (patch-third__party_electron__node_src_env.h) = 6167a77b6bca340f3008d3669766940903ddade7
+SHA1 (patch-third__party_electron__node_src_handle__wrap.cc) = 0e6e0ba2d5a00b49ab9c3e560b8a490ff0ad360e
+SHA1 (patch-third__party_electron__node_src_inspector_BUILD.gn) = 4c4425eeccc3ad8908a9d1dca38f0e40e74eab92
+SHA1 (patch-third__party_electron__node_src_module__wrap.cc) = c1870e665334e20bf3ae42cfae55e3cc414c5317
+SHA1 (patch-third__party_electron__node_src_module__wrap.h) = 198a1a09e11e8bb5b000805289db638c8b727ee9
+SHA1 (patch-third__party_electron__node_src_node.h) = 7a190e72a0ece4033a56cb7d34f909a4bf32d681
+SHA1 (patch-third__party_electron__node_src_node__binding.cc) = 61c72f106a9de900608a3fbf16fa8ea9e50734e1
+SHA1 (patch-third__party_electron__node_src_node__binding.h) = 7cd84234a1f3f15360d52bedb86b9d7a17313321
+SHA1 (patch-third__party_electron__node_src_node__buffer.h) = fa9196eceff8490dcd02cc3431f9188b1264b659
+SHA1 (patch-third__party_electron__node_src_node__builtins.cc) = fc4e271196abf64836b3538c2742ee4f175cc510
+SHA1 (patch-third__party_electron__node_src_node__builtins.h) = bfb09f1031f773cd42c8be2561b595a0ee332e8d
+SHA1 (patch-third__party_electron__node_src_node__constants.cc) = af00628e499569d2fcbccc72b5992b378de6a798
+SHA1 (patch-third__party_electron__node_src_node__contextify.cc) = 658800e6e195ad829077f53021fd89276311aef9
+SHA1 (patch-third__party_electron__node_src_node__contextify.h) = 56fe5d07484e8e71d0b439302238b34effbceec5
+SHA1 (patch-third__party_electron__node_src_node__env__var.cc) = d930dbd21eebb1c3d6c6530bb08f33778ec7ba83
+SHA1 (patch-third__party_electron__node_src_node__errors.cc) = 576627142d009c29ac9eb1ffcefe2e1661bb3fe1
+SHA1 (patch-third__party_electron__node_src_node__errors.h) = d07ed8adec19e48fa66fd6f1a2e1a716b4eb9e59
+SHA1 (patch-third__party_electron__node_src_node__external__reference.h) = b79827153f1541e6638dee358f13bdfa7d15956a
+SHA1 (patch-third__party_electron__node_src_node__file.cc) = f61a87f0c18ad7a8b5528d7b56d30c0ecea307d1
+SHA1 (patch-third__party_electron__node_src_node__file.h) = fc45aced264181480afb78402bbd9472022e61ce
+SHA1 (patch-third__party_electron__node_src_node__i18n.cc) = 72cc2e45e53777dde7f7b8ef8f50e3ff9cbc4a94
+SHA1 (patch-third__party_electron__node_src_node__internals.h) = fdebe6d3ee6cad69f11c2d07a5525e0e8be0ff33
+SHA1 (patch-third__party_electron__node_src_node__messaging.cc) = a761ed073b50ca7b9fe43c39b94d06e5bcda3d94
+SHA1 (patch-third__party_electron__node_src_node__metadata.h) = b9493eb23d52a3b59dea48c82435fb9b331723e4
+SHA1 (patch-third__party_electron__node_src_node__options.cc) = d2e200fdeaa4e2b781f6fd9117401a5476f462b8
+SHA1 (patch-third__party_electron__node_src_node__options.h) = bae749610e2373173fa60988e660c19d134e6ea5
+SHA1 (patch-third__party_electron__node_src_node__platform.cc) = 93ad6e3be0d39bd3d8b1e33dc835befe05fbf640
+SHA1 (patch-third__party_electron__node_src_node__platform.h) = 01e84b91494b01fe691be52d47d8958e75b5b42b
+SHA1 (patch-third__party_electron__node_src_node__process__object.cc) = 0739679a23b35f25e3e0632223f4651101e35a5e
+SHA1 (patch-third__party_electron__node_src_node__serdes.cc) = e581b32357cd1a44aa87041296185d7fb28d3b45
+SHA1 (patch-third__party_electron__node_src_node__trace__events.cc) = 79158fab8bc9ea735a88aecf8b1b3b9f730c9dae
+SHA1 (patch-third__party_electron__node_src_stream__base.cc) = ca9854fdee79bb4898a5dc2bb71ef6a9136f4bec
+SHA1 (patch-third__party_electron__node_src_stream__base.h) = d35d440d8b7629c360599483605b7ec3e0b2a22e
+SHA1 (patch-third__party_electron__node_src_tracing_agent.cc) = 410371e7606fda36a05abdd44d9d56a603cdb2de
+SHA1 (patch-third__party_electron__node_src_tracing_agent.h) = 35b2bfb97545e1e547d2a7fe39e0b8822477401e
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__buffer.cc) = c82cea0c9efe817be610012b92e62415eccbf1e7
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__writer.cc) = 20e7dd475e8d38e59f23be657e19239e01cfc6b9
+SHA1 (patch-third__party_electron__node_src_tracing_node__trace__writer.h) = da8509f7640241c9eb3f81f1b814e8912911d3b9
+SHA1 (patch-third__party_electron__node_src_tracing_trace__event.h) = d70525d6db3157a5780cb01905c788a3dc744977
+SHA1 (patch-third__party_electron__node_test_addons_cppgc-object_binding.cc) = 11745c5a8bbc3c62276483ba9cd96b35619b8edb
+SHA1 (patch-third__party_electron__node_test_cctest_test__cppgc.cc) = 3d160bf571b7c72981a42d59b82627f6c964e319
+SHA1 (patch-third__party_electron__node_test_cctest_test__environment.cc) = 4f169e086140cd874e26bb726920e451ab012ce7
+SHA1 (patch-third__party_electron__node_test_common_assertSnapshot.js) = 3c0dc5b0b2927206281b361d026f7c3084b6c2d3
+SHA1 (patch-third__party_electron__node_test_common_debugger.js) = 204f931ffc7c3d489fa6eb1058286e66de190c07
+SHA1 (patch-third__party_electron__node_test_common_globals.js) = 4ee4b58d12dd2e12ece0a836fbca62dc0b9a946a
+SHA1 (patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js) = 483c7b11b53a9c45825cb4275d45d3a2fa47ffd5
+SHA1 (patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js) = a719a3215522ed381f1bb7ac880ee66f86d4d6da
+SHA1 (patch-third__party_electron__node_test_parallel_parallel.status) = 5423c98e7f7e677338cbe068bd9704cee1c1e8f3
+SHA1 (patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js) = cf6557a5199d29242f90b2dbc9e58bd2e4fb3c02
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js) = b94e07f3e2fac52a7416ba9e52a49f6eac5296a7
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js) = b6bfcc1ee468e91f488f02b9ce25e1ac18ee1891
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-certificate.js) = cbf8a91c4442c21e08e8ec4618249d839a48d27c
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js) = eaadbf135393cd9b69555b27074c1774e47f027b
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js) = f0e7cd1678fb2bb87749782a956bfeb7a1576538
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-classes.js) = b0ac335361aebbd94f7ca48effa98e69e89de80a
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js) = 57df5e403efeb2273a6a3e9fa1709159e8e78e84
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js) = 372018cdb8f5eb6055e2dc1f2efc4457d54cdd50
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-dh.js) = 25cb6930d304b52590025d82f64b1f924da15a62
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js) = 187a403b1333fe0aeb7e772ea09b9e7efe10ed3f
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js) = 85bac8951df232d609345b5df93259e7cdbe56e2
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hash.js) = 4988558a5fd4eb0d48cb0df325403ff40a221651
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js) = 3bec04c4f608f2632718afd07adfc04ac11a7b18
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-padding.js) = fc25082d8b208f17a8b833d6ab9d0919cef6c1c5
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-private-decrypt-gh32240.js) = 76d49155f4f630e393e275d4a832111b4e78755b
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js) = 72e8c20b962ba67ba658059429370f50334b2493
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js) = 212b7be4b1ba9dd203ab7eb357ee463503d8bf2a
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js) = a328588397188ecf898b06d50ef3443652a54479
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-stream.js) = 69713f36de69868e52025f8a49c62d4c70a2c549
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto-x509.js) = 27296c6ad45bab024056c82fb8665ea8f9f2ef00
+SHA1 (patch-third__party_electron__node_test_parallel_test-crypto.js) = 1f61db14ada1527de95eee365468e70249aec51e
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-address.mjs) = c269e1aa8359c47e01a0d4df98dd45e54f857b9e
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-break.js) = aadf7a4dfb1da64fe48fb4b082f575443163a628
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js) = 9299fafbfb8f7baf655b311b579988fb6f46355e
+SHA1 (patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js) = de87f01f4a7e28ae0013e6235a5c644b67aca937
+SHA1 (patch-third__party_electron__node_test_parallel_test-fs-write.js) = ed4ef6558e2884180066e778a74710498e19d7b4
+SHA1 (patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js) = 111849cfcf0fb6efb6d4d660d78d237a88007651
+SHA1 (patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js) = 91056c4a4c4c1781c12c878eff33a77f5fd6dc21
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-console.mjs) = e10f4caca0d42182c79fd7edbab68e6e44d7240b
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs) = 81a9b84b4352e38f2ae91e8fc8c67964a2c5697a
+SHA1 (patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs) = ce11bec39413626cce1a35a2e27d5d0c3c74afb3
+SHA1 (patch-third__party_electron__node_test_parallel_test-tls-getcertificate-x509.js) = 53ba8a7982092b3881e05eced3b57099eb81a15a
+SHA1 (patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js) = 1331bdb3958b8c5e133127b3aea07ecc472e113c
+SHA1 (patch-third__party_electron__node_test_parallel_test-tls-write-error.js) = ff89d43e53a6e9593ed799182dad11fd259730d6
+SHA1 (patch-third__party_electron__node_test_parallel_test-v8-serdes.js) = b1fe98ed8a912d4563fbfc366b63424e78fa1675
+SHA1 (patch-third__party_electron__node_test_parallel_test-v8-stats.js) = 81e16ad8a1271d5f70cdf7f9134f195e39279a6e
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js) = b417e879c1ffc698fc332cbe0da99d65781f7c4c
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js) = c2ddcb18d722f324a0531c61dad4a5f34cceb68f
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js) = 3b35b6395c64ee62112064b31791077d798b576a
+SHA1 (patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js) = 9b093f89463d260e908c3a2f07eb1e0e8b3c692f
+SHA1 (patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js) = 71c00d0674cc65710048285f28d531a907b628fb
+SHA1 (patch-third__party_electron__node_test_parallel_test-x509-escaping.js) = 26e7920871224f7d41d958a77c76e2c6a1c2766e
+SHA1 (patch-third__party_electron__node_test_sequential_sequential.status) = baad32e0a060c7f90b75595a82cfc9cec1916a72
+SHA1 (patch-third__party_electron__node_test_sequential_test-debugger-pid.js) = 172bd3d214c1468a850f3ab6aa6ee1409ac4edd2
+SHA1 (patch-third__party_electron__node_test_wpt_status_streams.json) = 99dda809907d1424e9fb0eab11dfa3d781be52fc
+SHA1 (patch-third__party_electron__node_tools_install.py) = a72c7a5d0392e50126b27df7435eea4a0bab1368
+SHA1 (patch-third__party_electron__node_tools_js2c.cc) = 75e999dc15ebad06ccf9ac1f2a2a800adf1f0406
+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_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) = d197ab4be5666bf0cd0832ffe608e921aa6a84aa
+SHA1 (patch-third__party_ffmpeg_libavcodec_x86_cabac.h) = 4abafabeef360c3d694bb695764b45ae32caf008
+SHA1 (patch-third__party_ffmpeg_libavutil_cpu.c) = 4aa27fdc8b9354c044dc1b6743773fea1c3fa801
+SHA1 (patch-third__party_ffmpeg_libavutil_mem.c) = 40392084867817bab7dd27dea8f2ecbfaaafb394
+SHA1 (patch-third__party_ffmpeg_libavutil_random__seed.c) = 5f60528750bbb49032de9fe724694d9b7a8f3a30
+SHA1 (patch-third__party_ffmpeg_libavutil_x86_x86inc.asm) = b6923d4e25ad035019c4ceb7680b492497c3d625
+SHA1 (patch-third__party_fontconfig_include_config.h) = 20e20bf715c63d96d0a5b42121d83b1c8bc904ea
+SHA1 (patch-third__party_fontconfig_src_src_fccompat.c) = a1abd81c17029f15ac7ad3beb8a8f4d2b09db1fa
+SHA1 (patch-third__party_ipcz_src_reference__drivers_random.cc) = 9282fb0e9a0987ca7178035709ef3c1125fe5d00
+SHA1 (patch-third__party_ipcz_src_standalone_base_logging.cc) = b63036e38c6c1d8c337f420beb686cb1a547ae5e
+SHA1 (patch-third__party_leveldatabase_env__chromium.cc) = 00d9cb4aca86f9807befcb48510b289ade5cdb2a
+SHA1 (patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c) = fd0f12496edf58f01f40e7f9358b8c1b9d781c89
+SHA1 (patch-third__party_libc++_src_src_chrono.cpp) = 672d34eebe73af6d4a43026dd74276c91163b035
+SHA1 (patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp) = 689ed38698374f7a9e2080f73b8a6e66a3b9062b
+SHA1 (patch-third__party_libc++abi_src_src_cxa__guard__impl.h) = 858e75a0af9449636e5cc7c3745d1bd781b77981
+SHA1 (patch-third__party_libdrm_src_xf86drmMode.c) = c6d16b56d79987b48906f91bcf695455945de5a7
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h) = 26889557e088ff1c3cd58a068552d5107e8fc785
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h) = 964e3f56583a15d0140ecaf9ff2c5aed8cadf392
+SHA1 (patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h) = 8b1542e557d7260f6344f9c302f22ccde14c52fa
+SHA1 (patch-third__party_libsync_src_include_sync_sync.h) = f4c58f869dbf1b2046d4b539a32ad4938016826c
+SHA1 (patch-third__party_libsync_src_sync.c) = bdeabc3fc22a995947b3b31645edf0b4e6d81800
+SHA1 (patch-third__party_libusb_BUILD.gn) = ddd1563418b5f971536ed5dda3c7f7b15b00b915
+SHA1 (patch-third__party_libusb_src_libusb_core.c) = 66ef663b3a9212fc7fe8e918f3f06c17755c5420
+SHA1 (patch-third__party_libusb_src_libusb_os_threads__posix.c) = acd4a0ab01167870123e92e485cf23581fe9f822
+SHA1 (patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c) = 7e2c21f2a7a4cd65a00ac81337adf74239f67862
+SHA1 (patch-third__party_lzma__sdk_C_CpuArch.c) = 77f81c788c98bca6917a69e290fe6fdd109a952d
+SHA1 (patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc) = 9f104a1d99bea3bf6e9e9d82607a25475668a912
+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) = 6734cd8fb1bec469cfd701afc4fdd92fd941dceb
+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) = 186f1fbd8587082f1d4bc6298c519d3d8b9b63e3
+SHA1 (patch-third__party_nasm_config_config-linux.h) = 57cc1c2375e1aa2596b383996c7648f30c47323a
+SHA1 (patch-third__party_node_node.gni) = 555d7c19c8234bd6599ec9106cf3226845effb99
+SHA1 (patch-third__party_node_node.py) = e5777d0ef2077b4c5bae93fd5426e2aa5e1823ae
+SHA1 (patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp) = 630e471859f92dd7ae2f311078c71aecff578a4f
+SHA1 (patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp) = d80f67c38fc50ec7b96d9abd2a54ed1b785fefc7
+SHA1 (patch-third__party_pdfium_fxjs_fx__date__helpers.cpp) = dcc8cc0c674d2b6653c2aa2fa29a949675da6c10
+SHA1 (patch-third__party_pdfium_pdfium.gni) = 466fe00aee8ce250f6e909ca13b961c69023cb91
+SHA1 (patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp) = 3e893a8d299915b54c958a6893304ff079b99690
+SHA1 (patch-third__party_perfetto_include_perfetto_base_build__config.h) = 0f7ed937a1b2cc656adce9dfb7774ed85220fc96
+SHA1 (patch-third__party_perfetto_include_perfetto_base_thread__utils.h) = 8447ee500386886c3c390456995c396773ccbfc7
+SHA1 (patch-third__party_perfetto_include_perfetto_base_time.h) = 424d932cc62f445eee09927439ab4ac7de7e6d18
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h) = 6f258a1f8b75dc73dbd95181082e933e6f3457f6
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h) = 5c7873afa69afc921bcd4f5977a3c96b6d63ded9
+SHA1 (patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h) = 8d82d82fac73ba6a00915d86e81d1d7b2b3ecd88
+SHA1 (patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h) = 17465fc55287b902c31700a3196e0591358d164f
+SHA1 (patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto) = de4709f0f41582228962ad9d65d529288a694583
+SHA1 (patch-third__party_perfetto_src_base_event__fd.cc) = 0ce2cabfd2648c315eedd92cf776e35f7792e196
+SHA1 (patch-third__party_perfetto_src_base_periodic__task.cc) = 652b5e23db8a3ef788a4799308972d9e6c602990
+SHA1 (patch-third__party_perfetto_src_base_string__utils.cc) = 149750e3b1cef5fac6e7ccf1ed896085670254e4
+SHA1 (patch-third__party_perfetto_src_base_subprocess__posix.cc) = 5ef2d59577877cde5e9260eb0e5ed627afeab942
+SHA1 (patch-third__party_perfetto_src_base_test_vm__test__utils.cc) = 7df5203845acb273444c5efcc92d1fff0b50e0d2
+SHA1 (patch-third__party_perfetto_src_base_thread__task__runner.cc) = 7a13b618cd74c5baadf618ad57488e23fdea3087
+SHA1 (patch-third__party_perfetto_src_base_unix__socket.cc) = 032b3e554824094eddc94fda6aba3754e10517d5
+SHA1 (patch-third__party_perfetto_src_base_utils.cc) = e34bb290fefa9e5ac79eed19db6833985cd4a18b
+SHA1 (patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc) = 32a4cabf660f1af0365c43649f11e415d3201238
+SHA1 (patch-third__party_perfetto_src_tracing_core_clock__snapshots.cc) = b505537363303573cd6c8e8f11ad6624b340b481
+SHA1 (patch-third__party_perfetto_src_tracing_ipc_memfd.cc) = 6d34618a285e47b176d888a6b2d1767cdc78cdc4
+SHA1 (patch-third__party_perfetto_src_tracing_track.cc) = 6650b7ef23e263b3b60089040ec3d137a8b3b84f
+SHA1 (patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h) = 2bf1f054a551b5a8993d143dac9cd7b23111873a
+SHA1 (patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h) = 182bb2595e662b485897a9bebb4e638b2b92f85d
+SHA1 (patch-third__party_skia_src_ports_SkMemory__malloc.cpp) = e910086c0f5183e7f0b744e55160929aa4d541a7
+SHA1 (patch-third__party_skia_src_ports_SkOSFile__posix.cpp) = 63b0a29686e72779f3e29261126839a15ad7dc7c
+SHA1 (patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.cpp) = 050757efeaaceda81015b56ccd61f90acabf3f4e
+SHA1 (patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.h) = 5f1faf7e8d84a0f1991161ffc11c035629183df4
+SHA1 (patch-third__party_skia_tests_RasterPipelineCodeGeneratorTest.cpp) = f4ec1389ae307f98bb32ca74c55ae5c67d4210f5
+SHA1 (patch-third__party_speech-dispatcher_libspeechd__version.h) = 4b82edc0a64df39d9b292fa16c4740c7e1504a2d
+SHA1 (patch-third__party_speech-dispatcher_speechd__types.h) = 8dcb09bff2fd495c522c475346b99bcc6e73442a
+SHA1 (patch-third__party_sqlite_BUILD.gn) = 113ae241a3db0642212390c074a138b2051e627b
+SHA1 (patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c) = 264fe0c876fdb387a2416ec24c6b42843fe0417d
+SHA1 (patch-third__party_sqlite_src_amalgamation_sqlite3.c) = 06687f84f5a40754b7bec1aad74ebe4aa9ea85c6
+SHA1 (patch-third__party_squirrel.mac_.gitignore) = 9b29afef8fd9810377ad0ee4c9a9574c21f3b35a
+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) = 7c4a9807192c9d341abfa33801441fb559c81adf
+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) = c46346f536a097ee3fc9b480b311a85572b13d3d
+SHA1 (patch-third__party_swiftshader_src_System_Configurator.cpp) = 239682f3c3f8c81c91c6efc889ca55683a054fd4
+SHA1 (patch-third__party_swiftshader_src_System_Linux_MemFd.cpp) = dacadaf888106c581a209151e0c39ce985534a31
+SHA1 (patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp) = 0bcea6e3f53fd13751e59c5f80e4016ba763a1b6
+SHA1 (patch-third__party_swiftshader_src_WSI_libXCB.cpp) = cdd2eac50d4b2ac30da80c060b099d1fbd756613
+SHA1 (patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h) = 957607f1b835c85bcc59080141356e968b1f212e
+SHA1 (patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h) = c00843a63c5d4d6d258405cd4f1eb2023efc3108
+SHA1 (patch-third__party_swiftshader_third__party_marl_src_memory.cpp) = 66a25eb71c7bb683ea676d62e65a9568e6fbc3f9
+SHA1 (patch-third__party_swiftshader_third__party_marl_src_thread.cpp) = f429ca612ecd4f28511e7f56a6e7ac7bfca98b73
+SHA1 (patch-third__party_test__fonts_fontconfig_BUILD.gn) = a5c342483e838ef7bccac37cec1a17b3f44945d9
+SHA1 (patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc) = 31f6fea2cdd7d961f5fd03a9b7cced2b920caf68
+SHA1 (patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc) = 4ae16b341ca79de2ee890e3d26e3906aefe9ee14
+SHA1 (patch-third__party_tflite_features.gni) = 14f9f37e24b5af8495c50d32d92a2b5e3c72e9d0
+SHA1 (patch-third__party_unrar_src_crypt.cpp) = ad2ba79fca394dbee5f62ce2556f72cf5c153840
+SHA1 (patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h) = aa4111fa1d36d0c94da44d40c96bbb34a3e7c35f
+SHA1 (patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp) = 9af7252144cbbca4f984568445294fca0afce678
+SHA1 (patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h) = 8856e200f8854743724edf27ff1fa45aca7688fe
+SHA1 (patch-third__party_wayland_BUILD.gn) = 0eff1699f32bcefb89705b84add1154a34b87df7
+SHA1 (patch-third__party_wayland_include_config.h) = 5b5690973dfb305ece9e4b2cd64c880fe37c9ef6
+SHA1 (patch-third__party_webrtc_BUILD.gn) = 06a8c7657ce72ab3f99aaa1809292ee93e23203d
+SHA1 (patch-third__party_webrtc_modules_audio__device_BUILD.gn) = c4b686e72e5710cf4baa6b53cc0652504da2a947
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc) = fdc01aa8a3e6195069b68103599938eb01e79a0b
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc) = fe2b25b682aee1cf7d71ae2eee663b83752f0351
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc) = add01bee743c10392108ac05aa94a8e6f39d4d18
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc) = 09f983b2da64284dc38199114cbf00b7ca6e79ab
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc) = 81e42483308a769bbf19a86d9689817b5d0e34ba
+SHA1 (patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc) = d1ddf092c1b8214a6a9b3b2b09aeaa501d8e2d83
+SHA1 (patch-third__party_webrtc_rtc__base_byte__order.h) = 74872e6cc4646133c133add4d1982581fc6d9b5e
+SHA1 (patch-third__party_webrtc_rtc__base_ip__address.cc) = ce60935078e4f53bbc195e50b3ce43fbd11903c0
+SHA1 (patch-third__party_webrtc_rtc__base_net__test__helpers.cc) = edbdd0fa34251915125d632fbd4bd048b9ae4325
+SHA1 (patch-third__party_webrtc_rtc__base_network.cc) = 1c6165c02de20d4431971329fe0363b2a1d6fbd4
+SHA1 (patch-third__party_webrtc_rtc__base_physical__socket__server.cc) = 8c05ec8e961f6ee7eca48fe86fd74448df4decb4
+SHA1 (patch-third__party_webrtc_rtc__base_physical__socket__server.h) = ef82ddee6a3fda7643c10feedb0310bf15260c1f
+SHA1 (patch-third__party_webrtc_rtc__base_platform__thread__types.cc) = c93cd7004115fc59d680f8b0e60c1303c34d6e60
+SHA1 (patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h) = 4c9f549a3c9fa471bd2571669f54653c837acbe8
+SHA1 (patch-third__party_webrtc_system__wrappers_BUILD.gn) = 71b6d504fb882a1e3b478d8fa50c3fabaf1fa67b
+SHA1 (patch-third__party_widevine_cdm_widevine.gni) = e0411a215cc2f843444c97b8ee12e840ffe79415
+SHA1 (patch-third__party_zlib_BUILD.gn) = d76ae6c3728f3fd8d1eabc5e78dba94dfb41d077
+SHA1 (patch-third__party_zlib_cpu__features.c) = c3a2e467a8e5877c91e884f275a48c8a9ecc0f39
+SHA1 (patch-tools_clang_scripts_update.py) = eec58eb80d08cc90437eea405ef0059e9f178f4a
+SHA1 (patch-tools_generate__shim__headers_generate__shim__headers.py) = 2717a709f78e23f069d297198448d51519f48493
+SHA1 (patch-tools_generate__stubs_rules.gni) = 9366b04a9364eda48fa31558a91503f99bc269cf
+SHA1 (patch-tools_gn_build_build__linux.ninja.template) = aa2c11087b0cb83a14478e70daa1306791bde1fd
+SHA1 (patch-tools_gn_build_gen.py) = af9da9fea6203bf9eb0281562da6be8654f93bb0
+SHA1 (patch-tools_gn_src_base_files_file__posix.cc) = 9a122017b8bdf184d3f8f4b3c5a20358ee9696ef
+SHA1 (patch-tools_gn_src_gn_version.h) = c31e5763212ae6a757622b7b312787c1b5162b57
+SHA1 (patch-tools_gn_src_util_exe__path.cc) = 48db446e838ff3a7c722ee97c5aee1a2e717ff96
+SHA1 (patch-tools_grit_grit_node_base.py) = 53f08e0110c44f0bb3e49d07c2a6e721a9bc69fb
+SHA1 (patch-tools_gritsettings_resource__ids.spec) = b4759189f274bb651ff3868cb19f596be29adee4
+SHA1 (patch-tools_json__schema__compiler_cpp__bundle__generator.py) = 49383041bc717a799517f9c3c939bc61d57304d1
+SHA1 (patch-tools_json__schema__compiler_feature__compiler.py) = 4035251c207441814914c406f1138bdbd751272e
+SHA1 (patch-tools_licenses_licenses.py) = 97fa15b5cde1854509162690ccc2c83cda749c16
+SHA1 (patch-tools_memory_partition__allocator_inspect__utils.h) = 6b9db4de9320798601efb05f4191db10210ebb75
+SHA1 (patch-tools_perf_chrome__telemetry__build_BUILD.gn) = c84750f97bde0f12c2cce20b8b1f713d1d9b8fbf
+SHA1 (patch-tools_protoc__wrapper_protoc__wrapper.py) = a6429fab66368d24038cec3690d9f255ecd0b83f
+SHA1 (patch-tools_v8__context__snapshot_BUILD.gn) = 75607b4fb5b622a207118d71029135283cc87e00
+SHA1 (patch-tools_variations_fieldtrial__to__struct.py) = befb939eff27acfc89622645367f1059b66b5fe2
+SHA1 (patch-ui_accelerated__widget__mac_BUILD.gn) = 39c32d1cbfadb3aa68395f0bbad1a6851c1eeed2
+SHA1 (patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h) = 3cc8a34086d176236c8954c214806870e96b3e46
+SHA1 (patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm) = 49142cda0c00edae6eb490b83688b4306ebab692
+SHA1 (patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm) = 445399dba2ffce94ca0a10074f7b53ae2049f03f
+SHA1 (patch-ui_accessibility_platform_BUILD.gn) = 1f2f4d555692e96232a1b5f127a0e26a3f53ed50
+SHA1 (patch-ui_accessibility_platform_inspect_ax__transform__mac.mm) = 50638af1fa93ad50ed385a9b026c401d629b65ac
+SHA1 (patch-ui_aura_client_drag__drop__client.h) = a5774a50a5deda2661618c01e333267379ac72ea
+SHA1 (patch-ui_aura_screen__ozone.cc) = 6332e0440aa77154dc3f79de05cac10b5a534bf8
+SHA1 (patch-ui_aura_screen__ozone.h) = 8431c4e3194f25c2c754fcbdb7ccde78e214c1b5
+SHA1 (patch-ui_base_BUILD.gn) = 847fb475a1ac285d0e4696405b2f72a0b6d74860
+SHA1 (patch-ui_base_accelerators_accelerator.cc) = a335985166bf2a0b1dc2aa206cd970c1c2364270
+SHA1 (patch-ui_base_accelerators_accelerator.h) = a5b715f67169991222bd886efc33ffee70b9f550
+SHA1 (patch-ui_base_accelerators_accelerator__unittest.cc) = 4c078abfc1d0fc370f8ea27774032c7f4466d0f7
+SHA1 (patch-ui_base_accelerators_media__keys__listener.cc) = a711574a2a0eaee3fbcad66ac3380cbad08a5764
+SHA1 (patch-ui_base_accelerators_media__keys__listener__mac.mm) = 8c4c92fe17475f06bcc1d5dcbc5dc77e81f4d8fa
+SHA1 (patch-ui_base_clipboard_clipboard__constants.cc) = 15ddf96d3adfaa68722f1ea21693e874938d5598
+SHA1 (patch-ui_base_clipboard_clipboard__constants.h) = e817cc34954d21eaed495d9d3cfd37925ad5b500
+SHA1 (patch-ui_base_clipboard_clipboard__non__backed.cc) = 4a4c7749836d90ab6a4a25d6d40cd5c845c3d04b
+SHA1 (patch-ui_base_clipboard_scoped__clipboard__writer.cc) = b9f99aec672922f2a94b1aae34df01cb162f8f9a
+SHA1 (patch-ui_base_clipboard_scoped__clipboard__writer.h) = e24e807c72b1b2ef6667fbd3067568ead5cdcea7
+SHA1 (patch-ui_base_cocoa_remote__accessibility__api.h) = 77c2ef864ed0bea4149cac260d225ba6fb61ebef
+SHA1 (patch-ui_base_cocoa_remote__layer__api.h) = cf8e3b400ea3497078a7cb54120a94ebc4549625
+SHA1 (patch-ui_base_cocoa_remote__layer__api.mm) = 48af603f04945fa3089e1bc7514388511a16e8f4
+SHA1 (patch-ui_base_cursor_cursor__factory.cc) = 322d1aec95f83e11ca1cedc5b145fda4b5cf2192
+SHA1 (patch-ui_base_cursor_cursor__factory.h) = 4f1e99926ef440a2a112cd0c437535a15e4fc1d9
+SHA1 (patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc) = 8932a3087ce6ad283a70e2d4138c904e9a62d978
+SHA1 (patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc) = 4b059fcc8c5ee4fe821d0c3a81a2cca8801ef27d
+SHA1 (patch-ui_base_ime_dummy__text__input__client.cc) = a301a3af98bbf3f916a90e80d517f870e0194856
+SHA1 (patch-ui_base_ime_dummy__text__input__client.h) = ddec332d1dcfcfc797215d5d55cee338b1ec40df
+SHA1 (patch-ui_base_ime_fake__text__input__client.cc) = 4d1a16d60d73a2f665941599e1d1570f691b5f98
+SHA1 (patch-ui_base_ime_fake__text__input__client.h) = 2ab55244fb31d4637a6c1087f9ebd4b0ee7339da
+SHA1 (patch-ui_base_ime_init_input__method__initializer.cc) = d0b175f61598a43fc85a12c16c9574e1f26bafbc
+SHA1 (patch-ui_base_ime_linux_linux__input__method__context__factory.cc) = 1b973d5730350ff790986ec461ad7db5e210232e
+SHA1 (patch-ui_base_ime_text__input__client.h) = 341a2ca8f2a58b42b0456033dce2150a479a86bf
+SHA1 (patch-ui_base_models_simple__menu__model.cc) = e8da7ef9e88e41d84725f4592a331ef49292ba7f
+SHA1 (patch-ui_base_models_simple__menu__model.h) = c20b3539e588e5eb363bc4cd1f96d2284ee38b41
+SHA1 (patch-ui_base_resource_resource__bundle.cc) = 8444e000801d5055e3f981d05c6ffca34f66a58f
+SHA1 (patch-ui_base_test_skia__gold__pixel__diff.cc) = 9a4ff2f8e015d77f3b70714c5d4395f4a1d6cc93
+SHA1 (patch-ui_base_test_ui__controls.h) = 0cfe7f3df99a9f53b2c80be72aee3951b3e66100
+SHA1 (patch-ui_base_ui__base__features.cc) = 72d7a6aaac874ac109d689d5f1079af64f778785
+SHA1 (patch-ui_base_ui__base__features.h) = 10787984ac186073fe9cf2d56db6672990f19636
+SHA1 (patch-ui_base_ui__base__switches.cc) = 1a89c4b8d213bada01c251c5a5262e785480015f
+SHA1 (patch-ui_base_ui__base__switches.h) = b39027719da6f5db8b99ed272188f97af423c396
+SHA1 (patch-ui_base_webui_web__ui__util.cc) = 7da66a435b08e4df33bc7dc850fccf4b1402f807
+SHA1 (patch-ui_base_x_x11__cursor__factory.cc) = 289a689c2f7d5ccf67f1b59127905b2988ecc6a4
+SHA1 (patch-ui_base_x_x11__cursor__factory.h) = aa4ef7dd7d6d89fc17d64dcf98fcb050823364fc
+SHA1 (patch-ui_base_x_x11__cursor__loader.cc) = fd8c1921ce4aa561e3a6888640e246c8e46403cc
+SHA1 (patch-ui_base_x_x11__display__manager.cc) = a7fbd2749cb69f03e8a295a8d5f8b64c5728f55a
+SHA1 (patch-ui_base_x_x11__global__shortcut__listener.cc) = d5d8b0d8491619a0e9981382092458767d8e31aa
+SHA1 (patch-ui_base_x_x11__global__shortcut__listener.h) = 3a085d4f9c5a0e1dc4110b053a420edbb4011cee
+SHA1 (patch-ui_base_x_x11__shm__image__pool.cc) = f58277d3dd827093771ff1bede1167b521e91829
+SHA1 (patch-ui_color_color__id.h) = 3465d7acdf85cb21f7f5334bfd02eccae3c0e843
+SHA1 (patch-ui_color_color__provider__utils.cc) = 31b11a4935ab6d6a62b357e3b393ac71c3de54b5
+SHA1 (patch-ui_color_system__theme.h) = d9a5331ba244b8578a16f70fa02154be01effa42
+SHA1 (patch-ui_color_ui__color__mixer.cc) = 53871cdd1269637cd02f821e15de6fb1bc4a475c
+SHA1 (patch-ui_color_win_native__color__mixers__win.cc) = 98ac13d20b6e2ef727101cd95d80a6cd4c64ddad
+SHA1 (patch-ui_compositor_compositor.cc) = b12c7c5a78ea609a95431d415b7ffc9214cf3de6
+SHA1 (patch-ui_compositor_compositor.h) = f602df41b861e27951117b9d554301fc28a38c75
+SHA1 (patch-ui_compositor_compositor__observer.h) = 9f3f843cdfdbc9ab2ded9a561806e96c1b7efde6
+SHA1 (patch-ui_display_BUILD.gn) = 6345940d26e20552f7eb8c9aa4983ba24a2ffea4
+SHA1 (patch-ui_display_mac_screen__mac.mm) = 6dd851d34c3709981387b4df8cc7cc0930893524
+SHA1 (patch-ui_display_screen.cc) = 810bbbcce1e65309696fff069170deea368b8284
+SHA1 (patch-ui_display_screen.h) = 576a10e0d9f8432d9ba1c5c7482d681fc9ec1ad0
+SHA1 (patch-ui_events_devices_x11_device__data__manager__x11.cc) = 7af6471ac597f6a90ef76ae2e3624111ecd43738
+SHA1 (patch-ui_events_event.cc) = e0d2f8c5982e1ac73309a8056e74b6400debae99
+SHA1 (patch-ui_events_event__switches.cc) = 39e0427203f441bca2bf743210e806ee975fbcab
+SHA1 (patch-ui_events_event__switches.h) = b1c09a0c4297d9d4ff2a863105baaa0f5806e4be
+SHA1 (patch-ui_events_keycodes_dom_keycode__converter.cc) = e386b74708fa490cd3d11af8d7ade6f06691b4a6
+SHA1 (patch-ui_events_keycodes_dom_keycode__converter.h) = 7f378007cb2e8dffd09cbc08139d4449d42483d9
+SHA1 (patch-ui_events_x_events__x__utils.cc) = 335fa510c959e756ba1ce505c5d617af9d7546ba
+SHA1 (patch-ui_gfx_BUILD.gn) = 0394a9f3b05c304bb91aea994b56eeb05f6ca301
+SHA1 (patch-ui_gfx_ca__layer__params.h) = 298a8ff469e56df555f0abf44bb80d207d7bdf45
+SHA1 (patch-ui_gfx_canvas__skia.cc) = 4a959587c0ebc4a045e3dc42fb39ef8883ab7a78
+SHA1 (patch-ui_gfx_font__fallback__linux.cc) = f3d7ccbbf8de9793bc3745f00bb9b752b59766f0
+SHA1 (patch-ui_gfx_font__render__params.h) = c83f17187fa962457b0b0c971f7fd08c0a2b8fe6
+SHA1 (patch-ui_gfx_font__render__params__linux.cc) = 9d25cddce3778ff46e084e86d55115f1bf7f451c
+SHA1 (patch-ui_gfx_font__util.cc) = b93d8d31f3e4072104903a3bcbfadd451f1bb8a4
+SHA1 (patch-ui_gfx_gpu__memory__buffer.cc) = fe545dfb0b53a8955e925847e10456dd3e2bc2c3
+SHA1 (patch-ui_gfx_gpu__memory__buffer.h) = bda96698bbe0fc7529d7925840d6a0a8fe165d34
+SHA1 (patch-ui_gfx_linux_dmabuf__uapi.h) = da9c4db6cba9e8dda21435957d2438b954c5ccba
+SHA1 (patch-ui_gfx_linux_gbm__wrapper.cc) = 556ec03c245200b4de6437a33ad5a80c7f34a5fd
+SHA1 (patch-ui_gfx_mojom_buffer__types__mojom__traits.cc) = 07defaa5b4b5f8ef3022be8c1a732e8331d10e73
+SHA1 (patch-ui_gfx_mojom_ca__layer__params.mojom) = f022329daac9ea6278ab52051204db3fa93f1dfd
+SHA1 (patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc) = 25ea5b94cd530071466a08def1bb39642f2f5cd4
+SHA1 (patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h) = 57c0502fd2fd39c134b9a091ff8c3be3a5f7f957
+SHA1 (patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc) = cddbe4067e04d7532e689105b2233de96a4c8608
+SHA1 (patch-ui_gfx_mojom_native__handle__types__mojom__traits.h) = 5437f475a48f2d15fa326749042e5c330d02fd15
+SHA1 (patch-ui_gfx_native__pixmap__handle.cc) = 41e4259dc6041b5b640639aaab2edb3546269641
+SHA1 (patch-ui_gfx_native__pixmap__handle.h) = eeb024398df279fc30629ec6947f596b5b531fb4
+SHA1 (patch-ui_gfx_native__widget__types.h) = f1b8c7a58cb100d312bbbdd0858031ec1fed5d5b
+SHA1 (patch-ui_gfx_platform__font__mac.mm) = 983fab1c5f676a19b326d0e9c443a417a824ed31
+SHA1 (patch-ui_gfx_platform__font__skia.cc) = fbc6179bf8427fff95827635919f539073587e28
+SHA1 (patch-ui_gfx_render__text__api__fuzzer.cc) = ee4310cb59671aacb8789416261ee02724f2981d
+SHA1 (patch-ui_gfx_render__text__fuzzer.cc) = 3867ecb6165fe82889b5fd49d6f42ca91851e3a2
+SHA1 (patch-ui_gfx_switches.cc) = 3bea2fa01c82677d54908177d538d5e3ea17b30f
+SHA1 (patch-ui_gfx_switches.h) = 4e0857c0ec7d48df77a8456dc5f3bc215cd72b9f
+SHA1 (patch-ui_gfx_x_generated__protos_dri3.cc) = 9cb93b255e3ea0b7f4888df89f7763d4f8e072b5
+SHA1 (patch-ui_gfx_x_generated__protos_shm.cc) = 1357f2f627c1d0d5d03d2dd2999ec63b28b6569c
+SHA1 (patch-ui_gfx_x_xlib__support.cc) = b0add691b2e4b1fe3e335351732fd0b97ac947ab
+SHA1 (patch-ui_gl_BUILD.gn) = fd0ef34d3c1e4fbc8a89f8901b2fe5dfef10a84f
+SHA1 (patch-ui_gl_gl__context.cc) = 4fc3a26108879c184c8f656eb5fe629292a5f4a1
+SHA1 (patch-ui_gl_gl__fence.cc) = b8672433954fe957f85fe4c003e642141aba3fc7
+SHA1 (patch-ui_gl_gl__implementation.cc) = e77950261c20aae5582a25c0db5f159ec3ea085e
+SHA1 (patch-ui_gl_gl__switches.cc) = cfa0ab88e14bb5a34901af198df63c7d7faefc8d
+SHA1 (patch-ui_gl_sync__control__vsync__provider.cc) = 5fb1f6fc3a2e6e68ddabac9a7948707ce1772fc2
+SHA1 (patch-ui_gl_sync__control__vsync__provider.h) = 8f8ec0d958a0cd6bf8152625ba213e3fa761c5cb
+SHA1 (patch-ui_gtk_gtk__compat.cc) = dd73bd59de324e8f879053d9f085761530fe8ee0
+SHA1 (patch-ui_gtk_gtk__compat.h) = a65baa56f39b4b411d84f69ef62c28579b83d497
+SHA1 (patch-ui_gtk_gtk__ui.cc) = 50218d3248c8f3f7b06a74ddaeee573a19f118ee
+SHA1 (patch-ui_gtk_gtk__ui.h) = 65a106f037916905521205ddc0c964cc545c76b5
+SHA1 (patch-ui_gtk_gtk__util.cc) = fe44dec44cf354141e4d3f550de483e9a5d09350
+SHA1 (patch-ui_gtk_printing_print__dialog__gtk.cc) = 694d22874571bdb92b4e073f1c403958421439da
+SHA1 (patch-ui_gtk_select__file__dialog__linux__gtk.cc) = dce30183aab105f52ae22374281cefb8ef02c8f5
+SHA1 (patch-ui_gtk_window__frame__provider__gtk.cc) = d77a6a56f21695b80f384fb0383d3762ce6bbde1
+SHA1 (patch-ui_gtk_window__frame__provider__gtk.h) = 0e6d52ec4fb18e1d0996924d53e1da84a4ebb52a
+SHA1 (patch-ui_linux_fallback__linux__ui.cc) = 90c5de13243f71a388783bc5748739fc2d48baf1
+SHA1 (patch-ui_linux_fallback__linux__ui.h) = 33d52eab9c56e07ae604b66f1d9fc35698b4229f
+SHA1 (patch-ui_linux_linux__ui.h) = 68e156d69e843f9bf279d8f01499b4d0237e9025
+SHA1 (patch-ui_message__center_views_message__popup__view.cc) = dc2a53905459aa22dbe7ad2157a61da62fd87c27
+SHA1 (patch-ui_native__theme_native__theme.cc) = 1b56288b246322ca8ce149365f80edb4a41e0227
+SHA1 (patch-ui_native__theme_native__theme.h) = d6c7c2a946fe35dbb50d47a1575c0e338922a7ee
+SHA1 (patch-ui_native__theme_native__theme__base.cc) = d962c9a38b46b062fad533c0746ef2375365d930
+SHA1 (patch-ui_native__theme_native__theme__features.cc) = 416aa4525938be440ad4dd86c8cfdbc2c07abb4f
+SHA1 (patch-ui_native__theme_native__theme__win.cc) = e218484427e0126ee7cccb668f30d470a5c0b60f
+SHA1 (patch-ui_ozone_common_egl__util.cc) = 12fdc5474b561b0f6795aa8168ca18a9eed3b79f
+SHA1 (patch-ui_ozone_common_features.cc) = a3e9c2bd23f8f24163eaa7f76d3af32f75b2fbb4
+SHA1 (patch-ui_ozone_platform_headless_headless__surface__factory.cc) = d0c3ae4f387977fdb6fed4e08452fa82bbc7b530
+SHA1 (patch-ui_ozone_platform_headless_ozone__platform__headless.cc) = 48566108602fc5808347b835fb462835c63dc856
+SHA1 (patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc) = 40a83376371fe21d5040ad2a532ca821da733241
+SHA1 (patch-ui_ozone_platform_wayland_common_wayland__util.cc) = d632e0ef14bbee099aadef27988d7da9d235328c
+SHA1 (patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc) = 236fb198032da14b63e99554be77d8f164126821
+SHA1 (patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h) = ea0f8c6f0a330c88bce9f35adb695e878f476ef3
+SHA1 (patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc) = 17535b7c6680345f262c0439af384c26e5c499d4
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__connection.cc) = cdc32c0c21cc94f8121a2108cf7e4bbc01daeb8c
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.cc) = f4dad56b63c556ce0b536b3e11b3f6631298bd7e
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.h) = 6aff56383bf89a08e4098e236875ef5d4ababa7a
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc) = 2b7384f3646766eacd1e240487d950674925b163
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__popup.cc) = 10004c077fdd6f1774c65d3c00023fa71880ea81
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc) = e0673405bfb65b549b6296ba21909f416437b099
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h) = 0b12466e25a0c6f392b690d2b4f94a4a6e975714
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__window.cc) = 4f3c1820ef26d658ab48dfb5f9e0942a449b210f
+SHA1 (patch-ui_ozone_platform_wayland_host_wayland__window.h) = 1b56e1e5624cffc135cb9a72f6bf74db8dfadc1b
+SHA1 (patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__impl.cc) = b9b11a6cdb6af28382a8aef419327a814d42f6e6
+SHA1 (patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc) = f59cfd71df848de544afdbd0375231ef03ee3bb1
+SHA1 (patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc) = ee40ddc9a3480b987a0413f90c089c32c2aa2611
+SHA1 (patch-ui_ozone_platform_x11_BUILD.gn) = a5209b7f175bebd82889f2fbe5eec086db750b6f
+SHA1 (patch-ui_ozone_platform_x11_ozone__platform__x11.cc) = 3313a02c7c732dc481b458ff71ed8110a27cfe92
+SHA1 (patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc) = 795975a4a190e5ed5145c0a8ae4716754971edfc
+SHA1 (patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc) = 4d24681847b6b9494328e20bce208cf01b84b493
+SHA1 (patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h) = c0e37f985a5b922620698718c996bcfe6ebe42cb
+SHA1 (patch-ui_ozone_platform_x11_x11__screen__ozone.cc) = 8fbd06070dc0fae8e050b8ac3f368ec8316e7685
+SHA1 (patch-ui_ozone_platform_x11_x11__screen__ozone.h) = 30174d112e9d1fd534bc412a2f691f1ffce5f695
+SHA1 (patch-ui_ozone_platform_x11_x11__window.cc) = b6a56fe12dc7e77693d33283a465faf9fc6b2d11
+SHA1 (patch-ui_ozone_public_ozone__platform.h) = 2dff79b0ba451e16916cdb5dd5740a409d0bf54e
+SHA1 (patch-ui_ozone_public_platform__global__shortcut__listener.h) = 2e65492a315fdde2d0b9bc7f1575ae5b8c3e926e
+SHA1 (patch-ui_ozone_test_mock__platform__window__delegate.h) = 89470102b6a676fba51ef83f0e8dcd4e441e8811
+SHA1 (patch-ui_platform__window_platform__window__delegate.cc) = a291631678526e50a24c6f3e6b24d7bad021ee5c
+SHA1 (patch-ui_platform__window_platform__window__delegate.h) = e3fb3acbefe10850d05210bf9547ef3ff35195ad
+SHA1 (patch-ui_platform__window_platform__window__init__properties.h) = 4a3183975f5a6e33ba8aebc669811bd287c00920
+SHA1 (patch-ui_qt_BUILD.gn) = f59c339c9e6b5a8bddd9d50e67d6be997a64ea9c
+SHA1 (patch-ui_qt_qt.gni) = 2c0f32ce056ed7dbbe758f8068a98acfa0c089b3
+SHA1 (patch-ui_shell__dialogs_select__file__dialog.h) = e93aa0883d696b005928ff8f5366f7a963f6ec78
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux.cc) = 6453ec94e1902c587257211fe83724720ce53d87
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux.h) = ceed5d2451b0602a8f27aea15f63a9808a84ab0d
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc) = d21b6ed1cf7d23810a79c626ae9bdbd305423017
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc) = 6c7c05f8e234527d2112027916e59fc7831d77d9
+SHA1 (patch-ui_shell__dialogs_select__file__dialog__linux__portal.h) = cd97209f41656e94e8532344f291a9be929fbef7
+SHA1 (patch-ui_strings_translations_app__locale__settings__bn.xtb) = 2ad59e40710695addb5fb73d2cc2469b0f35b4a2
+SHA1 (patch-ui_strings_translations_app__locale__settings__ja.xtb) = e62d0723eab456aef241bc7cd3d5e1b0c8916134
+SHA1 (patch-ui_strings_translations_app__locale__settings__ko.xtb) = 9d56bb46ead5ae3a810ba8c1bd7617c3cb4a6526
+SHA1 (patch-ui_strings_translations_app__locale__settings__ml.xtb) = 9b6ce98d9e1b6877e79f17556d2a4f50d4b11f03
+SHA1 (patch-ui_strings_translations_app__locale__settings__th.xtb) = 21bc306ae272107d626e94629493fd12669b3fa5
+SHA1 (patch-ui_strings_translations_app__locale__settings__zh-CN.xtb) = abd633cc6a6620acb8f2c7c000718e90ce02e06a
+SHA1 (patch-ui_strings_translations_app__locale__settings__zh-TW.xtb) = dc1b3026f01b348c4a6fb3dbb023ce30fb148f19
+SHA1 (patch-ui_strings_ui__strings.grd) = 35f53a3e4c4d78a0fd51a5a9e97e1421582e4587
+SHA1 (patch-ui_views_BUILD.gn) = 8c65852ebc76ae41fd2b90508a2542cf95e9fd3e
+SHA1 (patch-ui_views_cocoa_native__widget__mac__ns__window__host.h) = 334ba7af81fadc904f9695a3e77e7d0499c235e0
+SHA1 (patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm) = bf4f8a1723ab27d5a789d4c4ecf04943b07544dc
+SHA1 (patch-ui_views_controls_menu_menu__controller.cc) = 26af9d711a98fcf43c74e6ec60c6e31404fe8809
+SHA1 (patch-ui_views_controls_menu_menu__controller.h) = 43ef49e219ca2c666a37c1859c79e52e0602f44b
+SHA1 (patch-ui_views_controls_menu_menu__runner.cc) = 118fa2d9ad73d7a85d681296c7e9ed6caa8f10a1
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl.cc) = b2434f0b9296d0c9f1ac4083c4395eb775d6f7d5
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl.h) = a825eb050b384ee980f286c4f0bd2839ce54dcab
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__adapter.cc) = 4d75219d7e37e4d5a5367df8cebfe8d28795e793
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__adapter.h) = a6d04330e0df7c21212ecc3a4c3d986b23db3fff
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__cocoa.h) = 922a5ccaf2b78311a19d5fe4a7ef35309aceddb7
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm) = 69473aecf02b5c66f001359cb779fcd5a40a5988
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__interface.h) = 0627a4441b187346d6d002820f47a204903c5d62
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__mac.h) = ac7be4060c32d0e2adf18a375fa2bd599ba1e48b
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__mac.mm) = 94ad6e44df0ead127b7fb57eb851440e9527b771
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h) = ac2dc02b022c3017a08cf88124b462855dafb687
+SHA1 (patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm) = 403e219600f83447cc868fcc0976aeeaf3fafa30
+SHA1 (patch-ui_views_controls_prefix__selector.cc) = 735c4b61815f9eb75aafe8d5b9176bc639b6f8cf
+SHA1 (patch-ui_views_controls_prefix__selector.h) = 96ea1f2df9c99967107a723b2eaa8ec184301868
+SHA1 (patch-ui_views_controls_textfield_textfield.cc) = 548fca159e638530e205e69637c9e3d87b7d778a
+SHA1 (patch-ui_views_controls_textfield_textfield.h) = b816546241f9ea76648099ba737196bccd978ad9
+SHA1 (patch-ui_views_controls_webview_BUILD.gn) = 615df8ba21c71f28db031b0b11878297d9245d59
+SHA1 (patch-ui_views_controls_webview_web__dialog__view.cc) = 48c1089f7d080ce9cb08b85d84e24d56613e4de9
+SHA1 (patch-ui_views_controls_webview_web__dialog__view.h) = 2cc8e6a9e465d10e7519d34b1a5cdc776884210b
+SHA1 (patch-ui_views_corewm_tooltip__aura.cc) = 5c14fbd830d5ca4de9946c199f38d556adfd280f
+SHA1 (patch-ui_views_examples_widget__example.cc) = abe042bb2755cf3c6eacb807b3b664a3e58688b4
+SHA1 (patch-ui_views_focus_focus__manager.cc) = a4997183fd7edf94f99802a1c7e82f38eda4f6bb
+SHA1 (patch-ui_views_style_platform__style.cc) = 4b1613c5cddc9fe059b6156ad20e17284004928b
+SHA1 (patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc) = 75856943c9f873766451a11caa9a4d85f508d63d
+SHA1 (patch-ui_views_views__delegate.cc) = 5b3d4a7a2e00ac43145974fa28e2f6c88ddb1710
+SHA1 (patch-ui_views_views__delegate.h) = aa592a2d50579af85bd48212442ffc878baf6da6
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc) = 041d48bc93dee1b211600dfdd6e7df0ec0dd898c
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h) = 7faf9cdcb0c531be36a15bdd70ee8aaed46d184c
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc) = c45924dd8dec709386ddd124fff9493faad690c9
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc) = 73ba670be92bb268dacf6b6c32b437a580a333f5
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc) = 61a2d21f1564eacad32b6ac7472f9b2762e027d6
+SHA1 (patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h) = b1e1b8b7c1b1341c6a2eecafe1e4fa54121d29cd
+SHA1 (patch-ui_views_widget_root__view.cc) = 4537edc611359af0d06d8a8a7458027f7ecd31b7
+SHA1 (patch-ui_views_widget_widget.cc) = 3d43b388b4d2da256056bdd38b90e86b14c73d9d
+SHA1 (patch-ui_views_win_hwnd__message__handler.cc) = 605a69a7f63b4271f2c5e80dfd3f902307f95029
+SHA1 (patch-ui_views_win_hwnd__message__handler__delegate.h) = 530ca7c6728434580abdc08d173646de5e42c9a5
+SHA1 (patch-ui_views_window_custom__frame__view.cc) = 3b8c8ddf0e69ba5c42784865c5a70d37d27d1a5d
+SHA1 (patch-ui_views_window_dialog__delegate.cc) = 90cc08a91cf0a28a7ca490f763288ae6644df0ea
+SHA1 (patch-ui_views_window_frame__background.cc) = 28633216a18bbbe1cb9e8fe1daaafb762814a84d
+SHA1 (patch-ui_views_window_frame__caption__button.cc) = d1561b46405f4f07b6e5f98a3e62b7dd5430e9fb
+SHA1 (patch-ui_views_window_frame__caption__button.h) = e567595b2783309878a215db229041c0de2919b2
+SHA1 (patch-url_url__util.cc) = 682dbd80ffae2e7d3af195399c3b3d75bb16903d
+SHA1 (patch-url_url__util.h) = 68394be9686975ea947e9dc2c5a5609c06e58c71
+SHA1 (patch-v8_BUILD.gn) = c51c4846f59d304b252a539f5ab1b4a2f3941d70
+SHA1 (patch-v8_include_v8-internal.h) = a295fa99a1e28bf7cc2b3f1312420a31a88825a1
+SHA1 (patch-v8_include_v8-microtask-queue.h) = 1f4b1be378c2f2679c8b0f4f7b78fddbcef047ff
+SHA1 (patch-v8_include_v8-object.h) = 4e2ea722259a4f2ff41f51f54ab1c46a6c33cf58
+SHA1 (patch-v8_include_v8config.h) = 3f2152d5ad4a14ca93a60c579feb9da5ee7573bb
+SHA1 (patch-v8_src_api_api.cc) = bb94d825d90c31beb0071af8950e88139fbd5052
+SHA1 (patch-v8_src_base_atomicops.h) = 4f3dd4f779f11c09ae0ff9856360cf4a3c6f1ab3
+SHA1 (patch-v8_src_base_platform_memory.h) = 467f78dadc7c1ea05ffb7fdc4bac62b8ac5eb385
+SHA1 (patch-v8_src_base_platform_platform-freebsd.cc) = 5fc87dc760e10e184f15b5e480aef5eaee882961
+SHA1 (patch-v8_src_base_platform_platform-openbsd.cc) = 43c4aedcd9240b97bcbaa2c821b0f9b0dbb36140
+SHA1 (patch-v8_src_base_platform_platform-posix.cc) = 25162cf5ed3022b50456a1db20716f5898ed0a10
+SHA1 (patch-v8_src_base_small-vector.h) = 096169fa21aa8db7a4a5f22a80e3c8cdd191ea91
+SHA1 (patch-v8_src_base_strings.h) = a56c73a4ec7d26ae28a2d375306f97af0f00ae3b
+SHA1 (patch-v8_src_base_sys-info.cc) = 73fc7e787533b5ff79737c1aa5e6a4ab5442b284
+SHA1 (patch-v8_src_base_utils_random-number-generator.cc) = 1acb5c582e7780aa99a86dbdac793de9a3028b23
+SHA1 (patch-v8_src_compiler_access-info.cc) = 80e64eccb799575d88c9f9ccf18bb83443012803
+SHA1 (patch-v8_src_compiler_heap-refs.cc) = 802694c5d1bdfdd59b176989b3eb3c23f9c8d0cb
+SHA1 (patch-v8_src_compiler_js-call-reducer.cc) = ac121a30d33e323d18a3570e7e31c8c1635d5f97
+SHA1 (patch-v8_src_compiler_js-native-context-specialization.cc) = 8a39c0043e77a369a7fbd7f33222525f80be3e09
+SHA1 (patch-v8_src_diagnostics_perf-jit.cc) = b0c397aa1b9394117f6f712ce8d5f765779a01f9
+SHA1 (patch-v8_src_diagnostics_perf-jit.h) = ac0140a909dbaec64a6fd850e3ffdca3a054047b
+SHA1 (patch-v8_src_execution_isolate.cc) = 556a85ddf10d7668c1a56cb4139c62bcedb5bb20
+SHA1 (patch-v8_src_execution_microtask-queue.h) = 57da8cbbd7db8b469ad07d863a01db3e8d401f34
+SHA1 (patch-v8_src_flags_flags.cc) = e7020fc69dfd25a9868841a550955b9e5dd59e0c
+SHA1 (patch-v8_src_maglev_maglev-graph-builder.cc) = 80b92e04b590702a67b32a3492b8ba0b660231f1
+SHA1 (patch-v8_src_runtime_runtime-wasm.cc) = 1051bd4741006ed340209a2d6cf66ae5b6de65f0
+SHA1 (patch-v8_src_sandbox_sandbox.cc) = 42c46e1fcbb712f8a628bb3c345295d4e928afd4
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc) = 7574451c194f2d512b2e2e2ee14b407cd16f1661
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h) = 82b722a98eb6cae703adc1011dad8dcd175ed44a
+SHA1 (patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc) = 6f0b7eefaa863d27527b41b760ca63a7d4549f20
+SHA1 (patch-v8_src_trap-handler_handler-inside-posix.cc) = cae956ce9c30b987d424ced366f65dd3d3b1bab8
+SHA1 (patch-v8_src_trap-handler_handler-inside-posix.h) = c92e27c6f3e9d02e56c6a780daaee1d6c654bcee
+SHA1 (patch-v8_src_trap-handler_trap-handler.h) = 4ac80edc8276f5f43023b2799eacfa1759d2b9f4
+SHA1 (patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h) = a1efc0606166e60f30ce32a791c74cb0f544e35a
+SHA1 (patch-v8_src_wasm_wasm-js.cc) = d790e09fb671896e7b1f599b1e6e208e391dbbc6
+SHA1 (patch-v8_test_mjsunit_regress_wasm_regress-366635354.js) = e7653be16e5cf85fa0b789f1d6191e0bc310eca3
+SHA1 (patch-v8_test_mjsunit_wasm_regress-367818758.js) = 1900eb74ef17db0194860a750f90170d87fc2a5d
+SHA1 (patch-v8_tools_run-paxctl.py) = 7f6fef44493a7016c6b0a7dbd3121e9829babee5
+SHA1 (patch-v8_tools_run.py) = 166f784b2f27ad66a3b4e951b13cb3f9dee6da85
diff --git a/electron32/options.mk b/electron32/options.mk
new file mode 100644
index 0000000000..1b3345d3a9
--- /dev/null
+++ b/electron32/options.mk
@@ -0,0 +1,63 @@
+# $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 sndio sunaudio
+PKG_SUPPORTED_OPTIONS+= debug
+
+.if ${OPSYS} == "NetBSD"
+PKG_SUGGESTED_OPTIONS+= sunaudio
+.elif ${OPSYS} == "OpenBSD"
+PKG_SUGGESTED_OPTIONS+= sndio
+.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:Msndio)
+GN_ARGS+= use_sndio=true
+.else
+GN_ARGS+= use_sndio=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/electron32/patches/patch-.gitignore b/electron32/patches/patch-.gitignore
new file mode 100644
index 0000000000..7b3a74d5b2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.054677000 +0000
++++ .gitignore
+@@ -213,6 +213,7 @@ vs-chromium-project.txt
+ /data
+ /delegate_execute
+ /device/serial/device_serial_mojo.xml
++/electron
+ /google_apis/gcm/gcm.xml
+ /googleurl
+ /gpu/gles2_conform_test
diff --git a/electron32/patches/patch-.gn b/electron32/patches/patch-.gn
new file mode 100644
index 0000000000..74a8bedced
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.054677000 +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/electron32/patches/patch-BUILD.gn b/electron32/patches/patch-BUILD.gn
new file mode 100644
index 0000000000..05e954fa72
--- /dev/null
+++ b/electron32/patches/patch-BUILD.gn
@@ -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.gn.orig 2024-10-18 12:33:59.054677000 +0000
++++ BUILD.gn
+@@ -66,7 +66,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)
+@@ -98,7 +98,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",
+@@ -431,7 +430,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",
+@@ -626,6 +625,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)",
+@@ -674,7 +682,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
+@@ -1001,7 +1009,6 @@ if (is_win) {
+ "//media:media_unittests",
+ "//media/midi:midi_unittests",
+ "//net:net_unittests",
+- "//printing:printing_unittests",
+ "//sql:sql_unittests",
+ "//third_party/breakpad:symupload",
+ "//ui/base:ui_base_unittests",
+@@ -1010,6 +1017,10 @@ if (is_win) {
+ "//ui/views:views_unittests",
+ "//url:url_unittests",
+ ]
++
++ if (enable_printing) {
++ deps += [ "//printing:printing_unittests" ]
++ }
+ }
+ }
+
+@@ -1124,7 +1135,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 = [
+@@ -1221,7 +1232,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.
+@@ -1235,7 +1246,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.
+@@ -1702,7 +1713,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/electron32/patches/patch-apps_ui_views_app__window__frame__view.cc b/electron32/patches/patch-apps_ui_views_app__window__frame__view.cc
new file mode 100644
index 0000000000..a0b2afe65b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.138629400 +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/electron32/patches/patch-ash_display_mirror__window__controller.cc b/electron32/patches/patch-ash_display_mirror__window__controller.cc
new file mode 100644
index 0000000000..0ea541e50e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.262559400 +0000
++++ ash/display/mirror_window_controller.cc
+@@ -294,7 +294,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/electron32/patches/patch-base_BUILD.gn b/electron32/patches/patch-base_BUILD.gn
new file mode 100644
index 0000000000..2a270d1094
--- /dev/null
+++ b/electron32/patches/patch-base_BUILD.gn
@@ -0,0 +1,187 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- base/BUILD.gn.orig 2024-10-18 12:33:59.710306200 +0000
++++ base/BUILD.gn
+@@ -176,7 +176,7 @@ buildflag_header("ios_cronet_buildflags"
+ flags = [ "CRONET_BUILD=$is_cronet_build" ]
+ }
+
+-enable_message_pump_epoll = is_linux || is_chromeos || is_android
++enable_message_pump_epoll = (is_linux || is_chromeos || is_android) && !is_bsd
+ buildflag_header("message_pump_buildflags") {
+ header = "message_pump_buildflags.h"
+ header_dir = "base/message_loop"
+@@ -962,7 +962,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",
+@@ -1048,6 +1048,7 @@ component("base") {
+ "//build/config/compiler:prevent_unsafe_narrowing",
+ "//build/config/compiler:wexit_time_destructors",
+ "//build/config/compiler:wglobal_constructors",
++ "//electron/build/config:mas_build",
+ ]
+
+ deps = [
+@@ -1119,11 +1120,24 @@ 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" ]
++ }
++
++ if (is_freebsd) {
++ libs += [
++ "execinfo",
++ "util",
++ "z",
++ ]
++ }
++
+ if (use_allocator_shim) {
+ if (is_apple) {
+ sources += [ "allocator/early_zone_registration_apple.h" ]
+@@ -1143,7 +1157,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" ]
+ }
+
+@@ -2121,6 +2135,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 += [
+@@ -2266,6 +2303,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",
+@@ -2276,7 +2340,7 @@ component("base") {
+ }
+
+ if (dep_libevent) {
+- deps += [ "//third_party/libevent" ]
++ public_deps += [ "//third_party/libevent" ]
+ }
+
+ if (use_libevent) {
+@@ -3077,7 +3141,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
+@@ -3730,7 +3794,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",
+@@ -3757,7 +3821,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",
+@@ -3768,7 +3832,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" ]
+ }
+
+@@ -3953,7 +4017,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/electron32/patches/patch-base_allocator_dispatcher_tls.h b/electron32/patches/patch-base_allocator_dispatcher_tls.h
new file mode 100644
index 0000000000..6c2a61bcff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.710306200 +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/electron32/patches/patch-base_allocator_partition__allocator_partition__alloc.gni b/electron32/patches/patch-base_allocator_partition__allocator_partition__alloc.gni
new file mode 100644
index 0000000000..a690ea2b9f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.710306200 +0000
++++ base/allocator/partition_allocator/partition_alloc.gni
+@@ -31,7 +31,7 @@ if (is_nacl) {
+ use_large_empty_slot_span_ring = is_mac
+
+ 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,
+@@ -361,7 +361,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_BUILD.gn
new file mode 100644
index 0000000000..414375dbdb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.710306200 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/BUILD.gn
+@@ -796,7 +796,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_address__space__randomization.h
new file mode 100644
index 0000000000..c575b0a8d7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.710306200 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_oom.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_oom.cc
new file mode 100644
index 0000000000..b3df3d33a4
--- /dev/null
+++ b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_oom.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
+
+--- base/allocator/partition_allocator/src/partition_alloc/oom.cc.orig 2024-10-18 12:33:59.714303700 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/oom.cc
+@@ -28,21 +28,47 @@ namespace internal {
+ // partition_alloc::internal::base::internal::OnNoMemoryInternal
+ PA_NOINLINE void OnNoMemoryInternal(size_t size) {
+ g_oom_size = size;
++ size_t tmp_size = size;
++ internal::base::debug::Alias(&tmp_size);
++
+ #if PA_BUILDFLAG(IS_WIN)
++ // Create an exception vector with:
++ // [0] the size of the allocation, in bytes
++ // [1] "current committed memory limit for the system or the current process,
++ // whichever is smaller, in bytes"
++ // [2] "maximum amount of memory the current process can commit, in bytes"
++ //
++ // Citations from
++ // https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
++ //
++ // System commit constraints (which may be different from the process commit
++ // constraints) are in the stability_report.SystemMemoryState.WindowsMemory
++ // proto attached to crash reports.
++ //
++ // Note: Both the process commit constraints in the exception vector and the
++ // system commit constraints in the proto are collected *after* the OOM and
++ // may therefore not reflect the state at the time of the OOM (e.g. another
++ // process may have exited or the page file may have been resized).
++ constexpr size_t kInvalid = std::numeric_limits<ULONG_PTR>::max();
++ ULONG_PTR exception_args[] = {size, kInvalid, kInvalid};
++
++ MEMORYSTATUSEX memory_status = {};
++ memory_status.dwLength = sizeof(memory_status);
++ if (::GlobalMemoryStatusEx(&memory_status) != 0) {
++ exception_args[1] = memory_status.ullTotalPageFile;
++ exception_args[2] = memory_status.ullAvailPageFile;
++ }
++ internal::base::debug::Alias(&memory_status);
++
+ // Kill the process. This is important for security since most of code
+ // does not check the result of memory allocation.
+- // https://msdn.microsoft.com/en-us/library/het71c37.aspx
+- // Pass the size of the failed request in an exception argument.
+- ULONG_PTR exception_args[] = {size};
++ // Documentation: https://msdn.microsoft.com/en-us/library/het71c37.aspx
+ ::RaiseException(win::kOomExceptionCode, EXCEPTION_NONCONTINUABLE,
+ std::size(exception_args), exception_args);
+
+ // Safety check, make sure process exits here.
+ _exit(win::kOomExceptionCode);
+ #else
+- size_t tmp_size = size;
+- internal::base::debug::Alias(&tmp_size);
+-
+ // Note: Don't add anything that may allocate here. Depending on the
+ // allocator, this may be called from within the allocator (e.g. with
+ // PartitionAlloc), and would deadlock as our locks are not recursive.
diff --git a/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator.h
new file mode 100644
index 0000000000..a1c4c0cfa0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.714303700 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__constants.h
new file mode 100644
index 0000000000..356b1ed3bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.714303700 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.cc
new file mode 100644
index 0000000000..1d76d4f5ea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.714303700 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.cc
+@@ -9,7 +9,7 @@
+ #include "partition_alloc/page_allocator.h"
+
+ #if PA_BUILDFLAG(HAS_MEMORY_TAGGING) || \
+- (defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1))
++ (defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1) && !PA_BUILDFLAG(IS_BSD))
+ struct __ifunc_arg_t;
+
+ #include "partition_alloc/aarch64_support.h"
diff --git a/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_page__allocator__internals__posix.h
new file mode 100644
index 0000000000..727327f67b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.714303700 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/page_allocator_internals_posix.h
+@@ -411,8 +411,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_proc__maps__linux.cc
new file mode 100644
index 0000000000..741688e978
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.714303700 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_debug_stack__trace__posix.cc
new file mode 100644
index 0000000000..c23d79b049
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.718301500 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_rand__util__posix.cc
new file mode 100644
index 0000000000..e6ce799575
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.718301500 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread.h
new file mode 100644
index 0000000000..1d930f0aa2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.718301500 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__internal__posix.h
new file mode 100644
index 0000000000..eabb7fe94e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.718301500 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__base_threading_platform__thread__posix.cc
new file mode 100644
index 0000000000..63d6df78a0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.718301500 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.h
new file mode 100644
index 0000000000..62d2bef6c5
--- /dev/null
+++ b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__config.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_config.h.orig 2024-10-18 12:33:59.722299300 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_alloc_config.h
+@@ -168,7 +168,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))
+
+ // PartitionAlloc uses PartitionRootEnumerator to acquire all
+ // PartitionRoots at BeforeFork and to release at AfterFork.
+@@ -216,7 +216,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__constants.h
new file mode 100644
index 0000000000..4abb56933d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.722299300 +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;
+@@ -458,7 +458,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__alloc__forward.h
new file mode 100644
index 0000000000..95cb0747b2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.722299300 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_partition__root.cc
new file mode 100644
index 0000000000..048dffec21
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.722299300 +0000
++++ base/allocator/partition_allocator/src/partition_alloc/partition_root.cc
+@@ -43,7 +43,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>
+ #endif
+
+@@ -277,7 +277,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.
+@@ -1074,7 +1074,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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_spinning__mutex.cc
new file mode 100644
index 0000000000..cc80135f04
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.726297100 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_stack_stack.cc
new file mode 100644
index 0000000000..ee27fb6d0b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.726297100 +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/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc b/electron32/patches/patch-base_allocator_partition__allocator_src_partition__alloc_thread__isolation_pkey.cc
new file mode 100644
index 0000000000..4d507b76c5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.730294700 +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/electron32/patches/patch-base_atomicops.h b/electron32/patches/patch-base_atomicops.h
new file mode 100644
index 0000000000..47b5e0bb82
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.746285700 +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/electron32/patches/patch-base_base__paths__posix.cc b/electron32/patches/patch-base_base__paths__posix.cc
new file mode 100644
index 0000000000..0779025a5a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.750283500 +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
+@@ -49,13 +54,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_IN_MIGRATION() << "Unable to resolve path.";
++ return false;
++ }
++ *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];
+@@ -67,13 +80,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("/usr/local/chrome/chrome");
++ return true;
++#if !BUILDFLAG(IS_AIX)
++ }
++ return ret;
++#endif
+ #endif
+ }
+ case DIR_SRC_TEST_DATA_ROOT: {
diff --git a/electron32/patches/patch-base_compiler__specific.h b/electron32/patches/patch-base_compiler__specific.h
new file mode 100644
index 0000000000..b9c7b3d173
--- /dev/null
+++ b/electron32/patches/patch-base_compiler__specific.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
+
+--- base/compiler_specific.h.orig 2024-10-18 12:33:59.750283500 +0000
++++ base/compiler_specific.h
+@@ -326,7 +326,8 @@
+ //
+ // In some cases it's desirable to remove this, e.g. on hot functions, or if
+ // we have purposely changed the reference canary.
+-#if defined(COMPILER_GCC) || defined(__clang__)
++#if (defined(COMPILER_GCC) || defined(__clang__)) && !defined(__OpenBSD__) && !defined(__FreeBSD__) && \
++ !defined(__NetBSD__)
+ #if HAS_ATTRIBUTE(__no_stack_protector__)
+ #define NO_STACK_PROTECTOR __attribute__((__no_stack_protector__))
+ #else
diff --git a/electron32/patches/patch-base_debug_debugger__posix.cc b/electron32/patches/patch-base_debug_debugger__posix.cc
new file mode 100644
index 0000000000..df1c7a3f42
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.754281300 +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/electron32/patches/patch-base_debug_elf__reader.cc b/electron32/patches/patch-base_debug_elf__reader.cc
new file mode 100644
index 0000000000..b8a84a56ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +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/electron32/patches/patch-base_debug_proc__maps__linux.cc b/electron32/patches/patch-base_debug_proc__maps__linux.cc
new file mode 100644
index 0000000000..23cc84de76
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +0000
++++ base/debug/proc_maps_linux.cc
+@@ -18,7 +18,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/electron32/patches/patch-base_debug_stack__trace.cc b/electron32/patches/patch-base_debug_stack__trace.cc
new file mode 100644
index 0000000000..a9487e4dd0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +0000
++++ base/debug/stack_trace.cc
+@@ -255,7 +255,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;
+@@ -317,7 +317,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();
+@@ -341,7 +341,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/electron32/patches/patch-base_debug_stack__trace__posix.cc b/electron32/patches/patch-base_debug_stack__trace__posix.cc
new file mode 100644
index 0000000000..8126e81929
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +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
+@@ -307,7 +309,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
+@@ -324,7 +326,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)
+@@ -541,7 +547,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;
+@@ -566,6 +572,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) {
+@@ -580,6 +587,7 @@ void StackDumpSignalHandler(int signal,
+ if (errno != EPERM) {
+ _exit(EXIT_FAILURE);
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_ANDROID) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+@@ -769,6 +777,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.
+@@ -861,11 +870,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)) {
+@@ -883,6 +896,7 @@ class SandboxSymbolizeHelper {
+
+ is_initialized_ = true;
+ return true;
++#endif
+ }
+
+ // Opens all object files and caches their file descriptors.
diff --git a/electron32/patches/patch-base_enterprise__util__mac.mm b/electron32/patches/patch-base_enterprise__util__mac.mm
new file mode 100644
index 0000000000..cfd504d0c9
--- /dev/null
+++ b/electron32/patches/patch-base_enterprise__util__mac.mm
@@ -0,0 +1,30 @@
+$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 2024-10-18 12:33:59.758278800 +0000
++++ base/enterprise_util_mac.mm
+@@ -116,6 +116,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 +227,6 @@ DeviceUserDomainJoinState AreDeviceAndUs
+
+ return state;
+ }
++#endif
+
+ } // namespace base
diff --git a/electron32/patches/patch-base_features.cc b/electron32/patches/patch-base_features.cc
new file mode 100644
index 0000000000..b5c29f2511
--- /dev/null
+++ b/electron32/patches/patch-base_features.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
+
+--- base/features.cc.orig 2024-10-18 12:33:59.758278800 +0000
++++ base/features.cc
+@@ -9,8 +9,10 @@
+ #include "base/threading/platform_thread.h"
+ #include "build/buildflag.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
++#if !BUILDFLAG(IS_BSD)
+ #include "base/message_loop/message_pump_epoll.h"
++#endif
+ #include "base/message_loop/message_pump_libevent.h"
+ #endif
+
+@@ -116,10 +118,12 @@ void Init(EmitThreadControllerProfilerMe
+ sequence_manager::internal::ThreadController::InitializeFeatures(
+ emit_thread_controller_profiler_metadata);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ MessagePumpLibevent::InitializeFeatures();
++#if !BUILDFLAG(IS_BSD)
+ MessagePumpEpoll::InitializeFeatures();
+ #endif
++#endif
+
+ #if BUILDFLAG(IS_APPLE) || BUILDFLAG(IS_CHROMEOS)
+ PlatformThread::InitializeFeatures();
diff --git a/electron32/patches/patch-base_files_dir__reader__linux.h b/electron32/patches/patch-base_files_dir__reader__linux.h
new file mode 100644
index 0000000000..250b65c2f8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +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/electron32/patches/patch-base_files_dir__reader__posix.h b/electron32/patches/patch-base_files_dir__reader__posix.h
new file mode 100644
index 0000000000..9f970d8197
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.758278800 +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/electron32/patches/patch-base_files_file__path__watcher.h b/electron32/patches/patch-base_files_file__path__watcher.h
new file mode 100644
index 0000000000..74a8e41073
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_files_file__path__watcher__bsd.cc b/electron32/patches/patch-base_files_file__path__watcher__bsd.cc
new file mode 100644
index 0000000000..bcdf428fdd
--- /dev/null
+++ b/electron32/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-01-06 07:57:02.975848620 +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/electron32/patches/patch-base_files_file__path__watcher__kqueue.cc b/electron32/patches/patch-base_files_file__path__watcher__kqueue.cc
new file mode 100644
index 0000000000..e498c91c5c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_files_file__path__watcher__kqueue.h b/electron32/patches/patch-base_files_file__path__watcher__kqueue.h
new file mode 100644
index 0000000000..5ff2a9eefe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_files_file__path__watcher__unittest.cc b/electron32/patches/patch-base_files_file__path__watcher__unittest.cc
new file mode 100644
index 0000000000..491fe5b193
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_files_file__util__posix.cc b/electron32/patches/patch-base_files_file__util__posix.cc
new file mode 100644
index 0000000000..e03e3597e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +0000
++++ base/files/file_util_posix.cc
+@@ -889,36 +889,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/electron32/patches/patch-base_files_file__util__unittest.cc b/electron32/patches/patch-base_files_file__util__unittest.cc
new file mode 100644
index 0000000000..f1f38d3ea1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +0000
++++ base/files/file_util_unittest.cc
+@@ -3903,7 +3903,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";
+@@ -4620,7 +4620,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/electron32/patches/patch-base_files_important__file__writer__cleaner.cc b/electron32/patches/patch-base_files_important__file__writer__cleaner.cc
new file mode 100644
index 0000000000..dbf9364bd1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_files_scoped__file.cc b/electron32/patches/patch-base_files_scoped__file.cc
new file mode 100644
index 0000000000..8c6c60f008
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.762276600 +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/electron32/patches/patch-base_functional_callback__helpers.h b/electron32/patches/patch-base_functional_callback__helpers.h
new file mode 100644
index 0000000000..808ad5a7ad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.766274500 +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/electron32/patches/patch-base_functional_unretained__traits.h b/electron32/patches/patch-base_functional_unretained__traits.h
new file mode 100644
index 0000000000..4f8c282f57
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.766274500 +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/electron32/patches/patch-base_i18n_icu__util.cc b/electron32/patches/patch-base_i18n_icu__util.cc
new file mode 100644
index 0000000000..e0a23c47de
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.770272300 +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/electron32/patches/patch-base_linux__util.cc b/electron32/patches/patch-base_linux__util.cc
new file mode 100644
index 0000000000..234c8d612f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.774269800 +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(std::to_string(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/electron32/patches/patch-base_logging__unittest.cc b/electron32/patches/patch-base_logging__unittest.cc
new file mode 100644
index 0000000000..67678ca6af
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.774269800 +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
+
+@@ -579,14 +579,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/electron32/patches/patch-base_memory_discardable__memory.cc b/electron32/patches/patch-base_memory_discardable__memory.cc
new file mode 100644
index 0000000000..4474ce4a1e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.774269800 +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);
+@@ -52,7 +52,7 @@ const base::FeatureParam<DiscardableMemo
+
+ 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 =
+@@ -71,7 +71,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.
+@@ -101,7 +101,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/electron32/patches/patch-base_memory_discardable__memory__internal.h b/electron32/patches/patch-base_memory_discardable__memory__internal.h
new file mode 100644
index 0000000000..d48b3470bc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.774269800 +0000
++++ base/memory/discardable_memory_internal.h
+@@ -10,7 +10,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/electron32/patches/patch-base_memory_madv__free__discardable__memory__posix.cc b/electron32/patches/patch-base_memory_madv__free__discardable__memory__posix.cc
new file mode 100644
index 0000000000..2741d92390
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.774269800 +0000
++++ base/memory/madv_free_discardable_memory_posix.cc
+@@ -311,6 +311,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
+@@ -326,6 +330,7 @@ bool MadvFreeDiscardableMemoryPosix::IsR
+ return false;
+ }
+ return true;
++#endif
+ }
+
+ bool MadvFreeDiscardableMemoryPosix::IsDiscarded() const {
diff --git a/electron32/patches/patch-base_memory_platform__shared__memory__region.h b/electron32/patches/patch-base_memory_platform__shared__memory__region.h
new file mode 100644
index 0000000000..0b21c54384
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.778267600 +0000
++++ base/memory/platform_shared_memory_region.h
+@@ -17,7 +17,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;
+ }
+@@ -84,7 +84,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:
+@@ -216,7 +216,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/electron32/patches/patch-base_memory_platform__shared__memory__region__posix.cc b/electron32/patches/patch-base_memory_platform__shared__memory__region__posix.cc
new file mode 100644
index 0000000000..a79d2ed0ba
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.778267600 +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/electron32/patches/patch-base_message__loop_message__pump__glib.cc b/electron32/patches/patch-base_message__loop_message__pump__glib.cc
new file mode 100644
index 0000000000..5900ef43cc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.782265400 +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/electron32/patches/patch-base_native__library__posix.cc b/electron32/patches/patch-base_native__library__posix.cc
new file mode 100644
index 0000000000..5e9ed33d85
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +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/electron32/patches/patch-base_native__library__unittest.cc b/electron32/patches/patch-base_native__library__unittest.cc
new file mode 100644
index 0000000000..2f8f29f5f2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +0000
++++ base/native_library_unittest.cc
+@@ -133,7 +133,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/electron32/patches/patch-base_posix_can__lower__nice__to.cc b/electron32/patches/patch-base_posix_can__lower__nice__to.cc
new file mode 100644
index 0000000000..42c972f362
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +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/electron32/patches/patch-base_posix_sysctl.cc b/electron32/patches/patch-base_posix_sysctl.cc
new file mode 100644
index 0000000000..26c05d6503
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +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/electron32/patches/patch-base_posix_unix__domain__socket.cc b/electron32/patches/patch-base_posix_unix__domain__socket.cc
new file mode 100644
index 0000000000..d89765656c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +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/electron32/patches/patch-base_posix_unix__domain__socket__unittest.cc b/electron32/patches/patch-base_posix_unix__domain__socket__unittest.cc
new file mode 100644
index 0000000000..e20860ab21
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.790260800 +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/electron32/patches/patch-base_process_internal__linux.h b/electron32/patches/patch-base_process_internal__linux.h
new file mode 100644
index 0000000000..f3d5864cb3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_kill.h b/electron32/patches/patch-base_process_kill.h
new file mode 100644
index 0000000000..17dd1863a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_kill__posix.cc b/electron32/patches/patch-base_process_kill__posix.cc
new file mode 100644
index 0000000000..b782d82251
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_launch.h b/electron32/patches/patch-base_process_launch.h
new file mode 100644
index 0000000000..00cc72be11
--- /dev/null
+++ b/electron32/patches/patch-base_process_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
+
+--- base/process/launch.h.orig 2024-10-18 12:33:59.794258600 +0000
++++ base/process/launch.h
+@@ -211,7 +211,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/electron32/patches/patch-base_process_launch__mac.cc b/electron32/patches/patch-base_process_launch__mac.cc
new file mode 100644
index 0000000000..e36569bbf6
--- /dev/null
+++ b/electron32/patches/patch-base_process_launch__mac.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/launch_mac.cc.orig 2024-10-18 12:33:59.794258600 +0000
++++ base/process/launch_mac.cc
+@@ -21,13 +21,18 @@
+ #include "base/threading/scoped_blocking_call.h"
+ #include "base/threading/thread_restrictions.h"
+ #include "base/trace_event/base_tracing.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);
+@@ -99,13 +104,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
+
+@@ -226,7 +245,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/electron32/patches/patch-base_process_launch__posix.cc b/electron32/patches/patch-base_process_launch__posix.cc
new file mode 100644
index 0000000000..81161754d3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +0000
++++ base/process/launch_posix.cc
+@@ -66,6 +66,9 @@
+ #error "macOS should use launch_mac.cc"
+ #endif
+
++#if defined(OS_FREEBSD)
++#pragma weak environ
++#endif
+ extern char** environ;
+
+ namespace base {
+@@ -210,6 +213,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/electron32/patches/patch-base_process_memory__linux.cc b/electron32/patches/patch-base_process_memory__linux.cc
new file mode 100644
index 0000000000..e70418aed9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__handle.cc b/electron32/patches/patch-base_process_process__handle.cc
new file mode 100644
index 0000000000..cfbfab739e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__handle.h b/electron32/patches/patch-base_process_process__handle.h
new file mode 100644
index 0000000000..752fd6c86c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__handle__freebsd.cc b/electron32/patches/patch-base_process_process__handle__freebsd.cc
new file mode 100644
index 0000000000..6fa023442d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__handle__netbsd.cc b/electron32/patches/patch-base_process_process__handle__netbsd.cc
new file mode 100644
index 0000000000..902038b961
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.011844318 +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/electron32/patches/patch-base_process_process__handle__openbsd.cc b/electron32/patches/patch-base_process_process__handle__openbsd.cc
new file mode 100644
index 0000000000..14e4252f06
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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("/usr/local/chrome/chrome");
++
++ 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/electron32/patches/patch-base_process_process__info__mac.cc b/electron32/patches/patch-base_process_process__info__mac.cc
new file mode 100644
index 0000000000..f4c06e7b0b
--- /dev/null
+++ b/electron32/patches/patch-base_process_process__info__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
+
+--- base/process/process_info_mac.cc.orig 2024-10-18 12:33:59.794258600 +0000
++++ base/process/process_info_mac.cc
+@@ -8,15 +8,21 @@
+ #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/electron32/patches/patch-base_process_process__iterator.h b/electron32/patches/patch-base_process_process__iterator.h
new file mode 100644
index 0000000000..78bfedc060
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +0000
++++ base/process/process_iterator.h
+@@ -24,7 +24,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>
+@@ -116,7 +116,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/electron32/patches/patch-base_process_process__iterator__freebsd.cc b/electron32/patches/patch-base_process_process__iterator__freebsd.cc
new file mode 100644
index 0000000000..e3d1723523
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__iterator__netbsd.cc b/electron32/patches/patch-base_process_process__iterator__netbsd.cc
new file mode 100644
index 0000000000..9bb6150a50
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.018295937 +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/electron32/patches/patch-base_process_process__iterator__openbsd.cc b/electron32/patches/patch-base_process_process__iterator__openbsd.cc
new file mode 100644
index 0000000000..347704eeb0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__metrics.cc b/electron32/patches/patch-base_process_process__metrics.cc
new file mode 100644
index 0000000000..55e2a2d75a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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/electron32/patches/patch-base_process_process__metrics.h b/electron32/patches/patch-base_process_process__metrics.h
new file mode 100644
index 0000000000..61e213aaa7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.794258600 +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.
+ //
+@@ -116,7 +116,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;
+@@ -150,7 +150,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
+@@ -195,7 +195,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;
+
+@@ -216,7 +216,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)
+@@ -238,12 +238,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_;
+@@ -284,7 +282,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.
+ //
+@@ -319,7 +317,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
+@@ -334,7 +332,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;
+@@ -371,7 +369,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.
+@@ -566,7 +564,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/electron32/patches/patch-base_process_process__metrics__freebsd.cc b/electron32/patches/patch-base_process_process__metrics__freebsd.cc
new file mode 100644
index 0000000000..af13cb8eb4
--- /dev/null
+++ b/electron32/patches/patch-base_process_process__metrics__freebsd.cc
@@ -0,0 +1,309 @@
+$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 2024-10-18 12:33:59.798256400 +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,22 +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_IN_MIGRATION();
+- return base::unexpected(ProcessCPUUsageError::kNotImplemented);
++ return base::ok(Microseconds(info.ki_runtime));
+ }
+
+ size_t GetSystemCommitCharge() {
+@@ -64,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/electron32/patches/patch-base_process_process__metrics__netbsd.cc b/electron32/patches/patch-base_process_process__metrics__netbsd.cc
new file mode 100644
index 0000000000..f053bfd7d4
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.022572153 +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/electron32/patches/patch-base_process_process__metrics__openbsd.cc b/electron32/patches/patch-base_process_process__metrics__openbsd.cc
new file mode 100644
index 0000000000..3eaa84361d
--- /dev/null
+++ b/electron32/patches/patch-base_process_process__metrics__openbsd.cc
@@ -0,0 +1,240 @@
+$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 2024-10-18 12:33:59.798256400 +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,38 +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_IN_MIGRATION();
+- return base::unexpected(ProcessCPUUsageError::kNotImplemented);
+-}
+-
+-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);
+@@ -86,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/electron32/patches/patch-base_process_process__metrics__posix.cc b/electron32/patches/patch-base_process_process__metrics__posix.cc
new file mode 100644
index 0000000000..42f7e1e08d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_process_process__metrics__unittest.cc b/electron32/patches/patch-base_process_process__metrics__unittest.cc
new file mode 100644
index 0000000000..1b34662a8a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_process_process__posix.cc b/electron32/patches/patch-base_process_process__posix.cc
new file mode 100644
index 0000000000..2610647b6d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_process_process__unittest.cc b/electron32/patches/patch-base_process_process__unittest.cc
new file mode 100644
index 0000000000..e9a3e5c695
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +0000
++++ base/process/process_unittest.cc
+@@ -199,7 +199,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/electron32/patches/patch-base_profiler_module__cache.cc b/electron32/patches/patch-base_profiler_module__cache.cc
new file mode 100644
index 0000000000..a0b428a06e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_profiler_sampling__profiler__thread__token.cc b/electron32/patches/patch-base_profiler_sampling__profiler__thread__token.cc
new file mode 100644
index 0000000000..04306fa5a3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_profiler_sampling__profiler__thread__token.h b/electron32/patches/patch-base_profiler_sampling__profiler__thread__token.h
new file mode 100644
index 0000000000..69bc43b755
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_profiler_stack__base__address__posix.cc b/electron32/patches/patch-base_profiler_stack__base__address__posix.cc
new file mode 100644
index 0000000000..fed3f5adff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.798256400 +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/electron32/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc b/electron32/patches/patch-base_profiler_stack__sampling__profiler__test__util.cc
new file mode 100644
index 0000000000..bc98d7ef0c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.802254200 +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/electron32/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc b/electron32/patches/patch-base_profiler_stack__sampling__profiler__unittest.cc
new file mode 100644
index 0000000000..ae99c01eaf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.802254200 +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/electron32/patches/patch-base_profiler_thread__delegate__posix.cc b/electron32/patches/patch-base_profiler_thread__delegate__posix.cc
new file mode 100644
index 0000000000..4285d49707
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.802254200 +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/electron32/patches/patch-base_rand__util.h b/electron32/patches/patch-base_rand__util.h
new file mode 100644
index 0000000000..9325631a55
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.802254200 +0000
++++ base/rand_util.h
+@@ -147,7 +147,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/electron32/patches/patch-base_rand__util__posix.cc b/electron32/patches/patch-base_rand__util__posix.cc
new file mode 100644
index 0000000000..b7a6cd69cc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.802254200 +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
+@@ -181,6 +183,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()) {
+@@ -217,6 +220,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
+@@ -236,9 +242,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/electron32/patches/patch-base_strings_safe__sprintf__unittest.cc b/electron32/patches/patch-base_strings_safe__sprintf__unittest.cc
new file mode 100644
index 0000000000..cf679c3723
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.806251800 +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/electron32/patches/patch-base_synchronization_lock__impl.h b/electron32/patches/patch-base_synchronization_lock__impl.h
new file mode 100644
index 0000000000..b7e1a56573
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +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/electron32/patches/patch-base_syslog__logging.cc b/electron32/patches/patch-base_syslog__logging.cc
new file mode 100644
index 0000000000..072a07d79a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +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/electron32/patches/patch-base_system_sys__info.cc b/electron32/patches/patch-base_system_sys__info.cc
new file mode 100644
index 0000000000..fbea682d4c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +0000
++++ base/system/sys_info.cc
+@@ -223,7 +223,7 @@ std::string SysInfo::HardwareModelName()
+ #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/electron32/patches/patch-base_system_sys__info.h b/electron32/patches/patch-base_system_sys__info.h
new file mode 100644
index 0000000000..d9029a74c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +0000
++++ base/system/sys_info.h
+@@ -325,6 +325,8 @@ class BASE_EXPORT SysInfo {
+ static void ResetCpuSecurityMitigationsEnabledForTesting();
+ #endif
+
++ static uint64_t MaxSharedMemorySize();
++
+ private:
+ friend class test::ScopedAmountOfPhysicalMemoryOverride;
+ FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory);
+@@ -337,7 +339,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/electron32/patches/patch-base_system_sys__info__freebsd.cc b/electron32/patches/patch-base_system_sys__info__freebsd.cc
new file mode 100644
index 0000000000..268183bc9d
--- /dev/null
+++ b/electron32/patches/patch-base_system_sys__info__freebsd.cc
@@ -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/system/sys_info_freebsd.cc.orig 2024-10-18 12:33:59.810249600 +0000
++++ base/system/sys_info_freebsd.cc
+@@ -9,30 +9,106 @@
+ #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_IN_MIGRATION();
+ return 0;
+ }
+- return static_cast<int64_t>(pages) * page_size;
++
++ 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<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_IN_MIGRATION();
+ return 0;
+ }
++
+ 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/electron32/patches/patch-base_system_sys__info__netbsd.cc b/electron32/patches/patch-base_system_sys__info__netbsd.cc
new file mode 100644
index 0000000000..56b2a03b9c
--- /dev/null
+++ b/electron32/patches/patch-base_system_sys__info__netbsd.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/system/sys_info_netbsd.cc.orig 2025-01-06 07:57:03.044216393 +0000
++++ base/system/sys_info_netbsd.cc
+@@ -0,0 +1,91 @@
++// 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_IN_MIGRATION();
++ return 1;
++ }
++ 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);
++ // pledge(2)
++ if (sysctl(mib, std::size(mib), &limit, &size, NULL, 0) < 0) {
++ NOTREACHED_IN_MIGRATION();
++ return 0;
++ }
++ 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/electron32/patches/patch-base_system_sys__info__openbsd.cc b/electron32/patches/patch-base_system_sys__info__openbsd.cc
new file mode 100644
index 0000000000..2e465bfa47
--- /dev/null
+++ b/electron32/patches/patch-base_system_sys__info__openbsd.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_openbsd.cc.orig 2024-10-18 12:33:59.810249600 +0000
++++ base/system/sys_info_openbsd.cc
+@@ -3,7 +3,6 @@
+ // found in the LICENSE file.
+
+ #include "base/system/sys_info.h"
+-
+ #include <stddef.h>
+ #include <stdint.h>
+ #include <sys/param.h>
+@@ -12,6 +11,7 @@
+
+ #include "base/notreached.h"
+ #include "base/posix/sysctl.h"
++#include "base/strings/string_util.h"
+
+ namespace {
+
+@@ -27,9 +27,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) {
+@@ -41,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
+@@ -56,16 +77,28 @@ 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_IN_MIGRATION();
+ return 0;
+ }
+- 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/electron32/patches/patch-base_system_sys__info__posix.cc b/electron32/patches/patch-base_system_sys__info__posix.cc
new file mode 100644
index 0000000000..e8d8b14757
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +0000
++++ base/system/sys_info_posix.cc
+@@ -118,7 +118,7 @@ bool GetDiskSpaceInfo(const base::FilePa
+
+ namespace base {
+
+-#if !BUILDFLAG(IS_OPENBSD)
++#if !BUILDFLAG(IS_BSD)
+ // static
+ int SysInfo::NumberOfProcessors() {
+ #if BUILDFLAG(IS_MAC)
+@@ -175,7 +175,7 @@ int SysInfo::NumberOfProcessors() {
+
+ return cached_num_cpus;
+ }
+-#endif // !BUILDFLAG(IS_OPENBSD)
++#endif // !BUILDFLAG(IS_BSD)
+
+ // static
+ uint64_t SysInfo::AmountOfVirtualMemory() {
+@@ -265,6 +265,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/electron32/patches/patch-base_system_sys__info__unittest.cc b/electron32/patches/patch-base_system_sys__info__unittest.cc
new file mode 100644
index 0000000000..9468226678
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.810249600 +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/electron32/patches/patch-base_task_thread__pool_environment__config__unittest.cc b/electron32/patches/patch-base_task_thread__pool_environment__config__unittest.cc
new file mode 100644
index 0000000000..b112999a1d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.818245000 +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/electron32/patches/patch-base_test_launcher_test__launcher.cc b/electron32/patches/patch-base_test_launcher_test__launcher.cc
new file mode 100644
index 0000000000..45cd27d750
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.838233700 +0000
++++ base/test/launcher/test_launcher.cc
+@@ -74,6 +74,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"
+@@ -1807,6 +1808,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/electron32/patches/patch-base_test_test__file__util__linux.cc b/electron32/patches/patch-base_test_test__file__util__linux.cc
new file mode 100644
index 0000000000..14b65216be
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.842231500 +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/electron32/patches/patch-base_test_test__file__util__posix.cc b/electron32/patches/patch-base_test_test__file__util__posix.cc
new file mode 100644
index 0000000000..c377f1fc6c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.842231500 +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/electron32/patches/patch-base_threading_hang__watcher.cc b/electron32/patches/patch-base_threading_hang__watcher.cc
new file mode 100644
index 0000000000..3a37df499f
--- /dev/null
+++ b/electron32/patches/patch-base_threading_hang__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
+
+--- base/threading/hang_watcher.cc.orig 2024-10-18 12:33:59.850226900 +0000
++++ base/threading/hang_watcher.cc
+@@ -354,7 +354,7 @@ void HangWatcher::InitializeOnMainThread
+
+ bool enable_hang_watcher = base::FeatureList::IsEnabled(kEnableHangWatcher);
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !BUILDFLAG(IS_BSD)
+ if (is_zygote_child) {
+ enable_hang_watcher =
+ enable_hang_watcher &&
diff --git a/electron32/patches/patch-base_threading_platform__thread.h b/electron32/patches/patch-base_threading_platform__thread.h
new file mode 100644
index 0000000000..cc8dc6676e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.850226900 +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/electron32/patches/patch-base_threading_platform__thread__bsd.cc b/electron32/patches/patch-base_threading_platform__thread__bsd.cc
new file mode 100644
index 0000000000..42bf59ab19
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.057010401 +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/electron32/patches/patch-base_threading_platform__thread__internal__posix.cc b/electron32/patches/patch-base_threading_platform__thread__internal__posix.cc
new file mode 100644
index 0000000000..55ff79960d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.850226900 +0000
++++ base/threading/platform_thread_internal_posix.cc
+@@ -42,7 +42,7 @@ ThreadPriorityForTest NiceValueToThreadP
+ }
+
+ int GetCurrentThreadNiceValue() {
+-#if BUILDFLAG(IS_NACL)
++#if BUILDFLAG(IS_NACL) || BUILDFLAG(IS_BSD)
+ NOTIMPLEMENTED();
+ return 0;
+ #else
diff --git a/electron32/patches/patch-base_threading_platform__thread__posix.cc b/electron32/patches/patch-base_threading_platform__thread__posix.cc
new file mode 100644
index 0000000000..28cd82d890
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.850226900 +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/electron32/patches/patch-base_threading_platform__thread__unittest.cc b/electron32/patches/patch-base_threading_platform__thread__unittest.cc
new file mode 100644
index 0000000000..117eef86bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.854224700 +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>
+@@ -429,7 +429,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;
+@@ -713,12 +713,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/electron32/patches/patch-base_threading_thread__restrictions.h b/electron32/patches/patch-base_threading_thread__restrictions.h
new file mode 100644
index 0000000000..779524ae24
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.854224700 +0000
++++ base/threading/thread_restrictions.h
+@@ -136,6 +136,7 @@ class KeyStorageLinux;
+ class NativeBackendKWallet;
+ class NativeDesktopMediaList;
+ class PartnerBookmarksReader;
++class ProcessSingleton;
+ class Profile;
+ class ProfileImpl;
+ class ScopedAllowBlockingForProfile;
+@@ -286,6 +287,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
+@@ -593,6 +597,7 @@ class BASE_EXPORT [[maybe_unused, nodisc
+ friend class ::DesktopNotificationBalloon;
+ friend class ::FirefoxProfileLock;
+ friend class ::GaiaConfig;
++ friend class ::ProcessSingleton;
+ friend class ::ProfileImpl;
+ friend class ::ScopedAllowBlockingForProfile;
+ friend class ::StartupTabProviderImpl;
+@@ -633,6 +638,7 @@ class BASE_EXPORT [[maybe_unused, nodisc
+ 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/electron32/patches/patch-base_trace__event_builtin__categories.h b/electron32/patches/patch-base_trace__event_builtin__categories.h
new file mode 100644
index 0000000000..14762145b7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.858222500 +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/electron32/patches/patch-base_trace__event_malloc__dump__provider.cc b/electron32/patches/patch-base_trace__event_malloc__dump__provider.cc
new file mode 100644
index 0000000000..a3f5ec306e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.858222500 +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/electron32/patches/patch-base_trace__event_memory__dump__manager.cc b/electron32/patches/patch-base_trace__event_memory__dump__manager.cc
new file mode 100644
index 0000000000..ba3a28ef25
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.858222500 +0000
++++ base/trace_event/memory_dump_manager.cc
+@@ -87,7 +87,7 @@ const char* const MemoryDumpManager::kSy
+ #if defined(MALLOC_MEMORY_TRACING_SUPPORTED)
+ MallocDumpProvider::kAllocatedObjects;
+ #else
+- nullptr;
++ "";
+ #endif
+
+ // static
diff --git a/electron32/patches/patch-base_trace__event_process__memory__dump.cc b/electron32/patches/patch-base_trace__event_process__memory__dump.cc
new file mode 100644
index 0000000000..c01904bb81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.862220000 +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/electron32/patches/patch-base_tracing_trace__time.cc b/electron32/patches/patch-base_tracing_trace__time.cc
new file mode 100644
index 0000000000..6430e7786c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.866217900 +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/electron32/patches/patch-base_tracing_trace__time.h b/electron32/patches/patch-base_tracing_trace__time.h
new file mode 100644
index 0000000000..d192c6e23c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.866217900 +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/electron32/patches/patch-base_version__info_version__info.h b/electron32/patches/patch-base_version__info_version__info.h
new file mode 100644
index 0000000000..edfedfdd7a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.870215700 +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/electron32/patches/patch-build_config_BUILD.gn b/electron32/patches/patch-build_config_BUILD.gn
new file mode 100644
index 0000000000..596ab9c10f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.898199800 +0000
++++ build/config/BUILD.gn
+@@ -213,6 +213,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/electron32/patches/patch-build_config_BUILDCONFIG.gn b/electron32/patches/patch-build_config_BUILDCONFIG.gn
new file mode 100644
index 0000000000..7352ee84b7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.898199800 +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" &&
+@@ -231,6 +235,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")
+ }
+@@ -274,6 +284,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")
+ }
+@@ -308,7 +320,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_win = current_os == "win" || current_os == "winuwp"
diff --git a/electron32/patches/patch-build_config_clang_BUILD.gn b/electron32/patches/patch-build_config_clang_BUILD.gn
new file mode 100644
index 0000000000..ac61d77c2b
--- /dev/null
+++ b/electron32/patches/patch-build_config_clang_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/clang/BUILD.gn.orig 2024-10-18 12:33:59.902197600 +0000
++++ build/config/clang/BUILD.gn
+@@ -237,7 +237,7 @@ template("clang_lib") {
+
+ # Adds a dependency on the Clang runtime library clang_rt.builtins.
+ clang_lib("compiler_builtins") {
+- if (!toolchain_has_rust) {
++ if (!toolchain_has_rust || is_bsd) {
+ # Since there's no Rust in the toolchain, there's no concern that we'll use
+ # the Rust stdlib's intrinsics here.
+ #
diff --git a/electron32/patches/patch-build_config_compiler_BUILD.gn b/electron32/patches/patch-build_config_compiler_BUILD.gn
new file mode 100644
index 0000000000..67f2f1716c
--- /dev/null
+++ b/electron32/patches/patch-build_config_compiler_BUILD.gn
@@ -0,0 +1,144 @@
+$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 2024-10-18 12:33:59.902197600 +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() {
+@@ -251,13 +251,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 ---------------------------------------------------------------------
+@@ -503,6 +506,10 @@ config("compiler") {
+ }
+ }
+
++ if (is_openbsd) {
++ ldflags += [ "-Wl,-z,wxneeded" ]
++ }
++
+ # Linux-specific compiler flags setup.
+ # ------------------------------------
+ if (use_icf && (!is_apple || use_lld)) {
+@@ -556,7 +563,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 += [
+@@ -1197,7 +1204,7 @@ config("compiler_cpu_abi") {
+ ]
+ }
+ } else if (current_cpu == "arm") {
+- if (is_clang && !is_android && !is_nacl &&
++ if (is_clang && !is_android && !is_nacl && !is_bsd &&
+ !(is_chromeos_lacros && is_chromeos_device)) {
+ cflags += [ "--target=arm-linux-gnueabihf" ]
+ ldflags += [ "--target=arm-linux-gnueabihf" ]
+@@ -1212,7 +1219,7 @@ config("compiler_cpu_abi") {
+ cflags += [ "-mtune=$arm_tune" ]
+ }
+ } else if (current_cpu == "arm64") {
+- if (is_clang && !is_android && !is_nacl && !is_fuchsia &&
++ if (is_clang && !is_android && !is_nacl && !is_fuchsia && !is_bsd &&
+ !(is_chromeos_lacros && is_chromeos_device)) {
+ cflags += [ "--target=aarch64-linux-gnu" ]
+ ldflags += [ "--target=aarch64-linux-gnu" ]
+@@ -1547,7 +1554,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",
+@@ -1605,7 +1612,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",
+@@ -1938,9 +1945,6 @@ config("default_warnings") {
+
+ # TODO(crbug.com/40286317): Evaluate and possibly enable.
+ "-Wno-vla-extension",
+-
+- # TODO(crbug.com/40284799): Fix and re-enable.
+- "-Wno-thread-safety-reference-return",
+ ]
+
+ cflags_cc += [
+@@ -1948,14 +1952,11 @@ config("default_warnings") {
+ "-Wenum-compare-conditional",
+ ]
+
+- if (!is_nacl) {
++ if (!is_nacl && !is_openbsd) {
+ cflags_cc += [
+ # TODO(crbug.com/41486292): Fix and re-enable.
+ "-Wno-c++11-narrowing-const-reference",
+ ]
+-
+- # TODO(crbug.com/344680447): Fix and re-enable.
+- cflags_cc += [ "-Wno-missing-template-arg-list-after-template-kw" ]
+ }
+ }
+
+@@ -2676,7 +2677,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.
+@@ -2703,7 +2704,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 ]
+ }
+@@ -2868,7 +2869,7 @@ config("symbols") {
+ configs += [ "//build/config:compress_debug_sections" ]
+ }
+
+- 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/electron32/patches/patch-build_config_linux_BUILD.gn b/electron32/patches/patch-build_config_linux_BUILD.gn
new file mode 100644
index 0000000000..b925c226e5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.906195400 +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/electron32/patches/patch-build_config_linux_atk_BUILD.gn b/electron32/patches/patch-build_config_linux_atk_BUILD.gn
new file mode 100644
index 0000000000..be03cee3eb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.906195400 +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/electron32/patches/patch-build_config_linux_atspi2_BUILD.gn b/electron32/patches/patch-build_config_linux_atspi2_BUILD.gn
new file mode 100644
index 0000000000..d5d16d2290
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.906195400 +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/electron32/patches/patch-build_config_linux_gtk_BUILD.gn b/electron32/patches/patch-build_config_linux_gtk_BUILD.gn
new file mode 100644
index 0000000000..0dcb9bc318
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.906195400 +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/electron32/patches/patch-build_config_linux_pkg-config.py b/electron32/patches/patch-build_config_linux_pkg-config.py
new file mode 100644
index 0000000000..0a51e1a029
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.906195400 +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/electron32/patches/patch-build_config_ozone.gni b/electron32/patches/patch-build_config_ozone.gni
new file mode 100644
index 0000000000..387bf8be7f
--- /dev/null
+++ b/electron32/patches/patch-build_config_ozone.gni
@@ -0,0 +1,29 @@
+$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 2024-10-18 12:33:59.906195400 +0000
++++ build/config/ozone.gni
+@@ -84,7 +84,19 @@ 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_freebsd) {
+ ozone_platform = "x11"
+ ozone_platform_wayland = true
+ ozone_platform_x11 = true
diff --git a/electron32/patches/patch-build_config_rust.gni b/electron32/patches/patch-build_config_rust.gni
new file mode 100644
index 0000000000..32e7038a38
--- /dev/null
+++ b/electron32/patches/patch-build_config_rust.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/rust.gni.orig 2024-10-18 12:33:59.906195400 +0000
++++ build/config/rust.gni
+@@ -270,6 +270,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/electron32/patches/patch-build_config_v8__target__cpu.gni b/electron32/patches/patch-build_config_v8__target__cpu.gni
new file mode 100644
index 0000000000..c26d0119d1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.910193000 +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/electron32/patches/patch-build_detect__host__arch.py b/electron32/patches/patch-build_detect__host__arch.py
new file mode 100644
index 0000000000..838f8ab590
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.910193000 +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/electron32/patches/patch-build_gn__run__binary.py b/electron32/patches/patch-build_gn__run__binary.py
new file mode 100644
index 0000000000..c3c261d85f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.914190800 +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/electron32/patches/patch-build_linux_chrome.map b/electron32/patches/patch-build_linux_chrome.map
new file mode 100644
index 0000000000..1d4691fba8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.914190800 +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/electron32/patches/patch-build_linux_strip__binary.py b/electron32/patches/patch-build_linux_strip__binary.py
new file mode 100644
index 0000000000..ea62503942
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.914190800 +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/electron32/patches/patch-build_linux_unbundle_icu.gn b/electron32/patches/patch-build_linux_unbundle_icu.gn
new file mode 100644
index 0000000000..6e4ad7f9db
--- /dev/null
+++ b/electron32/patches/patch-build_linux_unbundle_icu.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
+
+--- build/linux/unbundle/icu.gn.orig 2024-10-18 12:33:59.918188600 +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
diff --git a/electron32/patches/patch-build_linux_unbundle_libevent.gn b/electron32/patches/patch-build_linux_unbundle_libevent.gn
new file mode 100644
index 0000000000..987b120f5b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.918188600 +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/electron32/patches/patch-build_linux_unbundle_libusb.gn b/electron32/patches/patch-build_linux_unbundle_libusb.gn
new file mode 100644
index 0000000000..6bad8e0c8b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.918188600 +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/electron32/patches/patch-build_rust_rust__bindgen.gni b/electron32/patches/patch-build_rust_rust__bindgen.gni
new file mode 100644
index 0000000000..460f8f5399
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.918188600 +0000
++++ build/rust/rust_bindgen.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/electron32/patches/patch-build_rust_std_BUILD.gn b/electron32/patches/patch-build_rust_std_BUILD.gn
new file mode 100644
index 0000000000..9fadea0903
--- /dev/null
+++ b/electron32/patches/patch-build_rust_std_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/rust/std/BUILD.gn.orig 2024-10-18 12:33:59.922186100 +0000
++++ build/rust/std/BUILD.gn
+@@ -100,7 +100,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",
diff --git a/electron32/patches/patch-build_toolchain_freebsd_BUILD.gn b/electron32/patches/patch-build_toolchain_freebsd_BUILD.gn
new file mode 100644
index 0000000000..327686e379
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.085518042 +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/electron32/patches/patch-build_toolchain_gcc__solink__wrapper.py b/electron32/patches/patch-build_toolchain_gcc__solink__wrapper.py
new file mode 100644
index 0000000000..5c5b28c3f0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.926184000 +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/electron32/patches/patch-build_toolchain_gcc__toolchain.gni b/electron32/patches/patch-build_toolchain_gcc__toolchain.gni
new file mode 100644
index 0000000000..dbeef17913
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.926184000 +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/electron32/patches/patch-build_toolchain_netbsd_BUILD.gn b/electron32/patches/patch-build_toolchain_netbsd_BUILD.gn
new file mode 100644
index 0000000000..1aa641cd1a
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.087771666 +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/electron32/patches/patch-build_toolchain_openbsd_BUILD.gn b/electron32/patches/patch-build_toolchain_openbsd_BUILD.gn
new file mode 100644
index 0000000000..603527cefa
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.088552208 +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/electron32/patches/patch-build_toolchain_toolchain.gni b/electron32/patches/patch-build_toolchain_toolchain.gni
new file mode 100644
index 0000000000..8e00aef4b4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.926184000 +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/electron32/patches/patch-build_toolchain_win_rc_rc.py b/electron32/patches/patch-build_toolchain_win_rc_rc.py
new file mode 100644
index 0000000000..63110a900e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.926184000 +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/electron32/patches/patch-buildtools_reclient__cfgs_.gitignore b/electron32/patches/patch-buildtools_reclient__cfgs_.gitignore
new file mode 100644
index 0000000000..2d684ac28b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +0000
++++ buildtools/reclient_cfgs/.gitignore
+@@ -1,4 +1,5 @@
+ /chromium-browser-clang/
+ /python/
++/nacl/
+ /win-cross/
+ reproxy.cfg
diff --git a/electron32/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py b/electron32/patches/patch-buildtools_reclient__cfgs_configure__reclient__cfgs.py
new file mode 100644
index 0000000000..f8e4046cd5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +0000
++++ buildtools/reclient_cfgs/configure_reclient_cfgs.py
+@@ -322,4 +322,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/electron32/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg b/electron32/patches/patch-buildtools_reclient__cfgs_nacl_rewrapper__linux.cfg
new file mode 100644
index 0000000000..8f07ee067e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +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/electron32/patches/patch-buildtools_third__party_libc++_BUILD.gn b/electron32/patches/patch-buildtools_third__party_libc++_BUILD.gn
new file mode 100644
index 0000000000..14e435a855
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +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/electron32/patches/patch-buildtools_third__party_libc++_____config__site b/electron32/patches/patch-buildtools_third__party_libc++_____config__site
new file mode 100644
index 0000000000..9251062d02
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +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/electron32/patches/patch-buildtools_third__party_libc++abi_BUILD.gn b/electron32/patches/patch-buildtools_third__party_libc++abi_BUILD.gn
new file mode 100644
index 0000000000..de9459b441
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.934179500 +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/electron32/patches/patch-cc_BUILD.gn b/electron32/patches/patch-cc_BUILD.gn
new file mode 100644
index 0000000000..42144996fe
--- /dev/null
+++ b/electron32/patches/patch-cc_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
+
+--- cc/BUILD.gn.orig 2024-10-18 12:33:59.934179500 +0000
++++ cc/BUILD.gn
+@@ -685,7 +685,7 @@ cc_test_static_library("test_support") {
+ if (enable_vulkan) {
+ deps += [ "//gpu/vulkan/init" ]
+ }
+- if (!is_android) {
++ if (!is_android && !is_bsd) {
+ data_deps = [ "//third_party/mesa_headers" ]
+ }
+ if (skia_use_dawn) {
+@@ -944,7 +944,6 @@ cc_test("cc_unittests") {
+ data = [ "//components/test/data/viz/" ]
+ data_deps = [
+ "//testing/buildbot/filters:cc_unittests_filters",
+- "//third_party/mesa_headers",
+ ]
+
+ if (is_android && enable_chrome_android_internal) {
diff --git a/electron32/patches/patch-cc_base_features.cc b/electron32/patches/patch-cc_base_features.cc
new file mode 100644
index 0000000000..fecf90ca86
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.938177000 +0000
++++ cc/base/features.cc
+@@ -85,7 +85,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/electron32/patches/patch-chrome_BUILD.gn b/electron32/patches/patch-chrome_BUILD.gn
new file mode 100644
index 0000000000..aa051ab648
--- /dev/null
+++ b/electron32/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 2024-10-18 12:33:59.998143200 +0000
++++ chrome/BUILD.gn
+@@ -192,11 +192,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",
+@@ -1567,7 +1572,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"
+@@ -1606,6 +1611,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/electron32/patches/patch-chrome_app_chrome__command__ids.h b/electron32/patches/patch-chrome_app_chrome__command__ids.h
new file mode 100644
index 0000000000..2b13b8f0c7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.238008500 +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/electron32/patches/patch-chrome_app_chrome__main.cc b/electron32/patches/patch-chrome_app_chrome__main.cc
new file mode 100644
index 0000000000..ccd45a2636
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.238008500 +0000
++++ chrome/app/chrome_main.cc
+@@ -30,11 +30,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
+
+@@ -55,7 +55,7 @@
+ #endif // BUILDFLAG(IS_WIN)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ #define ENABLE_OLD_HEADLESS
+ #endif
+
+@@ -119,7 +119,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
+
+@@ -185,7 +185,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/electron32/patches/patch-chrome_app_chrome__main__delegate.cc b/electron32/patches/patch-chrome_app_chrome__main__delegate.cc
new file mode 100644
index 0000000000..53e7bb2e1d
--- /dev/null
+++ b/electron32/patches/patch-chrome_app_chrome__main__delegate.cc
@@ -0,0 +1,158 @@
+$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 2024-10-18 12:34:00.238008500 +0000
++++ chrome/app/chrome_main_delegate.cc
+@@ -139,7 +139,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
+@@ -183,21 +183,21 @@
+ #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_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ #include "base/message_loop/message_pump_libevent.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) ||
+@@ -472,7 +472,7 @@ void SetCrashpadUploadConsentPostLogin()
+ }
+ #endif // 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;
+@@ -554,7 +554,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.
+@@ -638,7 +638,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.
+@@ -768,7 +768,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(
+@@ -962,7 +962,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();
+@@ -1160,7 +1160,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;
+@@ -1315,7 +1315,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
+@@ -1345,7 +1345,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
+
+@@ -1732,7 +1732,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)) {
+@@ -1828,13 +1828,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/electron32/patches/patch-chrome_browser_BUILD.gn b/electron32/patches/patch-chrome_browser_BUILD.gn
new file mode 100644
index 0000000000..c34fd73384
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.917626600 +0000
++++ chrome/browser/BUILD.gn
+@@ -4767,7 +4767,7 @@ static_library("browser") {
+
+ # On Windows, the hashes are embedded in //chrome:chrome_initial rather
+ # than here in :chrome_dll.
+- if (!is_win) {
++ if (!is_win && !is_electron_build) {
+ deps += [ "//chrome:packed_resources_integrity_header" ]
+ sources += [ "certificate_viewer_stub.cc" ]
+ }
+@@ -7013,6 +7013,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/electron32/patches/patch-chrome_browser_about__flags.cc b/electron32/patches/patch-chrome_browser_about__flags.cc
new file mode 100644
index 0000000000..58c386cea7
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_about__flags.cc
@@ -0,0 +1,299 @@
+$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 2024-10-18 12:34:00.921624400 +0000
++++ chrome/browser/about_flags.cc
+@@ -238,7 +238,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
+
+@@ -332,7 +332,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)
+
+@@ -341,7 +341,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/enterprise/profile_management/profile_management_features.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
+
+@@ -351,7 +351,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
+@@ -493,7 +493,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,
+@@ -893,6 +893,26 @@ 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 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 ALSA by default if available", kAudioBackendAlsa,
++ std::size(kAudioBackendAlsa),
++ nullptr}};
++#endif
++
+ const FeatureEntry::FeatureParam kClipboardMaximumAge60Seconds[] = {
+ {"UIClipboardMaximumAge", "60"}};
+ const FeatureEntry::FeatureParam kClipboardMaximumAge90Seconds[] = {
+@@ -1306,7 +1326,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"},
+ };
+@@ -1350,7 +1370,7 @@ const FeatureEntry::FeatureVariation
+ };
+
+ #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"},
+@@ -3779,7 +3799,7 @@ const flags_ui::FeatureEntry::FeatureVar
+ };
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const flags_ui::FeatureEntry::FeatureParam
+ kDesktopPWAsLinkCapturingDefaultOn[] = {
+ {"link_capturing_state", "on_by_default"}};
+@@ -4858,7 +4878,7 @@ const FeatureEntry kFeatureEntries[] = {
+ },
+ #endif // BUILDFLAG(IS_ANDROID)
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {
+ "fluent-overlay-scrollbars",
+ flag_descriptions::kFluentOverlayScrollbarsName,
+@@ -5277,7 +5297,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kWebAppUniversalInstallDescription, kOsDesktop,
+ FEATURE_VALUE_TYPE(features::kWebAppUniversalInstall)},
+ #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,
+@@ -5413,7 +5433,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,
+@@ -5436,9 +5456,19 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kWaylandPerWindowScalingName,
+ flag_descriptions::kWaylandPerWindowScalingDescription, kOsLinux,
+ FEATURE_VALUE_TYPE(features::kWaylandPerSurfaceScale)},
++
++#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,
+@@ -6433,7 +6463,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,
+@@ -6728,7 +6758,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,
+@@ -7397,7 +7427,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,
+@@ -8417,7 +8447,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,
+@@ -8441,7 +8471,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(media::kV4L2FlatStatefulVideoDecoder)},
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ {"enable-family-link-extensions-permissions",
+ flag_descriptions::
+ kEnableExtensionsPermissionsForSupervisedUsersOnDesktopName,
+@@ -9292,7 +9322,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(ash::features::kWallpaperPerDesk)},
+ #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,
+@@ -9331,7 +9361,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,
+@@ -9556,7 +9586,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ {"policy-indication-for-managed-default-search",
+ flag_descriptions::kPolicyIndicationForManagedDefaultSearchName,
+ flag_descriptions::kPolicyIndicationForManagedDefaultSearchDescription,
+@@ -9896,7 +9926,7 @@ const FeatureEntry kFeatureEntries[] = {
+ #endif
+
+ #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,
+@@ -10796,7 +10826,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),
+@@ -10834,7 +10864,7 @@ const FeatureEntry kFeatureEntries[] = {
+ FEATURE_VALUE_TYPE(features::kSiteInstanceGroupsForDataUrls)},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"site-search-settings-policy",
+ flag_descriptions::kSiteSearchSettingsPolicyName,
+ flag_descriptions::kSiteSearchSettingsPolicyDescription, kOsAll,
+@@ -10959,7 +10989,7 @@ const FeatureEntry kFeatureEntries[] = {
+ flag_descriptions::kHideIncognitoMediaMetadataDescription, kOsAll,
+ FEATURE_VALUE_TYPE(media::kHideIncognitoMediaMetadata)},
+
+-#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,
+@@ -11002,7 +11032,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-link-capturing-pwa",
+ flag_descriptions::kDesktopPWAsUserLinkCapturingName,
+ flag_descriptions::kDesktopPWAsUserLinkCapturingDescription,
+@@ -11318,7 +11348,7 @@ const FeatureEntry kFeatureEntries[] = {
+ trusted_vault::kTrustedVaultFrequentDegradedRecoverabilityPolling)},
+ #endif
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ {"restart-to-gain-access-to-keychain",
+ flag_descriptions::kRestartToGainAccessToKeychainName,
+ flag_descriptions::kRestartToGainAccessToKeychainDescription,
+@@ -11981,7 +12011,7 @@ const FeatureEntry kFeatureEntries[] = {
+ kAuthenticateUsingUserConsentVerifierInteropApi)},
+ #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,
+@@ -12007,7 +12037,7 @@ const FeatureEntry kFeatureEntries[] = {
+ "AutofillUploadCardRequestTimeout")},
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ {"autofill-enable-amount-extraction-desktop",
+ flag_descriptions::kAutofillEnableAmountExtractionDesktopName,
+ flag_descriptions::kAutofillEnableAmountExtractionDesktopDescription,
diff --git a/electron32/patches/patch-chrome_browser_accessibility_page__colors.cc b/electron32/patches/patch-chrome_browser_accessibility_page__colors.cc
new file mode 100644
index 0000000000..085cb8c76b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.925622000 +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/electron32/patches/patch-chrome_browser_after__startup__task__utils.cc b/electron32/patches/patch-chrome_browser_after__startup__task__utils.cc
new file mode 100644
index 0000000000..e890997d16
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.925622000 +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/electron32/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc b/electron32/patches/patch-chrome_browser_apps_app__service_publishers_extension__apps.cc
new file mode 100644
index 0000000000..cb6cd29937
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:00.997581700 +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/electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc b/electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.cc
new file mode 100644
index 0000000000..011cc4a68c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.009575000 +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/electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h b/electron32/patches/patch-chrome_browser_apps_platform__apps_platform__app__launch.h
new file mode 100644
index 0000000000..4ab6558949
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.009575000 +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/electron32/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc b/electron32/patches/patch-chrome_browser_autocomplete_chrome__autocomplete__scheme__classifier.cc
new file mode 100644
index 0000000000..d923427041
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.349385300 +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/electron32/patches/patch-chrome_browser_background_background__mode__manager.cc b/electron32/patches/patch-chrome_browser_background_background__mode__manager.cc
new file mode 100644
index 0000000000..346c3c8732
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.361378700 +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/electron32/patches/patch-chrome_browser_background_background__mode__optimizer.cc b/electron32/patches/patch-chrome_browser_background_background__mode__optimizer.cc
new file mode 100644
index 0000000000..d983d79e74
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.361378700 +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/electron32/patches/patch-chrome_browser_browser__features.cc b/electron32/patches/patch-chrome_browser_browser__features.cc
new file mode 100644
index 0000000000..b3d13f7423
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_browser__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
+
+--- chrome/browser/browser_features.cc.orig 2024-10-18 12:34:01.365376200 +0000
++++ chrome/browser/browser_features.cc
+@@ -69,7 +69,7 @@ BASE_FEATURE(kClosedTabCache,
+ 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);
+@@ -316,7 +316,7 @@ BASE_FEATURE(kSandboxExternalProtocolBlo
+ BASE_FEATURE(kSupportSearchSuggestionForPrerender2,
+ "SupportSearchSuggestionForPrerender2",
+ #if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_CHROMEOS_LACROS) || \
+- BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT);
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT);
diff --git a/electron32/patches/patch-chrome_browser_browser__process__impl.cc b/electron32/patches/patch-chrome_browser_browser__process__impl.cc
new file mode 100644
index 0000000000..c3c423799e
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_browser__process__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/browser_process_impl.cc.orig 2024-10-18 12:34:01.365376200 +0000
++++ chrome/browser/browser_process_impl.cc
+@@ -227,7 +227,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
+
+@@ -1277,7 +1277,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
+
+@@ -1615,7 +1615,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/electron32/patches/patch-chrome_browser_browser__process__impl.h b/electron32/patches/patch-chrome_browser_browser__process__impl.h
new file mode 100644
index 0000000000..aee0cc319a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.365376200 +0000
++++ chrome/browser/browser_process_impl.h
+@@ -404,7 +404,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/electron32/patches/patch-chrome_browser_chrome__browser__field__trials.cc b/electron32/patches/patch-chrome_browser_chrome__browser__field__trials.cc
new file mode 100644
index 0000000000..7ef8671887
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.377369600 +0000
++++ chrome/browser/chrome_browser_field_trials.cc
+@@ -48,7 +48,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)
+@@ -155,7 +155,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/electron32/patches/patch-chrome_browser_chrome__browser__field__trials.h b/electron32/patches/patch-chrome_browser_chrome__browser__field__trials.h
new file mode 100644
index 0000000000..8d8fd0db73
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.377369600 +0000
++++ chrome/browser/chrome_browser_field_trials.h
+@@ -34,7 +34,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/electron32/patches/patch-chrome_browser_chrome__browser__interface__binders.cc b/electron32/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
new file mode 100644
index 0000000000..5b098328ec
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_chrome__browser__interface__binders.cc
@@ -0,0 +1,95 @@
+$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 2024-10-18 12:34:01.377369600 +0000
++++ chrome/browser/chrome_browser_interface_binders.cc
+@@ -133,12 +133,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 "ui/webui/resources/cr_components/app_management/app_management.mojom.h"
+ #endif
+@@ -226,7 +226,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/companion/visual_query/visual_query_suggestions_service_factory.h"
+ #include "chrome/browser/ui/web_applications/sub_apps_service_impl.h"
+ #include "chrome/browser/ui/webui/discards/discards.mojom.h"
+@@ -237,7 +237,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)
+
+@@ -864,7 +864,7 @@ void BindScreen2xMainContentExtractor(
+ #endif
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ void BindVisualSuggestionsModelProvider(
+ content::RenderFrameHost* frame_host,
+ mojo::PendingReceiver<
+@@ -1060,7 +1060,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
+@@ -1158,7 +1158,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);
+@@ -1169,7 +1169,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);
+ #endif
+@@ -1261,7 +1261,7 @@ void PopulateChromeWebUIFrameBinders(
+
+ 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);
+@@ -1753,7 +1753,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/electron32/patches/patch-chrome_browser_chrome__browser__main.cc b/electron32/patches/patch-chrome_browser_chrome__browser__main.cc
new file mode 100644
index 0000000000..2759e3e855
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +0000
++++ chrome/browser/chrome_browser_main.cc
+@@ -251,15 +251,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
+
+@@ -292,14 +292,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"
+@@ -371,14 +371,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");
+
+@@ -543,7 +543,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.
+@@ -1109,7 +1109,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 .
+@@ -1157,7 +1157,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(
+@@ -1344,7 +1344,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(
+@@ -1393,7 +1393,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();
+ }
+@@ -1505,7 +1505,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();
+ }
+@@ -2056,7 +2056,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/electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc b/electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__linux.cc
new file mode 100644
index 0000000000..82ff9d4345
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +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/electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc b/electron32/patches/patch-chrome_browser_chrome__browser__main__extra__parts__ozone.cc
new file mode 100644
index 0000000000..a3bd54abe1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +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/electron32/patches/patch-chrome_browser_chrome__browser__main__linux.cc b/electron32/patches/patch-chrome_browser_chrome__browser__main__linux.cc
new file mode 100644
index 0000000000..e8781938da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +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
+
+@@ -84,7 +84,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
+@@ -110,7 +112,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();
+@@ -169,7 +171,7 @@ void ChromeBrowserMainPartsLinux::CheckI
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ 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/electron32/patches/patch-chrome_browser_chrome__browser__main__linux.h b/electron32/patches/patch-chrome_browser_chrome__browser__main__linux.h
new file mode 100644
index 0000000000..436392acad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +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/electron32/patches/patch-chrome_browser_chrome__browser__main__posix.cc b/electron32/patches/patch-chrome_browser_chrome__browser__main__posix.cc
new file mode 100644
index 0000000000..2899445ffd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +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/electron32/patches/patch-chrome_browser_chrome__content__browser__client.cc b/electron32/patches/patch-chrome_browser_chrome__content__browser__client.cc
new file mode 100644
index 0000000000..bd1b967611
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_chrome__content__browser__client.cc
@@ -0,0 +1,167 @@
+$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 2024-10-18 12:34:01.381367400 +0000
++++ chrome/browser/chrome_content_browser_client.cc
+@@ -477,7 +477,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)
+@@ -593,12 +593,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
+@@ -609,7 +609,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"
+@@ -617,7 +617,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)
+@@ -632,7 +632,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"
+@@ -1572,7 +1572,7 @@ void ChromeContentBrowserClient::Registe
+ #if BUILDFLAG(IS_CHROMEOS)
+ registry->RegisterBooleanPref(prefs::kNativeClientForceAllowed, 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)
+@@ -1772,7 +1772,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)
+@@ -1806,7 +1806,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
+@@ -1827,7 +1827,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>());
+@@ -1846,7 +1846,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<
+ chrome::enterprise_util::ChromeBrowserMainExtraPartsEnterprise>());
+@@ -2708,7 +2708,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(
+@@ -3060,7 +3060,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)) {
+@@ -4888,7 +4888,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,
+@@ -5479,7 +5479,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);
+@@ -5493,7 +5493,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);
+@@ -5532,7 +5532,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);
+@@ -7442,7 +7442,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/electron32/patches/patch-chrome_browser_chrome__content__browser__client.h b/electron32/patches/patch-chrome_browser_chrome__content__browser__client.h
new file mode 100644
index 0000000000..2ea00f657b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.381367400 +0000
++++ chrome/browser/chrome_content_browser_client.h
+@@ -523,7 +523,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/electron32/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc b/electron32/patches/patch-chrome_browser_component__updater_widevine__cdm__component__installer.cc
new file mode 100644
index 0000000000..240a03ba4d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.425342800 +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/electron32/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc b/electron32/patches/patch-chrome_browser_custom__handlers_chrome__protocol__handler__registry__delegate.cc
new file mode 100644
index 0000000000..30b9ef83f4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.437336200 +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/electron32/patches/patch-chrome_browser_defaults.cc b/electron32/patches/patch-chrome_browser_defaults.cc
new file mode 100644
index 0000000000..90ee8b519c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.437336200 +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/electron32/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc b/electron32/patches/patch-chrome_browser_device__identity_device__oauth2__token__service__factory.cc
new file mode 100644
index 0000000000..9fa98309a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.441334000 +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_IN_MIGRATION();
diff --git a/electron32/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h b/electron32/patches/patch-chrome_browser_diagnostics_diagnostics__writer.h
new file mode 100644
index 0000000000..71dd08f15d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.449329400 +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/electron32/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc b/electron32/patches/patch-chrome_browser_download_chrome__download__manager__delegate.cc
new file mode 100644
index 0000000000..44a49f22eb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.461322800 +0000
++++ chrome/browser/download/chrome_download_manager_delegate.cc
+@@ -1753,7 +1753,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();
+ }
+@@ -1901,7 +1901,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()) {
+@@ -1979,7 +1979,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/electron32/patches/patch-chrome_browser_download_download__commands.cc b/electron32/patches/patch-chrome_browser_download_download__commands.cc
new file mode 100644
index 0000000000..d3f41bd251
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.461322800 +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"
+@@ -167,7 +167,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/electron32/patches/patch-chrome_browser_download_download__commands.h b/electron32/patches/patch-chrome_browser_download_download__commands.h
new file mode 100644
index 0000000000..465b4b032b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.465320600 +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/electron32/patches/patch-chrome_browser_download_download__file__picker.cc b/electron32/patches/patch-chrome_browser_download_download__file__picker.cc
new file mode 100644
index 0000000000..05b84a81cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.465320600 +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/electron32/patches/patch-chrome_browser_download_download__item__model.cc b/electron32/patches/patch-chrome_browser_download_download__item__model.cc
new file mode 100644
index 0000000000..10c236c963
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.465320600 +0000
++++ chrome/browser/download/download_item_model.cc
+@@ -814,7 +814,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();
+@@ -862,7 +862,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);
+@@ -1260,7 +1260,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/electron32/patches/patch-chrome_browser_download_download__prefs.cc b/electron32/patches/patch-chrome_browser_download_download__prefs.cc
new file mode 100644
index 0000000000..ae7e2d3202
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.465320600 +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"
+@@ -64,6 +65,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;
+@@ -74,7 +79,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;
+@@ -180,7 +185,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
+@@ -304,7 +309,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)
+@@ -469,7 +474,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;
+@@ -501,7 +506,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();
+@@ -538,7 +543,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;
+@@ -690,7 +695,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/electron32/patches/patch-chrome_browser_download_download__prefs.h b/electron32/patches/patch-chrome_browser_download_download__prefs.h
new file mode 100644
index 0000000000..e154f7a600
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.465320600 +0000
++++ chrome/browser/download/download_prefs.h
+@@ -115,7 +115,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);
+@@ -179,7 +179,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/electron32/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_analysis_analysis__service__settings.cc
new file mode 100644
index 0000000000..567de8a8cc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.477313800 +0000
++++ chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc
+@@ -151,7 +151,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/electron32/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_connectors__service.cc
new file mode 100644
index 0000000000..9510be0e44
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.481311600 +0000
++++ chrome/browser/enterprise/connectors/connectors_service.cc
+@@ -570,7 +570,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/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__connector__service__factory.cc
new file mode 100644
index 0000000000..78eea6997d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.485309400 +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/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_device__trust__service__factory.cc
new file mode 100644
index 0000000000..4433d3eb71
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.485309400 +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/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_browser_commands_key__rotation__command__factory.cc
new file mode 100644
index 0000000000..656fb6a8e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.485309400 +0000
++++ chrome/browser/enterprise/connectors/device_trust/key_management/browser/commands/key_rotation_command_factory.cc
+@@ -14,7 +14,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"
+@@ -47,7 +47,7 @@ std::unique_ptr<KeyRotationCommand> KeyR
+ scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory) {
+ #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)
+ return std::make_unique<MacKeyRotationCommand>(url_loader_factory);
diff --git a/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_key__management_core_persistence_key__persistence__delegate__factory.cc
new file mode 100644
index 0000000000..028e6711ad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.489307200 +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_IN_MIGRATION();
diff --git a/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_device__trust_signals_signals__service__factory.cc
new file mode 100644
index 0000000000..efdefaf08d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.489307200 +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/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_browser__crash__event__router.cc
new file mode 100644
index 0000000000..2f81072bfc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.493305000 +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/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_crash__reporting__context.cc
new file mode 100644
index 0000000000..057488d0c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.493305000 +0000
++++ chrome/browser/enterprise/connectors/reporting/crash_reporting_context.cc
+@@ -19,7 +19,7 @@
+
+ namespace enterprise_connectors {
+
+-#if !BUILDFLAG(IS_CHROMEOS)
++#if !BUILDFLAG(IS_CHROMEOS) && !BUILDFLAG(IS_BSD)
+
+ namespace {
+
diff --git a/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.cc
new file mode 100644
index 0000000000..bd768c86b5
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.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/enterprise/connectors/reporting/realtime_reporting_client.cc.orig 2024-10-18 12:34:01.493305000 +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"
+@@ -133,7 +133,7 @@ void UploadSecurityEventReport(base::Val
+ std::move(upload_callback));
+ }
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void PopulateSignals(base::Value::Dict event,
+ policy::CloudPolicyClient* client,
+ std::string name,
+@@ -421,7 +421,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,
+@@ -480,7 +480,7 @@ void RealtimeReportingClient::ReportEven
+ if (include_profile_user_name) {
+ event.Set(kKeyProfileUserName, GetProfileUserName());
+ }
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ Profile* profile = Profile::FromBrowserContext(context_);
+ device_signals::SignalsAggregator* signals_aggregator =
+ enterprise_signals::SignalsAggregatorFactory::GetForProfile(profile);
+@@ -505,7 +505,7 @@ std::string RealtimeReportingClient::Get
+ ? safe_browsing::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);
diff --git a/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__client.h
new file mode 100644
index 0000000000..9132d4bda6
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_enterprise_connectors_reporting_realtime__reporting__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
+
+--- chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h.orig 2024-10-18 12:34:01.493305000 +0000
++++ chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.h
+@@ -16,7 +16,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
+
+@@ -184,7 +184,7 @@ class RealtimeReportingClient : public K
+ 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/electron32/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc b/electron32/patches/patch-chrome_browser_enterprise_identifiers_profile__id__delegate__impl.cc
new file mode 100644
index 0000000000..573803e9a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.497302800 +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/electron32/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc b/electron32/patches/patch-chrome_browser_enterprise_profile__management_profile__management__navigation__throttle.cc
new file mode 100644
index 0000000000..736bbb7c2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.497302800 +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/electron32/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc b/electron32/patches/patch-chrome_browser_enterprise_remote__commands_cbcm__remote__commands__factory.cc
new file mode 100644
index 0000000000..fe46025273
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.497302800 +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/electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc b/electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher.cc
new file mode 100644
index 0000000000..6bee19d419
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.501300600 +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/electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc b/electron32/patches/patch-chrome_browser_enterprise_signals_device__info__fetcher__linux.cc
new file mode 100644
index 0000000000..0c5f28bb7a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.501300600 +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/electron32/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h b/electron32/patches/patch-chrome_browser_enterprise_signin_enterprise__signin__service.h
new file mode 100644
index 0000000000..544be73998
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.501300600 +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/electron32/patches/patch-chrome_browser_extensions_BUILD.gn b/electron32/patches/patch-chrome_browser_extensions_BUILD.gn
new file mode 100644
index 0000000000..22cc9a437e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.505298100 +0000
++++ chrome/browser/extensions/BUILD.gn
+@@ -1513,6 +1513,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_service_discovery) {
+ sources += [
+ "api/mdns/mdns_api.cc",
diff --git a/electron32/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc b/electron32/patches/patch-chrome_browser_extensions_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 0000000000..00098def75
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.509296000 +0000
++++ chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc
+@@ -44,7 +44,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
+
+@@ -120,7 +120,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/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_chrome__desktop__report__request__helper.cc
new file mode 100644
index 0000000000..dfdede4de1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.521289300 +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/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.cc
new file mode 100644
index 0000000000..a879a2ecb4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.525287200 +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/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_conversion__utils.h
new file mode 100644
index 0000000000..f638be73a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.525287200 +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/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.cc
new file mode 100644
index 0000000000..4206dd0770
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.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/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc.orig 2024-10-18 12:34:01.525287200 +0000
++++ chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
+@@ -33,7 +33,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"
+@@ -150,7 +150,7 @@ api::enterprise_reporting_private::Conte
+ return info;
+ }
+
+-#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) {
+@@ -211,7 +211,7 @@ EnterpriseReportingPrivateGetDeviceIdFun
+
+ // getPersistentSecret
+
+-#if !BUILDFLAG(IS_LINUX)
++#if !BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_BSD)
+
+ EnterpriseReportingPrivateGetPersistentSecretFunction::
+ EnterpriseReportingPrivateGetPersistentSecretFunction() = default;
+@@ -637,7 +637,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/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h b/electron32/patches/patch-chrome_browser_extensions_api_enterprise__reporting__private_enterprise__reporting__private__api.h
new file mode 100644
index 0000000000..b50adffeef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.525287200 +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/electron32/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc b/electron32/patches/patch-chrome_browser_extensions_api_image__writer__private_removable__storage__provider.cc
new file mode 100644
index 0000000000..46fb57def7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.529285000 +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/electron32/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc b/electron32/patches/patch-chrome_browser_extensions_api_management_chrome__management__api__delegate.cc
new file mode 100644
index 0000000000..2a901fd2a3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.533282500 +0000
++++ chrome/browser/extensions/api/management/chrome_management_api_delegate.cc
+@@ -417,7 +417,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/electron32/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc b/electron32/patches/patch-chrome_browser_extensions_api_messaging_launch__context__posix.cc
new file mode 100644
index 0000000000..110c9ec52e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.533282500 +0000
++++ chrome/browser/extensions/api/messaging/launch_context_posix.cc
+@@ -86,7 +86,7 @@ std::optional<LaunchContext::ProcessStat
+
+ // 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)
+ // 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/electron32/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc b/electron32/patches/patch-chrome_browser_extensions_api_passwords__private_passwords__private__delegate__impl.cc
new file mode 100644
index 0000000000..a1069790e6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.537280300 +0000
++++ chrome/browser/extensions/api/passwords_private/passwords_private_delegate_impl.cc
+@@ -630,7 +630,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/electron32/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc b/electron32/patches/patch-chrome_browser_extensions_api_runtime_chrome__runtime__api__delegate.cc
new file mode 100644
index 0000000000..d0b086fc28
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.545276000 +0000
++++ chrome/browser/extensions/api/runtime/chrome_runtime_api_delegate.cc
+@@ -284,7 +284,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_IN_MIGRATION() << "Platform not supported: " << os;
+ return false;
diff --git a/electron32/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc b/electron32/patches/patch-chrome_browser_extensions_api_settings__private_prefs__util.cc
new file mode 100644
index 0000000000..6a61c1d97e
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_extensions_api_settings__private_prefs__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/extensions/api/settings_private/prefs_util.cc.orig 2024-10-18 12:34:01.545276000 +0000
++++ chrome/browser/extensions/api/settings_private/prefs_util.cc
+@@ -205,7 +205,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
+@@ -217,7 +217,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/electron32/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc b/electron32/patches/patch-chrome_browser_extensions_api_tabs_tabs__api.cc
new file mode 100644
index 0000000000..52299a4b04
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.553271500 +0000
++++ chrome/browser/extensions/api/tabs/tabs_api.cc
+@@ -892,7 +892,7 @@ ExtensionFunction::ResponseAction Window
+ // 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::SHOW_STATE_MINIMIZED) {
+ new_window->window()->Minimize();
+ }
diff --git a/electron32/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc b/electron32/patches/patch-chrome_browser_extensions_api_webrtc__logging__private_webrtc__logging__private__api.cc
new file mode 100644
index 0000000000..53369bf165
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.557269300 +0000
++++ chrome/browser/extensions/api/webrtc_logging_private/webrtc_logging_private_api.cc
+@@ -29,7 +29,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
+
+@@ -38,7 +38,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(
+@@ -576,7 +576,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/electron32/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc b/electron32/patches/patch-chrome_browser_extensions_api_webstore__private_webstore__private__api.cc
new file mode 100644
index 0000000000..73f3523766
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.557269300 +0000
++++ chrome/browser/extensions/api/webstore_private/webstore_private_api.cc
+@@ -910,7 +910,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/electron32/patches/patch-chrome_browser_extensions_external__provider__impl.cc b/electron32/patches/patch-chrome_browser_extensions_external__provider__impl.cc
new file mode 100644
index 0000000000..4789241f29
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.577258000 +0000
++++ chrome/browser/extensions/external_provider_impl.cc
+@@ -834,7 +834,7 @@ void ExternalProviderImpl::CreateExterna
+ if (!profile->GetPrefs()->GetBoolean(pref_names::kBlockExternalExtensions)) {
+ // 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)
+ provider_list->push_back(std::make_unique<ExternalProviderImpl>(
+ service,
+ base::MakeRefCounted<ExternalPrefLoader>(
+@@ -862,7 +862,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/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc b/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.cc
new file mode 100644
index 0000000000..536e81dc38
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.581256000 +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/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.h b/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener.h
new file mode 100644
index 0000000000..73c7ff20ee
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.581256000 +0000
++++ chrome/browser/extensions/global_shortcut_listener.h
+@@ -33,6 +33,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/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc b/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.cc
new file mode 100644
index 0000000000..ffe7214462
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.581256000 +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/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h b/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__ozone.h
new file mode 100644
index 0000000000..dd92a9bef3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.581256000 +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/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc b/electron32/patches/patch-chrome_browser_extensions_global__shortcut__listener__win.cc
new file mode 100644
index 0000000000..5380d78008
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.581256000 +0000
++++ chrome/browser/extensions/global_shortcut_listener_win.cc
+@@ -63,6 +63,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);
+
+@@ -93,6 +95,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/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc b/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.cc
new file mode 100644
index 0000000000..55e2a9e094
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.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/file_system_access/chrome_file_system_access_permission_context.cc.orig 2024-10-18 12:34:01.613238000 +0000
++++ chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+@@ -39,7 +39,6 @@
+ #include "chrome/browser/safe_browsing/download_protection/download_protection_util.h"
+ #include "chrome/browser/ui/browser_finder.h"
+ #include "chrome/browser/ui/file_system_access_dialogs.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"
+@@ -225,118 +224,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},
+- {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)
+- // 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
+- // 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/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h b/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
new file mode 100644
index 0000000000..4c77a62ef9
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_file__system__access_chrome__file__system__access__permission__context.h
@@ -0,0 +1,162 @@
+$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 2024-10-18 12:34:01.613238000 +0000
++++ chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
+@@ -17,12 +17,13 @@
+ #include "base/time/default_clock.h"
+ #include "chrome/browser/file_system_access/file_system_access_features.h"
+ #include "chrome/browser/file_system_access/file_system_access_permission_request_manager.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"
+ #include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-forward.h"
+
++
+ #if !BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/permissions/one_time_permissions_tracker.h"
+ #include "chrome/browser/permissions/one_time_permissions_tracker_observer.h"
+@@ -30,7 +31,8 @@
+ #include "chrome/browser/web_applications/web_app_install_manager_observer.h"
+ #endif
+
+-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS)
++#if 0
++#include "components/enterprise/buildflags/buildflags.h"
+ #include "chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h"
+ #include "components/enterprise/common/files_scan_data.h"
+ #endif
+@@ -337,6 +339,119 @@ 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 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},
++ {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_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("/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
++ // TODO(crbug.com/40095723): Refine this list, for example add
++ // XDG_CONFIG_HOME when it is not set ~/.config?
++ };
++
+ protected:
+ SEQUENCE_CHECKER(sequence_checker_);
+
+@@ -356,7 +471,7 @@ class ChromeFileSystemAccessPermissionCo
+
+ void PermissionGrantDestroyed(PermissionGrantImpl* grant);
+
+-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS)
++#if 0
+ void OnContentAnalysisComplete(
+ std::vector<PathInfo> entries,
+ EntriesAllowedByEnterprisePolicyCallback callback,
diff --git a/electron32/patches/patch-chrome_browser_first__run_first__run__dialog.h b/electron32/patches/patch-chrome_browser_first__run_first__run__dialog.h
new file mode 100644
index 0000000000..fa33f71f03
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.613238000 +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/electron32/patches/patch-chrome_browser_first__run_first__run__internal.h b/electron32/patches/patch-chrome_browser_first__run_first__run__internal.h
new file mode 100644
index 0000000000..c7346f4d28
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.613238000 +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/electron32/patches/patch-chrome_browser_flag__descriptions.cc b/electron32/patches/patch-chrome_browser_flag__descriptions.cc
new file mode 100644
index 0000000000..49581d4c11
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_flag__descriptions.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
+
+--- chrome/browser/flag_descriptions.cc.orig 2024-10-18 12:34:01.617235700 +0000
++++ chrome/browser/flag_descriptions.cc
+@@ -419,7 +419,7 @@ const char kIsolatedSandboxedIframesDesc
+ "grouping when enabled is per-site.";
+
+ #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[] =
+@@ -856,7 +856,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[] =
+@@ -3050,7 +3050,7 @@ const char kCbdTimeframeRequiredDescript
+ "value to the list.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ const char kPolicyIndicationForManagedDefaultSearchName[] =
+ "Enable policy indication for managed Default Search provider";
+ const char kPolicyIndicationForManagedDefaultSearchDescription[] =
+@@ -3385,7 +3385,7 @@ const char kShowAutofillTypePredictionsD
+ "text.";
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const char kShowFeaturedEnterpriseSiteSearchName[] =
+ "Show featured Enterprise site search engines in Omnibox";
+ const char kShowFeaturedEnterpriseSiteSearchDescription[] =
+@@ -3422,7 +3422,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 kSiteSearchSettingsPolicyName[] = "Enable SiteSearchSettings policy";
+ const char kSiteSearchSettingsPolicyDescription[] =
+ "Allow site search engines to be defined by the SiteSearchSettings policy.";
+@@ -7869,7 +7869,7 @@ const char kLacrosMergeIcuDataFileDescri
+ "Enables sharing common areas of icudtl.dat between Ash and Lacros.";
+ #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 "
+@@ -8126,7 +8126,7 @@ const char kV4L2FlatStatefulVideoDecoder
+
+ // Linux -----------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const char kOzonePlatformHintChoiceDefault[] = "Default";
+ const char kOzonePlatformHintChoiceAuto[] = "Auto";
+ const char kOzonePlatformHintChoiceX11[] = "X11";
+@@ -8156,6 +8156,18 @@ const char kSimplifiedTabDragUIDescripti
+ const char kWaylandPerWindowScalingName[] = "Wayland per-window scaling";
+ const char kWaylandPerWindowScalingDescription[] =
+ "Enable Wayland's per-window scaling experimental support.";
++
++#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_FREEBSD) || BUILDFLAG(IS_NETBSD)
++ "Select the desired audio backend to use. The default will automatically "
++ "enumerate through the supported backends.";
++#endif
++#endif
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // All views-based platforms --------------------------------------------------
+@@ -8182,14 +8194,14 @@ 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.";
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+-#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[] =
+@@ -8221,7 +8233,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.";
+@@ -8375,7 +8387,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.";
+@@ -8449,7 +8461,7 @@ const char kAutofillCaretExtractionDescr
+ "Enables passing caret position via Autofill";
+ #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[] =
diff --git a/electron32/patches/patch-chrome_browser_flag__descriptions.h b/electron32/patches/patch-chrome_browser_flag__descriptions.h
new file mode 100644
index 0000000000..56a9e1d5d8
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_flag__descriptions.h
@@ -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/flag_descriptions.h.orig 2024-10-18 12:34:01.617235700 +0000
++++ chrome/browser/flag_descriptions.h
+@@ -273,7 +273,7 @@ extern const char kImageDescriptionsAlte
+ extern const char kImageDescriptionsAlternateRoutingDescription[];
+
+ #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
+@@ -660,7 +660,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) ||
+@@ -1764,7 +1764,7 @@ extern const char kCbdTimeframeRequiredN
+ extern const char kCbdTimeframeRequiredDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ extern const char kPolicyIndicationForManagedDefaultSearchName[];
+ extern const char kPolicyIndicationForManagedDefaultSearchDescription[];
+ #endif
+@@ -1958,7 +1958,7 @@ extern const char kShowAutofillTypePredi
+ extern const char kShowAutofillTypePredictionsDescription[];
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ extern const char kShowFeaturedEnterpriseSiteSearchName[];
+ extern const char kShowFeaturedEnterpriseSiteSearchDescription[];
+
+@@ -1980,7 +1980,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 kSiteSearchSettingsPolicyName[];
+ extern const char kSiteSearchSettingsPolicyDescription[];
+
+@@ -4557,7 +4557,7 @@ extern const char kLacrosMergeIcuDataFil
+ extern const char kLacrosMergeIcuDataFileDescription[];
+ #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)
+@@ -4705,7 +4705,7 @@ extern const char kV4L2FlatStatefulVideo
+
+ // Linux ---------------------------------------------------------------------
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ extern const char kOzonePlatformHintChoiceDefault[];
+ extern const char kOzonePlatformHintChoiceAuto[];
+ extern const char kOzonePlatformHintChoiceX11[];
+@@ -4724,6 +4724,9 @@ extern const char kSimplifiedTabDragUIDe
+
+ extern const char kWaylandPerWindowScalingName[];
+ extern const char kWaylandPerWindowScalingDescription[];
++
++extern const char kAudioBackendName[];
++extern const char kAudioBackendDescription[];
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // All views-based platforms --------------------------------------------------
+@@ -4753,7 +4756,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[];
+
+@@ -4772,13 +4775,13 @@ extern const char kScreenlockReauthPromo
+ #endif // 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)
+ extern const char kFollowingFeedSidepanelName[];
+ extern const char kFollowingFeedSidepanelDescription[];
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+-#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[];
+
+@@ -4877,7 +4880,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
+@@ -4931,7 +4934,7 @@ extern const char kAutofillCaretExtracti
+ extern const char kAutofillCaretExtractionDescription[];
+ #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[];
+
diff --git a/electron32/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc b/electron32/patches/patch-chrome_browser_gcm_gcm__profile__service__factory.cc
new file mode 100644
index 0000000000..a8a7e3b7e4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.621233500 +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/electron32/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc b/electron32/patches/patch-chrome_browser_gcm_instance__id_instance__id__profile__service__factory.cc
new file mode 100644
index 0000000000..b8f1539a2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.621233500 +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/electron32/patches/patch-chrome_browser_global__desktop__features.cc b/electron32/patches/patch-chrome_browser_global__desktop__features.cc
new file mode 100644
index 0000000000..10725775f2
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_global__desktop__features.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/global_desktop_features.cc.orig 2024-10-18 12:34:01.621233500 +0000
++++ chrome/browser/global_desktop_features.cc
+@@ -45,14 +45,14 @@ void GlobalDesktopFeatures::ReplaceGloba
+ }
+
+ void GlobalDesktopFeatures::Init() {
+-#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();
+ }
+ #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<whats_new::WhatsNewRegistry>
+ GlobalDesktopFeatures::CreateWhatsNewRegistry() {
+ return whats_new::CreateWhatsNewRegistry();
diff --git a/electron32/patches/patch-chrome_browser_global__desktop__features.h b/electron32/patches/patch-chrome_browser_global__desktop__features.h
new file mode 100644
index 0000000000..cfca7ac750
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_global__desktop__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_desktop_features.h.orig 2024-10-18 12:34:01.621233500 +0000
++++ chrome/browser/global_desktop_features.h
+@@ -9,7 +9,7 @@
+ #include "build/build_config.h"
+
+ 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
+@@ -37,7 +37,7 @@ class GlobalDesktopFeatures {
+ // Public accessors for features, e.g.
+ // FooFeature* foo_feature() { return foo_feature_.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();
+ }
+@@ -50,7 +50,7 @@ class GlobalDesktopFeatures {
+ // testing. e.g.
+ // virtual std::unique_ptr<FooFeature> CreateFooFeature();
+
+-#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
+
+@@ -58,7 +58,7 @@ class GlobalDesktopFeatures {
+ // Features will each have a controller. e.g.
+ // std::unique_ptr<FooFeature> foo_feature_;
+
+-#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/electron32/patches/patch-chrome_browser_headless_headless__mode__util.cc b/electron32/patches/patch-chrome_browser_headless_headless__mode__util.cc
new file mode 100644
index 0000000000..33d52004bb
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_headless_headless__mode__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/headless/headless_mode_util.cc.orig 2024-10-18 12:34:01.625231300 +0000
++++ chrome/browser/headless/headless_mode_util.cc
+@@ -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)
+@@ -87,7 +87,7 @@ class HeadlessModeHandleImpl : public He
+ command_line->AppendSwitchPath(switches::kUserDataDir, GetUserDataDir());
+ }
+
+-#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/electron32/patches/patch-chrome_browser_intranet__redirect__detector.h b/electron32/patches/patch-chrome_browser_intranet__redirect__detector.h
new file mode 100644
index 0000000000..8d74a86cdc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.649217800 +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/electron32/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc b/electron32/patches/patch-chrome_browser_media__galleries_fileapi_mtp__device__map__service.cc
new file mode 100644
index 0000000000..818ea56841
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.709184400 +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/electron32/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc b/electron32/patches/patch-chrome_browser_media__galleries_media__file__system__registry.cc
new file mode 100644
index 0000000000..308dbc5e83
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.709184400 +0000
++++ chrome/browser/media_galleries/media_file_system_registry.cc
+@@ -585,7 +585,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/electron32/patches/patch-chrome_browser_media_audio__service__util.cc b/electron32/patches/patch-chrome_browser_media_audio__service__util.cc
new file mode 100644
index 0000000000..eaae470720
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.681200000 +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/electron32/patches/patch-chrome_browser_media_offscreen__tab.cc b/electron32/patches/patch-chrome_browser_media_offscreen__tab.cc
new file mode 100644
index 0000000000..17ae6124ab
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.685197800 +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/electron32/patches/patch-chrome_browser_media_offscreen__tab.h b/electron32/patches/patch-chrome_browser_media_offscreen__tab.h
new file mode 100644
index 0000000000..3527c9f204
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.685197800 +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/electron32/patches/patch-chrome_browser_media_router_discovery_BUILD.gn b/electron32/patches/patch-chrome_browser_media_router_discovery_BUILD.gn
new file mode 100644
index 0000000000..657adef5f9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.685197800 +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/electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc b/electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__posix.cc
new file mode 100644
index 0000000000..da37e4bccc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.689195600 +0000
++++ chrome/browser/media/router/discovery/discovery_network_list_posix.cc
+@@ -5,11 +5,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>
+
+@@ -18,7 +19,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>
+@@ -27,7 +28,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)
+@@ -40,6 +41,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/electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc b/electron32/patches/patch-chrome_browser_media_router_discovery_discovery__network__list__wifi__linux.cc
new file mode 100644
index 0000000000..a2d8ad967d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.689195600 +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/electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc b/electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.cc
new file mode 100644
index 0000000000..2df5bea964
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +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/electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h b/electron32/patches/patch-chrome_browser_media_webrtc_chrome__screen__enumerator.h
new file mode 100644
index 0000000000..30dc2eddff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +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/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h b/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list.h
new file mode 100644
index 0000000000..942ca08589
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +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;
+@@ -142,6 +143,8 @@ class DesktopMediaList {
+ // important when IsSourceDelegated() returns true, as it helps to notify the
+ // delegated source list when it should be hidden.
+ virtual void HideList() = 0;
++
++ int skip_next_refresh_ = 0;
+ };
+
+ #endif // CHROME_BROWSER_MEDIA_WEBRTC_DESKTOP_MEDIA_LIST_H_
diff --git a/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc b/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.cc
new file mode 100644
index 0000000000..b08d161d4c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +0000
++++ chrome/browser/media/webrtc/desktop_media_list_base.cc
+@@ -69,12 +69,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 {
+@@ -230,7 +230,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/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h b/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__list__base.h
new file mode 100644
index 0000000000..e133849786
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +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/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc b/electron32/patches/patch-chrome_browser_media_webrtc_desktop__media__picker__controller.cc
new file mode 100644
index 0000000000..ddc4974d92
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.697191200 +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/electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc b/electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.cc
new file mode 100644
index 0000000000..fb2475ad41
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.701188800 +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/electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h b/electron32/patches/patch-chrome_browser_media_webrtc_fake__desktop__media__list.h
new file mode 100644
index 0000000000..51178f2aa2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.701188800 +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/electron32/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc b/electron32/patches/patch-chrome_browser_media_webrtc_native__desktop__media__list.cc
new file mode 100644
index 0000000000..b0dc676117
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.701188800 +0000
++++ chrome/browser/media/webrtc/native_desktop_media_list.cc
+@@ -171,7 +171,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(
+@@ -356,7 +356,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_;
+
+@@ -644,6 +644,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(
+@@ -1028,6 +1034,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/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc b/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__log__uploader.cc
new file mode 100644
index 0000000000..985ef2c417
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.705186600 +0000
++++ chrome/browser/media/webrtc/webrtc_log_uploader.cc
+@@ -101,7 +101,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/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc b/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.cc
new file mode 100644
index 0000000000..1839f1c39f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.705186600 +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/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h b/electron32/patches/patch-chrome_browser_media_webrtc_webrtc__logging__controller.h
new file mode 100644
index 0000000000..e73cffdc5d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.705186600 +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/electron32/patches/patch-chrome_browser_memory__details.cc b/electron32/patches/patch-chrome_browser_memory__details.cc
new file mode 100644
index 0000000000..acf10612c5
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_memory__details.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/memory_details.cc.orig 2024-10-18 12:34:01.713182200 +0000
++++ chrome/browser/memory_details.cc
+@@ -38,7 +38,7 @@
+ #include "services/resource_coordinator/public/cpp/memory_instrumentation/memory_instrumentation.h"
+ #include "ui/base/l10n/l10n_util.h"
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_BSD)
+ #include "content/public/browser/zygote_host/zygote_host_linux.h"
+ #endif
+
+@@ -334,7 +334,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/electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc b/electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.cc
new file mode 100644
index 0000000000..870c34d944
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.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/metrics/chrome_browser_main_extra_parts_metrics.cc.orig 2024-10-18 12:34:01.713182200 +0000
++++ chrome/browser/metrics/chrome_browser_main_extra_parts_metrics.cc
+@@ -83,8 +83,10 @@
+
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++#if defined(__GLIBC__) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD))
++#if !BUILDFLAG(IS_BSD)
+ #include <gnu/libc-version.h>
++#endif
+
+ #include "base/linux_util.h"
+ #include "base/strings/string_split.h"
+@@ -108,7 +110,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)
+
+@@ -117,7 +119,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
+
+@@ -864,7 +866,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,
+@@ -1163,11 +1165,11 @@ void ChromeBrowserMainExtraPartsMetrics:
+ }
+ #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/electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h b/electron32/patches/patch-chrome_browser_metrics_chrome__browser__main__extra__parts__metrics.h
new file mode 100644
index 0000000000..b97543b995
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.713182200 +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)
+
+@@ -119,7 +119,7 @@ class ChromeBrowserMainExtraPartsMetrics
+ performance_intervention_metrics_reporter_;
+ #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/electron32/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc b/electron32/patches/patch-chrome_browser_metrics_chrome__metrics__service__client.cc
new file mode 100644
index 0000000000..492ee2b1ea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.713182200 +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
+
+@@ -213,7 +213,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)
+
+@@ -535,7 +535,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)
+@@ -707,7 +707,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
+@@ -758,7 +758,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
+@@ -843,7 +843,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) ||
+@@ -950,7 +950,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)
+@@ -1137,7 +1137,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(
+@@ -1471,7 +1471,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/electron32/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc b/electron32/patches/patch-chrome_browser_metrics_perf_cpu__identity.cc
new file mode 100644
index 0000000000..79462c9670
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.717180000 +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/electron32/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc b/electron32/patches/patch-chrome_browser_metrics_power_process__metrics__recorder__util.cc
new file mode 100644
index 0000000000..1b4d752b0a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.721177800 +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/electron32/patches/patch-chrome_browser_metrics_power_process__monitor.cc b/electron32/patches/patch-chrome_browser_metrics_power_process__monitor.cc
new file mode 100644
index 0000000000..46c64b2d1e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.721177800 +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
+
+@@ -158,7 +158,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/electron32/patches/patch-chrome_browser_metrics_power_process__monitor.h b/electron32/patches/patch-chrome_browser_metrics_power_process__monitor.h
new file mode 100644
index 0000000000..ccae272227
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.721177800 +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/electron32/patches/patch-chrome_browser_net_profile__network__context__service.cc b/electron32/patches/patch-chrome_browser_net_profile__network__context__service.cc
new file mode 100644
index 0000000000..f3910441cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.745164400 +0000
++++ chrome/browser/net/profile_network_context_service.cc
+@@ -140,7 +140,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"
+@@ -260,7 +260,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) {
+@@ -939,7 +939,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/electron32/patches/patch-chrome_browser_net_proxy__config__monitor.cc b/electron32/patches/patch-chrome_browser_net_proxy__config__monitor.cc
new file mode 100644
index 0000000000..73784f35b5
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_net_proxy__config__monitor.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/net/proxy_config_monitor.cc.orig 2024-10-18 12:34:01.745164400 +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) ||
+@@ -136,9 +140,11 @@ 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(
+ g_browser_process->extension_event_router_forwarder(), profile_,
+ line_number, base::UTF8ToUTF16(details));
++#endif
+ }
+
+ void ProxyConfigMonitor::OnRequestMaybeFailedDueToProxySettings(
+@@ -152,9 +158,10 @@ void ProxyConfigMonitor::OnRequestMaybeF
+ // controlled.
+ return;
+ }
+-
++#if 0
+ extensions::ProxyEventRouter::GetInstance()->OnProxyError(
+ g_browser_process->extension_event_router_forwarder(), profile_,
+ net_error);
++#endif
+ }
+ #endif
diff --git a/electron32/patches/patch-chrome_browser_net_proxy__config__monitor.h b/electron32/patches/patch-chrome_browser_net_proxy__config__monitor.h
new file mode 100644
index 0000000000..38eec0f6f3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.745164400 +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/electron32/patches/patch-chrome_browser_net_system__network__context__manager.cc b/electron32/patches/patch-chrome_browser_net_system__network__context__manager.cc
new file mode 100644
index 0000000000..c4ba0fe5b7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.745164400 +0000
++++ chrome/browser/net/system_network_context_manager.cc
+@@ -96,7 +96,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"
+@@ -140,7 +140,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;
+@@ -148,7 +148,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)
+@@ -194,7 +194,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)
+@@ -209,7 +209,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)
+@@ -219,7 +219,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
+@@ -261,11 +261,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 ||
+@@ -281,7 +281,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)
+@@ -511,7 +511,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) {}
+@@ -569,7 +569,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)
+@@ -583,7 +583,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)
+
+@@ -653,7 +653,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)
+@@ -678,11 +678,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)
+
+@@ -735,7 +735,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)
+
+@@ -950,7 +950,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/electron32/patches/patch-chrome_browser_net_system__network__context__manager.h b/electron32/patches/patch-chrome_browser_net_system__network__context__manager.h
new file mode 100644
index 0000000000..4218188a0e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.745164400 +0000
++++ chrome/browser/net/system_network_context_manager.h
+@@ -197,7 +197,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:
+@@ -278,7 +278,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/electron32/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc b/electron32/patches/patch-chrome_browser_new__tab__page_modules_file__suggestion_drive__service.cc
new file mode 100644
index 0000000000..945c0f8eca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.749162200 +0000
++++ chrome/browser/new_tab_page/modules/file_suggestion/drive_service.cc
+@@ -32,7 +32,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/electron32/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc b/electron32/patches/patch-chrome_browser_new__tab__page_new__tab__page__util.cc
new file mode 100644
index 0000000000..c047ef6186
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.753160000 +0000
++++ chrome/browser/new_tab_page/new_tab_page_util.cc
+@@ -20,7 +20,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/electron32/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc b/electron32/patches/patch-chrome_browser_notifications_notification__display__service__impl.cc
new file mode 100644
index 0000000000..61a50be14a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.757157600 +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
+@@ -65,7 +65,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
+ }
+@@ -81,7 +81,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>(
+@@ -89,7 +89,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/electron32/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc b/electron32/patches/patch-chrome_browser_notifications_notification__platform__bridge__delegator.cc
new file mode 100644
index 0000000000..143cdf8b5f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.761155400 +0000
++++ chrome/browser/notifications/notification_platform_bridge_delegator.cc
+@@ -57,7 +57,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/electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc b/electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.cc
new file mode 100644
index 0000000000..4c8c3ef965
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.761155400 +0000
++++ chrome/browser/notifications/platform_notification_service_impl.cc
+@@ -218,6 +218,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/electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h b/electron32/patches/patch-chrome_browser_notifications_platform__notification__service__impl.h
new file mode 100644
index 0000000000..0f14d1288d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.761155400 +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/electron32/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc b/electron32/patches/patch-chrome_browser_password__manager_chrome__password__manager__client.cc
new file mode 100644
index 0000000000..4ffa4ef247
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.817124100 +0000
++++ chrome/browser/password_manager/chrome_password_manager_client.cc
+@@ -560,7 +560,7 @@ void ChromePasswordManagerClient::
+
+ bool ChromePasswordManagerClient::IsReauthBeforeFillingRequired(
+ device_reauth::DeviceAuthenticator* authenticator) {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!GetLocalStatePrefs() || !GetPrefs() || !authenticator) {
+ return false;
+ }
+@@ -798,7 +798,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());
+ manage_passwords_ui_controller->OnKeychainError();
diff --git a/electron32/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc b/electron32/patches/patch-chrome_browser_password__manager_password__reuse__manager__factory.cc
new file mode 100644
index 0000000000..fe4c52400f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.817124100 +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/electron32/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc b/electron32/patches/patch-chrome_browser_pdf_chrome__pdf__stream__delegate.cc
new file mode 100644
index 0000000000..94e378a069
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.821122000 +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/electron32/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc b/electron32/patches/patch-chrome_browser_picture__in__picture_picture__in__picture__window__manager.cc
new file mode 100644
index 0000000000..8803fa7f20
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.837113100 +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) {
+@@ -187,7 +190,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(
+@@ -383,7 +386,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)
+@@ -469,6 +472,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.
+ //
+@@ -507,6 +511,8 @@ PictureInPictureWindowManager::GetOverla
+ }
+
+ return overlay_view;
++#endif // BUILDFLAG(GOOGLE_CHROME_BRANDING)
++ return nullptr;
+ }
+
+ PictureInPictureOcclusionTracker*
diff --git a/electron32/patches/patch-chrome_browser_platform__util__linux.cc b/electron32/patches/patch-chrome_browser_platform__util__linux.cc
new file mode 100644
index 0000000000..33e287c258
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.837113100 +0000
++++ chrome/browser/platform_util_linux.cc
+@@ -300,7 +300,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/electron32/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc b/electron32/patches/patch-chrome_browser_plugins_plugin__response__interceptor__url__loader__throttle.cc
new file mode 100644
index 0000000000..6e42462e78
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.837113100 +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/electron32/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc b/electron32/patches/patch-chrome_browser_policy_browser__signin__policy__handler.cc
new file mode 100644
index 0000000000..ba014a31e5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.841110700 +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/electron32/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc b/electron32/patches/patch-chrome_browser_policy_chrome__browser__cloud__management__controller__desktop.cc
new file mode 100644
index 0000000000..0fc0e9cb8c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.841110700 +0000
++++ chrome/browser/policy/chrome_browser_cloud_management_controller_desktop.cc
+@@ -50,7 +50,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)
+
+@@ -59,7 +59,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)
+@@ -87,7 +87,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>();
+@@ -255,7 +255,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/electron32/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc b/electron32/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
new file mode 100644
index 0000000000..c057145e7a
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_policy_configuration__policy__handler__list__factory.cc
@@ -0,0 +1,260 @@
+$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 2024-10-18 12:34:01.845108500 +0000
++++ chrome/browser/policy/configuration_policy_handler_list_factory.cc
+@@ -236,19 +236,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)
+@@ -262,13 +262,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/site_search_policy_handler.h"
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+@@ -542,7 +542,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 },
+@@ -884,7 +884,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 },
+@@ -893,7 +893,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 },
+@@ -1721,7 +1721,7 @@ const PolicyToPreferenceMapEntry kSimple
+ base::Value::Type::LIST },
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ { key::kGSSAPILibraryName,
+ prefs::kGSSAPILibraryName,
+ base::Value::Type::STRING },
+@@ -1778,7 +1778,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 },
+@@ -1804,12 +1804,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 },
+@@ -1817,7 +1817,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 },
+@@ -1829,7 +1829,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 },
+@@ -1930,7 +1930,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 },
+@@ -2041,7 +2041,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 },
+@@ -2120,7 +2120,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 },
+@@ -2149,7 +2149,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 },
+@@ -2192,7 +2192,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},
+@@ -2212,7 +2212,7 @@ const PolicyToPreferenceMapEntry kSimple
+ optimization_guide::model_execution::prefs::kHistorySearchEnterprisePolicyAllowed,
+ base::Value::Type::INTEGER},
+ #endif
+-#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 },
+@@ -2346,7 +2346,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,
+@@ -2362,7 +2362,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));
+
+@@ -2575,7 +2575,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(
+@@ -2627,7 +2627,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(
+@@ -2712,7 +2712,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));
+@@ -3070,7 +3070,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>(
+@@ -3078,7 +3078,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));
+@@ -3096,7 +3096,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)
+@@ -3119,7 +3119,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)
diff --git a/electron32/patches/patch-chrome_browser_policy_device__management__service__configuration.cc b/electron32/patches/patch-chrome_browser_policy_device__management__service__configuration.cc
new file mode 100644
index 0000000000..6ad1c9c540
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_policy_device__management__service__configuration.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/policy/device_management_service_configuration.cc.orig 2024-10-18 12:34:01.845108500 +0000
++++ chrome/browser/policy/device_management_service_configuration.cc
+@@ -24,7 +24,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
+@@ -102,7 +102,7 @@ DeviceManagementServiceConfiguration::Ge
+ content::BrowserContext* context) const {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
+ ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
+- !BUILDFLAG(IS_ANDROID))
++ !BUILDFLAG(IS_ANDROID)) || BUILDFLAG(IS_BSD)
+ auto* service =
+ enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
+ context);
diff --git a/electron32/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc b/electron32/patches/patch-chrome_browser_policy_policy__value__and__status__aggregator.cc
new file mode 100644
index 0000000000..e3d763c183
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.853104000 +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/electron32/patches/patch-chrome_browser_predictors_preconnect__manager.cc b/electron32/patches/patch-chrome_browser_predictors_preconnect__manager.cc
new file mode 100644
index 0000000000..1eea0ed789
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.861099700 +0000
++++ chrome/browser/predictors/preconnect_manager.cc
+@@ -11,9 +11,11 @@
+ #include "base/metrics/histogram_macros.h"
+ #include "base/not_fatal_until.h"
+ #include "base/trace_event/trace_event.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"
+@@ -24,6 +26,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) {}
+@@ -84,12 +100,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/electron32/patches/patch-chrome_browser_predictors_preconnect__manager.h b/electron32/patches/patch-chrome_browser_predictors_preconnect__manager.h
new file mode 100644
index 0000000000..cc5741850c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.861099700 +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/electron32/patches/patch-chrome_browser_prefs_browser__prefs.cc b/electron32/patches/patch-chrome_browser_prefs_browser__prefs.cc
new file mode 100644
index 0000000000..dfaabf5ba6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.865097500 +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
+
+@@ -496,18 +496,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
+
+@@ -542,7 +542,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
+
+@@ -1562,7 +1562,7 @@ void RegisterLocalState(PrefRegistrySimp
+ registry->RegisterIntegerPref(prefs::kLastWhatsNewVersion, 0);
+ #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)
+ WhatsNewUI::RegisterLocalStatePrefs(registry);
+ #endif
+
+@@ -1735,7 +1735,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
+
+@@ -2094,12 +2094,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/electron32/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc b/electron32/patches/patch-chrome_browser_prefs_pref__service__incognito__allowlist.cc
new file mode 100644
index 0000000000..f16406f4fd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.865097500 +0000
++++ chrome/browser/prefs/pref_service_incognito_allowlist.cc
+@@ -188,7 +188,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/electron32/patches/patch-chrome_browser_printing_print__backend__service__manager.cc b/electron32/patches/patch-chrome_browser_printing_print__backend__service__manager.cc
new file mode 100644
index 0000000000..c2fe9fdc9e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.873093000 +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
+
+@@ -877,7 +877,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());
+@@ -1054,7 +1054,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/electron32/patches/patch-chrome_browser_printing_print__job.cc b/electron32/patches/patch-chrome_browser_printing_print__job.cc
new file mode 100644
index 0000000000..4dbf20dccf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.873093000 +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),
+@@ -405,8 +405,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
+@@ -498,8 +500,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/electron32/patches/patch-chrome_browser_printing_print__view__manager__base.cc b/electron32/patches/patch-chrome_browser_printing_print__view__manager__base.cc
new file mode 100644
index 0000000000..3f6a063343
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.873093000 +0000
++++ chrome/browser/printing/print_view_manager_base.cc
+@@ -87,6 +87,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,
+@@ -95,9 +109,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;
+ }
+@@ -107,9 +121,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;
+ }
+@@ -121,14 +135,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;
+@@ -186,9 +200,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() {
+@@ -212,12 +228,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);
+@@ -299,7 +319,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);
+@@ -346,12 +366,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) {
+@@ -359,7 +380,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));
+@@ -371,6 +393,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));
+ }
+@@ -412,7 +438,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;
+ }
+@@ -441,7 +469,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
+@@ -674,7 +702,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()) {
+@@ -702,7 +730,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;
+@@ -746,10 +774,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)
+@@ -774,8 +799,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) {
+@@ -796,8 +835,6 @@ void PrintViewManagerBase::UpdatePrintSe
+ }
+ #endif
+
+- CompleteUpdatePrintSettings(std::move(job_settings),
+- std::move(print_settings), std::move(callback));
+ }
+
+ void PrintViewManagerBase::SetAccessibilityTree(
+@@ -813,7 +850,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,
+@@ -839,7 +876,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::
+@@ -869,11 +906,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();
+ }
+
+@@ -885,15 +920,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(
+@@ -935,13 +979,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) {
+@@ -958,18 +1003,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);
+ }
+
+@@ -979,7 +1032,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;
+ }
+
+@@ -1032,7 +1085,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;
+
+@@ -1052,7 +1108,7 @@ bool PrintViewManagerBase::SetupNewPrint
+ #endif
+ print_job_->AddObserver(*this);
+
+- printing_succeeded_ = false;
++ printing_status_ = PrintStatus::kUnknown;
+ return true;
+ }
+
+@@ -1110,7 +1166,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();
+ }
+@@ -1120,6 +1176,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;
+
+@@ -1127,7 +1188,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);
+@@ -1169,7 +1230,7 @@ bool PrintViewManagerBase::RunInnerMessa
+ }
+
+ bool PrintViewManagerBase::OpportunisticallyCreatePrintJob(int cookie) {
+- if (print_job_)
++ if (print_job_ && print_job_->document())
+ return true;
+
+ if (!cookie) {
+@@ -1192,7 +1253,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_`.
+@@ -1323,6 +1384,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
+@@ -1337,10 +1400,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/electron32/patches/patch-chrome_browser_printing_print__view__manager__base.h b/electron32/patches/patch-chrome_browser_printing_print__view__manager__base.h
new file mode 100644
index 0000000000..ad4d191b26
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.873093000 +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/electron32/patches/patch-chrome_browser_printing_printer__query.cc b/electron32/patches/patch-chrome_browser_printing_printer__query.cc
new file mode 100644
index 0000000000..687eac117a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.873093000 +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/electron32/patches/patch-chrome_browser_process__singleton.h b/electron32/patches/patch-chrome_browser_process__singleton.h
new file mode 100644
index 0000000000..c71f684261
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_process__singleton.h
@@ -0,0 +1,59 @@
+$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 2024-10-18 12:34:01.889084000 +0000
++++ chrome/browser/process_singleton.h
+@@ -18,6 +18,7 @@
+ #include "base/functional/callback.h"
+ #include "base/memory/ref_counted.h"
+ #include "base/process/process.h"
++#include "base/containers/span.h"
+ #include "ui/gfx/native_widget_types.h"
+
+ #if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID)
+@@ -100,14 +101,24 @@ 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::span<const uint8_t> additional_data,
++ bool is_sandboxed,
++ const NotificationCallback& notification_callback);
++#else
+ ProcessSingleton(const base::FilePath& user_data_dir,
++ const base::span<const uint8_t> additional_data,
+ const NotificationCallback& notification_callback);
+
+ ProcessSingleton(const ProcessSingleton&) = delete;
+ ProcessSingleton& operator=(const ProcessSingleton&) = delete;
+
++#endif
+ ~ProcessSingleton();
+
+ // Notify another process, if available. Otherwise sets ourselves as the
+@@ -171,11 +182,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::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/electron32/patches/patch-chrome_browser_process__singleton__posix.cc b/electron32/patches/patch-chrome_browser_process__singleton__posix.cc
new file mode 100644
index 0000000000..e1093b46a8
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_process__singleton__posix.cc
@@ -0,0 +1,238 @@
+$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 2024-10-18 12:34:01.889084000 +0000
++++ chrome/browser/process_singleton_posix.cc
+@@ -54,6 +54,7 @@
+ #include <memory>
+ #include <set>
+ #include <string>
++#include <tuple>
+ #include <type_traits>
+
+ #include "base/base_paths.h"
+@@ -81,6 +82,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"
+@@ -97,7 +99,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
+
+@@ -343,6 +345,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;
+@@ -355,7 +359,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);
+@@ -366,6 +370,7 @@ bool DisplayProfileInUseError(const base
+
+ NOTREACHED_IN_MIGRATION();
+ return false;
++#endif
+ }
+
+ bool IsChromeProcess(pid_t pid) {
+@@ -378,6 +383,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:
+@@ -590,6 +610,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
+@@ -649,13 +670,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 {
+@@ -703,7 +728,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;
+@@ -733,10 +759,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
+@@ -765,8 +809,10 @@ void ProcessSingleton::LinuxWatcher::Soc
+ //
+ ProcessSingleton::ProcessSingleton(
+ const base::FilePath& user_data_dir,
++ const base::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);
+@@ -781,6 +827,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() {
+@@ -883,7 +933,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);
+
+@@ -893,11 +944,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.
+@@ -1048,11 +1109,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/electron32/patches/patch-chrome_browser_process__singleton__win.cc b/electron32/patches/patch-chrome_browser_process__singleton__win.cc
new file mode 100644
index 0000000000..dd1a4abfb5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.889084000 +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::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 (chrome::AttemptToNotifyRunningChrome(remote_window_)) {
++ switch (chrome::AttemptToNotifyRunningChrome(remote_window_, additional_data_)) {
+ case chrome::NOTIFY_SUCCESS:
+ return PROCESS_NOTIFIED;
+ case chrome::NOTIFY_FAILED:
+@@ -378,7 +425,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_ = chrome::FindRunningChromeWindow(user_data_dir_);
+ if (!remote_window_ && !EscapeVirtualization(user_data_dir_)) {
+@@ -387,7 +434,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;
+@@ -426,6 +473,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/electron32/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc b/electron32/patches/patch-chrome_browser_profiles_chrome__browser__main__extra__parts__profiles.cc
new file mode 100644
index 0000000000..de7c0c1a8a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.893082000 +0000
++++ chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
+@@ -342,7 +342,7 @@
+ #include "chromeos/constants/chromeos_features.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
+
+@@ -428,18 +428,18 @@
+ #endif
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || 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"
+@@ -681,7 +681,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();
+@@ -810,7 +810,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ enterprise_connectors::ConnectorsServiceFactory::GetInstance();
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ enterprise_connectors::DeviceTrustConnectorServiceFactory::GetInstance();
+ enterprise_connectors::DeviceTrustServiceFactory::GetInstance();
+ #endif
+@@ -818,25 +818,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_ASH)
+ 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_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || 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)
+@@ -969,7 +969,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #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))
+ metrics::DesktopProfileSessionDurationsServiceFactory::GetInstance();
+ #endif
+@@ -1075,7 +1075,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
+@@ -1119,7 +1119,7 @@ void ChromeBrowserMainExtraPartsProfiles
+ #if !BUILDFLAG(IS_CHROMEOS_ASH) && !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
+@@ -1135,7 +1135,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_CHROMEOS_LACROS)
diff --git a/electron32/patches/patch-chrome_browser_profiles_profile__impl.cc b/electron32/patches/patch-chrome_browser_profiles_profile__impl.cc
new file mode 100644
index 0000000000..05ae05848b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.897079500 +0000
++++ chrome/browser/profiles/profile_impl.cc
+@@ -266,6 +266,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;
+@@ -600,7 +604,7 @@ void ProfileImpl::LoadPrefsForNormalStar
+ #else
+ {
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+-#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/electron32/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc b/electron32/patches/patch-chrome_browser_profiles_profile__keyed__service__factory.cc
new file mode 100644
index 0000000000..c053ca8102
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.897079500 +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/electron32/patches/patch-chrome_browser_profiles_profile__selections.cc b/electron32/patches/patch-chrome_browser_profiles_profile__selections.cc
new file mode 100644
index 0000000000..ee59d386ee
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_profiles_profile__selections.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/profiles/profile_selections.cc.orig 2024-10-18 12:34:01.897079500 +0000
++++ chrome/browser/profiles/profile_selections.cc
+@@ -13,6 +13,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ 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;
+ }
+
+@@ -123,6 +124,7 @@ Profile* ProfileSelections::ApplyProfile
+
+ ProfileSelection ProfileSelections::GetProfileSelection(
+ Profile* profile) const {
++#if 0
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ // This check has to be performed before the check on
+ // `profile->IsRegularProfile()` because profiles that are internal ASH
+@@ -148,6 +150,7 @@ ProfileSelection ProfileSelections::GetP
+ }
+
+ NOTREACHED_IN_MIGRATION();
++#endif
+ return ProfileSelection::kNone;
+ }
+
diff --git a/electron32/patches/patch-chrome_browser_profiles_profiles__state.cc b/electron32/patches/patch-chrome_browser_profiles_profiles__state.cc
new file mode 100644
index 0000000000..bf0cfc67a6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.901077300 +0000
++++ chrome/browser/profiles/profiles_state.cc
+@@ -196,7 +196,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.
+@@ -243,7 +243,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) &&
+@@ -259,7 +259,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/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.cc b/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.cc
new file mode 100644
index 0000000000..583992bd75
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.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
+
+--- chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc.orig 2024-10-18 12:34:01.929061700 +0000
++++ chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.cc
+@@ -7,17 +7,21 @@
+ #include <stddef.h>
+
+ #include "base/task/sequenced_task_runner.h"
++#if 0
+ #include "chrome/browser/browser_process.h"
+ #include "chrome/browser/profiles/profile.h"
+ #include "chrome/browser/profiles/profile_manager.h"
+ #include "chrome/common/chrome_switches.h"
+ #include "chrome/common/pepper_permission_util.h"
++#endif
+ #include "content/public/browser/browser_ppapi_host.h"
+ #include "content/public/browser/browser_task_traits.h"
+ #include "content/public/browser/browser_thread.h"
+ #include "content/public/browser/child_process_security_policy.h"
+ #include "content/public/browser/render_view_host.h"
++#if 0
+ #include "extensions/buildflags/buildflags.h"
++#endif
+ #include "ppapi/c/pp_errors.h"
+ #include "ppapi/host/dispatch_host_message.h"
+ #include "ppapi/host/host_message_context.h"
+@@ -26,12 +30,11 @@
+ #include "ppapi/shared_impl/file_system_util.h"
+ #include "storage/browser/file_system/isolated_context.h"
+
+-#if BUILDFLAG(ENABLE_EXTENSIONS)
++#if 0
+ #include "extensions/browser/extension_registry.h"
+ #include "extensions/common/constants.h"
+ #include "extensions/common/extension.h"
+ #include "extensions/common/extension_set.h"
+-#endif
+
+ namespace {
+
+@@ -41,6 +44,7 @@ const char* kPredefinedAllowedCrxFsOrigi
+ };
+
+ } // namespace
++#endif
+
+ // static
+ PepperIsolatedFileSystemMessageFilter*
+@@ -64,11 +68,16 @@ PepperIsolatedFileSystemMessageFilter::P
+ const base::FilePath& profile_directory,
+ const GURL& document_url,
+ ppapi::host::PpapiHost* ppapi_host)
++#if 0
+ : render_process_id_(render_process_id),
+ profile_directory_(profile_directory),
+ document_url_(document_url) {
+ for (size_t i = 0; i < std::size(kPredefinedAllowedCrxFsOrigins); ++i)
+ allowed_crxfs_origins_.insert(kPredefinedAllowedCrxFsOrigins[i]);
++#else
++ : profile_directory_(profile_directory),
++ document_url_(document_url) {
++#endif
+ }
+
+ PepperIsolatedFileSystemMessageFilter::
+@@ -93,6 +102,7 @@ int32_t PepperIsolatedFileSystemMessageF
+ return PP_ERROR_FAILED;
+ }
+
++#if 0
+ Profile* PepperIsolatedFileSystemMessageFilter::GetProfile() {
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
+ ProfileManager* profile_manager = g_browser_process->profile_manager();
+@@ -117,6 +127,7 @@ PepperIsolatedFileSystemMessageFilter::C
+ return storage::IsolatedContext::ScopedFSHandle();
+ #endif
+ }
++#endif
+
+ int32_t PepperIsolatedFileSystemMessageFilter::OnOpenFileSystem(
+ ppapi::host::HostMessageContext* context,
+@@ -125,7 +136,7 @@ int32_t PepperIsolatedFileSystemMessageF
+ case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_INVALID:
+ break;
+ case PP_ISOLATEDFILESYSTEMTYPE_PRIVATE_CRX:
+- return OpenCrxFileSystem(context);
++ return PP_ERROR_NOTSUPPORTED;
+ }
+ NOTREACHED_IN_MIGRATION();
+ context->reply_msg =
+@@ -133,6 +144,7 @@ int32_t PepperIsolatedFileSystemMessageF
+ return PP_ERROR_FAILED;
+ }
+
++#if 0
+ int32_t PepperIsolatedFileSystemMessageFilter::OpenCrxFileSystem(
+ ppapi::host::HostMessageContext* context) {
+ #if BUILDFLAG(ENABLE_EXTENSIONS)
+@@ -173,3 +185,4 @@ int32_t PepperIsolatedFileSystemMessageF
+ return PP_ERROR_NOTSUPPORTED;
+ #endif
+ }
++#endif
diff --git a/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.h b/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.h
new file mode 100644
index 0000000000..2a8bfe2a25
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_renderer__host_pepper_pepper__isolated__file__system__message__filter.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
+
+--- chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h.orig 2024-10-18 12:34:01.929061700 +0000
++++ chrome/browser/renderer_host/pepper/pepper_isolated_file_system_message_filter.h
+@@ -20,7 +20,9 @@
+ #include "storage/browser/file_system/isolated_context.h"
+ #include "url/gurl.h"
+
++#if 0
+ class Profile;
++#endif
+
+ namespace content {
+ class BrowserPpapiHost;
+@@ -59,6 +61,7 @@ class PepperIsolatedFileSystemMessageFil
+
+ ~PepperIsolatedFileSystemMessageFilter() override;
+
++#if 0
+ Profile* GetProfile();
+
+ // Returns filesystem id of isolated filesystem if valid, or empty string
+@@ -66,18 +69,23 @@ class PepperIsolatedFileSystemMessageFil
+ // allows access on that thread.
+ storage::IsolatedContext::ScopedFSHandle CreateCrxFileSystem(
+ Profile* profile);
++#endif
+
+ int32_t OnOpenFileSystem(ppapi::host::HostMessageContext* context,
+ PP_IsolatedFileSystemType_Private type);
++#if 0
+ int32_t OpenCrxFileSystem(ppapi::host::HostMessageContext* context);
+
+ const int render_process_id_;
++#endif
+ // Keep a copy from original thread.
+ const base::FilePath profile_directory_;
+ const GURL document_url_;
+
++#if 0
+ // Set of origins that can use CrxFs private APIs from NaCl.
+ std::set<std::string> allowed_crxfs_origins_;
++#endif
+ };
+
+ #endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_PEPPER_ISOLATED_FILE_SYSTEM_MESSAGE_FILTER_H_
diff --git a/electron32/patches/patch-chrome_browser_renderer__preferences__util.cc b/electron32/patches/patch-chrome_browser_renderer__preferences__util.cc
new file mode 100644
index 0000000000..38d37d0f3f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:01.929061700 +0000
++++ chrome/browser/renderer_preferences_util.cc
+@@ -39,7 +39,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"
+@@ -154,7 +154,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()) {
+@@ -177,7 +177,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/electron32/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts b/electron32/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
new file mode 100644
index 0000000000..fa6b1691a5
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_resources_pdf_pdf__viewer.ts
@@ -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/resources/pdf/pdf_viewer.ts.orig 2024-10-18 12:34:02.144941800 +0000
++++ chrome/browser/resources/pdf/pdf_viewer.ts
+@@ -1012,7 +1012,15 @@ export class PdfViewerElement extends Pd
+ dataArray = [result.dataToSave];
+ }
+
++ const a = document.createElement('a');
++ a.download = this.attachments_[index].name;
+ const blob = new Blob(dataArray);
++ // <if expr="not _google_chrome">
++ a.href = URL.createObjectURL(blob);
++ a.click();
++ URL.revokeObjectURL(a.href);
++ // </if>
++ // <if expr="_google_chrome">
+ const fileName = this.attachments_[index].name;
+ chrome.fileSystem.chooseEntry(
+ {type: 'saveFile', suggestedName: fileName},
+@@ -1034,6 +1042,7 @@ export class PdfViewerElement extends Pd
+ // </if>
+ });
+ });
++ // </if>
+ }
+
+ /**
+@@ -1157,7 +1166,15 @@ export class PdfViewerElement extends Pd
+ }
+
+ // Create blob before callback to avoid race condition.
++ const a = document.createElement('a');
++ a.download = fileName;
+ const blob = new Blob([result.dataToSave], {type: 'application/pdf'});
++ // <if expr="not _google_chrome">
++ a.href = URL.createObjectURL(blob);
++ a.click();
++ URL.revokeObjectURL(a.href);
++ // </if>
++ // <if expr="_google_chrome">
+ chrome.fileSystem.chooseEntry(
+ {
+ type: 'saveFile',
+@@ -1182,6 +1199,7 @@ export class PdfViewerElement extends Pd
+ // </if>
+ });
+ });
++ // </if>
+
+ // <if expr="enable_pdf_ink2">
+ // Ink2 doesn't need to exit annotation mode after save.
diff --git a/electron32/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css b/electron32/patches/patch-chrome_browser_resources_settings_autofill__page_passwords__shared.css
new file mode 100644
index 0000000000..a24201b7ff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.156935200 +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/electron32/patches/patch-chrome_browser_resources_signin_signin__shared.css b/electron32/patches/patch-chrome_browser_resources_signin_signin__shared.css
new file mode 100644
index 0000000000..42b55d7066
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.184919600 +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/electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc b/electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_binary__upload__service.cc
new file mode 100644
index 0000000000..7d4cc3392c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.200910800 +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
+
+@@ -434,7 +434,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/electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_deep__scanning__utils.cc b/electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_deep__scanning__utils.cc
new file mode 100644
index 0000000000..b2c59dd0ad
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_safe__browsing_cloud__content__scanning_deep__scanning__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/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc.orig 2024-10-18 12:34:02.204908600 +0000
++++ chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.cc
+@@ -16,7 +16,7 @@
+ #include "components/crash/core/common/crash_key.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 "chrome/browser/enterprise/signin/enterprise_signin_prefs.h"
+ #include "components/prefs/pref_service.h"
+ #endif
+@@ -416,7 +416,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/electron32/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc b/electron32/patches/patch-chrome_browser_safe__browsing_incident__reporting_incident__reporting__service.cc
new file mode 100644
index 0000000000..e730317854
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.212904000 +0000
++++ chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+@@ -695,7 +695,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/electron32/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc b/electron32/patches/patch-chrome_browser_screen__ai_screen__ai__install__state.cc
new file mode 100644
index 0000000000..7f6b36e484
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.224897400 +0000
++++ chrome/browser/screen_ai/screen_ai_install_state.cc
+@@ -17,7 +17,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
+@@ -27,7 +27,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/electron32/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc b/electron32/patches/patch-chrome_browser_screen__ai_screen__ai__service__router.cc
new file mode 100644
index 0000000000..0960e8cef8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.224897400 +0000
++++ chrome/browser/screen_ai/screen_ai_service_router.cc
+@@ -293,7 +293,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())};
+@@ -307,7 +307,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/electron32/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc b/electron32/patches/patch-chrome_browser_send__tab__to__self_receiving__ui__handler__registry.cc
new file mode 100644
index 0000000000..5ac928a6d5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.232893000 +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/electron32/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc b/electron32/patches/patch-chrome_browser_send__tab__to__self_send__tab__to__self__client__service.cc
new file mode 100644
index 0000000000..6e5c67894d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.232893000 +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/electron32/patches/patch-chrome_browser_sessions_session__restore.cc b/electron32/patches/patch-chrome_browser_sessions_session__restore.cc
new file mode 100644
index 0000000000..bfb562ac48
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.236890800 +0000
++++ chrome/browser/sessions/session_restore.cc
+@@ -99,7 +99,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)
+
+@@ -1049,7 +1049,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/electron32/patches/patch-chrome_browser_sharing_sharing__device__registration.cc b/electron32/patches/patch-chrome_browser_sharing_sharing__device__registration.cc
new file mode 100644
index 0000000000..91b274ecde
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_sharing_sharing__device__registration.cc
@@ -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/sharing/sharing_device_registration.cc.orig 2024-10-18 12:34:02.252882000 +0000
++++ chrome/browser/sharing/sharing_device_registration.cc
+@@ -331,7 +331,7 @@ bool SharingDeviceRegistration::IsSmsFet
+
+ bool SharingDeviceRegistration::IsRemoteCopySupported() const {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return true;
+ #else
+ return false;
diff --git a/electron32/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc b/electron32/patches/patch-chrome_browser_sharing_sharing__handler__registry__impl.cc
new file mode 100644
index 0000000000..4af5404af5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.252882000 +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/electron32/patches/patch-chrome_browser_shortcuts_icon__badging.cc b/electron32/patches/patch-chrome_browser_shortcuts_icon__badging.cc
new file mode 100644
index 0000000000..a8096988d6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.256879800 +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/electron32/patches/patch-chrome_browser_signin_signin__util.cc b/electron32/patches/patch-chrome_browser_signin_signin__util.cc
new file mode 100644
index 0000000000..5421c63537
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.272870800 +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/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc b/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.cc
new file mode 100644
index 0000000000..2d71dc633b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.280866400 +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,
+@@ -266,6 +269,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();
+@@ -273,6 +280,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/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h b/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__hunspell__dictionary.h
new file mode 100644
index 0000000000..9740dd8c14
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.280866400 +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/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc b/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.cc
new file mode 100644
index 0000000000..45b6c2fbac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.280866400 +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/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.h b/electron32/patches/patch-chrome_browser_spellchecker_spellcheck__service.h
new file mode 100644
index 0000000000..b5fe4a702b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.280866400 +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/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__delegate__impl.cc
new file mode 100644
index 0000000000..999bce6ced
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_delegate_impl.cc
+@@ -196,7 +196,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/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.cc
new file mode 100644
index 0000000000..eb0dc71495
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.cc
+@@ -359,7 +359,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)
+ }
+@@ -476,7 +476,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/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__extensions__manager.h
new file mode 100644
index 0000000000..90d715b5fd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +0000
++++ chrome/browser/supervised_user/supervised_user_extensions_manager.h
+@@ -154,7 +154,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/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__google__auth__navigation__throttle.cc
new file mode 100644
index 0000000000..46f54efb49
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +0000
++++ chrome/browser/supervised_user/supervised_user_google_auth_navigation_throttle.cc
+@@ -25,7 +25,7 @@
+
+ #if BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/supervised_user/child_accounts/child_account_service_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
+@@ -139,7 +139,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/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__metrics__service__factory.cc
new file mode 100644
index 0000000000..e56997d8db
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +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
+
+@@ -61,7 +61,7 @@ KeyedService* SupervisedUserMetricsServi
+ 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->GetPrefs());
diff --git a/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc b/electron32/patches/patch-chrome_browser_supervised__user_supervised__user__navigation__observer.cc
new file mode 100644
index 0000000000..234978ef82
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.296857600 +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/electron32/patches/patch-chrome_browser_sync_chrome__sync__client.cc b/electron32/patches/patch-chrome_browser_sync_chrome__sync__client.cc
new file mode 100644
index 0000000000..4a993eaf89
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_sync_chrome__sync__client.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/sync/chrome_sync_client.cc.orig 2024-10-18 12:34:02.300855400 +0000
++++ chrome/browser/sync/chrome_sync_client.cc
+@@ -119,7 +119,7 @@
+ #endif // BUILDFLAG(ENABLE_SPELLCHECK)
+
+ #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"
+ #elif BUILDFLAG(IS_ANDROID)
+@@ -233,7 +233,7 @@ bool ShouldSyncAppsTypesInTransportMode(
+ syncer::ModelTypeControllerDelegate* GetSavedTabGroupControllerDelegate(
+ Profile* profile) {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ auto* keyed_service =
+ tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile);
+ CHECK(keyed_service);
+@@ -251,7 +251,7 @@ syncer::ModelTypeControllerDelegate* Get
+ syncer::ModelTypeControllerDelegate* GetSharedTabGroupControllerDelegate(
+ Profile* profile) {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ tab_groups::SavedTabGroupKeyedService* keyed_service =
+ tab_groups::SavedTabGroupServiceFactory::GetForProfile(profile);
+ CHECK(keyed_service);
+@@ -545,7 +545,7 @@ ChromeSyncClient::CreateModelTypeControl
+ // platforms.
+ bool enable_tab_group_sync = false;
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_WIN)
++ BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ enable_tab_group_sync = true;
+ #elif BUILDFLAG(IS_ANDROID)
+ enable_tab_group_sync =
+@@ -586,7 +586,7 @@ ChromeSyncClient::CreateModelTypeControl
+
+ // 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 (GetPrefService()->GetBoolean(spellcheck::prefs::kSpellCheckEnable)) {
+ controllers.push_back(
diff --git a/electron32/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc b/electron32/patches/patch-chrome_browser_sync_device__info__sync__client__impl.cc
new file mode 100644
index 0000000000..99781aae35
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.300855400 +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/electron32/patches/patch-chrome_browser_sync_sync__service__factory.cc b/electron32/patches/patch-chrome_browser_sync_sync__service__factory.cc
new file mode 100644
index 0000000000..6e9ed00c2c
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_sync_sync__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/sync/sync_service_factory.cc.orig 2024-10-18 12:34:02.300855400 +0000
++++ chrome/browser/sync/sync_service_factory.cc
+@@ -85,7 +85,7 @@
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+ #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_service_factory.h"
+ #elif BUILDFLAG(IS_ANDROID)
+ #include "chrome/browser/tab_group_sync/tab_group_sync_service_factory.h"
+@@ -134,7 +134,7 @@ std::unique_ptr<KeyedService> BuildSyncS
+ // TODO(crbug.com/40118868): Reassess whether the following block needs to be
+ // included in lacros-chrome 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))
+ syncer::SyncPrefs prefs(profile->GetPrefs());
+ local_sync_backend_enabled = prefs.IsLocalSyncEnabled();
+@@ -271,7 +271,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/electron32/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc b/electron32/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__service__factory.cc
new file mode 100644
index 0000000000..6b11900ec2
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_tab__group__sync_tab__group__sync__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/tab_group_sync/tab_group_sync_service_factory.cc.orig 2024-10-18 12:34:02.328839800 +0000
++++ chrome/browser/tab_group_sync/tab_group_sync_service_factory.cc
+@@ -110,7 +110,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)
+ delegate =
+ std::make_unique<TabGroupSyncDelegateDesktop>(service.get(), profile);
+ #else
diff --git a/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.cc b/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.cc
new file mode 100644
index 0000000000..56e90a3a92
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +0000
++++ chrome/browser/task_manager/sampling/task_group.cc
+@@ -38,7 +38,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)
+@@ -123,7 +123,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),
+@@ -142,7 +142,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)
+@@ -322,7 +322,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/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.h b/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group.h
new file mode 100644
index 0000000000..9bfda1cf59
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +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/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc b/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.cc
new file mode 100644
index 0000000000..b68b0c95c2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +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/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h b/electron32/patches/patch-chrome_browser_task__manager_sampling_task__group__sampler.h
new file mode 100644
index 0000000000..d3946f87ef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +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/electron32/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc b/electron32/patches/patch-chrome_browser_task__manager_sampling_task__manager__impl.cc
new file mode 100644
index 0000000000..572440de75
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +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/electron32/patches/patch-chrome_browser_task__manager_task__manager__observer.h b/electron32/patches/patch-chrome_browser_task__manager_task__manager__observer.h
new file mode 100644
index 0000000000..ceae1dd214
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.340833200 +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/electron32/patches/patch-chrome_browser_themes_theme__helper.cc b/electron32/patches/patch-chrome_browser_themes_theme__helper.cc
new file mode 100644
index 0000000000..aef5feb187
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.344831000 +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/electron32/patches/patch-chrome_browser_themes_theme__service.cc b/electron32/patches/patch-chrome_browser_themes_theme__service.cc
new file mode 100644
index 0000000000..5435ac5357
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.344831000 +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
+@@ -326,7 +326,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/electron32/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc b/electron32/patches/patch-chrome_browser_themes_theme__service__aura__linux.cc
new file mode 100644
index 0000000000..ca51ccf47e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.344831000 +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/electron32/patches/patch-chrome_browser_themes_theme__service__factory.cc b/electron32/patches/patch-chrome_browser_themes_theme__service__factory.cc
new file mode 100644
index 0000000000..a877b98356
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.344831000 +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
+
+@@ -106,7 +106,7 @@ ThemeServiceFactory::~ThemeServiceFactor
+
+ KeyedService* ThemeServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ using ThemeService = ThemeServiceAuraLinux;
+ #endif
+
+@@ -120,9 +120,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/electron32/patches/patch-chrome_browser_ui_actions_chrome__action__id.h b/electron32/patches/patch-chrome_browser_ui_actions_chrome__action__id.h
new file mode 100644
index 0000000000..49c2a24901
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:02.364819800 +0000
++++ chrome/browser/ui/actions/chrome_action_id.h
+@@ -510,7 +510,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/electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.cc b/electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.cc
new file mode 100644
index 0000000000..dd29c9ff50
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_ash_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/ash_web_view_impl.cc.orig 2024-10-18 12:34:03.100412400 +0000
++++ chrome/browser/ui/ash/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/electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.h b/electron32/patches/patch-chrome_browser_ui_ash_ash__web__view__impl.h
new file mode 100644
index 0000000000..e0b50852b1
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_ash_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/ash_web_view_impl.h.orig 2024-10-18 12:34:03.100412400 +0000
++++ chrome/browser/ui/ash/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/electron32/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc b/electron32/patches/patch-chrome_browser_ui_ash_keyboard_chrome__keyboard__web__contents.cc
new file mode 100644
index 0000000000..a57a6ec21f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.112405800 +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/electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc b/electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.cc
new file mode 100644
index 0000000000..64293582ba
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.136392600 +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) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ scoped_observation_.Observe(BrowserList::GetInstance());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+ }
+@@ -109,7 +109,7 @@ void DesktopPaymentsWindowManager::WebCo
+ }
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || 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/electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h b/electron32/patches/patch-chrome_browser_ui_autofill_payments_desktop__payments__window__manager.h
new file mode 100644
index 0000000000..5ddbf52fdb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.136392600 +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) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || 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) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ public BrowserListObserver,
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+ public content::WebContentsObserver {
+@@ -58,7 +58,7 @@ class DesktopPaymentsWindowManager : pub
+ content::NavigationHandle* navigation_handle) override;
+ void WebContentsDestroyed() override;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // BrowserListObserver:
+ void OnBrowserSetLastActive(Browser* browser) override;
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
+@@ -136,7 +136,7 @@ class DesktopPaymentsWindowManager : pub
+ std::unique_ptr<PaymentsWindowUserConsentDialogControllerImpl>
+ payments_window_user_consent_dialog_controller_;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ base::ScopedObservation<BrowserList, BrowserListObserver> scoped_observation_{
+ this};
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/electron32/patches/patch-chrome_browser_ui_browser.cc b/electron32/patches/patch-chrome_browser_ui_browser.cc
new file mode 100644
index 0000000000..e037098202
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.140390400 +0000
++++ chrome/browser/ui/browser.cc
+@@ -2069,12 +2069,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/electron32/patches/patch-chrome_browser_ui_browser.h b/electron32/patches/patch-chrome_browser_ui_browser.h
new file mode 100644
index 0000000000..345a6159bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.140390400 +0000
++++ chrome/browser/ui/browser.h
+@@ -338,7 +338,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).
+@@ -977,8 +977,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/electron32/patches/patch-chrome_browser_ui_browser__command__controller.cc b/electron32/patches/patch-chrome_browser_ui_browser__command__controller.cc
new file mode 100644
index 0000000000..4724bc5dde
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.140390400 +0000
++++ chrome/browser/ui/browser_command_controller.cc
+@@ -129,7 +129,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
+@@ -138,7 +138,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)
+
+@@ -315,7 +315,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();
+@@ -567,7 +567,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;
+@@ -579,7 +579,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,
+@@ -773,7 +773,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 {
+@@ -1272,12 +1272,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()
+@@ -1592,7 +1592,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/electron32/patches/patch-chrome_browser_ui_browser__commands.cc b/electron32/patches/patch-chrome_browser_ui_browser__commands.cc
new file mode 100644
index 0000000000..f2ede5e74f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.144388200 +0000
++++ chrome/browser/ui/browser_commands.cc
+@@ -2005,7 +2005,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/electron32/patches/patch-chrome_browser_ui_browser__ui__prefs.cc b/electron32/patches/patch-chrome_browser_ui_browser__ui__prefs.cc
new file mode 100644
index 0000000000..ecdc37bc23
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.144388200 +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)
+@@ -179,7 +179,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());
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
diff --git a/electron32/patches/patch-chrome_browser_ui_browser__view__prefs.cc b/electron32/patches/patch-chrome_browser_ui_browser__view__prefs.cc
new file mode 100644
index 0000000000..4acb7ab8d1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.144388200 +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/electron32/patches/patch-chrome_browser_ui_chrome__pages.cc b/electron32/patches/patch-chrome_browser_ui_chrome__pages.cc
new file mode 100644
index 0000000000..9bd52f9b80
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.148386000 +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));
+ }
+@@ -722,7 +722,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/electron32/patches/patch-chrome_browser_ui_chrome__pages.h b/electron32/patches/patch-chrome_browser_ui_chrome__pages.h
new file mode 100644
index 0000000000..5c42d3eccf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.148386000 +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
+@@ -196,7 +196,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/electron32/patches/patch-chrome_browser_ui_color_BUILD.gn b/electron32/patches/patch-chrome_browser_ui_color_BUILD.gn
new file mode 100644
index 0000000000..883a5b6d43
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.156381600 +0000
++++ chrome/browser/ui/color/BUILD.gn
+@@ -89,9 +89,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/electron32/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc b/electron32/patches/patch-chrome_browser_ui_color_native__chrome__color__mixer.cc
new file mode 100644
index 0000000000..184c46712d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.156381600 +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/electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc b/electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.cc
new file mode 100644
index 0000000000..9ed5b6a413
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.160379400 +0000
++++ chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+@@ -21,12 +21,16 @@
+ #include "chrome/browser/history/history_service_factory.h"
+ #include "chrome/browser/profiles/profile.h"
+ #include "chrome/browser/safe_browsing/safe_browsing_service.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"
+@@ -256,10 +260,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|.
+@@ -371,12 +377,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(
+@@ -462,10 +470,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(
+@@ -573,18 +583,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;
+@@ -617,6 +626,7 @@ void FullscreenController::EnterFullscre
+ if (!extension_caused_fullscreen_.is_empty())
+ url = extension_caused_fullscreen_;
+ }
++#endif
+
+ fullscreen_start_time_ = base::TimeTicks::Now();
+ if (option == BROWSER)
+@@ -636,6 +646,7 @@ void FullscreenController::ExitFullscree
+ if (chrome::IsRunningInAppMode())
+ 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 =
+@@ -647,15 +658,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());
+@@ -717,8 +729,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/electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h b/electron32/patches/patch-chrome_browser_ui_exclusive__access_fullscreen__controller.h
new file mode 100644
index 0000000000..0dfd62c0c8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.160379400 +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/electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc b/electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.cc
new file mode 100644
index 0000000000..d9e2e9a477
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.176370600 +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/electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h b/electron32/patches/patch-chrome_browser_ui_media__router_presentation__receiver__window__controller.h
new file mode 100644
index 0000000000..29f5a12aa0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.176370600 +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/electron32/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc b/electron32/patches/patch-chrome_browser_ui_omnibox_omnibox__pedal__implementations.cc
new file mode 100644
index 0000000000..7372cc20d4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.180368400 +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/electron32/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc b/electron32/patches/patch-chrome_browser_ui_passwords_bubble__controllers_relaunch__chrome__bubble__controller.cc
new file mode 100644
index 0000000000..b16c9aaf33
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.184366200 +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/electron32/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc b/electron32/patches/patch-chrome_browser_ui_passwords_manage__passwords__ui__controller.cc
new file mode 100644
index 0000000000..48e9da033d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.228341800 +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;
+@@ -502,7 +502,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/electron32/patches/patch-chrome_browser_ui_sad__tab.cc b/electron32/patches/patch-chrome_browser_ui_sad__tab.cc
new file mode 100644
index 0000000000..4457bfce74
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.236337400 +0000
++++ chrome/browser/ui/sad_tab.cc
+@@ -176,7 +176,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/electron32/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h b/electron32/patches/patch-chrome_browser_ui_sharing__hub_sharing__hub__bubble__controller.h
new file mode 100644
index 0000000000..ec2e63623c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.244333000 +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/electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc b/electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller.cc
new file mode 100644
index 0000000000..648cad6d59
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.244333000 +0000
++++ chrome/browser/ui/signin/signin_view_controller.cc
+@@ -492,7 +492,7 @@ void SigninViewController::ShowModalMana
+ signin::SigninChoiceCallbackVariant process_user_choice_callback,
+ base::OnceClosure done_callback) {
+ #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/electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h b/electron32/patches/patch-chrome_browser_ui_signin_signin__view__controller__delegate.h
new file mode 100644
index 0000000000..75f438dbf3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.244333000 +0000
++++ chrome/browser/ui/signin/signin_view_controller_delegate.h
+@@ -83,7 +83,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/electron32/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc b/electron32/patches/patch-chrome_browser_ui_startup_bad__flags__prompt.cc
new file mode 100644
index 0000000000..d34117a547
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.248330800 +0000
++++ chrome/browser/ui/startup/bad_flags_prompt.cc
+@@ -107,7 +107,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/electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc b/electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator.cc
new file mode 100644
index 0000000000..6f80799b6f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.248330800 +0000
++++ chrome/browser/ui/startup/startup_browser_creator.cc
+@@ -138,7 +138,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"
+@@ -967,7 +967,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())) {
+@@ -1084,7 +1084,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) &&
+@@ -1294,7 +1294,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/electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc b/electron32/patches/patch-chrome_browser_ui_startup_startup__browser__creator__impl.cc
new file mode 100644
index 0000000000..c8cadde9e5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.248330800 +0000
++++ chrome/browser/ui/startup/startup_browser_creator_impl.cc
+@@ -86,7 +86,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)
+
+@@ -237,7 +237,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
+@@ -267,7 +267,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/electron32/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc b/electron32/patches/patch-chrome_browser_ui_startup_startup__tab__provider.cc
new file mode 100644
index 0000000000..2e62fbd35e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.248330800 +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/electron32/patches/patch-chrome_browser_ui_tab__helpers.cc b/electron32/patches/patch-chrome_browser_ui_tab__helpers.cc
new file mode 100644
index 0000000000..c667c0f547
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.252328600 +0000
++++ chrome/browser/ui/tab_helpers.cc
+@@ -241,7 +241,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"
+@@ -719,12 +719,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/electron32/patches/patch-chrome_browser_ui_tabs_features.cc b/electron32/patches/patch-chrome_browser_ui_tabs_features.cc
new file mode 100644
index 0000000000..3f90ec0c70
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.252328600 +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/electron32/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc b/electron32/patches/patch-chrome_browser_ui_tabs_tab__strip__prefs.cc
new file mode 100644
index 0000000000..787f961ada
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.296304500 +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/electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.cc b/electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.cc
new file mode 100644
index 0000000000..5b0b15c64a
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__columns.cc
@@ -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.cc.orig 2024-10-18 12:34:03.296304500 +0000
++++ chrome/browser/ui/task_manager/task_manager_columns.cc
+@@ -93,7 +93,7 @@ const TableColumnData kColumns[] = {
+ std::size("100000") * kCharWidth, -1, true, false, 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)
+ {IDS_TASK_MANAGER_OPEN_FD_COUNT_COLUMN, ui::TableColumn::RIGHT, -1, 0,
+ std::size("999") * kCharWidth, -1, true, false, false},
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
diff --git a/electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc b/electron32/patches/patch-chrome_browser_ui_task__manager_task__manager__table__model.cc
new file mode 100644
index 0000000000..94a014172a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.296304500 +0000
++++ chrome/browser/ui/task_manager/task_manager_table_model.cc
+@@ -454,7 +454,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)
+@@ -621,7 +621,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]);
+@@ -806,7 +806,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/electron32/patches/patch-chrome_browser_ui_test_popup__browsertest.cc b/electron32/patches/patch-chrome_browser_ui_test_popup__browsertest.cc
new file mode 100644
index 0000000000..3f577fb232
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.296304500 +0000
++++ chrome/browser/ui/test/popup_browsertest.cc
+@@ -74,7 +74,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()))
+@@ -106,7 +106,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/electron32/patches/patch-chrome_browser_ui_test_test__browser__ui.cc b/electron32/patches/patch-chrome_browser_ui_test_test__browser__ui.cc
new file mode 100644
index 0000000000..72bc21aa77
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.296304500 +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/electron32/patches/patch-chrome_browser_ui_ui__features.cc b/electron32/patches/patch-chrome_browser_ui_ui__features.cc
new file mode 100644
index 0000000000..36c5070e33
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.304300000 +0000
++++ chrome/browser/ui/ui_features.cc
+@@ -108,7 +108,7 @@ BASE_FEATURE(kEvDetailsInPageInfo,
+ "EvDetailsInPageInfo",
+ base::FEATURE_ENABLED_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)
+ // Enables the feature to remove the last confirmation dialog when relaunching
+ // to update Chrome.
+ BASE_FEATURE(kFewerUpdateConfirmations,
+@@ -381,7 +381,7 @@ BASE_FEATURE(kTopChromeWebUIUsesSpareRen
+ "TopChromeWebUIUsesSpareRenderer",
+ base::FEATURE_ENABLED_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)
+ // Enables alternate update-related text to be displayed in browser app menu
+ // button, menu item and confirmation dialog.
+ BASE_FEATURE(kUpdateTextOptions,
+@@ -457,7 +457,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/electron32/patches/patch-chrome_browser_ui_ui__features.h b/electron32/patches/patch-chrome_browser_ui_ui__features.h
new file mode 100644
index 0000000000..d2d16468c1
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_ui__features.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/ui/ui_features.h.orig 2024-10-18 12:34:03.304300000 +0000
++++ chrome/browser/ui/ui_features.h
+@@ -80,7 +80,7 @@ BASE_DECLARE_FEATURE(kAccessCodeCastUI);
+
+ BASE_DECLARE_FEATURE(kEvDetailsInPageInfo);
+
+-#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
+
+@@ -239,7 +239,7 @@ bool IsToolbarPinningEnabled();
+
+ BASE_DECLARE_FEATURE(kTopChromeWebUIUsesSpareRenderer);
+
+-#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(kUpdateTextOptions);
+ extern const base::FeatureParam<int> kUpdateTextOptionNumber;
+ #endif
+@@ -266,7 +266,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/electron32/patches/patch-chrome_browser_ui_views_accelerator__table.cc b/electron32/patches/patch-chrome_browser_ui_views_accelerator__table.cc
new file mode 100644
index 0000000000..95e4165a79
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.308297900 +0000
++++ chrome/browser/ui/views/accelerator_table.cc
+@@ -72,11 +72,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},
+@@ -104,7 +104,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},
+@@ -156,7 +156,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/electron32/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc b/electron32/patches/patch-chrome_browser_ui_views_apps_chrome__native__app__window__views__aura.cc
new file mode 100644
index 0000000000..7fbc89716d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.312295700 +0000
++++ chrome/browser/ui/views/apps/chrome_native_app_window_views_aura.cc
+@@ -19,7 +19,7 @@
+ #include "ui/gfx/image/image_skia.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
+
+@@ -55,7 +55,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/electron32/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc b/electron32/patches/patch-chrome_browser_ui_views_chrome__browser__main__extra__parts__views.cc
new file mode 100644
index 0000000000..9e313ecd82
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.332284700 +0000
++++ chrome/browser/ui/views/chrome_browser_main_extra_parts_views.cc
+@@ -38,7 +38,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>
+@@ -131,7 +131,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/electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h b/electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate.h
new file mode 100644
index 0000000000..40045203bb
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate.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
+
+--- chrome/browser/ui/views/chrome_views_delegate.h.orig 2024-10-18 12:34:03.332284700 +0000
++++ chrome/browser/ui/views/chrome_views_delegate.h
+@@ -59,11 +59,11 @@ class ChromeViewsDelegate : public views
+ base::OnceClosure callback) override;
+ // 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)
+ bool WindowManagerProvidesTitleBar(bool maximized) override;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::ImageSkia* GetDefaultWindowIcon() const override;
+ #endif
+
diff --git a/electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc b/electron32/patches/patch-chrome_browser_ui_views_chrome__views__delegate__linux.cc
new file mode 100644
index 0000000000..8926a2fa81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.332284700 +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/electron32/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc b/electron32/patches/patch-chrome_browser_ui_views_compose_compose__dialog__view.cc
new file mode 100644
index 0000000000..5434751ace
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.332284700 +0000
++++ chrome/browser/ui/views/compose/compose_dialog_view.cc
+@@ -159,7 +159,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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.cc
new file mode 100644
index 0000000000..e88bf7c4da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.352273700 +0000
++++ chrome/browser/ui/views/frame/browser_frame.cc
+@@ -54,7 +54,7 @@
+ #include "components/user_manager/user_manager.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
+@@ -89,7 +89,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;
+@@ -184,7 +184,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());
+@@ -370,7 +370,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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.h b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame.h
new file mode 100644
index 0000000000..6e577d099b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.352273700 +0000
++++ chrome/browser/ui/views/frame/browser_frame.h
+@@ -65,7 +65,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; }
+@@ -225,7 +225,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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux.cc
new file mode 100644
index 0000000000..16db69bfb9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.352273700 +0000
++++ chrome/browser/ui/views/frame/browser_frame_view_layout_linux.cc
+@@ -53,7 +53,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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__layout__linux__native.cc
new file mode 100644
index 0000000000..66c9eb762a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.352273700 +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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__frame__view__linux.cc
new file mode 100644
index 0000000000..5110b19f46
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.352273700 +0000
++++ chrome/browser/ui/views/frame/browser_frame_view_linux.cc
+@@ -60,7 +60,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;
+@@ -104,7 +104,7 @@ void BrowserFrameViewLinux::OnWindowButt
+ }
+
+ 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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__non__client__frame__view__factory__views.cc
new file mode 100644
index 0000000000..8bc0f7e67e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.356271500 +0000
++++ chrome/browser/ui/views/frame/browser_non_client_frame_view_factory_views.cc
+@@ -16,7 +16,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"
+@@ -33,7 +33,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/electron32/patches/patch-chrome_browser_ui_views_frame_browser__view.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_browser__view.cc
new file mode 100644
index 0000000000..cd659e5ffb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.356271500 +0000
++++ chrome/browser/ui/views/frame/browser_view.cc
+@@ -2258,7 +2258,7 @@ void BrowserView::TabDraggingStatusChang
+ // CrOS cleanup is done.
+ // 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))
+ 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/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.cc
new file mode 100644
index 0000000000..966a49f75c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +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
+
+@@ -564,7 +564,7 @@ OpaqueBrowserFrameView::FrameButtonStyle
+ OpaqueBrowserFrameView::GetFrameButtonStyle() const {
+ // 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)
+ return FrameButtonStyle::kMdButton;
+ #else
+ return FrameButtonStyle::kImageButton;
+@@ -583,7 +583,7 @@ bool OpaqueBrowserFrameView::ShouldDrawR
+ return false;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool OpaqueBrowserFrameView::IsTiled() const {
+ return frame()->tiled();
+ }
+@@ -782,7 +782,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/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h b/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view.h
new file mode 100644
index 0000000000..3d4acbf6e7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view.h
+@@ -114,7 +114,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;
+@@ -231,7 +231,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/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h b/electron32/patches/patch-chrome_browser_ui_views_frame_opaque__browser__frame__view__layout__delegate.h
new file mode 100644
index 0000000000..35fe44ba45
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_delegate.h
+@@ -10,7 +10,7 @@
+ #include "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #include "ui/base/ui_base_types.h"
+ #endif
+
+@@ -93,7 +93,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/electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.cc
new file mode 100644
index 0000000000..7bcae085ee
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.cc
+@@ -61,7 +61,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"
+@@ -93,7 +93,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
+@@ -185,7 +185,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()) {
+@@ -581,7 +581,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);
+@@ -803,7 +803,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)));
+@@ -885,7 +885,7 @@ void PictureInPictureBrowserFrameView::R
+ BrowserNonClientFrameView::RemovedFromWidget();
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ gfx::Insets PictureInPictureBrowserFrameView::MirroredFrameBorderInsets()
+ const {
+ auto border = FrameBorderInsets();
+@@ -1153,7 +1153,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_) {
+@@ -1287,7 +1287,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();
+@@ -1305,7 +1305,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_ASH)
+ return gfx::Insets(kResizeBorder);
+@@ -1326,7 +1326,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/electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h b/electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.h
new file mode 100644
index 0000000000..992f05f8be
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_views_frame_picture__in__picture__browser__frame__view.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
+
+--- chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h.orig 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/picture_in_picture_browser_frame_view.h
+@@ -27,7 +27,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
+
+@@ -35,7 +35,7 @@
+ // parent window, so to prevent cutting off important dialogs we resize the
+ // picture-in-picture window to fit them. While ChromeOS Ash also uses Aura, it
+ // does not have this issue so we do not resize on ChromeOS Ash.
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ #define RESIZE_DOCUMENT_PICTURE_IN_PICTURE_TO_DIALOG 1
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_LACROS)
+@@ -103,7 +103,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 MirroredFrameBorderInsets() const override;
+ gfx::Insets GetInputInsets() const override;
+ SkRRect GetRestoredClipRegion() const override;
+@@ -195,7 +195,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;
+
+@@ -371,7 +371,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/electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__builder.cc
new file mode 100644
index 0000000000..57842785e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/system_menu_model_builder.cc
+@@ -75,7 +75,7 @@ void SystemMenuModelBuilder::BuildSystem
+ ui::SimpleMenuModel* model) {
+ // 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_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ 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);
+@@ -91,7 +91,7 @@ void SystemMenuModelBuilder::BuildSystem
+ }
+ // 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_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ model->AddSeparator(ui::NORMAL_SEPARATOR);
+ bool supports_server_side_decorations = true;
+ #if BUILDFLAG(IS_OZONE) && !BUILDFLAG(IS_CHROMEOS)
+@@ -155,7 +155,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/electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_system__menu__model__delegate.cc
new file mode 100644
index 0000000000..9a3c0cda3a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/system_menu_model_delegate.cc
+@@ -21,7 +21,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
+@@ -36,7 +36,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);
+@@ -58,7 +58,7 @@ bool SystemMenuModelDelegate::IsCommandI
+ bool SystemMenuModelDelegate::IsCommandIdVisible(int command_id) const {
+ // 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)
+ bool is_maximized = browser_->window()->IsMaximized();
+ switch (command_id) {
+ case IDC_MAXIMIZE_WINDOW:
diff --git a/electron32/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc b/electron32/patches/patch-chrome_browser_ui_views_frame_tab__strip__region__view.cc
new file mode 100644
index 0000000000..750bc493d6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.360269300 +0000
++++ chrome/browser/ui/views/frame/tab_strip_region_view.cc
+@@ -201,7 +201,7 @@ TabStripRegionView::TabStripRegionView(s
+
+ // 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)
+ // The New Tab Button can be middle-clicked on Linux.
+ new_tab_button_->SetTriggerableEventFlags(
+ new_tab_button_->GetTriggerableEventFlags() |
diff --git a/electron32/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc b/electron32/patches/patch-chrome_browser_ui_views_hats_hats__next__web__dialog.cc
new file mode 100644
index 0000000000..8df00e1562
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.364267000 +0000
++++ chrome/browser/ui/views/hats/hats_next_web_dialog.cc
+@@ -75,8 +75,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/electron32/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc b/electron32/patches/patch-chrome_browser_ui_views_hung__renderer__view.cc
new file mode 100644
index 0000000000..71c5dd1020
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.364267000 +0000
++++ chrome/browser/ui/views/hung_renderer_view.cc
+@@ -406,7 +406,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/electron32/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc b/electron32/patches/patch-chrome_browser_ui_views_omnibox_omnibox__view__views.cc
new file mode 100644
index 0000000000..a54da5df1f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.376260500 +0000
++++ chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+@@ -1972,7 +1972,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/electron32/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc b/electron32/patches/patch-chrome_browser_ui_views_overlay_close__image__button.cc
new file mode 100644
index 0000000000..9b2a94cb6a
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_views_overlay_close__image__button.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/browser/ui/views/overlay/close_image_button.cc.orig 2024-10-18 12:34:03.380258300 +0000
++++ chrome/browser/ui/views/overlay/close_image_button.cc
+@@ -4,10 +4,13 @@
+
+ #include "chrome/browser/ui/views/overlay/close_image_button.h"
+
++#include "build/branding_buildflags.h"
+ #include "build/chromeos_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"
+@@ -27,7 +30,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/electron32/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc b/electron32/patches/patch-chrome_browser_ui_views_overlay_video__overlay__window__views.cc
new file mode 100644
index 0000000000..8584a346b0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.380258300 +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_label_button.h"
+ #include "chrome/browser/ui/views/overlay/close_image_button.h"
+@@ -60,7 +62,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"
+@@ -313,7 +315,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) {
+@@ -346,11 +348,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/electron32/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc b/electron32/patches/patch-chrome_browser_ui_views_passwords_password__bubble__view__base.cc
new file mode 100644
index 0000000000..c98cae6275
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.384256100 +0000
++++ chrome/browser/ui/views/passwords/password_bubble_view_base.cc
+@@ -37,7 +37,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
+
+@@ -141,7 +141,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/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc b/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view.cc
new file mode 100644
index 0000000000..f6d4df47d4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.400247300 +0000
++++ chrome/browser/ui/views/profiles/profile_menu_view.cc
+@@ -83,7 +83,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
+
+@@ -568,7 +568,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/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc b/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__menu__view__base.cc
new file mode 100644
index 0000000000..5a12c65e0f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.400247300 +0000
++++ chrome/browser/ui/views/profiles/profile_menu_view_base.cc
+@@ -687,7 +687,7 @@ void ProfileMenuViewBase::SetProfileIden
+
+ // 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)
+ // 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/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc b/electron32/patches/patch-chrome_browser_ui_views_profiles_profile__picker__view.cc
new file mode 100644
index 0000000000..f833e86ab2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.404245100 +0000
++++ chrome/browser/ui/views/profiles/profile_picker_view.cc
+@@ -87,7 +87,7 @@
+ #include "chrome/browser/ui/views/profiles/first_run_flow_controller_lacros.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "chrome/browser/shell_integration_linux.h"
+ #endif
+
+@@ -117,7 +117,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/electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc b/electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.cc
new file mode 100644
index 0000000000..42e67d2e49
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.404245100 +0000
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.cc
+@@ -55,7 +55,7 @@ namespace {
+
+ const int kModalDialogWidth = 448;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ const int kManagedUserNoticeConfirmationDialogWidth = 512;
+ const int kManagedUserNoticeConfirmationDialogHeight = 576;
+ const int kManagedUserNoticeConfirmationUpdatedDialogWidth = 900;
+@@ -173,7 +173,7 @@ SigninViewControllerDelegateViews::Creat
+ #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)
+ // static
+ std::unique_ptr<views::WebView>
+ SigninViewControllerDelegateViews::CreateManagedUserNoticeConfirmationWebView(
+@@ -335,7 +335,7 @@ SigninViewControllerDelegateViews::Signi
+ SetButtons(ui::DIALOG_BUTTON_NONE);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || 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) {
+@@ -425,7 +425,7 @@ void SigninViewControllerDelegateViews::
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ void SigninViewControllerDelegateViews::DeleteProfileOnCancel() {
+ ProfileAttributesEntry* entry =
+ g_browser_process->profile_manager()
+@@ -499,7 +499,7 @@ SigninViewControllerDelegate::CreateProf
+ #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)
+ // static
+ SigninViewControllerDelegate*
+ SigninViewControllerDelegate::CreateManagedUserNoticeDelegate(
diff --git a/electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h b/electron32/patches/patch-chrome_browser_ui_views_profiles_signin__view__controller__delegate__views.h
new file mode 100644
index 0000000000..b7191fcda5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.404245100 +0000
++++ chrome/browser/ui/views/profiles/signin_view_controller_delegate_views.h
+@@ -75,7 +75,7 @@ class SigninViewControllerDelegateViews
+ #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)
+ static std::unique_ptr<views::WebView>
+ CreateManagedUserNoticeConfirmationWebView(
+ Browser* browser,
+@@ -141,7 +141,7 @@ class SigninViewControllerDelegateViews
+ InitializeSigninWebDialogUI initialize_signin_web_dialog_ui);
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ // Deletes the ephemeral profile when cancelling the local profile creation
+ // dialog.
+ void DeleteProfileOnCancel();
diff --git a/electron32/patches/patch-chrome_browser_ui_views_tabs_tab.cc b/electron32/patches/patch-chrome_browser_ui_views_tabs_tab.cc
new file mode 100644
index 0000000000..9974d8af12
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.572152600 +0000
++++ chrome/browser/ui/views/tabs/tab.cc
+@@ -616,7 +616,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/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc b/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.cc
new file mode 100644
index 0000000000..9dd10525ee
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__drag__controller.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/tabs/tab_drag_controller.cc.orig 2024-10-18 12:34:03.572152600 +0000
++++ chrome/browser/ui/views/tabs/tab_drag_controller.cc
+@@ -98,7 +98,7 @@
+ #include "components/remote_cocoa/browser/window.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/aura/client/drag_drop_client.h"
+ #endif
+
+@@ -218,7 +218,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)) {
+@@ -416,7 +416,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_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ ref->can_release_capture_ = false;
+ #endif
+ ref->start_point_in_screen_ =
+@@ -1065,7 +1065,7 @@ TabDragController::DragBrowserToNewTabSt
+
+ // 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))
+ // 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.
+@@ -2151,7 +2151,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
+@@ -2597,7 +2597,7 @@ TabDragController::Liveness TabDragContr
+ }
+ // 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)
+ // 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/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc b/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__hover__card__bubble__view.cc
new file mode 100644
index 0000000000..0bced12ef0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.576150400 +0000
++++ chrome/browser/ui/views/tabs/tab_hover_card_bubble_view.cc
+@@ -374,7 +374,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/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc b/electron32/patches/patch-chrome_browser_ui_views_tabs_tab__style__views.cc
new file mode 100644
index 0000000000..eeffd3da5e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.580148200 +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/electron32/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc b/electron32/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__service.cc
new file mode 100644
index 0000000000..723419b830
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_views_user__education_browser__user__education__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/ui/views/user_education/browser_user_education_service.cc.orig 2024-10-18 12:34:03.588143800 +0000
++++ chrome/browser/ui/views/user_education/browser_user_education_service.cc
+@@ -1008,7 +1008,7 @@ void MaybeRegisterChromeFeaturePromos(
+ FeaturePromoSpecification::AcceleratorInfo())
+ .SetBubbleArrow(HelpBubbleArrow::kTopLeft)));
+
+-#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/electron32/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc b/electron32/patches/patch-chrome_browser_ui_views_web__apps_web__app__integration__test__driver.cc
new file mode 100644
index 0000000000..789f41c5c4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.596139400 +0000
++++ chrome/browser/ui/views/web_apps/web_app_integration_test_driver.cc
+@@ -516,7 +516,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;
+@@ -2104,7 +2104,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(
+@@ -3431,7 +3431,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
+@@ -3446,7 +3446,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
+@@ -3456,7 +3456,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;
+ }
+@@ -3472,7 +3472,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;
+ }
+@@ -4289,7 +4289,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
+@@ -4489,7 +4489,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);
+@@ -4533,7 +4533,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/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h b/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__dialogs.h
new file mode 100644
index 0000000000..b445b58174
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.604135000 +0000
++++ chrome/browser/ui/web_applications/web_app_dialogs.h
+@@ -22,7 +22,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/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc b/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.cc
new file mode 100644
index 0000000000..ec69520249
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +0000
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.cc
+@@ -577,7 +577,7 @@ void WebAppUiManagerImpl::MaybeShowIPHPr
+ content::WebContents* web_contents,
+ 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);
+
+@@ -797,7 +797,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)
+ void WebAppUiManagerImpl::ShowIPHPromoForAppsLaunchedViaLinkCapturing(
+ const Browser* browser,
+ const webapps::AppId& app_id,
diff --git a/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h b/electron32/patches/patch-chrome_browser_ui_web__applications_web__app__ui__manager__impl.h
new file mode 100644
index 0000000000..77e2d6d76e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +0000
++++ chrome/browser/ui/web_applications/web_app_ui_manager_impl.h
+@@ -222,7 +222,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/electron32/patches/patch-chrome_browser_ui_webui_about_about__ui.cc b/electron32/patches/patch-chrome_browser_ui_webui_about_about__ui.cc
new file mode 100644
index 0000000000..3b06818898
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_about_about__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/webui/about/about_ui.cc.orig 2024-10-18 12:34:03.608132800 +0000
++++ chrome/browser/ui/webui/about/about_ui.cc
+@@ -596,7 +596,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,
+@@ -651,7 +651,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/electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc b/electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.cc
new file mode 100644
index 0000000000..34d5de588c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +0000
++++ chrome/browser/ui/webui/accessibility/accessibility_ui.cc
+@@ -43,6 +43,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"
+@@ -169,7 +170,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());
+@@ -203,7 +204,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()
+@@ -236,7 +237,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 =
+@@ -303,11 +304,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;
+@@ -647,7 +648,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);
+ }
+ }
+@@ -700,7 +702,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 =
+@@ -727,6 +730,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);
+@@ -739,6 +743,7 @@ void AccessibilityUIMessageHandler::Requ
+ return;
+ }
+ }
++#endif
+ #endif // !BUILDFLAG(IS_ANDROID)
+ // No browser with the specified |session_id| was found.
+ base::Value::Dict result;
+@@ -807,11 +812,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()) {
+@@ -881,8 +888,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/electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h b/electron32/patches/patch-chrome_browser_ui_webui_accessibility_accessibility__ui.h
new file mode 100644
index 0000000000..8ffd98ae68
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +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
+@@ -82,6 +84,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/electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.cc
new file mode 100644
index 0000000000..08462c3a5b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +0000
++++ chrome/browser/ui/webui/app_home/app_home_page_handler.cc
+@@ -61,7 +61,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/electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h b/electron32/patches/patch-chrome_browser_ui_webui_app__home_app__home__page__handler.h
new file mode 100644
index 0000000000..e5bb9eac2d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.608132800 +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/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_certificate__manager__handler.cc
new file mode 100644
index 0000000000..12f56c9713
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.652108400 +0000
++++ chrome/browser/ui/webui/certificate_manager/certificate_manager_handler.cc
+@@ -147,7 +147,7 @@ CertificateManagerPageHandler::GetCertSo
+ "distrusted_certs",
+ cert_verifier::mojom::CertificateTrust::kDistrusted);
+ 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/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc b/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.cc
new file mode 100644
index 0000000000..7b39a29897
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.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/certificate_manager/client_cert_sources.cc.orig 2024-10-18 12:34:03.652108400 +0000
++++ chrome/browser/ui/webui/certificate_manager/client_cert_sources.cc
+@@ -36,7 +36,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"
+@@ -98,7 +98,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
+@@ -373,7 +373,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>(
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h b/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.h
new file mode 100644
index 0000000000..5cbaf8b1f7
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_certificate__manager_client__cert__sources.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/certificate_manager/client_cert_sources.h.orig 2024-10-18 12:34:03.652108400 +0000
++++ chrome/browser/ui/webui/certificate_manager/client_cert_sources.h
+@@ -15,7 +15,7 @@ class Profile;
+ std::unique_ptr<CertificateManagerPageHandler::CertSource>
+ CreatePlatformClientCertSource();
+
+-#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
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc b/electron32/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.cc
new file mode 100644
index 0000000000..5584dabb2c
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_chrome__web__ui__controller__factory.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
+
+--- chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc.orig 2024-10-18 12:34:03.652108400 +0000
++++ chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+@@ -189,7 +189,7 @@
+ #include "chrome/browser/ui/webui/chromeos/chrome_url_disabled/chrome_url_disabled_ui.h"
+ #endif
+
+-#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
+
+@@ -214,21 +214,21 @@
+ #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/discards/discards_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) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #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/whats_new/whats_new_ui.h"
+ #include "chrome/browser/ui/webui/whats_new/whats_new_util.h"
+ #endif
+@@ -378,7 +378,7 @@ bool IsAboutUI(const GURL& url) {
+ #if !BUILDFLAG(IS_ANDROID)
+ || url.host_piece() == chrome::kChromeUITermsHost
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_OPENBSD)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ || url.host_piece() == chrome::kChromeUILinuxProxyConfigHost
+ #endif
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -572,7 +572,7 @@ WebUIFactoryFunction GetWebUIFactoryFunc
+ if (url.host_piece() == chrome::kChromeUIMobileSetupHost)
+ return &NewWebUI<ash::cellular_setup::MobileSetupUI>;
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIWebUIJsErrorHost)
+ return &NewWebUI<WebUIJsErrorUI>;
+ #endif
+@@ -628,7 +628,7 @@ WebUIFactoryFunction GetWebUIFactoryFunc
+ if (url.host_piece() == chrome::kChromeUINaClHost)
+ return &NewWebUI<NaClUI>;
+ #endif
+-#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && \
++#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)) && \
+ defined(TOOLKIT_VIEWS)) || \
+ defined(USE_AURA)
+ if (url.host_piece() == chrome::kChromeUITabModalConfirmDialogHost)
+@@ -659,7 +659,7 @@ WebUIFactoryFunction GetWebUIFactoryFunc
+ if (url.host_piece() == chrome::kChromeUIWebuiGalleryHost) {
+ return &NewWebUI<WebuiGalleryUI>;
+ }
+-#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.host_piece() == chrome::kChromeUIWhatsNewHost &&
+ whats_new::IsEnabled()) {
+ return &NewWebUI<WhatsNewUI>;
+@@ -678,26 +678,26 @@ WebUIFactoryFunction GetWebUIFactoryFunc
+ }
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_ANDROID)
++ BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUISandboxHost) {
+ return &NewWebUI<SandboxInternalsUI>;
+ }
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS_ASH)
++ BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIConnectorsInternalsHost)
+ return &NewWebUI<enterprise_connectors::ConnectorsInternalsUI>;
+ #endif
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ if (url.host_piece() == chrome::kChromeUIDiscardsHost)
+ return &NewWebUI<DiscardsUI>;
+ #endif
+-#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.host_piece() == chrome::kChromeUIBrowserSwitchHost)
+ return &NewWebUI<BrowserSwitchUI>;
+ #endif
+-#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.host_piece() == chrome::kChromeUIWebAppSettingsHost)
+ return &NewWebUI<WebAppSettingsUI>;
+ #endif
+@@ -936,7 +936,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)
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc b/electron32/patches/patch-chrome_browser_ui_webui_connectors__internals_device__trust__utils.cc
new file mode 100644
index 0000000000..2d72eaf7d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.652108400 +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/electron32/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc b/electron32/patches/patch-chrome_browser_ui_webui_interstitials_interstitial__ui.cc
new file mode 100644
index 0000000000..e2331f0d9e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.664101800 +0000
++++ chrome/browser/ui/webui/interstitials/interstitial_ui.cc
+@@ -70,7 +70,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.h"
+ #endif
+@@ -376,7 +376,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<SupervisedUserVerificationPage>
+ CreateSupervisedUserVerificationPage(content::WebContents* web_contents) {
+ const GURL kRequestUrl("https://supervised-user-verification.example.net");
+@@ -570,7 +570,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 = CreateSupervisedUserVerificationPage(web_contents);
+ #endif
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui.cc b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui.cc
new file mode 100644
index 0000000000..3c9a2da1c4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.664101800 +0000
++++ chrome/browser/ui/webui/management/management_ui.cc
+@@ -100,11 +100,11 @@ content::WebUIDataSource* CreateAndAddMa
+ {kManagementOnFileTransferVisibleData,
+ IDS_MANAGEMENT_FILE_TRANSFER_VISIBLE_DATA},
+ #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/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.cc
new file mode 100644
index 0000000000..599858f61f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.664101800 +0000
++++ chrome/browser/ui/webui/management/management_ui_constants.cc
+@@ -82,12 +82,12 @@ const char kProfileReportingBrowser[] =
+ const char kProfileReportingExtension[] = "profileReportingExtension";
+ const char kProfileReportingPolicy[] = "profileReportingPolicy";
+
+-#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/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__constants.h
new file mode 100644
index 0000000000..ee9480a7ae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.664101800 +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/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.cc
new file mode 100644
index 0000000000..47f65dd412
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__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/management/management_ui_handler.cc.orig 2024-10-18 12:34:03.664101800 +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)
+@@ -365,7 +365,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)
+ // Insert the device signals consent disclosure at the end of browser
+ // reporting section.
+ auto* user_permission_service = GetUserPermissionService();
+@@ -543,7 +543,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/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h b/electron32/patches/patch-chrome_browser_ui_webui_management_management__ui__handler.h
new file mode 100644
index 0000000000..3dafa5d2a6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.664101800 +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();
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards__handler.cc
new file mode 100644
index 0000000000..8b66fea1f9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.672097400 +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
+
+@@ -75,7 +75,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/electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc b/electron32/patches/patch-chrome_browser_ui_webui_password__manager_promo__cards_relaunch__chrome__promo.cc
new file mode 100644
index 0000000000..878b132077
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.672097400 +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/electron32/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_searchbox_searchbox__handler.cc
new file mode 100644
index 0000000000..0273fbe79c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.676095200 +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
+@@ -675,7 +675,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/electron32/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_settings_appearance__handler.cc
new file mode 100644
index 0000000000..be6995265c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.680093000 +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/electron32/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc b/electron32/patches/patch-chrome_browser_ui_webui_settings_settings__localized__strings__provider.cc
new file mode 100644
index 0000000000..fdb4a422ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.684090900 +0000
++++ chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
+@@ -141,7 +141,7 @@
+ #include "chrome/browser/ui/chrome_pages.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ #include "ui/display/screen.h"
+ #endif
+
+@@ -160,7 +160,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
+@@ -280,7 +280,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",
+@@ -405,7 +405,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},
+@@ -413,7 +413,7 @@ void AddAppearanceStrings(content::WebUI
+ {"classicTheme", IDS_SETTINGS_CLASSIC_THEME},
+ {"useClassicTheme", IDS_SETTINGS_USE_CLASSIC_THEME},
+ #endif
+-#if BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ {"showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS},
+ #endif
+ #if BUILDFLAG(IS_MAC)
+@@ -441,7 +441,7 @@ void AddAppearanceStrings(content::WebUI
+
+ // 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_BSD)) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ bool show_custom_chrome_frame = ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_server_side_window_decorations;
diff --git a/electron32/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc b/electron32/patches/patch-chrome_browser_ui_webui_signin_profile__picker__handler.cc
new file mode 100644
index 0000000000..794a6c6fa0
--- /dev/null
+++ b/electron32/patches/patch-chrome_browser_ui_webui_signin_profile__picker__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/signin/profile_picker_handler.cc.orig 2024-10-18 12:34:03.692086500 +0000
++++ chrome/browser/ui/webui/signin/profile_picker_handler.cc
+@@ -203,7 +203,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()) {
diff --git a/electron32/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc b/electron32/patches/patch-chrome_browser_ui_window__sizer_window__sizer.cc
new file mode 100644
index 0000000000..d41a75ce00
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.704079900 +0000
++++ chrome/browser/ui/window_sizer/window_sizer.cc
+@@ -210,7 +210,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/electron32/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc b/electron32/patches/patch-chrome_browser_visited__url__ranking_visited__url__ranking__service__factory.cc
new file mode 100644
index 0000000000..ec6336f931
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.712075500 +0000
++++ chrome/browser/visited_url_ranking/visited_url_ranking_service_factory.cc
+@@ -41,7 +41,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"
+@@ -114,7 +114,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/electron32/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc b/electron32/patches/patch-chrome_browser_web__applications_commands_launch__web__app__command.cc
new file mode 100644
index 0000000000..a479807d58
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.724068900 +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/electron32/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc b/electron32/patches/patch-chrome_browser_web__applications_commands_set__user__display__mode__command.cc
new file mode 100644
index 0000000000..45479b4e75
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.724068900 +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/electron32/patches/patch-chrome_browser_web__applications_extension__status__utils.h b/electron32/patches/patch-chrome_browser_web__applications_extension__status__utils.h
new file mode 100644
index 0000000000..116c948a26
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.728066700 +0000
++++ chrome/browser/web_applications/extension_status_utils.h
+@@ -55,7 +55,7 @@ bool IsExternalExtensionUninstalled(cont
+ bool ClearExternalExtensionUninstalled(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/electron32/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc b/electron32/patches/patch-chrome_browser_web__applications_extensions_extension__status__utils.cc
new file mode 100644
index 0000000000..49c980b263
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.728066700 +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,"
+@@ -113,7 +113,7 @@ bool ClearExternalExtensionUninstalled(c
+ 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/electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc b/electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__manager.cc
new file mode 100644
index 0000000000..a25d33d25d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.740060000 +0000
++++ chrome/browser/web_applications/os_integration/os_integration_manager.cc
+@@ -649,7 +649,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/electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h b/electron32/patches/patch-chrome_browser_web__applications_os__integration_os__integration__test__override.h
new file mode 100644
index 0000000000..3fe375fb7d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.740060000 +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/electron32/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc b/electron32/patches/patch-chrome_browser_web__applications_os__integration_run__on__os__login__sub__manager.cc
new file mode 100644
index 0000000000..48d59f3f46
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.740060000 +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/electron32/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc b/electron32/patches/patch-chrome_browser_web__applications_os__integration_shortcut__sub__manager.cc
new file mode 100644
index 0000000000..d7fcf3a80f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.740060000 +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/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h b/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__file__handler__registration.h
new file mode 100644
index 0000000000..fbf2cf226f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.740060000 +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/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc b/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.cc
new file mode 100644
index 0000000000..f24897f2b6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.744058000 +0000
++++ chrome/browser/web_applications/os_integration/web_app_shortcut.cc
+@@ -65,7 +65,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};
+@@ -227,7 +227,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/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h b/electron32/patches/patch-chrome_browser_web__applications_os__integration_web__app__shortcut.h
new file mode 100644
index 0000000000..8646d7cbec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.744058000 +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)
+
+@@ -70,7 +70,7 @@ struct ShortcutInfo {
+ std::set<std::string> file_handler_extensions;
+ std::set<std::string> file_handler_mime_types;
+ std::set<std::string> protocol_handlers;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::set<DesktopActionInfo> actions;
+ #endif // BUILDFLAG(IS_LINUX)
+
diff --git a/electron32/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc b/electron32/patches/patch-chrome_browser_web__applications_policy_web__app__policy__manager.cc
new file mode 100644
index 0000000000..045d699b18
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.744058000 +0000
++++ chrome/browser/web_applications/policy/web_app_policy_manager.cc
+@@ -101,7 +101,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/electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc b/electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.cc
new file mode 100644
index 0000000000..d9038de226
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.748055700 +0000
++++ chrome/browser/web_applications/test/os_integration_test_override_impl.cc
+@@ -46,7 +46,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
+
+@@ -131,7 +131,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,
+@@ -266,7 +266,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;
+@@ -314,7 +314,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();
+@@ -328,7 +328,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));
+@@ -384,7 +384,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_) {
+@@ -427,7 +427,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;
+@@ -477,7 +477,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);
+@@ -502,7 +502,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/electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h b/electron32/patches/patch-chrome_browser_web__applications_test_os__integration__test__override__impl.h
new file mode 100644
index 0000000000..9a3ec0aadc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.748055700 +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)
+
+@@ -242,7 +242,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();
+@@ -322,7 +322,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/electron32/patches/patch-chrome_browser_web__applications_web__app__helpers.cc b/electron32/patches/patch-chrome_browser_web__applications_web__app__helpers.cc
new file mode 100644
index 0000000000..176d1b879a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.752053500 +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/electron32/patches/patch-chrome_browser_web__applications_web__app__install__info.h b/electron32/patches/patch-chrome_browser_web__applications_web__app__install__info.h
new file mode 100644
index 0000000000..3969cf7658
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.752053500 +0000
++++ chrome/browser/web_applications/web_app_install_info.h
+@@ -38,7 +38,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/electron32/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc b/electron32/patches/patch-chrome_browser_webauthn_chrome__authenticator__request__delegate.cc
new file mode 100644
index 0000000000..bf51012f77
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.764047000 +0000
++++ chrome/browser/webauthn/chrome_authenticator_request_delegate.cc
+@@ -1095,7 +1095,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/electron32/patches/patch-chrome_browser_webauthn_enclave__manager.cc b/electron32/patches/patch-chrome_browser_webauthn_enclave__manager.cc
new file mode 100644
index 0000000000..375e2a23f6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.764047000 +0000
++++ chrome/browser/webauthn/enclave_manager.cc
+@@ -686,7 +686,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");
+@@ -696,7 +696,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/electron32/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc b/electron32/patches/patch-chrome_browser_webauthn_gpm__user__verification__policy.cc
new file mode 100644
index 0000000000..ad16d5d4c0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.764047000 +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/electron32/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc b/electron32/patches/patch-chrome_browser_webauthn_unexportable__key__utils.cc
new file mode 100644
index 0000000000..8746f70f2b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.764047000 +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/electron32/patches/patch-chrome_browser_win_chrome__process__finder.cc b/electron32/patches/patch-chrome_browser_win_chrome__process__finder.cc
new file mode 100644
index 0000000000..36538a7a7f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.772042500 +0000
++++ chrome/browser/win/chrome_process_finder.cc
+@@ -41,7 +41,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::span<const uint8_t> additional_data) {
+ TRACE_EVENT0("startup", "AttemptToNotifyRunningChrome");
+
+ DCHECK(remote_window);
+@@ -70,12 +72,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/electron32/patches/patch-chrome_browser_win_chrome__process__finder.h b/electron32/patches/patch-chrome_browser_win_chrome__process__finder.h
new file mode 100644
index 0000000000..2b342348f9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.772042500 +0000
++++ chrome/browser/win/chrome_process_finder.h
+@@ -7,6 +7,7 @@
+
+ #include <windows.h>
+
++#include "base/containers/span.h"
+ #include "base/time/time.h"
+
+ namespace base {
+@@ -27,7 +28,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::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/electron32/patches/patch-chrome_browser_win_titlebar__config.cc b/electron32/patches/patch-chrome_browser_win_titlebar__config.cc
new file mode 100644
index 0000000000..6408f0fb49
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.776040300 +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/electron32/patches/patch-chrome_common_channel__info.h b/electron32/patches/patch-chrome_common_channel__info.h
new file mode 100644
index 0000000000..3710e72cb7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.780038000 +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/electron32/patches/patch-chrome_common_channel__info__posix.cc b/electron32/patches/patch-chrome_common_channel__info__posix.cc
new file mode 100644
index 0000000000..31e362d1a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.780038000 +0000
++++ chrome/common/channel_info_posix.cc
+@@ -93,7 +93,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();
+@@ -121,7 +121,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/electron32/patches/patch-chrome_common_chrome__features.cc b/electron32/patches/patch-chrome_common_chrome__features.cc
new file mode 100644
index 0000000000..92c0cc4e56
--- /dev/null
+++ b/electron32/patches/patch-chrome_common_chrome__features.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/chrome_features.cc.orig 2024-10-18 12:34:03.971932400 +0000
++++ chrome/common/chrome_features.cc
+@@ -75,7 +75,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,
+@@ -93,7 +93,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.
+@@ -260,7 +260,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
+@@ -309,7 +309,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.
+@@ -897,7 +897,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);
+@@ -910,7 +910,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/electron32/patches/patch-chrome_common_chrome__features.h b/electron32/patches/patch-chrome_common_chrome__features.h
new file mode 100644
index 0000000000..7de1230de7
--- /dev/null
+++ b/electron32/patches/patch-chrome_common_chrome__features.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
+
+--- chrome/common/chrome_features.h.orig 2024-10-18 12:34:03.971932400 +0000
++++ chrome/common/chrome_features.h
+@@ -55,13 +55,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)
+@@ -192,7 +192,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);
+@@ -545,7 +545,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;
+@@ -553,7 +553,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/electron32/patches/patch-chrome_common_chrome__paths.cc b/electron32/patches/patch-chrome_common_chrome__paths.cc
new file mode 100644
index 0000000000..c88b02bb19
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.975930200 +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)
+@@ -225,7 +225,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;
+ }
+@@ -541,7 +541,7 @@ bool PathProvider(int key, base::FilePat
+ return false;
+ }
+ break;
+-#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;
+@@ -552,7 +552,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;
+@@ -561,7 +561,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;
+@@ -599,7 +599,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)
+@@ -613,6 +613,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/electron32/patches/patch-chrome_common_chrome__paths.h b/electron32/patches/patch-chrome_common_chrome__paths.h
new file mode 100644
index 0000000000..39febe8ce0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.975930200 +0000
++++ chrome/common/chrome_paths.h
+@@ -59,7 +59,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
+@@ -67,7 +67,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
+@@ -126,7 +126,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/electron32/patches/patch-chrome_common_chrome__paths__internal.h b/electron32/patches/patch-chrome_common_chrome__paths__internal.h
new file mode 100644
index 0000000000..0ed4f3e8cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:03.975930200 +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/electron32/patches/patch-chrome_common_chrome__switches.cc b/electron32/patches/patch-chrome_common_chrome__switches.cc
new file mode 100644
index 0000000000..391d378539
--- /dev/null
+++ b/electron32/patches/patch-chrome_common_chrome__switches.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/common/chrome_switches.cc.orig 2024-10-18 12:34:03.975930200 +0000
++++ chrome/common/chrome_switches.cc
+@@ -898,14 +898,14 @@ 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.
+ const char kGuest[] = "guest";
+ #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/electron32/patches/patch-chrome_common_chrome__switches.h b/electron32/patches/patch-chrome_common_chrome__switches.h
new file mode 100644
index 0000000000..68137a47a0
--- /dev/null
+++ b/electron32/patches/patch-chrome_common_chrome__switches.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/common/chrome_switches.h.orig 2024-10-18 12:34:03.975930200 +0000
++++ chrome/common/chrome_switches.h
+@@ -279,12 +279,12 @@ 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[];
+ #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/electron32/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc b/electron32/patches/patch-chrome_common_extensions_permissions_chrome__permission__message__rules.cc
new file mode 100644
index 0000000000..b3524aa672
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.023903800 +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/electron32/patches/patch-chrome_common_media_cdm__host__file__path.cc b/electron32/patches/patch-chrome_common_media_cdm__host__file__path.cc
new file mode 100644
index 0000000000..6245bae30e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.027901600 +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/electron32/patches/patch-chrome_common_media_cdm__registration.cc b/electron32/patches/patch-chrome_common_media_cdm__registration.cc
new file mode 100644
index 0000000000..a423c72730
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.027901600 +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/electron32/patches/patch-chrome_common_media_cdm__registration.h b/electron32/patches/patch-chrome_common_media_cdm__registration.h
new file mode 100644
index 0000000000..ccb1fe5fae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.027901600 +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/electron32/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h b/electron32/patches/patch-chrome_common_media_component__widevine__cdm__hint__file__linux.h
new file mode 100644
index 0000000000..24ea57b9fc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.027901600 +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/electron32/patches/patch-chrome_common_pref__names.h b/electron32/patches/patch-chrome_common_pref__names.h
new file mode 100644
index 0000000000..0eedf9ce3d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.031899500 +0000
++++ chrome/common/pref_names.h
+@@ -1364,7 +1364,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
+@@ -1507,7 +1507,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";
+@@ -2112,7 +2112,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
+@@ -2549,14 +2549,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";
+@@ -2634,7 +2634,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[] =
+@@ -3164,7 +3164,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
+@@ -3760,7 +3760,7 @@ inline constexpr char kFileOrDirectoryPi
+ 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[] =
+@@ -4034,7 +4034,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
+@@ -4128,7 +4128,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/electron32/patches/patch-chrome_common_url__constants.h b/electron32/patches/patch-chrome_common_url__constants.h
new file mode 100644
index 0000000000..0305f38df8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.035897300 +0000
++++ chrome/common/url_constants.h
+@@ -927,7 +927,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/electron32/patches/patch-chrome_common_webui__url__constants.cc b/electron32/patches/patch-chrome_common_webui__url__constants.cc
new file mode 100644
index 0000000000..34056fe0e9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.035897300 +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)
+@@ -284,7 +284,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/electron32/patches/patch-chrome_common_webui__url__constants.h b/electron32/patches/patch-chrome_common_webui__url__constants.h
new file mode 100644
index 0000000000..a15b63ae7a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.035897300 +0000
++++ chrome/common/webui_url_constants.h
+@@ -564,24 +564,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";
+@@ -593,13 +593,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/";
+@@ -621,7 +621,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/electron32/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc b/electron32/patches/patch-chrome_enterprise__companion_enterprise__companion__client.cc
new file mode 100644
index 0000000000..72899caa02
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.051888500 +0000
++++ chrome/enterprise_companion/enterprise_companion_client.cc
+@@ -33,7 +33,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/electron32/patches/patch-chrome_enterprise__companion_lock.cc b/electron32/patches/patch-chrome_enterprise__companion_lock.cc
new file mode 100644
index 0000000000..42e2644095
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.051888500 +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/electron32/patches/patch-chrome_renderer_pepper_chrome__renderer__pepper__host__factory.cc b/electron32/patches/patch-chrome_renderer_pepper_chrome__renderer__pepper__host__factory.cc
new file mode 100644
index 0000000000..35c971fa6e
--- /dev/null
+++ b/electron32/patches/patch-chrome_renderer_pepper_chrome__renderer__pepper__host__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
+
+--- chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc.orig 2024-10-18 12:34:04.087868700 +0000
++++ chrome/renderer/pepper/chrome_renderer_pepper_host_factory.cc
+@@ -5,7 +5,9 @@
+ #include "chrome/renderer/pepper/chrome_renderer_pepper_host_factory.h"
+
+ #include "base/check_op.h"
++#if 0
+ #include "chrome/renderer/pepper/pepper_uma_host.h"
++#endif
+ #include "content/public/renderer/renderer_ppapi_host.h"
+ #include "ppapi/host/ppapi_host.h"
+ #include "ppapi/host/resource_host.h"
+@@ -33,6 +35,7 @@ ChromeRendererPepperHostFactory::CreateR
+ if (!host_->IsValidInstance(instance))
+ return nullptr;
+
++#if 0
+ // Permissions for the following interfaces will be checked at the
+ // time of the corresponding instance's method calls. Currently these
+ // interfaces are available only for whitelisted apps which may not have
+@@ -42,6 +45,7 @@ ChromeRendererPepperHostFactory::CreateR
+ return std::make_unique<PepperUMAHost>(host_, instance, resource);
+ }
+ }
++#endif
+
+ return nullptr;
+ }
diff --git a/electron32/patches/patch-chrome_renderer_pepper_pepper__helper.h b/electron32/patches/patch-chrome_renderer_pepper_pepper__helper.h
new file mode 100644
index 0000000000..36c6aea0db
--- /dev/null
+++ b/electron32/patches/patch-chrome_renderer_pepper_pepper__helper.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/renderer/pepper/pepper_helper.h.orig 2024-10-18 12:34:04.087868700 +0000
++++ chrome/renderer/pepper/pepper_helper.h
+@@ -5,11 +5,13 @@
+ #ifndef CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_
+ #define CHROME_RENDERER_PEPPER_PEPPER_HELPER_H_
+
++#include "base/component_export.h"
+ #include "content/public/renderer/render_frame_observer.h"
+
+ // This class listens for Pepper creation events from the RenderFrame and
+ // attaches the parts required for Chrome-specific plugin support.
+-class PepperHelper : public content::RenderFrameObserver {
++class COMPONENT_EXPORT(PEPPER_FLASH) PepperHelper
++ : public content::RenderFrameObserver {
+ public:
+ explicit PepperHelper(content::RenderFrame* render_frame);
+
diff --git a/electron32/patches/patch-chrome_services_printing_print__backend__service__impl.cc b/electron32/patches/patch-chrome_services_printing_print__backend__service__impl.cc
new file mode 100644
index 0000000000..cbb9dc2095
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.099862000 +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());
+@@ -470,7 +470,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`.
+@@ -691,7 +691,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/electron32/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc b/electron32/patches/patch-chrome_services_speech_audio__source__fetcher__impl.cc
new file mode 100644
index 0000000000..2d68dea3a0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.107858000 +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/electron32/patches/patch-chrome_test_BUILD.gn b/electron32/patches/patch-chrome_test_BUILD.gn
new file mode 100644
index 0000000000..485fd5c6fa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.111855700 +0000
++++ chrome/test/BUILD.gn
+@@ -7202,9 +7202,12 @@ test("unit_tests") {
+ "//chrome/browser/safe_browsing/incident_reporting/verifier_test:verifier_test_dll_2",
+ ]
+
++ 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",
+@@ -8228,6 +8231,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",
+@@ -8303,7 +8310,6 @@ test("unit_tests") {
+
+ # Non-android deps for "unit_tests" target.
+ deps += [
+- "//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/electron32/patches/patch-chrome_test_base_scoped__channel__override__posix.cc b/electron32/patches/patch-chrome_test_base_scoped__channel__override__posix.cc
new file mode 100644
index 0000000000..04ebde7990
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.127847000 +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/electron32/patches/patch-chrome_test_chromedriver_chrome__launcher.cc b/electron32/patches/patch-chrome_test_chromedriver_chrome__launcher.cc
new file mode 100644
index 0000000000..17766788d1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.135842600 +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/electron32/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc b/electron32/patches/patch-chrome_test_chromedriver_chrome_chrome__finder.cc
new file mode 100644
index 0000000000..72bf748ebb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.131844800 +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/electron32/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc b/electron32/patches/patch-chrome_test_chromedriver_key__converter__unittest.cc
new file mode 100644
index 0000000000..5a519263d5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.135842600 +0000
++++ chrome/test/chromedriver/key_converter_unittest.cc
+@@ -246,7 +246,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
+@@ -303,7 +303,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/electron32/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc b/electron32/patches/patch-chrome_test_chromedriver_keycode__text__conversion__unittest.cc
new file mode 100644
index 0000000000..5f3ff4bc7d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:04.139840400 +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/electron32/patches/patch-chrome_updater_configurator.cc b/electron32/patches/patch-chrome_updater_configurator.cc
new file mode 100644
index 0000000000..c1a6ff8da1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.371168000 +0000
++++ chrome/updater/configurator.cc
+@@ -67,7 +67,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/electron32/patches/patch-chrome_updater_lock.cc b/electron32/patches/patch-chrome_updater_lock.cc
new file mode 100644
index 0000000000..1a87d6b049
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.375165700 +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/electron32/patches/patch-chrome_updater_util_posix__util.cc b/electron32/patches/patch-chrome_updater_util_posix__util.cc
new file mode 100644
index 0000000000..d6d6607021
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.419141800 +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/electron32/patches/patch-chrome_utility_services.cc b/electron32/patches/patch-chrome_utility_services.cc
new file mode 100644
index 0000000000..31cb197438
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.427137400 +0000
++++ chrome/utility/services.cc
+@@ -57,7 +57,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)
+
+@@ -214,7 +214,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/electron32/patches/patch-chromecast_browser_cast__browser__main__parts.cc b/electron32/patches/patch-chromecast_browser_cast__browser__main__parts.cc
new file mode 100644
index 0000000000..9838e95c20
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.439130800 +0000
++++ chromecast/browser/cast_browser_main_parts.cc
+@@ -94,7 +94,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>
+@@ -267,7 +267,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());
+@@ -313,7 +313,7 @@ const DefaultCommandLineSwitch kDefaultS
+ {cc::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.
+@@ -490,7 +490,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/electron32/patches/patch-chromecast_browser_cast__content__browser__client.cc b/electron32/patches/patch-chromecast_browser_cast__content__browser__client.cc
new file mode 100644
index 0000000000..69b4c82f33
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.439130800 +0000
++++ chromecast/browser/cast_content_browser_client.cc
+@@ -431,7 +431,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/electron32/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc b/electron32/patches/patch-chromecast_cast__core_runtime_browser_runtime__application__service__impl.cc
new file mode 100644
index 0000000000..3a372afb7e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.451124400 +0000
++++ chromecast/cast_core/runtime/browser/runtime_application_service_impl.cc
+@@ -336,7 +336,7 @@ CastWebView::Scoped RuntimeApplicationSe
+ GetFlagEntry(feature::kCastCoreIsRemoteControlMode,
+ config_.extra_features(), /*default_value=*/false);
+ params->enabled_for_dev = IsEnabledForDev();
+-#if BUILDFLAG(ENABLE_CAST_RECEIVER) && BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(ENABLE_CAST_RECEIVER) && (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD))
+ // cast_receiver::ApplicationControlsImpl constructs an instance of
+ // url_rewrite::UrlRequestRewriteRulesManager. CastWebContentsImpl should NOT
+ // construct its own instance, or UrlRequestRulesReceiver will crash when a
diff --git a/electron32/patches/patch-chromecast_media_base_default__monotonic__clock.cc b/electron32/patches/patch-chromecast_media_base_default__monotonic__clock.cc
new file mode 100644
index 0000000000..3cf4fc87c1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:05.463117800 +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/electron32/patches/patch-components_autofill_core_browser_payments__data__manager.cc b/electron32/patches/patch-components_autofill_core_browser_payments__data__manager.cc
new file mode 100644
index 0000000000..c8d4b7e54a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.014818000 +0000
++++ components/autofill/core/browser/payments_data_manager.cc
+@@ -1055,7 +1055,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/electron32/patches/patch-components_autofill_core_common_autofill__features.cc b/electron32/patches/patch-components_autofill_core_common_autofill__features.cc
new file mode 100644
index 0000000000..4c5e57a46a
--- /dev/null
+++ b/electron32/patches/patch-components_autofill_core_common_autofill__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/autofill/core/common/autofill_features.cc.orig 2024-10-18 12:34:06.026811400 +0000
++++ components/autofill/core/common/autofill_features.cc
+@@ -673,7 +673,7 @@ BASE_FEATURE(kAutofillSilentProfileUpdat
+ // Enabled by default for Mac and Windows platforms.
+ BASE_FEATURE(kAutofillContentEditableChangeEvents,
+ "AutofillContentEditableChangeEvents",
+-#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/electron32/patches/patch-components_autofill_core_common_autofill__payments__features.cc b/electron32/patches/patch-components_autofill_core_common_autofill__payments__features.cc
new file mode 100644
index 0000000000..2774a4b662
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.026811400 +0000
++++ components/autofill/core/common/autofill_payments_features.cc
+@@ -8,7 +8,7 @@
+
+ namespace autofill::features {
+
+-#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.
+@@ -272,7 +272,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/electron32/patches/patch-components_autofill_core_common_autofill__payments__features.h b/electron32/patches/patch-components_autofill_core_common_autofill__payments__features.h
new file mode 100644
index 0000000000..06cc97b435
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.026811400 +0000
++++ components/autofill/core/common/autofill_payments_features.h
+@@ -14,7 +14,7 @@ namespace autofill::features {
+
+ // All features in alphabetical order.
+ #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/electron32/patches/patch-components_commerce_core_commerce__feature__list.cc b/electron32/patches/patch-components_commerce_core_commerce__feature__list.cc
new file mode 100644
index 0000000000..8b3cbb831d
--- /dev/null
+++ b/electron32/patches/patch-components_commerce_core_commerce__feature__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
+
+--- components/commerce/core/commerce_feature_list.cc.orig 2024-10-18 12:34:06.154742200 +0000
++++ components/commerce/core/commerce_feature_list.cc
+@@ -168,7 +168,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);
+@@ -261,7 +261,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/electron32/patches/patch-components_constrained__window_constrained__window__views.cc b/electron32/patches/patch-components_constrained__window_constrained__window__views.cc
new file mode 100644
index 0000000000..a618184b32
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.598502600 +0000
++++ components/constrained_window/constrained_window_views.cc
+@@ -369,7 +369,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/electron32/patches/patch-components_content__settings_core_browser_website__settings__registry.cc b/electron32/patches/patch-components_content__settings_core_browser_website__settings__registry.cc
new file mode 100644
index 0000000000..8f3cc66306
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.610496000 +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/electron32/patches/patch-components_cookie__config_cookie__store__util.cc b/electron32/patches/patch-components_cookie__config_cookie__store__util.cc
new file mode 100644
index 0000000000..2375122fd5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.618492000 +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/electron32/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py b/electron32/patches/patch-components_crash_content_tools_generate__breakpad__symbols.py
new file mode 100644
index 0000000000..0667071190
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_app_BUILD.gn b/electron32/patches/patch-components_crash_core_app_BUILD.gn
new file mode 100644
index 0000000000..b0c1f94f50
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +0000
++++ components/crash/core/app/BUILD.gn
+@@ -82,6 +82,10 @@ static_library("app") {
+ ]
+ }
+
++ if (is_bsd) {
++ sources -= [ "crashpad.cc" ]
++ }
++
+ defines = [ "CRASH_IMPLEMENTATION" ]
+
+ public_deps = [ ":lib" ]
+@@ -95,7 +99,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" ]
+ }
+@@ -115,7 +119,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",
+@@ -246,11 +250,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)) {
+ ldflags = [
+ # The handler is in
diff --git a/electron32/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc b/electron32/patches/patch-components_crash_core_app_chrome__crashpad__handler.cc
new file mode 100644
index 0000000000..0f7f7ff5c8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_app_crash__reporter__client.cc b/electron32/patches/patch-components_crash_core_app_crash__reporter__client.cc
new file mode 100644
index 0000000000..d495597bf9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +0000
++++ components/crash/core/app/crash_reporter_client.cc
+@@ -141,6 +141,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/electron32/patches/patch-components_crash_core_app_crash__reporter__client.h b/electron32/patches/patch-components_crash_core_app_crash__reporter__client.h
new file mode 100644
index 0000000000..f191835964
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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"
+@@ -153,6 +154,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/electron32/patches/patch-components_crash_core_app_crashpad__handler__main.cc b/electron32/patches/patch-components_crash_core_app_crashpad__handler__main.cc
new file mode 100644
index 0000000000..1a39f2af3a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_app_crashpad__linux.cc b/electron32/patches/patch-components_crash_core_app_crashpad__linux.cc
new file mode 100644
index 0000000000..ac7650c469
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_app_crashpad__mac.mm b/electron32/patches/patch-components_crash_core_app_crashpad__mac.mm
new file mode 100644
index 0000000000..b19ef0fc51
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_app_crashpad__win.cc b/electron32/patches/patch-components_crash_core_app_crashpad__win.cc
new file mode 100644
index 0000000000..aa9c7722db
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc b/electron32/patches/patch-components_crash_core_browser_crash__upload__list__crashpad.cc
new file mode 100644
index 0000000000..f3143488e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_crash_core_common_BUILD.gn b/electron32/patches/patch-components_crash_core_common_BUILD.gn
new file mode 100644
index 0000000000..85045a6501
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.622489700 +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/electron32/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h b/electron32/patches/patch-components_device__signals_core_browser_mock__signals__aggregator.h
new file mode 100644
index 0000000000..54d58a9488
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator.h b/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator.h
new file mode 100644
index 0000000000..b4b7cb5217
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc b/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.cc
new file mode 100644
index 0000000000..cbfa14e16e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h b/electron32/patches/patch-components_device__signals_core_browser_signals__aggregator__impl.h
new file mode 100644
index 0000000000..3e9a822822
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_user__permission__service.h b/electron32/patches/patch-components_device__signals_core_browser_user__permission__service.h
new file mode 100644
index 0000000000..bb645f7e8f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc b/electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.cc
new file mode 100644
index 0000000000..7381596a2f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h b/electron32/patches/patch-components_device__signals_core_browser_user__permission__service__impl.h
new file mode 100644
index 0000000000..cc7f0bf7b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_core_common_signals__features.cc b/electron32/patches/patch-components_device__signals_core_common_signals__features.cc
new file mode 100644
index 0000000000..3945c3acd3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +0000
++++ components/device_signals/core/common/signals_features.cc
+@@ -46,7 +46,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/electron32/patches/patch-components_device__signals_core_common_signals__features.h b/electron32/patches/patch-components_device__signals_core_common_signals__features.h
new file mode 100644
index 0000000000..663796d326
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +0000
++++ components/device_signals/core/common/signals_features.h
+@@ -28,7 +28,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/electron32/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc b/electron32/patches/patch-components_device__signals_core_system__signals_platform__delegate.cc
new file mode 100644
index 0000000000..5a060572e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.658470200 +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/electron32/patches/patch-components_device__signals_test_signals__contract.cc b/electron32/patches/patch-components_device__signals_test_signals__contract.cc
new file mode 100644
index 0000000000..bf569c8d3d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.662468000 +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/electron32/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc b/electron32/patches/patch-components_discardable__memory_service_discardable__shared__memory__manager.cc
new file mode 100644
index 0000000000..7477d5be7d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.662468000 +0000
++++ components/discardable_memory/service/discardable_shared_memory_manager.cc
+@@ -176,7 +176,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/electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc b/electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.cc
new file mode 100644
index 0000000000..b89ff7c00e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.690452800 +0000
++++ components/embedder_support/android/delegate/web_contents_delegate_android.cc
+@@ -182,14 +182,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/electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h b/electron32/patches/patch-components_embedder__support_android_delegate_web__contents__delegate__android.h
new file mode 100644
index 0000000000..13242db309
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.690452800 +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/electron32/patches/patch-components_embedder__support_user__agent__utils.cc b/electron32/patches/patch-components_embedder__support_user__agent__utils.cc
new file mode 100644
index 0000000000..e20990f480
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.698448700 +0000
++++ components/embedder_support/user_agent_utils.cc
+@@ -445,6 +445,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/electron32/patches/patch-components_embedder__support_user__agent__utils__unittest.cc b/electron32/patches/patch-components_embedder__support_user__agent__utils__unittest.cc
new file mode 100644
index 0000000000..ce0adac0b4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.698448700 +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/electron32/patches/patch-components_enterprise_watermarking_watermark.cc b/electron32/patches/patch-components_enterprise_watermarking_watermark.cc
new file mode 100644
index 0000000000..bfcf2d6564
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.706444300 +0000
++++ components/enterprise/watermarking/watermark.cc
+@@ -23,7 +23,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",
+@@ -34,7 +34,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/electron32/patches/patch-components_eye__dropper_eye__dropper__view.cc b/electron32/patches/patch-components_eye__dropper_eye__dropper__view.cc
new file mode 100644
index 0000000000..66c6ba8058
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.734429100 +0000
++++ components/eye_dropper/eye_dropper_view.cc
+@@ -202,7 +202,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/electron32/patches/patch-components_feature__engagement_public_event__constants.cc b/electron32/patches/patch-components_feature__engagement_public_event__constants.cc
new file mode 100644
index 0000000000..db24bf7c2d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +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 kTabGroupCreated[] = "tab_group_created";
diff --git a/electron32/patches/patch-components_feature__engagement_public_event__constants.h b/electron32/patches/patch-components_feature__engagement_public_event__constants.h
new file mode 100644
index 0000000000..b74fc5b821
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +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/electron32/patches/patch-components_feature__engagement_public_feature__configurations.cc b/electron32/patches/patch-components_feature__engagement_public_feature__configurations.cc
new file mode 100644
index 0000000000..d30c9e8670
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +0000
++++ components/feature_engagement/public/feature_configurations.cc
+@@ -99,7 +99,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
+@@ -118,7 +118,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;
+@@ -1599,7 +1599,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/electron32/patches/patch-components_feature__engagement_public_feature__constants.cc b/electron32/patches/patch-components_feature__engagement_public_feature__constants.cc
new file mode 100644
index 0000000000..22d7f41071
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +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",
+@@ -637,7 +637,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);
+@@ -771,7 +772,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/electron32/patches/patch-components_feature__engagement_public_feature__constants.h b/electron32/patches/patch-components_feature__engagement_public_feature__constants.h
new file mode 100644
index 0000000000..b1a1e74f42
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +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
+@@ -264,7 +264,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(kIPHAutofillExternalAccountProfileSuggestionFeature);
+ BASE_DECLARE_FEATURE(kIPHAutofillManualFallbackFeature);
+@@ -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);
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron32/patches/patch-components_feature__engagement_public_feature__list.cc b/electron32/patches/patch-components_feature__engagement_public_feature__list.cc
new file mode 100644
index 0000000000..48c8371acc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +0000
++++ components/feature_engagement/public/feature_list.cc
+@@ -155,7 +155,7 @@ const base::Feature* const kAllFeatures[
+ &kIPHiOSContextualPanelPriceInsightsFeature,
+ #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
+@@ -223,7 +223,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,
+ &kIPHAutofillExternalAccountProfileSuggestionFeature,
+ &kIPHAutofillManualFallbackFeature,
+@@ -273,7 +274,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,
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron32/patches/patch-components_feature__engagement_public_feature__list.h b/electron32/patches/patch-components_feature__engagement_public_feature__list.h
new file mode 100644
index 0000000000..f5fe1000a4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.746422800 +0000
++++ components/feature_engagement/public/feature_list.h
+@@ -278,7 +278,7 @@ DEFINE_VARIATION_PARAM(kIPHiOSContextual
+ #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
+@@ -385,7 +385,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");
+ DEFINE_VARIATION_PARAM(kIPHAutofillExternalAccountProfileSuggestionFeature,
+@@ -474,7 +475,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");
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+@@ -632,7 +633,7 @@ constexpr flags_ui::FeatureEntry::Featur
+ VARIATION_ENTRY(kIPHiOSContextualPanelSampleModelFeature),
+ VARIATION_ENTRY(kIPHiOSContextualPanelPriceInsightsFeature),
+ #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),
+@@ -690,7 +691,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(kIPHAutofillExternalAccountProfileSuggestionFeature),
+ VARIATION_ENTRY(kIPHAutofillManualFallbackFeature),
+@@ -741,7 +743,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),
+ #endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
+
diff --git a/electron32/patches/patch-components_feed_core_proto_v2_wire_version.proto b/electron32/patches/patch-components_feed_core_proto_v2_wire_version.proto
new file mode 100644
index 0000000000..8742c91ce8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.750420600 +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/electron32/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc b/electron32/patches/patch-components_feed_core_v2_feed__network__impl__unittest.cc
new file mode 100644
index 0000000000..cfe780ca50
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.754418400 +0000
++++ components/feed/core/v2/feed_network_impl_unittest.cc
+@@ -752,8 +752,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/electron32/patches/patch-components_feed_core_v2_proto__util.cc b/electron32/patches/patch-components_feed_core_v2_proto__util.cc
new file mode 100644
index 0000000000..be1465dfc3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.754418400 +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/electron32/patches/patch-components_feed_core_v2_proto__util__unittest.cc b/electron32/patches/patch-components_feed_core_v2_proto__util__unittest.cc
new file mode 100644
index 0000000000..66fc40d7da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.754418400 +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/electron32/patches/patch-components_feed_core_v2_test_proto__printer.cc b/electron32/patches/patch-components_feed_core_v2_test_proto__printer.cc
new file mode 100644
index 0000000000..2c398483ac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.758416200 +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/electron32/patches/patch-components_flags__ui_flags__state.cc b/electron32/patches/patch-components_flags__ui_flags__state.cc
new file mode 100644
index 0000000000..260268a01d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.766411800 +0000
++++ components/flags_ui/flags_state.cc
+@@ -750,7 +750,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/electron32/patches/patch-components_gwp__asan_BUILD.gn b/electron32/patches/patch-components_gwp__asan_BUILD.gn
new file mode 100644
index 0000000000..595158f25e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.782403200 +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/electron32/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc b/electron32/patches/patch-components_gwp__asan_client_guarded__page__allocator__posix.cc
new file mode 100644
index 0000000000..0f6ddfeece
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.782403200 +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/electron32/patches/patch-components_gwp__asan_client_gwp__asan.cc b/electron32/patches/patch-components_gwp__asan_client_gwp__asan.cc
new file mode 100644
index 0000000000..0c66f4e39f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.782403200 +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/electron32/patches/patch-components_gwp__asan_client_gwp__asan__features.cc b/electron32/patches/patch-components_gwp__asan_client_gwp__asan__features.cc
new file mode 100644
index 0000000000..3b78b3ae6c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.782403200 +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/electron32/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc b/electron32/patches/patch-components_gwp__asan_crash__handler_crash__analyzer.cc
new file mode 100644
index 0000000000..49ee7f4cf1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.786401000 +0000
++++ components/gwp_asan/crash_handler/crash_analyzer.cc
+@@ -30,7 +30,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>
+@@ -90,7 +90,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/electron32/patches/patch-components_live__caption_caption__util.cc b/electron32/patches/patch-components_live__caption_caption__util.cc
new file mode 100644
index 0000000000..1121e8ea54
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.838373000 +0000
++++ components/live_caption/caption_util.cc
+@@ -144,7 +144,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/electron32/patches/patch-components_live__caption_caption__util.h b/electron32/patches/patch-components_live__caption_caption__util.h
new file mode 100644
index 0000000000..c062dabe20
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.838373000 +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/electron32/patches/patch-components_media__router_common_media__source.cc b/electron32/patches/patch-components_media__router_common_media__source.cc
new file mode 100644
index 0000000000..9076f92026
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.858362200 +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/electron32/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc b/electron32/patches/patch-components_media__router_common_providers_cast_channel_cast__message__util.cc
new file mode 100644
index 0000000000..719bf6547e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.862360000 +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/electron32/patches/patch-components_metrics_drive__metrics__provider__linux.cc b/electron32/patches/patch-components_metrics_drive__metrics__provider__linux.cc
new file mode 100644
index 0000000000..c72d982ce5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.874353600 +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/electron32/patches/patch-components_metrics_metrics__log.cc b/electron32/patches/patch-components_metrics_metrics__log.cc
new file mode 100644
index 0000000000..9b0f058f71
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.878351400 +0000
++++ components/metrics/metrics_log.cc
+@@ -56,7 +56,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
+@@ -146,7 +146,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) {
+@@ -415,7 +415,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());
+@@ -432,7 +432,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/electron32/patches/patch-components_metrics_motherboard.cc b/electron32/patches/patch-components_metrics_motherboard.cc
new file mode 100644
index 0000000000..4f6c8d4311
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.878351400 +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/electron32/patches/patch-components_named__mojo__ipc__server_connection__info.h b/electron32/patches/patch-components_named__mojo__ipc__server_connection__info.h
new file mode 100644
index 0000000000..ab856ec458
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.898340700 +0000
++++ components/named_mojo_ipc_server/connection_info.h
+@@ -14,8 +14,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 {
+@@ -33,7 +39,7 @@ struct ConnectionInfo {
+ std::optional<base::win::ScopedHandle> impersonation_token{};
+ #elif 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/electron32/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc b/electron32/patches/patch-components_named__mojo__ipc__server_named__mojo__ipc__server__client__util.cc
new file mode 100644
index 0000000000..366e44639c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.898340700 +0000
++++ components/named_mojo_ipc_server/named_mojo_ipc_server_client_util.cc
+@@ -22,7 +22,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/electron32/patches/patch-components_named__system__lock_lock.h b/electron32/patches/patch-components_named__system__lock_lock.h
new file mode 100644
index 0000000000..f6c6a3c1a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.898340700 +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/electron32/patches/patch-components_neterror_resources_neterror.js b/electron32/patches/patch-components_neterror_resources_neterror.js
new file mode 100644
index 0000000000..036b814d44
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.902338500 +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/electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator.cc b/electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator.cc
new file mode 100644
index 0000000000..76dfb1d844
--- /dev/null
+++ b/electron32/patches/patch-components_network__session__configurator_browser_network__session__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
+
+--- components/network_session_configurator/browser/network_session_configurator.cc.orig 2024-10-18 12:34:06.906336300 +0000
++++ components/network_session_configurator/browser/network_session_configurator.cc
+@@ -825,7 +825,7 @@ net::URLRequestContextBuilder::HttpCache
+ // backport, having it behave differently than in stable would be a bigger
+ // problem. TODO: Does this work in later macOS releases?
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ return net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE;
+ #else
+ return net::URLRequestContextBuilder::HttpCacheParams::DISK_BLOCKFILE;
diff --git a/electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc b/electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator__unittest.cc
new file mode 100644
index 0000000000..c02ed82623
--- /dev/null
+++ b/electron32/patches/patch-components_network__session__configurator_browser_network__session__configurator__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/network_session_configurator/browser/network_session_configurator_unittest.cc.orig 2024-10-18 12:34:06.906336300 +0000
++++ components/network_session_configurator/browser/network_session_configurator_unittest.cc
+@@ -782,7 +782,7 @@ TEST_F(NetworkSessionConfiguratorTest, H
+
+ TEST_F(NetworkSessionConfiguratorTest, DefaultCacheBackend) {
+ #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
+- BUILDFLAG(IS_MAC)
++ BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ EXPECT_EQ(net::URLRequestContextBuilder::HttpCacheParams::DISK_SIMPLE,
+ ChooseCacheType());
+ #else
diff --git a/electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc b/electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.cc
new file mode 100644
index 0000000000..ca3686a940
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.918329700 +0000
++++ components/offline_pages/content/background_loader/background_loader_contents.cc
+@@ -85,8 +85,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/electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h b/electron32/patches/patch-components_offline__pages_content_background__loader_background__loader__contents.h
new file mode 100644
index 0000000000..6ff90ce5e2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.918329700 +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;
+
+ void AddNewContents(content::WebContents* source,
+ std::unique_ptr<content::WebContents> new_contents,
diff --git a/electron32/patches/patch-components_optimization__guide_core_optimization__guide__util.cc b/electron32/patches/patch-components_optimization__guide_core_optimization__guide__util.cc
new file mode 100644
index 0000000000..110f81c6cc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.986293000 +0000
++++ components/optimization_guide/core/optimization_guide_util.cc
+@@ -35,7 +35,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/electron32/patches/patch-components_os__crypt_sync_BUILD.gn b/electron32/patches/patch-components_os__crypt_sync_BUILD.gn
new file mode 100644
index 0000000000..b0b87fc728
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.990290900 +0000
++++ components/os_crypt/sync/BUILD.gn
+@@ -46,6 +46,7 @@ component("os_crypt") {
+ "os_crypt_mac.mm",
+ ]
+ deps += [ "//crypto:mock_apple_keychain" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_win) {
diff --git a/electron32/patches/patch-components_os__crypt_sync_keychain__password__mac.mm b/electron32/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
new file mode 100644
index 0000000000..f4097ff892
--- /dev/null
+++ b/electron32/patches/patch-components_os__crypt_sync_keychain__password__mac.mm
@@ -0,0 +1,92 @@
+$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 2024-10-18 12:34:06.994288700 +0000
++++ components/os_crypt/sync/keychain_password_mac.mm
+@@ -22,6 +22,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 +87,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 +106,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/electron32/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc b/electron32/patches/patch-components_os__crypt_sync_libsecret__util__linux.cc
new file mode 100644
index 0000000000..04772ffb39
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.994288700 +0000
++++ components/os_crypt/sync/libsecret_util_linux.cc
+@@ -176,16 +176,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/electron32/patches/patch-components_os__crypt_sync_os__crypt.h b/electron32/patches/patch-components_os__crypt_sync_os__crypt.h
new file mode 100644
index 0000000000..dd18198fe8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:06.994288700 +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
+
+-#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)
+ // Create the KeyStorage. Will be null if no service is found. A Config must
+ // be set before every call to this method.
+ std::unique_ptr<KeyStorageLinux> CreateKeyStorage();
diff --git a/electron32/patches/patch-components_paint__preview_browser_paint__preview__client.cc b/electron32/patches/patch-components_paint__preview_browser_paint__preview__client.cc
new file mode 100644
index 0000000000..976fa12da8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.214170700 +0000
++++ components/paint_preview/browser/paint_preview_client.cc
+@@ -313,8 +313,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/electron32/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc b/electron32/patches/patch-components_paint__preview_browser_paint__preview__client__unittest.cc
new file mode 100644
index 0000000000..8f51456469
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.214170700 +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/electron32/patches/patch-components_paint__preview_common_proto_paint__preview.proto b/electron32/patches/patch-components_paint__preview_common_proto_paint__preview.proto
new file mode 100644
index 0000000000..ed3194fc82
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.214170700 +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/electron32/patches/patch-components_paint__preview_player_player__compositor__delegate.cc b/electron32/patches/patch-components_paint__preview_player_player__compositor__delegate.cc
new file mode 100644
index 0000000000..694745f77d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.218168500 +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/electron32/patches/patch-components_password__manager_core_browser_features_password__features.cc b/electron32/patches/patch-components_password__manager_core_browser_features_password__features.cc
new file mode 100644
index 0000000000..3fedf8a909
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.222166300 +0000
++++ components/password_manager/core/browser/features/password_features.cc
+@@ -41,7 +41,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
+@@ -90,7 +90,7 @@ BASE_FEATURE(kPasswordManualFallbackAvai
+ "PasswordManualFallbackAvailable",
+ 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/electron32/patches/patch-components_password__manager_core_browser_features_password__features.h b/electron32/patches/patch-components_password__manager_core_browser_features_password__features.h
new file mode 100644
index 0000000000..189ae8bc55
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.226164300 +0000
++++ components/password_manager/core/browser/features/password_features.h
+@@ -90,7 +90,7 @@ BASE_DECLARE_FEATURE(kPasswordManagerLog
+ // Enables triggering password suggestions through the context menu.
+ BASE_DECLARE_FEATURE(kPasswordManualFallbackAvailable);
+
+-#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/electron32/patches/patch-components_password__manager_core_browser_password__form__manager.cc b/electron32/patches/patch-components_password__manager_core_browser_password__form__manager.cc
new file mode 100644
index 0000000000..fa5922750a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.234160000 +0000
++++ components/password_manager/core/browser/password_form_manager.cc
+@@ -58,7 +58,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
+
+@@ -228,7 +228,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()) {
+@@ -885,7 +885,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/electron32/patches/patch-components_password__manager_core_browser_password__manager.cc b/electron32/patches/patch-components_password__manager_core_browser_password__manager.cc
new file mode 100644
index 0000000000..8649b0b0b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.234160000 +0000
++++ components/password_manager/core/browser/password_manager.cc
+@@ -425,7 +425,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
+@@ -438,7 +438,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/electron32/patches/patch-components_password__manager_core_browser_password__manager__client.h b/electron32/patches/patch-components_password__manager_core_browser_password__manager__client.h
new file mode 100644
index 0000000000..a6b0294019
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.234160000 +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"
+@@ -520,7 +520,7 @@ class PasswordManagerClient {
+ virtual void RefreshPasswordManagerSettingsIfNeeded() const;
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // Creates and show the cross domain confirmation popup.
+ virtual std::unique_ptr<PasswordCrossDomainConfirmationPopupController>
+ ShowCrossDomainConfirmationPopup(const gfx::RectF& element_bounds,
diff --git a/electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.cc b/electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.cc
new file mode 100644
index 0000000000..ac0e48a42d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.238157700 +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/electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.h b/electron32/patches/patch-components_password__manager_core_browser_password__manager__switches.h
new file mode 100644
index 0000000000..e7438ef3e4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.238157700 +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/electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc b/electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
new file mode 100644
index 0000000000..6fa7b9383b
--- /dev/null
+++ b/electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.cc
@@ -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_manual_fallback_flow.cc.orig 2024-10-18 12:34:07.238157700 +0000
++++ components/password_manager/core/browser/password_manual_fallback_flow.cc
+@@ -204,7 +204,7 @@ void PasswordManualFallbackFlow::DidAcce
+ payload.password));
+
+ #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/electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h b/electron32/patches/patch-components_password__manager_core_browser_password__manual__fallback__flow.h
new file mode 100644
index 0000000000..e28654905b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.238157700 +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)
+@@ -161,7 +161,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/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database.cc b/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database.cc
new file mode 100644
index 0000000000..e1fdf5fa5d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.242155800 +0000
++++ components/password_manager/core/browser/password_store/login_database.cc
+@@ -1028,7 +1028,7 @@ bool ShouldDeleteUndecryptablePasswords(
+ clearing_undecryptable_passwords,
+ bool is_user_data_dir_policy_set,
+ bool is_disabled_by_policy) {
+-#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
+@@ -1047,7 +1047,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/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc b/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__async__helper.cc
new file mode 100644
index 0000000000..59b0baa7d7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.242155800 +0000
++++ components/password_manager/core/browser/password_store/login_database_async_helper.cc
+@@ -152,7 +152,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/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc b/electron32/patches/patch-components_password__manager_core_browser_password__store_login__database__unittest.cc
new file mode 100644
index 0000000000..38c3c9c6d5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.242155800 +0000
++++ components/password_manager/core/browser/password_store/login_database_unittest.cc
+@@ -2207,7 +2207,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/electron32/patches/patch-components_password__manager_core_browser_password__store_password__store__built__in__backend.cc b/electron32/patches/patch-components_password__manager_core_browser_password__store_password__store__built__in__backend.cc
new file mode 100644
index 0000000000..12f6b5c272
--- /dev/null
+++ b/electron32/patches/patch-components_password__manager_core_browser_password__store_password__store__built__in__backend.cc
@@ -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/password_store_built_in_backend.cc.orig 2024-10-18 12:34:07.242155800 +0000
++++ components/password_manager/core/browser/password_store/password_store_built_in_backend.cc
+@@ -211,7 +211,7 @@ void PasswordStoreBuiltInBackend::InitBa
+ std::move(clearing_undecryptable_passwords_cb)));
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ background_task_runner_->PostTask(
+ FROM_HERE,
+ base::BindOnce(&LoginDatabaseAsyncHelper::
diff --git a/electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc b/electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.cc
new file mode 100644
index 0000000000..03b0cb0292
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.246153600 +0000
++++ components/password_manager/core/browser/stub_password_manager_client.cc
+@@ -180,7 +180,7 @@ version_info::Channel StubPasswordManage
+ }
+
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<
+ password_manager::PasswordCrossDomainConfirmationPopupController>
+ StubPasswordManagerClient::ShowCrossDomainConfirmationPopup(
diff --git a/electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h b/electron32/patches/patch-components_password__manager_core_browser_stub__password__manager__client.h
new file mode 100644
index 0000000000..0db9bb4b6d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.246153600 +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)
+ std::unique_ptr<
+ password_manager::PasswordCrossDomainConfirmationPopupController>
+ ShowCrossDomainConfirmationPopup(
diff --git a/electron32/patches/patch-components_password__manager_core_common_password__manager__pref__names.h b/electron32/patches/patch-components_password__manager_core_common_password__manager__pref__names.h
new file mode 100644
index 0000000000..dd0de7ab3e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.250151400 +0000
++++ components/password_manager/core/common/password_manager_pref_names.h
+@@ -41,7 +41,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.
+@@ -370,7 +370,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/electron32/patches/patch-components_performance__manager_public_features.h b/electron32/patches/patch-components_performance__manager_public_features.h
new file mode 100644
index 0000000000..c91f9666a0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.302123500 +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/electron32/patches/patch-components_permissions_prediction__service_prediction__common.cc b/electron32/patches/patch-components_permissions_prediction__service_prediction__common.cc
new file mode 100644
index 0000000000..07b2ae53d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.326110600 +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/electron32/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc b/electron32/patches/patch-components_policy_core_browser_policy__pref__mapping__test.cc
new file mode 100644
index 0000000000..54e65593a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.366089000 +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/electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc b/electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__client.cc
new file mode 100644
index 0000000000..aa018e2d05
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.370087000 +0000
++++ components/policy/core/common/cloud/cloud_policy_client.cc
+@@ -647,7 +647,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/electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc b/electron32/patches/patch-components_policy_core_common_cloud_cloud__policy__util.cc
new file mode 100644
index 0000000000..3dee298aa5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.374085000 +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;
+@@ -145,7 +150,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 =
+@@ -168,7 +173,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/electron32/patches/patch-components_policy_core_common_policy__loader__common.cc b/electron32/patches/patch-components_policy_core_common_policy__loader__common.cc
new file mode 100644
index 0000000000..c78261a040
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.378082800 +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::kHomepageIsNewTabPage,
+ key::kPasswordProtectionChangePasswordURL,
+@@ -56,7 +56,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/electron32/patches/patch-components_policy_core_common_policy__paths.cc b/electron32/patches/patch-components_policy_core_common_policy__paths.cc
new file mode 100644
index 0000000000..b4af7031a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.382080600 +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/electron32/patches/patch-components_policy_core_common_policy__utils.cc b/electron32/patches/patch-components_policy_core_common_policy__utils.cc
new file mode 100644
index 0000000000..1c714798dd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.382080600 +0000
++++ components/policy/core/common/policy_utils.cc
+@@ -28,7 +28,7 @@ bool IsPolicyTestingEnabled(PrefService*
+ return true;
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (channel == version_info::Channel::DEV) {
+ return true;
+ }
diff --git a/electron32/patches/patch-components_policy_tools_generate__policy__source.py b/electron32/patches/patch-components_policy_tools_generate__policy__source.py
new file mode 100644
index 0000000000..5c04d6518e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.545992600 +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/electron32/patches/patch-components_power__metrics_BUILD.gn b/electron32/patches/patch-components_power__metrics_BUILD.gn
new file mode 100644
index 0000000000..695e1c1a61
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.553988200 +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/electron32/patches/patch-components_power__metrics_energy__metrics__provider.cc b/electron32/patches/patch-components_power__metrics_energy__metrics__provider.cc
new file mode 100644
index 0000000000..1dfec332eb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.553988200 +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/electron32/patches/patch-components_printing_browser_print__manager.cc b/electron32/patches/patch-components_printing_browser_print__manager.cc
new file mode 100644
index 0000000000..4b3f02ad49
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.561984000 +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/electron32/patches/patch-components_printing_browser_print__manager.h b/electron32/patches/patch-components_printing_browser_print__manager.h
new file mode 100644
index 0000000000..48c8fa17d6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.561984000 +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/electron32/patches/patch-components_printing_common_print.mojom b/electron32/patches/patch-components_printing_common_print.mojom
new file mode 100644
index 0000000000..093a51b154
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.565981900 +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/electron32/patches/patch-components_printing_renderer_print__render__frame__helper.cc b/electron32/patches/patch-components_printing_renderer_print__render__frame__helper.cc
new file mode 100644
index 0000000000..d4f8b605d0
--- /dev/null
+++ b/electron32/patches/patch-components_printing_renderer_print__render__frame__helper.cc
@@ -0,0 +1,168 @@
+$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 2024-10-18 12:34:07.565981900 +0000
++++ components/printing/renderer/print_render_frame_helper.cc
+@@ -51,6 +51,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"
+@@ -1222,14 +1223,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;
+ }
+@@ -1260,12 +1261,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;
+@@ -1282,9 +1285,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;
+ }
+@@ -1294,7 +1298,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;
+@@ -1451,6 +1455,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)
+@@ -2043,17 +2049,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;
+ }
+@@ -2074,8 +2082,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;
+@@ -2336,29 +2351,37 @@ 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 =
++ settings->params->print_scaling_option =
+ center_on_paper ? mojom::PrintScalingOption::kCenterShrinkToFitPaper
+ : mojom::PrintScalingOption::kSourceSize;
+- RecordDebugEvent(settings.params->printed_doc_type ==
++ RecordDebugEvent(settings->params->printed_doc_type ==
+ mojom::SkiaDocumentType::kMSKP
+ ? DebugEvent::kSetPrintSettings5
+ : DebugEvent::kSetPrintSettings6);
+- SetPrintPagesParams(settings);
++ SetPrintPagesParams(*settings);
+ return true;
+ }
+
diff --git a/electron32/patches/patch-components_printing_renderer_print__render__frame__helper.h b/electron32/patches/patch-components_printing_renderer_print__render__frame__helper.h
new file mode 100644
index 0000000000..25b5b952c8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.565981900 +0000
++++ components/printing/renderer/print_render_frame_helper.h
+@@ -251,7 +251,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)
+@@ -318,7 +318,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);
+@@ -328,7 +329,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,
+@@ -625,7 +627,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/electron32/patches/patch-components_remote__cocoa_app__shim_BUILD.gn b/electron32/patches/patch-components_remote__cocoa_app__shim_BUILD.gn
new file mode 100644
index 0000000000..c68fd2bb82
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.597964800 +0000
++++ components/remote_cocoa/app_shim/BUILD.gn
+@@ -16,6 +16,7 @@ component("app_shim") {
+ assert(is_mac)
+
+ configs += [ ":app_shim_warnings" ]
++ configs += ["//electron/build/config:mas_build"]
+ sources = [
+ "NSToolbar+Private.h",
+ "NSToolbar+Private.mm",
diff --git a/electron32/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm b/electron32/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
new file mode 100644
index 0000000000..c084441e47
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_application__bridge.mm
@@ -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/remote_cocoa/app_shim/application_bridge.mm.orig 2024-10-18 12:34:07.597964800 +0000
++++ components/remote_cocoa/app_shim/application_bridge.mm
+@@ -50,6 +50,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;
+@@ -60,6 +61,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;
+@@ -98,7 +102,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/electron32/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm b/electron32/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.mm
new file mode 100644
index 0000000000..0ba17493e7
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_browser__native__widget__window__mac.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/browser_native_widget_window_mac.mm.orig 2024-10-18 12:34:07.597964800 +0000
++++ components/remote_cocoa/app_shim/browser_native_widget_window_mac.mm
+@@ -9,6 +9,7 @@
+ #include "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
+ #include "components/remote_cocoa/common/native_widget_ns_window_host.mojom.h"
+
++#if !IS_MAS_BUILD()
+ @interface NSWindow (PrivateBrowserNativeWidgetAPI)
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
+ @end
+@@ -65,10 +66,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])
+@@ -115,6 +119,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.
diff --git a/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
new file mode 100644
index 0000000000..a486312a74
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__frameless__nswindow.mm
@@ -0,0 +1,37 @@
+$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 2024-10-18 12:34:07.597964800 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.mm
+@@ -4,6 +4,8 @@
+
+ #import "components/remote_cocoa/app_shim/native_widget_mac_frameless_nswindow.h"
+
++#if !IS_MAS_BUILD()
++
+ @interface NSWindow (PrivateAPI)
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle;
+ @end
+@@ -18,8 +20,12 @@
+ }
+ @end
+
++#endif // MAS_BUILD
++
+ @implementation NativeWidgetMacFramelessNSWindow
+
++#if !IS_MAS_BUILD()
++
+ + (Class)frameViewClassForStyleMask:(NSUInteger)windowStyle {
+ if ([NativeWidgetMacFramelessNSWindowFrame class]) {
+ return [NativeWidgetMacFramelessNSWindowFrame class];
+@@ -27,4 +33,6 @@
+ return [super frameViewClassForStyleMask:windowStyle];
+ }
+
++#endif // MAS_BUILD
++
+ @end
diff --git a/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.h
new file mode 100644
index 0000000000..bd479e8291
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.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
+
+--- components/remote_cocoa/app_shim/native_widget_mac_nswindow.h.orig 2024-10-18 12:34:07.597964800 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_nswindow.h
+@@ -17,6 +17,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 +34,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/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
new file mode 100644
index 0000000000..58f43201b2
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__mac__nswindow.mm
@@ -0,0 +1,63 @@
+$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 2024-10-18 12:34:07.601962600 +0000
++++ components/remote_cocoa/app_shim/native_widget_mac_nswindow.mm
+@@ -106,14 +106,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;
+@@ -152,6 +156,8 @@ void OrderChildWindow(NSWindow* child_wi
+ }
+ @end
+
++#if !IS_MAS_BUILD()
++
+ @implementation NativeWidgetMacNSWindowTitledFrame
+ - (void)mouseDown:(NSEvent*)event {
+ if (self.window.isMovable)
+@@ -179,6 +185,8 @@ void OrderChildWindow(NSWindow* child_wi
+ }
+ @end
+
++#endif // MAS_BUILD
++
+ @implementation NativeWidgetMacNSWindow {
+ @private
+ CommandDispatcher* __strong _commandDispatcher;
+@@ -367,6 +375,8 @@ void OrderChildWindow(NSWindow* child_wi
+
+ // NSWindow overrides.
+
++#if !IS_MAS_BUILD()
++
+ + (Class)frameViewClassForStyleMask:(NSWindowStyleMask)windowStyle {
+ if (windowStyle & NSWindowStyleMaskTitled) {
+ if (Class customFrame = [NativeWidgetMacNSWindowTitledFrame class])
+@@ -378,6 +388,8 @@ void OrderChildWindow(NSWindow* child_wi
+ return [super frameViewClassForStyleMask:windowStyle];
+ }
+
++#endif
++
+ - (BOOL)_isTitleHidden {
+ bool shouldShowWindowTitle = YES;
+ if (_bridge)
diff --git a/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
new file mode 100644
index 0000000000..318df5e3d9
--- /dev/null
+++ b/electron32/patches/patch-components_remote__cocoa_app__shim_native__widget__ns__window__bridge.mm
@@ -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/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm.orig 2024-10-18 12:34:07.601962600 +0000
++++ components/remote_cocoa/app_shim/native_widget_ns_window_bridge.mm
+@@ -635,10 +635,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/electron32/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc b/electron32/patches/patch-components_safe__browsing_content_common_file__type__policies__unittest.cc
new file mode 100644
index 0000000000..edfa718908
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.965767100 +0000
++++ components/safe_browsing/content/common/file_type_policies_unittest.cc
+@@ -139,7 +139,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/electron32/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py b/electron32/patches/patch-components_safe__browsing_content_resources_gen__file__type__proto.py
new file mode 100644
index 0000000000..fa46dc63ca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.969765200 +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/electron32/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc b/electron32/patches/patch-components_safe__browsing_core_browser_db_v4__protocol__manager__util.cc
new file mode 100644
index 0000000000..fb1930d21c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.973763000 +0000
++++ components/safe_browsing/core/browser/db/v4_protocol_manager_util.cc
+@@ -118,7 +118,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/electron32/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc b/electron32/patches/patch-components_safe__browsing_core_browser_realtime_url__lookup__service__base.cc
new file mode 100644
index 0000000000..cee21e0129
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.977760800 +0000
++++ components/safe_browsing/core/browser/realtime/url_lookup_service_base.cc
+@@ -107,7 +107,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/electron32/patches/patch-components_safe__browsing_core_common_features.cc b/electron32/patches/patch-components_safe__browsing_core_common_features.cc
new file mode 100644
index 0000000000..c25eae60cd
--- /dev/null
+++ b/electron32/patches/patch-components_safe__browsing_core_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
+
+--- components/safe_browsing/core/common/features.cc.orig 2024-10-18 12:34:07.977760800 +0000
++++ components/safe_browsing/core/common/features.cc
+@@ -186,7 +186,7 @@ BASE_FEATURE(kGooglePlayProtectInApkTele
+ BASE_FEATURE(kHashPrefixRealTimeLookups,
+ "SafeBrowsingHashPrefixRealTimeLookups",
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
+@@ -267,7 +267,7 @@ constexpr base::FeatureParam<int> kRefer
+ 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/electron32/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc b/electron32/patches/patch-components_search__engines_search__engine__choice_search__engine__choice__service.cc
new file mode 100644
index 0000000000..2ca3517d7e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.989754400 +0000
++++ components/search_engines/search_engine_choice/search_engine_choice_service.cc
+@@ -610,7 +610,7 @@ void SearchEngineChoiceService::ProcessP
+
+ 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/electron32/patches/patch-components_search__engines_template__url__service.cc b/electron32/patches/patch-components_search__engines_template__url__service.cc
new file mode 100644
index 0000000000..cf77b847d0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.993752200 +0000
++++ components/search_engines/template_url_service.cc
+@@ -3081,7 +3081,7 @@ bool TemplateURLService::MatchesDefaultS
+ std::unique_ptr<EnterpriseSiteSearchManager>
+ TemplateURLService::GetEnterpriseSiteSearchManager(PrefService* prefs) {
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_CHROMEOS)
++ BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ return base::FeatureList::IsEnabled(omnibox::kSiteSearchSettingsPolicy)
+ ? std::make_unique<EnterpriseSiteSearchManager>(
+ prefs, base::BindRepeating(
diff --git a/electron32/patches/patch-components_security__interstitials_content_utils.cc b/electron32/patches/patch-components_security__interstitials_content_utils.cc
new file mode 100644
index 0000000000..0fe80f64e7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:07.997750000 +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/electron32/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc b/electron32/patches/patch-components_segmentation__platform_embedder_default__model_cross__device__user__segment.cc
new file mode 100644
index 0000000000..3c4caf0bb0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.005746000 +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/electron32/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc b/electron32/patches/patch-components_services_paint__preview__compositor_paint__preview__compositor__collection__impl.cc
new file mode 100644
index 0000000000..e5c59833bd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.029733000 +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/electron32/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc b/electron32/patches/patch-components_services_storage_dom__storage_dom__storage__constants.cc
new file mode 100644
index 0000000000..bb9d27e111
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.033731000 +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/electron32/patches/patch-components_soda_soda__util.cc b/electron32/patches/patch-components_soda_soda__util.cc
new file mode 100644
index 0000000000..0f729e7994
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.073709500 +0000
++++ components/soda/soda_util.cc
+@@ -20,7 +20,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
+
+@@ -45,7 +45,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
+@@ -76,7 +76,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/electron32/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc b/electron32/patches/patch-components_startup__metric__utils_common_startup__metric__utils.cc
new file mode 100644
index 0000000000..0bfe989446
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.077707300 +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/electron32/patches/patch-components_storage__monitor_BUILD.gn b/electron32/patches/patch-components_storage__monitor_BUILD.gn
new file mode 100644
index 0000000000..76421c682f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.077707300 +0000
++++ components/storage_monitor/BUILD.gn
+@@ -77,7 +77,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",
+@@ -184,7 +184,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/electron32/patches/patch-components_storage__monitor_removable__device__constants.cc b/electron32/patches/patch-components_storage__monitor_removable__device__constants.cc
new file mode 100644
index 0000000000..76b10c16bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.081705300 +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/electron32/patches/patch-components_storage__monitor_removable__device__constants.h b/electron32/patches/patch-components_storage__monitor_removable__device__constants.h
new file mode 100644
index 0000000000..471f34a339
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:08.081705300 +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/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc b/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__metrics__service.cc
new file mode 100644
index 0000000000..0fa379dbc4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.169125800 +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/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc b/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__preferences.cc
new file mode 100644
index 0000000000..d8636f89c9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.173123600 +0000
++++ components/supervised_user/core/browser/supervised_user_preferences.cc
+@@ -154,7 +154,7 @@ void RegisterProfilePrefs(PrefRegistrySi
+ registry->RegisterBooleanPref(prefs::kChildAccountStatusKnown, false);
+ registry->RegisterStringPref(prefs::kFamilyLinkUserMemberRole, std::string());
+ #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/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__service.cc b/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__service.cc
new file mode 100644
index 0000000000..7f6ca61c24
--- /dev/null
+++ b/electron32/patches/patch-components_supervised__user_core_browser_supervised__user__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_service.cc.orig 2024-10-18 12:34:09.173123600 +0000
++++ components/supervised_user/core/browser/supervised_user_service.cc
+@@ -176,7 +176,7 @@ FirstTimeInterstitialBannerState Supervi
+ const FirstTimeInterstitialBannerState original_state) {
+ FirstTimeInterstitialBannerState target_state = original_state;
+ #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \
+- BUILDFLAG(IS_IOS)
++ BUILDFLAG(IS_IOS) || BUILDFLAG(IS_BSD)
+ if (original_state != FirstTimeInterstitialBannerState::kSetupComplete &&
+ can_show_first_time_interstitial_banner_) {
+ target_state = FirstTimeInterstitialBannerState::kNeedToShow;
diff --git a/electron32/patches/patch-components_supervised__user_core_common_features.cc b/electron32/patches/patch-components_supervised__user_core_common_features.cc
new file mode 100644
index 0000000000..eccfaccde5
--- /dev/null
+++ b/electron32/patches/patch-components_supervised__user_core_common_features.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
+
+--- components/supervised_user/core/common/features.cc.orig 2024-10-18 12:34:09.177121600 +0000
++++ components/supervised_user/core/common/features.cc
+@@ -66,7 +66,7 @@ BASE_FEATURE(kUpdatedSupervisedUserExten
+ "UpdatedSupervisedUserExtensionApprovalStrings",
+ base::FEATURE_DISABLED_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_DISABLED_BY_DEFAULT);
+@@ -81,7 +81,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 =
+@@ -106,13 +106,13 @@ BASE_FEATURE(kCustomWebSignInInterceptFo
+ "CustomWebSignInInterceptForSupervisedUsersUi",
+ 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);
+@@ -122,7 +122,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);
diff --git a/electron32/patches/patch-components_supervised__user_core_common_features.h b/electron32/patches/patch-components_supervised__user_core_common_features.h
new file mode 100644
index 0000000000..5967897652
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.177121600 +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
+
+@@ -62,11 +62,11 @@ BASE_DECLARE_FEATURE(kCustomWebSignInInt
+
+ // 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
+@@ -78,7 +78,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/electron32/patches/patch-components_supervised__user_core_common_pref__names.h b/electron32/patches/patch-components_supervised__user_core_common_pref__names.h
new file mode 100644
index 0000000000..42e5fe327a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.177121600 +0000
++++ components/supervised_user/core/common/pref_names.h
+@@ -137,7 +137,7 @@ inline constexpr char kFirstTimeIntersti
+ "profile.managed.banner_state";
+
+ #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/electron32/patches/patch-components_sync__device__info_local__device__info__util.cc b/electron32/patches/patch-components_sync__device__info_local__device__info__util.cc
new file mode 100644
index 0000000000..29da1fbc8a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.381013400 +0000
++++ components/sync_device_info/local_device_info_util.cc
+@@ -84,7 +84,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()) {
+@@ -109,7 +109,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;
+@@ -128,7 +128,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/electron32/patches/patch-components_sync__device__info_local__device__info__util__linux.cc b/electron32/patches/patch-components_sync__device__info_local__device__info__util__linux.cc
new file mode 100644
index 0000000000..b5262967b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.381013400 +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/electron32/patches/patch-components_sync_base_sync__util.cc b/electron32/patches/patch-components_sync_base_sync__util.cc
new file mode 100644
index 0000000000..aaec59a984
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.189115000 +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/electron32/patches/patch-components_system__cpu_cpu__probe.cc b/electron32/patches/patch-components_system__cpu_cpu__probe.cc
new file mode 100644
index 0000000000..8ee3c42fca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:09.412996500 +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/electron32/patches/patch-components_translate_core_common_translate__util.cc b/electron32/patches/patch-components_translate_core_common_translate__util.cc
new file mode 100644
index 0000000000..6313fad250
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.200053700 +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/electron32/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc b/electron32/patches/patch-components_trusted__vault_trusted__vault__connection__impl.cc
new file mode 100644
index 0000000000..dbfaf78e91
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.216045400 +0000
++++ components/trusted_vault/trusted_vault_connection_impl.cc
+@@ -101,7 +101,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/electron32/patches/patch-components_update__client_update__query__params.cc b/electron32/patches/patch-components_update__client_update__query__params.cc
new file mode 100644
index 0000000000..77d879f681
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.292005500 +0000
++++ components/update_client/update_query_params.cc
+@@ -42,6 +42,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/electron32/patches/patch-components_upload__list_upload__list.cc b/electron32/patches/patch-components_upload__list_upload__list.cc
new file mode 100644
index 0000000000..9648b8d470
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.292005500 +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/electron32/patches/patch-components_upload__list_upload__list.h b/electron32/patches/patch-components_upload__list_upload__list.h
new file mode 100644
index 0000000000..96e3a996f6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.292005500 +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/electron32/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc b/electron32/patches/patch-components_url__formatter_spoof__checks_idn__spoof__checker.cc
new file mode 100644
index 0000000000..3efbbfb6c8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.296003300 +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/electron32/patches/patch-components_user__education_views_help__bubble__view.cc b/electron32/patches/patch-components_user__education_views_help__bubble__view.cc
new file mode 100644
index 0000000000..da18582682
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.355972000 +0000
++++ components/user_education/views/help_bubble_view.cc
+@@ -856,7 +856,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/electron32/patches/patch-components_variations_service_variations__service.cc b/electron32/patches/patch-components_variations_service_variations__service.cc
new file mode 100644
index 0000000000..dd742bec11
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.407945000 +0000
++++ components/variations/service/variations_service.cc
+@@ -101,7 +101,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/electron32/patches/patch-components_visited__url__ranking_public_url__visit__util.cc b/electron32/patches/patch-components_visited__url__ranking_public_url__visit__util.cc
new file mode 100644
index 0000000000..bc40fa7b63
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.467913400 +0000
++++ components/visited_url_ranking/public/url_visit_util.cc
+@@ -62,7 +62,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/electron32/patches/patch-components_viz_common_features.cc b/electron32/patches/patch-components_viz_common_features.cc
new file mode 100644
index 0000000000..6e95f2ac1d
--- /dev/null
+++ b/electron32/patches/patch-components_viz_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
+
+--- components/viz/common/features.cc.orig 2024-10-18 12:34:11.483905000 +0000
++++ components/viz/common/features.cc
+@@ -234,7 +234,7 @@ BASE_FEATURE(kAllowForceMergeRenderPassW
+ "AllowForceMergeRenderPassWithRequireOverlayQuads",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // On platforms using SkiaOutputDeviceBufferQueue and not yet universally using
+ // SkiaRenderer-allocated images, when this is true SkiaRenderer will allocate
+ // and maintain a buffer queue of images for the root render pass, instead of
+@@ -500,7 +500,7 @@ bool ShouldOnBeginFrameThrottleVideo() {
+ return base::FeatureList::IsEnabled(features::kOnBeginFrameThrottleVideo);
+ }
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ bool ShouldRendererAllocateImages() {
+ return base::FeatureList::IsEnabled(kRendererAllocatesImages);
+ }
diff --git a/electron32/patches/patch-components_viz_common_features.h b/electron32/patches/patch-components_viz_common_features.h
new file mode 100644
index 0000000000..8c36bab024
--- /dev/null
+++ b/electron32/patches/patch-components_viz_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
+
+--- components/viz/common/features.h.orig 2024-10-18 12:34:11.483905000 +0000
++++ components/viz/common/features.h
+@@ -72,7 +72,7 @@ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(k
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kAllowUndamagedNonrootRenderPassToSkip);
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(
+ kAllowForceMergeRenderPassWithRequireOverlayQuads);
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kRendererAllocatesImages);
+ #endif
+ VIZ_COMMON_EXPORT BASE_DECLARE_FEATURE(kOnBeginFrameAcks);
+@@ -129,7 +129,7 @@ VIZ_COMMON_EXPORT bool UseWebViewNewInva
+ VIZ_COMMON_EXPORT bool UseSurfaceLayerForVideo();
+ VIZ_COMMON_EXPORT int MaxOverlaysConsidered();
+ VIZ_COMMON_EXPORT bool ShouldOnBeginFrameThrottleVideo();
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ VIZ_COMMON_EXPORT bool ShouldRendererAllocateImages();
+ #endif
+ VIZ_COMMON_EXPORT bool IsOnBeginFrameAcksEnabled();
diff --git a/electron32/patches/patch-components_viz_host_host__display__client.cc b/electron32/patches/patch-components_viz_host_host__display__client.cc
new file mode 100644
index 0000000000..9ec73aa683
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.531880000 +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/electron32/patches/patch-components_viz_host_host__display__client.h b/electron32/patches/patch-components_viz_host_host__display__client.h
new file mode 100644
index 0000000000..ea03b16554
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.531880000 +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/electron32/patches/patch-components_viz_host_layered__window__updater__impl.cc b/electron32/patches/patch-components_viz_host_layered__window__updater__impl.cc
new file mode 100644
index 0000000000..f21d875c45
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.531880000 +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/electron32/patches/patch-components_viz_host_layered__window__updater__impl.h b/electron32/patches/patch-components_viz_host_layered__window__updater__impl.h
new file mode 100644
index 0000000000..182ecac538
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.531880000 +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/electron32/patches/patch-components_viz_service_BUILD.gn b/electron32/patches/patch-components_viz_service_BUILD.gn
new file mode 100644
index 0000000000..58b40e7f15
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.531880000 +0000
++++ components/viz/service/BUILD.gn
+@@ -169,6 +169,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",
+@@ -364,6 +366,7 @@ viz_component("service") {
+ "frame_sinks/external_begin_frame_source_mac.h",
+ ]
+ }
++ configs = ["//electron/build/config:mas_build"]
+ }
+
+ if (is_android || use_ozone) {
+@@ -635,6 +638,7 @@ viz_source_set("unit_tests") {
+ "display_embedder/software_output_device_mac_unittest.mm",
+ ]
+ frameworks = [ "IOSurface.framework" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_win) {
diff --git a/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider.h b/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider.h
new file mode 100644
index 0000000000..845a77e1be
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.619834000 +0000
++++ components/viz/service/display_embedder/output_surface_provider.h
+@@ -38,7 +38,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/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc b/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.cc
new file mode 100644
index 0000000000..e30d7277de
--- /dev/null
+++ b/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.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
+
+--- components/viz/service/display_embedder/output_surface_provider_impl.cc.orig 2024-10-18 12:34:11.619834000 +0000
++++ components/viz/service/display_embedder/output_surface_provider_impl.cc
+@@ -25,12 +25,14 @@
+ #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"
+ #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)
+@@ -94,7 +96,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>();
+@@ -102,7 +105,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/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h b/electron32/patches/patch-components_viz_service_display__embedder_output__surface__provider__impl.h
new file mode 100644
index 0000000000..8a5195aecc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.619834000 +0000
++++ components/viz/service/display_embedder/output_surface_provider_impl.h
+@@ -50,7 +50,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;
+@@ -58,7 +59,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/electron32/patches/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc b/electron32/patches/patch-components_viz_service_display__embedder_skia__output__device__buffer__queue.cc
new file mode 100644
index 0000000000..edeb368813
--- /dev/null
+++ b/electron32/patches/patch-components_viz_service_display__embedder_skia__output__device__buffer__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
+
+--- components/viz/service/display_embedder/skia_output_device_buffer_queue.cc.orig 2024-10-18 12:34:11.619834000 +0000
++++ components/viz/service/display_embedder/skia_output_device_buffer_queue.cc
+@@ -175,7 +175,7 @@ SkiaOutputDeviceBufferQueue::SkiaOutputD
+ capabilities_.only_invalidates_damage_rect = false;
+ capabilities_.number_of_buffers = 3;
+
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ capabilities_.renderer_allocates_images =
+ ::features::ShouldRendererAllocateImages();
+ #else
diff --git a/electron32/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc b/electron32/patches/patch-components_viz_service_display__embedder_skia__output__surface__impl.cc
new file mode 100644
index 0000000000..d510e3472c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.623831700 +0000
++++ components/viz/service/display_embedder/skia_output_surface_impl.cc
+@@ -1663,7 +1663,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/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc b/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.cc
new file mode 100644
index 0000000000..10e75d7343
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.627829600 +0000
++++ components/viz/service/display_embedder/software_output_device_mac.cc
+@@ -106,6 +106,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();
+@@ -194,6 +196,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/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h b/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__mac.h
new file mode 100644
index 0000000000..6b647cc9db
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.627829600 +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/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc b/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.cc
new file mode 100644
index 0000000000..4469395352
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.727395470 +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/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h b/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__proxy.h
new file mode 100644
index 0000000000..53cc64ba6a
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.727986883 +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/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc b/electron32/patches/patch-components_viz_service_display__embedder_software__output__device__win.cc
new file mode 100644
index 0000000000..c20f605b53
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.627829600 +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/electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.cc b/electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.cc
new file mode 100644
index 0000000000..41da0a1b5f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.627829600 +0000
++++ components/viz/service/display_embedder/software_output_surface.cc
+@@ -119,7 +119,7 @@ void SoftwareOutputSurface::SwapBuffersC
+ now.SnappedToNextTick(refresh_timebase_, refresh_interval_) - now;
+ // 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)
+ if (needs_swap_size_notifications_)
+ client_->DidSwapWithSize(pixel_size);
+ #endif
+@@ -148,7 +148,7 @@ gfx::OverlayTransform SoftwareOutputSurf
+
+ // 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)
+ void SoftwareOutputSurface::SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) {
+ needs_swap_size_notifications_ = needs_swap_size_notifications;
diff --git a/electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.h b/electron32/patches/patch-components_viz_service_display__embedder_software__output__surface.h
new file mode 100644
index 0000000000..88c78d70f4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.627829600 +0000
++++ components/viz/service/display_embedder/software_output_surface.h
+@@ -45,7 +45,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputS
+ gfx::OverlayTransform GetDisplayTransform() override;
+ // 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)
+ void SetNeedsSwapSizeNotifications(
+ bool needs_swap_size_notifications) override;
+ #endif
+@@ -65,7 +65,7 @@ class VIZ_SERVICE_EXPORT SoftwareOutputS
+
+ // 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)
+ bool needs_swap_size_notifications_ = false;
+ #endif
+
diff --git a/electron32/patches/patch-components_viz_service_display_skia__renderer.cc b/electron32/patches/patch-components_viz_service_display_skia__renderer.cc
new file mode 100644
index 0000000000..3226383276
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.599844200 +0000
++++ components/viz/service/display/skia_renderer.cc
+@@ -1441,7 +1441,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/electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc b/electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.cc
new file mode 100644
index 0000000000..ac3f448aeb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.647819300 +0000
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.cc
+@@ -100,7 +100,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.
+@@ -111,7 +112,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);
+@@ -673,7 +674,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/electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h b/electron32/patches/patch-components_viz_service_frame__sinks_root__compositor__frame__sink__impl.h
new file mode 100644
index 0000000000..f7eb377f56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.647819300 +0000
++++ components/viz/service/frame_sinks/root_compositor_frame_sink_impl.h
+@@ -214,7 +214,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/electron32/patches/patch-components_viz_test_fake__display__client.cc b/electron32/patches/patch-components_viz_test_fake__display__client.cc
new file mode 100644
index 0000000000..117a979de5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.667808800 +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/electron32/patches/patch-components_viz_test_fake__display__client.h b/electron32/patches/patch-components_viz_test_fake__display__client.h
new file mode 100644
index 0000000000..fd261abcba
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.667808800 +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/electron32/patches/patch-components_viz_test_mock__display__client.h b/electron32/patches/patch-components_viz_test_mock__display__client.h
new file mode 100644
index 0000000000..680e5e2cd6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.671806600 +0000
++++ components/viz/test/mock_display_client.h
+@@ -43,7 +43,7 @@ class MockDisplayClient : public mojom::
+ MOCK_METHOD1(SetWideColorEnabled, void(bool enabled));
+ MOCK_METHOD1(SetPreferredRefreshRate, void(float refresh_rate));
+ #endif
+-#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/electron32/patches/patch-components_viz_test_test__output__surface__provider.cc b/electron32/patches/patch-components_viz_test_test__output__surface__provider.cc
new file mode 100644
index 0000000000..488841f11b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.671806600 +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/electron32/patches/patch-components_viz_test_test__output__surface__provider.h b/electron32/patches/patch-components_viz_test_test__output__surface__provider.h
new file mode 100644
index 0000000000..470996312a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.671806600 +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;
+ };
diff --git a/electron32/patches/patch-components_webrtc_media__stream__devices__controller.cc b/electron32/patches/patch-components_webrtc_media__stream__devices__controller.cc
new file mode 100644
index 0000000000..1acef662e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.771754300 +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/electron32/patches/patch-components_webrtc_media__stream__devices__controller.h b/electron32/patches/patch-components_webrtc_media__stream__devices__controller.h
new file mode 100644
index 0000000000..340657a390
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.771754300 +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/electron32/patches/patch-content_app_BUILD.gn b/electron32/patches/patch-content_app_BUILD.gn
new file mode 100644
index 0000000000..e71411d2ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.927672600 +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/electron32/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm b/electron32/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
new file mode 100644
index 0000000000..c16c38d0fc
--- /dev/null
+++ b/electron32/patches/patch-content_app__shim__remote__cocoa_ns__view__bridge__factory__impl.mm
@@ -0,0 +1,47 @@
+$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 2024-10-18 12:34:11.939666300 +0000
++++ content/app_shim_remote_cocoa/ns_view_bridge_factory_impl.mm
+@@ -63,7 +63,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 +77,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 +88,9 @@ class RenderWidgetHostNSViewBridgeOwner
+ ui::RemoteAccessibility::GetRemoteElementFromToken(element_token);
+ }
+ return remote_accessibility_element_;
++#else
++ return nil;
++#endif
+ }
+
+ // RenderWidgetHostNSViewHostHelper implementation.
+@@ -103,8 +109,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/electron32/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm b/electron32/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
new file mode 100644
index 0000000000..3c0b99a1ce
--- /dev/null
+++ b/electron32/patches/patch-content_app__shim__remote__cocoa_render__widget__host__view__cocoa.mm
@@ -0,0 +1,78 @@
+$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 2024-10-18 12:34:11.947662000 +0000
++++ content/app_shim_remote_cocoa/render_widget_host_view_cocoa.mm
+@@ -169,6 +169,15 @@ void ExtractUnderlines(NSAttributedStrin
+
+ } // namespace
+
++@interface NSWindow (AtomCustomMethods)
++- (BOOL)acceptsFirstMouse;
++- (BOOL)disableAutoHideCursor;
++@end
++
++@interface NSView (ElectronCustomMethods)
++- (BOOL)shouldIgnoreMouseEvent;
++@end
++
+ // RenderWidgetHostViewCocoa ---------------------------------------------------
+
+ // Private methods:
+@@ -767,6 +776,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 +873,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 +1199,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);
+@@ -2042,15 +2062,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;
+ }
diff --git a/electron32/patches/patch-content_app_content__main.cc b/electron32/patches/patch-content_app_content__main.cc
new file mode 100644
index 0000000000..7586fa782b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.931670700 +0000
++++ content/app/content_main.cc
+@@ -207,7 +207,7 @@ RunContentProcess(ContentMainParams para
+ 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
+@@ -293,7 +293,7 @@ RunContentProcess(ContentMainParams para
+ 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
+
+@@ -306,16 +306,14 @@ RunContentProcess(ContentMainParams para
+
+ #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/electron32/patches/patch-content_app_content__main__runner__impl.cc b/electron32/patches/patch-content_app_content__main__runner__impl.cc
new file mode 100644
index 0000000000..91b9b401e6
--- /dev/null
+++ b/electron32/patches/patch-content_app_content__main__runner__impl.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
+
+--- content/app/content_main_runner_impl.cc.orig 2024-10-18 12:34:11.935668500 +0000
++++ content/app/content_main_runner_impl.cc
+@@ -45,6 +45,7 @@
+ #include "base/process/memory.h"
+ #include "base/process/process.h"
+ #include "base/process/process_handle.h"
++#include "base/strings/string_piece.h"
+ #include "base/strings/string_number_conversions.h"
+ #include "base/strings/string_util.h"
+ #include "base/task/single_thread_task_runner.h"
+@@ -149,18 +150,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
+
+@@ -194,6 +197,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"
+@@ -281,8 +288,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);
++ base::StringPiece 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();
+@@ -302,11 +314,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;
+@@ -314,11 +323,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
+ }
+
+@@ -403,7 +413,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
+@@ -441,7 +451,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.
+@@ -453,9 +466,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.
+@@ -877,11 +897,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)
+
+@@ -997,7 +1016,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* {
+@@ -1058,6 +1077,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);
+@@ -1133,7 +1164,7 @@ int NO_STACK_PROTECTOR ContentMainRunner
+ ->ReconfigureAfterFeatureListInit(process_type);
+ }
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ // If dynamic Mojo Core is being used, ensure that it's loaded very early in
+ // the child/zygote process, before any sandbox is initialized. The library
+ // is not fully initialized with IPC support until a ChildProcess is later
+@@ -1169,6 +1200,11 @@ int NO_STACK_PROTECTOR 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/electron32/patches/patch-content_browser_BUILD.gn b/electron32/patches/patch-content_browser_BUILD.gn
new file mode 100644
index 0000000000..a305c89af1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:11.955658000 +0000
++++ content/browser/BUILD.gn
+@@ -70,6 +70,7 @@ source_set("browser") {
+ "//content:content_implementation",
+ "//v8:external_startup_data",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ defines = []
+ libs = []
+ frameworks = []
+@@ -2396,6 +2397,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",
+@@ -2438,6 +2447,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",
+@@ -2987,8 +3005,9 @@ source_set("browser") {
+ "//ppapi/shared_impl",
+ ]
+
+- assert(enable_printing)
+- deps += [ "//printing" ]
++ if (enable_printing) {
++ deps += [ "//printing" ]
++ }
+
+ if (is_chromeos) {
+ sources += [
diff --git a/electron32/patches/patch-content_browser_accessibility_browser__accessibility__manager__mac.mm b/electron32/patches/patch-content_browser_accessibility_browser__accessibility__manager__mac.mm
new file mode 100644
index 0000000000..e85a9a036e
--- /dev/null
+++ b/electron32/patches/patch-content_browser_accessibility_browser__accessibility__manager__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
+
+--- content/browser/accessibility/browser_accessibility_manager_mac.mm.orig 2024-10-18 12:34:11.991639100 +0000
++++ content/browser/accessibility/browser_accessibility_manager_mac.mm
+@@ -20,7 +20,9 @@
+ #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"
++#if !IS_MAS_BUILD()
+ #include "ui/base/cocoa/remote_accessibility_api.h"
++#endif
+
+ namespace {
+
+@@ -224,6 +226,7 @@ void BrowserAccessibilityManagerMac::Fir
+ return;
+ }
+
++#if !IS_MAS_BUILD()
+ BrowserAccessibilityManager* root_manager = GetManagerForRootFrame();
+ if (root_manager) {
+ BrowserAccessibilityManagerMac* root_manager_mac =
+@@ -246,6 +249,7 @@ void BrowserAccessibilityManagerMac::Fir
+ return;
+ }
+ }
++#endif
+
+ // Use native VoiceOver support for live regions.
+ BrowserAccessibilityCocoa* retained_node = native_node;
+@@ -646,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
+@@ -674,6 +679,7 @@ bool BrowserAccessibilityManagerMac::Sho
+ if ([window isKindOfClass:[NSAccessibilityRemoteUIElement class]]) {
+ return true;
+ }
++#endif
+
+ return false;
+ }
diff --git a/electron32/patches/patch-content_browser_audio_audio__service.cc b/electron32/patches/patch-content_browser_audio_audio__service.cc
new file mode 100644
index 0000000000..5e1796ece4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.127568200 +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/electron32/patches/patch-content_browser_browser__child__process__host__impl.cc b/electron32/patches/patch-content_browser_browser__child__process__host__impl.cc
new file mode 100644
index 0000000000..b258af4bb2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.199530800 +0000
++++ content/browser/browser_child_process_host_impl.cc
+@@ -324,6 +324,7 @@ void BrowserChildProcessHostImpl::Launch
+ switches::kMojoCoreLibraryPath,
+ switches::kPerfettoDisableInterning,
+ switches::kTraceToConsole,
++ switches::kDisableUnveil,
+ };
+ cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches);
+
+@@ -655,7 +656,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/electron32/patches/patch-content_browser_browser__child__process__host__impl.h b/electron32/patches/patch-content_browser_browser__child__process__host__impl.h
new file mode 100644
index 0000000000..7e87920cd7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.199530800 +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/electron32/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc b/electron32/patches/patch-content_browser_browser__child__process__host__impl__receiver__bindings.cc
new file mode 100644
index 0000000000..acd88cd189
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.199530800 +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/electron32/patches/patch-content_browser_browser__main__loop.cc b/electron32/patches/patch-content_browser_browser__main__loop.cc
new file mode 100644
index 0000000000..b45086c43f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.199530800 +0000
++++ content/browser/browser_main_loop.cc
+@@ -254,6 +254,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
+@@ -549,6 +555,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
+@@ -586,7 +598,7 @@ int BrowserMainLoop::EarlyInitialization
+ base::PlatformThread::SetCurrentThreadType(base::ThreadType::kCompositing);
+
+ #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/electron32/patches/patch-content_browser_child__process__launcher.h b/electron32/patches/patch-content_browser_child__process__launcher.h
new file mode 100644
index 0000000000..a0ea2016f8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.251504000 +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)
+@@ -191,7 +192,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
+@@ -206,6 +210,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/electron32/patches/patch-content_browser_child__process__launcher__helper.h b/electron32/patches/patch-content_browser_child__process__launcher__helper.h
new file mode 100644
index 0000000000..124a331118
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.251504000 +0000
++++ content/browser/child_process_launcher_helper.h
+@@ -299,7 +299,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/electron32/patches/patch-content_browser_child__process__launcher__helper__linux.cc b/electron32/patches/patch-content_browser_child__process__launcher__helper__linux.cc
new file mode 100644
index 0000000000..7c072f3148
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.251504000 +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/electron32/patches/patch-content_browser_child__process__launcher__helper__mac.cc b/electron32/patches/patch-content_browser_child__process__launcher__helper__mac.cc
new file mode 100644
index 0000000000..eadbfa63b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.251504000 +0000
++++ content/browser/child_process_launcher_helper_mac.cc
+@@ -123,7 +123,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();
+@@ -193,6 +194,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/electron32/patches/patch-content_browser_child__process__launcher__helper__win.cc b/electron32/patches/patch-content_browser_child__process__launcher__helper__win.cc
new file mode 100644
index 0000000000..8a66d0a10b
--- /dev/null
+++ b/electron32/patches/patch-content_browser_child__process__launcher__helper__win.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/child_process_launcher_helper_win.cc.orig 2024-10-18 12:34:12.251504000 +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,30 @@ 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();
+ return true;
+ }
+
+@@ -159,7 +185,7 @@ ChildProcessLauncherHelper::LaunchProces
+ ChildProcessLauncherHelper::Process process;
+ *launch_result =
+ StartSandboxedProcess(delegate_.get(), *command_line(),
+- options->handles_to_inherit, &process.process);
++ options, &process.process);
+ return process;
+ }
+
diff --git a/electron32/patches/patch-content_browser_child__thread__type__switcher__linux.cc b/electron32/patches/patch-content_browser_child__thread__type__switcher__linux.cc
new file mode 100644
index 0000000000..56343a11e6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.255501700 +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) {
+@@ -38,6 +41,7 @@ void SetThreadTypeOnLauncherThread(base:
+
+ base::PlatformThread::SetThreadType(peer_pid, peer_tid, thread_type,
+ base::IsViaIPC(true));
++#endif
+ }
+
+ } // namespace
diff --git a/electron32/patches/patch-content_browser_code__cache_generated__code__cache.cc b/electron32/patches/patch-content_browser_code__cache_generated__code__cache.cc
new file mode 100644
index 0000000000..34ca1eae56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.259499800 +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/electron32/patches/patch-content_browser_code__cache_generated__code__cache.h b/electron32/patches/patch-content_browser_code__cache_generated__code__cache.h
new file mode 100644
index 0000000000..c13e992f2a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.259499800 +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/electron32/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc b/electron32/patches/patch-content_browser_code__cache_generated__code__cache__browsertest.cc
new file mode 100644
index 0000000000..8bf183a660
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.259499800 +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/electron32/patches/patch-content_browser_compositor_viz__process__transport__factory.cc b/electron32/patches/patch-content_browser_compositor_viz__process__transport__factory.cc
new file mode 100644
index 0000000000..df32ce082c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.279489300 +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);
+ }
+@@ -390,8 +390,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/electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc b/electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.cc
new file mode 100644
index 0000000000..a00009800d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.303476800 +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/electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h b/electron32/patches/patch-content_browser_devtools_devtools__frontend__host__impl.h
new file mode 100644
index 0000000000..ade59c7e7b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.303476800 +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/electron32/patches/patch-content_browser_devtools_protocol_system__info__handler.cc b/electron32/patches/patch-content_browser_devtools_protocol_system__info__handler.cc
new file mode 100644
index 0000000000..2cf0751595
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.339458000 +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/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h b/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher.h
new file mode 100644
index 0000000000..8e38882c7b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.407422800 +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_FUCHSIA) || BUILDFLAG(IS_WIN) || 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/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc b/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__bsd.cc
new file mode 100644
index 0000000000..c538763996
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.767460097 +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/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h b/electron32/patches/patch-content_browser_file__system__access_file__path__watcher_file__path__watcher__kqueue.h
new file mode 100644
index 0000000000..83fe5481c2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.407422800 +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/electron32/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc b/electron32/patches/patch-content_browser_file__system__access_file__system__access__local__path__watcher.cc
new file mode 100644
index 0000000000..563ddfe8ac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.423414500 +0000
++++ content/browser/file_system_access/file_system_access_local_path_watcher.cc
+@@ -62,7 +62,7 @@ void FileSystemAccessLocalPathWatcher::I
+ FilePathWatcher::WatchOptions watch_options{
+ .type = scope().IsRecursive() ? FilePathWatcher::Type::kRecursive
+ : FilePathWatcher::Type::kNonRecursive,
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || 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/electron32/patches/patch-content_browser_font__access_font__enumeration__data__source.cc b/electron32/patches/patch-content_browser_font__access_font__enumeration__data__source.cc
new file mode 100644
index 0000000000..248f979db5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.459395600 +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/electron32/patches/patch-content_browser_gpu_compositor__util.cc b/electron32/patches/patch-content_browser_gpu_compositor__util.cc
new file mode 100644
index 0000000000..6b065f6d0c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.467391500 +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::kVaapiVideoDecodeLinux) ||
+ #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::kVaapiVideoEncodeLinux)),
+ #else
+ command_line.HasSwitch(switches::kDisableAcceleratedVideoEncode)),
diff --git a/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc b/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.cc
new file mode 100644
index 0000000000..8882eadf01
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.467391500 +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/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.h b/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl.h
new file mode 100644
index 0000000000..62fe0676a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.467391500 +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/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc b/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.cc
new file mode 100644
index 0000000000..94af97cc43
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.467391500 +0000
++++ content/browser/gpu/gpu_data_manager_impl_private.cc
+@@ -1685,7 +1685,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/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h b/electron32/patches/patch-content_browser_gpu_gpu__data__manager__impl__private.h
new file mode 100644
index 0000000000..ed3a50c5d5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.467391500 +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)
+@@ -303,7 +303,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/electron32/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc b/electron32/patches/patch-content_browser_gpu_gpu__memory__buffer__manager__singleton.cc
new file mode 100644
index 0000000000..3e7648d202
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.471389300 +0000
++++ content/browser/gpu/gpu_memory_buffer_manager_singleton.cc
+@@ -54,7 +54,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;
+@@ -117,7 +117,7 @@ void GpuMemoryBufferManagerSingleton::On
+ SetNativeConfigurations(std::move(configs));
+ }
+ #endif // BUILDFLAG(IS_OZONE_X11)
+-#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/electron32/patches/patch-content_browser_gpu_gpu__process__host.cc b/electron32/patches/patch-content_browser_gpu_gpu__process__host.cc
new file mode 100644
index 0000000000..2d291b5af9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.471389300 +0000
++++ content/browser/gpu/gpu_process_host.cc
+@@ -273,6 +273,7 @@ static const char* const kSwitchNames[]
+ switches::kEnableLowEndDeviceMode,
+ switches::kDisableSkiaGraphite,
+ switches::kDisableLowEndDeviceMode,
++ switches::kDisableUnveil,
+ switches::kProfilingAtStart,
+ switches::kProfilingFile,
+ switches::kProfilingFlush,
+@@ -300,7 +301,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/electron32/patches/patch-content_browser_media_capture_desktop__capture__device.cc b/electron32/patches/patch-content_browser_media_capture_desktop__capture__device.cc
new file mode 100644
index 0000000000..e8207d12b1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.787225000 +0000
++++ content/browser/media/capture/desktop_capture_device.cc
+@@ -822,8 +822,14 @@ std::unique_ptr<media::VideoCaptureDevic
+ DesktopCapturerLacros::CaptureType::kScreen,
+ webrtc::DesktopCaptureOptions());
+ #else
+- 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);
++ }
+ #endif
+ if (screen_capturer && screen_capturer->SelectSource(source.id)) {
+ capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
+@@ -842,8 +848,14 @@ std::unique_ptr<media::VideoCaptureDevic
+ new DesktopCapturerLacros(DesktopCapturerLacros::CaptureType::kWindow,
+ webrtc::DesktopCaptureOptions()));
+ #else
+- 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);
++ }
+ #endif
+ if (window_capturer && window_capturer->SelectSource(source.id)) {
+ capturer = std::make_unique<webrtc::DesktopAndCursorComposer>(
diff --git a/electron32/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc b/electron32/patches/patch-content_browser_media_capture_desktop__capture__device__mac.cc
new file mode 100644
index 0000000000..e2809afa18
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.787225000 +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/electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc b/electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.cc
new file mode 100644
index 0000000000..e67b255cd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.795220900 +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/electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h b/electron32/patches/patch-content_browser_media_capture_io__surface__capture__device__base__mac.h
new file mode 100644
index 0000000000..1540007f39
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.795220900 +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/electron32/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm b/electron32/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
new file mode 100644
index 0000000000..2071b1f528
--- /dev/null
+++ b/electron32/patches/patch-content_browser_media_capture_screen__capture__kit__device__mac.mm
@@ -0,0 +1,252 @@
+$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 2024-10-18 12:34:12.795220900 +0000
++++ content/browser/media/capture/screen_capture_kit_device_mac.mm
+@@ -24,24 +24,83 @@ using SampleCallback = base::RepeatingCa
+ std::optional<gfx::Size>,
+ std::optional<gfx::Rect>)>;
+ 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
+
+ API_AVAILABLE(macos(12.3))
+ @interface ScreenCaptureKitDeviceHelper
+ : 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;
+@@ -141,7 +200,8 @@ BASE_FEATURE(kScreenCaptureKitFullDeskto
+
+ class API_AVAILABLE(macos(12.3)) ScreenCaptureKitDeviceMac
+ : public IOSurfaceCaptureDeviceBase,
+- public ScreenCaptureKitResetStreamInterface {
++ public ScreenCaptureKitResetStreamInterface
++ {
+ public:
+ explicit ScreenCaptureKitDeviceMac(const DesktopMediaID& source)
+ : source_(source),
+@@ -150,18 +210,41 @@ 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())
++ );
++ auto* picker_observer = [[ScreenCaptureKitPickerHelper alloc] initWithStreamPickCallback:picker_callback cancelCallback:cancel_callback errorCallback:error_callback];
++ [[SCContentSharingPicker sharedPicker] addObserver:picker_observer];
++ }
+ }
+ 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;
++ }
++ }
++ }
+
+ void OnShareableContentCreated(SCShareableContent* content) {
+ DCHECK(device_task_runner_->RunsTasksInCurrentSequence());
+@@ -182,8 +265,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;
+@@ -216,6 +308,18 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ return;
+ }
+
++ 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.
++ stream_config_content_size_ =
++ gfx::Size(filter.contentRect.size.width * filter.pointPixelScale,
++ 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;
+@@ -229,6 +333,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 =
+@@ -370,7 +475,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");
+@@ -393,9 +498,32 @@ 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 (@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(
+@@ -461,6 +589,8 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ }
+
+ private:
++ static int active_streams_;
++
+ const DesktopMediaID source_;
+ const scoped_refptr<base::SingleThreadTaskRunner> device_task_runner_;
+
+@@ -489,6 +619,8 @@ class API_AVAILABLE(macos(12.3)) ScreenC
+ base::WeakPtrFactory<ScreenCaptureKitDeviceMac> weak_factory_{this};
+ };
+
++int ScreenCaptureKitDeviceMac::active_streams_ = 0;
++
+ } // namespace
+
+ std::unique_ptr<media::VideoCaptureDevice> CreateScreenCaptureKitDeviceMac(
diff --git a/electron32/patches/patch-content_browser_media_frameless__media__interface__proxy.h b/electron32/patches/patch-content_browser_media_frameless__media__interface__proxy.h
new file mode 100644
index 0000000000..cb72f82775
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.823206200 +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/electron32/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc b/electron32/patches/patch-content_browser_media_media__keys__listener__manager__impl.cc
new file mode 100644
index 0000000000..c9edcd4977
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.835200000 +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(
+@@ -357,6 +361,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();
+ }
+
+@@ -408,6 +426,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_IN_MIGRATION();
+ }
+@@ -450,6 +473,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_IN_MIGRATION();
+ }
diff --git a/electron32/patches/patch-content_browser_network__service__instance__impl.cc b/electron32/patches/patch-content_browser_network__service__instance__impl.cc
new file mode 100644
index 0000000000..2caadcb14d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.951139700 +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
+@@ -363,7 +363,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(
+@@ -432,7 +432,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/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.cc b/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.cc
new file mode 100644
index 0000000000..dd1c5ccf43
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.951139700 +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/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.h b/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl.h
new file mode 100644
index 0000000000..d51b8b67e4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.951139700 +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/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc b/electron32/patches/patch-content_browser_notifications_blink__notification__service__impl__unittest.cc
new file mode 100644
index 0000000000..6b2f9ac0d8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.955137500 +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/electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.cc b/electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.cc
new file mode 100644
index 0000000000..282281d6f5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.967131400 +0000
++++ content/browser/notifications/platform_notification_context_impl.cc
+@@ -268,6 +268,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,
+@@ -276,7 +277,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/electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.h b/electron32/patches/patch-content_browser_notifications_platform__notification__context__impl.h
new file mode 100644
index 0000000000..9fc30ee0ef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.967131400 +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/electron32/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc b/electron32/patches/patch-content_browser_ppapi__plugin__process__host__receiver__bindings.cc
new file mode 100644
index 0000000000..326e4a34c6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:12.999114800 +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/electron32/patches/patch-content_browser_ppapi__plugin__sandboxed__process__launcher__delegate.cc b/electron32/patches/patch-content_browser_ppapi__plugin__sandboxed__process__launcher__delegate.cc
new file mode 100644
index 0000000000..ae57fbbe15
--- /dev/null
+++ b/electron32/patches/patch-content_browser_ppapi__plugin__sandboxed__process__launcher__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
+
+--- content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc.orig 2024-10-18 12:34:12.999114800 +0000
++++ content/browser/ppapi_plugin_sandboxed_process_launcher_delegate.cc
+@@ -10,6 +10,7 @@
+ #include "build/build_config.h"
+ #include "content/public/common/content_switches.h"
+ #include "sandbox/policy/mojom/sandbox.mojom.h"
++#include "sandbox/policy/switches.h"
+
+ #if BUILDFLAG(IS_WIN)
+ #include "sandbox/policy/win/sandbox_win.h"
+@@ -56,6 +57,9 @@ bool PpapiPluginSandboxedProcessLauncher
+ ZygoteCommunication* PpapiPluginSandboxedProcessLauncherDelegate::GetZygote() {
+ const base::CommandLine& browser_command_line =
+ *base::CommandLine::ForCurrentProcess();
++ if (browser_command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
++ return nullptr;
++ }
+ base::CommandLine::StringType plugin_launcher =
+ browser_command_line.GetSwitchValueNative(switches::kPpapiPluginLauncher);
+ if (!plugin_launcher.empty())
diff --git a/electron32/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc b/electron32/patches/patch-content_browser_renderer__host_code__cache__host__impl.cc
new file mode 100644
index 0000000000..b951d659ed
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.179021600 +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) {
+@@ -427,6 +452,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/electron32/patches/patch-content_browser_renderer__host_delegated__frame__host.cc b/electron32/patches/patch-content_browser_renderer__host_delegated__frame__host.cc
new file mode 100644
index 0000000000..28ecc7c9ab
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.195013300 +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/electron32/patches/patch-content_browser_renderer__host_input_input__device__change__observer.cc b/electron32/patches/patch-content_browser_renderer__host_input_input__device__change__observer.cc
new file mode 100644
index 0000000000..03d3c7d6c2
--- /dev/null
+++ b/electron32/patches/patch-content_browser_renderer__host_input_input__device__change__observer.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/input/input_device_change_observer.cc.orig 2024-10-18 12:34:13.234992700 +0000
++++ content/browser/renderer_host/input/input_device_change_observer.cc
+@@ -9,7 +9,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/events/devices/input_device_observer_android.h"
+@@ -21,7 +21,7 @@ InputDeviceChangeObserver::InputDeviceCh
+ render_view_host_impl_ = rvhi;
+ #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);
+@@ -31,7 +31,7 @@ InputDeviceChangeObserver::InputDeviceCh
+ InputDeviceChangeObserver::~InputDeviceChangeObserver() {
+ #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/electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc b/electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.cc
new file mode 100644
index 0000000000..6016e89524
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.258980300 +0000
++++ content/browser/renderer_host/legacy_render_widget_host_win.cc
+@@ -321,12 +321,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);
+@@ -357,7 +357,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/electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h b/electron32/patches/patch-content_browser_renderer__host_legacy__render__widget__host__win.h
new file mode 100644
index 0000000000..48e1bc9db8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.258980300 +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/electron32/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc b/electron32/patches/patch-content_browser_renderer__host_media_in__process__video__capture__device__launcher.cc
new file mode 100644
index 0000000000..a970fd2afe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.274972000 +0000
++++ content/browser/renderer_host/media/in_process_video_capture_device_launcher.cc
+@@ -316,8 +316,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.
+@@ -344,13 +352,15 @@ void InProcessVideoCaptureDeviceLauncher
+ std::move(after_start_capture_callback));
+ break;
+ #else
++ 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/electron32/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc b/electron32/patches/patch-content_browser_renderer__host_media_service__video__capture__device__launcher.cc
new file mode 100644
index 0000000000..f298558a37
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.310953400 +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/electron32/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc b/electron32/patches/patch-content_browser_renderer__host_navigation__controller__impl__unittest.cc
new file mode 100644
index 0000000000..9436757425
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.394909900 +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/electron32/patches/patch-content_browser_renderer__host_navigation__request.cc b/electron32/patches/patch-content_browser_renderer__host_navigation__request.cc
new file mode 100644
index 0000000000..bc9a3c6cac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.406903700 +0000
++++ content/browser/renderer_host/navigation_request.cc
+@@ -10657,6 +10657,12 @@ NavigationRequest::GetOriginForURLLoader
+ }
+ }
+
++ 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/electron32/patches/patch-content_browser_renderer__host_navigator.cc b/electron32/patches/patch-content_browser_renderer__host_navigator.cc
new file mode 100644
index 0000000000..4c52e75aae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.450881000 +0000
++++ content/browser/renderer_host/navigator.cc
+@@ -1338,6 +1338,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 &&
+@@ -1387,6 +1388,7 @@ void Navigator::RecordNavigationMetrics(
+ first_before_unload_start_time)
+ .InMilliseconds());
+ }
++#endif
+
+ builder.Record(ukm::UkmRecorder::Get());
+ metrics_data_.reset();
diff --git a/electron32/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc b/electron32/patches/patch-content_browser_renderer__host_pepper_pepper__file__io__host.cc
new file mode 100644
index 0000000000..37d92e0b03
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.462874700 +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/electron32/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc b/electron32/patches/patch-content_browser_renderer__host_render__frame__host__impl.cc
new file mode 100644
index 0000000000..de726e0971
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.514847800 +0000
++++ content/browser/renderer_host/render_frame_host_impl.cc
+@@ -785,8 +785,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());
+@@ -7979,6 +7979,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();
+@@ -8832,6 +8843,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/electron32/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc b/electron32/patches/patch-content_browser_renderer__host_render__frame__host__manager.cc
new file mode 100644
index 0000000000..0a17c4ab0e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.546831400 +0000
++++ content/browser/renderer_host/render_frame_host_manager.cc
+@@ -4470,6 +4470,9 @@ RenderFrameHostManager::GetSiteInstanceF
+ request->ResetStateForSiteInstanceChange();
+ }
+
++ GetContentClient()->browser()->RegisterPendingSiteInstance(
++ render_frame_host_.get(), dest_site_instance.get());
++
+ return dest_site_instance;
+ }
+
diff --git a/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.cc b/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.cc
new file mode 100644
index 0000000000..1998ab1c00
--- /dev/null
+++ b/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.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_process_host_impl.cc.orig 2024-10-18 12:34:13.578814700 +0000
++++ content/browser/renderer_host/render_process_host_impl.cc
+@@ -218,7 +218,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
+@@ -948,7 +948,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;
+@@ -1121,7 +1121,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)
+ }
+@@ -1613,9 +1613,15 @@ bool RenderProcessHostImpl::Init() {
+ std::make_unique<RendererSandboxedProcessLauncherDelegateWin>(
+ *cmd_line, IsPdf(), /*is_jit_disabled=*/IsPdf());
+ #else
++#if 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>();
+ #endif
++#endif
+
+ auto tracing_config_memory_region =
+ tracing::CreateTracingConfigSharedMemory();
+@@ -1978,7 +1984,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;
+ }
+@@ -1986,7 +1992,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;
+ }
+@@ -3131,7 +3137,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() &&
+@@ -3188,6 +3194,7 @@ void RenderProcessHostImpl::PropagateBro
+ switches::kDisableSpeechAPI,
+ switches::kDisableThreadedCompositing,
+ switches::kDisableTouchDragDrop,
++ switches::kDisableUnveil,
+ switches::kDisableV8IdleTasks,
+ switches::kDisableVideoCaptureUseGpuMemoryBuffer,
+ switches::kDisableWebGLImageChromium,
diff --git a/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.h b/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl.h
new file mode 100644
index 0000000000..3e63ee06c9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.578814700 +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
+@@ -602,7 +602,7 @@ class CONTENT_EXPORT RenderProcessHostIm
+ // Sets this RenderProcessHost to be guest only. For Testing only.
+ void SetForGuestsOnlyForTesting();
+
+-#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_BSD)
+ // Launch the zygote early in the browser startup.
+ static void EarlyZygoteLaunch();
+ #endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_ANDROID) && !BUILDFLAG(IS_MAC)
+@@ -967,7 +967,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_;
diff --git a/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc b/electron32/patches/patch-content_browser_renderer__host_render__process__host__impl__receiver__bindings.cc
new file mode 100644
index 0000000000..ae62ed1336
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.578814700 +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/electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.cc b/electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.cc
new file mode 100644
index 0000000000..445cde1afe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.578814700 +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 =
+@@ -737,6 +737,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/electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.h b/electron32/patches/patch-content_browser_renderer__host_render__view__host__impl.h
new file mode 100644
index 0000000000..64acb31388
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.578814700 +0000
++++ content/browser/renderer_host/render_view_host_impl.h
+@@ -139,6 +139,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__delegate.h
new file mode 100644
index 0000000000..ff2ed2fa31
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.594806400 +0000
++++ content/browser/renderer_host/render_widget_host_delegate.h
+@@ -26,6 +26,7 @@
+ #include "third_party/blink/public/mojom/manifest/display_mode.mojom.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 {
+@@ -285,6 +286,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.cc
new file mode 100644
index 0000000000..4e224ee6a7
--- /dev/null
+++ b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.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
+
+--- content/browser/renderer_host/render_widget_host_impl.cc.orig 2024-10-18 12:34:13.598804500 +0000
++++ content/browser/renderer_host/render_widget_host_impl.cc
+@@ -781,6 +781,9 @@ void RenderWidgetHostImpl::WasHidden() {
+ return;
+ }
+
++ if (disable_hidden_)
++ return;
++
+ RejectPointerLockOrUnlockIfNecessary(
+ blink::mojom::PointerLockResult::kWrongDocument);
+
+@@ -1963,6 +1966,9 @@ void RenderWidgetHostImpl::SetCursor(con
+ if (view_) {
+ view_->UpdateCursor(cursor);
+ }
++ if (delegate_) {
++ delegate_->OnCursorChanged(cursor);
++ }
+ }
+
+ void RenderWidgetHostImpl::ShowContextMenuAtPoint(
+@@ -2026,9 +2032,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.h b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__impl.h
new file mode 100644
index 0000000000..a3079860a4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.598804500 +0000
++++ content/browser/renderer_host/render_widget_host_impl.h
+@@ -1000,6 +1000,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.cc
new file mode 100644
index 0000000000..71c9cc25cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.606800300 +0000
++++ content/browser/renderer_host/render_widget_host_view_aura.cc
+@@ -120,7 +120,7 @@
+ #include "ui/gfx/gdi_util.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "content/browser/accessibility/browser_accessibility_auralinux.h"
+ #include "ui/base/ime/linux/text_edit_command_auralinux.h"
+ #include "ui/base/ime/text_input_flags.h"
+@@ -479,7 +479,7 @@ gfx::NativeViewAccessible RenderWidgetHo
+ return ToBrowserAccessibilityWin(manager->GetBrowserAccessibilityRoot())
+ ->GetCOM();
+
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ BrowserAccessibilityManager* manager =
+ host()->GetOrCreateRootBrowserAccessibilityManager();
+ if (manager && manager->GetBrowserAccessibilityRoot())
+@@ -580,8 +580,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(
+@@ -644,7 +644,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();
+@@ -1736,7 +1736,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) {
+@@ -2564,7 +2564,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;
+@@ -2748,7 +2748,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 &&
+@@ -2946,6 +2946,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__aura.h
new file mode 100644
index 0000000000..e8da8b7d61
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.606800300 +0000
++++ content/browser/renderer_host/render_widget_host_view_aura.h
+@@ -260,7 +260,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;
+@@ -628,6 +628,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.cc
new file mode 100644
index 0000000000..2705a561c5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.626790000 +0000
++++ content/browser/renderer_host/render_widget_host_view_base.cc
+@@ -779,6 +779,13 @@ bool RenderWidgetHostViewBase::ScreenRec
+ return false;
+ }
+
++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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__base.h
new file mode 100644
index 0000000000..4e9ae5345d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.626790000 +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"
+@@ -76,9 +79,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;
+@@ -155,6 +160,10 @@ class CONTENT_EXPORT RenderWidgetHostVie
+ void DidOverscroll(const ui::DidOverscrollParams& params) override {}
+ void DidStopFlinging() override {}
+ RenderWidgetHostViewBase* GetRootView() override;
++ virtual RenderWidgetHostViewBase* CreateViewForWidget(
++ RenderWidgetHost* render_widget_host,
++ RenderWidgetHost* embedder_render_widget_host,
++ WebContentsView* web_contents_view);
+ viz::FrameSinkId GetRootFrameSinkId() override;
+ void NotifyHitTestRegionUpdated(
+ const viz::AggregatedHitTestRegion& region) override {}
+@@ -235,6 +244,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__event__handler.cc
new file mode 100644
index 0000000000..c9db638ef0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.642781700 +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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.h
new file mode 100644
index 0000000000..9452073c15
--- /dev/null
+++ b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.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
+
+--- content/browser/renderer_host/render_widget_host_view_mac.h.orig 2024-10-18 12:34:13.646779500 +0000
++++ content/browser/renderer_host/render_widget_host_view_mac.h
+@@ -53,7 +53,9 @@ class CursorManager;
+
+ @protocol RenderWidgetHostViewMacDelegate;
+
++#if !IS_MAS_BUILD()
+ @class NSAccessibilityRemoteUIElement;
++#endif
+ @class RenderWidgetHostViewCocoa;
+ @class CursorAccessibilityScaleFactorObserver;
+
+@@ -686,9 +688,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/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
new file mode 100644
index 0000000000..d727fd3f65
--- /dev/null
+++ b/electron32/patches/patch-content_browser_renderer__host_render__widget__host__view__mac.mm
@@ -0,0 +1,82 @@
+$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 2024-10-18 12:34:13.646779500 +0000
++++ content/browser/renderer_host/render_widget_host_view_mac.mm
+@@ -272,8 +272,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.
+@@ -555,7 +557,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) {
+@@ -1657,8 +1663,10 @@ RenderWidgetHostViewMac::AccessibilityGe
+
+ gfx::NativeViewAccessible
+ RenderWidgetHostViewMac::AccessibilityGetNativeViewAccessibleForWindow() {
++#if !IS_MAS_BUILD()
+ if (remote_window_accessible_)
+ return remote_window_accessible_;
++#endif
+ return [GetInProcessNSView() window];
+ }
+
+@@ -1707,9 +1715,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(
+@@ -2233,20 +2243,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/electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc b/electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.cc
new file mode 100644
index 0000000000..745aefb4bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.650777600 +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/electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h b/electron32/patches/patch-content_browser_renderer__host_renderer__sandboxed__process__launcher__delegate.h
new file mode 100644
index 0000000000..0403e86741
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.650777600 +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/electron32/patches/patch-content_browser_renderer__host_text__input__manager.cc b/electron32/patches/patch-content_browser_renderer__host_text__input__manager.cc
new file mode 100644
index 0000000000..229c0efb06
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.654775400 +0000
++++ content/browser/renderer_host/text_input_manager.cc
+@@ -167,6 +167,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
+@@ -454,6 +455,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/electron32/patches/patch-content_browser_renderer__host_text__input__manager.h b/electron32/patches/patch-content_browser_renderer__host_text__input__manager.h
new file mode 100644
index 0000000000..a2c88441bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.658773400 +0000
++++ content/browser/renderer_host/text_input_manager.h
+@@ -71,6 +71,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.
+@@ -275,6 +279,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/electron32/patches/patch-content_browser_sandbox__host__linux.cc b/electron32/patches/patch-content_browser_sandbox__host__linux.cc
new file mode 100644
index 0000000000..7f8d125240
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.690756800 +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/electron32/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc b/electron32/patches/patch-content_browser_scheduler_responsiveness_jank__monitor__impl.cc
new file mode 100644
index 0000000000..9888527f8b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.690756800 +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/electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc b/electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.cc
new file mode 100644
index 0000000000..0df89ca5bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.690756800 +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/electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h b/electron32/patches/patch-content_browser_scheduler_responsiveness_native__event__observer.h
new file mode 100644
index 0000000000..9222af6d13
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.694754800 +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/electron32/patches/patch-content_browser_service__process__host__impl.cc b/electron32/patches/patch-content_browser_service__process__host__impl.cc
new file mode 100644
index 0000000000..25fd8bed1b
--- /dev/null
+++ b/electron32/patches/patch-content_browser_service__process__host__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
+
+--- content/browser/service_process_host_impl.cc.orig 2024-10-18 12:34:13.730736300 +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,16 @@ 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));
++#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/electron32/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc b/electron32/patches/patch-content_browser_service__worker_service__worker__context__wrapper.cc
new file mode 100644
index 0000000000..66e9d311e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.766717400 +0000
++++ content/browser/service_worker/service_worker_context_wrapper.cc
+@@ -2024,6 +2024,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
+@@ -2043,9 +2063,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>()));
+@@ -2053,9 +2071,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/electron32/patches/patch-content_browser_site__instance__impl.cc b/electron32/patches/patch-content_browser_site__instance__impl.cc
new file mode 100644
index 0000000000..b8a902e64f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:13.882657500 +0000
++++ content/browser/site_instance_impl.cc
+@@ -211,7 +211,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/electron32/patches/patch-content_browser_utility__process__host.cc b/electron32/patches/patch-content_browser_utility__process__host.cc
new file mode 100644
index 0000000000..ca91e0cf8d
--- /dev/null
+++ b/electron32/patches/patch-content_browser_utility__process__host.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/browser/utility_process_host.cc.orig 2024-10-18 12:34:14.010591500 +0000
++++ content/browser/utility_process_host.cc
+@@ -61,7 +61,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"
+@@ -74,7 +74,7 @@
+ #include "services/network/public/mojom/network_service.mojom.h"
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "base/task/sequenced_task_runner.h"
+ #include "components/viz/host/gpu_client.h"
+ #include "media/capture/capture_switches.h"
+@@ -85,7 +85,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;
+@@ -150,7 +150,7 @@ UtilityProcessHost::UtilityProcessHost(s
+ started_(false),
+ name_(u"utility process"),
+ file_data_(std::make_unique<ChildProcessLauncherFileData>()),
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allowed_gpu_(false),
+ gpu_client_(nullptr, base::OnTaskRunnerDeleter(nullptr)),
+ #endif
+@@ -178,11 +178,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();
+@@ -209,7 +211,7 @@ void UtilityProcessHost::SetPreloadLibra
+ #endif // BUILDFLAG(IS_WIN)
+
+ void UtilityProcessHost::SetAllowGpuClient() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allowed_gpu_ = true;
+ #endif
+ }
+@@ -229,6 +231,24 @@ 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;
++}
++
+ mojom::ChildProcess* UtilityProcessHost::GetChildProcess() {
+ return static_cast<ChildProcessHostImpl*>(process_->GetHost())
+ ->child_process();
+@@ -348,7 +368,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
+@@ -407,7 +427,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) {
+@@ -418,13 +438,13 @@ bool UtilityProcessHost::StartProcess()
+ }
+ #endif // BUILDFLAG(IS_LINUX)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ // Pass `kVideoCaptureUseGpuMemoryBuffer` flag to video capture service only
+ // when the video capture use GPU memory buffer enabled.
+ 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 &&
+@@ -436,9 +456,22 @@ bool UtilityProcessHost::StartProcess()
+ }
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_ASH)
+
++#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)
+ if (!preload_libraries_.empty()) {
+@@ -476,7 +509,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/electron32/patches/patch-content_browser_utility__process__host.h b/electron32/patches/patch-content_browser_utility__process__host.h
new file mode 100644
index 0000000000..e3c050fb52
--- /dev/null
+++ b/electron32/patches/patch-content_browser_utility__process__host.h
@@ -0,0 +1,99 @@
+$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 2024-10-18 12:34:14.010591500 +0000
++++ content/browser/utility_process_host.h
+@@ -29,11 +29,15 @@
+ #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
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ namespace viz {
+ class GpuClient;
+ } // namespace viz
+@@ -74,7 +78,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
+@@ -98,9 +102,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();
+@@ -138,6 +146,16 @@ 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);
++
+ // Returns a control interface for the running child process.
+ mojom::ChildProcess* GetChildProcess();
+
+@@ -191,6 +209,22 @@ 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;
++
+ // Indicates whether the process has been successfully launched yet, or if
+ // launch failed.
+ enum class LaunchState {
+@@ -200,7 +234,7 @@ class CONTENT_EXPORT UtilityProcessHost
+ };
+ LaunchState launch_state_ = LaunchState::kLaunchInProgress;
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ bool allowed_gpu_;
+ std::unique_ptr<viz::GpuClient, base::OnTaskRunnerDeleter> gpu_client_;
+ #endif
diff --git a/electron32/patches/patch-content_browser_utility__process__host__receiver__bindings.cc b/electron32/patches/patch-content_browser_utility__process__host__receiver__bindings.cc
new file mode 100644
index 0000000000..b2f0520bbb
--- /dev/null
+++ b/electron32/patches/patch-content_browser_utility__process__host__receiver__bindings.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
+
+--- content/browser/utility_process_host_receiver_bindings.cc.orig 2024-10-18 12:34:14.010591500 +0000
++++ content/browser/utility_process_host_receiver_bindings.cc
+@@ -10,12 +10,12 @@
+ #include "content/public/browser/content_browser_client.h"
+ #include "content/public/common/content_client.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
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "components/viz/host/gpu_client.h"
+ #include "content/public/browser/gpu_client.h"
+ #endif
+@@ -24,13 +24,13 @@ 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;
+ }
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ if (allowed_gpu_) {
+ // TODO(crbug.com/328099369) Remove once all clients get this directly.
+ if (auto gpu_receiver = receiver.As<viz::mojom::Gpu>()) {
diff --git a/electron32/patches/patch-content_browser_utility__sandbox__delegate.cc b/electron32/patches/patch-content_browser_utility__sandbox__delegate.cc
new file mode 100644
index 0000000000..740590c371
--- /dev/null
+++ b/electron32/patches/patch-content_browser_utility__sandbox__delegate.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
+
+--- content/browser/utility_sandbox_delegate.cc.orig 2024-10-18 12:34:14.010591500 +0000
++++ content/browser/utility_sandbox_delegate.cc
+@@ -34,17 +34,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 ||
+@@ -76,10 +78,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)
+@@ -107,11 +109,17 @@ 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(USE_ZYGOTE)
+ ZygoteCommunication* UtilitySandboxedProcessLauncherDelegate::GetZygote() {
+@@ -136,10 +144,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)
diff --git a/electron32/patches/patch-content_browser_utility__sandbox__delegate.h b/electron32/patches/patch-content_browser_utility__sandbox__delegate.h
new file mode 100644
index 0000000000..dfb4545054
--- /dev/null
+++ b/electron32/patches/patch-content_browser_utility__sandbox__delegate.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
+
+--- content/browser/utility_sandbox_delegate.h.orig 2024-10-18 12:34:14.010591500 +0000
++++ content/browser/utility_sandbox_delegate.h
+@@ -30,7 +30,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;
+@@ -56,18 +58,16 @@ 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(USE_ZYGOTE)
+ void SetZygote(ZygoteCommunication* handle);
+ #endif // BUILDFLAG(USE_ZYGOTE_HANDLE)
+
+ private:
+-#if BUILDFLAG(IS_POSIX)
+ base::EnvironmentMap env_;
+-#endif // BUILDFLAG(IS_POSIX)
+
+ #if BUILDFLAG(IS_WIN)
+ std::vector<base::FilePath> preload_libraries_;
+@@ -77,12 +77,14 @@ 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_;
+ };
+ } // namespace content
+
diff --git a/electron32/patches/patch-content_browser_v8__snapshot__files.cc b/electron32/patches/patch-content_browser_v8__snapshot__files.cc
new file mode 100644
index 0000000000..8cc3557377
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.010591500 +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/electron32/patches/patch-content_browser_web__contents_web__contents__impl.cc b/electron32/patches/patch-content_browser_web__contents_web__contents__impl.cc
new file mode 100644
index 0000000000..6cf2f6ec3b
--- /dev/null
+++ b/electron32/patches/patch-content_browser_web__contents_web__contents__impl.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
+
+--- content/browser/web_contents/web_contents_impl.cc.orig 2024-10-18 12:34:14.018587400 +0000
++++ content/browser/web_contents/web_contents_impl.cc
+@@ -3617,6 +3617,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);
+
+@@ -3627,6 +3634,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());
+
+@@ -3864,21 +3872,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) {
+@@ -4036,7 +4048,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
+@@ -4628,8 +4640,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,
+@@ -4726,6 +4737,12 @@ FrameTree* WebContentsImpl::CreateNewWin
+ new_contents_impl->is_popup_ =
+ params.disposition == WindowOpenDisposition::NEW_POPUP;
+
++ 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
+@@ -4767,12 +4784,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,
+@@ -5417,6 +5428,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();
+@@ -9106,7 +9122,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;
+ }
diff --git a/electron32/patches/patch-content_browser_web__contents_web__contents__impl.h b/electron32/patches/patch-content_browser_web__contents_web__contents__impl.h
new file mode 100644
index 0000000000..f1071cda08
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.018587400 +0000
++++ content/browser/web_contents/web_contents_impl.h
+@@ -1100,6 +1100,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/electron32/patches/patch-content_browser_web__contents_web__contents__view__aura.cc b/electron32/patches/patch-content_browser_web__contents_web__contents__view__aura.cc
new file mode 100644
index 0000000000..0a47cb5637
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.046573000 +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.
+@@ -1319,7 +1319,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/electron32/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc b/electron32/patches/patch-content_browser_web__contents_web__contents__view__aura__unittest.cc
new file mode 100644
index 0000000000..ca0fef2bb9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.058566800 +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/electron32/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc b/electron32/patches/patch-content_browser_web__contents_web__contents__view__drag__security__info.cc
new file mode 100644
index 0000000000..26b7a619f5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.058566800 +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/electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc b/electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.cc
new file mode 100644
index 0000000000..1f2d26f490
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.166511300 +0000
++++ content/browser/webui/web_ui_main_frame_observer.cc
+@@ -13,7 +13,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"
+@@ -31,7 +31,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.
+@@ -55,7 +55,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,
+@@ -167,7 +167,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/electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.h b/electron32/patches/patch-content_browser_webui_web__ui__main__frame__observer.h
new file mode 100644
index 0000000000..327ec516bd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.166511300 +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.
+@@ -60,7 +60,7 @@ class CONTENT_EXPORT WebUIMainFrameObser
+ void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
+
+ private:
+-#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/electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc b/electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.cc
new file mode 100644
index 0000000000..2851963cb4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.198494700 +0000
++++ content/browser/zygote_host/zygote_host_impl_linux.cc
+@@ -18,8 +18,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"
+@@ -37,6 +39,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,
+@@ -58,6 +61,7 @@ bool ReceiveFixedMessage(int fd,
+ return false;
+ return true;
+ }
++#endif
+
+ } // namespace
+
+@@ -67,9 +71,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_() {}
+@@ -82,6 +90,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;
+ }
+@@ -132,6 +141,7 @@ void ZygoteHostImpl::Init(const base::Co
+ "you can try using --"
+ << sandbox::policy::switches::kNoSandbox << ".";
+ }
++#endif
+ }
+
+ void ZygoteHostImpl::AddZygotePid(pid_t pid) {
+@@ -156,6 +166,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]));
+@@ -224,9 +235,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/electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h b/electron32/patches/patch-content_browser_zygote__host_zygote__host__impl__linux.h
new file mode 100644
index 0000000000..7594906939
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.198494700 +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/electron32/patches/patch-content_child_BUILD.gn b/electron32/patches/patch-content_child_BUILD.gn
new file mode 100644
index 0000000000..d2f4dbea31
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.198494700 +0000
++++ content/child/BUILD.gn
+@@ -130,6 +130,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/electron32/patches/patch-content_child_child__process.cc b/electron32/patches/patch-content_child_child__process.cc
new file mode 100644
index 0000000000..94116d71f3
--- /dev/null
+++ b/electron32/patches/patch-content_child_child__process.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/child/child_process.cc.orig 2024-10-18 12:34:14.198494700 +0000
++++ content/child/child_process.cc
+@@ -35,7 +35,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
+
+@@ -70,7 +70,7 @@ ChildProcess::ChildProcess(base::ThreadT
+ thread_pool_init_params)
+ : resetter_(&child_process, this, nullptr),
+ io_thread_(std::make_unique<ChildIOThread>()) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ const bool is_embedded_in_browser_process =
+@@ -199,7 +199,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/electron32/patches/patch-content_child_child__process.h b/electron32/patches/patch-content_child_child__process.h
new file mode 100644
index 0000000000..5eeee13abe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.198494700 +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/electron32/patches/patch-content_common_BUILD.gn b/electron32/patches/patch-content_common_BUILD.gn
new file mode 100644
index 0000000000..1eb914e361
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.206490500 +0000
++++ content/common/BUILD.gn
+@@ -200,6 +200,7 @@ source_set("common") {
+ "//content:content_implementation",
+ "//build/config:precompiled_headers",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+
+ public_deps = [
+ ":mojo_bindings",
+@@ -388,19 +389,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/electron32/patches/patch-content_common_features.cc b/electron32/patches/patch-content_common_features.cc
new file mode 100644
index 0000000000..36cdeaacbf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.226480200 +0000
++++ content/common/features.cc
+@@ -158,7 +158,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);
+@@ -308,7 +308,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/electron32/patches/patch-content_common_features.h b/electron32/patches/patch-content_common_features.h
new file mode 100644
index 0000000000..7719c9ace0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.226480200 +0000
++++ content/common/features.h
+@@ -35,7 +35,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kDoc
+ CONTENT_EXPORT BASE_DECLARE_FEATURE(kEnableBackForwardCacheForScreenReader);
+ 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);
+@@ -76,7 +76,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/electron32/patches/patch-content_common_font__list__unittest.cc b/electron32/patches/patch-content_common_font__list__unittest.cc
new file mode 100644
index 0000000000..4cce4349a4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.226480200 +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/electron32/patches/patch-content_common_frame.mojom b/electron32/patches/patch-content_common_frame.mojom
new file mode 100644
index 0000000000..e589e04c87
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.226480200 +0000
++++ content/common/frame.mojom
+@@ -605,6 +605,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/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc b/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.cc
new file mode 100644
index 0000000000..afdbb8721c
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.921469245 +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/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h b/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__bsd.h
new file mode 100644
index 0000000000..cb793f5ba6
--- /dev/null
+++ b/electron32/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-01-06 07:57:03.922024619 +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/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h b/electron32/patches/patch-content_common_gpu__pre__sandbox__hook__linux.h
new file mode 100644
index 0000000000..6f1378ca08
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.230478300 +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/electron32/patches/patch-content_common_mojo__core__library__support.cc b/electron32/patches/patch-content_common_mojo__core__library__support.cc
new file mode 100644
index 0000000000..6d6a8701b7
--- /dev/null
+++ b/electron32/patches/patch-content_common_mojo__core__library__support.cc
@@ -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/mojo_core_library_support.cc.orig 2024-10-18 12:34:14.238474100 +0000
++++ content/common/mojo_core_library_support.cc
+@@ -15,7 +15,7 @@ bool IsMojoCoreSharedLibraryEnabled() {
+ }
+
+ std::optional<base::FilePath> GetMojoCoreSharedLibraryPath() {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ const base::CommandLine& command_line =
+ *base::CommandLine::ForCurrentProcess();
+ if (!command_line.HasSwitch(switches::kMojoCoreLibraryPath))
diff --git a/electron32/patches/patch-content_common_sandbox__init__win.cc b/electron32/patches/patch-content_common_sandbox__init__win.cc
new file mode 100644
index 0000000000..c023f4fc42
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.242472200 +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,
+ base::Process* process) {
+ 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, process);
++ full_command_line, options, delegate, process);
+ }
+
+ } // namespace content
diff --git a/electron32/patches/patch-content_common_url__schemes.cc b/electron32/patches/patch-content_common_url__schemes.cc
new file mode 100644
index 0000000000..22f572c7e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.246470000 +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/electron32/patches/patch-content_common_user__agent.cc b/electron32/patches/patch-content_common_user__agent.cc
new file mode 100644
index 0000000000..be739429ea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.246470000 +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/electron32/patches/patch-content_gpu_gpu__child__thread.cc b/electron32/patches/patch-content_gpu_gpu__child__thread.cc
new file mode 100644
index 0000000000..87dc902a39
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.262462000 +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
+
+@@ -142,7 +142,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/electron32/patches/patch-content_gpu_gpu__main.cc b/electron32/patches/patch-content_gpu_gpu__main.cc
new file mode 100644
index 0000000000..df9d53386d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.262462000 +0000
++++ content/gpu/gpu_main.cc
+@@ -94,10 +94,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
+
+@@ -116,7 +120,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&);
+@@ -174,7 +178,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_);
+@@ -257,6 +261,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
+@@ -284,7 +292,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
+@@ -306,7 +314,8 @@ int GpuMain(MainFunctionParams parameter
+
+ base::PlatformThread::SetName("CrGpuMain");
+
+-#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.
+@@ -355,7 +364,6 @@ int GpuMain(MainFunctionParams parameter
+ #endif
+ const bool dead_on_arrival = !init_success;
+
+- auto* client = GetContentClient()->gpu();
+ if (client) {
+ client->PostSandboxInitialized();
+ }
+@@ -436,7 +444,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) {
+@@ -476,7 +484,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/electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc b/electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.cc
new file mode 100644
index 0000000000..4068daeecc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.262462000 +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/electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h b/electron32/patches/patch-content_ppapi__plugin_ppapi__blink__platform__impl.h
new file mode 100644
index 0000000000..d3c4e2cfdb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.262462000 +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/electron32/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc b/electron32/patches/patch-content_ppapi__plugin_ppapi__plugin__main.cc
new file mode 100644
index 0000000000..8a9194c320
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.262462000 +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/electron32/patches/patch-content_public_app_content__main__delegate.cc b/electron32/patches/patch-content_public_app_content__main__delegate.cc
new file mode 100644
index 0000000000..21be82a027
--- /dev/null
+++ b/electron32/patches/patch-content_public_app_content__main__delegate.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/public/app/content_main_delegate.cc.orig 2024-10-18 12:34:14.370406400 +0000
++++ content/public/app/content_main_delegate.cc
+@@ -5,6 +5,7 @@
+ #include "content/public/app/content_main_delegate.h"
+
+ #include "base/check.h"
++#include "base/strings/string_piece.h"
+ #include "build/build_config.h"
+ #include "content/public/browser/content_browser_client.h"
+ #include "content/public/common/content_client.h"
+@@ -91,6 +92,10 @@ std::optional<int> ContentMainDelegate::
+ return std::nullopt;
+ }
+
++base::StringPiece ContentMainDelegate::GetBrowserV8SnapshotFilename() {
++ return base::StringPiece();
++}
++
+ ContentClient* ContentMainDelegate::CreateContentClient() {
+ return new ContentClient();
+ }
diff --git a/electron32/patches/patch-content_public_app_content__main__delegate.h b/electron32/patches/patch-content_public_app_content__main__delegate.h
new file mode 100644
index 0000000000..9e25d66146
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.370406400 +0000
++++ content/public/app/content_main_delegate.h
+@@ -10,6 +10,7 @@
+ #include <string>
+ #include <vector>
+
++#include "base/strings/string_piece.h"
+ #include "build/build_config.h"
+ #include "content/common/content_export.h"
+ #include "content/public/common/main_function_params.h"
+@@ -176,6 +177,8 @@ class CONTENT_EXPORT ContentMainDelegate
+ virtual bool ShouldHandleConsoleControlEvents();
+ #endif
+
++ virtual base::StringPiece GetBrowserV8SnapshotFilename();
++
+ protected:
+ friend class ContentClientCreator;
+ friend class ContentClientInitializer;
diff --git a/electron32/patches/patch-content_public_browser_content__browser__client.cc b/electron32/patches/patch-content_public_browser_content__browser__client.cc
new file mode 100644
index 0000000000..ed8e1ba555
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.374404200 +0000
++++ content/public/browser/content_browser_client.cc
+@@ -750,6 +750,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) {
+@@ -1325,7 +1327,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/electron32/patches/patch-content_public_browser_content__browser__client.h b/electron32/patches/patch-content_public_browser_content__browser__client.h
new file mode 100644
index 0000000000..a76759e876
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.394394000 +0000
++++ content/public/browser/content_browser_client.h
+@@ -189,6 +189,7 @@ class NetworkService;
+ class TrustedURLLoaderHeaderClient;
+ } // namespace mojom
+ struct ResourceRequest;
++class ResourceRequestBody;
+ } // namespace network
+
+ namespace sandbox {
+@@ -328,6 +329,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.
+@@ -1285,6 +1291,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/electron32/patches/patch-content_public_browser_desktop__media__id.h b/electron32/patches/patch-content_public_browser_desktop__media__id.h
new file mode 100644
index 0000000000..8cf6b9ee02
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.394394000 +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/electron32/patches/patch-content_public_browser_platform__notification__service.h b/electron32/patches/patch-content_public_browser_platform__notification__service.h
new file mode 100644
index 0000000000..1b4b0b7f2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.414383600 +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/electron32/patches/patch-content_public_browser_render__view__host.h b/electron32/patches/patch-content_public_browser_render__view__host.h
new file mode 100644
index 0000000000..9408a9e7d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.430375600 +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/electron32/patches/patch-content_public_browser_service__process__host.cc b/electron32/patches/patch-content_public_browser_service__process__host.cc
new file mode 100644
index 0000000000..354ded3e9d
--- /dev/null
+++ b/electron32/patches/patch-content_public_browser_service__process__host.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/public/browser/service_process_host.cc.orig 2024-10-18 12:34:14.430375600 +0000
++++ content/public/browser/service_process_host.cc
+@@ -52,12 +52,45 @@ 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::WithPreloadedLibraries(
+@@ -70,7 +103,7 @@ ServiceProcessHost::Options::WithPreload
+
+ ServiceProcessHost::Options& ServiceProcessHost::Options::WithGpuClient(
+ base::PassKey<ServiceProcessHostGpuClient> passkey) {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ allow_gpu_client = true;
+ #endif
+ return *this;
diff --git a/electron32/patches/patch-content_public_browser_service__process__host.h b/electron32/patches/patch-content_public_browser_service__process__host.h
new file mode 100644
index 0000000000..d3217d4a28
--- /dev/null
+++ b/electron32/patches/patch-content_public_browser_service__process__host.h
@@ -0,0 +1,79 @@
+$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 2024-10-18 12:34:14.430375600 +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,30 @@ 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 libraries to preload before the sandbox is locked down. Paths
+ // should be absolute paths. Libraries will be preloaded before sandbox
+@@ -127,11 +151,20 @@ 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;
+ };
+
+ // An interface which can be implemented and registered/unregistered with
diff --git a/electron32/patches/patch-content_public_browser_service__process__info.h b/electron32/patches/patch-content_public_browser_service__process__info.h
new file mode 100644
index 0000000000..366082562b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.430375600 +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/electron32/patches/patch-content_public_browser_web__contents.h b/electron32/patches/patch-content_public_browser_web__contents.h
new file mode 100644
index 0000000000..98eaa58e15
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.438371400 +0000
++++ content/public/browser/web_contents.h
+@@ -109,10 +109,13 @@ class BrowserContext;
+ class BrowserPluginGuestDelegate;
+ class RenderFrameHost;
+ class RenderViewHost;
++class RenderViewHostDelegateView;
+ class RenderWidgetHostView;
++class RenderWidgetHostViewBase;
+ class ScreenOrientationDelegate;
+ class SiteInstance;
+ class WebContentsDelegate;
++class WebContentsView;
+ class WebUI;
+ struct DropData;
+ struct MHTMLGenerationParams;
+@@ -259,6 +262,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 GetLastActiveTime(). If this is left
+ // default initialized then the value is not passed on to the WebContents
diff --git a/electron32/patches/patch-content_public_browser_web__contents__delegate.cc b/electron32/patches/patch-content_public_browser_web__contents__delegate.cc
new file mode 100644
index 0000000000..2631b1e781
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.438371400 +0000
++++ content/public/browser/web_contents_delegate.cc
+@@ -30,6 +30,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,
+@@ -129,8 +140,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/electron32/patches/patch-content_public_browser_web__contents__delegate.h b/electron32/patches/patch-content_public_browser_web__contents__delegate.h
new file mode 100644
index 0000000000..10b45027c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.438371400 +0000
++++ content/public/browser/web_contents_delegate.h
+@@ -17,6 +17,7 @@
+ #include "base/memory/scoped_refptr.h"
+ #include "build/build_config.h"
+ #include "content/common/content_export.h"
++#include "content/common/frame.mojom.h"
+ #include "content/public/browser/eye_dropper.h"
+ #include "content/public/browser/fullscreen_types.h"
+ #include "content/public/browser/invalidate_type.h"
+@@ -336,8 +337,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
+@@ -358,6 +358,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/electron32/patches/patch-content_public_browser_web__contents__observer.h b/electron32/patches/patch-content_public_browser_web__contents__observer.h
new file mode 100644
index 0000000000..85e7b486c1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.438371400 +0000
++++ content/public/browser/web_contents_observer.h
+@@ -33,6 +33,7 @@
+ #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-forward.h"
+ #include "third_party/blink/public/mojom/media/capture_handle_config.mojom-forward.h"
+ #include "third_party/skia/include/core/SkColor.h"
++#include "ui/base/cursor/cursor.h"
+ #include "ui/base/page_transition_types.h"
+ #include "ui/base/window_open_disposition.h"
+
+@@ -602,6 +603,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/electron32/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h b/electron32/patches/patch-content_public_browser_zygote__host_zygote__host__linux.h
new file mode 100644
index 0000000000..2238f58c5f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.454363000 +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/electron32/patches/patch-content_public_common_content__client.h b/electron32/patches/patch-content_public_common_content__client.h
new file mode 100644
index 0000000000..6dc3fb4ad1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.458361100 +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/electron32/patches/patch-content_public_common_content__features.cc b/electron32/patches/patch-content_public_common_content__features.cc
new file mode 100644
index 0000000000..f89de6ac81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.458361100 +0000
++++ content/public/common/content_features.cc
+@@ -36,7 +36,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
+@@ -1128,9 +1128,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
+@@ -1167,7 +1167,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/electron32/patches/patch-content_public_common_content__switches.cc b/electron32/patches/patch-content_public_common_content__switches.cc
new file mode 100644
index 0000000000..d64e7e98e6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.458361100 +0000
++++ content/public/common/content_switches.cc
+@@ -349,6 +349,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.
+@@ -987,7 +989,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/electron32/patches/patch-content_public_common_content__switches.h b/electron32/patches/patch-content_public_common_content__switches.h
new file mode 100644
index 0000000000..bfb43b6cd7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.458361100 +0000
++++ content/public/common/content_switches.h
+@@ -110,6 +110,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[];
+@@ -268,7 +269,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/electron32/patches/patch-content_public_common_sandbox__init__win.h b/electron32/patches/patch-content_public_common_sandbox__init__win.h
new file mode 100644
index 0000000000..3dfae073f5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.466357000 +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,
+ base::Process* process);
+
+ } // namespace content
diff --git a/electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc b/electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.cc
new file mode 100644
index 0000000000..b88d6efdf2
--- /dev/null
+++ b/electron32/patches/patch-content_public_common_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/public/common/sandboxed_process_launcher_delegate.cc.orig 2024-10-18 12:34:14.466357000 +0000
++++ content/public/common/sandboxed_process_launcher_delegate.cc
+@@ -68,11 +68,17 @@ 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_MAC)
+
diff --git a/electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h b/electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.h
new file mode 100644
index 0000000000..10855de581
--- /dev/null
+++ b/electron32/patches/patch-content_public_common_sandboxed__process__launcher__delegate.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/common/sandboxed_process_launcher_delegate.h.orig 2024-10-18 12:34:14.466357000 +0000
++++ content/public/common/sandboxed_process_launcher_delegate.h
+@@ -6,6 +6,7 @@
+ #define CONTENT_PUBLIC_COMMON_SANDBOXED_PROCESS_LAUNCHER_DELEGATE_H_
+
+ #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"
+@@ -57,10 +58,14 @@ 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_MAC)
+ // Whether or not to disclaim TCC responsibility for the process, defaults to
diff --git a/electron32/patches/patch-content_public_common_zygote_features.gni b/electron32/patches/patch-content_public_common_zygote_features.gni
new file mode 100644
index 0000000000..9a86f49806
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.466357000 +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/electron32/patches/patch-content_public_gpu_content__gpu__client.h b/electron32/patches/patch-content_public_gpu_content__gpu__client.h
new file mode 100644
index 0000000000..a6bee143ed
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.470355000 +0000
++++ content/public/gpu/content_gpu_client.h
+@@ -30,6 +30,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/electron32/patches/patch-content_public_renderer_content__renderer__client.h b/electron32/patches/patch-content_public_renderer_content__renderer__client.h
new file mode 100644
index 0000000000..a6a583c579
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.470355000 +0000
++++ content/public/renderer/content_renderer_client.h
+@@ -412,6 +412,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/electron32/patches/patch-content_public_renderer_render__frame__observer.h b/electron32/patches/patch-content_public_renderer_render__frame__observer.h
new file mode 100644
index 0000000000..1454945f01
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.474352800 +0000
++++ content/public/renderer/render_frame_observer.h
+@@ -145,6 +145,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/electron32/patches/patch-content_renderer_BUILD.gn b/electron32/patches/patch-content_renderer_BUILD.gn
new file mode 100644
index 0000000000..7816f29765
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.538320000 +0000
++++ content/renderer/BUILD.gn
+@@ -230,6 +230,7 @@ target(link_target_type, "renderer") {
+ }
+
+ configs += [ "//content:content_implementation" ]
++ configs += ["//electron/build/config:mas_build"]
+ defines = []
+
+ public_deps = [
diff --git a/electron32/patches/patch-content_renderer_render__frame__impl.cc b/electron32/patches/patch-content_renderer_render__frame__impl.cc
new file mode 100644
index 0000000000..3501d2057e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.606285000 +0000
++++ content/renderer/render_frame_impl.cc
+@@ -4693,6 +4693,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_)
+@@ -6668,6 +6674,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/electron32/patches/patch-content_renderer_render__frame__impl.h b/electron32/patches/patch-content_renderer_render__frame__impl.h
new file mode 100644
index 0000000000..72a00487de
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.606285000 +0000
++++ content/renderer/render_frame_impl.h
+@@ -643,6 +643,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/electron32/patches/patch-content_renderer_render__process__impl.cc b/electron32/patches/patch-content_renderer_render__process__impl.cc
new file mode 100644
index 0000000000..ded306564d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.622276800 +0000
++++ content/renderer/render_process_impl.cc
+@@ -204,6 +204,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/electron32/patches/patch-content_renderer_render__thread__impl.cc b/electron32/patches/patch-content_renderer_render__thread__impl.cc
new file mode 100644
index 0000000000..2ace854a1c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.622276800 +0000
++++ content/renderer/render_thread_impl.cc
+@@ -214,6 +214,8 @@
+
+ #if BUILDFLAG(IS_APPLE)
+ #include <malloc/malloc.h>
++#elif BUILDFLAG(IS_BSD)
++#include <stdlib.h>
+ #else
+ #include <malloc.h>
+ #endif
+@@ -1017,7 +1019,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::kVaapiVideoDecodeLinux) &&
+ #endif // BUILDFLAG(IS_LINUX)
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode) &&
+@@ -1026,7 +1028,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::kVaapiVideoEncodeLinux) &&
+ #else
+ !cmd_line->HasSwitch(switches::kDisableAcceleratedVideoEncode) &&
+@@ -1276,7 +1278,7 @@ bool RenderThreadImpl::IsLcdTextEnabled(
+ }
+
+ bool RenderThreadImpl::IsElasticOverscrollEnabled() {
+- return is_elastic_overscroll_enabled_;
++ return base::CommandLine::ForCurrentProcess()->HasSwitch("scroll-bounce");
+ }
+
+ gpu::GpuMemoryBufferManager* RenderThreadImpl::GetGpuMemoryBufferManager() {
+@@ -1801,7 +1803,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/electron32/patches/patch-content_renderer_renderer__blink__platform__impl.cc b/electron32/patches/patch-content_renderer_renderer__blink__platform__impl.cc
new file mode 100644
index 0000000000..d8573ee7d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.622276800 +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
+@@ -197,13 +197,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());
+@@ -223,7 +223,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>();
+@@ -284,7 +284,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.
+@@ -881,12 +881,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/electron32/patches/patch-content_renderer_renderer__blink__platform__impl.h b/electron32/patches/patch-content_renderer_renderer__blink__platform__impl.h
new file mode 100644
index 0000000000..87cac03bd0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.622276800 +0000
++++ content/renderer/renderer_blink_platform_impl.h
+@@ -195,6 +195,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(
+@@ -255,7 +258,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/electron32/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc b/electron32/patches/patch-content_renderer_renderer__main__platform__delegate__linux.cc
new file mode 100644
index 0000000000..79e4b698cd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.626274800 +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/electron32/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm b/electron32/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
new file mode 100644
index 0000000000..b235ff29e9
--- /dev/null
+++ b/electron32/patches/patch-content_renderer_renderer__main__platform__delegate__mac.mm
@@ -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/renderer/renderer_main_platform_delegate_mac.mm.orig 2024-10-18 12:34:14.626274800 +0000
++++ content/renderer/renderer_main_platform_delegate_mac.mm
+@@ -10,9 +10,11 @@
+ #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 +24,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 +33,7 @@ void DisableSystemServices() {
+
+ sandbox::DisableLaunchServices();
+ sandbox::DisableCoreServicesCheckFix();
++#endif
+ }
+
+ } // namespace
diff --git a/electron32/patches/patch-content_renderer_theme__helper__mac.mm b/electron32/patches/patch-content_renderer_theme__helper__mac.mm
new file mode 100644
index 0000000000..4d7b860a4e
--- /dev/null
+++ b/electron32/patches/patch-content_renderer_theme__helper__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/theme_helper_mac.mm.orig 2024-10-18 12:34:14.630272600 +0000
++++ content/renderer/theme_helper_mac.mm
+@@ -8,10 +8,11 @@
+
+ #include "base/strings/sys_string_conversions.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ bool CGFontRenderingGetFontSmoothingDisabled(void);
+ }
+-
++#endif
+ namespace content {
+
+ void SystemColorsDidChange(int aqua_color_variant) {
+@@ -24,8 +25,18 @@ void SystemColorsDidChange(int aqua_colo
+ }
+
+ 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/electron32/patches/patch-content_shell_BUILD.gn b/electron32/patches/patch-content_shell_BUILD.gn
new file mode 100644
index 0000000000..aa79e0e544
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.694239900 +0000
++++ content/shell/BUILD.gn
+@@ -1084,7 +1084,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/electron32/patches/patch-content_shell_app_shell__main__delegate.cc b/electron32/patches/patch-content_shell_app_shell__main__delegate.cc
new file mode 100644
index 0000000000..03a1c969e6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.698237700 +0000
++++ content/shell/app/shell_main_delegate.cc
+@@ -276,7 +276,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/electron32/patches/patch-content_shell_browser_shell__browser__main__parts.cc b/electron32/patches/patch-content_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 0000000000..ca4df8cb4a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.702235700 +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/electron32/patches/patch-content_shell_browser_shell__paths.cc b/electron32/patches/patch-content_shell_browser_shell__paths.cc
new file mode 100644
index 0000000000..cc613f7dc3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.702235700 +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/electron32/patches/patch-content_shell_renderer_shell__content__renderer__client.cc b/electron32/patches/patch-content_shell_renderer_shell__content__renderer__client.cc
new file mode 100644
index 0000000000..d724f32c30
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.718227400 +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/electron32/patches/patch-content_shell_utility_shell__content__utility__client.cc b/electron32/patches/patch-content_shell_utility_shell__content__utility__client.cc
new file mode 100644
index 0000000000..f3a3d32b2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.718227400 +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/electron32/patches/patch-content_test_BUILD.gn b/electron32/patches/patch-content_test_BUILD.gn
new file mode 100644
index 0000000000..3c237cadd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:14.718227400 +0000
++++ content/test/BUILD.gn
+@@ -502,6 +502,7 @@ static_library("test_support") {
+ configs += [
+ "//build/config:precompiled_headers",
+ "//v8:external_startup_data",
++ "//electron/build/config:mas_build",
+ ]
+
+ public_deps = [
+@@ -1103,6 +1104,7 @@ static_library("browsertest_support") {
+ }
+
+ configs += [ "//v8:external_startup_data" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ mojom("content_test_mojo_bindings") {
+@@ -1685,7 +1687,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" ]
+ }
+
+@@ -1718,6 +1720,7 @@ test("content_browsertests") {
+ defines = [ "HAS_OUT_OF_PROC_TEST_RUNNER" ]
+
+ configs += [ "//build/config:precompiled_headers" ]
++ configs += ["//electron/build/config:mas_build"]
+
+ public_deps = [
+ ":test_interfaces",
+@@ -2974,6 +2977,7 @@ test("content_unittests") {
+ }
+
+ configs += [ "//build/config:precompiled_headers" ]
++ configs += ["//electron/build/config:mas_build"]
+
+ public_deps = [ "//content:content_resources" ]
+
diff --git a/electron32/patches/patch-content_test_mock__platform__notification__service.cc b/electron32/patches/patch-content_test_mock__platform__notification__service.cc
new file mode 100644
index 0000000000..a0540d94fe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.189474800 +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/electron32/patches/patch-content_test_mock__platform__notification__service.h b/electron32/patches/patch-content_test_mock__platform__notification__service.h
new file mode 100644
index 0000000000..d2fadc7840
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.189474800 +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/electron32/patches/patch-content_test_test__page__broadcast.h b/electron32/patches/patch-content_test_test__page__broadcast.h
new file mode 100644
index 0000000000..b9f2246f27
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.201468700 +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/electron32/patches/patch-content_utility_services.cc b/electron32/patches/patch-content_utility_services.cc
new file mode 100644
index 0000000000..d10971f359
--- /dev/null
+++ b/electron32/patches/patch-content_utility_services.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
+
+--- content/utility/services.cc.orig 2024-10-18 12:34:16.205466700 +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"
+@@ -97,7 +97,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
+@@ -115,13 +115,13 @@ extern sandbox::TargetServices* g_utilit
+ #endif // BUILDFLAG(ENABLE_ACCESSIBILITY_SERVICE)
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || \
+- BUILDFLAG(ENABLE_VIDEO_EFFECTS)
++ BUILDFLAG(ENABLE_VIDEO_EFFECTS) || BUILDFLAG(IS_BSD)
+ #include "services/viz/public/cpp/gpu/gpu.h"
+ #include "services/viz/public/mojom/gpu.mojom.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(ENABLE_VIDEO_EFFECTS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "media/capture/capture_switches.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -239,7 +239,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) {
+@@ -328,7 +328,7 @@ auto RunVideoCapture(
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+ auto service = std::make_unique<UtilityThreadVideoCaptureServiceImpl>(
+ std::move(receiver), base::SingleThreadTaskRunner::GetCurrentDefault());
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ {
+ #else
+@@ -384,7 +384,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<
+@@ -395,7 +395,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) {
+@@ -418,7 +418,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)) {
+@@ -470,7 +470,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)) {
+@@ -479,7 +479,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/electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc b/electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..f1809badf3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.205466700 +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/electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h b/electron32/patches/patch-content_utility_speech_speech__recognition__sandbox__hook__linux.h
new file mode 100644
index 0000000000..85167dde01
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.205466700 +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/electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc b/electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.cc
new file mode 100644
index 0000000000..46991965be
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.205466700 +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/electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h b/electron32/patches/patch-content_utility_utility__blink__platform__with__sandbox__support__impl.h
new file mode 100644
index 0000000000..1e045a2631
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.205466700 +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/electron32/patches/patch-content_utility_utility__main.cc b/electron32/patches/patch-content_utility_utility__main.cc
new file mode 100644
index 0000000000..4b92cb8e32
--- /dev/null
+++ b/electron32/patches/patch-content_utility_utility__main.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
+
+--- content/utility/utility_main.cc.orig 2024-10-18 12:34:16.205466700 +0000
++++ content/utility/utility_main.cc
+@@ -36,17 +36,21 @@
+ #include "services/screen_ai/buildflags/buildflags.h"
+ #include "services/tracing/public/cpp/trace_startup.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
+@@ -58,10 +62,15 @@
+ #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(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#include "content/common/gpu_pre_sandbox_hook_bsd.h"
++#endif
++
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ #include "chromeos/ash/components/assistant/buildflags.h"
+ #include "chromeos/ash/services/ime/ime_sandbox_hook.h"
+@@ -73,7 +82,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
+@@ -101,7 +110,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(
+@@ -128,9 +137,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;
+@@ -145,6 +155,7 @@ bool ShouldUseAmdGpuPolicy(sandbox::mojo
+
+ return false;
+ }
++#endif
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+ #if BUILDFLAG(IS_WIN)
+@@ -242,7 +253,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
+@@ -254,7 +266,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.
+@@ -292,7 +304,7 @@ int UtilityMain(MainFunctionParams param
+ screen_ai::GetBinaryPathSwitch()));
+ break;
+ #endif
+-#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);
+@@ -319,6 +331,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 =
+@@ -326,6 +339,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/electron32/patches/patch-content_utility_utility__thread__impl.cc b/electron32/patches/patch-content_utility_utility__thread__impl.cc
new file mode 100644
index 0000000000..f383bc08df
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.205466700 +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/electron32/patches/patch-content_web__test_BUILD.gn b/electron32/patches/patch-content_web__test_BUILD.gn
new file mode 100644
index 0000000000..e2ae8d2b29
--- /dev/null
+++ b/electron32/patches/patch-content_web__test_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/web_test/BUILD.gn.orig 2024-10-18 12:34:16.213462600 +0000
++++ content/web_test/BUILD.gn
+@@ -151,6 +151,8 @@ static_library("web_test_browser") {
+ "browser/web_test_tts_platform.h",
+ ]
+
++ configs += ["//electron/build/config:mas_build"]
++
+ if (is_mac) {
+ sources += [ "browser/web_test_shell_platform_delegate_mac.mm" ]
+ } else if (toolkit_views && !is_castos) {
diff --git a/electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.cc b/electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.cc
new file mode 100644
index 0000000000..444b161e15
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.217460600 +0000
++++ content/web_test/browser/web_test_content_browser_client.cc
+@@ -515,6 +515,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/electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.h b/electron32/patches/patch-content_web__test_browser_web__test__content__browser__client.h
new file mode 100644
index 0000000000..9fa54aa309
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.217460600 +0000
++++ content/web_test/browser/web_test_content_browser_client.h
+@@ -91,6 +91,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/electron32/patches/patch-content_zygote_BUILD.gn b/electron32/patches/patch-content_zygote_BUILD.gn
new file mode 100644
index 0000000000..ffedff82ca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.253442300 +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/electron32/patches/patch-content_zygote_zygote__linux.cc b/electron32/patches/patch-content_zygote_zygote__linux.cc
new file mode 100644
index 0000000000..7d5505b8bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.253442300 +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.
+@@ -723,3 +724,4 @@ void Zygote::HandleReinitializeLoggingRe
+ }
+
+ } // namespace content
++#endif
diff --git a/electron32/patches/patch-content_zygote_zygote__main__linux.cc b/electron32/patches/patch-content_zygote_zygote__main__linux.cc
new file mode 100644
index 0000000000..00f326da77
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.253442300 +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/electron32/patches/patch-device_bluetooth_BUILD.gn b/electron32/patches/patch-device_bluetooth_BUILD.gn
new file mode 100644
index 0000000000..ee1703722e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.433350800 +0000
++++ device/bluetooth/BUILD.gn
+@@ -249,6 +249,7 @@ component("bluetooth") {
+ "IOKit.framework",
+ "Foundation.framework",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_mac) {
diff --git a/electron32/patches/patch-device_bluetooth_bluetooth__adapter.cc b/electron32/patches/patch-device_bluetooth_bluetooth__adapter.cc
new file mode 100644
index 0000000000..e597f66a11
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.433350800 +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/electron32/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm b/electron32/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
new file mode 100644
index 0000000000..a10e8ff665
--- /dev/null
+++ b/electron32/patches/patch-device_bluetooth_bluetooth__adapter__mac.mm
@@ -0,0 +1,48 @@
+$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 2024-10-18 12:34:16.445344700 +0000
++++ device/bluetooth/bluetooth_adapter_mac.mm
+@@ -39,6 +39,7 @@
+ #include "device/bluetooth/bluetooth_socket_mac.h"
+ #include "device/bluetooth/public/cpp/bluetooth_address.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 +53,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|.
+@@ -150,8 +152,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)) {
+ }
+@@ -307,8 +311,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/electron32/patches/patch-device_bluetooth_cast__bluetooth.gni b/electron32/patches/patch-device_bluetooth_cast__bluetooth.gni
new file mode 100644
index 0000000000..7fae82c19e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.513310200 +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/electron32/patches/patch-device_fido_fido__discovery__factory.cc b/electron32/patches/patch-device_fido_fido__discovery__factory.cc
new file mode 100644
index 0000000000..68803e1a95
--- /dev/null
+++ b/electron32/patches/patch-device_fido_fido__discovery__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
+
+--- device/fido/fido_discovery_factory.cc.orig 2024-10-18 12:34:16.657237000 +0000
++++ device/fido/fido_discovery_factory.cc
+@@ -127,7 +127,7 @@ std::vector<std::unique_ptr<FidoDiscover
+
+ std::optional<std::unique_ptr<FidoDiscoveryBase>>
+ FidoDiscoveryFactory::MaybeCreateEnclaveDiscovery() {
+-#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!base::FeatureList::IsEnabled(kWebAuthnEnclaveAuthenticator) ||
+ !enclave_ui_request_stream_ || !network_context_factory_) {
+ return std::nullopt;
diff --git a/electron32/patches/patch-device_gamepad_BUILD.gn b/electron32/patches/patch-device_gamepad_BUILD.gn
new file mode 100644
index 0000000000..1236d40728
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.701214800 +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/electron32/patches/patch-device_gamepad_gamepad__provider.cc b/electron32/patches/patch-device_gamepad_gamepad__provider.cc
new file mode 100644
index 0000000000..1b68f876ab
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.713208700 +0000
++++ device/gamepad/gamepad_provider.cc
+@@ -224,7 +224,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/electron32/patches/patch-device_gamepad_hid__writer__linux.cc b/electron32/patches/patch-device_gamepad_hid__writer__linux.cc
new file mode 100644
index 0000000000..d73ae2991e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:16.721204500 +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/electron32/patches/patch-electron_BUILD.gn b/electron32/patches/patch-electron_BUILD.gn
new file mode 100644
index 0000000000..43fd22df39
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/BUILD.gn
+@@ -524,7 +524,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",
+@@ -617,6 +617,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 += [
+@@ -1194,7 +1200,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",
+@@ -1220,7 +1226,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" ]
+ }
+
+@@ -1287,7 +1293,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" ]
+ }
+ }
+@@ -1395,7 +1401,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/electron32/patches/patch-electron_build_args_all.gn b/electron32/patches/patch-electron_build_args_all.gn
new file mode 100644
index 0000000000..89b5e20030
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_build_args_release.gn b/electron32/patches/patch-electron_build_args_release.gn
new file mode 100644
index 0000000000..dd21c72e51
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_default__app_default__app.ts b/electron32/patches/patch-electron_default__app_default__app.ts
new file mode 100644
index 0000000000..fca65dbfaf
--- /dev/null
+++ b/electron32/patches/patch-electron_default__app_default__app.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/default_app/default_app.ts
+@@ -61,7 +61,8 @@ async function createWindow (backgroundC
+ show: false
+ };
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd' ) {
+ options.icon = url.fileURLToPath(new URL('icon.png', import.meta.url));
+ }
+
diff --git a/electron32/patches/patch-electron_filenames.gni b/electron32/patches/patch-electron_filenames.gni
new file mode 100644
index 0000000000..f34f56acb9
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/filenames.gni
+@@ -243,8 +243,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/electron32/patches/patch-electron_lib_browser_api_app.ts b/electron32/patches/patch-electron_lib_browser_api_app.ts
new file mode 100644
index 0000000000..113a860a3a
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_browser_api_app.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/browser/api/app.ts
+@@ -67,7 +67,8 @@ if (process.platform === 'darwin') {
+ app.dock!.getMenu = () => dockMenu;
+ }
+
+-if (process.platform === 'linux') {
++if (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd') {
+ const patternVmRSS = /^VmRSS:\s*(\d+) kB$/m;
+ const patternVmHWM = /^VmHWM:\s*(\d+) kB$/m;
+
diff --git a/electron32/patches/patch-electron_lib_browser_api_dialog.ts b/electron32/patches/patch-electron_lib_browser_api_dialog.ts
new file mode 100644
index 0000000000..1f1844335b
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_browser_api_dialog.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/browser/api/dialog.ts
+@@ -41,7 +41,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ return text.replaceAll('_', '__').replaceAll(/&(.?)/g, (match, after) => {
+ if (after === '&') return after;
+ return `_${after}`;
diff --git a/electron32/patches/patch-electron_lib_browser_api_menu-item-roles.ts b/electron32/patches/patch-electron_lib_browser_api_menu-item-roles.ts
new file mode 100644
index 0000000000..0a0d72226d
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_browser_api_menu-item-roles.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/browser/api/menu-item-roles.ts
+@@ -2,7 +2,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_lib_browser_api_power-monitor.ts b/electron32/patches/patch-electron_lib_browser_api_power-monitor.ts
new file mode 100644
index 0000000000..500365a52e
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_browser_api_power-monitor.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/browser/api/power-monitor.ts
+@@ -17,7 +17,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_lib_browser_init.ts b/electron32/patches/patch-electron_lib_browser_init.ts
new file mode 100644
index 0000000000..eb688d2c1d
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_browser_init.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/browser/init.ts
+@@ -162,7 +162,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') return false;
+ const currentDesktop = process.env.XDG_CURRENT_DESKTOP;
+
+ if (!currentDesktop) return false;
diff --git a/electron32/patches/patch-electron_lib_browser_rpc-server.ts b/electron32/patches/patch-electron_lib_browser_rpc-server.ts
new file mode 100644
index 0000000000..941195df66
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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 'openbsd': case 'netbsd':
+ return new Set(Object.keys(clipboard));
+ default:
+ return new Set();
diff --git a/electron32/patches/patch-electron_lib_renderer_api_clipboard.ts b/electron32/patches/patch-electron_lib_renderer_api_clipboard.ts
new file mode 100644
index 0000000000..8ec0c841f7
--- /dev/null
+++ b/electron32/patches/patch-electron_lib_renderer_api_clipboard.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/lib/renderer/api/clipboard.ts
+@@ -7,7 +7,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_script_lib_config.py b/electron32/patches/patch-electron_script_lib_config.py
new file mode 100644
index 0000000000..7288d94a20
--- /dev/null
+++ b/electron32/patches/patch-electron_script_lib_config.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
+
+--- electron/script/lib/config.py.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/script/lib/config.py
+@@ -7,6 +7,11 @@ PLATFORM = {
+ 'cygwin': 'win32',
+ 'msys': 'win32',
+ 'darwin': 'darwin',
++ 'freebsd13': 'freebsd',
++ 'freebsd14': 'freebsd',
++ 'freebsd15': 'freebsd',
++ 'openbsd': 'openbsd',
++ 'netbsd': 'netbsd',
+ 'linux': 'linux',
+ 'linux2': 'linux',
+ 'win32': 'win32',
diff --git a/electron32/patches/patch-electron_script_lib_utils.js b/electron32/patches/patch-electron_script_lib_utils.js
new file mode 100644
index 0000000000..cb088cfd69
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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 'openbsd': case 'netbsd':
+ return `out/${OUT_DIR}/electron`;
+ default:
+ throw new Error('Unknown platform');
diff --git a/electron32/patches/patch-electron_script_spec-runner.js b/electron32/patches/patch-electron_script_spec-runner.js
new file mode 100644
index 0000000000..4e0de81066
--- /dev/null
+++ b/electron32/patches/patch-electron_script_spec-runner.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
+
+--- electron/script/spec-runner.js.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/script/spec-runner.js
+@@ -165,7 +165,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ runnerArgs.unshift(path.resolve(__dirname, 'dbus_mock.py'), exe);
+ exe = 'python3';
+ }
diff --git a/electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.cc b/electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.cc
new file mode 100644
index 0000000000..d9e1fbbe1a
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/app/electron_crash_reporter_client.cc
+@@ -95,7 +95,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);
+@@ -196,7 +196,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/electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.h b/electron32/patches/patch-electron_shell_app_electron__crash__reporter__client.h
new file mode 100644
index 0000000000..fe3afa240e
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/app/electron_crash_reporter_client.h
+@@ -31,7 +31,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,
+@@ -70,7 +70,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/electron32/patches/patch-electron_shell_app_electron__main__delegate.cc b/electron32/patches/patch-electron_shell_app_electron__main__delegate.cc
new file mode 100644
index 0000000000..c020c17472
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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"
+@@ -157,7 +157,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(
+@@ -283,7 +283,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 --"
+@@ -333,7 +333,7 @@ void ElectronMainDelegate::PreSandboxSta
+ /* is_preinit = */ IsBrowserProcess() || IsZygoteProcess());
+ #endif
+
+-#if !IS_MAS_BUILD()
++#if !IS_MAS_BUILD() && !BUILDFLAG(IS_BSD)
+ crash_reporter::InitializeCrashKeys();
+ #endif
+
+@@ -368,7 +368,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
+@@ -403,7 +403,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/electron32/patches/patch-electron_shell_app_node__main.cc b/electron32/patches/patch-electron_shell_app_node__main.cc
new file mode 100644
index 0000000000..a7c7cf6314
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/app/node_main.cc
+@@ -48,7 +48,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"
+@@ -99,14 +99,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);
+@@ -271,7 +271,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/electron32/patches/patch-electron_shell_browser_api_electron__api__app.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__app.cc
new file mode 100644
index 0000000000..d3c75f7e32
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_app.cc
+@@ -92,7 +92,7 @@
+ #include "shell/browser/ui/cocoa/electron_bundle_mover.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
+@@ -416,7 +416,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.
+@@ -602,7 +602,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());
+@@ -928,7 +928,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
+@@ -1032,7 +1032,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.
+@@ -1327,7 +1327,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);
+@@ -1701,7 +1701,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))
+@@ -1759,7 +1759,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/electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.cc
new file mode 100644
index 0000000000..f8f79d7c00
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_base_window.cc
+@@ -40,7 +40,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
+
+@@ -993,7 +993,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
+@@ -1050,7 +1050,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
+@@ -1300,7 +1300,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/electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.h b/electron32/patches/patch-electron_shell_browser_api_electron__api__base__window.h
new file mode 100644
index 0000000000..c60c890114
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_base_window.h
+@@ -241,7 +241,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/electron32/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__crash__reporter.cc
new file mode 100644
index 0000000000..2b5cf450af
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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"
+@@ -65,7 +65,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() {}
+@@ -136,7 +136,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;
+@@ -182,7 +182,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) {
+@@ -237,13 +237,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();
+@@ -252,7 +252,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);
+@@ -264,7 +264,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/electron32/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__desktop__capturer.cc
new file mode 100644
index 0000000000..3c1743bfc9
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_desktop_capturer.cc
+@@ -46,7 +46,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/electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.cc
new file mode 100644
index 0000000000..601f75d01c
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_power_monitor.cc
+@@ -118,6 +118,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) {
+@@ -143,7 +148,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/electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h b/electron32/patches/patch-electron_shell_browser_api_electron__api__power__monitor.h
new file mode 100644
index 0000000000..47b9e92c20
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__safe__storage.cc
new file mode 100644
index 0000000000..d48f0d5a2b
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_safe_storage.cc
+@@ -20,7 +20,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.
+@@ -39,7 +39,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";
+@@ -136,7 +136,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/electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc b/electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.cc
new file mode 100644
index 0000000000..e0ec3659a1
--- /dev/null
+++ b/electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.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
+
+--- electron/shell/browser/api/electron_api_web_contents.cc.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_web_contents.cc
+@@ -153,11 +153,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/gfx/font_render_params.h"
+ #endif
+
+@@ -517,7 +517,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)
+@@ -871,7 +871,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));
+@@ -2612,7 +2612,7 @@ 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();
+@@ -3291,7 +3291,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
+@@ -4152,7 +4152,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/electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.h b/electron32/patches/patch-electron_shell_browser_api_electron__api__web__contents.h
new file mode 100644
index 0000000000..faf303b9e7
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/api/electron_api_web_contents.h
+@@ -762,7 +762,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/electron32/patches/patch-electron_shell_browser_api_process__metric.h b/electron32/patches/patch-electron_shell_browser_api_process__metric.h
new file mode 100644
index 0000000000..82f0b829fd
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_browser.cc b/electron32/patches/patch-electron_shell_browser_browser.cc
new file mode 100644
index 0000000000..4d7183c80c
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/browser.cc
+@@ -66,7 +66,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/electron32/patches/patch-electron_shell_browser_browser.h b/electron32/patches/patch-electron_shell_browser_browser.h
new file mode 100644
index 0000000000..35ccf1a0aa
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/browser.h
+@@ -145,7 +145,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);
+@@ -273,10 +273,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/electron32/patches/patch-electron_shell_browser_browser__linux.cc b/electron32/patches/patch-electron_shell_browser_browser__linux.cc
new file mode 100644
index 0000000000..e223b85a58
--- /dev/null
+++ b/electron32/patches/patch-electron_shell_browser_browser__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
+
+--- electron/shell/browser/browser_linux.cc.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/browser_linux.cc
+@@ -19,7 +19,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"
+ #include "ui/gtk/gtk_util.h" // nogncheck
+ #endif
diff --git a/electron32/patches/patch-electron_shell_browser_browser__process__impl.cc b/electron32/patches/patch-electron_shell_browser_browser__process__impl.cc
new file mode 100644
index 0000000000..f03857e89d
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/browser_process_impl.cc
+@@ -339,7 +339,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) {
+@@ -362,7 +362,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/electron32/patches/patch-electron_shell_browser_browser__process__impl.h b/electron32/patches/patch-electron_shell_browser_browser__process__impl.h
new file mode 100644
index 0000000000..bfe2267710
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/browser_process_impl.h
+@@ -23,7 +23,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_;
+@@ -149,7 +149,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/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.cc b/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.cc
new file mode 100644
index 0000000000..cb07e594c4
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/electron_browser_main_parts.cc
+@@ -78,7 +78,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"
+@@ -131,7 +131,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
+@@ -299,7 +299,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
+@@ -330,7 +330,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)
+@@ -390,7 +390,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>();
+@@ -496,7 +496,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)
+@@ -508,7 +508,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.
+@@ -609,7 +611,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/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.h b/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts.h
new file mode 100644
index 0000000000..f5533f401f
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/electron_browser_main_parts.h
+@@ -119,7 +119,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
+
+@@ -141,7 +141,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/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc b/electron32/patches/patch-electron_shell_browser_electron__browser__main__parts__posix.cc
new file mode 100644
index 0000000000..362517fcdc
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc b/electron32/patches/patch-electron_shell_browser_extensions_api_runtime_electron__runtime__api__delegate.cc
new file mode 100644
index 0000000000..de31b86b6e
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/extensions/api/runtime/electron_runtime_api_delegate.cc
+@@ -55,6 +55,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/electron32/patches/patch-electron_shell_browser_native__window.cc b/electron32/patches/patch-electron_shell_browser_native__window.cc
new file mode 100644
index 0000000000..c5bfb145ec
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/native_window.cc
+@@ -203,7 +203,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/electron32/patches/patch-electron_shell_browser_native__window__views.cc b/electron32/patches/patch-electron_shell_browser_native__window__views.cc
new file mode 100644
index 0000000000..d92db11acb
--- /dev/null
+++ b/electron32/patches/patch-electron_shell_browser_native__window__views.cc
@@ -0,0 +1,206 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/native_window_views.cc
+@@ -53,7 +53,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"
+@@ -298,7 +298,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";
+@@ -324,7 +324,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) {
+@@ -426,7 +426,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);
+@@ -462,7 +462,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();
+@@ -524,7 +524,7 @@ void NativeWindowViews::Show() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+
+@@ -540,7 +540,7 @@ void NativeWindowViews::ShowInactive() {
+
+ NotifyWindowShow();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (global_menu_bar_)
+ global_menu_bar_->OnWindowMapped();
+
+@@ -559,7 +559,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
+@@ -590,7 +590,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();
+@@ -646,7 +646,7 @@ void NativeWindowViews::SetEnabledIntern
+ #endif
+ }
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ void NativeWindowViews::Maximize() {
+ if (IsVisible()) {
+ widget()->Maximize();
+@@ -786,7 +786,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_) {
+@@ -1046,7 +1046,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
+ }
+@@ -1086,7 +1086,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();
+@@ -1309,7 +1309,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();
+@@ -1364,7 +1364,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(
+@@ -1410,7 +1410,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);
+ }
+@@ -1481,7 +1481,7 @@ void NativeWindowViews::SetVisibleOnAllW
+ }
+
+ bool NativeWindowViews::IsVisibleOnAllWorkspaces() const {
+-#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.
+@@ -1504,7 +1504,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 =
+@@ -1602,7 +1602,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());
+@@ -1698,7 +1698,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
+ }
+@@ -1754,7 +1754,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)
+@@ -1773,7 +1773,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/electron32/patches/patch-electron_shell_browser_native__window__views.h b/electron32/patches/patch-electron_shell_browser_native__window__views.h
new file mode 100644
index 0000000000..dbb12cead0
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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
+
+@@ -161,7 +161,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
+
+@@ -247,7 +247,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/electron32/patches/patch-electron_shell_browser_net_system__network__context__manager.cc b/electron32/patches/patch-electron_shell_browser_net_system__network__context__manager.cc
new file mode 100644
index 0000000000..1502445869
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/net/system_network_context_manager.cc
+@@ -42,7 +42,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/electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc b/electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.cc
new file mode 100644
index 0000000000..37ce691580
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/osr/osr_host_display_client.cc
+@@ -96,7 +96,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/electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.h b/electron32/patches/patch-electron_shell_browser_osr_osr__host__display__client.h
new file mode 100644
index 0000000000..033ec36d6b
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/osr/osr_host_display_client.h
+@@ -72,7 +72,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/electron32/patches/patch-electron_shell_browser_printing_printing__utils.cc b/electron32/patches/patch-electron_shell_browser_printing_printing__utils.cc
new file mode 100644
index 0000000000..93c9a436f2
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/printing/printing_utils.cc
+@@ -28,7 +28,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/electron32/patches/patch-electron_shell_browser_relauncher__linux.cc b/electron32/patches/patch-electron_shell_browser_relauncher__linux.cc
new file mode 100644
index 0000000000..fb84c1247d
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/file_util.h"
+ #include "base/files/scoped_file.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/electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc b/electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents.cc
new file mode 100644
index 0000000000..5b51c6f573
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/ui/inspectable_web_contents.cc
+@@ -557,7 +557,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/electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h b/electron32/patches/patch-electron_shell_browser_ui_inspectable__web__contents__view__delegate.h
new file mode 100644
index 0000000000..4fcfa0d5b4
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc b/electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.cc
new file mode 100644
index 0000000000..4926468fc9
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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 =
+@@ -53,7 +53,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;
+ }
+@@ -85,7 +85,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/electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h b/electron32/patches/patch-electron_shell_browser_ui_views_electron__views__delegate.h
new file mode 100644
index 0000000000..be1843ed54
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc b/electron32/patches/patch-electron_shell_browser_ui_views_inspectable__web__contents__view__views.cc
new file mode 100644
index 0000000000..6769ea6c2a
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/ui/views/inspectable_web_contents_view_views.cc
+@@ -184,7 +184,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/electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.cc b/electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.cc
new file mode 100644
index 0000000000..caa43e2106
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/browser/ui/views/menu_bar.cc
+@@ -13,7 +13,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
+
+@@ -212,7 +212,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");
+@@ -237,7 +237,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
+@@ -245,7 +245,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/electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.h b/electron32/patches/patch-electron_shell_browser_ui_views_menu__bar.h
new file mode 100644
index 0000000000..bbeed7b1b0
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_browser_ui_views_submenu__button.cc b/electron32/patches/patch-electron_shell_browser_ui_views_submenu__button.cc
new file mode 100644
index 0000000000..7b91026377
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_api_electron__api__clipboard.cc b/electron32/patches/patch-electron_shell_common_api_electron__api__clipboard.cc
new file mode 100644
index 0000000000..812350d867
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/common/api/electron_api_clipboard.cc
+@@ -59,7 +59,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);
+@@ -75,7 +75,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 (!base::Contains(custom_format_names, format_string)) {
+ custom_format_names =
+ clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kSelection,
diff --git a/electron32/patches/patch-electron_shell_common_api_electron__api__native__image.cc b/electron32/patches/patch-electron_shell_common_api_electron__api__native__image.cc
new file mode 100644
index 0000000000..f91ae586f4
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_api_electron__api__native__image.h b/electron32/patches/patch-electron_shell_common_api_electron__api__native__image.h
new file mode 100644
index 0000000000..0980cceb25
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/common/api/electron_api_native_image.h
+@@ -78,7 +78,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/electron32/patches/patch-electron_shell_common_api_electron__bindings.cc b/electron32/patches/patch-electron_shell_common_api_electron__bindings.cc
new file mode 100644
index 0000000000..5be8c5d2b3
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/common/api/electron_bindings.cc
+@@ -253,7 +253,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/electron32/patches/patch-electron_shell_common_electron__command__line.cc b/electron32/patches/patch-electron_shell_common_electron__command__line.cc
new file mode 100644
index 0000000000..535f5dbfc3
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_electron__command__line.h b/electron32/patches/patch-electron_shell_common_electron__command__line.h
new file mode 100644
index 0000000000..e42f3d99a0
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_electron__paths.h b/electron32/patches/patch-electron_shell_common_electron__paths.h
new file mode 100644
index 0000000000..271d2c6517
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_gin__converters_std__converter.h b/electron32/patches/patch-electron_shell_common_gin__converters_std__converter.h
new file mode 100644
index 0000000000..13032488b4
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/common/gin_converters/std_converter.h
+@@ -28,7 +28,7 @@ v8::Local<v8::Value> ConvertToV8(v8::Iso
+ isolate, std::forward<T>(input));
+ }
+
+-#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/electron32/patches/patch-electron_shell_common_node__bindings.cc b/electron32/patches/patch-electron_shell_common_node__bindings.cc
new file mode 100644
index 0000000000..02e278f8ed
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.000000000 +0000
++++ electron/shell/common/node_bindings.cc
+@@ -43,7 +43,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
+
+@@ -157,7 +157,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
+@@ -516,7 +516,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/electron32/patches/patch-electron_shell_common_node__bindings__linux.cc b/electron32/patches/patch-electron_shell_common_node__bindings__linux.cc
new file mode 100644
index 0000000000..4926c11c96
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_common_platform__util.h b/electron32/patches/patch-electron_shell_common_platform__util.h
new file mode 100644
index 0000000000..ffa7463aa8
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc b/electron32/patches/patch-electron_shell_renderer_api_electron__api__crash__reporter__renderer.cc
new file mode 100644
index 0000000000..0f380dae0a
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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/electron32/patches/patch-electron_spec_api-app-spec.ts b/electron32/patches/patch-electron_spec_api-app-spec.ts
new file mode 100644
index 0000000000..9aade65198
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-app-spec.ts
@@ -0,0 +1,147 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-app-spec.ts
+@@ -126,11 +126,13 @@ describe('app module', () => {
+ });
+
+ describe('app.getPreferredSystemLanguages()', () => {
+- ifit(process.platform !== 'linux')('should not be empty', () => {
++ ifit(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && 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 === 'openbsd' || 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 +195,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', 'openbsd', '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 +449,8 @@ describe('app module', () => {
+ // let w = null
+
+ // before(function () {
+- // if (process.platform !== 'linux') {
++ // if (process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ // process.platform !== 'openbsd' && process.platform !== 'netbsd') {
+ // this.skip()
+ // }
+ // })
+@@ -554,7 +557,8 @@ describe('app module', () => {
+ describe('app.badgeCount', () => {
+ const platformIsNotSupported =
+ (process.platform === 'win32') ||
+- (process.platform === 'linux' && !app.isUnityRunning());
++ ((process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd') && !app.isUnityRunning());
+
+ const expectedBadgeCount = 42;
+
+@@ -598,7 +602,10 @@ 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 !== 'openbsd' && 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 +985,8 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('accessibilitySupportEnabled property', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('accessibilitySupportEnabled property', () => {
+ it('with properties', () => {
+ it('can set accessibility support enabled', () => {
+ expect(app.accessibilitySupportEnabled).to.eql(false);
+@@ -1178,7 +1186,8 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('select-client-certificate event', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('select-client-certificate event', () => {
+ let w: BrowserWindow;
+
+ before(function () {
+@@ -1313,7 +1322,9 @@ 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 === 'openbsd' || 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 +1342,8 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('getApplicationInfoForProtocol()', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('getApplicationInfoForProtocol()', () => {
+ it('returns promise rejection for a bogus protocol', async function () {
+ await expect(
+ app.getApplicationInfoForProtocol('bogus-protocol://')
+@@ -1381,7 +1393,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('getFileIcon() API', () => {
+ const iconPath = path.join(__dirname, 'fixtures/assets/icon.ico');
+ const sizes = {
+ small: 16,
+@@ -1463,7 +1476,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') {
+ expect(entry.sandboxed).to.be.a('boolean');
+ }
+
+@@ -1537,7 +1551,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ // For linux and macOS complete info is same as basic info
+ await verifyBasicGPUInfo(completeInfo);
+ const basicInfo = await getGPUInfo('basic');
+@@ -1561,7 +1576,9 @@ describe('app module', () => {
+ });
+ });
+
+- ifdescribe(!(process.platform === 'linux' && (process.arch === 'arm64' || process.arch === 'arm')))('sandbox options', () => {
++ ifdescribe(!((process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || 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/electron32/patches/patch-electron_spec_api-browser-window-spec.ts b/electron32/patches/patch-electron_spec_api-browser-window-spec.ts
new file mode 100644
index 0000000000..795646927f
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-browser-window-spec.ts
@@ -0,0 +1,198 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-browser-window-spec.ts
+@@ -67,7 +67,8 @@ 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 === 'openbsd' || 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');
+@@ -1123,7 +1124,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('should not be visible when the window is minimized', async () => {
+ const minimize = once(w, 'minimize');
+ w.minimize();
+ await minimize;
+@@ -1140,7 +1142,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('should not restore maximized windows', async () => {
+ const maximize = once(w, 'maximize');
+ const shown = once(w, 'show');
+ w.maximize();
+@@ -1205,7 +1208,8 @@ 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 !== 'openbsd' && 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 });
+@@ -1306,7 +1310,8 @@ 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 !== 'openbsd' && 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 });
+@@ -1765,7 +1770,8 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Maximized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('Maximized state', () => {
+ it('checks normal bounds when maximized', async () => {
+ const bounds = w.getBounds();
+ const maximize = once(w, 'maximize');
+@@ -1975,7 +1981,8 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('Minimized state', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('Minimized state', () => {
+ it('checks normal bounds when minimized', async () => {
+ const bounds = w.getBounds();
+ const minimize = once(w, 'minimize');
+@@ -2938,7 +2945,8 @@ 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 !== 'openbsd' && 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);
+@@ -2964,7 +2972,8 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')(('Linux'), () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd')(('Linux'), () => {
+ it('sets 1 regardless of parameter', () => {
+ const w = new BrowserWindow({ show: false });
+ w.setOpacity(0);
+@@ -3175,7 +3184,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3241,7 +3251,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') && !w.isMaximized()) {
+ const maximize = once(w, 'maximize');
+ w.show();
+ w.maximize();
+@@ -3906,7 +3917,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && test.osSandbox) {
+ expect(test.creationTime).to.be.null('creation time');
+ expect(test.systemMemoryInfo).to.be.null('system memory info');
+ } else {
+@@ -4411,7 +4423,8 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('max/minimize events', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('max/minimize events', () => {
+ afterEach(closeAllWindows);
+ it('emits an event when window is maximized', async () => {
+ const w = new BrowserWindow({ show: false });
+@@ -4682,7 +4695,8 @@ 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 === 'openbsd' || 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();
+@@ -4699,7 +4713,8 @@ 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 !== 'openbsd' && 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 });
+@@ -4736,7 +4751,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('should not restore a minimized window', async () => {
+ const w = new BrowserWindow();
+ const minimize = once(w, 'minimize');
+ w.minimize();
+@@ -5210,7 +5226,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('does affect maximizability when disabled and enabled', () => {
+ const w = new BrowserWindow({ show: false });
+ expect(w.resizable).to.be.true('resizable');
+
+@@ -5349,7 +5366,8 @@ describe('BrowserWindow module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('window states (excluding Linux)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('window states (excluding Linux)', () => {
+ // Not implemented on Linux.
+ afterEach(closeAllWindows);
+
+@@ -6516,7 +6534,8 @@ 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 !== 'openbsd' && 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/electron32/patches/patch-electron_spec_api-clipboard-spec.ts b/electron32/patches/patch-electron_spec_api-clipboard-spec.ts
new file mode 100644
index 0000000000..86e45f6fcd
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-clipboard-spec.ts
@@ -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/spec/api-clipboard-spec.ts.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-clipboard-spec.ts
+@@ -54,7 +54,8 @@ ifdescribe(process.platform !== 'win32'
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('clipboard.readBookmark', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('clipboard.readBookmark', () => {
+ it('returns title and url', () => {
+ clipboard.writeBookmark('a title', 'https://electronjs.org');
+
+@@ -73,7 +74,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('does not crash when reading various custom clipboard types', () => {
+ const type = process.platform === 'darwin' ? 'NSFilenamesPboardType' : 'FileNameW';
+
+ expect(() => {
+@@ -114,7 +116,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') {
+ if (process.platform !== 'win32') {
+ expect(clipboard.readBookmark()).to.deep.equal(bookmark);
+ } else {
diff --git a/electron32/patches/patch-electron_spec_api-content-tracing-spec.ts b/electron32/patches/patch-electron_spec_api-content-tracing-spec.ts
new file mode 100644
index 0000000000..7d07292e9c
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-content-tracing-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-content-tracing-spec.ts
+@@ -9,7 +9,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd'))('contentTracing', () => {
+ const record = async (options: TraceConfig | TraceCategoriesAndOptions, outputFilePath: string | undefined, recordTimeInMilliseconds = 1e1) => {
+ await app.whenReady();
+
diff --git a/electron32/patches/patch-electron_spec_api-crash-reporter-spec.ts b/electron32/patches/patch-electron_spec_api-crash-reporter-spec.ts
new file mode 100644
index 0000000000..6b199250d6
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-crash-reporter-spec.ts
@@ -0,0 +1,68 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-crash-reporter-spec.ts
+@@ -14,7 +14,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && process.arch.includes('arm'));
+
+ type CrashInfo = {
+ prod: string
+@@ -47,7 +48,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && process.arch === 'ia32')) {
+ expect(fields.upload_file_minidump.length).to.be.greaterThan(0);
+ }
+ }
+@@ -184,7 +186,8 @@ ifdescribe(!isLinuxOnArm && !process.mas
+
+ // Ensures that passing in crashpadHandlerPID flag for Linx child processes
+ // does not affect child proocess args.
+- ifit(process.platform === 'linux')('ensure linux child process args are not modified', async () => {
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || 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 +536,8 @@ ifdescribe(!isLinuxOnArm && !process.mas
+ }
+ }
+
+- const processList = process.platform === 'linux'
++ const processList = (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd')
+ ? ['main', 'renderer', 'sandboxed-renderer']
+ : ['main', 'renderer', 'sandboxed-renderer', 'node'];
+ for (const crashingProcess of processList) {
+@@ -546,7 +550,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
+@@ -570,7 +575,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ reportsDir = path.join(crashesDir, 'completed');
+ } else if (process.platform === 'win32') {
+ reportsDir = path.join(crashesDir, 'reports');
diff --git a/electron32/patches/patch-electron_spec_api-desktop-capturer-spec.ts b/electron32/patches/patch-electron_spec_api-desktop-capturer-spec.ts
new file mode 100644
index 0000000000..651c26a580
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-desktop-capturer-spec.ts
@@ -0,0 +1,58 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-desktop-capturer-spec.ts
+@@ -45,7 +45,8 @@ 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 !== 'openbsd' && 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 +58,8 @@ 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 !== 'openbsd' && 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);
+@@ -102,7 +104,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -138,7 +141,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && sources.length === 0) {
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
+ }
+@@ -207,7 +211,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') && sources.length === 0) {
+ destroyWindows();
+ it.skip('desktopCapturer.getSources returned an empty source list');
+ return;
diff --git a/electron32/patches/patch-electron_spec_api-menu-spec.ts b/electron32/patches/patch-electron_spec_api-menu-spec.ts
new file mode 100644
index 0000000000..a5d4079308
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-menu-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-menu-spec.ts
+@@ -890,7 +890,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_api-native-image-spec.ts b/electron32/patches/patch-electron_spec_api-native-image-spec.ts
new file mode 100644
index 0000000000..7dc1a700f6
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-native-image-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-native-image-spec.ts
+@@ -428,7 +428,8 @@ describe('nativeImage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform !== 'linux')('createThumbnailFromPath(path, size)', () => {
++ ifdescribe(process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd')('createThumbnailFromPath(path, size)', () => {
+ useRemoteContext({ webPreferences: { contextIsolation: false, nodeIntegration: true } });
+
+ it('throws when invalid size is passed', async () => {
diff --git a/electron32/patches/patch-electron_spec_api-net-log-spec.ts b/electron32/patches/patch-electron_spec_api-net-log-spec.ts
new file mode 100644
index 0000000000..d888acfac9
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-net-log-spec.ts
@@ -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/spec/api-net-log-spec.ts.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-net-log-spec.ts
+@@ -121,7 +121,8 @@ 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 !== 'openbsd' && 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 +135,8 @@ 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 !== 'openbsd' && 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 +152,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('should end logging automatically when only .startLogging() is called', async () => {
+ const appProcess = ChildProcess.spawn(process.execPath,
+ [appPath], {
+ env: {
diff --git a/electron32/patches/patch-electron_spec_api-notification-dbus-spec.ts b/electron32/patches/patch-electron_spec_api-notification-dbus-spec.ts
new file mode 100644
index 0000000000..90886250f8
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-notification-dbus-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-notification-dbus-spec.ts
+@@ -19,7 +19,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') ||
+ process.arch === 'ia32' ||
+ process.arch.indexOf('arm') === 0 ||
+ !process.env.DBUS_SESSION_BUS_ADDRESS;
diff --git a/electron32/patches/patch-electron_spec_api-power-monitor-spec.ts b/electron32/patches/patch-electron_spec_api-power-monitor-spec.ts
new file mode 100644
index 0000000000..872e6e4d63
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-power-monitor-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-power-monitor-spec.ts
+@@ -18,7 +18,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_api-process-spec.ts b/electron32/patches/patch-electron_spec_api-process-spec.ts
new file mode 100644
index 0000000000..6d309e88c5
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-process-spec.ts
@@ -0,0 +1,28 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-process-spec.ts
+@@ -46,7 +46,8 @@ describe('process module', () => {
+ it('resolves promise successfully with valid data', async () => {
+ const memoryInfo = await w.webContents.executeJavaScript('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 === 'openbsd' || process.platform === 'netbsd') {
+ expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0);
+ }
+ expect(memoryInfo.private).to.be.a('number').greaterThan(0);
+@@ -145,7 +146,8 @@ describe('process module', () => {
+ it('resolves promise successfully with valid data', async () => {
+ const memoryInfo = await 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 === 'openbsd' || process.platform === 'netbsd') {
+ expect(memoryInfo.residentSet).to.be.a('number').greaterThan(0);
+ }
+ expect(memoryInfo.private).to.be.a('number').greaterThan(0);
diff --git a/electron32/patches/patch-electron_spec_api-protocol-spec.ts b/electron32/patches/patch-electron_spec_api-protocol-spec.ts
new file mode 100644
index 0000000000..d8328b063a
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-protocol-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-protocol-spec.ts
+@@ -1738,7 +1738,8 @@ 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 !== 'openbsd' && 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/electron32/patches/patch-electron_spec_api-safe-storage-spec.ts b/electron32/patches/patch-electron_spec_api-safe-storage-spec.ts
new file mode 100644
index 0000000000..582de98d22
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-safe-storage-spec.ts
@@ -0,0 +1,28 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-safe-storage-spec.ts
+@@ -29,7 +29,8 @@ describe('safeStorage module', () => {
+
+ describe('safeStorage module', () => {
+ before(() => {
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ });
+@@ -47,7 +48,8 @@ describe('safeStorage module', () => {
+ });
+ });
+
+- ifdescribe(process.platform === 'linux')('SafeStorage.getSelectedStorageBackend()', () => {
++ ifdescribe(process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || process.platform === 'netbsd')('SafeStorage.getSelectedStorageBackend()', () => {
+ it('should return a valid backend', () => {
+ expect(safeStorage.getSelectedStorageBackend()).to.equal('basic_text');
+ });
diff --git a/electron32/patches/patch-electron_spec_api-screen-spec.ts b/electron32/patches/patch-electron_spec_api-screen-spec.ts
new file mode 100644
index 0000000000..e148d35be7
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-screen-spec.ts
@@ -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/spec/api-screen-spec.ts.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-screen-spec.ts
+@@ -95,7 +95,8 @@ describe('screen module', () => {
+
+ const { size } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || 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 +110,8 @@ describe('screen module', () => {
+
+ const { workAreaSize } = display!;
+
+- if (process.platform === 'linux') {
++ if (process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || 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 +127,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_api-shell-spec.ts b/electron32/patches/patch-electron_spec_api-shell-spec.ts
new file mode 100644
index 0000000000..e1877f429b
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-shell-spec.ts
@@ -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/spec/api-shell-spec.ts.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-shell-spec.ts
+@@ -26,7 +26,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ process.env.DE = envVars.de;
+ process.env.BROWSER = envVars.browser;
+ process.env.DISPLAY = envVars.display;
+@@ -42,6 +43,11 @@ 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 === '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/electron32/patches/patch-electron_spec_api-subframe-spec.ts b/electron32/patches/patch-electron_spec_api-subframe-spec.ts
new file mode 100644
index 0000000000..8df5b9c369
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-subframe-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-subframe-spec.ts
+@@ -218,7 +218,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd')('cross-site frame sandboxing', () => {
+ let server: http.Server;
+ let crossSiteUrl: string;
+ let serverUrl: string;
diff --git a/electron32/patches/patch-electron_spec_api-tray-spec.ts b/electron32/patches/patch-electron_spec_api-tray-spec.ts
new file mode 100644
index 0000000000..5f2b280d82
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-tray-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-tray-spec.ts
+@@ -131,7 +131,8 @@ 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 !== 'openbsd' && 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/electron32/patches/patch-electron_spec_api-utility-process-spec.ts b/electron32/patches/patch-electron_spec_api-utility-process-spec.ts
new file mode 100644
index 0000000000..7babc62620
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-utility-process-spec.ts
@@ -0,0 +1,28 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-utility-process-spec.ts
+@@ -438,7 +438,8 @@ 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 !== 'openbsd' && 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');
+@@ -475,7 +476,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_api-web-frame-main-spec.ts b/electron32/patches/patch-electron_spec_api-web-frame-main-spec.ts
new file mode 100644
index 0000000000..7b2631df40
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_api-web-frame-main-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/api-web-frame-main-spec.ts
+@@ -292,7 +292,8 @@ 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 !== 'openbsd' && 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/electron32/patches/patch-electron_spec_chromium-spec.ts b/electron32/patches/patch-electron_spec_chromium-spec.ts
new file mode 100644
index 0000000000..b41213da8a
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_chromium-spec.ts
@@ -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/spec/chromium-spec.ts.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/chromium-spec.ts
+@@ -474,13 +474,17 @@ 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 === 'openbsd' || 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 === 'openbsd' || process.platform === 'netbsd')('should not change LC_ALL', async () => testLocale('fr', lcAll, true));
++ ifit(process.platform === 'linux' || process.platform === 'freebsd' ||
++ process.platform === 'openbsd' || 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 === 'openbsd' || process.platform === 'netbsd')('should not change LC_ALL when --lang is not set', async () => testLocale('', lcAll, true));
+ });
+
+ describe('--remote-debugging-pipe switch', () => {
+@@ -567,7 +571,8 @@ describe('command line switches', () =>
+
+ // Disable the test on linux arm and arm64 to avoid startup crash
+ // https://github.com/electron/electron/issues/44293#issuecomment-2420077154
+- ifit(process.platform !== 'linux' || (process.arch !== 'arm' && process.arch !== 'arm64'))('creates startup trace', async () => {
++ ifit((process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd') || (process.arch !== 'arm' && process.arch !== 'arm64'))('creates startup trace', async () => {
+ const rc = await startRemoteControlApp(['--trace-startup=*', `--trace-startup-file=${outputFilePath}`, '--trace-startup-duration=1', '--enable-logging']);
+ const stderrComplete = new Promise<string>(resolve => {
+ let stderr = '';
+@@ -2917,12 +2922,13 @@ 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') {
+ 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 !== 'openbsd' && process.platform !== 'netbsd')('should fall back to Japanese font for sans-serif Japanese script', async function () {
+ const html = `
+ <html lang="ja-JP">
+ <head>
+@@ -3318,7 +3324,8 @@ describe('navigator.clipboard.write', ()
+ });
+ });
+
+-ifdescribe((process.platform !== 'linux' || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
++ifdescribe(((process.platform !== 'linux' && process.platform !== 'freebsd' &&
++ process.platform !== 'openbsd' && process.platform !== 'netbsd') || app.isUnityRunning()))('navigator.setAppBadge/clearAppBadge', () => {
+ let w: BrowserWindow;
+
+ const expectedBadgeCount = 42;
diff --git a/electron32/patches/patch-electron_spec_crash-spec.ts b/electron32/patches/patch-electron_spec_crash-spec.ts
new file mode 100644
index 0000000000..2ba38ef7ec
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_crash-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/crash-spec.ts
+@@ -47,7 +47,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd') || (process.arch !== 'arm64' && process.arch !== 'arm'));
+ }
+ }
+ default: {
diff --git a/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js b/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.js
new file mode 100644
index 0000000000..eef16edb84
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_decrypt-app_main.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
+
+--- electron/spec/fixtures/api/safe-storage/decrypt-app/main.js.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/fixtures/api/safe-storage/decrypt-app/main.js
+@@ -7,7 +7,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encryptedString = await readFile(pathToEncryptedString);
diff --git a/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js b/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.js
new file mode 100644
index 0000000000..ac36a50620
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_fixtures_api_safe-storage_encrypt-app_main.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
+
+--- electron/spec/fixtures/api/safe-storage/encrypt-app/main.js.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/fixtures/api/safe-storage/encrypt-app/main.js
+@@ -7,7 +7,8 @@ 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 === 'openbsd' || process.platform === 'netbsd') {
+ safeStorage.setUsePlainTextEncryption(true);
+ }
+ const encrypted = safeStorage.encryptString('plaintext');
diff --git a/electron32/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js b/electron32/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.js
new file mode 100644
index 0000000000..29ec26ec15
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_fixtures_crash-cases_safe-storage_index.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
+
+--- electron/spec/fixtures/crash-cases/safe-storage/index.js.orig 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/fixtures/crash-cases/safe-storage/index.js
+@@ -22,7 +22,8 @@ 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 !== 'openbsd' && process.platform !== 'netbsd');
+ if (safeStorage.isEncryptionAvailable()) {
+ const plaintext = 'plaintext';
+ const ciphertext = safeStorage.encryptString(plaintext);
diff --git a/electron32/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js b/electron32/patches/patch-electron_spec_fixtures_native-addon_uv-dlopen_index.js
new file mode 100644
index 0000000000..301844f518
--- /dev/null
+++ b/electron32/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 2024-12-05 00:03:24.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 'openbsd': case 'netbsd':
+ return path.resolve(__dirname, 'build/Release/foo.so');
+ case 'darwin':
+ return path.resolve(__dirname, 'build/Release/foo.dylib');
diff --git a/electron32/patches/patch-electron_spec_node-spec.ts b/electron32/patches/patch-electron_spec_node-spec.ts
new file mode 100644
index 0000000000..e52eb9a724
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_node-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/node-spec.ts
+@@ -148,7 +148,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_version-bump-spec.ts b/electron32/patches/patch-electron_spec_version-bump-spec.ts
new file mode 100644
index 0000000000..ff0b3888c6
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_version-bump-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/version-bump-spec.ts
+@@ -53,7 +53,8 @@ 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 === 'openbsd' || 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/electron32/patches/patch-electron_spec_visibility-state-spec.ts b/electron32/patches/patch-electron_spec_visibility-state-spec.ts
new file mode 100644
index 0000000000..e3c2ee77ef
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_visibility-state-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/visibility-state-spec.ts
+@@ -12,7 +12,8 @@ import { closeWindow } from './lib/windo
+
+ // 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 !== 'openbsd' && process.platform !== 'netbsd')('document.visibilityState', () => {
+ let w: BaseWindow & {webContents: WebContents};
+
+ afterEach(async () => {
diff --git a/electron32/patches/patch-electron_spec_webview-spec.ts b/electron32/patches/patch-electron_spec_webview-spec.ts
new file mode 100644
index 0000000000..03b8fca047
--- /dev/null
+++ b/electron32/patches/patch-electron_spec_webview-spec.ts
@@ -0,0 +1,18 @@
+$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 2024-12-05 00:03:24.000000000 +0000
++++ electron/spec/webview-spec.ts
+@@ -559,7 +559,8 @@ 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 !== 'openbsd' && 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/electron32/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc b/electron32/patches/patch-extensions_browser_api_api__browser__context__keyed__service__factories.cc
new file mode 100644
index 0000000000..39a9900dd3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.592763200 +0000
++++ extensions/browser/api/api_browser_context_keyed_service_factories.cc
+@@ -102,7 +102,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/electron32/patches/patch-extensions_browser_api_management_management__api.cc b/electron32/patches/patch-extensions_browser_api_management_management__api.cc
new file mode 100644
index 0000000000..fe3f2078ad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.684716700 +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/electron32/patches/patch-extensions_browser_api_messaging_message__service.cc b/electron32/patches/patch-extensions_browser_api_messaging_message__service.cc
new file mode 100644
index 0000000000..bbe81d0e09
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.692712800 +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/electron32/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc b/electron32/patches/patch-extensions_browser_api_networking__private_networking__private__delegate__factory.cc
new file mode 100644
index 0000000000..a2a9a16e26
--- /dev/null
+++ b/electron32/patches/patch-extensions_browser_api_networking__private_networking__private__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
+
+--- extensions/browser/api/networking_private/networking_private_delegate_factory.cc.orig 2024-10-18 12:34:17.696710600 +0000
++++ extensions/browser/api/networking_private/networking_private_delegate_factory.cc
+@@ -14,7 +14,7 @@
+ #include "extensions/browser/api/networking_private/networking_private_chromeos.h"
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ #include "extensions/browser/api/networking_private/networking_private_lacros.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"
+@@ -67,7 +67,7 @@ NetworkingPrivateDelegateFactory::BuildS
+ delegate = std::make_unique<NetworkingPrivateChromeOS>(browser_context);
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ delegate = std::make_unique<NetworkingPrivateLacros>(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());
diff --git a/electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc b/electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.cc
new file mode 100644
index 0000000000..87fa6e7a34
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.836640000 +0000
++++ extensions/browser/guest_view/extension_options/extension_options_guest.cc
+@@ -218,8 +218,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) {
+ // This method handles opening links from within the guest. Since this guest
+ // view is used for displaying embedded extension options, we want any
+ // external links to be opened in a new tab, not in a new guest view so we
diff --git a/electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h b/electron32/patches/patch-extensions_browser_guest__view_extension__options_extension__options__guest.h
new file mode 100644
index 0000000000..6e4f2d5656
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.836640000 +0000
++++ extensions/browser/guest_view/extension_options/extension_options_guest.h
+@@ -65,8 +65,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/electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc b/electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.cc
new file mode 100644
index 0000000000..90f8ed1dd7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.840638000 +0000
++++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.cc
+@@ -389,8 +389,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) {
+ return true;
+ }
+
diff --git a/electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h b/electron32/patches/patch-extensions_browser_guest__view_mime__handler__view_mime__handler__view__guest.h
new file mode 100644
index 0000000000..fdf5a0f963
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.840638000 +0000
++++ extensions/browser/guest_view/mime_handler_view/mime_handler_view_guest.h
+@@ -177,8 +177,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/electron32/patches/patch-extensions_browser_script__injection__tracker.cc b/electron32/patches/patch-extensions_browser_script__injection__tracker.cc
new file mode 100644
index 0000000000..88fd199eb2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.876619800 +0000
++++ extensions/browser/script_injection_tracker.cc
+@@ -170,7 +170,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/electron32/patches/patch-extensions_common_api___permission__features.json b/electron32/patches/patch-extensions_common_api___permission__features.json
new file mode 100644
index 0000000000..18906bae9f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.908603700 +0000
++++ extensions/common/api/_permission_features.json
+@@ -138,7 +138,7 @@
+ {
+ "channel": "stable",
+ "extension_types": ["platform_app"],
+- "platforms": ["chromeos", "lacros", "win", "mac", "linux"],
++ "platforms": ["chromeos", "lacros", "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", "lacros", "mac", "win", "linux", "fuchsia"],
++ "platforms": ["chromeos", "lacros", "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/electron32/patches/patch-extensions_common_api_runtime.json b/electron32/patches/patch-extensions_common_api_runtime.json
new file mode 100644
index 0000000000..da37b1a617
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.936589500 +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/electron32/patches/patch-extensions_common_command.cc b/electron32/patches/patch-extensions_common_command.cc
new file mode 100644
index 0000000000..5c1e83ca5b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.944585300 +0000
++++ extensions/common/command.cc
+@@ -285,7 +285,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/electron32/patches/patch-extensions_common_features_feature.cc b/electron32/patches/patch-extensions_common_features_feature.cc
new file mode 100644
index 0000000000..d7071436d6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:17.964575300 +0000
++++ extensions/common/features/feature.cc
+@@ -34,6 +34,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/electron32/patches/patch-extensions_renderer_bindings_api__binding__util.cc b/electron32/patches/patch-extensions_renderer_bindings_api__binding__util.cc
new file mode 100644
index 0000000000..106089d8da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.048533000 +0000
++++ extensions/renderer/bindings/api_binding_util.cc
+@@ -132,7 +132,7 @@ std::string GetPlatformString() {
+ return "lacros";
+ #elif BUILDFLAG(IS_CHROMEOS_ASH) && !BUILDFLAG(IS_CHROMEOS_LACROS)
+ return "chromeos";
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "linux";
+ #elif BUILDFLAG(IS_MAC)
+ return "mac";
diff --git a/electron32/patches/patch-extensions_renderer_bindings_argument__spec.cc b/electron32/patches/patch-extensions_renderer_bindings_argument__spec.cc
new file mode 100644
index 0000000000..3054d503c2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.068523000 +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/electron32/patches/patch-extensions_renderer_script__injection.cc b/electron32/patches/patch-extensions_renderer_script__injection.cc
new file mode 100644
index 0000000000..2242cc883e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.116499000 +0000
++++ extensions/renderer/script_injection.cc
+@@ -318,6 +318,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/electron32/patches/patch-extensions_shell_app_shell__main__delegate.cc b/electron32/patches/patch-extensions_shell_app_shell__main__delegate.cc
new file mode 100644
index 0000000000..63d9565eb8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.120496700 +0000
++++ extensions/shell/app/shell_main_delegate.cc
+@@ -43,7 +43,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"
+@@ -63,7 +63,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/electron32/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc b/electron32/patches/patch-extensions_shell_browser_api_runtime_shell__runtime__api__delegate.cc
new file mode 100644
index 0000000000..0d36bc6dd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.124494800 +0000
++++ extensions/shell/browser/api/runtime/shell_runtime_api_delegate.cc
+@@ -44,7 +44,7 @@ void ShellRuntimeAPIDelegate::OpenURL(co
+ bool ShellRuntimeAPIDelegate::GetPlatformInfo(PlatformInfo* info) {
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ info->os = api::runtime::PlatformOs::kCros;
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_BSD)
+ info->os = api::runtime::PlatformOs::kLinux;
+ #endif
+ return true;
diff --git a/electron32/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc b/electron32/patches/patch-extensions_shell_browser_shell__browser__main__parts.cc
new file mode 100644
index 0000000000..bcd92460bc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.136489000 +0000
++++ extensions/shell/browser/shell_browser_main_parts.cc
+@@ -150,7 +150,7 @@ void ShellBrowserMainParts::PostCreateMa
+ switches::kAppShellAllowRoaming)) {
+ network_controller_->SetCellularAllowRoaming(true);
+ }
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || 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/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc b/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.cc
new file mode 100644
index 0000000000..2e9d1efc88
--- /dev/null
+++ b/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__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
+
+--- extensions/shell/browser/shell_extensions_api_client.cc.orig 2024-10-18 12:34:18.136489000 +0000
++++ extensions/shell/browser/shell_extensions_api_client.cc
+@@ -58,7 +58,7 @@ ShellExtensionsAPIClient::CreateDisplayI
+
+ // 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)
+ FileSystemDelegate* ShellExtensionsAPIClient::GetFileSystemDelegate() {
+ if (!file_system_delegate_)
+ file_system_delegate_ = std::make_unique<ShellFileSystemDelegate>();
diff --git a/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.h b/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__client.h
new file mode 100644
index 0000000000..6b20bc45e7
--- /dev/null
+++ b/electron32/patches/patch-extensions_shell_browser_shell__extensions__api__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
+
+--- extensions/shell/browser/shell_extensions_api_client.h.orig 2024-10-18 12:34:18.136489000 +0000
++++ extensions/shell/browser/shell_extensions_api_client.h
+@@ -36,7 +36,7 @@ class ShellExtensionsAPIClient : public
+ const override;
+ // 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)
+ FileSystemDelegate* GetFileSystemDelegate() override;
+ #endif
+ MessagingDelegate* GetMessagingDelegate() override;
+@@ -45,7 +45,7 @@ class ShellExtensionsAPIClient : public
+ private:
+ // 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::unique_ptr<FileSystemDelegate> file_system_delegate_;
+ #endif
+ std::unique_ptr<MessagingDelegate> messaging_delegate_;
diff --git a/electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc b/electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.cc
new file mode 100644
index 0000000000..5ce5e075d3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.320396400 +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/electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.h b/electron32/patches/patch-fuchsia__web_webengine_browser_frame__impl.h
new file mode 100644
index 0000000000..1dd7ba593c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.320396400 +0000
++++ fuchsia_web/webengine/browser/frame_impl.h
+@@ -306,8 +306,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/electron32/patches/patch-gin_converter.cc b/electron32/patches/patch-gin_converter.cc
new file mode 100644
index 0000000000..518b818f10
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +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/electron32/patches/patch-gin_converter.h b/electron32/patches/patch-gin_converter.h
new file mode 100644
index 0000000000..ac78918550
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +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/electron32/patches/patch-gin_isolate__holder.cc b/electron32/patches/patch-gin_isolate__holder.cc
new file mode 100644
index 0000000000..0368fc2e41
--- /dev/null
+++ b/electron32/patches/patch-gin_isolate__holder.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
+
+--- gin/isolate_holder.cc.orig 2024-10-18 12:34:18.336388300 +0000
++++ gin/isolate_holder.cc
+@@ -75,7 +75,8 @@ IsolateHolder::IsolateHolder(
+ IsolateCreationMode isolate_creation_mode,
+ v8::CreateHistogramCallback create_histogram_callback,
+ v8::AddHistogramSampleCallback add_histogram_sample_callback,
+- scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner)
++ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner,
++ v8::Isolate* isolate)
+ : IsolateHolder(std::move(task_runner),
+ access_mode,
+ isolate_type,
+@@ -84,7 +85,8 @@ IsolateHolder::IsolateHolder(
+ create_histogram_callback,
+ add_histogram_sample_callback),
+ isolate_creation_mode,
+- std::move(low_priority_task_runner)) {}
++ std::move(low_priority_task_runner),
++ isolate) {}
+
+ IsolateHolder::IsolateHolder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+@@ -92,7 +94,8 @@ IsolateHolder::IsolateHolder(
+ IsolateType isolate_type,
+ std::unique_ptr<v8::Isolate::CreateParams> params,
+ IsolateCreationMode isolate_creation_mode,
+- scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner)
++ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner,
++ v8::Isolate* isolate)
+ : access_mode_(access_mode), isolate_type_(isolate_type) {
+ CHECK(Initialized())
+ << "You need to invoke gin::IsolateHolder::Initialize first";
+@@ -103,7 +106,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(low_priority_task_runner));
+@@ -151,9 +154,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;
diff --git a/electron32/patches/patch-gin_object__template__builder.cc b/electron32/patches/patch-gin_object__template__builder.cc
new file mode 100644
index 0000000000..e79b2335a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +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/electron32/patches/patch-gin_object__template__builder.h b/electron32/patches/patch-gin_object__template__builder.h
new file mode 100644
index 0000000000..ee4e051a1e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +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/electron32/patches/patch-gin_public_gin__embedders.h b/electron32/patches/patch-gin_public_gin__embedders.h
new file mode 100644
index 0000000000..24bed7eb66
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +0000
++++ gin/public/gin_embedders.h
+@@ -18,6 +18,8 @@ namespace gin {
+ enum GinEmbedder : uint16_t {
+ kEmbedderNativeGin,
+ kEmbedderBlink,
++ kEmbedderElectron,
++ kEmbedderBlinkTag,
+ kEmbedderPDFium,
+ kEmbedderFuchsia,
+ };
diff --git a/electron32/patches/patch-gin_public_isolate__holder.h b/electron32/patches/patch-gin_public_isolate__holder.h
new file mode 100644
index 0000000000..87ecd87aaa
--- /dev/null
+++ b/electron32/patches/patch-gin_public_isolate__holder.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
+
+--- gin/public/isolate_holder.h.orig 2024-10-18 12:34:18.336388300 +0000
++++ gin/public/isolate_holder.h
+@@ -85,7 +85,8 @@ class GIN_EXPORT IsolateHolder {
+ v8::CreateHistogramCallback create_histogram_callback = nullptr,
+ v8::AddHistogramSampleCallback add_histogram_sample_callback = nullptr,
+ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner =
+- nullptr);
++ nullptr,
++ v8::Isolate* isolate = nullptr);
+ IsolateHolder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner,
+ AccessMode access_mode,
+@@ -93,7 +94,8 @@ class GIN_EXPORT IsolateHolder {
+ std::unique_ptr<v8::Isolate::CreateParams> params,
+ IsolateCreationMode isolate_creation_mode = IsolateCreationMode::kNormal,
+ scoped_refptr<base::SingleThreadTaskRunner> low_priority_task_runner =
+- nullptr);
++ nullptr,
++ v8::Isolate* isolate = nullptr);
+ IsolateHolder(const IsolateHolder&) = delete;
+ IsolateHolder& operator=(const IsolateHolder&) = delete;
+ ~IsolateHolder();
+@@ -113,7 +115,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
diff --git a/electron32/patches/patch-gin_public_v8__platform.h b/electron32/patches/patch-gin_public_v8__platform.h
new file mode 100644
index 0000000000..de2fb40c9c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +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/electron32/patches/patch-gin_v8__initializer.cc b/electron32/patches/patch-gin_v8__initializer.cc
new file mode 100644
index 0000000000..3726b073a5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.336388300 +0000
++++ gin/v8_initializer.cc
+@@ -486,7 +486,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;
+@@ -496,7 +497,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.
+@@ -596,8 +598,7 @@ void V8Initializer::GetV8ExternalSnapsho
+
+ #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
+
+-// static
+-void V8Initializer::LoadV8Snapshot(V8SnapshotFileType snapshot_file_type) {
++void V8Initializer::LoadV8SnapshotFromFileName(base::StringPiece 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.
+@@ -606,11 +607,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/electron32/patches/patch-gin_v8__initializer.h b/electron32/patches/patch-gin_v8__initializer.h
new file mode 100644
index 0000000000..70d8a20a9e
--- /dev/null
+++ b/electron32/patches/patch-gin_v8__initializer.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
+
+--- gin/v8_initializer.h.orig 2024-10-18 12:34:18.336388300 +0000
++++ gin/v8_initializer.h
+@@ -9,6 +9,7 @@
+
+ #include "base/files/file.h"
+ #include "base/files/memory_mapped_file.h"
++#include "base/strings/string_piece.h"
+ #include "build/build_config.h"
+ #include "gin/array_buffer.h"
+ #include "gin/gin_export.h"
+@@ -31,7 +32,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 +43,7 @@ class GIN_EXPORT V8Initializer {
+ int* snapshot_size_out);
+
+ #if defined(V8_USE_EXTERNAL_STARTUP_DATA)
++ static void LoadV8SnapshotFromFileName(base::StringPiece 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/electron32/patches/patch-gin_v8__platform.cc b/electron32/patches/patch-gin_v8__platform.cc
new file mode 100644
index 0000000000..222532aebc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.340386400 +0000
++++ gin/v8_platform.cc
+@@ -205,6 +205,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/electron32/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc b/electron32/patches/patch-google__apis_gcm_engine_heartbeat__manager.cc
new file mode 100644
index 0000000000..0aac040ca4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.412350200 +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/electron32/patches/patch-google__apis_google__api__keys-inc.cc b/electron32/patches/patch-google__apis_google__api__keys-inc.cc
new file mode 100644
index 0000000000..6291b351ca
--- /dev/null
+++ b/electron32/patches/patch-google__apis_google__api__keys-inc.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
+
+--- google_apis/google_api_keys-inc.cc.orig 2024-10-18 12:34:18.412350200 +0000
++++ google_apis/google_api_keys-inc.cc
+@@ -190,14 +190,18 @@ class APIKeyCache {
+ STRINGIZE_NO_EXPANSION(GOOGLE_METRICS_SIGNING_KEY), std::string(),
+ nullptr, std::string(), environment.get(), command_line, gaia_config);
+
++ // https://gitlab.archlinux.org/archlinux/packaging/packages/chromium/-/blob/main/use-oauth2-client-switches-as-default.patch?ref_type=heads
++ // Use the --oauth2-client-id= and --oauth2-client-secret= switches for
++ // setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at
++ // runtime -- this allows signing into Chromium without baked-in values
+ std::string default_client_id = CalculateKeyValue(
+ GOOGLE_DEFAULT_CLIENT_ID,
+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), std::string(),
+- nullptr, std::string(), environment.get(), command_line, gaia_config);
++ ::switches::kOAuth2ClientID, std::string(), environment.get(), command_line, gaia_config);
+ std::string default_client_secret = CalculateKeyValue(
+ GOOGLE_DEFAULT_CLIENT_SECRET,
+ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), std::string(),
+- nullptr, std::string(), environment.get(), command_line, gaia_config);
++ ::switches::kOAuth2ClientSecret, std::string(), environment.get(), command_line, gaia_config);
+
+ // We currently only allow overriding the baked-in values for the
+ // default OAuth2 client ID and secret using a command-line
diff --git a/electron32/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc b/electron32/patches/patch-gpu_command__buffer_service_dawn__context__provider.cc
new file mode 100644
index 0000000000..b119798d85
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.596257700 +0000
++++ gpu/command_buffer/service/dawn_context_provider.cc
+@@ -175,7 +175,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/electron32/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc b/electron32/patches/patch-gpu_command__buffer_service_gles2__cmd__decoder.cc
new file mode 100644
index 0000000000..9cf3e976d5
--- /dev/null
+++ b/electron32/patches/patch-gpu_command__buffer_service_gles2__cmd__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
+
+--- gpu/command_buffer/service/gles2_cmd_decoder.cc.orig 2024-10-18 12:34:18.628241800 +0000
++++ gpu/command_buffer/service/gles2_cmd_decoder.cc
+@@ -2902,7 +2902,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.";
diff --git a/electron32/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc b/electron32/patches/patch-gpu_command__buffer_service_shared__image_angle__vulkan__image__backing__factory.cc
new file mode 100644
index 0000000000..5271feec50
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.740185500 +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/electron32/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc b/electron32/patches/patch-gpu_command__buffer_service_shared__image_external__vk__image__backing.cc
new file mode 100644
index 0000000000..b0b85fce65
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.756177400 +0000
++++ gpu/command_buffer/service/shared_image/external_vk_image_backing.cc
+@@ -54,7 +54,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"
+@@ -734,7 +734,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/electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc b/electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__factory.cc
new file mode 100644
index 0000000000..74ad1f1d36
--- /dev/null
+++ b/electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__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/shared_image_factory.cc.orig 2024-10-18 12:34:18.784163200 +0000
++++ gpu/command_buffer/service/shared_image/shared_image_factory.cc
+@@ -148,7 +148,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;
diff --git a/electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc b/electron32/patches/patch-gpu_command__buffer_service_shared__image_shared__image__manager.cc
new file mode 100644
index 0000000000..617bbac55c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.784163200 +0000
++++ gpu/command_buffer/service/shared_image/shared_image_manager.cc
+@@ -572,7 +572,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)
+ return ui::OzonePlatform::GetInstance()
+ ->GetPlatformRuntimeProperties()
+ .supports_native_pixmaps;
diff --git a/electron32/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc b/electron32/patches/patch-gpu_command__buffer_service_shared__image_wrapped__sk__image__backing.cc
new file mode 100644
index 0000000000..99964abc90
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.796157400 +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/electron32/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc b/electron32/patches/patch-gpu_command__buffer_service_webgpu__decoder__impl.cc
new file mode 100644
index 0000000000..d533b782f7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.820145100 +0000
++++ gpu/command_buffer/service/webgpu_decoder_impl.cc
+@@ -1303,7 +1303,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) {
+@@ -1972,7 +1972,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/electron32/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc b/electron32/patches/patch-gpu_command__buffer_tests_gl__gpu__memory__buffer__unittest.cc
new file mode 100644
index 0000000000..82346ae4b1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.824143200 +0000
++++ gpu/command_buffer/tests/gl_gpu_memory_buffer_unittest.cc
+@@ -27,7 +27,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
+@@ -70,7 +70,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/electron32/patches/patch-gpu_config_gpu__control__list.cc b/electron32/patches/patch-gpu_config_gpu__control__list.cc
new file mode 100644
index 0000000000..ddf35b6217
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.844133100 +0000
++++ gpu/config/gpu_control_list.cc
+@@ -277,7 +277,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;
+@@ -814,7 +814,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/electron32/patches/patch-gpu_config_gpu__finch__features.cc b/electron32/patches/patch-gpu_config_gpu__finch__features.cc
new file mode 100644
index 0000000000..c07c7b0426
--- /dev/null
+++ b/electron32/patches/patch-gpu_config_gpu__finch__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
+
+--- gpu/config/gpu_finch_features.cc.orig 2024-10-18 12:34:18.852129200 +0000
++++ gpu/config/gpu_finch_features.cc
+@@ -157,7 +157,7 @@ const base::FeatureParam<std::string>
+ 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
+@@ -170,7 +170,7 @@ BASE_FEATURE(kCanvasOopRasterization,
+ "CanvasOopRasterization",
+ #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_IOS) || BUILDFLAG(IS_WIN) || \
+ (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64)) || BUILDFLAG(IS_ANDROID) || \
+- BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++ BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron32/patches/patch-gpu_config_gpu__info__collector.cc b/electron32/patches/patch-gpu_config_gpu__info__collector.cc
new file mode 100644
index 0000000000..f39f29389e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.852129200 +0000
++++ gpu/config/gpu_info_collector.cc
+@@ -364,7 +364,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/electron32/patches/patch-gpu_config_gpu__test__config.cc b/electron32/patches/patch-gpu_config_gpu__test__config.cc
new file mode 100644
index 0000000000..07282f288e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.868121100 +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/electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc b/electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.cc
new file mode 100644
index 0000000000..ce0cad0bb6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.892109200 +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
+
+@@ -56,7 +56,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/electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h b/electron32/patches/patch-gpu_ipc_common_gpu__memory__buffer__support.h
new file mode 100644
index 0000000000..dadd900c08
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.892109200 +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/electron32/patches/patch-gpu_ipc_service_BUILD.gn b/electron32/patches/patch-gpu_ipc_service_BUILD.gn
new file mode 100644
index 0000000000..79787b61d8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.904103000 +0000
++++ gpu/ipc/service/BUILD.gn
+@@ -135,6 +135,7 @@ component("service") {
+ "QuartzCore.framework",
+ ]
+ defines += [ "GL_SILENCE_DEPRECATION" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+ if (is_ios) {
+ sources += [ "image_transport_surface_ios.mm" ]
diff --git a/electron32/patches/patch-gpu_ipc_service_gpu__init.cc b/electron32/patches/patch-gpu_ipc_service_gpu__init.cc
new file mode 100644
index 0000000000..e26449fb17
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.908101000 +0000
++++ gpu/ipc/service/gpu_init.cc
+@@ -398,7 +398,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
+@@ -435,7 +435,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.
+@@ -544,7 +544,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
+@@ -626,7 +626,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;
+@@ -777,7 +777,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.
+@@ -832,7 +832,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
+@@ -1022,7 +1022,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
+@@ -1077,7 +1077,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/electron32/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc b/electron32/patches/patch-gpu_ipc_service_gpu__memory__buffer__factory.cc
new file mode 100644
index 0000000000..3665d35a46
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.908101000 +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
+
+@@ -37,7 +37,7 @@ GpuMemoryBufferFactory::CreateNativeType
+ return std::make_unique<GpuMemoryBufferFactoryIOSurface>();
+ #elif BUILDFLAG(IS_ANDROID)
+ return std::make_unique<GpuMemoryBufferFactoryAndroidHardwareBuffer>();
+-#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/electron32/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h b/electron32/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.h
new file mode 100644
index 0000000000..dfd69b5f2a
--- /dev/null
+++ b/electron32/patches/patch-gpu_ipc_service_image__transport__surface__overlay__mac.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
+
+--- gpu/ipc/service/image_transport_surface_overlay_mac.h.orig 2024-10-18 12:34:18.928091000 +0000
++++ gpu/ipc/service/image_transport_surface_overlay_mac.h
+@@ -23,7 +23,9 @@
+ #include "ui/display/types/display_constants.h"
+ #endif
+
++#if !IS_MAS_BUILD()
+ @class CAContext;
++#endif
+ @class CALayer;
+
+ namespace ui {
diff --git a/electron32/patches/patch-gpu_ipc_service_x__util.h b/electron32/patches/patch-gpu_ipc_service_x__util.h
new file mode 100644
index 0000000000..5136222a2d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.928091000 +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/electron32/patches/patch-gpu_vulkan_generate__bindings.py b/electron32/patches/patch-gpu_vulkan_generate__bindings.py
new file mode 100644
index 0000000000..fe58cbf094
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.932088900 +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/electron32/patches/patch-gpu_vulkan_semaphore__handle.cc b/electron32/patches/patch-gpu_vulkan_semaphore__handle.cc
new file mode 100644
index 0000000000..dc876f84a7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.932088900 +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/electron32/patches/patch-gpu_vulkan_vulkan__device__queue.cc b/electron32/patches/patch-gpu_vulkan_vulkan__device__queue.cc
new file mode 100644
index 0000000000..24e80ac381
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.936087000 +0000
++++ gpu/vulkan/vulkan_device_queue.cc
+@@ -149,7 +149,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)) {
+@@ -292,7 +292,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/electron32/patches/patch-gpu_vulkan_vulkan__device__queue.h b/electron32/patches/patch-gpu_vulkan_vulkan__device__queue.h
new file mode 100644
index 0000000000..8454b50a21
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.936087000 +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/electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.cc b/electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.cc
new file mode 100644
index 0000000000..1309b11ea6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.936087000 +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/electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.h b/electron32/patches/patch-gpu_vulkan_vulkan__function__pointers.h
new file mode 100644
index 0000000000..d0b8034131
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.936087000 +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/electron32/patches/patch-gpu_vulkan_vulkan__image.h b/electron32/patches/patch-gpu_vulkan_vulkan__image.h
new file mode 100644
index 0000000000..c64dfd14e2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.936087000 +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/electron32/patches/patch-gpu_vulkan_vulkan__util.cc b/electron32/patches/patch-gpu_vulkan_vulkan__util.cc
new file mode 100644
index 0000000000..77fe2d49bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.952078800 +0000
++++ gpu/vulkan/vulkan_util.cc
+@@ -468,7 +468,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/electron32/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc b/electron32/patches/patch-headless_lib_browser_headless__browser__main__parts__posix.cc
new file mode 100644
index 0000000000..98281ebf60
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.956076900 +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/electron32/patches/patch-headless_lib_browser_headless__content__browser__client.h b/electron32/patches/patch-headless_lib_browser_headless__content__browser__client.h
new file mode 100644
index 0000000000..ffd3c28e81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.956076900 +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/electron32/patches/patch-headless_lib_browser_headless__request__context__manager.cc b/electron32/patches/patch-headless_lib_browser_headless__request__context__manager.cc
new file mode 100644
index 0000000000..d6e19e7150
--- /dev/null
+++ b/electron32/patches/patch-headless_lib_browser_headless__request__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
+
+--- headless/lib/browser/headless_request_context_manager.cc.orig 2024-10-18 12:34:18.956076900 +0000
++++ headless/lib/browser/headless_request_context_manager.cc
+@@ -66,7 +66,7 @@ void SetCryptKeyOnce(const base::FilePat
+ return;
+ done_once = true;
+
+-#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/electron32/patches/patch-headless_lib_browser_headless__web__contents__impl.cc b/electron32/patches/patch-headless_lib_browser_headless__web__contents__impl.cc
new file mode 100644
index 0000000000..2b703e8df8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.956076900 +0000
++++ headless/lib/browser/headless_web_contents_impl.cc
+@@ -62,7 +62,7 @@ namespace headless {
+ 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
+
+@@ -195,8 +195,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/electron32/patches/patch-headless_lib_headless__content__main__delegate.cc b/electron32/patches/patch-headless_lib_headless__content__main__delegate.cc
new file mode 100644
index 0000000000..8ce1ed9b89
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:18.960075000 +0000
++++ headless/lib/headless_content_main_delegate.cc
+@@ -409,7 +409,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/electron32/patches/patch-ipc_ipc__channel.h b/electron32/patches/patch-ipc_ipc__channel.h
new file mode 100644
index 0000000000..2737549fd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.467908600 +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/electron32/patches/patch-ipc_ipc__channel__common.cc b/electron32/patches/patch-ipc_ipc__channel__common.cc
new file mode 100644
index 0000000000..6e4a6f7aaa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.467908600 +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/electron32/patches/patch-ipc_ipc__channel__mojo.cc b/electron32/patches/patch-ipc_ipc__channel__mojo.cc
new file mode 100644
index 0000000000..91401ea843
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.467908600 +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/electron32/patches/patch-ipc_ipc__message__utils.cc b/electron32/patches/patch-ipc_ipc__message__utils.cc
new file mode 100644
index 0000000000..4ec6e86c63
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.479903000 +0000
++++ ipc/ipc_message_utils.cc
+@@ -400,7 +400,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/electron32/patches/patch-ipc_ipc__message__utils.h b/electron32/patches/patch-ipc_ipc__message__utils.h
new file mode 100644
index 0000000000..10218cb613
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.479903000 +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/electron32/patches/patch-media_BUILD.gn b/electron32/patches/patch-media_BUILD.gn
new file mode 100644
index 0000000000..dfcf9bc452
--- /dev/null
+++ b/electron32/patches/patch-media_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
+
+--- media/BUILD.gn.orig 2024-10-18 12:34:27.495895100 +0000
++++ media/BUILD.gn
+@@ -96,6 +96,9 @@ config("media_config") {
+ defines += [ "DLOPEN_PULSEAUDIO" ]
+ }
+ }
++ if (use_sndio) {
++ defines += [ "USE_SNDIO" ]
++ }
+ if (use_cras) {
+ defines += [ "USE_CRAS" ]
+ }
diff --git a/electron32/patches/patch-media_audio_BUILD.gn b/electron32/patches/patch-media_audio_BUILD.gn
new file mode 100644
index 0000000000..0b06e2cc5e
--- /dev/null
+++ b/electron32/patches/patch-media_audio_BUILD.gn
@@ -0,0 +1,42 @@
+$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 2024-10-18 12:34:27.499893400 +0000
++++ media/audio/BUILD.gn
+@@ -199,6 +199,7 @@ source_set("audio") {
+ "CoreMedia.framework",
+ ]
+ weak_frameworks = [ "ScreenCaptureKit.framework" ] # macOS 13.0
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_ios) {
+@@ -270,10 +271,24 @@ 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) {
++ 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_alsa) {
+ libs += [ "asound" ]
+ sources += [
diff --git a/electron32/patches/patch-media_audio_alsa_audio__manager__alsa.cc b/electron32/patches/patch-media_audio_alsa_audio__manager__alsa.cc
new file mode 100644
index 0000000000..e5f601b9df
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.503891500 +0000
++++ media/audio/alsa/audio_manager_alsa.cc
+@@ -95,7 +95,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) {
+@@ -107,7 +109,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,
+@@ -190,7 +194,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;
+ }
+@@ -242,7 +250,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++) {
+@@ -266,7 +276,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/electron32/patches/patch-media_audio_apple_audio__low__latency__input.cc b/electron32/patches/patch-media_audio_apple_audio__low__latency__input.cc
new file mode 100644
index 0000000000..ce1e84622d
--- /dev/null
+++ b/electron32/patches/patch-media_audio_apple_audio__low__latency__input.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/audio/apple/audio_low_latency_input.cc.orig 2024-10-18 12:34:27.511887600 +0000
++++ media/audio/apple/audio_low_latency_input.cc
+@@ -34,19 +34,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/electron32/patches/patch-media_audio_audio__input__device.cc b/electron32/patches/patch-media_audio_audio__input__device.cc
new file mode 100644
index 0000000000..2034cc0ae9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.519883600 +0000
++++ media/audio/audio_input_device.cc
+@@ -264,7 +264,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/electron32/patches/patch-media_audio_audio__output__proxy__unittest.cc b/electron32/patches/patch-media_audio_audio__output__proxy__unittest.cc
new file mode 100644
index 0000000000..636f237c46
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.527880000 +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/electron32/patches/patch-media_audio_mac_audio__manager__mac.cc b/electron32/patches/patch-media_audio_mac_audio__manager__mac.cc
new file mode 100644
index 0000000000..97e763efea
--- /dev/null
+++ b/electron32/patches/patch-media_audio_mac_audio__manager__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
+
+--- media/audio/mac/audio_manager_mac.cc.orig 2024-10-18 12:34:27.535876000 +0000
++++ media/audio/mac/audio_manager_mac.cc
+@@ -971,7 +971,7 @@ AudioParameters AudioManagerMac::GetPref
+
+ void AudioManagerMac::InitializeOnAudioThread() {
+ DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+- InitializeCoreAudioDispatchOverride();
++ // InitializeCoreAudioDispatchOverride();
+ power_observer_ = std::make_unique<AudioPowerObserver>();
+ }
+
diff --git a/electron32/patches/patch-media_audio_pulse_pulse__util.cc b/electron32/patches/patch-media_audio_pulse_pulse__util.cc
new file mode 100644
index 0000000000..839cf42dca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.539874000 +0000
++++ media/audio/pulse/pulse_util.cc
+@@ -45,8 +45,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/electron32/patches/patch-media_audio_sndio_audio__manager__sndio.cc b/electron32/patches/patch-media_audio_sndio_audio__manager__sndio.cc
new file mode 100644
index 0000000000..84aa3f1381
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.274233182 +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/electron32/patches/patch-media_audio_sndio_audio__manager__sndio.h b/electron32/patches/patch-media_audio_sndio_audio__manager__sndio.h
new file mode 100644
index 0000000000..190c3dc953
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.274838842 +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/electron32/patches/patch-media_audio_sndio_sndio__input.cc b/electron32/patches/patch-media_audio_sndio_sndio__input.cc
new file mode 100644
index 0000000000..256dd00b5a
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.275380528 +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/electron32/patches/patch-media_audio_sndio_sndio__input.h b/electron32/patches/patch-media_audio_sndio_sndio__input.h
new file mode 100644
index 0000000000..bba347fdd1
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.275977807 +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/electron32/patches/patch-media_audio_sndio_sndio__output.cc b/electron32/patches/patch-media_audio_sndio_sndio__output.cc
new file mode 100644
index 0000000000..c87a28e0af
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.276484851 +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/electron32/patches/patch-media_audio_sndio_sndio__output.h b/electron32/patches/patch-media_audio_sndio_sndio__output.h
new file mode 100644
index 0000000000..099f70571f
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.277061458 +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/electron32/patches/patch-media_base_audio__latency.cc b/electron32/patches/patch-media_base_audio__latency.cc
new file mode 100644
index 0000000000..51e594dd56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.583853200 +0000
++++ media/base/audio_latency.cc
+@@ -147,7 +147,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/electron32/patches/patch-media_base_libaom__thread__wrapper.cc b/electron32/patches/patch-media_base_libaom__thread__wrapper.cc
new file mode 100644
index 0000000000..3df905f06a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.607841700 +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/electron32/patches/patch-media_base_libvpx__thread__wrapper.cc b/electron32/patches/patch-media_base_libvpx__thread__wrapper.cc
new file mode 100644
index 0000000000..985ce250ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.607841700 +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/electron32/patches/patch-media_base_media__switches.cc b/electron32/patches/patch-media_base_media__switches.cc
new file mode 100644
index 0000000000..d5e5b3533b
--- /dev/null
+++ b/electron32/patches/patch-media_base_media__switches.cc
@@ -0,0 +1,147 @@
+$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 2024-10-18 12:34:27.627832200 +0000
++++ media/base/media_switches.cc
+@@ -21,7 +21,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
+
+@@ -61,7 +61,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.
+@@ -368,8 +368,8 @@ BASE_FEATURE(kMacLoopbackAudioForScreenS
+ "MacLoopbackAudioForScreenShare",
+ 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",
+@@ -379,6 +379,28 @@ 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::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_FREEBSD) || BUILDFLAG(IS_NETBSD)
++ AudioBackend::kAuto,
++#endif
++ &kAudioBackendOptions};
+ #endif // BUILDFLAG(IS_LINUX)
+
+ // When enabled, MediaCapabilities will check with GPU Video Accelerator
+@@ -676,7 +698,7 @@ BASE_FEATURE(kFeatureManagementLiveTrans
+ // 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
+@@ -704,7 +726,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
+@@ -716,7 +738,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
+@@ -745,7 +767,7 @@ BASE_FEATURE(kUnifiedAutoplay,
+ "UnifiedAutoplay",
+ base::FEATURE_ENABLED_BY_DEFAULT);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Enable vaapi video decoding on linux. This is already enabled by default on
+ // chromeos, but needs an experiment on linux.
+ BASE_FEATURE(kVaapiVideoDecodeLinux,
+@@ -836,7 +858,7 @@ BASE_FEATURE(kVaapiVp9SModeHWEncoding,
+ "VaapiVp9SModeHWEncoding",
+ base::FEATURE_ENABLED_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)
+ // Enables the new V4L2StatefulVideoDecoder instead of V4L2VideoDecoder.
+ // Owners: frkoenig%chromium.org@localhost, mcasas%chromium.org@localhost
+ // Expiry: When the |V4L2FlatVideoDecoder| flag handles stateful decoding on
+@@ -963,7 +985,7 @@ BASE_FEATURE(kLiveCaptionUseWaitK,
+ // Live Caption can be used in multiple languages, as opposed to just English.
+ BASE_FEATURE(kLiveCaptionMultiLanguage,
+ "LiveCaptionMultiLanguage",
+-#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
+@@ -993,7 +1015,7 @@ BASE_FEATURE(kLiveCaptionWebAudio,
+ // Live Translate translates captions generated by Live Caption.
+ BASE_FEATURE(kLiveTranslate,
+ "LiveTranslate",
+-#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
+@@ -1468,7 +1490,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,
+@@ -1548,7 +1570,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/electron32/patches/patch-media_base_media__switches.h b/electron32/patches/patch-media_base_media__switches.h
new file mode 100644
index 0000000000..1ea204706f
--- /dev/null
+++ b/electron32/patches/patch-media_base_media__switches.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
+
+--- media/base/media_switches.h.orig 2024-10-18 12:34:27.627832200 +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,25 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kPlatf
+ 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,
++ 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);
+@@ -346,7 +358,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUnifi
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseAndroidOverlayForSecureOnly);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseDecoderStreamForWebRTC);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kUseFakeDeviceForMediaStream);
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinux);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoDecodeLinuxGL);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVideoEncodeLinux);
+@@ -365,7 +377,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapi
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp8TemporalLayerHWEncoding);
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVaapiVp9SModeHWEncoding);
+ #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(kV4L2FlatStatefulVideoDecoder);
+ #endif // BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
+ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoBlitColorAccuracy);
+@@ -510,7 +522,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/electron32/patches/patch-media_base_user__input__monitor__unittest.cc b/electron32/patches/patch-media_base_user__input__monitor__unittest.cc
new file mode 100644
index 0000000000..d875e5b1d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.655818700 +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/electron32/patches/patch-media_base_video__frame.cc b/electron32/patches/patch-media_base_video__frame.cc
new file mode 100644
index 0000000000..883c0ebe7c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.659816700 +0000
++++ media/base/video_frame.cc
+@@ -83,7 +83,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
+@@ -98,7 +98,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 &&
+@@ -396,7 +396,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)
+@@ -817,7 +817,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,
+@@ -1528,7 +1528,7 @@ scoped_refptr<gpu::ClientSharedImage> Vi
+ : shared_images_[texture_index];
+ }
+
+-#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/electron32/patches/patch-media_base_video__frame.h b/electron32/patches/patch-media_base_video__frame.h
new file mode 100644
index 0000000000..814763b7c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.659816700 +0000
++++ media/base/video_frame.h
+@@ -45,7 +45,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)
+
+@@ -111,7 +111,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
+@@ -402,7 +402,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
+@@ -721,7 +721,7 @@ class MEDIA_EXPORT VideoFrame : public b
+ scoped_refptr<gpu::ClientSharedImage> shared_image(
+ size_t texture_index) 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.
+@@ -963,7 +963,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/electron32/patches/patch-media_capture_video__capture__types.h b/electron32/patches/patch-media_capture_video__capture__types.h
new file mode 100644
index 0000000000..374c0a97a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.819740300 +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/electron32/patches/patch-media_capture_video_create__video__capture__device__factory.cc b/electron32/patches/patch-media_capture_video_create__video__capture__device__factory.cc
new file mode 100644
index 0000000000..0f87671757
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.759769000 +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/electron32/patches/patch-media_capture_video_fake__video__capture__device__factory.cc b/electron32/patches/patch-media_capture_video_fake__video__capture__device__factory.cc
new file mode 100644
index 0000000000..4d6b1d9bb7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.759769000 +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/electron32/patches/patch-media_capture_video_file__video__capture__device__factory.cc b/electron32/patches/patch-media_capture_video_file__video__capture__device__factory.cc
new file mode 100644
index 0000000000..30de43c94e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.763767000 +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/electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc b/electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.cc
new file mode 100644
index 0000000000..6f30b6bd15
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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/electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.h b/electron32/patches/patch-media_capture_video_linux_fake__v4l2__impl.h
new file mode 100644
index 0000000000..9354eda8df
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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/electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc b/electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.cc
new file mode 100644
index 0000000000..7914aa1df0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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>
+@@ -27,17 +29,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.
+@@ -47,6 +51,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 {
+@@ -264,7 +276,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
+@@ -320,7 +332,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)
+ }
+@@ -447,7 +459,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>(
+ std::move(gmb_support_test_));
+@@ -797,7 +809,7 @@ void V4L2CaptureDelegate::SetGPUEnvironm
+
+ 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) {
+@@ -807,7 +819,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));
+ }
+
+@@ -818,6 +830,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,
+@@ -845,6 +858,7 @@ void V4L2CaptureDelegate::ReplaceControl
+ << ", {type = V4L2_EVENT_CTRL, id = " << control_id << "}";
+ }
+ }
++#endif
+ }
+
+ mojom::RangePtr V4L2CaptureDelegate::RetrieveUserControlRange(int control_id) {
+@@ -1025,7 +1039,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));
+@@ -1045,6 +1063,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;
+@@ -1052,6 +1076,7 @@ void V4L2CaptureDelegate::DoCapture() {
+ FROM_HERE,
+ base::BindOnce(&V4L2CaptureDelegate::DoCapture, GetWeakPtr()));
+ return;
++#endif
+ } else if (timeout_count_ >= kContinuousTimeoutLimit) {
+ SetErrorState(
+ VideoCaptureError::kV4L2MultipleContinuousTimeoutsWhileReadPolling,
+@@ -1063,6 +1088,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;
+@@ -1098,6 +1124,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) {
+@@ -1151,7 +1178,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(),
+@@ -1224,7 +1251,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/electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h b/electron32/patches/patch-media_capture_video_linux_v4l2__capture__delegate.h
new file mode 100644
index 0000000000..a6b5095665
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +0000
++++ media/capture/video/linux/v4l2_capture_delegate.h
+@@ -23,7 +23,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>
+@@ -35,7 +35,7 @@ class Location;
+
+ namespace media {
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class V4L2CaptureDelegateGpuHelper;
+ #endif // BUILDFLAG(IS_LINUX)
+
+@@ -86,7 +86,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);
+
+ void SetGPUEnvironmentForTesting(
+ std::unique_ptr<gpu::GpuMemoryBufferSupport> gmb_support);
+@@ -100,10 +100,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);
+@@ -133,7 +133,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
+@@ -167,7 +167,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/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device.h b/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device.h
new file mode 100644
index 0000000000..741c615acb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc b/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.cc
new file mode 100644
index 0000000000..cf1e6cbc18
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h b/electron32/patches/patch-media_capture_video_linux_v4l2__capture__device__impl.h
new file mode 100644
index 0000000000..b9e0f47b73
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.779759400 +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/electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc b/electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.cc
new file mode 100644
index 0000000000..99b2859d3d
--- /dev/null
+++ b/electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.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
+
+--- media/capture/video/linux/video_capture_device_factory_v4l2.cc.orig 2024-10-18 12:34:27.783757400 +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,15 @@ 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)
++ target_container->emplace_back("/dev/video");
++#else
+ const base::FilePath path("/dev/");
+ base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES,
+ "video*");
+@@ -82,9 +87,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 +110,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 +127,7 @@ class DevVideoFilePathsDeviceProvider
+ return std::string();
+ }
+ return display_name;
++#endif
+ }
+ };
+
+@@ -219,7 +233,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 +293,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/electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h b/electron32/patches/patch-media_capture_video_linux_video__capture__device__factory__v4l2.h
new file mode 100644
index 0000000000..35a3c408be
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.783757400 +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/electron32/patches/patch-media_capture_video_linux_video__capture__device__linux.cc b/electron32/patches/patch-media_capture_video_linux_video__capture__device__linux.cc
new file mode 100644
index 0000000000..878ca3e6da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.783757400 +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/electron32/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc b/electron32/patches/patch-media_capture_video_video__capture__buffer__tracker__factory__impl.cc
new file mode 100644
index 0000000000..26f739f081
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.791753500 +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/electron32/patches/patch-media_capture_video_video__capture__device__client.cc b/electron32/patches/patch-media_capture_video_video__capture__device__client.cc
new file mode 100644
index 0000000000..2ec1e0db01
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.791753500 +0000
++++ media/capture/video/video_capture_device_client.cc
+@@ -164,7 +164,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/electron32/patches/patch-media_cdm_cdm__paths__unittest.cc b/electron32/patches/patch-media_cdm_cdm__paths__unittest.cc
new file mode 100644
index 0000000000..81c856eb81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.871715300 +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/electron32/patches/patch-media_cdm_library__cdm_cdm__paths.gni b/electron32/patches/patch-media_cdm_library__cdm_cdm__paths.gni
new file mode 100644
index 0000000000..2bba8dbbd7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.875713300 +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/electron32/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py b/electron32/patches/patch-media_ffmpeg_scripts_build__ffmpeg.py
new file mode 100644
index 0000000000..d2b6025977
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.903700000 +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/electron32/patches/patch-media_ffmpeg_scripts_robo__lib_config.py b/electron32/patches/patch-media_ffmpeg_scripts_robo__lib_config.py
new file mode 100644
index 0000000000..42d61e4336
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:27.907698200 +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/electron32/patches/patch-media_gpu_buffer__validation.cc b/electron32/patches/patch-media_gpu_buffer__validation.cc
new file mode 100644
index 0000000000..e5574df091
--- /dev/null
+++ b/electron32/patches/patch-media_gpu_buffer__validation.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
+
+--- media/gpu/buffer_validation.cc.orig 2024-10-18 12:34:28.091610400 +0000
++++ media/gpu/buffer_validation.cc
+@@ -16,7 +16,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 <drm_fourcc.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+@@ -29,7 +29,7 @@
+ namespace media {
+
+ namespace {
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #ifndef I915_FORMAT_MOD_4_TILED_MTL_MC_CCS
+ // TODO(b/271455200): Remove this definition once drm_fourcc.h contains it.
+ /*
+@@ -55,7 +55,7 @@ bool IsIntelMediaCompressedModifier(uint
+ } // namespace
+
+ 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;
+@@ -109,14 +109,14 @@ 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 uint64_t modifier = gmb_handle.native_pixmap_handle.modifier;
+ const bool is_intel_media_compressed_buffer =
+ IsIntelMediaCompressedModifier(modifier);
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+
diff --git a/electron32/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc b/electron32/patches/patch-media_gpu_chromeos_gl__image__processor__backend.cc
new file mode 100644
index 0000000000..cdc9ba25e0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.091610400 +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/electron32/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc b/electron32/patches/patch-media_gpu_chromeos_libyuv__image__processor__backend.cc
new file mode 100644
index 0000000000..3cf850ae64
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.091610400 +0000
++++ media/gpu/chromeos/libyuv_image_processor_backend.cc
+@@ -48,7 +48,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),
+@@ -415,7 +415,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)
+@@ -577,7 +577,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/electron32/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc b/electron32/patches/patch-media_gpu_chromeos_mailbox__video__frame__converter.cc
new file mode 100644
index 0000000000..383456b43d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.091610400 +0000
++++ media/gpu/chromeos/mailbox_video_frame_converter.cc
+@@ -67,7 +67,7 @@ viz::SharedImageFormat GetSharedImageFor
+ << static_cast<int>(buffer_format);
+ NOTREACHED_NORETURN();
+ }
+-#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/electron32/patches/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc b/electron32/patches/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc
new file mode 100644
index 0000000000..1afc214a08
--- /dev/null
+++ b/electron32/patches/patch-media_gpu_chromeos_native__pixmap__frame__resource.cc
@@ -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/native_pixmap_frame_resource.cc.orig 2024-10-18 12:34:28.091610400 +0000
++++ media/gpu/chromeos/native_pixmap_frame_resource.cc
+@@ -176,7 +176,7 @@ scoped_refptr<NativePixmapFrameResource>
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+ CHECK(!is_intel_media_compressed_buffer ||
diff --git a/electron32/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc b/electron32/patches/patch-media_gpu_chromeos_platform__video__frame__utils.cc
new file mode 100644
index 0000000000..22ae8fee0f
--- /dev/null
+++ b/electron32/patches/patch-media_gpu_chromeos_platform__video__frame__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
+
+--- media/gpu/chromeos/platform_video_frame_utils.cc.orig 2024-10-18 12:34:28.107602600 +0000
++++ media/gpu/chromeos/platform_video_frame_utils.cc
+@@ -68,7 +68,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
+@@ -196,7 +196,7 @@ class GbmDeviceWrapper {
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+ if (is_intel_media_compression_enabled) {
+@@ -350,7 +350,7 @@ scoped_refptr<VideoFrame> CreateVideoFra
+ const bool is_intel_media_compression_enabled =
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FeatureList::IsEnabled(features::kEnableIntelMediaCompression);
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ false;
+ #endif
+
diff --git a/electron32/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc b/electron32/patches/patch-media_gpu_chromeos_video__decoder__pipeline.cc
new file mode 100644
index 0000000000..6888c32e33
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.107602600 +0000
++++ media/gpu/chromeos/video_decoder_pipeline.cc
+@@ -1096,7 +1096,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());
+@@ -1105,7 +1105,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
+@@ -1287,7 +1287,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/electron32/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc b/electron32/patches/patch-media_gpu_gpu__video__encode__accelerator__factory.cc
new file mode 100644
index 0000000000..066a1e10c1
--- /dev/null
+++ b/electron32/patches/patch-media_gpu_gpu__video__encode__accelerator__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/gpu/gpu_video_encode_accelerator_factory.cc.orig 2024-10-18 12:34:28.107602600 +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(kVaapiVideoEncodeLinux))
+ vea_factory_functions.push_back(base::BindRepeating(&CreateVaapiVEA));
+ #else
diff --git a/electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc b/electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..2755b895ce
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.139587400 +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) {
+@@ -176,6 +179,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ NOTREACHED_NORETURN();
+ #endif // BUILDFLAG(USE_V4L2_CODEC)
+ }
++#endif
+
+ } // namespace
+
+@@ -191,6 +195,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ // (at least).
+ bool HardwareVideoDecodingPreSandboxHook(
+ sandbox::policy::SandboxLinux::Options options) {
++#if !BUILDFLAG(IS_BSD)
+ using HardwareVideoDecodingProcessPolicy =
+ sandbox::policy::HardwareVideoDecodingProcessPolicy;
+ using PolicyType =
+@@ -236,6 +241,7 @@ bool HardwareVideoDecodingPreSandboxHook
+ // |permissions| is empty?
+ sandbox::policy::SandboxLinux::GetInstance()->StartBrokerProcess(
+ command_set, permissions, options);
++#endif
+ return true;
+ }
+
diff --git a/electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h b/electron32/patches/patch-media_gpu_sandbox_hardware__video__decoding__sandbox__hook__linux.h
new file mode 100644
index 0000000000..2ca614f3f4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.139587400 +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/electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc b/electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..e698533be8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.139587400 +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;
+
+@@ -121,6 +124,7 @@ bool HardwareVideoEncodingPreSandboxHook
+ }
+ }
+ #endif
++#endif
+ return true;
+ }
+
diff --git a/electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h b/electron32/patches/patch-media_gpu_sandbox_hardware__video__encoding__sandbox__hook__linux.h
new file mode 100644
index 0000000000..00fca6d541
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.139587400 +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/electron32/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc b/electron32/patches/patch-media_gpu_vaapi_vaapi__video__decoder.cc
new file mode 100644
index 0000000000..c0ff7e35bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.227545500 +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/electron32/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc b/electron32/patches/patch-media_gpu_vaapi_vaapi__wrapper.cc
new file mode 100644
index 0000000000..cd9ed95643
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.231543800 +0000
++++ media/gpu/vaapi/vaapi_wrapper.cc
+@@ -72,7 +72,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/electron32/patches/patch-media_media__options.gni b/electron32/patches/patch-media_media__options.gni
new file mode 100644
index 0000000000..c86f10a1df
--- /dev/null
+++ b/electron32/patches/patch-media_media__options.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
+
+--- media/media_options.gni.orig 2024-10-18 12:34:28.271524700 +0000
++++ media/media_options.gni
+@@ -190,12 +190,15 @@ declare_args() {
+ # Enables runtime selection of ALSA library for audio.
+ use_alsa = false
+
++ # Enable runtime selection of sndio(7)
++ use_sndio = 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/electron32/patches/patch-media_mojo_mojom_stable_BUILD.gn b/electron32/patches/patch-media_mojo_mojom_stable_BUILD.gn
new file mode 100644
index 0000000000..5fb5ab1a3f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.315503600 +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/electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc b/electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.cc
new file mode 100644
index 0000000000..9eedb22e2d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.319501900 +0000
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.cc
+@@ -837,7 +837,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,
+@@ -858,7 +858,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/electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h b/electron32/patches/patch-media_mojo_mojom_stable_stable__video__decoder__types__mojom__traits.h
new file mode 100644
index 0000000000..143f1c4208
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.319501900 +0000
++++ media/mojo/mojom/stable/stable_video_decoder_types_mojom_traits.h
+@@ -690,7 +690,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/electron32/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc b/electron32/patches/patch-media_mojo_mojom_video__frame__mojom__traits.cc
new file mode 100644
index 0000000000..9130e81616
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:28.331496000 +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/electron32/patches/patch-media_video_fake__gpu__memory__buffer.cc b/electron32/patches/patch-media_video_fake__gpu__memory__buffer.cc
new file mode 100644
index 0000000000..f807298b97
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.382996300 +0000
++++ media/video/fake_gpu_memory_buffer.cc
+@@ -9,7 +9,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>
+@@ -52,7 +52,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());
+@@ -82,7 +82,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_);
+@@ -144,7 +144,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/electron32/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc b/electron32/patches/patch-media_video_gpu__memory__buffer__video__frame__pool.cc
new file mode 100644
index 0000000000..7f38702d1d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.382996300 +0000
++++ media/video/gpu_memory_buffer_video_frame_pool.cc
+@@ -106,7 +106,7 @@ class GpuMemoryBufferVideoFramePool::Poo
+ gpu::SHARED_IMAGE_USAGE_RASTER_READ |
+ gpu::SHARED_IMAGE_USAGE_DISPLAY_READ |
+ gpu::SHARED_IMAGE_USAGE_SCANOUT;
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ // TODO(crbug.com/40194712): Always add the flag once the
+ // OzoneImageBacking is by default turned on.
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+@@ -795,7 +795,7 @@ void GpuMemoryBufferVideoFramePool::Pool
+ }
+
+ bool is_software_backed_video_frame = !video_frame->HasTextures();
+-#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
+
+@@ -1340,7 +1340,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
diff --git a/electron32/patches/patch-media_video_video__encode__accelerator__adapter.cc b/electron32/patches/patch-media_video_video__encode__accelerator__adapter.cc
new file mode 100644
index 0000000000..e4907a68e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.390992600 +0000
++++ media/video/video_encode_accelerator_adapter.cc
+@@ -158,7 +158,7 @@ VideoEncodeAccelerator::Config SetUpVeaC
+ if (is_rgb)
+ 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
+@@ -484,7 +484,7 @@ void VideoEncodeAcceleratorAdapter::Init
+ SetUpVeaConfig(profile_, options_, format, first_frame->storage_type(),
+ supported_rc_modes_, required_encoder_type_);
+
+-#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/electron32/patches/patch-media_video_video__encode__accelerator__adapter__test.cc b/electron32/patches/patch-media_video_video__encode__accelerator__adapter__test.cc
new file mode 100644
index 0000000000..2304898da2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.394990700 +0000
++++ media/video/video_encode_accelerator_adapter_test.cc
+@@ -457,7 +457,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/electron32/patches/patch-media_webrtc_audio__processor.cc b/electron32/patches/patch-media_webrtc_audio__processor.cc
new file mode 100644
index 0000000000..3181e279e1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.394990700 +0000
++++ media/webrtc/audio_processor.cc
+@@ -513,7 +513,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/electron32/patches/patch-media_webrtc_helpers.cc b/electron32/patches/patch-media_webrtc_helpers.cc
new file mode 100644
index 0000000000..445fa8f265
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.394990700 +0000
++++ media/webrtc/helpers.cc
+@@ -41,14 +41,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/electron32/patches/patch-media_webrtc_helpers__unittests.cc b/electron32/patches/patch-media_webrtc_helpers__unittests.cc
new file mode 100644
index 0000000000..67a3f8a894
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.398988700 +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/electron32/patches/patch-mojo_core_BUILD.gn b/electron32/patches/patch-mojo_core_BUILD.gn
new file mode 100644
index 0000000000..7fa6ef2d6e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.398988700 +0000
++++ mojo/core/BUILD.gn
+@@ -166,7 +166,7 @@ template("core_impl_source_set") {
+ ]
+ }
+
+- 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/electron32/patches/patch-mojo_core_channel.cc b/electron32/patches/patch-mojo_core_channel.cc
new file mode 100644
index 0000000000..20a3f6048a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.398988700 +0000
++++ mojo/core/channel.cc
+@@ -79,7 +79,11 @@ const size_t kMaxUnusedReadBufferCapacit
+ // Fuchsia: The zx_channel_write() API supports up to 64 handles.
+ const size_t kMaxAttachedHandles = 64;
+
++#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/electron32/patches/patch-mojo_core_embedder_features.h b/electron32/patches/patch-mojo_core_embedder_features.h
new file mode 100644
index 0000000000..6f755df9b5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.406985000 +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/electron32/patches/patch-mojo_public_c_system_thunks.cc b/electron32/patches/patch-mojo_public_c_system_thunks.cc
new file mode 100644
index 0000000000..94dbe67287
--- /dev/null
+++ b/electron32/patches/patch-mojo_public_c_system_thunks.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
+
+--- mojo/public/c/system/thunks.cc.orig 2024-10-18 12:34:29.418979200 +0000
++++ mojo/public/c/system/thunks.cc
+@@ -30,7 +30,7 @@
+ #include "mojo/public/c/system/message_pipe.h"
+
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ #include "base/environment.h"
+ #include "base/files/file_path.h"
+ #include "base/scoped_native_library.h"
+@@ -77,7 +77,7 @@ class CoreLibraryInitializer {
+
+ MojoResult LoadLibrary(base::FilePath library_path) {
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ if (library_ && library_->is_valid())
+ return MOJO_RESULT_OK;
+
+@@ -91,7 +91,7 @@ class CoreLibraryInitializer {
+
+ if (library_path.empty()) {
+ // Default to looking for the library in the current working directory.
+-#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const base::FilePath::CharType kDefaultLibraryPathValue[] =
+ FILE_PATH_LITERAL("./libmojo_core.so");
+ #elif BUILDFLAG(IS_FUCHSIA)
+@@ -147,7 +147,7 @@ class CoreLibraryInitializer {
+
+ private:
+ #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || \
+- BUILDFLAG(IS_FUCHSIA)
++ BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ std::optional<base::ScopedNativeLibrary> library_;
+ #endif
+ };
diff --git a/electron32/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc b/electron32/patches/patch-mojo_public_cpp_platform_socket__utils__posix.cc
new file mode 100644
index 0000000000..d94385e5f3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.466956600 +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/electron32/patches/patch-mojo_public_tools_bindings_mojom.gni b/electron32/patches/patch-mojo_public_tools_bindings_mojom.gni
new file mode 100644
index 0000000000..6626ced7e0
--- /dev/null
+++ b/electron32/patches/patch-mojo_public_tools_bindings_mojom.gni
@@ -0,0 +1,30 @@
+$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 2024-10-18 12:34:29.514933800 +0000
++++ mojo/public/tools/bindings/mojom.gni
+@@ -763,6 +763,21 @@ 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_freebsd) {
++ enabled_features += [ "is_freebsd" ]
++ enabled_features += [ "is_bsd" ]
++ }
++
+ action(parser_target_name) {
+ allow_remote = true
+
diff --git a/electron32/patches/patch-net_BUILD.gn b/electron32/patches/patch-net_BUILD.gn
new file mode 100644
index 0000000000..fad3af9560
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:29.998704700 +0000
++++ net/BUILD.gn
+@@ -123,7 +123,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" ]
+ }
+
+@@ -1246,6 +1246,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",
+@@ -1407,7 +1420,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",
+@@ -2072,7 +2085,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",
+@@ -2876,14 +2889,14 @@ test("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",
+@@ -2974,6 +2987,10 @@ test("net_unittests") {
+ ]
+ }
+
++ if (is_bsd) {
++ deps += [ "//sandbox/policy" ]
++ }
++
+ if (enable_websockets) {
+ deps += [ "//net/server:tests" ]
+ }
+@@ -3034,7 +3051,7 @@ test("net_unittests") {
+ ]
+ }
+
+- if (is_linux || is_chromeos) {
++ if ((is_linux || is_chromeos) && !is_bsd) {
+ sources += [ "tools/quic/quic_simple_server_test.cc" ]
+ }
+
+@@ -3173,7 +3190,7 @@ test("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/electron32/patches/patch-net_base_features.cc b/electron32/patches/patch-net_base_features.cc
new file mode 100644
index 0000000000..e7921afec0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.006700800 +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
+@@ -506,7 +506,12 @@ BASE_FEATURE(kSpdyHeadersToHttpResponseU
+ "SpdyHeadersToHttpResponseUseBuilder",
+ base::FEATURE_DISABLED_BY_DEFAULT);
+
++#if BUILDFLAG(IS_OPENBSD)
++// 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/electron32/patches/patch-net_base_mock__network__change__notifier.cc b/electron32/patches/patch-net_base_mock__network__change__notifier.cc
new file mode 100644
index 0000000000..e35b6df962
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.010699000 +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/electron32/patches/patch-net_base_mock__network__change__notifier.h b/electron32/patches/patch-net_base_mock__network__change__notifier.h
new file mode 100644
index 0000000000..821dbfe90c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.010699000 +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/electron32/patches/patch-net_base_network__change__notifier.cc b/electron32/patches/patch-net_base_network__change__notifier.cc
new file mode 100644
index 0000000000..617c623509
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.010699000 +0000
++++ net/base/network_change_notifier.cc
+@@ -42,7 +42,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"
+@@ -329,6 +329,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 @@ const char* NetworkChangeNotifier::Conne
+ 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/electron32/patches/patch-net_base_network__change__notifier.h b/electron32/patches/patch-net_base_network__change__notifier.h
new file mode 100644
index 0000000000..c6fae7c599
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.010699000 +0000
++++ net/base/network_change_notifier.h
+@@ -18,7 +18,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
+
+@@ -459,7 +459,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
+@@ -629,7 +629,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/electron32/patches/patch-net_base_network__change__notifier__passive.cc b/electron32/patches/patch-net_base_network__change__notifier__passive.cc
new file mode 100644
index 0000000000..29ec4b12f5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.010699000 +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/electron32/patches/patch-net_base_network__interfaces__posix.h b/electron32/patches/patch-net_base_network__interfaces__posix.h
new file mode 100644
index 0000000000..e88332223e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.014697000 +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/electron32/patches/patch-net_base_sockaddr__util__posix.cc b/electron32/patches/patch-net_base_sockaddr__util__posix.cc
new file mode 100644
index 0000000000..defb060ccf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.018695000 +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/electron32/patches/patch-net_base_sockaddr__util__posix__unittest.cc b/electron32/patches/patch-net_base_sockaddr__util__posix__unittest.cc
new file mode 100644
index 0000000000..088a337e9c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.018695000 +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/electron32/patches/patch-net_cert_cert__verify__proc.h b/electron32/patches/patch-net_cert_cert__verify__proc.h
new file mode 100644
index 0000000000..a08d2f1301
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.018695000 +0000
++++ net/cert/cert_verify_proc.h
+@@ -176,7 +176,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/electron32/patches/patch-net_disk__cache_simple_simple__file__tracker.cc b/electron32/patches/patch-net_disk__cache_simple_simple__file__tracker.cc
new file mode 100644
index 0000000000..a9913b7d4a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.266578400 +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/electron32/patches/patch-net_dns_BUILD.gn b/electron32/patches/patch-net_dns_BUILD.gn
new file mode 100644
index 0000000000..a4d267037a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.266578400 +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",
+ ]
++
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ # 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/electron32/patches/patch-net_dns_address__info.cc b/electron32/patches/patch-net_dns_address__info.cc
new file mode 100644
index 0000000000..80dd87ca05
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.266578400 +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/electron32/patches/patch-net_dns_address__sorter__posix.cc b/electron32/patches/patch-net_dns_address__sorter__posix.cc
new file mode 100644
index 0000000000..c337861f92
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.266578400 +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/electron32/patches/patch-net_dns_dns__config__service__posix.cc b/electron32/patches/patch-net_dns_dns__config__service__posix.cc
new file mode 100644
index 0000000000..1935a1242c
--- /dev/null
+++ b/electron32/patches/patch-net_dns_dns__config__service__posix.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
+
+--- net/dns/dns_config_service_posix.cc.orig 2024-10-18 12:34:30.270576500 +0000
++++ net/dns/dns_config_service_posix.cc
+@@ -39,6 +39,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 +141,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 +164,7 @@ class DnsConfigServicePosix::Watcher : p
+ success = false;
+ }
+ #endif // !BUILDFLAG(IS_IOS)
++#endif
+ return success;
+ }
+
diff --git a/electron32/patches/patch-net_dns_dns__reloader.cc b/electron32/patches/patch-net_dns_dns__reloader.cc
new file mode 100644
index 0000000000..53f5535655
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.270576500 +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/electron32/patches/patch-net_dns_dns__util.cc b/electron32/patches/patch-net_dns_dns__util.cc
new file mode 100644
index 0000000000..1b6c320134
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.270576500 +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/electron32/patches/patch-net_dns_host__resolver__proc.cc b/electron32/patches/patch-net_dns_host__resolver__proc.cc
new file mode 100644
index 0000000000..42e6876b73
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_dns_public_BUILD.gn b/electron32/patches/patch-net_dns_public_BUILD.gn
new file mode 100644
index 0000000000..8994aa962e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_dns_public_resolv__reader.cc b/electron32/patches/patch-net_dns_public_resolv__reader.cc
new file mode 100644
index 0000000000..cfd21c0cc4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_dns_public_resolv__reader.h b/electron32/patches/patch-net_dns_public_resolv__reader.h
new file mode 100644
index 0000000000..11a50ad161
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_dns_public_scoped__res__state.cc b/electron32/patches/patch-net_dns_public_scoped__res__state.cc
new file mode 100644
index 0000000000..5a8b56af77
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_dns_public_scoped__res__state.h b/electron32/patches/patch-net_dns_public_scoped__res__state.h
new file mode 100644
index 0000000000..d5d7f4f27a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.278572800 +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/electron32/patches/patch-net_filter_zstd__source__stream.cc b/electron32/patches/patch-net_filter_zstd__source__stream.cc
new file mode 100644
index 0000000000..29504e51a7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.286568900 +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/electron32/patches/patch-net_http_http__auth__gssapi__posix.cc b/electron32/patches/patch-net_http_http__auth__gssapi__posix.cc
new file mode 100644
index 0000000000..96afcc7fac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.290567000 +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/electron32/patches/patch-net_http_http__auth__gssapi__posix.h b/electron32/patches/patch-net_http_http__auth__gssapi__posix.h
new file mode 100644
index 0000000000..5910783be5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.290567000 +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/electron32/patches/patch-net_http_http__auth__handler__negotiate.cc b/electron32/patches/patch-net_http_http__auth__handler__negotiate.cc
new file mode 100644
index 0000000000..8dc4cdf2ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.294565200 +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/electron32/patches/patch-net_http_http__auth__preferences.cc b/electron32/patches/patch-net_http_http__auth__preferences.cc
new file mode 100644
index 0000000000..4cd5a8298e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.294565200 +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/electron32/patches/patch-net_http_http__auth__preferences.h b/electron32/patches/patch-net_http_http__auth__preferences.h
new file mode 100644
index 0000000000..52d0cda09c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.294565200 +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/electron32/patches/patch-net_http_http__network__session.cc b/electron32/patches/patch-net_http_http__network__session.cc
new file mode 100644
index 0000000000..af0edb5a2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.298563200 +0000
++++ net/http/http_network_session.cc
+@@ -19,7 +19,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/url_security_manager.h"
diff --git a/electron32/patches/patch-net_proxy__resolution_proxy__config__service.cc b/electron32/patches/patch-net_proxy__resolution_proxy__config__service.cc
new file mode 100644
index 0000000000..09b1ecbb2a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.486474800 +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/electron32/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc b/electron32/patches/patch-net_proxy__resolution_proxy__config__service__linux.cc
new file mode 100644
index 0000000000..47745d2460
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.490472800 +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/electron32/patches/patch-net_socket_socket__posix.cc b/electron32/patches/patch-net_socket_socket__posix.cc
new file mode 100644
index 0000000000..853da2b3cc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.510463500 +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/electron32/patches/patch-net_socket_socks5__client__socket.cc b/electron32/patches/patch-net_socket_socks5__client__socket.cc
new file mode 100644
index 0000000000..06ae74cbc1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.510463500 +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/electron32/patches/patch-net_socket_tcp__socket__posix.cc b/electron32/patches/patch-net_socket_tcp__socket__posix.cc
new file mode 100644
index 0000000000..134bfc4ba8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.514461500 +0000
++++ net/socket/tcp_socket_posix.cc
+@@ -97,6 +97,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/electron32/patches/patch-net_socket_udp__socket__posix.cc b/electron32/patches/patch-net_socket_udp__socket__posix.cc
new file mode 100644
index 0000000000..2e35618f81
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.518459600 +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;
+ }
+@@ -521,12 +547,17 @@ int UDPSocketPosix::SetRecvTos() {
+ }
+ }
+
++#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 {
+@@ -547,7 +578,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.
+@@ -848,9 +879,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,
+@@ -953,9 +1000,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/electron32/patches/patch-net_socket_udp__socket__unittest.cc b/electron32/patches/patch-net_socket_udp__socket__unittest.cc
new file mode 100644
index 0000000000..4add8a3398
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:30.518459600 +0000
++++ net/socket/udp_socket_unittest.cc
+@@ -358,7 +358,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).
+@@ -669,7 +669,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));
+ #elif BUILDFLAG(IS_MAC)
+@@ -697,7 +697,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));
+ #elif BUILDFLAG(IS_MAC)
+@@ -762,7 +762,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
+@@ -816,7 +816,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/electron32/patches/patch-net_third__party_quiche_BUILD.gn b/electron32/patches/patch-net_third__party_quiche_BUILD.gn
new file mode 100644
index 0000000000..e801521428
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.621940900 +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/electron32/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc b/electron32/patches/patch-net_tools_cert__verify__tool_cert__verify__tool.cc
new file mode 100644
index 0000000000..2a6d806e36
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.625939000 +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.
+ //
+@@ -579,7 +579,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/electron32/patches/patch-net_tools_net__watcher_net__watcher.cc b/electron32/patches/patch-net_tools_net__watcher_net__watcher.cc
new file mode 100644
index 0000000000..8757090853
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.633935200 +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/electron32/patches/patch-net_traffic__annotation_network__traffic__annotation.h b/electron32/patches/patch-net_traffic__annotation_network__traffic__annotation.h
new file mode 100644
index 0000000000..5e999af476
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.641931500 +0000
++++ net/traffic_annotation/network_traffic_annotation.h
+@@ -378,7 +378,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
+@@ -392,7 +392,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/electron32/patches/patch-net_url__request_static__http__user__agent__settings.h b/electron32/patches/patch-net_url__request_static__http__user__agent__settings.h
new file mode 100644
index 0000000000..93472661c9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.641931500 +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/electron32/patches/patch-net_url__request_url__request__context.cc b/electron32/patches/patch-net_url__request_url__request__context.cc
new file mode 100644
index 0000000000..d40d6e585e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.641931500 +0000
++++ net/url_request/url_request_context.cc
+@@ -121,7 +121,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/electron32/patches/patch-net_url__request_url__request__context.h b/electron32/patches/patch-net_url__request_url__request__context.h
new file mode 100644
index 0000000000..9facbd58a5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.641931500 +0000
++++ net/url_request/url_request_context.h
+@@ -91,7 +91,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/electron32/patches/patch-net_url__request_url__request__context__builder.cc b/electron32/patches/patch-net_url__request_url__request__context__builder.cc
new file mode 100644
index 0000000000..f761e63917
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.641931500 +0000
++++ net/url_request/url_request_context_builder.cc
+@@ -441,7 +441,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/electron32/patches/patch-pdf_pdfium_pdfium__engine.cc b/electron32/patches/patch-pdf_pdfium_pdfium__engine.cc
new file mode 100644
index 0000000000..e3eb50be24
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.661922000 +0000
++++ pdf/pdfium/pdfium_engine.cc
+@@ -93,7 +93,7 @@
+ #include "gin/public/cppgc.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
+
+@@ -524,7 +524,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/electron32/patches/patch-ppapi_buildflags_buildflags.gni b/electron32/patches/patch-ppapi_buildflags_buildflags.gni
new file mode 100644
index 0000000000..282dc88c69
--- /dev/null
+++ b/electron32/patches/patch-ppapi_buildflags_buildflags.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
+
+--- ppapi/buildflags/buildflags.gni.orig 2024-10-18 12:34:31.673916300 +0000
++++ ppapi/buildflags/buildflags.gni
+@@ -19,7 +19,7 @@ declare_args() {
+ # Enables Pepper API (PPAPI) plugin support.
+ # The only remaining PPAPI plugin supported is NaCl and if is disabled
+ # we can disable PPAPI.
+- enable_ppapi = enable_plugins && enable_nacl && !is_fuchsia
++ enable_ppapi = enable_plugins && !is_fuchsia
+ }
+
+ assert(enable_plugins || !enable_ppapi)
diff --git a/electron32/patches/patch-ppapi_tests_test__utils.h b/electron32/patches/patch-ppapi_tests_test__utils.h
new file mode 100644
index 0000000000..d2cb1bdd6a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.729890000 +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/electron32/patches/patch-printing_backend_cups__ipp__helper.cc b/electron32/patches/patch-printing_backend_cups__ipp__helper.cc
new file mode 100644
index 0000000000..a2b2cdeffb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.733888400 +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/electron32/patches/patch-printing_backend_print__backend__cups.cc b/electron32/patches/patch-printing_backend_print__backend__cups.cc
new file mode 100644
index 0000000000..b439a0bc88
--- /dev/null
+++ b/electron32/patches/patch-printing_backend_print__backend__cups.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
+
+--- printing/backend/print_backend_cups.cc.orig 2024-10-18 12:34:31.737886400 +0000
++++ printing/backend/print_backend_cups.cc
+@@ -32,7 +32,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"
+@@ -283,7 +283,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 (base::FeatureList::IsEnabled(features::kCupsIppPrintingBackend)) {
+ return base::MakeRefCounted<PrintBackendCupsIpp>(CupsConnection::Create());
+ }
diff --git a/electron32/patches/patch-printing_mojom_printing__context__mojom__traits.cc b/electron32/patches/patch-printing_mojom_printing__context__mojom__traits.cc
new file mode 100644
index 0000000000..d5d6a6132d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.737886400 +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/electron32/patches/patch-printing_mojom_printing__context__mojom__traits.h b/electron32/patches/patch-printing_mojom_printing__context__mojom__traits.h
new file mode 100644
index 0000000000..f87ebfb5b6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_print__settings.cc b/electron32/patches/patch-printing_print__settings.cc
new file mode 100644
index 0000000000..c1e3b4cad2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +0000
++++ printing/print_settings.cc
+@@ -320,7 +320,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)
+@@ -350,7 +350,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
+@@ -374,7 +374,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
+@@ -414,7 +414,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/electron32/patches/patch-printing_print__settings.h b/electron32/patches/patch-printing_print__settings.h
new file mode 100644
index 0000000000..34b64e701d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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) PrintSe
+ 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) PrintSe
+ 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) PrintSe
+ // 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/electron32/patches/patch-printing_print__settings__conversion.cc b/electron32/patches/patch-printing_print__settings__conversion.cc
new file mode 100644
index 0000000000..51c3020f47
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_printing__context.cc b/electron32/patches/patch-printing_printing__context.cc
new file mode 100644
index 0000000000..0d52592f6c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_printing__context.h b/electron32/patches/patch-printing_printing__context.h
new file mode 100644
index 0000000000..fa95745594
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_printing__context__linux.cc b/electron32/patches/patch-printing_printing__context__linux.cc
new file mode 100644
index 0000000000..1f87bc303e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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
+
+@@ -68,7 +68,7 @@ mojom::ResultCode PrintingContextLinux::
+
+ ResetSettings();
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (!ui::LinuxUi::instance())
+ return mojom::ResultCode::kSuccess;
+
+@@ -84,7 +84,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
+@@ -97,7 +97,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/electron32/patches/patch-printing_printing__context__mac.h b/electron32/patches/patch-printing_printing__context__mac.h
new file mode 100644
index 0000000000..adb73d1880
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_printing__context__mac.mm b/electron32/patches/patch-printing_printing__context__mac.mm
new file mode 100644
index 0000000000..323e2aa369
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +0000
++++ printing/printing_context_mac.mm
+@@ -527,7 +527,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();
+ }
+ }
+@@ -680,6 +681,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/electron32/patches/patch-printing_printing__context__system__dialog__win.cc b/electron32/patches/patch-printing_printing__context__system__dialog__win.cc
new file mode 100644
index 0000000000..cadd3a408f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_printing__features.cc b/electron32/patches/patch-printing_printing__features.cc
new file mode 100644
index 0000000000..5133e24dd6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +0000
++++ printing/printing_features.cc
+@@ -21,12 +21,12 @@ BASE_FEATURE(kAddPrinterViaPrintscanmgr,
+ base::FEATURE_DISABLED_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/electron32/patches/patch-printing_printing__features.h b/electron32/patches/patch-printing_printing__features.h
new file mode 100644
index 0000000000..81b1dbf11e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc b/electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..65f5a6979f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h b/electron32/patches/patch-printing_sandbox_print__backend__sandbox__hook__linux.h
new file mode 100644
index 0000000000..31a72ed758
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.741884500 +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/electron32/patches/patch-remoting_base_chromoting__event.cc b/electron32/patches/patch-remoting_base_chromoting__event.cc
new file mode 100644
index 0000000000..3e609ba199
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.745882700 +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/electron32/patches/patch-remoting_base_host__settings.cc b/electron32/patches/patch-remoting_base_host__settings.cc
new file mode 100644
index 0000000000..e1bc2c68fb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.745882700 +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/electron32/patches/patch-remoting_client_display_sys__opengl.h b/electron32/patches/patch-remoting_client_display_sys__opengl.h
new file mode 100644
index 0000000000..a8d51a21c9
--- /dev/null
+++ b/electron32/patches/patch-remoting_client_display_sys__opengl.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
+
+--- remoting/client/display/sys_opengl.h.orig 2024-10-18 12:34:31.753878800 +0000
++++ remoting/client/display/sys_opengl.h
+@@ -9,7 +9,7 @@
+
+ #if BUILDFLAG(IS_IOS)
+ #include <OpenGLES/ES3/gl.h>
+-#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ #define GL_GLEXT_PROTOTYPES
+ #include <GL/gl.h>
+ #include <GL/glext.h>
diff --git a/electron32/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc b/electron32/patches/patch-remoting_codec_webrtc__video__encoder__vpx.cc
new file mode 100644
index 0000000000..6a722b7419
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +0000
++++ remoting/codec/webrtc_video_encoder_vpx.cc
+@@ -88,7 +88,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/electron32/patches/patch-remoting_host_base_desktop__environment__options.cc b/electron32/patches/patch-remoting_host_base_desktop__environment__options.cc
new file mode 100644
index 0000000000..8ad8c4f5c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +0000
++++ remoting/host/base/desktop_environment_options.cc
+@@ -124,7 +124,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/electron32/patches/patch-remoting_host_base_switches.cc b/electron32/patches/patch-remoting_host_base_switches.cc
new file mode 100644
index 0000000000..e800e7bc10
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +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/electron32/patches/patch-remoting_host_base_switches.h b/electron32/patches/patch-remoting_host_base_switches.h
new file mode 100644
index 0000000000..cb527cc565
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +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/electron32/patches/patch-remoting_host_basic__desktop__environment.cc b/electron32/patches/patch-remoting_host_basic__desktop__environment.cc
new file mode 100644
index 0000000000..61ae2d2281
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +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/electron32/patches/patch-remoting_host_chromoting__host.cc b/electron32/patches/patch-remoting_host_chromoting__host.cc
new file mode 100644
index 0000000000..a9b8a24299
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +0000
++++ remoting/host/chromoting_host.cc
+@@ -129,7 +129,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/electron32/patches/patch-remoting_host_chromoting__host.h b/electron32/patches/patch-remoting_host_chromoting__host.h
new file mode 100644
index 0000000000..de2d88303d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +0000
++++ remoting/host/chromoting_host.h
+@@ -32,7 +32,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
+
+@@ -97,7 +97,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
+@@ -206,7 +206,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/electron32/patches/patch-remoting_host_chromoting__host__context.cc b/electron32/patches/patch-remoting_host_chromoting__host__context.cc
new file mode 100644
index 0000000000..7320353107
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +0000
++++ remoting/host/chromoting_host_context.cc
+@@ -294,7 +294,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/electron32/patches/patch-remoting_host_chromoting__host__services__client.cc b/electron32/patches/patch-remoting_host_chromoting__host__services__client.cc
new file mode 100644
index 0000000000..5129ba9f9f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.757877000 +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/electron32/patches/patch-remoting_host_client__session.cc b/electron32/patches/patch-remoting_host_client__session.cc
new file mode 100644
index 0000000000..5fad722aad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.761875200 +0000
++++ remoting/host/client_session.cc
+@@ -157,7 +157,7 @@ void ClientSession::NotifyClientResoluti
+ if (desktop_environment_options_.enable_curtaining()) {
+ 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/electron32/patches/patch-remoting_host_crash_crash__file__uploader.cc b/electron32/patches/patch-remoting_host_crash_crash__file__uploader.cc
new file mode 100644
index 0000000000..9efa6d917c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.761875200 +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/electron32/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc b/electron32/patches/patch-remoting_host_desktop__and__cursor__conditional__composer.cc
new file mode 100644
index 0000000000..f6de5bef3c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.761875200 +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/electron32/patches/patch-remoting_host_desktop__capturer__proxy.cc b/electron32/patches/patch-remoting_host_desktop__capturer__proxy.cc
new file mode 100644
index 0000000000..103082e7a4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.761875200 +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/electron32/patches/patch-remoting_host_desktop__capturer__wrapper.cc b/electron32/patches/patch-remoting_host_desktop__capturer__wrapper.cc
new file mode 100644
index 0000000000..7d1f1bfa04
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.761875200 +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/electron32/patches/patch-remoting_host_evaluate__capability.cc b/electron32/patches/patch-remoting_host_evaluate__capability.cc
new file mode 100644
index 0000000000..37d14d189e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.765873200 +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/electron32/patches/patch-remoting_host_host__attributes.cc b/electron32/patches/patch-remoting_host_host__attributes.cc
new file mode 100644
index 0000000000..c4eec71d92
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.765873200 +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/electron32/patches/patch-remoting_host_host__details.cc b/electron32/patches/patch-remoting_host_host__details.cc
new file mode 100644
index 0000000000..708b05dcca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.765873200 +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/electron32/patches/patch-remoting_host_host__main.cc b/electron32/patches/patch-remoting_host_host__main.cc
new file mode 100644
index 0000000000..35c076107a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.765873200 +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/electron32/patches/patch-remoting_host_ipc__constants.cc b/electron32/patches/patch-remoting_host_ipc__constants.cc
new file mode 100644
index 0000000000..3c456fe896
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.777867600 +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
+@@ -68,7 +68,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/electron32/patches/patch-remoting_host_it2me_it2me__host.cc b/electron32/patches/patch-remoting_host_it2me_it2me__host.cc
new file mode 100644
index 0000000000..81948890d0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.777867600 +0000
++++ remoting/host/it2me/it2me_host.cc
+@@ -52,7 +52,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)
+@@ -180,7 +180,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());
+ }
+@@ -340,7 +340,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/electron32/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc b/electron32/patches/patch-remoting_host_it2me_it2me__native__messaging__host__main.cc
new file mode 100644
index 0000000000..a6db4e7c56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.777867600 +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/electron32/patches/patch-remoting_host_me2me__desktop__environment.cc b/electron32/patches/patch-remoting_host_me2me__desktop__environment.cc
new file mode 100644
index 0000000000..236818ac37
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +0000
++++ remoting/host/me2me_desktop_environment.cc
+@@ -119,7 +119,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;
+@@ -161,7 +161,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
+@@ -170,7 +170,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);
+ }
+@@ -195,7 +195,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/electron32/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc b/electron32/patches/patch-remoting_host_mouse__cursor__monitor__proxy.cc
new file mode 100644
index 0000000000..28a49e6346
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +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/electron32/patches/patch-remoting_host_policy__watcher.cc b/electron32/patches/patch-remoting_host_policy__watcher.cc
new file mode 100644
index 0000000000..a9e4dbbb56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +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/electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc b/electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__client.cc
new file mode 100644
index 0000000000..486e099e3b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +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/electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc b/electron32/patches/patch-remoting_host_remote__open__url_remote__open__url__util.cc
new file mode 100644
index 0000000000..c1a3323ded
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +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/electron32/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc b/electron32/patches/patch-remoting_host_remote__open__url_url__forwarder__configurator.cc
new file mode 100644
index 0000000000..8babd5c685
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.785863900 +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/electron32/patches/patch-remoting_host_remoting__me2me__host.cc b/electron32/patches/patch-remoting_host_remoting__me2me__host.cc
new file mode 100644
index 0000000000..6ecfe374c7
--- /dev/null
+++ b/electron32/patches/patch-remoting_host_remoting__me2me__host.cc
@@ -0,0 +1,175 @@
+$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 2024-10-18 12:34:31.789862200 +0000
++++ remoting/host/remoting_me2me_host.cc
+@@ -129,7 +129,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)
+@@ -140,13 +140,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
+
+@@ -159,7 +159,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)
+@@ -189,7 +189,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";
+@@ -397,7 +397,7 @@ class HostProcess : public ConfigWatcher
+
+ std::unique_ptr<ChromotingHostContext> context_;
+
+-#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)
+@@ -466,7 +466,7 @@ class HostProcess : public ConfigWatcher
+
+ std::unique_ptr<HostStatusLogger> host_status_logger_;
+ 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_;
+@@ -773,7 +773,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)
+ }
+@@ -808,7 +808,7 @@ void HostProcess::CreateAuthenticatorFac
+ base::MakeRefCounted<CorpSessionAuthzServiceClientFactory>(
+ 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,
+@@ -953,13 +953,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 =
+@@ -1036,7 +1036,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.
+@@ -1044,7 +1044,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(); }));
+@@ -1401,7 +1401,7 @@ bool HostProcess::OnUsernamePolicyUpdate
+ // Returns false: never restart the host after this policy update.
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_BSD)
+ std::optional<bool> host_username_match_required =
+ policies.FindBool(policy::key::kRemoteAccessHostMatchUsername);
+ if (!host_username_match_required.has_value()) {
+@@ -1849,7 +1849,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_googler_);
+ #endif
+
+@@ -1882,7 +1882,7 @@ void HostProcess::StartHost() {
+ host_status_logger_ = std::make_unique<HostStatusLogger>(
+ host_->status_monitor(), log_to_server_.get());
+
+-#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_ =
+@@ -1914,7 +1914,7 @@ void HostProcess::StartHost() {
+
+ host_->Start(host_owner_);
+
+-#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();
+@@ -2048,7 +2048,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 ...)
+@@ -2097,7 +2097,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/electron32/patches/patch-remoting_host_setup_start__host__main.cc b/electron32/patches/patch-remoting_host_setup_start__host__main.cc
new file mode 100644
index 0000000000..d9d81b8068
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.805854600 +0000
++++ remoting/host/setup/start_host_main.cc
+@@ -37,7 +37,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)
+@@ -339,7 +339,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);
+@@ -364,7 +364,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/electron32/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc b/electron32/patches/patch-remoting_host_webauthn_remote__webauthn__caller__security__utils.cc
new file mode 100644
index 0000000000..6c2a0915b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.805854600 +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/electron32/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc b/electron32/patches/patch-remoting_host_webauthn_remote__webauthn__extension__notifier.cc
new file mode 100644
index 0000000000..b989c28285
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.805854600 +0000
++++ remoting/host/webauthn/remote_webauthn_extension_notifier.cc
+@@ -24,7 +24,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"
+@@ -69,14 +69,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/electron32/patches/patch-remoting_protocol_webrtc__video__stream.cc b/electron32/patches/patch-remoting_protocol_webrtc__video__stream.cc
new file mode 100644
index 0000000000..e544a6399a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.965779500 +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/electron32/patches/patch-sandbox_BUILD.gn b/electron32/patches/patch-sandbox_BUILD.gn
new file mode 100644
index 0000000000..c067f08118
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.985770200 +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/electron32/patches/patch-sandbox_features.gni b/electron32/patches/patch-sandbox_features.gni
new file mode 100644
index 0000000000..864cb2b83a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.985770200 +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/electron32/patches/patch-sandbox_linux_BUILD.gn b/electron32/patches/patch-sandbox_linux_BUILD.gn
new file mode 100644
index 0000000000..d2013c1258
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.985770200 +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
+@@ -379,6 +379,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/electron32/patches/patch-sandbox_linux_services_init__process__reaper.cc b/electron32/patches/patch-sandbox_linux_services_init__process__reaper.cc
new file mode 100644
index 0000000000..132266b0e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.989768300 +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/electron32/patches/patch-sandbox_linux_services_libc__interceptor.cc b/electron32/patches/patch-sandbox_linux_services_libc__interceptor.cc
new file mode 100644
index 0000000000..b3acfa2685
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.989768300 +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/electron32/patches/patch-sandbox_mac_BUILD.gn b/electron32/patches/patch-sandbox_mac_BUILD.gn
new file mode 100644
index 0000000000..b5b5d50094
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/BUILD.gn
+@@ -39,6 +39,7 @@ component("seatbelt") {
+ ]
+ public_deps = [ "//third_party/protobuf:protobuf_lite" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ component("seatbelt_extension") {
+@@ -52,6 +53,7 @@ component("seatbelt_extension") {
+ libs = [ "sandbox" ]
+ public_deps = [ "//base" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ component("system_services") {
+@@ -66,6 +68,7 @@ component("system_services") {
+ deps = [ ":seatbelt_export" ]
+ public_deps = [ "//base" ]
+ defines = [ "SEATBELT_IMPLEMENTATION" ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ source_set("sandbox_unittests") {
diff --git a/electron32/patches/patch-sandbox_mac_sandbox__compiler.cc b/electron32/patches/patch-sandbox_mac_sandbox__compiler.cc
new file mode 100644
index 0000000000..5120ee48a1
--- /dev/null
+++ b/electron32/patches/patch-sandbox_mac_sandbox__compiler.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
+
+--- sandbox/mac/sandbox_compiler.cc.orig 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/sandbox_compiler.cc
+@@ -47,6 +47,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 +68,9 @@ bool SandboxCompiler::CompileAndApplyPro
+ }
+ }
+ return false;
++#else
++ return true;
++#endif
+ }
+
+ bool SandboxCompiler::CompilePolicyToProto(mac::SandboxPolicy& policy,
diff --git a/electron32/patches/patch-sandbox_mac_sandbox__logging.cc b/electron32/patches/patch-sandbox_mac_sandbox__logging.cc
new file mode 100644
index 0000000000..be63afc098
--- /dev/null
+++ b/electron32/patches/patch-sandbox_mac_sandbox__logging.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
+
+--- sandbox/mac/sandbox_logging.cc.orig 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/sandbox_logging.cc
+@@ -33,9 +33,11 @@
+ }
+ #endif
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ void abort_report_np(const char*, ...);
+ }
++#endif
+
+ namespace sandbox::logging {
+
+@@ -76,9 +78,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/electron32/patches/patch-sandbox_mac_seatbelt.cc b/electron32/patches/patch-sandbox_mac_seatbelt.cc
new file mode 100644
index 0000000000..c107c4480c
--- /dev/null
+++ b/electron32/patches/patch-sandbox_mac_seatbelt.cc
@@ -0,0 +1,169 @@
+$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 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/seatbelt.cc
+@@ -9,7 +9,7 @@
+
+ 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 +40,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 +74,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 +126,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 +135,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 +145,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 +160,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 +170,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/electron32/patches/patch-sandbox_mac_seatbelt__extension.cc b/electron32/patches/patch-sandbox_mac_seatbelt__extension.cc
new file mode 100644
index 0000000000..d60d439ea7
--- /dev/null
+++ b/electron32/patches/patch-sandbox_mac_seatbelt__extension.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
+
+--- sandbox/mac/seatbelt_extension.cc.orig 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/seatbelt_extension.cc
+@@ -11,6 +11,7 @@
+ #include "base/notreached.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 +23,7 @@ char* sandbox_extension_issue_file(const
+ const char* path,
+ uint32_t flags);
+ }
++#endif
+
+ namespace sandbox {
+
+@@ -50,7 +52,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 +68,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 +90,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_IN_MIGRATION();
+ return nullptr;
diff --git a/electron32/patches/patch-sandbox_mac_system__services.cc b/electron32/patches/patch-sandbox_mac_system__services.cc
new file mode 100644
index 0000000000..5a28720964
--- /dev/null
+++ b/electron32/patches/patch-sandbox_mac_system__services.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
+
+--- sandbox/mac/system_services.cc.orig 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/mac/system_services.cc
+@@ -9,6 +9,7 @@
+
+ #include "base/apple/osstatus_logging.h"
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ OSStatus SetApplicationIsDaemon(Boolean isDaemon);
+ void _LSSetApplicationLaunchServicesServerConnectionStatus(
+@@ -19,10 +20,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 +39,13 @@ void DisableLaunchServices() {
+ 0, ^bool(CFDictionaryRef options) {
+ return false;
+ });
++ #endif
+ }
+
+ void DisableCoreServicesCheckFix() {
++#if !IS_MAS_BUILD()
+ _CSCheckFixDisable();
++#endif
+ }
+
+ } // namespace sandbox
diff --git a/electron32/patches/patch-sandbox_policy_BUILD.gn b/electron32/patches/patch-sandbox_policy_BUILD.gn
new file mode 100644
index 0000000000..8dc5aae444
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_BUILD.gn
@@ -0,0 +1,56 @@
+$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 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/policy/BUILD.gn
+@@ -49,7 +49,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",
+@@ -124,6 +124,38 @@ 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_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/electron32/patches/patch-sandbox_policy_features.cc b/electron32/patches/patch-sandbox_policy_features.cc
new file mode 100644
index 0000000000..6aa41b8a14
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.993766300 +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.
+@@ -147,7 +151,7 @@ BASE_FEATURE(kForceSpectreVariant2Mitiga
+ base::FEATURE_DISABLED_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/electron32/patches/patch-sandbox_policy_features.h b/electron32/patches/patch-sandbox_policy_features.h
new file mode 100644
index 0000000000..c7e79a9aaa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.993766300 +0000
++++ sandbox/policy/features.h
+@@ -47,7 +47,7 @@ SANDBOX_POLICY_EXPORT BASE_DECLARE_FEATU
+ SANDBOX_POLICY_EXPORT BASE_DECLARE_FEATURE(kForceSpectreVariant2Mitigation);
+ #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/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc b/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
new file mode 100644
index 0000000000..3c447ef98a
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.cc
@@ -0,0 +1,254 @@
+$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-01-06 07:57:04.477505279 +0000
++++ sandbox/policy/freebsd/sandbox_freebsd.cc
+@@ -0,0 +1,245 @@
++// 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=" << GetSandboxTypeInEnglish(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)
++}
++
++// static
++std::string SandboxLinux::GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type) {
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ return "Unsandboxed";
++ case sandbox::mojom::Sandbox::kRenderer:
++ return "Renderer";
++ case sandbox::mojom::Sandbox::kUtility:
++ return "Utility";
++ case sandbox::mojom::Sandbox::kGpu:
++ return "GPU";
++#if BUILDFLAG(ENABLE_PPAPI)
++ case sandbox::mojom::Sandbox::kPpapi:
++ return "PPAPI";
++#endif
++ case sandbox::mojom::Sandbox::kNetwork:
++ return "Network";
++ case sandbox::mojom::Sandbox::kCdm:
++ return "CDM";
++ case sandbox::mojom::Sandbox::kPrintCompositor:
++ return "Print Compositor";
++ case sandbox::mojom::Sandbox::kAudio:
++ return "Audio";
++ case sandbox::mojom::Sandbox::kSpeechRecognition:
++ return "Speech Recognition";
++ case sandbox::mojom::Sandbox::kService:
++ return "Service";
++ case sandbox::mojom::Sandbox::kVideoCapture:
++ return "Video Capture";
++ default:
++ return "Unknown";
++ }
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h b/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
new file mode 100644
index 0000000000..7f29e6c1df
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_freebsd_sandbox__freebsd.h
@@ -0,0 +1,287 @@
+$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-01-06 07:57:04.478266823 +0000
++++ sandbox/policy/freebsd/sandbox_freebsd.h
+@@ -0,0 +1,278 @@
++// 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();
++
++ static std::string GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type);
++
++ // 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/electron32/patches/patch-sandbox_policy_mac_sandbox__mac.mm b/electron32/patches/patch-sandbox_policy_mac_sandbox__mac.mm
new file mode 100644
index 0000000000..0f7a6bf8de
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/mac/sandbox_mac.mm
+@@ -38,6 +38,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/electron32/patches/patch-sandbox_policy_mojom_sandbox.mojom b/electron32/patches/patch-sandbox_policy_mojom_sandbox.mojom
new file mode 100644
index 0000000000..1042efca85
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/mojom/sandbox.mojom
+@@ -77,6 +77,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/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc b/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
new file mode 100644
index 0000000000..ebbf03c0fb
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.cc
@@ -0,0 +1,254 @@
+$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-01-06 07:57:04.480968267 +0000
++++ sandbox/policy/netbsd/sandbox_netbsd.cc
+@@ -0,0 +1,245 @@
++// 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=" << GetSandboxTypeInEnglish(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)
++}
++
++// static
++std::string SandboxLinux::GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type) {
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ return "Unsandboxed";
++ case sandbox::mojom::Sandbox::kRenderer:
++ return "Renderer";
++ case sandbox::mojom::Sandbox::kUtility:
++ return "Utility";
++ case sandbox::mojom::Sandbox::kGpu:
++ return "GPU";
++#if BUILDFLAG(ENABLE_PPAPI)
++ case sandbox::mojom::Sandbox::kPpapi:
++ return "PPAPI";
++#endif
++ case sandbox::mojom::Sandbox::kNetwork:
++ return "Network";
++ case sandbox::mojom::Sandbox::kCdm:
++ return "CDM";
++ case sandbox::mojom::Sandbox::kPrintCompositor:
++ return "Print Compositor";
++ case sandbox::mojom::Sandbox::kAudio:
++ return "Audio";
++ case sandbox::mojom::Sandbox::kSpeechRecognition:
++ return "Speech Recognition";
++ case sandbox::mojom::Sandbox::kService:
++ return "Service";
++ case sandbox::mojom::Sandbox::kVideoCapture:
++ return "Video Capture";
++ default:
++ return "Unknown";
++ }
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h b/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
new file mode 100644
index 0000000000..98b5bb7b06
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_netbsd_sandbox__netbsd.h
@@ -0,0 +1,287 @@
+$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-01-06 07:57:04.481545432 +0000
++++ sandbox/policy/netbsd/sandbox_netbsd.h
+@@ -0,0 +1,278 @@
++// 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();
++
++ static std::string GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type);
++
++ // 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/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc b/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.cc
new file mode 100644
index 0000000000..6da5f8669f
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.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
+
+--- sandbox/policy/openbsd/sandbox_openbsd.cc.orig 2025-01-06 07:57:04.482427941 +0000
++++ sandbox/policy/openbsd/sandbox_openbsd.cc
+@@ -0,0 +1,424 @@
++// 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:
++ 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=" << GetSandboxTypeInEnglish(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:
++ 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: " << GetSandboxTypeInEnglish(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)
++}
++
++// static
++std::string SandboxLinux::GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type) {
++ switch (sandbox_type) {
++ case sandbox::mojom::Sandbox::kNoSandbox:
++ return "Unsandboxed";
++ case sandbox::mojom::Sandbox::kRenderer:
++ return "Renderer";
++ case sandbox::mojom::Sandbox::kUtility:
++ return "Utility";
++ case sandbox::mojom::Sandbox::kGpu:
++ return "GPU";
++#if BUILDFLAG(ENABLE_PPAPI)
++ case sandbox::mojom::Sandbox::kPpapi:
++ return "PPAPI";
++#endif
++ case sandbox::mojom::Sandbox::kNetwork:
++ return "Network";
++ case sandbox::mojom::Sandbox::kCdm:
++ return "CDM";
++ case sandbox::mojom::Sandbox::kPrintCompositor:
++ return "Print Compositor";
++ case sandbox::mojom::Sandbox::kAudio:
++ return "Audio";
++ case sandbox::mojom::Sandbox::kSpeechRecognition:
++ return "Speech Recognition";
++ case sandbox::mojom::Sandbox::kService:
++ return "Service";
++ case sandbox::mojom::Sandbox::kVideoCapture:
++ return "Video Capture";
++ default:
++ return "Unknown";
++ }
++}
++
++} // namespace policy
++} // namespace sandbox
diff --git a/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h b/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
new file mode 100644
index 0000000000..e1105a9190
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_openbsd_sandbox__openbsd.h
@@ -0,0 +1,291 @@
+$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-01-06 07:57:04.483108191 +0000
++++ sandbox/policy/openbsd/sandbox_openbsd.h
+@@ -0,0 +1,282 @@
++// 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();
++
++ static std::string GetSandboxTypeInEnglish(sandbox::mojom::Sandbox sandbox_type);
++
++ // 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/electron32/patches/patch-sandbox_policy_sandbox.cc b/electron32/patches/patch-sandbox_policy_sandbox.cc
new file mode 100644
index 0000000000..26fcb195fc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +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/electron32/patches/patch-sandbox_policy_sandbox.h b/electron32/patches/patch-sandbox_policy_sandbox.h
new file mode 100644
index 0000000000..4a99b4d5d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +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/electron32/patches/patch-sandbox_policy_sandbox__type.cc b/electron32/patches/patch-sandbox_policy_sandbox__type.cc
new file mode 100644
index 0000000000..7b40649517
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_sandbox__type.cc
@@ -0,0 +1,121 @@
+$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 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/sandbox_type.cc
+@@ -38,7 +38,7 @@ bool IsUnsandboxedSandboxType(Sandbox sa
+ #endif
+ case Sandbox::kAudio:
+ return false;
+-#if BUILDFLAG(IS_FUCHSIA)
++#if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_BSD)
+ case Sandbox::kVideoCapture:
+ return false;
+ #endif
+@@ -63,7 +63,7 @@ bool IsUnsandboxedSandboxType(Sandbox sa
+ case Sandbox::kMirroring:
+ case Sandbox::kNaClLoader:
+ #endif
+-#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_CHROMEOS_ASH)
+@@ -74,7 +74,7 @@ bool IsUnsandboxedSandboxType(Sandbox sa
+ case Sandbox::kLibassistant:
+ #endif // BUILDFLAG(ENABLE_CROS_LIBASSISTANT)
+ #endif // // BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) | BUILDFLAG(IS_BSD)
+ case Sandbox::kZygoteIntermediateSandbox:
+ case Sandbox::kHardwareVideoEncoding:
+ #endif
+@@ -131,7 +131,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)
+@@ -142,10 +142,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)
+@@ -174,7 +174,7 @@ void SetCommandLineFlagsForSandboxType(b
+ case Sandbox::kNaClLoader:
+ break;
+ #endif // BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kZygoteIntermediateSandbox:
+ break;
+ #endif
+@@ -218,7 +218,7 @@ sandbox::mojom::Sandbox SandboxTypeFromC
+ #endif
+ }
+
+-#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;
+@@ -266,7 +266,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
+@@ -296,11 +296,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)
+@@ -322,7 +322,7 @@ std::string StringFromUtilitySandboxType
+ #if BUILDFLAG(IS_MAC)
+ case Sandbox::kNaClLoader:
+ #endif // BUILDFLAG(IS_MAC)
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
+ case Sandbox::kZygoteIntermediateSandbox:
+ #endif
+ NOTREACHED_IN_MIGRATION();
+@@ -394,11 +394,11 @@ sandbox::mojom::Sandbox UtilitySandboxTy
+ if (sandbox_string == switches::kScreenAISandbox)
+ return Sandbox::kScreenAI;
+ #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)
diff --git a/electron32/patches/patch-sandbox_policy_switches.cc b/electron32/patches/patch-sandbox_policy_switches.cc
new file mode 100644
index 0000000000..0e9b1dc83d
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_switches.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
+
+--- sandbox/policy/switches.cc.orig 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/switches.cc
+@@ -54,10 +54,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)
+
+@@ -97,7 +97,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/electron32/patches/patch-sandbox_policy_switches.h b/electron32/patches/patch-sandbox_policy_switches.h
new file mode 100644
index 0000000000..fe5c183a56
--- /dev/null
+++ b/electron32/patches/patch-sandbox_policy_switches.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
+
+--- sandbox/policy/switches.h.orig 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/switches.h
+@@ -57,10 +57,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)
+
+@@ -82,7 +82,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/electron32/patches/patch-sandbox_policy_win_sandbox__win.cc b/electron32/patches/patch-sandbox_policy_win_sandbox__win.cc
new file mode 100644
index 0000000000..ed41fbea16
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/win/sandbox_win.cc
+@@ -699,11 +699,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
+@@ -938,7 +936,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 =
+@@ -952,7 +950,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()) {
+@@ -967,6 +965,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))
+@@ -978,7 +983,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,
+ base::Process* process) {
+ SandboxLaunchTimer timer;
+@@ -986,7 +991,7 @@ ResultCode SandboxWin::StartSandboxedPro
+ // Avoid making a policy if we won't use it.
+ if (IsUnsandboxedProcess(delegate->GetSandboxType(), cmd_line,
+ *base::CommandLine::ForCurrentProcess())) {
+- return LaunchWithoutSandbox(cmd_line, handles_to_inherit, delegate,
++ return LaunchWithoutSandbox(cmd_line, *options, delegate,
+ process);
+ }
+
+@@ -994,7 +999,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)
+ return result;
+ timer.OnPolicyGenerated();
diff --git a/electron32/patches/patch-sandbox_policy_win_sandbox__win.h b/electron32/patches/patch-sandbox_policy_win_sandbox__win.h
new file mode 100644
index 0000000000..e046edd2c3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:31.997764600 +0000
++++ sandbox/policy/win/sandbox_win.h
+@@ -52,7 +52,7 @@ class SANDBOX_POLICY_EXPORT SandboxWin {
+ // Otherwise, returns one of sandbox::ResultCode for any other error.
+ static ResultCode StartSandboxedProcess(
+ const base::CommandLine& cmd_line,
+- const base::HandlesToInheritVector& handles_to_inherit,
++ const base::LaunchOptions* options,
+ SandboxDelegate* delegate,
+ base::Process* process);
+
+@@ -65,7 +65,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/electron32/patches/patch-services_audio_audio__sandbox__hook__linux.cc b/electron32/patches/patch-services_audio_audio__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..00f1e70a2a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.013757000 +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/electron32/patches/patch-services_audio_audio__sandbox__hook__linux.h b/electron32/patches/patch-services_audio_audio__sandbox__hook__linux.h
new file mode 100644
index 0000000000..ac3d7c3526
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.013757000 +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/electron32/patches/patch-services_device_BUILD.gn b/electron32/patches/patch-services_device_BUILD.gn
new file mode 100644
index 0000000000..24ed78582c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.025751400 +0000
++++ services/device/BUILD.gn
+@@ -14,7 +14,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/electron32/patches/patch-services_device_geolocation_location__provider__manager.cc b/electron32/patches/patch-services_device_geolocation_location__provider__manager.cc
new file mode 100644
index 0000000000..9d7a9c1f35
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.037746000 +0000
++++ services/device/geolocation/location_provider_manager.cc
+@@ -51,7 +51,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/electron32/patches/patch-services_device_hid_BUILD.gn b/electron32/patches/patch-services_device_hid_BUILD.gn
new file mode 100644
index 0000000000..47f658b1ca
--- /dev/null
+++ b/electron32/patches/patch-services_device_hid_BUILD.gn
@@ -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/device/hid/BUILD.gn.orig 2024-10-18 12:34:32.041744000 +0000
++++ services/device/hid/BUILD.gn
+@@ -36,7 +36,33 @@ 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_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/electron32/patches/patch-services_device_hid_hid__connection__fido.cc b/electron32/patches/patch-services_device_hid_hid__connection__fido.cc
new file mode 100644
index 0000000000..6532868e0e
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.494840897 +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/electron32/patches/patch-services_device_hid_hid__connection__fido.h b/electron32/patches/patch-services_device_hid_hid__connection__fido.h
new file mode 100644
index 0000000000..532b22619d
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.495444881 +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/electron32/patches/patch-services_device_hid_hid__connection__freebsd.cc b/electron32/patches/patch-services_device_hid_hid__connection__freebsd.cc
new file mode 100644
index 0000000000..0f534aead9
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.495996064 +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::internal::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/electron32/patches/patch-services_device_hid_hid__connection__freebsd.h b/electron32/patches/patch-services_device_hid_hid__connection__freebsd.h
new file mode 100644
index 0000000000..d11997071b
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.496784149 +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/electron32/patches/patch-services_device_hid_hid__service.cc b/electron32/patches/patch-services_device_hid_hid__service.cc
new file mode 100644
index 0000000000..30963c14e8
--- /dev/null
+++ b/electron32/patches/patch-services_device_hid_hid__service.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.cc.orig 2024-10-18 12:34:32.041744000 +0000
++++ services/device/hid/hid_service.cc
+@@ -20,11 +20,15 @@
+
+ #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)
++#elif BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_NETBSD)
+ #include "services/device/hid/hid_service_fuchsia.h"
+ #endif
+
+@@ -68,6 +72,10 @@ 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)
diff --git a/electron32/patches/patch-services_device_hid_hid__service__fido.cc b/electron32/patches/patch-services_device_hid_hid__service__fido.cc
new file mode 100644
index 0000000000..7e9734be04
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.498067824 +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/electron32/patches/patch-services_device_hid_hid__service__fido.h b/electron32/patches/patch-services_device_hid_hid__service__fido.h
new file mode 100644
index 0000000000..7c9a645581
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.498720976 +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/electron32/patches/patch-services_device_hid_hid__service__freebsd.cc b/electron32/patches/patch-services_device_hid_hid__service__freebsd.cc
new file mode 100644
index 0000000000..a602db8fff
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.499217963 +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::internal::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::internal::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::internal::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::internal::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/electron32/patches/patch-services_device_hid_hid__service__freebsd.h b/electron32/patches/patch-services_device_hid_hid__service__freebsd.h
new file mode 100644
index 0000000000..84e8b5182f
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.500077006 +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/electron32/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h b/electron32/patches/patch-services_device_public_cpp_generic__sensor_sensor__reading.h
new file mode 100644
index 0000000000..3b43985777
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.045742000 +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/electron32/patches/patch-services_device_public_mojom_BUILD.gn b/electron32/patches/patch-services_device_public_mojom_BUILD.gn
new file mode 100644
index 0000000000..ab89ed9308
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.049740300 +0000
++++ services/device/public/mojom/BUILD.gn
+@@ -97,7 +97,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/electron32/patches/patch-services_device_serial_BUILD.gn b/electron32/patches/patch-services_device_serial_BUILD.gn
new file mode 100644
index 0000000000..e93ea2fa7a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.053738400 +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/electron32/patches/patch-services_device_serial_serial__device__enumerator.cc b/electron32/patches/patch-services_device_serial_serial__device__enumerator.cc
new file mode 100644
index 0000000000..ba207e19b2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.053738400 +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/electron32/patches/patch-services_device_serial_serial__io__handler__posix.cc b/electron32/patches/patch-services_device_serial_serial__io__handler__posix.cc
new file mode 100644
index 0000000000..515af93727
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.053738400 +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/electron32/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc b/electron32/patches/patch-services_device_time__zone__monitor_time__zone__monitor__linux.cc
new file mode 100644
index 0000000000..bee4a8cba8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.053738400 +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/electron32/patches/patch-services_device_usb_BUILD.gn b/electron32/patches/patch-services_device_usb_BUILD.gn
new file mode 100644
index 0000000000..82494f11ea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.053738400 +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/electron32/patches/patch-services_device_usb_usb__service.cc b/electron32/patches/patch-services_device_usb_usb__service.cc
new file mode 100644
index 0000000000..da34d18e03
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.057736600 +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/electron32/patches/patch-services_device_usb_usb__service__fake.cc b/electron32/patches/patch-services_device_usb_usb__service__fake.cc
new file mode 100644
index 0000000000..e64f02627c
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.507815652 +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/electron32/patches/patch-services_device_usb_usb__service__fake.h b/electron32/patches/patch-services_device_usb_usb__service__fake.h
new file mode 100644
index 0000000000..3411881f5a
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.508354823 +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/electron32/patches/patch-services_device_usb_usb__service__impl.cc b/electron32/patches/patch-services_device_usb_usb__service__impl.cc
new file mode 100644
index 0000000000..433ea556de
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.057736600 +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/electron32/patches/patch-services_network_BUILD.gn b/electron32/patches/patch-services_network_BUILD.gn
new file mode 100644
index 0000000000..da35d16aa9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.065732700 +0000
++++ services/network/BUILD.gn
+@@ -411,7 +411,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/electron32/patches/patch-services_network_network__context.cc b/electron32/patches/patch-services_network_network__context.cc
new file mode 100644
index 0000000000..064799312b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.073729000 +0000
++++ services/network/network_context.cc
+@@ -156,6 +156,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
+@@ -580,6 +585,99 @@ mojom::URLLoaderFactoryParamsPtr CreateU
+
+ } // 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::
+@@ -589,7 +687,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_) {
+@@ -961,6 +1059,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) {
+@@ -1613,6 +1718,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().
+@@ -2384,7 +2496,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)
+@@ -2457,6 +2569,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/electron32/patches/patch-services_network_network__context.h b/electron32/patches/patch-services_network_network__context.h
new file mode 100644
index 0000000000..90886a5100
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.073729000 +0000
++++ services/network/network_context.h
+@@ -115,6 +115,7 @@ class URLMatcher;
+ }
+
+ namespace network {
++class RemoteCertVerifier;
+ class CookieManager;
+ class HostResolver;
+ class MdnsResponderManager;
+@@ -246,6 +247,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,
+@@ -312,6 +315,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)
+@@ -692,7 +696,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:
+@@ -921,6 +925,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/electron32/patches/patch-services_network_network__sandbox__hook__linux.cc b/electron32/patches/patch-services_network_network__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..0c7d6e2572
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.077727000 +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/electron32/patches/patch-services_network_network__sandbox__hook__linux.h b/electron32/patches/patch-services_network_network__sandbox__hook__linux.h
new file mode 100644
index 0000000000..32a0f1e529
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.077727000 +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/electron32/patches/patch-services_network_network__service.cc b/electron32/patches/patch-services_network_network__service.cc
new file mode 100644
index 0000000000..26a748274a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.077727000 +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"
+@@ -975,7 +975,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) {
+@@ -1057,7 +1057,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/electron32/patches/patch-services_network_network__service.h b/electron32/patches/patch-services_network_network__service.h
new file mode 100644
index 0000000000..a3a4ecfc52
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.077727000 +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)
+@@ -494,7 +494,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/electron32/patches/patch-services_network_public_cpp_BUILD.gn b/electron32/patches/patch-services_network_public_cpp_BUILD.gn
new file mode 100644
index 0000000000..5aa8c64858
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.081725400 +0000
++++ services/network/public/cpp/BUILD.gn
+@@ -497,7 +497,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",
+@@ -614,7 +614,7 @@ source_set("tests") {
+ ]
+ }
+
+- if (is_linux) {
++ if ((is_linux) && !is_bsd) {
+ sources += [ "network_interface_change_listener_mojom_traits_unittest.cc" ]
+ }
+
diff --git a/electron32/patches/patch-services_network_public_cpp_features.cc b/electron32/patches/patch-services_network_public_cpp_features.cc
new file mode 100644
index 0000000000..cee36b900c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.085723400 +0000
++++ services/network/public/cpp/features.cc
+@@ -127,7 +127,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/electron32/patches/patch-services_network_public_cpp_resource__request.cc b/electron32/patches/patch-services_network_public_cpp_resource__request.cc
new file mode 100644
index 0000000000..5d5bd23dec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.089721700 +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/electron32/patches/patch-services_network_public_cpp_resource__request.h b/electron32/patches/patch-services_network_public_cpp_resource__request.h
new file mode 100644
index 0000000000..4cba025d3e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.089721700 +0000
++++ services/network/public/cpp/resource_request.h
+@@ -73,6 +73,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/electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc b/electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.cc
new file mode 100644
index 0000000000..78c1259a6f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.093719700 +0000
++++ services/network/public/cpp/url_request_mojom_traits.cc
+@@ -96,6 +96,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/electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.h b/electron32/patches/patch-services_network_public_cpp_url__request__mojom__traits.h
new file mode 100644
index 0000000000..034443b844
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.093719700 +0000
++++ services/network/public/cpp/url_request_mojom_traits.h
+@@ -77,6 +77,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/electron32/patches/patch-services_network_public_mojom_BUILD.gn b/electron32/patches/patch-services_network_public_mojom_BUILD.gn
new file mode 100644
index 0000000000..2f7f125581
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.097717800 +0000
++++ services/network/public/mojom/BUILD.gn
+@@ -493,11 +493,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" ]
+@@ -1490,7 +1490,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/electron32/patches/patch-services_network_public_mojom_network__context.mojom b/electron32/patches/patch-services_network_public_mojom_network__context.mojom
new file mode 100644
index 0000000000..12d295d4a5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.097717800 +0000
++++ services/network/public/mojom/network_context.mojom
+@@ -298,6 +298,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 {
+@@ -989,6 +999,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);
+@@ -1275,6 +1288,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/electron32/patches/patch-services_network_public_mojom_url__request.mojom b/electron32/patches/patch-services_network_public_mojom_url__request.mojom
new file mode 100644
index 0000000000..576a7c55ae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.101716000 +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/electron32/patches/patch-services_network_public_mojom_url__response__head.mojom b/electron32/patches/patch-services_network_public_mojom_url__response__head.mojom
new file mode 100644
index 0000000000..1d4eb1d231
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.101716000 +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";
+@@ -44,6 +45,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/electron32/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h b/electron32/patches/patch-services_network_shared__dictionary_shared__dictionary__writer__in__memory.h
new file mode 100644
index 0000000000..feeadf0840
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.105714000 +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/electron32/patches/patch-services_network_test_test__network__context.h b/electron32/patches/patch-services_network_test_test__network__context.h
new file mode 100644
index 0000000000..136b2d1aec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.109712400 +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(
+@@ -149,6 +151,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/electron32/patches/patch-services_network_url__loader.cc b/electron32/patches/patch-services_network_url__loader.cc
new file mode 100644
index 0000000000..8e9b06b514
--- /dev/null
+++ b/electron32/patches/patch-services_network_url__loader.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
+
+--- services/network/url_loader.cc.orig 2024-10-18 12:34:32.113710400 +0000
++++ services/network/url_loader.cc
+@@ -712,6 +712,7 @@ URLLoader::URLLoader(
+ request.trusted_params->allow_cookies_from_browser;
+ include_request_cookies_with_response_ =
+ request.trusted_params->include_request_cookies_with_response;
++ report_raw_headers_ = request.trusted_params->report_raw_headers;
+ }
+
+ // Store any cookies passed from the browser process to later attach them to
+@@ -750,7 +751,7 @@ URLLoader::URLLoader(
+ &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)));
+ }
+@@ -1713,6 +1714,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/electron32/patches/patch-services_network_url__loader.h b/electron32/patches/patch-services_network_url__loader.h
new file mode 100644
index 0000000000..943554fac8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.113710400 +0000
++++ services/network/url_loader.h
+@@ -670,6 +670,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;
+ scoped_refptr<const net::HttpResponseHeaders> raw_response_headers_;
diff --git a/electron32/patches/patch-services_on__device__model_on__device__model__service.h b/electron32/patches/patch-services_on__device__model_on__device__model__service.h
new file mode 100644
index 0000000000..6da49998bd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.117708400 +0000
++++ services/on_device_model/on_device_model_service.h
+@@ -22,6 +22,10 @@
+ #include "sandbox/policy/linux/sandbox_linux.h"
+ #endif
+
++#if BUILDFLAG(IS_BSD)
++#include "sandbox/policy/sandbox.h"
++#endif
++
+ namespace on_device_model {
+
+ class COMPONENT_EXPORT(ON_DEVICE_MODEL) OnDeviceModelService
+@@ -35,7 +39,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/electron32/patches/patch-services_on__device__model_pre__sandbox__init.cc b/electron32/patches/patch-services_on__device__model_pre__sandbox__init.cc
new file mode 100644
index 0000000000..ff627efd96
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.117708400 +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.
+@@ -101,7 +101,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/electron32/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc b/electron32/patches/patch-services_resource__coordinator_memory__instrumentation_queued__request__dispatcher.cc
new file mode 100644
index 0000000000..abb302d4a3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.153691800 +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/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn b/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_BUILD.gn
new file mode 100644
index 0000000000..f4a2458422
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.153691800 +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/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h b/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics.h
new file mode 100644
index 0000000000..27f37df599
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.153691800 +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/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc b/electron32/patches/patch-services_resource__coordinator_public_cpp_memory__instrumentation_os__metrics__bsd.cc
new file mode 100644
index 0000000000..87f6f12737
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.593439706 +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/electron32/patches/patch-services_screen__ai_public_cpp_utilities.cc b/electron32/patches/patch-services_screen__ai_public_cpp_utilities.cc
new file mode 100644
index 0000000000..5ecfba552b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.157689800 +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/electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc b/electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.cc
new file mode 100644
index 0000000000..135dc1df19
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.161688000 +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/electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h b/electron32/patches/patch-services_screen__ai_sandbox_screen__ai__sandbox__hook__linux.h
new file mode 100644
index 0000000000..3e39abb62b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.161688000 +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/electron32/patches/patch-services_service__manager_BUILD.gn b/electron32/patches/patch-services_service__manager_BUILD.gn
new file mode 100644
index 0000000000..b1ea9c70cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.161688000 +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/electron32/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn b/electron32/patches/patch-services_service__manager_public_cpp_service__executable_BUILD.gn
new file mode 100644
index 0000000000..ba0a09a5f8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.165686100 +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/electron32/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc b/electron32/patches/patch-services_tracing_public_cpp_stack__sampling_tracing__sampler__profiler.cc
new file mode 100644
index 0000000000..bc8ef42cfa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.197671200 +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/electron32/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom b/electron32/patches/patch-services_video__capture_public_mojom_video__capture__service.mojom
new file mode 100644
index 0000000000..77130c62bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.201669500 +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/electron32/patches/patch-services_video__capture_video__capture__service__impl.cc b/electron32/patches/patch-services_video__capture_video__capture__service__impl.cc
new file mode 100644
index 0000000000..bb8a92a9b4
--- /dev/null
+++ b/electron32/patches/patch-services_video__capture_video__capture__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
+
+--- services/video_capture/video_capture_service_impl.cc.orig 2024-10-18 12:34:32.201669500 +0000
++++ services/video_capture/video_capture_service_impl.cc
+@@ -42,7 +42,7 @@
+ #include "services/video_capture/lacros/device_factory_adapter_lacros.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "media/capture/capture_switches.h"
+ #include "media/capture/video/video_capture_gpu_channel_host.h"
+ #include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
+@@ -110,7 +110,7 @@ class VideoCaptureServiceImpl::GpuDepend
+ this};
+ };
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ // Intended usage of this class is to create viz::Gpu in utility process and
+ // connect to viz::GpuClient of browser process, which will call to Gpu service.
+ // Also, this class holds the viz::ContextProvider to listen and monitor Gpu
+@@ -331,7 +331,7 @@ void VideoCaptureServiceImpl::LazyInitia
+ gpu_dependencies_context_ = std::make_unique<GpuDependenciesContext>();
+
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
+-#if BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ {
+ #else
+ if (switches::IsVideoCaptureUseGpuMemoryBufferEnabled()) {
+@@ -463,7 +463,7 @@ void VideoCaptureServiceImpl::OnGpuInfoU
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ void VideoCaptureServiceImpl::SetVizGpu(std::unique_ptr<viz::Gpu> viz_gpu) {
+ viz_gpu_ = std::move(viz_gpu);
+ }
diff --git a/electron32/patches/patch-services_video__capture_video__capture__service__impl.h b/electron32/patches/patch-services_video__capture_video__capture__service__impl.h
new file mode 100644
index 0000000000..19e768dddb
--- /dev/null
+++ b/electron32/patches/patch-services_video__capture_video__capture__service__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
+
+--- services/video_capture/video_capture_service_impl.h.orig 2024-10-18 12:34:32.201669500 +0000
++++ services/video_capture/video_capture_service_impl.h
+@@ -27,7 +27,7 @@
+ #include "services/video_capture/ash/video_capture_device_factory_ash.h"
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ #include "services/viz/public/cpp/gpu/gpu.h"
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -75,7 +75,7 @@ class VideoCaptureServiceImpl : public m
+ #if BUILDFLAG(IS_WIN)
+ void OnGpuInfoUpdate(const CHROME_LUID& luid) override;
+ #endif
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ void SetVizGpu(std::unique_ptr<viz::Gpu> viz_gpu);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) ||
+ // BUILDFLAG(IS_CHROMEOS_ASH)
+@@ -120,7 +120,7 @@ class VideoCaptureServiceImpl : public m
+ factory_receivers_ash_;
+ #endif
+
+-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) || BUILDFLAG(IS_BSD)
+ class VizGpuContextProvider;
+ std::unique_ptr<VizGpuContextProvider> viz_gpu_context_provider_;
+ std::unique_ptr<viz::Gpu> viz_gpu_;
diff --git a/electron32/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom b/electron32/patches/patch-services_viz_privileged_mojom_compositing_display__private.mojom
new file mode 100644
index 0000000000..769d782ba1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.205667500 +0000
++++ services/viz/privileged/mojom/compositing/display_private.mojom
+@@ -114,7 +114,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/electron32/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom b/electron32/patches/patch-services_viz_privileged_mojom_compositing_frame__sink__manager.mojom
new file mode 100644
index 0000000000..386f7f8282
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.205667500 +0000
++++ services/viz/privileged/mojom/compositing/frame_sink_manager.mojom
+@@ -34,6 +34,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;
+
+ [EnableIf=is_android]
+ float refresh_rate;
diff --git a/electron32/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom b/electron32/patches/patch-services_viz_privileged_mojom_compositing_layered__window__updater.mojom
new file mode 100644
index 0000000000..83eb9055af
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.205667500 +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/electron32/patches/patch-skia_ext_SkMemory__new__handler.cpp b/electron32/patches/patch-skia_ext_SkMemory__new__handler.cpp
new file mode 100644
index 0000000000..8aa99a4482
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.217661900 +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/electron32/patches/patch-skia_ext_font__utils.cc b/electron32/patches/patch-skia_ext_font__utils.cc
new file mode 100644
index 0000000000..5ee20b22ee
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.221660000 +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/electron32/patches/patch-skia_ext_platform__canvas.h b/electron32/patches/patch-skia_ext_platform__canvas.h
new file mode 100644
index 0000000000..6dbf1548cd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.221660000 +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/electron32/patches/patch-skia_ext_skcolorspace__trfn.cc b/electron32/patches/patch-skia_ext_skcolorspace__trfn.cc
new file mode 100644
index 0000000000..7c7bd8b60c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.221660000 +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/electron32/patches/patch-third__party_.gitignore b/electron32/patches/patch-third__party_.gitignore
new file mode 100644
index 0000000000..26d0e633ec
--- /dev/null
+++ b/electron32/patches/patch-third__party_.gitignore
@@ -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/.gitignore.orig 2024-10-18 12:34:32.461548000 +0000
++++ third_party/.gitignore
+@@ -48,7 +48,9 @@
+ /data_sharing_sdk
+ /devserver
+ /directxsdk
++/electron_node
+ /elfutils/src
++/engflow-reclient-configs/
+ /espresso/lib/
+ /eyesfree/src
+ /fuchsia-sdk/images
+@@ -103,6 +105,7 @@
+ /mocha
+ /mockito/src
+ /nacl_sdk_binaries/
++/nan
+ /ninja
+ /node/*.tar.gz
+ /node/linux/
+@@ -153,6 +156,7 @@
+ /spirv-headers/src
+ /spirv-tools/src
+ /sqlite4java/lib/
++/squirrel.mac
+ /subresource-filter-ruleset/data/*
+ /swift-format
+ /swift-toolchain
diff --git a/electron32/patches/patch-third__party_abseil-cpp_absl_base_config.h b/electron32/patches/patch-third__party_abseil-cpp_absl_base_config.h
new file mode 100644
index 0000000000..67cc78097e
--- /dev/null
+++ b/electron32/patches/patch-third__party_abseil-cpp_absl_base_config.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/abseil-cpp/absl/base/config.h.orig 2024-10-18 12:34:32.469544400 +0000
++++ third_party/abseil-cpp/absl/base/config.h
+@@ -412,7 +412,7 @@ 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__)
+ #define ABSL_HAVE_SCHED_YIELD 1
+ #endif
+
+@@ -427,7 +427,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__)
+ #define ABSL_HAVE_SEMAPHORE_H 1
+ #endif
+
diff --git a/electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc b/electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_raw__logging.cc
new file mode 100644
index 0000000000..3769a39ce4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.473542500 +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/electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc b/electron32/patches/patch-third__party_abseil-cpp_absl_base_internal_sysinfo.cc
new file mode 100644
index 0000000000..cd240b5291
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.477540500 +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
+
+@@ -194,6 +194,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) {
+@@ -226,6 +227,7 @@ static bool ReadLongFromFile(const char
+ }
+ return ret;
+ }
++#endif
+
+ #if defined(ABSL_INTERNAL_UNSCALED_CYCLECLOCK_FREQUENCY_IS_CPU_FREQUENCY)
+
+@@ -325,9 +327,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
+@@ -346,10 +350,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
+@@ -461,6 +467,12 @@ pid_t GetTID() {
+ return reinterpret_cast<pid_t>(thread);
+ }
+
++#elif defined(__OpenBSD__)
++
++pid_t GetTID() {
++ return getthrid();
++}
++
+ #else
+
+ // Fallback implementation of `GetTID` using `pthread_self`.
diff --git a/electron32/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h b/electron32/patches/patch-third__party_abseil-cpp_absl_debugging_internal_elf__mem__image.h
new file mode 100644
index 0000000000..75e91b7aba
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.509525800 +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(__VXWORKS__) && !defined(__hexagon__) && !defined(__FreeBSD__) && \
++ !defined(__NetBSD__)
+ #define ABSL_HAVE_ELF_MEM_IMAGE 1
+ #endif
+
diff --git a/electron32/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc b/electron32/patches/patch-third__party_abseil-cpp_absl_time_internal_cctz_src_time__zone__format.cc
new file mode 100644
index 0000000000..06ffdd653f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.581492200 +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/electron32/patches/patch-third__party_afl_src_afl-fuzz.c b/electron32/patches/patch-third__party_afl_src_afl-fuzz.c
new file mode 100644
index 0000000000..a0c7b69f9a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.685443600 +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/electron32/patches/patch-third__party_angle_BUILD.gn b/electron32/patches/patch-third__party_angle_BUILD.gn
new file mode 100644
index 0000000000..79a6d90c10
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.638903400 +0000
++++ third_party/angle/BUILD.gn
+@@ -347,7 +347,6 @@ config("extra_warnings") {
+ "-Wtautological-type-limit-compare",
+ "-Wundefined-reinterpret-cast",
+ "-Wunneeded-internal-declaration",
+- "-Wunused-but-set-variable",
+ "-Wsuggest-destructor-override",
+ "-Wsuggest-override",
+
+@@ -524,7 +523,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" ]
+ }
+
+@@ -679,6 +678,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/electron32/patches/patch-third__party_angle_src_common_platform.h b/electron32/patches/patch-third__party_angle_src_common_platform.h
new file mode 100644
index 0000000000..96c63c7f57
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.770859500 +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/electron32/patches/patch-third__party_angle_src_common_platform__helpers.h b/electron32/patches/patch-third__party_angle_src_common_platform__helpers.h
new file mode 100644
index 0000000000..21bdc1df51
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.770859500 +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/electron32/patches/patch-third__party_angle_src_common_system__utils.cpp b/electron32/patches/patch-third__party_angle_src_common_system__utils.cpp
new file mode 100644
index 0000000000..f01dfc976f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.774858200 +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/electron32/patches/patch-third__party_angle_src_common_system__utils__linux.cpp b/electron32/patches/patch-third__party_angle_src_common_system__utils__linux.cpp
new file mode 100644
index 0000000000..0fd51d8be2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.774858200 +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/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h b/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__internal.h
new file mode 100644
index 0000000000..d609fc9e72
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.850833000 +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/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp b/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__libpci.cpp
new file mode 100644
index 0000000000..e5b64c486a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.850833000 +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/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp b/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__linux.cpp
new file mode 100644
index 0000000000..7392c4e070
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.850833000 +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/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp b/electron32/patches/patch-third__party_angle_src_gpu__info__util_SystemInfo__x11.cpp
new file mode 100644
index 0000000000..1277b8dead
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.850833000 +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/electron32/patches/patch-third__party_angle_src_libANGLE_Display.cpp b/electron32/patches/patch-third__party_angle_src_libANGLE_Display.cpp
new file mode 100644
index 0000000000..789f72bae4
--- /dev/null
+++ b/electron32/patches/patch-third__party_angle_src_libANGLE_Display.cpp
@@ -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/angle/src/libANGLE/Display.cpp.orig 2024-10-18 12:37:20.866827700 +0000
++++ third_party/angle/src/libANGLE/Display.cpp
+@@ -60,7 +60,7 @@
+ # include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
+ # elif ANGLE_ENABLE_EAGL
+ # include "libANGLE/renderer/gl/eagl/DisplayEAGL.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"
+@@ -416,7 +416,7 @@ rx::DisplayImpl *CreateDisplayFromAttrib
+ impl = new rx::DisplayEAGL(state);
+ break;
+
+-# elif defined(ANGLE_PLATFORM_LINUX)
++# elif defined(ANGLE_PLATFORM_LINUX) || defined(ANGLE_PLATFORM_BSD)
+ # if defined(ANGLE_USE_GBM)
+ if (platformType == 0)
+ {
+@@ -462,7 +462,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)
+ {
+@@ -513,7 +513,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())
+ {
+@@ -2158,7 +2158,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/electron32/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp b/electron32/patches/patch-third__party_angle_src_libANGLE_formatutils.cpp
new file mode 100644
index 0000000000..a4d53c2159
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.910813000 +0000
++++ third_party/angle/src/libANGLE/formatutils.cpp
+@@ -1475,7 +1475,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/electron32/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp b/electron32/patches/patch-third__party_angle_src_libANGLE_renderer_gl_glx_FunctionsGLX.cpp
new file mode 100644
index 0000000000..c87535b6a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:20.994785300 +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/electron32/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h b/electron32/patches/patch-third__party_angle_src_libANGLE_renderer_vulkan_DisplayVk__api.h
new file mode 100644
index 0000000000..db92a6c9c9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:21.030773400 +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/electron32/patches/patch-third__party_angle_util_BUILD.gn b/electron32/patches/patch-third__party_angle_util_BUILD.gn
new file mode 100644
index 0000000000..ddbe810b63
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:21.810514700 +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/electron32/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc b/electron32/patches/patch-third__party_blink_common_renderer__preferences_renderer__preferences__mojom__traits.cc
new file mode 100644
index 0000000000..41f4e3bbc6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.965313000 +0000
++++ third_party/blink/common/renderer_preferences/renderer_preferences_mojom_traits.cc
+@@ -68,7 +68,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/electron32/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc b/electron32/patches/patch-third__party_blink_common_web__preferences_web__preferences__mojom__traits.cc
new file mode 100644
index 0000000000..46f40094c1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:32.973309300 +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/electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h b/electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences.h
new file mode 100644
index 0000000000..568c5981fd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.616547300 +0000
++++ third_party/blink/public/common/renderer_preferences/renderer_preferences.h
+@@ -65,7 +65,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/electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h b/electron32/patches/patch-third__party_blink_public_common_renderer__preferences_renderer__preferences__mojom__traits.h
new file mode 100644
index 0000000000..5b70baef31
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.616547300 +0000
++++ third_party/blink/public/common/renderer_preferences/renderer_preferences_mojom_traits.h
+@@ -166,7 +166,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/electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h b/electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences.h
new file mode 100644
index 0000000000..e2cde45ba9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.624543700 +0000
++++ third_party/blink/public/common/web_preferences/web_preferences.h
+@@ -10,6 +10,7 @@
+ #include <vector>
+
+ #include "build/build_config.h"
++#include "base/files/file_path.h"
+ #include "net/nqe/effective_connection_type.h"
+ #include "third_party/blink/public/common/common_export.h"
+ #include "third_party/blink/public/mojom/css/preferred_color_scheme.mojom-shared.h"
+@@ -441,6 +442,20 @@ struct BLINK_COMMON_EXPORT WebPreference
+ // blocking user's access to the background web content.
+ bool modal_context_menu = true;
+
++ // 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/electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h b/electron32/patches/patch-third__party_blink_public_common_web__preferences_web__preferences__mojom__traits.h
new file mode 100644
index 0000000000..4379a44d2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.624543700 +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/electron32/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom b/electron32/patches/patch-third__party_blink_public_mojom_dom__storage_storage__area.mojom
new file mode 100644
index 0000000000..210e1a2499
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.640536300 +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/electron32/patches/patch-third__party_blink_public_mojom_page_page.mojom b/electron32/patches/patch-third__party_blink_public_mojom_page_page.mojom
new file mode 100644
index 0000000000..186d08dfaa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.656528700 +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/electron32/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom b/electron32/patches/patch-third__party_blink_public_mojom_webpreferences_web__preferences.mojom
new file mode 100644
index 0000000000..f762f8d997
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.664525000 +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/electron32/patches/patch-third__party_blink_public_platform_platform.h b/electron32/patches/patch-third__party_blink_public_platform_platform.h
new file mode 100644
index 0000000000..26b3648556
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.668523300 +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
+@@ -662,6 +662,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/electron32/patches/patch-third__party_blink_public_platform_web__vector.h b/electron32/patches/patch-third__party_blink_public_platform_web__vector.h
new file mode 100644
index 0000000000..8676c132f2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.672521400 +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/electron32/patches/patch-third__party_blink_public_web_web__blob.h b/electron32/patches/patch-third__party_blink_public_web_web__blob.h
new file mode 100644
index 0000000000..a40a519a5c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +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/electron32/patches/patch-third__party_blink_public_web_web__document__loader.h b/electron32/patches/patch-third__party_blink_public_web_web__document__loader.h
new file mode 100644
index 0000000000..7b3ea8122c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +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"
+
+@@ -62,6 +63,8 @@ class BLINK_EXPORT WebDocumentLoader {
+ virtual ~ExtraData() = default;
+ };
+
++ virtual void SetDefersLoading(WebLoaderFreezeMode) = 0;
++
+ static bool WillLoadUrlAsEmpty(const WebURL&);
+
+ // Returns the http referrer of original request which initited this load.
diff --git a/electron32/patches/patch-third__party_blink_public_web_web__local__frame.h b/electron32/patches/patch-third__party_blink_public_web_web__local__frame.h
new file mode 100644
index 0000000000..99edbcb8ef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +0000
++++ third_party/blink/public/web/web_local_frame.h
+@@ -446,6 +446,7 @@ class BLINK_EXPORT WebLocalFrame : publi
+ mojom::EvaluationTiming,
+ mojom::LoadEventBlockingOption,
+ WebScriptExecutionCallback,
++ WebScriptExecutionCallbackUnmodified,
+ BackForwardCacheAware,
+ mojom::WantResultOption,
+ mojom::PromiseResultOption) = 0;
diff --git a/electron32/patches/patch-third__party_blink_public_web_web__local__frame__client.h b/electron32/patches/patch-third__party_blink_public_web_web__local__frame__client.h
new file mode 100644
index 0000000000..261eaa26bf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +0000
++++ third_party/blink/public/web/web_local_frame_client.h
+@@ -647,6 +647,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/electron32/patches/patch-third__party_blink_public_web_web__message__port__converter.h b/electron32/patches/patch-third__party_blink_public_web_web__message__port__converter.h
new file mode 100644
index 0000000000..b61adf571f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +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/electron32/patches/patch-third__party_blink_public_web_web__script__execution__callback.h b/electron32/patches/patch-third__party_blink_public_web_web__script__execution__callback.h
new file mode 100644
index 0000000000..fb633e169c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.704506600 +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/electron32/patches/patch-third__party_blink_public_web_web__view.h b/electron32/patches/patch-third__party_blink_public_web_web__view.h
new file mode 100644
index 0000000000..563a5f23a7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.708505000 +0000
++++ third_party/blink/public/web/web_view.h
+@@ -362,6 +362,7 @@ class BLINK_EXPORT WebView {
+ // Scheduling -----------------------------------------------------------
+
+ virtual PageScheduler* Scheduler() const = 0;
++ virtual void SetSchedulerThrottling(bool allowed) {}
+
+ // Visibility -----------------------------------------------------------
+
diff --git a/electron32/patches/patch-third__party_blink_public_web_web__window__features.h b/electron32/patches/patch-third__party_blink_public_web_web__window__features.h
new file mode 100644
index 0000000000..54a88b54dd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.708505000 +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 {
+
+@@ -70,6 +71,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/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc b/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_local__window__proxy.cc
new file mode 100644
index 0000000000..d44d8e51e9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.708505000 +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/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc b/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.cc
new file mode 100644
index 0000000000..a523abed30
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.740490000 +0000
++++ third_party/blink/renderer/bindings/core/v8/v8_initializer.cc
+@@ -623,7 +623,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,
+@@ -701,7 +703,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();
+@@ -744,9 +746,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.
+@@ -766,9 +765,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/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h b/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_v8__initializer.h
new file mode 100644
index 0000000000..44cb14a09b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.740490000 +0000
++++ third_party/blink/renderer/bindings/core/v8/v8_initializer.h
+@@ -84,6 +84,17 @@ class CORE_EXPORT V8Initializer {
+ v8::Local<v8::Value> data);
+ static void PromiseRejectHandlerInMainThread(v8::PromiseRejectMessage data);
+
++ 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/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc b/electron32/patches/patch-third__party_blink_renderer_bindings_core_v8_worker__or__worklet__script__controller.cc
new file mode 100644
index 0000000000..6e9886048a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.744488200 +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/electron32/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py b/electron32/patches/patch-third__party_blink_renderer_bindings_scripts_bind__gen_style__format.py
new file mode 100644
index 0000000000..369c05048e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.760480900 +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/electron32/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py b/electron32/patches/patch-third__party_blink_renderer_build_scripts_run__with__pythonpath.py
new file mode 100644
index 0000000000..443bcec7cf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.784469600 +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/electron32/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc b/electron32/patches/patch-third__party_blink_renderer_controller_blink__initializer.cc
new file mode 100644
index 0000000000..5b16c4250c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.788468000 +0000
++++ third_party/blink/renderer/controller/blink_initializer.cc
+@@ -81,12 +81,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/electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc b/electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.cc
new file mode 100644
index 0000000000..1730c9924f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.792466000 +0000
++++ third_party/blink/renderer/controller/memory_usage_monitor_posix.cc
+@@ -133,15 +133,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/electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h b/electron32/patches/patch-third__party_blink_renderer_controller_memory__usage__monitor__posix.h
new file mode 100644
index 0000000000..3f33efa730
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.792466000 +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/electron32/patches/patch-third__party_blink_renderer_core_BUILD.gn b/electron32/patches/patch-third__party_blink_renderer_core_BUILD.gn
new file mode 100644
index 0000000000..66139a4318
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.792466000 +0000
++++ third_party/blink/renderer/core/BUILD.gn
+@@ -332,6 +332,7 @@ component("core") {
+ configs -= core_config_remove
+ configs += core_config_add
+ configs += [ "//v8:external_startup_data" ]
++ configs += ["//electron/build/config:mas_build"]
+
+ public_deps = [
+ ":buildflags",
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc b/electron32/patches/patch-third__party_blink_renderer_core_css_font__face__set__document.cc
new file mode 100644
index 0000000000..643b3fe265
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:34.900416100 +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"
+@@ -150,21 +151,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/electron32/patches/patch-third__party_blink_renderer_core_editing_build.gni b/electron32/patches/patch-third__party_blink_renderer_core_editing_build.gni
new file mode 100644
index 0000000000..b5e6de1aeb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.024358700 +0000
++++ third_party/blink/renderer/core/editing/build.gni
+@@ -354,10 +354,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/electron32/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc b/electron32/patches/patch-third__party_blink_renderer_core_editing_editing__behavior.cc
new file mode 100644
index 0000000000..80d05998e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.064340400 +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/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.cc b/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.cc
new file mode 100644
index 0000000000..5e7f2a8e3b
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.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/blink/renderer/core/editing/ime/edit_context.cc.orig 2024-10-18 12:34:35.076335000 +0000
++++ third_party/blink/renderer/core/editing/ime/edit_context.cc
+@@ -758,6 +758,9 @@ bool EditContext::GetCompositionCharacte
+ bool EditContext::FirstRectForCharacterRange(uint32_t location,
+ uint32_t length,
+ gfx::Rect& rect_in_viewport) {
++ gfx::Rect rect_in_css_pixels;
++ bool found_rect = false;
++
+ if (HasValidCompositionBounds()) {
+ WebRange range = this->CompositionRange();
+ CHECK_GE(range.StartOffset(), 0);
+@@ -772,47 +775,52 @@ bool EditContext::FirstRectForCharacterR
+ if (length == 0) {
+ if (start_in_composition == character_bounds_.size()) {
+ // Zero-width rect after the last character in the composition range
+- rect_in_viewport =
++ rect_in_css_pixels =
+ gfx::Rect(character_bounds_[start_in_composition - 1].right(),
+ character_bounds_[start_in_composition - 1].y(), 0,
+ character_bounds_[start_in_composition - 1].height());
+ } else {
+ // Zero-width rect before the next character in the composition range
+- rect_in_viewport =
++ rect_in_css_pixels =
+ gfx::Rect(character_bounds_[start_in_composition].x(),
+ character_bounds_[start_in_composition].y(), 0,
+ character_bounds_[start_in_composition].height());
+ }
+ } else {
+- gfx::Rect rect = character_bounds_[start_in_composition];
++ rect_in_css_pixels = character_bounds_[start_in_composition];
+ for (size_t i = start_in_composition + 1; i < end_in_composition; ++i) {
+- rect.Union(character_bounds_[i]);
++ rect_in_css_pixels.Union(character_bounds_[i]);
+ }
+-
+- rect_in_viewport = rect;
+ }
+- return true;
++ found_rect = true;
+ }
+ }
+
+ // If we couldn't get a result from the composition bounds then we'll fall
+ // back to using the selection bounds, since these will generally be close to
+ // where the composition is happening.
+- if (!selection_bounds_.IsEmpty()) {
+- rect_in_viewport = selection_bounds_;
+- return true;
++ if (!found_rect && selection_bounds_ != gfx::Rect()) {
++ rect_in_css_pixels = selection_bounds_;
++ found_rect = true;
+ }
+
+ // If we have neither composition bounds nor selection bounds, we'll fall back
+ // to using the control bounds. In this case the IME might not be drawn
+ // exactly in the right spot, but will at least be adjacent to the editable
+ // region rather than in the corner of the screen.
+- if (!control_bounds_.IsEmpty()) {
+- rect_in_viewport = control_bounds_;
+- return true;
++ if (!found_rect && control_bounds_ != gfx::Rect()) {
++ rect_in_css_pixels = control_bounds_;
++ found_rect = true;
++ }
++
++ if (found_rect) {
++ // EditContext's coordinates are in CSS pixels, which need to be converted
++ // to physical pixels before return.
++ rect_in_viewport = gfx::ScaleToEnclosingRect(
++ rect_in_css_pixels, DomWindow()->GetFrame()->DevicePixelRatio());
+ }
+
+- return false;
++ return found_rect;
+ }
+
+ bool EditContext::HasValidCompositionBounds() const {
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.h b/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.h
new file mode 100644
index 0000000000..96afed285a
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_editing_ime_edit__context.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/blink/renderer/core/editing/ime/edit_context.h.orig 2024-10-18 12:34:35.076335000 +0000
++++ third_party/blink/renderer/core/editing/ime/edit_context.h
+@@ -139,6 +139,8 @@ class CORE_EXPORT EditContext final : pu
+ WebTextInputInfo TextInputInfo() override;
+ int ComputeWebTextInputNextPreviousFlags() override { return 0; }
+ WebRange CompositionRange() const override;
++ // Populate `bounds` with the bounds of each item in EditContext's
++ // stored character bounds, scaled to physical pixels.
+ bool GetCompositionCharacterBounds(WebVector<gfx::Rect>& bounds) override;
+ WebRange GetSelectionOffsets() const override;
+
+@@ -154,7 +156,7 @@ class CORE_EXPORT EditContext final : pu
+ void Blur();
+
+ // Populate |control_bounds| and |selection_bounds| with the bounds fetched
+- // from the active EditContext.
++ // from the active EditContext, in physical pixels.
+ void GetLayoutBounds(gfx::Rect* control_bounds,
+ gfx::Rect* selection_bounds) override;
+
+@@ -197,7 +199,7 @@ class CORE_EXPORT EditContext final : pu
+ int end,
+ bool dispatch_text_update_event = false);
+
+- // Sets rect_in_viewport to the surrounding rect, in CSS pixels,
++ // Sets rect_in_viewport to the surrounding rect, in physical pixels,
+ // for the character range specified by `location` and `length`.
+ // Returns true on success, false on failure (in which case
+ // rect_in_viewport) is not changed.
+@@ -285,6 +287,7 @@ class CORE_EXPORT EditContext final : pu
+ uint32_t selection_start_ = 0;
+ uint32_t selection_end_ = 0;
+
++ // The following bounds are in CSS pixels.
+ gfx::Rect control_bounds_;
+ gfx::Rect selection_bounds_;
+ WebVector<gfx::Rect> character_bounds_;
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc b/electron32/patches/patch-third__party_blink_renderer_core_execution__context_navigator__base.cc
new file mode 100644
index 0000000000..2f47d97bb3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.360204500 +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/electron32/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc b/electron32/patches/patch-third__party_blink_renderer_core_exported_web__blob.cc
new file mode 100644
index 0000000000..ea8cd6acc6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.364202500 +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/electron32/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc b/electron32/patches/patch-third__party_blink_renderer_core_exported_web__message__port__converter.cc
new file mode 100644
index 0000000000..ae4aa0823c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.376197000 +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/electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc b/electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
new file mode 100644
index 0000000000..ea2f82994b
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.cc
@@ -0,0 +1,91 @@
+$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 2024-10-18 12:34:35.388191500 +0000
++++ third_party/blink/renderer/core/exported/web_view_impl.cc
+@@ -168,6 +168,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"
+@@ -427,7 +428,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'
+@@ -1837,6 +1838,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)
+@@ -2461,6 +2463,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 &&
+@@ -3418,7 +3424,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(
+@@ -3974,10 +3980,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 =
+@@ -4054,11 +4073,12 @@ bool WebViewImpl::IsFencedFrameRoot() co
+ }
+
+ void WebViewImpl::SetSupportsDraggableRegions(bool supports_draggable_regions) {
+- supports_draggable_regions_ = supports_draggable_regions;
+ if (!MainFrameImpl() || !MainFrameImpl()->GetFrame()) {
+ return;
+ }
+
++ supports_draggable_regions_ = supports_draggable_regions;
++
+ LocalFrame* local_frame = MainFrameImpl()->GetFrame();
+
+ if (supports_draggable_regions_) {
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h b/electron32/patches/patch-third__party_blink_renderer_core_exported_web__view__impl.h
new file mode 100644
index 0000000000..2f41bc1600
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.388191500 +0000
++++ third_party/blink/renderer/core/exported/web_view_impl.h
+@@ -449,6 +449,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;
+@@ -930,6 +931,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/electron32/patches/patch-third__party_blink_renderer_core_frame_frame.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_frame.cc
new file mode 100644
index 0000000000..938fc47f6a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.412180400 +0000
++++ third_party/blink/renderer/core/frame/frame.cc
+@@ -130,14 +130,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);
+@@ -161,6 +153,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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__dom__window.cc
new file mode 100644
index 0000000000..4e2123fb98
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +0000
++++ third_party/blink/renderer/core/frame/local_dom_window.cc
+@@ -2240,6 +2240,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isol
+ WebWindowFeatures window_features =
+ GetWindowFeaturesFromString(features, entered_window);
+
++ window_features.raw_features = features;
++
+ // In fenced frames, we should always use `noopener`.
+ if (GetFrame()->IsInFencedFrameTree()) {
+ window_features.noopener = true;
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.cc
new file mode 100644
index 0000000000..082cedcead
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +0000
++++ third_party/blink/renderer/core/frame/local_frame.cc
+@@ -733,10 +733,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;
+
+@@ -788,6 +784,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);
+@@ -3109,6 +3110,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) {
+@@ -3142,7 +3144,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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.h b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame.h
new file mode 100644
index 0000000000..4cd93880a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +0000
++++ third_party/blink/renderer/core/frame/local_frame.h
+@@ -826,6 +826,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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client.h
new file mode 100644
index 0000000000..8dead81625
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +0000
++++ third_party/blink/renderer/core/frame/local_frame_client.h
+@@ -300,6 +300,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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.cc
new file mode 100644
index 0000000000..304937eee8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__client__impl.h
new file mode 100644
index 0000000000..261f909746
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +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/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_local__frame__mojo__handler.cc
new file mode 100644
index 0000000000..3b43dbfeae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.416178700 +0000
++++ third_party/blink/renderer/core/frame/local_frame_mojo_handler.cc
+@@ -959,6 +959,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/electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.cc
new file mode 100644
index 0000000000..784bdad3d0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.420176700 +0000
++++ third_party/blink/renderer/core/frame/pausable_script_executor.cc
+@@ -255,7 +255,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();
+@@ -270,10 +270,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) {
+@@ -295,6 +296,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();
+ }
+
+@@ -305,10 +314,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),
+@@ -432,6 +443,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/electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h b/electron32/patches/patch-third__party_blink_renderer_core_frame_pausable__script__executor.h
new file mode 100644
index 0000000000..24c66dd0ca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.420176700 +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/electron32/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_web__frame__test.cc
new file mode 100644
index 0000000000..28ab869745
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.424175000 +0000
++++ third_party/blink/renderer/core/frame/web_frame_test.cc
+@@ -294,6 +294,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);
+ }
+@@ -6477,7 +6478,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 \
+@@ -6886,7 +6887,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/electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc b/electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.cc
new file mode 100644
index 0000000000..33aa915a80
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.428173000 +0000
++++ third_party/blink/renderer/core/frame/web_local_frame_impl.cc
+@@ -1095,14 +1095,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);
+ }
+
+ v8::MaybeLocal<v8::Value> WebLocalFrameImpl::CallFunctionEvenIfScriptDisabled(
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h b/electron32/patches/patch-third__party_blink_renderer_core_frame_web__local__frame__impl.h
new file mode 100644
index 0000000000..ed0202dad3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.428173000 +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/electron32/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc b/electron32/patches/patch-third__party_blink_renderer_core_fullscreen_fullscreen.cc
new file mode 100644
index 0000000000..04e56ae05d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.428173000 +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/electron32/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc b/electron32/patches/patch-third__party_blink_renderer_core_html_canvas_canvas__async__blob__creator.cc
new file mode 100644
index 0000000000..eba14488f3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.432171300 +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/electron32/patches/patch-third__party_blink_renderer_core_html_parser_html__srcset__parser.cc b/electron32/patches/patch-third__party_blink_renderer_core_html_parser_html__srcset__parser.cc
new file mode 100644
index 0000000000..56530137e9
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_html_parser_html__srcset__parser.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
+
+--- third_party/blink/renderer/core/html/parser/html_srcset_parser.cc.orig 2024-10-18 12:34:35.468154700 +0000
++++ third_party/blink/renderer/core/html/parser/html_srcset_parser.cc
+@@ -418,7 +418,9 @@ static unsigned AvoidDownloadIfHigherDen
+ KURL url = document->CompleteURL(
+ StripLeadingAndTrailingHTMLSpaces(image_candidates[i]->Url()));
+ auto* resource = MemoryCache::Get()->ResourceForURL(
+- url, document->Fetcher()->GetCacheIdentifier(url));
++ url,
++ document->Fetcher()->GetCacheIdentifier(url,
++ /*skip_service_worker=*/false));
+ if ((resource && resource->IsLoaded()) || url.ProtocolIsData()) {
+ return i;
+ }
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc b/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__memory__agent.cc
new file mode 100644
index 0000000000..d53b378877
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.484147300 +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/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__network__agent.cc b/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__network__agent.cc
new file mode 100644
index 0000000000..1acb893ea3
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__network__agent.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/blink/renderer/core/inspector/inspector_network_agent.cc.orig 2024-10-18 12:34:35.484147300 +0000
++++ third_party/blink/renderer/core/inspector/inspector_network_agent.cc
+@@ -2440,7 +2440,8 @@ bool InspectorNetworkAgent::FetchResourc
+ Resource* cached_resource = document->Fetcher()->CachedResource(url);
+ if (!cached_resource) {
+ cached_resource = MemoryCache::Get()->ResourceForURL(
+- url, document->Fetcher()->GetCacheIdentifier(url));
++ url, document->Fetcher()->GetCacheIdentifier(
++ url, /*skip_service_worker=*/false));
+ }
+ if (cached_resource && InspectorPageAgent::CachedResourceContent(
+ cached_resource, content, base64_encoded)) {
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__page__agent.cc b/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__page__agent.cc
new file mode 100644
index 0000000000..6277b06d20
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_inspector_inspector__page__agent.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/blink/renderer/core/inspector/inspector_page_agent.cc.orig 2024-10-18 12:34:35.488145600 +0000
++++ third_party/blink/renderer/core/inspector/inspector_page_agent.cc
+@@ -176,7 +176,8 @@ Resource* CachedResource(LocalFrame* fra
+ Resource* cached_resource = document->Fetcher()->CachedResource(url);
+ if (!cached_resource) {
+ cached_resource = MemoryCache::Get()->ResourceForURL(
+- url, document->Fetcher()->GetCacheIdentifier(url));
++ url, document->Fetcher()->GetCacheIdentifier(
++ url, /*skip_service_worker=*/false));
+ }
+ if (!cached_resource)
+ cached_resource = loader->ResourceForURL(url);
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc b/electron32/patches/patch-third__party_blink_renderer_core_layout_layout__view.cc
new file mode 100644
index 0000000000..04699bd792
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.524129000 +0000
++++ third_party/blink/renderer/core/layout/layout_view.cc
+@@ -72,7 +72,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
+
+@@ -775,7 +775,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/electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc b/electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.cc
new file mode 100644
index 0000000000..562f5cd4ec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.544119800 +0000
++++ third_party/blink/renderer/core/loader/document_loader.cc
+@@ -2243,6 +2243,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
+@@ -2295,6 +2299,10 @@ scoped_refptr<SecurityOrigin> DocumentLo
+ debug_info_builder.Append(", url=");
+ debug_info_builder.Append(owner_document->Url().BaseAsString());
+ debug_info_builder.Append(")");
++ } 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/electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.h b/electron32/patches/patch-third__party_blink_renderer_core_loader_document__loader.h
new file mode 100644
index 0000000000..3eeda97304
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.544119800 +0000
++++ third_party/blink/renderer/core/loader/document_loader.h
+@@ -319,7 +319,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/electron32/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h b/electron32/patches/patch-third__party_blink_renderer_core_loader_empty__clients.h
new file mode 100644
index 0000000000..e6e07f8e67
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.544119800 +0000
++++ third_party/blink/renderer/core/loader/empty_clients.h
+@@ -412,6 +412,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/electron32/patches/patch-third__party_blink_renderer_core_loader_image__loader.cc b/electron32/patches/patch-third__party_blink_renderer_core_loader_image__loader.cc
new file mode 100644
index 0000000000..1776208c7d
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_loader_image__loader.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/blink/renderer/core/loader/image_loader.cc.orig 2024-10-18 12:34:35.544119800 +0000
++++ third_party/blink/renderer/core/loader/image_loader.cc
+@@ -710,7 +710,8 @@ bool ImageLoader::ShouldLoadImmediately(
+ // content when style recalc is over and DOM mutation is allowed again.
+ if (!url.IsNull()) {
+ Resource* resource = MemoryCache::Get()->ResourceForURL(
+- url, element_->GetDocument().Fetcher()->GetCacheIdentifier(url));
++ url, element_->GetDocument().Fetcher()->GetCacheIdentifier(
++ url, /*skip_service_worker=*/false));
+
+ if (resource && !resource->ErrorOccurred() &&
+ CanReuseFromListOfAvailableImages(
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_loader_modulescript_module__script__loader.cc b/electron32/patches/patch-third__party_blink_renderer_core_loader_modulescript_module__script__loader.cc
new file mode 100644
index 0000000000..2f073c6d0f
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_loader_modulescript_module__script__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/modulescript/module_script_loader.cc.orig 2024-10-18 12:34:35.548117900 +0000
++++ third_party/blink/renderer/core/loader/modulescript/module_script_loader.cc
+@@ -153,12 +153,20 @@ void ModuleScriptLoader::FetchInternal(
+ url_ = module_request.Url();
+ #endif
+
++ DOMWrapperWorld& request_world = modulator_->GetScriptState()->World();
++
++ // Prevents web service workers from intercepting isolated world dynamic
++ // script imports requests and responding with different contents.
++ // TODO(crbug.com/1296102): Link to documentation that describes the criteria
++ // where module imports are handled by service worker fetch handler.
++ resource_request.SetSkipServiceWorker(request_world.IsIsolatedWorld());
++
+ // <spec step="9">Set request 's destination to the result of running the
+ // fetch destination from module type steps given destination and
+ // moduleType.</spec>
+ SetFetchDestinationFromModuleType(resource_request, module_request);
+
+- ResourceLoaderOptions options(&modulator_->GetScriptState()->World());
++ ResourceLoaderOptions options(&request_world);
+
+ // <spec step="11">Set request's initiator type to "script".</spec>
+ options.initiator_info.name = fetch_initiator_type_names::kScript;
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc b/electron32/patches/patch-third__party_blink_renderer_core_paint_paint__layer.cc
new file mode 100644
index 0000000000..9fdd4fe0a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.572106800 +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/electron32/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc b/electron32/patches/patch-third__party_blink_renderer_core_scheduler__integration__tests_virtual__time__test.cc
new file mode 100644
index 0000000000..588305a7d3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.596095800 +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/electron32/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc b/electron32/patches/patch-third__party_blink_renderer_core_scroll_scrollbar__theme__aura.cc
new file mode 100644
index 0000000000..2b809ea8c5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.600094000 +0000
++++ third_party/blink/renderer/core/scroll/scrollbar_theme_aura.cc
+@@ -149,7 +149,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;
+@@ -372,7 +372,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/electron32/patches/patch-third__party_blink_renderer_core_testing_internals.cc b/electron32/patches/patch-third__party_blink_renderer_core_testing_internals.cc
new file mode 100644
index 0000000000..836f77d5de
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_core_testing_internals.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/testing/internals.cc.orig 2024-10-18 12:34:35.720039000 +0000
++++ third_party/blink/renderer/core/testing/internals.cc
+@@ -918,8 +918,8 @@ bool Internals::isLoading(const String&
+ if (!document_)
+ return false;
+ const KURL full_url = document_->CompleteURL(url);
+- const String cache_identifier =
+- document_->Fetcher()->GetCacheIdentifier(full_url);
++ const String cache_identifier = document_->Fetcher()->GetCacheIdentifier(
++ full_url, /*skip_service_worker=*/false);
+ Resource* resource =
+ MemoryCache::Get()->ResourceForURL(full_url, cache_identifier);
+ // We check loader() here instead of isLoading(), because a multipart
+@@ -931,8 +931,8 @@ bool Internals::isLoadingFromMemoryCache
+ if (!document_)
+ return false;
+ const KURL full_url = document_->CompleteURL(url);
+- const String cache_identifier =
+- document_->Fetcher()->GetCacheIdentifier(full_url);
++ const String cache_identifier = document_->Fetcher()->GetCacheIdentifier(
++ full_url, /*skip_service_worker=*/false);
+ Resource* resource =
+ MemoryCache::Get()->ResourceForURL(full_url, cache_identifier);
+ return resource && resource->GetStatus() == ResourceStatus::kCached;
diff --git a/electron32/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc b/electron32/patches/patch-third__party_blink_renderer_core_workers_worker__thread.cc
new file mode 100644
index 0000000000..0612f3aa7b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.760020500 +0000
++++ third_party/blink/renderer/core/workers/worker_thread.cc
+@@ -764,6 +764,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/electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h b/electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor.h
new file mode 100644
index 0000000000..0b403cccc2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.764018500 +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/electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc b/electron32/patches/patch-third__party_blink_renderer_core_xml_xslt__processor__libxslt.cc
new file mode 100644
index 0000000000..1474925191
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.764018500 +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/electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc b/electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__device__factory.cc
new file mode 100644
index 0000000000..60468e3a16
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.943935900 +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/electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc b/electron32/patches/patch-third__party_blink_renderer_modules_media_audio_audio__renderer__mixer__manager__test.cc
new file mode 100644
index 0000000000..245df441c8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:35.943935900 +0000
++++ third_party/blink/renderer/modules/media/audio/audio_renderer_mixer_manager_test.cc
+@@ -813,7 +813,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/electron32/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc b/electron32/patches/patch-third__party_blink_renderer_modules_peerconnection_webrtc__audio__renderer__test.cc
new file mode 100644
index 0000000000..4516ed25e7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.107860600 +0000
++++ third_party/blink/renderer/modules/peerconnection/webrtc_audio_renderer_test.cc
+@@ -302,7 +302,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/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.cc b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.cc
new file mode 100644
index 0000000000..bb1417f38c
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.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
+
+--- third_party/blink/renderer/modules/serial/serial_port_underlying_sink.cc.orig 2024-10-18 12:34:36.139846000 +0000
++++ third_party/blink/renderer/modules/serial/serial_port_underlying_sink.cc
+@@ -268,4 +268,10 @@ void SerialPortUnderlyingSink::PipeClose
+ abort_handle_.Clear();
+ }
+
++void SerialPortUnderlyingSink::Dispose() {
++ // Ensure that `watcher_` is disarmed so that `OnHandleReady()` is not called
++ // after this object becomes garbage.
++ PipeClosed();
++}
++
+ } // namespace blink
diff --git a/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.h b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.h
new file mode 100644
index 0000000000..9ce329922b
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__sink.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/modules/serial/serial_port_underlying_sink.h.orig 2024-10-18 12:34:36.139846000 +0000
++++ third_party/blink/renderer/modules/serial/serial_port_underlying_sink.h
+@@ -20,6 +20,8 @@ class SerialPort;
+ class WritableStreamDefaultController;
+
+ class SerialPortUnderlyingSink final : public UnderlyingSinkBase {
++ USING_PRE_FINALIZER(SerialPortUnderlyingSink, Dispose);
++
+ public:
+ SerialPortUnderlyingSink(SerialPort*, mojo::ScopedDataPipeProducerHandle);
+
+@@ -46,6 +48,7 @@ class SerialPortUnderlyingSink final : p
+ void OnFlushOrDrain();
+ void WriteData();
+ void PipeClosed();
++ void Dispose();
+
+ mojo::ScopedDataPipeProducerHandle data_pipe_;
+ mojo::SimpleWatcher watcher_;
diff --git a/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.cc b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.cc
new file mode 100644
index 0000000000..cef52236cb
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.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
+
+--- third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc.orig 2024-10-18 12:34:36.139846000 +0000
++++ third_party/blink/renderer/modules/serial/serial_port_underlying_source.cc
+@@ -224,4 +224,10 @@ void SerialPortUnderlyingSource::Close()
+ data_pipe_.reset();
+ }
+
++void SerialPortUnderlyingSource::Dispose() {
++ // Ensure that `watcher_` is disarmed so that `OnHandleReady()` is not called
++ // after this object becomes garbage.
++ Close();
++}
++
+ } // namespace blink
diff --git a/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.h b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.h
new file mode 100644
index 0000000000..332ddfc7c6
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_modules_serial_serial__port__underlying__source.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
+
+--- third_party/blink/renderer/modules/serial/serial_port_underlying_source.h.orig 2024-10-18 12:34:36.139846000 +0000
++++ third_party/blink/renderer/modules/serial/serial_port_underlying_source.h
+@@ -12,6 +12,7 @@
+ #include "third_party/blink/renderer/bindings/core/v8/script_value.h"
+ #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h"
+ #include "third_party/blink/renderer/core/streams/underlying_byte_source_base.h"
++#include "third_party/blink/renderer/platform/heap/prefinalizer.h"
+
+ namespace blink {
+
+@@ -20,6 +21,8 @@ class SerialPort;
+
+ class SerialPortUnderlyingSource : public UnderlyingByteSourceBase,
+ ExecutionContextLifecycleObserver {
++ USING_PRE_FINALIZER(SerialPortUnderlyingSource, Dispose);
++
+ public:
+ SerialPortUnderlyingSource(ScriptState*,
+ SerialPort*,
+@@ -47,6 +50,7 @@ class SerialPortUnderlyingSource : publi
+ void OnFlush(ScriptPromiseResolver<IDLUndefined>*);
+ void PipeClosed();
+ void Close();
++ void Dispose();
+
+ // TODO(crbug.com/1457493) : Remove when debugging is done.
+ MojoResult invalid_data_pipe_read_result_ = MOJO_RESULT_OK;
diff --git a/electron32/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc b/electron32/patches/patch-third__party_blink_renderer_modules_webaudio_audio__worklet__thread__test.cc
new file mode 100644
index 0000000000..aff99de802
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.207815000 +0000
++++ third_party/blink/renderer/modules/webaudio/audio_worklet_thread_test.cc
+@@ -468,7 +468,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/electron32/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc b/electron32/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__base.cc
new file mode 100644
index 0000000000..f08b2665d1
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_modules_webgl_webgl__rendering__context__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/modules/webgl/webgl_rendering_context_base.cc.orig 2024-10-18 12:34:36.343752600 +0000
++++ third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc
+@@ -6304,7 +6304,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/electron32/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc b/electron32/patches/patch-third__party_blink_renderer_modules_webgpu_gpu__queue.cc
new file mode 100644
index 0000000000..cd34742d6a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.351749000 +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/electron32/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc b/electron32/patches/patch-third__party_blink_renderer_modules_websockets_websocket__channel__impl.cc
new file mode 100644
index 0000000000..3c9461571d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.359745300 +0000
++++ third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc
+@@ -103,6 +103,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
+
+ void WebSocketChannelImpl::MessageDataDeleter::operator()(char* p) const {
+@@ -293,7 +304,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/electron32/patches/patch-third__party_blink_renderer_platform_BUILD.gn b/electron32/patches/patch-third__party_blink_renderer_platform_BUILD.gn
new file mode 100644
index 0000000000..80aa3fc010
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_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/blink/renderer/platform/BUILD.gn.orig 2024-10-18 12:34:36.419717800 +0000
++++ third_party/blink/renderer/platform/BUILD.gn
+@@ -2003,7 +2003,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",
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc b/electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.cc
new file mode 100644
index 0000000000..5f92a1ccd2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.475692300 +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/electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h b/electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.h
new file mode 100644
index 0000000000..ef400d2010
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_bindings_script__state.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/platform/bindings/script_state.h.orig 2024-10-18 12:34:36.475692300 +0000
++++ third_party/blink/renderer/platform/bindings/script_state.h
+@@ -184,7 +184,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 =
+@@ -251,9 +256,15 @@ 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);
++ static constexpr int kV8ContextPerContextDataTagIndex =
++ static_cast<int>(gin::kPerContextDataStartIndex) +
++ static_cast<int>(gin::kEmbedderBlink) +
++ static_cast<int>(gin::kEmbedderBlinkTag);
+ };
+
+ // ScriptStateProtectingContext keeps the context associated with the
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.cc
new file mode 100644
index 0000000000..f3f26d342f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.495683200 +0000
++++ third_party/blink/renderer/platform/fonts/font_cache.cc
+@@ -79,7 +79,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
+
+@@ -130,7 +130,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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__cache.h
new file mode 100644
index 0000000000..9713f8ae75
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.495683200 +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
+
+@@ -165,7 +165,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_; }
+@@ -241,7 +241,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*);
+@@ -314,7 +314,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&,
+@@ -351,7 +351,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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__description.cc
new file mode 100644
index 0000000000..dca1417d10
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.495683200 +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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__metrics.cc
new file mode 100644
index 0000000000..c08d15d7b9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.495683200 +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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__platform__data.cc
new file mode 100644
index 0000000000..5741bdcb03
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.499681200 +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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_font__unique__name__lookup.cc
new file mode 100644
index 0000000000..0b02ab8a43
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.511675800 +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/electron32/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc b/electron32/patches/patch-third__party_blink_renderer_platform_fonts_skia_font__cache__skia.cc
new file mode 100644
index 0000000000..5a493bd7d1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.519672200 +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/electron32/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc b/electron32/patches/patch-third__party_blink_renderer_platform_graphics_begin__frame__provider.cc
new file mode 100644
index 0000000000..57b7a1c910
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.527668500 +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/electron32/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc b/electron32/patches/patch-third__party_blink_renderer_platform_graphics_video__frame__submitter.cc
new file mode 100644
index 0000000000..3e090a773b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.627622600 +0000
++++ third_party/blink/renderer/platform/graphics/video_frame_submitter.cc
+@@ -418,7 +418,7 @@ void VideoFrameSubmitter::OnBeginFrame(
+ continue;
+ auto& feedback =
+ timing_details.find(frame_token)->value.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/electron32/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc b/electron32/patches/patch-third__party_blink_renderer_platform_instrumentation_partition__alloc__memory__dump__provider.cc
new file mode 100644
index 0000000000..e2aecfe727
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.659608100 +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/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.cc b/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.cc
new file mode 100644
index 0000000000..06d6dc3159
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.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/blink/renderer/platform/loader/fetch/resource_fetcher.cc.orig 2024-10-18 12:34:36.915490900 +0000
++++ third_party/blink/renderer/platform/loader/fetch/resource_fetcher.cc
+@@ -973,7 +973,8 @@ Resource* ResourceFetcher::CreateResourc
+ if (!archive_ && factory.GetType() == ResourceType::kRaw)
+ return nullptr;
+
+- const String cache_identifier = GetCacheIdentifier(url);
++ const String cache_identifier = GetCacheIdentifier(
++ url, params.GetResourceRequest().GetSkipServiceWorker());
+ // Most off-main-thread resource fetches use Resource::kRaw and don't reach
+ // this point, but off-main-thread module fetches might.
+ if (IsMainThread()) {
+@@ -1414,7 +1415,10 @@ Resource* ResourceFetcher::RequestResour
+ resource = nullptr;
+ } else {
+ resource = MemoryCache::Get()->ResourceForURL(
+- params.Url(), GetCacheIdentifier(params.Url()));
++ params.Url(),
++ GetCacheIdentifier(
++ params.Url(),
++ params.GetResourceRequest().GetSkipServiceWorker()));
+ }
+ if (resource) {
+ policy = DetermineRevalidationPolicy(resource_type, params, *resource,
+@@ -1712,7 +1716,8 @@ Resource* ResourceFetcher::CreateResourc
+ const FetchParameters& params,
+ const ResourceFactory& factory) {
+ const String cache_identifier =
+- GetCacheIdentifier(params.GetResourceRequest().Url());
++ GetCacheIdentifier(params.GetResourceRequest().Url(),
++ params.GetResourceRequest().GetSkipServiceWorker());
+ if (!base::FeatureList::IsEnabled(
+ blink::features::kScopeMemoryCachePerContext)) {
+ DCHECK(!IsMainThread() || params.IsStaleRevalidation() ||
+@@ -2784,9 +2789,11 @@ void ResourceFetcher::UpdateAllImageReso
+ to_be_removed.clear();
+ }
+
+-String ResourceFetcher::GetCacheIdentifier(const KURL& url) const {
+- if (properties_->GetControllerServiceWorkerMode() !=
+- mojom::ControllerServiceWorkerMode::kNoController) {
++String ResourceFetcher::GetCacheIdentifier(const KURL& url,
++ bool skip_service_worker) const {
++ if (!skip_service_worker &&
++ properties_->GetControllerServiceWorkerMode() !=
++ mojom::ControllerServiceWorkerMode::kNoController) {
+ return String::Number(properties_->ServiceWorkerId());
+ }
+
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.h b/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.h
new file mode 100644
index 0000000000..27ea78c046
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_loader_fetch_resource__fetcher.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/blink/renderer/platform/loader/fetch/resource_fetcher.h.orig 2024-10-18 12:34:36.915490900 +0000
++++ third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h
+@@ -278,7 +278,11 @@ class PLATFORM_EXPORT ResourceFetcher
+ uint32_t inflight_keepalive_bytes);
+ blink::mojom::ControllerServiceWorkerMode IsControlledByServiceWorker() const;
+
+- String GetCacheIdentifier(const KURL& url) const;
++ // Returns a cache identifier for MemoryCache.
++ // `url` is used for finding a matching WebBundle.
++ // If `skip_service_worker` is true, the identifier won't be a ServiceWorker's
++ // identifier to keep the cache separated.
++ String GetCacheIdentifier(const KURL& url, bool skip_service_worker) const;
+
+ // If `url` exists as a resource in a subresource bundle in this frame,
+ // returns its UnguessableToken; otherwise, returns std::nullopt.
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc b/electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.cc
new file mode 100644
index 0000000000..0b310c285b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.927485500 +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().SchemeIsHTTPOrHTTPS();
++
++ const std::string scheme = url_data_->url().scheme();
++ for (const std::string& streaming_scheme : *GetStreamingSchemes()) {
++ if (base::EqualsCaseInsensitiveASCII(scheme, streaming_scheme)) {
++ return false;
++ }
++ }
++ return true;
+ }
+
+ void MultiBufferDataSource::SetReader(
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h b/electron32/patches/patch-third__party_blink_renderer_platform_media_multi__buffer__data__source.h
new file mode 100644
index 0000000000..ceda89060e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.927485500 +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/electron32/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc b/electron32/patches/patch-third__party_blink_renderer_platform_peerconnection_rtc__video__encoder__factory.cc
new file mode 100644
index 0000000000..eaf2b76af1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.943478000 +0000
++++ third_party/blink/renderer/platform/peerconnection/rtc_video_encoder_factory.cc
+@@ -254,12 +254,12 @@ SupportedFormats GetSupportedFormatsInte
+ supported_formats.scalability_modes.push_back(profile.scalability_modes);
+ supported_formats.sdp_formats.push_back(std::move(*format));
+
+-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #if BUILDFLAG(IS_WIN)
+ const bool kShouldAddH264Cbp =
+ base::FeatureList::IsEnabled(kMediaFoundationH264CbpEncoding) &&
+ profile.profile == media::VideoCodecProfile::H264PROFILE_BASELINE;
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ const bool kShouldAddH264Cbp =
+ profile.profile == media::VideoCodecProfile::H264PROFILE_BASELINE;
+ #endif
diff --git a/electron32/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5 b/electron32/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
new file mode 100644
index 0000000000..2544c4772d
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_runtime__enabled__features.json5
@@ -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/blink/renderer/platform/runtime_enabled_features.json5.orig 2024-10-18 12:34:36.943478000 +0000
++++ third_party/blink/renderer/platform/runtime_enabled_features.json5
+@@ -344,7 +344,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",
+ },
+ {
+@@ -1703,7 +1703,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,
+ },
+ {
+@@ -3105,7 +3105,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: "experimental",
+ public: true,
+ base_feature_status: "enabled",
+@@ -3232,7 +3232,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",
+@@ -4195,7 +4195,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
+@@ -4364,7 +4364,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",
+ },
+@@ -4407,7 +4407,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/electron32/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc b/electron32/patches/patch-third__party_blink_renderer_platform_scheduler_common_thread.cc
new file mode 100644
index 0000000000..5927ccc3b4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.947476100 +0000
++++ third_party/blink/renderer/platform/scheduler/common/thread.cc
+@@ -82,7 +82,7 @@ void Thread::CreateAndSetCompositorThrea
+ std::make_unique<scheduler::CompositorThread>(params);
+ compositor_thread->Init();
+
+-#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/electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc b/electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_blink__categorized__worker__pool__delegate.cc
new file mode 100644
index 0000000000..9d26edaf1d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.983459700 +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/electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc b/electron32/patches/patch-third__party_blink_renderer_platform_widget_compositing_layer__tree__view.cc
new file mode 100644
index 0000000000..112908c95f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.983459700 +0000
++++ third_party/blink/renderer/platform/widget/compositing/layer_tree_view.cc
+@@ -375,9 +375,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/electron32/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h b/electron32/patches/patch-third__party_blink_renderer_platform_wtf_container__annotations.h
new file mode 100644
index 0000000000..3c061216c7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.991456000 +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/electron32/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h b/electron32/patches/patch-third__party_blink_renderer_platform_wtf_math__extras.h
new file mode 100644
index 0000000000..2832c1e9fc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.995454300 +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/electron32/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc b/electron32/patches/patch-third__party_blink_renderer_platform_wtf_stack__util.cc
new file mode 100644
index 0000000000..5f4a6a0e17
--- /dev/null
+++ b/electron32/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 2024-10-18 12:34:36.995454300 +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__)
+@@ -154,6 +164,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/electron32/patches/patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.cc b/electron32/patches/patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.cc
new file mode 100644
index 0000000000..03a6a9ac9a
--- /dev/null
+++ b/electron32/patches/patch-third__party_blink_renderer_platform_wtf_text_text__codec__icu.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/wtf/text/text_codec_icu.cc.orig 2024-10-18 12:34:36.999452400 +0000
++++ third_party/blink/renderer/platform/wtf/text/text_codec_icu.cc
+@@ -615,6 +615,7 @@ static void GbkUrlEscapedEntityCallack(
+ code_point, reason, err);
+ }
+
++#if !BUILDFLAG(IS_BSD)
+ static void GbkCallbackSubstitute(const void* context,
+ UConverterFromUnicodeArgs* from_unicode_args,
+ const UChar* code_units,
+@@ -632,6 +633,7 @@ static void GbkCallbackSubstitute(const
+ UCNV_FROM_U_CALLBACK_SUBSTITUTE(context, from_unicode_args, code_units,
+ length, code_point, reason, err);
+ }
++#endif
+ #endif // USING_SYSTEM_ICU
+
+ static void NotReachedEntityCallback(const void* context,
diff --git a/electron32/patches/patch-third__party_boringssl_BUILD.gn b/electron32/patches/patch-third__party_boringssl_BUILD.gn
new file mode 100644
index 0000000000..5e07f3d36a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.083761700 +0000
++++ third_party/boringssl/BUILD.gn
+@@ -48,6 +48,21 @@ config("no_asm_config") {
+ all_sources = crypto_sources + ssl_sources + pki_sources + pki_internal_headers
+ all_headers = crypto_headers + ssl_headers + pki_headers + pki_internal_headers
+
++if (is_electron_build) {
++ # Needed to build a nodejs-compatible boringssl.
++ all_sources += [
++ "src/decrepit/evp/evp_do_all.c",
++ "src/decrepit/xts/xts.c",
++ ]
++
++ all_sources += [
++ "src/decrepit/blowfish/blowfish.c",
++ "src/decrepit/cfb/cfb.c",
++ "src/decrepit/ripemd/internal.h",
++ "src/decrepit/ripemd/ripemd.c",
++ ]
++}
++
+ if (enable_rust) {
+ rust_bindgen("raw_bssl_sys_bindings") {
+ header = "src/rust/bssl-sys/wrapper.h"
diff --git a/electron32/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c b/electron32/patches/patch-third__party_boringssl_src_crypto_cipher__extra_cipher__extra.c
new file mode 100644
index 0000000000..4fb9d324d3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:00.445640000 +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/electron32/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c b/electron32/patches/patch-third__party_boringssl_src_crypto_digest__extra_digest__extra.c
new file mode 100644
index 0000000000..264740706c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:00.565600000 +0000
++++ third_party/boringssl/src/crypto/digest_extra/digest_extra.c
+@@ -85,6 +85,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/electron32/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c b/electron32/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c
new file mode 100644
index 0000000000..f7178bedca
--- /dev/null
+++ b/electron32/patches/patch-third__party_boringssl_src_crypto_fipsmodule_digest_digests.c
@@ -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.orig 2024-10-18 12:37:00.617582300 +0000
++++ third_party/boringssl/src/crypto/fipsmodule/digest/digests.c
+@@ -63,6 +63,7 @@
+ #include <openssl/md5.h>
+ #include <openssl/nid.h>
+ #include <openssl/sha.h>
++#include <openssl/ripemd.h>
+
+ #include "internal.h"
+ #include "../delocate.h"
+@@ -301,4 +302,27 @@ DEFINE_METHOD_FUNCTION(EVP_MD, EVP_md5_s
+ out->ctx_size = sizeof(MD5_SHA1_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/electron32/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c b/electron32/patches/patch-third__party_boringssl_src_decrepit_evp_evp__do__all.c
new file mode 100644
index 0000000000..a17b2dbc90
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:00.749538200 +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/electron32/patches/patch-third__party_boringssl_src_include_openssl_cipher.h b/electron32/patches/patch-third__party_boringssl_src_include_openssl_cipher.h
new file mode 100644
index 0000000000..c025faae0b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:00.925479000 +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/electron32/patches/patch-third__party_boringssl_src_include_openssl_digest.h b/electron32/patches/patch-third__party_boringssl_src_include_openssl_digest.h
new file mode 100644
index 0000000000..e104494181
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:00.925479000 +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/electron32/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc b/electron32/patches/patch-third__party_boringssl_src_ssl_ssl__buffer.cc
new file mode 100644
index 0000000000..f0f7c13b4a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:01.041440000 +0000
++++ third_party/boringssl/src/ssl/ssl_buffer.cc
+@@ -232,7 +232,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/electron32/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc b/electron32/patches/patch-third__party_boringssl_src_ssl_ssl__lib.cc
new file mode 100644
index 0000000000..9b62b7cdc7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:01.045438800 +0000
++++ third_party/boringssl/src/ssl/ssl_lib.cc
+@@ -1336,7 +1336,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
+@@ -2718,13 +2718,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/electron32/patches/patch-third__party_brotli_common_platform.h b/electron32/patches/patch-third__party_brotli_common_platform.h
new file mode 100644
index 0000000000..caf3c37aaa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.091758500 +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/electron32/patches/patch-third__party_cpuinfo_cpuinfo.gni b/electron32/patches/patch-third__party_cpuinfo_cpuinfo.gni
new file mode 100644
index 0000000000..385abe19df
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.195716000 +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/electron32/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni b/electron32/patches/patch-third__party_crashpad_crashpad_build_crashpad__buildconfig.gni
new file mode 100644
index 0000000000..4b5a88cac1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.215707800 +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/electron32/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn b/electron32/patches/patch-third__party_crashpad_crashpad_client_BUILD.gn
new file mode 100644
index 0000000000..c485007f50
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.215707800 +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/electron32/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc b/electron32/patches/patch-third__party_crashpad_crashpad_client_crashpad__client__posix.cc
new file mode 100644
index 0000000000..1391b0b39d
--- /dev/null
+++ b/electron32/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-01-06 07:57:04.946825786 +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/electron32/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc b/electron32/patches/patch-third__party_crashpad_crashpad_minidump_minidump__misc__info__writer.cc
new file mode 100644
index 0000000000..3bff5b1549
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.267686400 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h b/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_address__types.h
new file mode 100644
index 0000000000..27127864b1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.351652100 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h b/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_capture__context.h
new file mode 100644
index 0000000000..07a711c90b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.351652100 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_metrics.cc
new file mode 100644
index 0000000000..194dbdc762
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.351652100 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_misc_uuid.cc
new file mode 100644
index 0000000000..ba513fce40
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.351652100 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_close__multiple.cc
new file mode 100644
index 0000000000..e0bd03b195
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.355650400 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_drop__privileges.cc
new file mode 100644
index 0000000000..85b63259e8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.355650400 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_signals.cc
new file mode 100644
index 0000000000..6c9846b635
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.355650400 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_posix_symbolic__constants__posix.cc
new file mode 100644
index 0000000000..b7a80ed4e3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.355650400 +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/electron32/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc b/electron32/patches/patch-third__party_crashpad_crashpad_util_win_exception__handler__server.cc
new file mode 100644
index 0000000000..7990a71122
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.359648700 +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/electron32/patches/patch-third__party_crc32c_BUILD.gn b/electron32/patches/patch-third__party_crc32c_BUILD.gn
new file mode 100644
index 0000000000..37f0ec33b1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.363647200 +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/electron32/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h b/electron32/patches/patch-third__party_dawn_include_dawn_native_VulkanBackend.h
new file mode 100644
index 0000000000..d2690ea7ad
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:00.669727800 +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/electron32/patches/patch-third__party_dawn_src_dawn_common_Platform.h b/electron32/patches/patch-third__party_dawn_src_dawn_common_Platform.h
new file mode 100644
index 0000000000..a85bf1c64b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:00.677725300 +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/electron32/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp b/electron32/patches/patch-third__party_dawn_src_dawn_native_vulkan_BackendVk.cpp
new file mode 100644
index 0000000000..708aa12f4c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:00.957633700 +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/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness.cc b/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness.cc
new file mode 100644
index 0000000000..716caaf635
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness.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/dawn/src/tint/lang/core/ir/transform/robustness.cc.orig 2024-10-18 12:38:01.301521300 +0000
++++ third_party/dawn/src/tint/lang/core/ir/transform/robustness.cc
+@@ -316,7 +316,6 @@ struct State {
+ break;
+ }
+ case core::BuiltinFn::kTextureLoad: {
+- clamp_coords(1u);
+ uint32_t next_arg = 2u;
+ if (type::IsTextureArray(texture->dim())) {
+ clamp_array_index(next_arg++);
+@@ -324,6 +323,7 @@ struct State {
+ if (texture->IsAnyOf<type::SampledTexture, type::DepthTexture>()) {
+ clamp_level(next_arg++);
+ }
++ clamp_coords(1u); // Must run after clamp_level
+ break;
+ }
+ case core::BuiltinFn::kTextureStore: {
diff --git a/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness__test.cc b/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness__test.cc
new file mode 100644
index 0000000000..addf49230c
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_src_tint_lang_core_ir_transform_robustness__test.cc
@@ -0,0 +1,339 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/dawn/src/tint/lang/core/ir/transform/robustness_test.cc.orig 2024-10-18 12:38:01.313517300 +0000
++++ third_party/dawn/src/tint/lang/core/ir/transform/robustness_test.cc
+@@ -2103,28 +2103,28 @@ $B1: { # root
+ %load_signed = func(%coords:i32, %level:i32):vec4<f32> {
+ $B2: {
+ %5:texture_1d<f32> = load %texture
+- %6:u32 = textureDimensions %5
++ %6:u32 = textureNumLevels %5
+ %7:u32 = sub %6, 1u
+- %8:u32 = convert %coords
++ %8:u32 = convert %level
+ %9:u32 = min %8, %7
+- %10:u32 = textureNumLevels %5
++ %10:u32 = textureDimensions %5, %9
+ %11:u32 = sub %10, 1u
+- %12:u32 = convert %level
++ %12:u32 = convert %coords
+ %13:u32 = min %12, %11
+- %14:vec4<f32> = textureLoad %5, %9, %13
++ %14:vec4<f32> = textureLoad %5, %13, %9
+ ret %14
+ }
+ }
+ %load_unsigned = func(%coords_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level'
+ $B3: {
+ %18:texture_1d<f32> = load %texture
+- %19:u32 = textureDimensions %18
++ %19:u32 = textureNumLevels %18
+ %20:u32 = sub %19, 1u
+- %21:u32 = min %coords_1, %20
+- %22:u32 = textureNumLevels %18
++ %21:u32 = min %level_1, %20
++ %22:u32 = textureDimensions %18, %21
+ %23:u32 = sub %22, 1u
+- %24:u32 = min %level_1, %23
+- %25:vec4<f32> = textureLoad %18, %21, %24
++ %24:u32 = min %coords_1, %23
++ %25:vec4<f32> = textureLoad %18, %24, %21
+ ret %25
+ }
+ }
+@@ -2200,28 +2200,28 @@ $B1: { # root
+ %load_signed = func(%coords:vec2<i32>, %level:i32):vec4<f32> {
+ $B2: {
+ %5:texture_2d<f32> = load %texture
+- %6:vec2<u32> = textureDimensions %5
+- %7:vec2<u32> = sub %6, vec2<u32>(1u)
+- %8:vec2<u32> = convert %coords
+- %9:vec2<u32> = min %8, %7
+- %10:u32 = textureNumLevels %5
+- %11:u32 = sub %10, 1u
+- %12:u32 = convert %level
+- %13:u32 = min %12, %11
+- %14:vec4<f32> = textureLoad %5, %9, %13
++ %6:u32 = textureNumLevels %5
++ %7:u32 = sub %6, 1u
++ %8:u32 = convert %level
++ %9:u32 = min %8, %7
++ %10:vec2<u32> = textureDimensions %5, %9
++ %11:vec2<u32> = sub %10, vec2<u32>(1u)
++ %12:vec2<u32> = convert %coords
++ %13:vec2<u32> = min %12, %11
++ %14:vec4<f32> = textureLoad %5, %13, %9
+ ret %14
+ }
+ }
+ %load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level'
+ $B3: {
+ %18:texture_2d<f32> = load %texture
+- %19:vec2<u32> = textureDimensions %18
+- %20:vec2<u32> = sub %19, vec2<u32>(1u)
+- %21:vec2<u32> = min %coords_1, %20
+- %22:u32 = textureNumLevels %18
+- %23:u32 = sub %22, 1u
+- %24:u32 = min %level_1, %23
+- %25:vec4<f32> = textureLoad %18, %21, %24
++ %19:u32 = textureNumLevels %18
++ %20:u32 = sub %19, 1u
++ %21:u32 = min %level_1, %20
++ %22:vec2<u32> = textureDimensions %18, %21
++ %23:vec2<u32> = sub %22, vec2<u32>(1u)
++ %24:vec2<u32> = min %coords_1, %23
++ %25:vec4<f32> = textureLoad %18, %24, %21
+ ret %25
+ }
+ }
+@@ -2300,35 +2300,35 @@ $B1: { # root
+ %load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):vec4<f32> {
+ $B2: {
+ %6:texture_2d_array<f32> = load %texture
+- %7:vec2<u32> = textureDimensions %6
+- %8:vec2<u32> = sub %7, vec2<u32>(1u)
+- %9:vec2<u32> = convert %coords
+- %10:vec2<u32> = min %9, %8
+- %11:u32 = textureNumLayers %6
++ %7:u32 = textureNumLayers %6
++ %8:u32 = sub %7, 1u
++ %9:u32 = convert %layer
++ %10:u32 = min %9, %8
++ %11:u32 = textureNumLevels %6
+ %12:u32 = sub %11, 1u
+- %13:u32 = convert %layer
++ %13:u32 = convert %level
+ %14:u32 = min %13, %12
+- %15:u32 = textureNumLevels %6
+- %16:u32 = sub %15, 1u
+- %17:u32 = convert %level
+- %18:u32 = min %17, %16
+- %19:vec4<f32> = textureLoad %6, %10, %14, %18
++ %15:vec2<u32> = textureDimensions %6, %14
++ %16:vec2<u32> = sub %15, vec2<u32>(1u)
++ %17:vec2<u32> = convert %coords
++ %18:vec2<u32> = min %17, %16
++ %19:vec4<f32> = textureLoad %6, %18, %10, %14
+ ret %19
+ }
+ }
+ %load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level'
+ $B3: {
+ %24:texture_2d_array<f32> = load %texture
+- %25:vec2<u32> = textureDimensions %24
+- %26:vec2<u32> = sub %25, vec2<u32>(1u)
+- %27:vec2<u32> = min %coords_1, %26
+- %28:u32 = textureNumLayers %24
++ %25:u32 = textureNumLayers %24
++ %26:u32 = sub %25, 1u
++ %27:u32 = min %layer_1, %26
++ %28:u32 = textureNumLevels %24
+ %29:u32 = sub %28, 1u
+- %30:u32 = min %layer_1, %29
+- %31:u32 = textureNumLevels %24
+- %32:u32 = sub %31, 1u
+- %33:u32 = min %level_1, %32
+- %34:vec4<f32> = textureLoad %24, %27, %30, %33
++ %30:u32 = min %level_1, %29
++ %31:vec2<u32> = textureDimensions %24, %30
++ %32:vec2<u32> = sub %31, vec2<u32>(1u)
++ %33:vec2<u32> = min %coords_1, %32
++ %34:vec4<f32> = textureLoad %24, %33, %27, %30
+ ret %34
+ }
+ }
+@@ -2404,28 +2404,28 @@ $B1: { # root
+ %load_signed = func(%coords:vec3<i32>, %level:i32):vec4<f32> {
+ $B2: {
+ %5:texture_3d<f32> = load %texture
+- %6:vec3<u32> = textureDimensions %5
+- %7:vec3<u32> = sub %6, vec3<u32>(1u)
+- %8:vec3<u32> = convert %coords
+- %9:vec3<u32> = min %8, %7
+- %10:u32 = textureNumLevels %5
+- %11:u32 = sub %10, 1u
+- %12:u32 = convert %level
+- %13:u32 = min %12, %11
+- %14:vec4<f32> = textureLoad %5, %9, %13
++ %6:u32 = textureNumLevels %5
++ %7:u32 = sub %6, 1u
++ %8:u32 = convert %level
++ %9:u32 = min %8, %7
++ %10:vec3<u32> = textureDimensions %5, %9
++ %11:vec3<u32> = sub %10, vec3<u32>(1u)
++ %12:vec3<u32> = convert %coords
++ %13:vec3<u32> = min %12, %11
++ %14:vec4<f32> = textureLoad %5, %13, %9
+ ret %14
+ }
+ }
+ %load_unsigned = func(%coords_1:vec3<u32>, %level_1:u32):vec4<f32> { # %coords_1: 'coords', %level_1: 'level'
+ $B3: {
+ %18:texture_3d<f32> = load %texture
+- %19:vec3<u32> = textureDimensions %18
+- %20:vec3<u32> = sub %19, vec3<u32>(1u)
+- %21:vec3<u32> = min %coords_1, %20
+- %22:u32 = textureNumLevels %18
+- %23:u32 = sub %22, 1u
+- %24:u32 = min %level_1, %23
+- %25:vec4<f32> = textureLoad %18, %21, %24
++ %19:u32 = textureNumLevels %18
++ %20:u32 = sub %19, 1u
++ %21:u32 = min %level_1, %20
++ %22:vec3<u32> = textureDimensions %18, %21
++ %23:vec3<u32> = sub %22, vec3<u32>(1u)
++ %24:vec3<u32> = min %coords_1, %23
++ %25:vec4<f32> = textureLoad %18, %24, %21
+ ret %25
+ }
+ }
+@@ -2589,28 +2589,28 @@ $B1: { # root
+ %load_signed = func(%coords:vec2<i32>, %level:i32):f32 {
+ $B2: {
+ %5:texture_depth_2d = load %texture
+- %6:vec2<u32> = textureDimensions %5
+- %7:vec2<u32> = sub %6, vec2<u32>(1u)
+- %8:vec2<u32> = convert %coords
+- %9:vec2<u32> = min %8, %7
+- %10:u32 = textureNumLevels %5
+- %11:u32 = sub %10, 1u
+- %12:u32 = convert %level
+- %13:u32 = min %12, %11
+- %14:f32 = textureLoad %5, %9, %13
++ %6:u32 = textureNumLevels %5
++ %7:u32 = sub %6, 1u
++ %8:u32 = convert %level
++ %9:u32 = min %8, %7
++ %10:vec2<u32> = textureDimensions %5, %9
++ %11:vec2<u32> = sub %10, vec2<u32>(1u)
++ %12:vec2<u32> = convert %coords
++ %13:vec2<u32> = min %12, %11
++ %14:f32 = textureLoad %5, %13, %9
+ ret %14
+ }
+ }
+ %load_unsigned = func(%coords_1:vec2<u32>, %level_1:u32):f32 { # %coords_1: 'coords', %level_1: 'level'
+ $B3: {
+ %18:texture_depth_2d = load %texture
+- %19:vec2<u32> = textureDimensions %18
+- %20:vec2<u32> = sub %19, vec2<u32>(1u)
+- %21:vec2<u32> = min %coords_1, %20
+- %22:u32 = textureNumLevels %18
+- %23:u32 = sub %22, 1u
+- %24:u32 = min %level_1, %23
+- %25:f32 = textureLoad %18, %21, %24
++ %19:u32 = textureNumLevels %18
++ %20:u32 = sub %19, 1u
++ %21:u32 = min %level_1, %20
++ %22:vec2<u32> = textureDimensions %18, %21
++ %23:vec2<u32> = sub %22, vec2<u32>(1u)
++ %24:vec2<u32> = min %coords_1, %23
++ %25:f32 = textureLoad %18, %24, %21
+ ret %25
+ }
+ }
+@@ -2688,35 +2688,35 @@ $B1: { # root
+ %load_signed = func(%coords:vec2<i32>, %layer:i32, %level:i32):f32 {
+ $B2: {
+ %6:texture_depth_2d_array = load %texture
+- %7:vec2<u32> = textureDimensions %6
+- %8:vec2<u32> = sub %7, vec2<u32>(1u)
+- %9:vec2<u32> = convert %coords
+- %10:vec2<u32> = min %9, %8
+- %11:u32 = textureNumLayers %6
++ %7:u32 = textureNumLayers %6
++ %8:u32 = sub %7, 1u
++ %9:u32 = convert %layer
++ %10:u32 = min %9, %8
++ %11:u32 = textureNumLevels %6
+ %12:u32 = sub %11, 1u
+- %13:u32 = convert %layer
++ %13:u32 = convert %level
+ %14:u32 = min %13, %12
+- %15:u32 = textureNumLevels %6
+- %16:u32 = sub %15, 1u
+- %17:u32 = convert %level
+- %18:u32 = min %17, %16
+- %19:f32 = textureLoad %6, %10, %14, %18
++ %15:vec2<u32> = textureDimensions %6, %14
++ %16:vec2<u32> = sub %15, vec2<u32>(1u)
++ %17:vec2<u32> = convert %coords
++ %18:vec2<u32> = min %17, %16
++ %19:f32 = textureLoad %6, %18, %10, %14
+ ret %19
+ }
+ }
+ %load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32, %level_1:u32):f32 { # %coords_1: 'coords', %layer_1: 'layer', %level_1: 'level'
+ $B3: {
+ %24:texture_depth_2d_array = load %texture
+- %25:vec2<u32> = textureDimensions %24
+- %26:vec2<u32> = sub %25, vec2<u32>(1u)
+- %27:vec2<u32> = min %coords_1, %26
+- %28:u32 = textureNumLayers %24
++ %25:u32 = textureNumLayers %24
++ %26:u32 = sub %25, 1u
++ %27:u32 = min %layer_1, %26
++ %28:u32 = textureNumLevels %24
+ %29:u32 = sub %28, 1u
+- %30:u32 = min %layer_1, %29
+- %31:u32 = textureNumLevels %24
+- %32:u32 = sub %31, 1u
+- %33:u32 = min %level_1, %32
+- %34:f32 = textureLoad %24, %27, %30, %33
++ %30:u32 = min %level_1, %29
++ %31:vec2<u32> = textureDimensions %24, %30
++ %32:vec2<u32> = sub %31, vec2<u32>(1u)
++ %33:vec2<u32> = min %coords_1, %32
++ %34:f32 = textureLoad %24, %33, %27, %30
+ ret %34
+ }
+ }
+@@ -3148,28 +3148,28 @@ $B1: { # root
+ %load_signed = func(%coords:vec2<i32>, %layer:i32):vec4<f32> {
+ $B2: {
+ %5:texture_storage_2d_array<rgba8unorm, read_write> = load %texture
+- %6:vec2<u32> = textureDimensions %5
+- %7:vec2<u32> = sub %6, vec2<u32>(1u)
+- %8:vec2<u32> = convert %coords
+- %9:vec2<u32> = min %8, %7
+- %10:u32 = textureNumLayers %5
+- %11:u32 = sub %10, 1u
+- %12:u32 = convert %layer
+- %13:u32 = min %12, %11
+- %14:vec4<f32> = textureLoad %5, %9, %13
++ %6:u32 = textureNumLayers %5
++ %7:u32 = sub %6, 1u
++ %8:u32 = convert %layer
++ %9:u32 = min %8, %7
++ %10:vec2<u32> = textureDimensions %5
++ %11:vec2<u32> = sub %10, vec2<u32>(1u)
++ %12:vec2<u32> = convert %coords
++ %13:vec2<u32> = min %12, %11
++ %14:vec4<f32> = textureLoad %5, %13, %9
+ ret %14
+ }
+ }
+ %load_unsigned = func(%coords_1:vec2<u32>, %layer_1:u32):vec4<f32> { # %coords_1: 'coords', %layer_1: 'layer'
+ $B3: {
+ %18:texture_storage_2d_array<rgba8unorm, read_write> = load %texture
+- %19:vec2<u32> = textureDimensions %18
+- %20:vec2<u32> = sub %19, vec2<u32>(1u)
+- %21:vec2<u32> = min %coords_1, %20
+- %22:u32 = textureNumLayers %18
+- %23:u32 = sub %22, 1u
+- %24:u32 = min %layer_1, %23
+- %25:vec4<f32> = textureLoad %18, %21, %24
++ %19:u32 = textureNumLayers %18
++ %20:u32 = sub %19, 1u
++ %21:u32 = min %layer_1, %20
++ %22:vec2<u32> = textureDimensions %18
++ %23:vec2<u32> = sub %22, vec2<u32>(1u)
++ %24:vec2<u32> = min %coords_1, %23
++ %25:vec4<f32> = textureLoad %18, %24, %21
+ ret %25
+ }
+ }
diff --git a/electron32/patches/patch-third__party_dawn_src_tint_lang_spirv_writer_texture__builtin__test.cc b/electron32/patches/patch-third__party_dawn_src_tint_lang_spirv_writer_texture__builtin__test.cc
new file mode 100644
index 0000000000..983ec13533
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_src_tint_lang_spirv_writer_texture__builtin__test.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/dawn/src/tint/lang/spirv/writer/texture_builtin_test.cc.orig 2024-10-18 12:38:01.453471700 +0000
++++ third_party/dawn/src/tint/lang/spirv/writer/texture_builtin_test.cc
+@@ -1998,14 +1998,14 @@ TEST_F(SpirvWriterTest, TextureLoad_With
+
+ ASSERT_TRUE(Generate()) << Error() << output_;
+ EXPECT_INST(R"(
+- %13 = OpImageQuerySizeLod %v2uint %texture %uint_0
+- %15 = OpISub %v2uint %13 %16
+- %18 = OpExtInst %v2uint %19 UMin %coords %15
+- %20 = OpImageQueryLevels %uint %texture
+- %21 = OpISub %uint %20 %uint_1
+- %22 = OpBitcast %uint %level
+- %23 = OpExtInst %uint %19 UMin %22 %21
+- %result = OpImageFetch %v4float %texture %18 Lod %23
++ %13 = OpImageQueryLevels %uint %texture
++ %14 = OpISub %uint %13 %uint_1
++ %16 = OpBitcast %uint %level
++ %17 = OpExtInst %uint %18 UMin %16 %14
++ %19 = OpImageQuerySizeLod %v2uint %texture %17
++ %20 = OpISub %v2uint %19 %21
++ %22 = OpExtInst %v2uint %18 UMin %coords %20
++ %result = OpImageFetch %v4float %texture %22 Lod %17
+ )");
+ }
+
diff --git a/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_address__space__layout__validation__test.cc b/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_address__space__layout__validation__test.cc
new file mode 100644
index 0000000000..de3ccd2e18
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_address__space__layout__validation__test.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
+
+--- third_party/dawn/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc.orig 2024-10-18 12:38:01.509453300 +0000
++++ third_party/dawn/src/tint/lang/wgsl/resolver/address_space_layout_validation_test.cc
+@@ -216,7 +216,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ // multiple of 16 bytes
+ TEST_F(ResolverAddressSpaceLayoutValidationTest, UniformBuffer_MembersOffsetNotMultipleOf16) {
+ // struct Inner {
+- // @align(1) @size(5) scalar : i32;
++ // @align(4) @size(5) scalar : i32;
+ // };
+ //
+ // struct Outer {
+@@ -229,7 +229,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+
+ Structure(Ident(Source{{12, 34}}, "Inner"),
+ Vector{
+- Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
++ Member("scalar", ty.i32(), Vector{MemberAlign(4_i), MemberSize(5_a)}),
+ });
+
+ Structure(Source{{34, 56}}, "Outer",
+@@ -247,13 +247,13 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ R"(78:90 error: 'uniform' storage requires that the number of bytes between the start of the previous member of type struct and the current member be a multiple of 16 bytes, but there are currently 8 bytes between 'inner' and 'scalar'. Consider setting '@align(16)' on this member
+ note: see layout of struct:
+ /* align(4) size(12) */ struct Outer {
+-/* offset( 0) align(1) size( 5) */ inner : Inner,
+-/* offset( 5) align(1) size( 3) */ // -- implicit field alignment padding --
++/* offset( 0) align(4) size( 8) */ inner : Inner,
+ /* offset( 8) align(4) size( 4) */ scalar : i32,
+ /* */ };
+ 12:34 note: and layout of previous member struct:
+-/* align(1) size(5) */ struct Inner {
+-/* offset(0) align(1) size(5) */ scalar : i32,
++/* align(4) size(8) */ struct Inner {
++/* offset(0) align(4) size(5) */ scalar : i32,
++/* offset(5) align(1) size(3) */ // -- implicit struct size padding --
+ /* */ };
+ 22:24 note: 'Outer' used in address space 'uniform' here)");
+ }
+@@ -265,7 +265,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ // a : i32;
+ // b : i32;
+ // c : i32;
+- // @align(1) @size(5) scalar : i32;
++ // @align(4) @size(5) scalar : i32;
+ // };
+ //
+ // struct Outer {
+@@ -281,7 +281,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ Member("a", ty.i32()),
+ Member("b", ty.i32()),
+ Member("c", ty.i32()),
+- Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
++ Member("scalar", ty.i32(), Vector{MemberAlign(4_i), MemberSize(5_a)}),
+ });
+
+ Structure(Source{{34, 56}}, "Outer",
+@@ -307,7 +307,7 @@ note: see layout of struct:
+ /* offset( 0) align(4) size( 4) */ a : i32,
+ /* offset( 4) align(4) size( 4) */ b : i32,
+ /* offset( 8) align(4) size( 4) */ c : i32,
+-/* offset(12) align(1) size( 5) */ scalar : i32,
++/* offset(12) align(4) size( 5) */ scalar : i32,
+ /* offset(17) align(1) size( 3) */ // -- implicit struct size padding --
+ /* */ };
+ 22:24 note: 'Outer' used in address space 'uniform' here)");
+@@ -316,7 +316,7 @@ note: see layout of struct:
+ TEST_F(ResolverAddressSpaceLayoutValidationTest,
+ UniformBuffer_MembersOffsetNotMultipleOf16_SuggestedFix) {
+ // struct Inner {
+- // @align(1) @size(5) scalar : i32;
++ // @align(4) @size(5) scalar : i32;
+ // };
+ //
+ // struct Outer {
+@@ -328,7 +328,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ // var<uniform> a : Outer;
+
+ Structure("Inner", Vector{
+- Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
++ Member("scalar", ty.i32(), Vector{MemberAlign(4_i), MemberSize(5_a)}),
+ });
+
+ Structure("Outer", Vector{
+@@ -659,7 +659,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ // enable chromium_internal_relaxed_uniform_layout;
+ //
+ // struct Inner {
+- // @align(1) @size(5) scalar : i32;
++ // @align(4) @size(5) scalar : i32;
+ // };
+ //
+ // struct Outer {
+@@ -673,7 +673,7 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ Enable(wgsl::Extension::kChromiumInternalRelaxedUniformLayout);
+
+ Structure("Inner", Vector{
+- Member("scalar", ty.i32(), Vector{MemberAlign(1_i), MemberSize(5_a)}),
++ Member("scalar", ty.i32(), Vector{MemberAlign(4_i), MemberSize(5_a)}),
+ });
+
+ Structure("Outer", Vector{
+@@ -730,5 +730,29 @@ TEST_F(ResolverAddressSpaceLayoutValidat
+ EXPECT_TRUE(r()->Resolve()) << r()->error();
+ }
+
++TEST_F(ResolverAddressSpaceLayoutValidationTest, AlignAttributeTooSmall) {
++ // struct S {
++ // @align(4) vector : vec4u;
++ // scalar : u32;
++ // };
++ //
++ // @group(0) @binding(0)
++ // var<storage, read_write> a : array<S>;
++ Structure(
++ "S", Vector{
++ Member("vector", ty.vec4<u32>(), Vector{MemberAlign(Expr(Source{{12, 34}}, 4_a))}),
++ Member("scalar", ty.u32()),
++ });
++
++ GlobalVar(Source{{56, 78}}, "a", ty("S"), core::AddressSpace::kStorage,
++ core::Access::kReadWrite, Group(0_a), Binding(0_a));
++
++ ASSERT_FALSE(r()->Resolve());
++ EXPECT_EQ(
++ r()->error(),
++ R"(12:34 error: alignment must be a multiple of '16' bytes for the 'storage' address space
++56:78 note: 'S' used in address space 'storage' here)");
++}
++
+ } // namespace
+ } // namespace tint::resolver
diff --git a/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_validator.cc b/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_validator.cc
new file mode 100644
index 0000000000..61475d05dd
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_src_tint_lang_wgsl_resolver_validator.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/dawn/src/tint/lang/wgsl/resolver/validator.cc.orig 2024-10-18 12:38:01.525448000 +0000
++++ third_party/dawn/src/tint/lang/wgsl/resolver/validator.cc
+@@ -661,6 +661,22 @@ bool Validator::AddressSpaceLayout(const
+ return false;
+ }
+ }
++
++ // If an alignment was explicitly specified, we need to validate that it satisfies the
++ // alignment requirement of the address space.
++ auto* align_attr =
++ ast::GetAttribute<ast::StructMemberAlignAttribute>(m->Declaration()->attributes);
++ if (align_attr && !enabled_extensions_.Contains(
++ wgsl::Extension::kChromiumInternalRelaxedUniformLayout)) {
++ auto align = sem_.GetVal(align_attr->expr)->ConstantValue()->ValueAs<uint32_t>();
++ if (align % required_align != 0) {
++ AddError(align_attr->expr->source)
++ << "alignment must be a multiple of " << style::Literal(required_align)
++ << " bytes for the " << style::Enum(address_space) << " address space";
++ note_usage();
++ return false;
++ }
++ }
+ }
+ }
+
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl
new file mode 100644
index 0000000000..7ef919c8e0
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.orig 2025-01-06 07:57:04.974698155 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl
+@@ -0,0 +1,10 @@
++// flags: --transform robustness
++
++@group(0) @binding(0) var<uniform> level : u32;
++@group(0) @binding(1) var<uniform> coords : vec2<u32>;
++@group(0) @binding(2) var tex: texture_depth_2d;
++
++@compute @workgroup_size(1)
++fn compute_main() {
++ var res: f32 = textureLoad(tex, coords, level);
++}
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.dxc.hlsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.dxc.hlsl
new file mode 100644
index 0000000000..dd5df83dde
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.dxc.hlsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.dxc.hlsl.orig 2025-01-06 07:57:04.975642962 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.dxc.hlsl
+@@ -0,0 +1,13 @@
++cbuffer cbuffer_level : register(b0) {
++ uint4 level[1];
++};
++cbuffer cbuffer_coords : register(b1) {
++ uint4 coords[1];
++};
++Texture2D tex : register(t2);
++
++[numthreads(1, 1, 1)]
++void compute_main() {
++ float res = tex.Load(uint3(coords[0].xy, level[0].x)).x;
++ return;
++}
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.fxc.hlsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.fxc.hlsl
new file mode 100644
index 0000000000..05df9e8818
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.fxc.hlsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.fxc.hlsl.orig 2025-01-06 07:57:04.976192749 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.fxc.hlsl
+@@ -0,0 +1,13 @@
++cbuffer cbuffer_level : register(b0) {
++ uint4 level[1];
++};
++cbuffer cbuffer_coords : register(b1) {
++ uint4 coords[1];
++};
++Texture2D tex : register(t2);
++
++[numthreads(1, 1, 1)]
++void compute_main() {
++ float res = tex.Load(uint3(coords[0].xy, level[0].x)).x;
++ return;
++}
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.glsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.glsl
new file mode 100644
index 0000000000..a30b442cc3
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.glsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.glsl.orig 2025-01-06 07:57:04.976697280 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.glsl
+@@ -0,0 +1,27 @@
++#version 310 es
++
++
++struct TintTextureUniformData {
++ uint tint_builtin_value_0;
++};
++
++layout(binding = 0, std140)
++uniform level_block_1_ubo {
++ uint inner;
++} v;
++layout(binding = 1, std140)
++uniform coords_block_1_ubo {
++ uvec2 inner;
++} v_1;
++layout(binding = 0, std140)
++uniform tint_symbol_1_ubo {
++ TintTextureUniformData inner;
++} v_2;
++uniform highp sampler2D tex;
++layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
++void main() {
++ uvec2 v_3 = v_1.inner;
++ uint v_4 = min(v.inner, (v_2.inner.tint_builtin_value_0 - 1u));
++ ivec2 v_5 = ivec2(min(v_3, (uvec2(textureSize(tex, int(v_4))) - uvec2(1u))));
++ float res = texelFetch(tex, v_5, int(v_4)).x;
++}
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.dxc.hlsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.dxc.hlsl
new file mode 100644
index 0000000000..5585fb01ef
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.dxc.hlsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.dxc.hlsl.orig 2025-01-06 07:57:04.977241480 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.dxc.hlsl
+@@ -0,0 +1,22 @@
++
++cbuffer cbuffer_level : register(b0) {
++ uint4 level[1];
++};
++cbuffer cbuffer_coords : register(b1) {
++ uint4 coords[1];
++};
++Texture2D tex : register(t2);
++[numthreads(1, 1, 1)]
++void compute_main() {
++ Texture2D v = tex;
++ uint2 v_1 = coords[0u].xy;
++ uint v_2 = level[0u].x;
++ uint3 v_3 = (0u).xxx;
++ v.GetDimensions(0u, v_3[0u], v_3[1u], v_3[2u]);
++ uint v_4 = min(v_2, (v_3.z - 1u));
++ uint3 v_5 = (0u).xxx;
++ v.GetDimensions(uint(v_4), v_5[0u], v_5[1u], v_5[2u]);
++ int2 v_6 = int2(min(v_1, (v_5.xy - (1u).xx)));
++ float res = v.Load(int3(v_6, int(v_4))).x;
++}
++
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.fxc.hlsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.fxc.hlsl
new file mode 100644
index 0000000000..8031a058ff
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.fxc.hlsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.fxc.hlsl.orig 2025-01-06 07:57:04.977735953 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.fxc.hlsl
+@@ -0,0 +1,22 @@
++
++cbuffer cbuffer_level : register(b0) {
++ uint4 level[1];
++};
++cbuffer cbuffer_coords : register(b1) {
++ uint4 coords[1];
++};
++Texture2D tex : register(t2);
++[numthreads(1, 1, 1)]
++void compute_main() {
++ Texture2D v = tex;
++ uint2 v_1 = coords[0u].xy;
++ uint v_2 = level[0u].x;
++ uint3 v_3 = (0u).xxx;
++ v.GetDimensions(0u, v_3[0u], v_3[1u], v_3[2u]);
++ uint v_4 = min(v_2, (v_3.z - 1u));
++ uint3 v_5 = (0u).xxx;
++ v.GetDimensions(uint(v_4), v_5[0u], v_5[1u], v_5[2u]);
++ int2 v_6 = int2(min(v_1, (v_5.xy - (1u).xx)));
++ float res = v.Load(int3(v_6, int(v_4))).x;
++}
++
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.msl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.msl
new file mode 100644
index 0000000000..90c03e5719
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.ir.msl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.msl.orig 2025-01-06 07:57:04.978349155 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.ir.msl
+@@ -0,0 +1,17 @@
++#include <metal_stdlib>
++using namespace metal;
++
++struct tint_module_vars_struct {
++ const constant uint* level;
++ const constant uint2* coords;
++ depth2d<float, access::sample> tex;
++};
++
++kernel void compute_main(const constant uint* level [[buffer(1)]], const constant uint2* coords [[buffer(0)]], depth2d<float, access::sample> tex [[texture(0)]]) {
++ tint_module_vars_struct const tint_module_vars = tint_module_vars_struct{.level=level, .coords=coords, .tex=tex};
++ uint2 const v = (*tint_module_vars.coords);
++ uint const v_1 = (*tint_module_vars.level);
++ uint const v_2 = min(v_1, (tint_module_vars.tex.get_num_mip_levels() - 1u));
++ uint const v_3 = tint_module_vars.tex.get_width(v_2);
++ float res = tint_module_vars.tex.read(min(v, (uint2(v_3, tint_module_vars.tex.get_height(v_2)) - uint2(1u))), v_2);
++}
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.msl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.msl
new file mode 100644
index 0000000000..7dfd506062
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.msl
@@ -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/test/tint/bug/chromium/378541479.wgsl.expected.msl.orig 2025-01-06 07:57:04.978922409 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.msl
+@@ -0,0 +1,9 @@
++#include <metal_stdlib>
++
++using namespace metal;
++kernel void compute_main(const constant uint* tint_symbol [[buffer(1)]], depth2d<float, access::sample> tint_symbol_1 [[texture(0)]], const constant uint2* tint_symbol_2 [[buffer(0)]]) {
++ uint const level_idx = min(uint(*(tint_symbol)), (tint_symbol_1.get_num_mip_levels() - 1u));
++ float res = tint_symbol_1.read(uint2(min(*(tint_symbol_2), (uint2(tint_symbol_1.get_width(level_idx), tint_symbol_1.get_height(level_idx)) - uint2(1u)))), level_idx);
++ return;
++}
++
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.spvasm b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.spvasm
new file mode 100644
index 0000000000..07c1a34b01
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.spvasm
@@ -0,0 +1,79 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.spvasm.orig 2025-01-06 07:57:04.979493987 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.spvasm
+@@ -0,0 +1,70 @@
++; SPIR-V
++; Version: 1.3
++; Generator: Google Tint Compiler; 1
++; Bound: 39
++; Schema: 0
++ OpCapability Shader
++ OpCapability ImageQuery
++ %29 = OpExtInstImport "GLSL.std.450"
++ OpMemoryModel Logical GLSL450
++ OpEntryPoint GLCompute %compute_main "compute_main"
++ OpExecutionMode %compute_main LocalSize 1 1 1
++ OpMemberName %level_block 0 "inner"
++ OpName %level_block "level_block"
++ OpMemberName %coords_block 0 "inner"
++ OpName %coords_block "coords_block"
++ OpName %tex "tex"
++ OpName %compute_main "compute_main"
++ OpName %res "res"
++ OpMemberDecorate %level_block 0 Offset 0
++ OpDecorate %level_block Block
++ OpDecorate %1 DescriptorSet 0
++ OpDecorate %1 Binding 0
++ OpDecorate %1 NonWritable
++ OpMemberDecorate %coords_block 0 Offset 0
++ OpDecorate %coords_block Block
++ OpDecorate %5 DescriptorSet 0
++ OpDecorate %5 Binding 1
++ OpDecorate %5 NonWritable
++ OpDecorate %tex DescriptorSet 0
++ OpDecorate %tex Binding 2
++ %uint = OpTypeInt 32 0
++%level_block = OpTypeStruct %uint
++%_ptr_Uniform_level_block = OpTypePointer Uniform %level_block
++ %1 = OpVariable %_ptr_Uniform_level_block Uniform
++ %v2uint = OpTypeVector %uint 2
++%coords_block = OpTypeStruct %v2uint
++%_ptr_Uniform_coords_block = OpTypePointer Uniform %coords_block
++ %5 = OpVariable %_ptr_Uniform_coords_block Uniform
++ %float = OpTypeFloat 32
++ %11 = OpTypeImage %float 2D 0 0 0 1 Unknown
++%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
++ %tex = OpVariable %_ptr_UniformConstant_11 UniformConstant
++ %void = OpTypeVoid
++ %15 = OpTypeFunction %void
++%_ptr_Uniform_v2uint = OpTypePointer Uniform %v2uint
++ %uint_0 = OpConstant %uint 0
++%_ptr_Uniform_uint = OpTypePointer Uniform %uint
++ %uint_1 = OpConstant %uint 1
++ %32 = OpConstantComposite %v2uint %uint_1 %uint_1
++ %v4float = OpTypeVector %float 4
++%_ptr_Function_float = OpTypePointer Function %float
++%compute_main = OpFunction %void None %15
++ %16 = OpLabel
++ %res = OpVariable %_ptr_Function_float Function
++ %17 = OpLoad %11 %tex None
++ %18 = OpAccessChain %_ptr_Uniform_v2uint %5 %uint_0
++ %21 = OpLoad %v2uint %18 None
++ %22 = OpAccessChain %_ptr_Uniform_uint %1 %uint_0
++ %24 = OpLoad %uint %22 None
++ %25 = OpImageQueryLevels %uint %17
++ %26 = OpISub %uint %25 %uint_1
++ %28 = OpExtInst %uint %29 UMin %24 %26
++ %30 = OpImageQuerySizeLod %v2uint %17 %28
++ %31 = OpISub %v2uint %30 %32
++ %33 = OpExtInst %v2uint %29 UMin %21 %31
++ %34 = OpImageFetch %v4float %17 %33 Lod %28
++ %36 = OpCompositeExtract %float %34 0
++ OpStore %res %36
++ OpReturn
++ OpFunctionEnd
diff --git a/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.wgsl b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.wgsl
new file mode 100644
index 0000000000..dcf9614135
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_test_tint_bug_chromium_378541479.wgsl.expected.wgsl
@@ -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/dawn/test/tint/bug/chromium/378541479.wgsl.expected.wgsl.orig 2025-01-06 07:57:04.980051596 +0000
++++ third_party/dawn/test/tint/bug/chromium/378541479.wgsl.expected.wgsl
+@@ -0,0 +1,10 @@
++@group(0) @binding(0) var<uniform> level : u32;
++
++@group(0) @binding(1) var<uniform> coords : vec2<u32>;
++
++@group(0) @binding(2) var tex : texture_depth_2d;
++
++@compute @workgroup_size(1)
++fn compute_main() {
++ var res : f32 = textureLoad(tex, coords, level);
++}
diff --git a/electron32/patches/patch-third__party_dawn_webgpu-cts_compat-expectations.txt b/electron32/patches/patch-third__party_dawn_webgpu-cts_compat-expectations.txt
new file mode 100644
index 0000000000..6b6f94aff7
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_webgpu-cts_compat-expectations.txt
@@ -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/dawn/webgpu-cts/compat-expectations.txt.orig 2024-10-18 12:38:07.891368600 +0000
++++ third_party/dawn/webgpu-cts/compat-expectations.txt
+@@ -183,6 +183,10 @@ crbug.com/dawn/2086 webgpu:web_platform,
+ crbug.com/dawn/2086 [ intel-0x9bc5 ] webgpu:web_platform,canvas,configure:viewFormats:* [ Failure ]
+ crbug.com/dawn/2086 [ nvidia-0x2184 ] webgpu:web_platform,canvas,configure:viewFormats:* [ Failure ]
+
++# Failures due to change in `@align()` validation.
++crbug.com/375467276 webgpu:shader,execution,expression,access,structure,index:buffer_align:* [ Failure ]
++crbug.com/375467276 webgpu:shader,validation,shader_io,align:* [ Failure ]
++
+ ### This section represents things that will require Compat validation
+ ### These tests will never pass, but should be skipped in CTS once Compat
+ ### validation has been added
diff --git a/electron32/patches/patch-third__party_dawn_webgpu-cts_expectations.txt b/electron32/patches/patch-third__party_dawn_webgpu-cts_expectations.txt
new file mode 100644
index 0000000000..a634468f7c
--- /dev/null
+++ b/electron32/patches/patch-third__party_dawn_webgpu-cts_expectations.txt
@@ -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/dawn/webgpu-cts/expectations.txt.orig 2024-10-18 12:38:07.895367400 +0000
++++ third_party/dawn/webgpu-cts/expectations.txt
+@@ -1934,6 +1934,10 @@ crbug.com/dawn/0000 [ intel-0x3e9b ] web
+ crbug.com/dawn/0000 [ nvidia-0x2184 ] webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:vectorize="_undef_";non_uniform_discard=true [ Failure ]
+ crbug.com/dawn/0000 [ nvidia-0x2184 ] webgpu:shader,execution,expression,call,builtin,fwidthFine:f32:vectorize=4;non_uniform_discard=true [ Failure ]
+
++# Failures due to change in `@align()` validation.
++crbug.com/375467276 webgpu:shader,execution,expression,access,structure,index:buffer_align:* [ Failure ]
++crbug.com/375467276 webgpu:shader,validation,shader_io,align:* [ Failure ]
++
+ ################################################################################
+ # New flakes. Please triage - will be discarded/regenerated by the next roll:
+ # ##ROLLER_DISCARD_AND_REWRITE##
diff --git a/electron32/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts b/electron32/patches/patch-third__party_devtools-frontend_src_front__end_entrypoints_main_MainImpl.ts
new file mode 100644
index 0000000000..1bf39ad607
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:11.774633000 +0000
++++ third_party/devtools-frontend/src/front_end/entrypoints/main/MainImpl.ts
+@@ -740,6 +740,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/electron32/patches/patch-third__party_electron__node_BUILD.gn b/electron32/patches/patch-third__party_electron__node_BUILD.gn
new file mode 100644
index 0000000000..1cd5b54c31
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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 = false
++ use_system_nghttp2 = false
++ 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/base64",
++ "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-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/electron32/patches/patch-third__party_electron__node_common.gypi b/electron32/patches/patch-third__party_electron__node_common.gypi
new file mode 100644
index 0000000000..6b4b702648
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_common.gypi
@@ -0,0 +1,91 @@
+$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 2024-11-18 09:27:56.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', {
+@@ -462,7 +488,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 +659,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/electron32/patches/patch-third__party_electron__node_configure.py b/electron32/patches/patch-third__party_electron__node_configure.py
new file mode 100644
index 0000000000..667e9d75d0
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/configure.py
+@@ -1585,6 +1585,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/electron32/patches/patch-third__party_electron__node_deps_ada_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_ada_BUILD.gn
new file mode 100644
index 0000000000..155eadc2f2
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_base64_unofficial.gni b/electron32/patches/patch-third__party_electron__node_deps_base64_unofficial.gni
new file mode 100644
index 0000000000..a544994c33
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_deps_base64_unofficial.gni
@@ -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/deps/base64/unofficial.gni.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/deps/base64/unofficial.gni
+@@ -12,6 +12,10 @@ template("base64_gn_build") {
+ }
+ }
+
++ # FIXME(zcbenz): ASM on win/x86 compiles perfectly in upstream Node, figure
++ # out why it does not work in Electron's build configs.
++ support_x86_asm = current_cpu == "x64" || (current_cpu == "x86" && !is_win)
++
+ config("base64_internal_config") {
+ include_dirs = [ "base64/lib" ]
+ if (is_component_build) {
+@@ -19,7 +23,7 @@ template("base64_gn_build") {
+ } else {
+ defines = []
+ }
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ defines += [
+ "HAVE_SSSE3=1",
+ "HAVE_SSE41=1",
+@@ -69,7 +73,7 @@ template("base64_gn_build") {
+ source_set("base64_ssse3") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/ssse3/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [ "-mssse3" ]
+ }
+@@ -79,7 +83,7 @@ template("base64_gn_build") {
+ source_set("base64_sse41") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/sse41/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [ "-msse4.1" ]
+ }
+@@ -89,7 +93,7 @@ template("base64_gn_build") {
+ source_set("base64_sse42") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/sse42/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [ "-msse4.2" ]
+ }
+@@ -99,7 +103,7 @@ template("base64_gn_build") {
+ source_set("base64_avx") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/avx/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [ "-mavx" ]
+ } else if (is_win) {
+@@ -111,7 +115,7 @@ template("base64_gn_build") {
+ source_set("base64_avx2") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/avx2/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [ "-mavx2" ]
+ } else if (is_win) {
+@@ -123,7 +127,7 @@ template("base64_gn_build") {
+ source_set("base64_avx512") {
+ configs += [ ":base64_internal_config" ]
+ sources = [ "base64/lib/arch/avx512/codec.c" ]
+- if (current_cpu == "x86" || current_cpu == "x64") {
++ if (support_x86_asm) {
+ if (is_clang || !is_win) {
+ cflags_c = [
+ "-mavx512vl",
diff --git a/electron32/patches/patch-third__party_electron__node_deps_cares_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
new file mode 100644
index 0000000000..b71cb55559
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_deps_cares_BUILD.gn
@@ -0,0 +1,210 @@
+$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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/deps/cares/BUILD.gn
+@@ -1,14 +1,190 @@
+-##############################################################################
+-# #
+-# 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" ]
++}
++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_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__close_sockets.c",
++ "src/lib/ares__hosts_file.c",
++ "src/lib/ares__parse_into_addrinfo.c",
++ "src/lib/ares__socket.c",
++ "src/lib/ares__sortaddrinfo.c",
++ "src/lib/ares_android.c",
++ "src/lib/ares_android.h",
++ "src/lib/ares_cancel.c",
++ "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_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_platform.c",
++ "src/lib/ares_platform.h",
++ "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_setup.h",
++ "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__array.h",
++ "src/lib/dsa/ares__htable.c",
++ "src/lib/dsa/ares__htable.h",
++ "src/lib/dsa/ares__htable_asvp.c",
++ "src/lib/dsa/ares__htable_asvp.h",
++ "src/lib/dsa/ares__htable_strvp.c",
++ "src/lib/dsa/ares__htable_strvp.h",
++ "src/lib/dsa/ares__htable_szvp.c",
++ "src/lib/dsa/ares__htable_szvp.h",
++ "src/lib/dsa/ares__htable_vpvp.c",
++ "src/lib/dsa/ares__htable_vpvp.h",
++ "src/lib/dsa/ares__llist.c",
++ "src/lib/dsa/ares__llist.h",
++ "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/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__buf.h",
++ "src/lib/str/ares_str.c",
++ "src/lib/str/ares_str.h",
++ "src/lib/str/ares_strcasecmp.c",
++ "src/lib/str/ares_strcasecmp.h",
++ "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__threads.c",
++ "src/lib/util/ares__threads.h",
++ "src/lib/util/ares__timeval.c",
++ "src/lib/util/ares_math.c",
++ "src/lib/util/ares_rand.c",
++ "src/tools/ares_getopt.c",
++ "src/tools/ares_getopt.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" ]
++ }
++
++ if (is_openbsd) {
++ include_dirs += [ "config/openbsd" ]
++ sources += [ "config/openbsd/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/electron32/patches/patch-third__party_electron__node_deps_cares_include_ares__build.h b/electron32/patches/patch-third__party_electron__node_deps_cares_include_ares__build.h
new file mode 100644
index 0000000000..47e7951aef
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_deps_cares_include_ares__build.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/electron_node/deps/cares/include/ares_build.h.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/deps/cares/include/ares_build.h
+@@ -165,7 +165,9 @@
+ # define CARES_TYPEOF_ARES_SOCKLEN_T int
+
+ #elif defined(_WIN32)
+-# define WIN32_LEAN_AND_MEAN
++# ifndef WIN32_LEAN_AND_MEAN
++# define WIN32_LEAN_AND_MEAN
++# endif
+ # define CARES_TYPEOF_ARES_SOCKLEN_T int
+ # define CARES_HAVE_WINDOWS_H 1
+ # define CARES_HAVE_SYS_TYPES_H 1
diff --git a/electron32/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_googletest_BUILD.gn
new file mode 100644
index 0000000000..9ec6afa46a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_histogram_BUILD.gn
new file mode 100644
index 0000000000..055da3beb8
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h b/electron32/patches/patch-third__party_electron__node_deps_histogram_src_hdr__atomic.h
new file mode 100644
index 0000000000..d3f8499e72
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_llhttp_BUILD.gn
new file mode 100644
index 0000000000..c52316d33f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_nghttp2_BUILD.gn
new file mode 100644
index 0000000000..23b7854ffb
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_simdjson_BUILD.gn
new file mode 100644
index 0000000000..35ec6ba71e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_simdutf_BUILD.gn
new file mode 100644
index 0000000000..ef9b58ceb8
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
new file mode 100644
index 0000000000..b1893c24ac
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_deps_uv_BUILD.gn
@@ -0,0 +1,238 @@
+$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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/deps/uv/BUILD.gn
+@@ -1,14 +1,218 @@
+-##############################################################################
+-# #
+-# 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_openbsd) {
++ sources += [
++ "src/unix/openbsd.c",
++ ]
++ }
++ if (is_netbsd) {
++ sources += [
++ "src/unix/netbsd.c",
++ ]
++ }
+ }
diff --git a/electron32/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst b/electron32/patches/patch-third__party_electron__node_deps_uv_docs_src_loop.rst
new file mode 100644
index 0000000000..4d32a15026
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_include_uv.h b/electron32/patches/patch-third__party_electron__node_deps_uv_include_uv.h
new file mode 100644
index 0000000000..382fbb265a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h b/electron32/patches/patch-third__party_electron__node_deps_uv_include_uv_errno.h
new file mode 100644
index 0000000000..e062916eb2
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_async.c
new file mode 100644
index 0000000000..e1a82e9489
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_core.c
new file mode 100644
index 0000000000..d467aab11c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_loop.c
new file mode 100644
index 0000000000..db155c95c6
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_unix_pipe.c
new file mode 100644
index 0000000000..443510a1a9
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h b/electron32/patches/patch-third__party_electron__node_deps_uv_src_uv-common.h
new file mode 100644
index 0000000000..b56e705344
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_core.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_core.c
new file mode 100644
index 0000000000..6665da5c8e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_process.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_process.c
new file mode 100644
index 0000000000..a86c8bd4a6
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_util.c b/electron32/patches/patch-third__party_electron__node_deps_uv_src_win_util.c
new file mode 100644
index 0000000000..c4e573df5c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c b/electron32/patches/patch-third__party_electron__node_deps_uv_test_test-embed.c
new file mode 100644
index 0000000000..cd672b5a2a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uv_test_test-list.h b/electron32/patches/patch-third__party_electron__node_deps_uv_test_test-list.h
new file mode 100644
index 0000000000..1a5908b363
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn b/electron32/patches/patch-third__party_electron__node_deps_uvwasi_BUILD.gn
new file mode 100644
index 0000000000..4f8354901f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_.eslintrc.yaml b/electron32/patches/patch-third__party_electron__node_lib_.eslintrc.yaml
new file mode 100644
index 0000000000..04fb2ca835
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_child__process.js b/electron32/patches/patch-third__party_electron__node_lib_child__process.js
new file mode 100644
index 0000000000..6ff23b4787
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_assert_utils.js b/electron32/patches/patch-third__party_electron__node_lib_internal_assert_utils.js
new file mode 100644
index 0000000000..9b46a3751e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js b/electron32/patches/patch-third__party_electron__node_lib_internal_bootstrap_node.js
new file mode 100644
index 0000000000..00e2d688c8
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_constants.js b/electron32/patches/patch-third__party_electron__node_lib_internal_constants.js
new file mode 100644
index 0000000000..df9a4b649d
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js b/electron32/patches/patch-third__party_electron__node_lib_internal_fs_watchers.js
new file mode 100644
index 0000000000..178d36c0d6
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_http.js b/electron32/patches/patch-third__party_electron__node_lib_internal_http.js
new file mode 100644
index 0000000000..c157e6729a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js b/electron32/patches/patch-third__party_electron__node_lib_internal_main_worker__thread.js
new file mode 100644
index 0000000000..008b883d8f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/main/worker_thread.js
+@@ -113,7 +113,7 @@ port.on('message', (message) => {
+
+ require('internal/worker').assignEnvironmentData(environmentData);
+
+- 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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
new file mode 100644
index 0000000000..4bf7482d62
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_cjs_loader.js
@@ -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/electron_node/lib/internal/modules/cjs/loader.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/cjs/loader.js
+@@ -138,7 +138,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: {
+@@ -185,6 +185,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');
+@@ -226,7 +233,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);
+@@ -1434,6 +1441,13 @@ Module.prototype._compile = function(con
+ if (getOptionValue('--inspect-brk') && process._eval == null) {
+ if (!resolvedArgv) {
+ // We enter the repl if we're not given a filename argument.
++ // 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
++ } else
+ if (process.argv[1]) {
+ try {
+ resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
+@@ -1464,10 +1478,12 @@ Module.prototype._compile = function(con
+ this[kIsExecuting] = true;
+ if (inspectorWrapper) {
+ result = inspectorWrapper(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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_get__format.js
new file mode 100644
index 0000000000..1a3784f059
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/get_format.js
+@@ -31,6 +31,7 @@ const protocolHandlers = {
+ 'http:': getHttpProtocolModuleFormat,
+ 'https:': getHttpProtocolModuleFormat,
+ 'node:'() { return 'builtin'; },
++ 'electron:'() { return 'electron'; },
+ };
+
+ /**
diff --git a/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_load.js
new file mode 100644
index 0000000000..5010c66c03
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/load.js
+@@ -10,7 +10,7 @@ const { kEmptyObject } = require('intern
+ 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') ?
+@@ -42,8 +42,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) {
+@@ -82,7 +81,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) {
+@@ -133,7 +132,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 };
+ }
+@@ -142,7 +141,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;
+@@ -234,6 +233,7 @@ function throwIfUnsupportedURLScheme(par
+ protocol !== 'file:' &&
+ protocol !== 'data:' &&
+ protocol !== 'node:' &&
++ protocol !== 'electron:' &&
+ (
+ !experimentalNetworkImports ||
+ (
+@@ -242,7 +242,7 @@ function throwIfUnsupportedURLScheme(par
+ )
+ )
+ ) {
+- const schemes = ['file', 'data', 'node'];
++ const schemes = ['file', 'data', 'node', 'electron'];
+ if (experimentalNetworkImports) {
+ ArrayPrototypePush(schemes, 'https', 'http');
+ }
diff --git a/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_resolve.js
new file mode 100644
index 0000000000..665c6c642c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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;
+@@ -251,7 +251,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()
+@@ -267,7 +267,7 @@ function finalizeResolution(resolved, ba
+ }
+
+ if (!preserveSymlinks) {
+- const real = realpathSync(path, {
++ const real = fs.realpathSync(path, {
+ [internalFS.realpathCacheKey]: realpathCache,
+ });
+ const { search, hash } = resolved;
+@@ -741,6 +741,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.
+@@ -801,6 +803,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);
+
+@@ -819,7 +826,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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_translators.js
new file mode 100644
index 0000000000..e3805f986a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/esm/translators.js
+@@ -36,7 +36,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,
+@@ -272,7 +272,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) {
+@@ -294,8 +294,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.
+@@ -329,6 +329,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', async function commonjsStrategy(url, source,
+@@ -352,7 +356,7 @@ translators.set('commonjs', async functi
+
+ 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.
+ }
+@@ -371,6 +375,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);
+@@ -420,7 +427,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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_esm_utils.js
new file mode 100644
index 0000000000..84fe481d93
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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,
+@@ -273,12 +273,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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_package__json__reader.js
new file mode 100644
index 0000000000..41214c8c4f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js b/electron32/patches/patch-third__party_electron__node_lib_internal_modules_run__main.js
new file mode 100644
index 0000000000..8b736ef3fb
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/modules/run_main.js
+@@ -2,6 +2,7 @@
+
+ const {
+ StringPrototypeEndsWith,
++ StringPrototypeStartsWith,
+ } = primordials;
+
+ const { containsModuleSyntax } = internalBinding('contextify');
+@@ -22,6 +23,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;
+@@ -58,6 +66,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/electron32/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js b/electron32/patches/patch-third__party_electron__node_lib_internal_process_pre__execution.js
new file mode 100644
index 0000000000..61baae4bea
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/process/pre_execution.js
+@@ -247,12 +247,14 @@ function patchProcessObject(expandArgv1)
+ if (expandArgv1 && process.argv[1] &&
+ !StringPrototypeStartsWith(process.argv[1], '-')) {
+ // 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/electron32/patches/patch-third__party_electron__node_lib_internal_url.js b/electron32/patches/patch-third__party_electron__node_lib_internal_url.js
new file mode 100644
index 0000000000..7d79c2a9e7
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_lib_internal_worker.js b/electron32/patches/patch-third__party_electron__node_lib_internal_worker.js
new file mode 100644
index 0000000000..b4ec630755
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/lib/internal/worker.js
+@@ -101,8 +101,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/electron32/patches/patch-third__party_electron__node_src_api_environment.cc b/electron32/patches/patch-third__party_electron__node_src_api_environment.cc
new file mode 100644
index 0000000000..aaf9ec045b
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_api_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
+
+--- third_party/electron_node/src/api/environment.cc.orig 2024-11-18 09:27:56.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>());
+ }
+ }
+
+@@ -557,6 +568,10 @@ MultiIsolatePlatform* GetMultiIsolatePla
+ return env->platform();
+ }
+
++node::tracing::Agent* CreateAgent() {
++ return new node::tracing::Agent();
++}
++
+ MultiIsolatePlatform* CreatePlatform(
+ int thread_pool_size,
+ node::tracing::TracingController* tracing_controller) {
diff --git a/electron32/patches/patch-third__party_electron__node_src_base__object-inl.h b/electron32/patches/patch-third__party_electron__node_src_base__object-inl.h
new file mode 100644
index 0000000000..592b72083a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_base__object.h b/electron32/patches/patch-third__party_electron__node_src_base__object.h
new file mode 100644
index 0000000000..183aec98b0
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__cipher.cc
new file mode 100644
index 0000000000..4f2d9e6e0e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__common.cc
new file mode 100644
index 0000000000..f2ebb35b56
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__context.cc
new file mode 100644
index 0000000000..50516e7955
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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;
+@@ -882,10 +882,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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dh.cc
new file mode 100644
index 0000000000..321440b768
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__dsa.cc
new file mode 100644
index 0000000000..526a0fd979
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__keys.cc
new file mode 100644
index 0000000000..81b3e90647
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__random.cc
new file mode 100644
index 0000000000..5e743b87ca
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__rsa.cc
new file mode 100644
index 0000000000..f14be9506a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.cc
new file mode 100644
index 0000000000..dd2a9a0fe2
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.h b/electron32/patches/patch-third__party_electron__node_src_crypto_crypto__util.h
new file mode 100644
index 0000000000..ee22f525f0
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_env-inl.h b/electron32/patches/patch-third__party_electron__node_src_env-inl.h
new file mode 100644
index 0000000000..29c07f5d29
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_env.cc b/electron32/patches/patch-third__party_electron__node_src_env.cc
new file mode 100644
index 0000000000..d192e6fba6
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_env.h b/electron32/patches/patch-third__party_electron__node_src_env.h
new file mode 100644
index 0000000000..5c4bd25d4a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_handle__wrap.cc b/electron32/patches/patch-third__party_electron__node_src_handle__wrap.cc
new file mode 100644
index 0000000000..d7176d8980
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_inspector_BUILD.gn b/electron32/patches/patch-third__party_electron__node_src_inspector_BUILD.gn
new file mode 100644
index 0000000000..eaf628061a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_module__wrap.cc b/electron32/patches/patch-third__party_electron__node_src_module__wrap.cc
new file mode 100644
index 0000000000..d455ce6d41
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_module__wrap.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/electron_node/src/module_wrap.cc.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/module_wrap.cc
+@@ -186,7 +186,9 @@ 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 {
+ ScriptCompiler::CachedData* cached_data = nullptr;
+@@ -200,8 +202,7 @@ void ModuleWrap::New(const FunctionCallb
+ }
+
+ Local<String> source_text = args[2].As<String>();
+- ScriptOrigin origin(isolate,
+- url,
++ ScriptOrigin origin(url,
+ line_offset,
+ column_offset,
+ true, // is cross origin
+@@ -462,7 +463,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;
+@@ -587,11 +587,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);
+@@ -752,7 +751,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,
+@@ -817,12 +816,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(
+@@ -864,13 +864,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(
diff --git a/electron32/patches/patch-third__party_electron__node_src_module__wrap.h b/electron32/patches/patch-third__party_electron__node_src_module__wrap.h
new file mode 100644
index 0000000000..dcf296bb5f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/module_wrap.h
+@@ -7,6 +7,7 @@
+ #include <string>
+ #include <vector>
+ #include "base_object.h"
++#include "node.h"
+
+ namespace node {
+
+@@ -31,7 +32,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,
+@@ -68,6 +76,8 @@ class ModuleWrap : public BaseObject {
+ return true;
+ }
+
++ static ModuleWrap* GetFromModule(node::Environment*, v8::Local<v8::Module>);
++
+ private:
+ ModuleWrap(Realm* realm,
+ v8::Local<v8::Object> object,
+@@ -110,7 +120,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::Promise>> resolve_cache_;
diff --git a/electron32/patches/patch-third__party_electron__node_src_node.h b/electron32/patches/patch-third__party_electron__node_src_node.h
new file mode 100644
index 0000000000..bc7415ee2e
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node.h
@@ -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/src/node.h.orig 2024-11-18 09:27:56.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)
+@@ -133,6 +139,7 @@ struct SnapshotData;
+
+ namespace tracing {
+
++class Agent;
+ class TracingController;
+
+ }
+@@ -832,6 +839,8 @@ NODE_EXTERN void GetNodeReport(Environme
+ NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(Environment* env);
+ NODE_EXTERN MultiIsolatePlatform* GetMultiIsolatePlatform(IsolateData* env);
+
++NODE_EXTERN node::tracing::Agent* CreateAgent();
++
+ NODE_DEPRECATED("Use MultiIsolatePlatform::Create() instead",
+ NODE_EXTERN MultiIsolatePlatform* CreatePlatform(
+ int thread_pool_size,
+@@ -1552,24 +1561,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/electron32/patches/patch-third__party_electron__node_src_node__binding.cc b/electron32/patches/patch-third__party_electron__node_src_node__binding.cc
new file mode 100644
index 0000000000..5b2dffca68
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__binding.h b/electron32/patches/patch-third__party_electron__node_src_node__binding.h
new file mode 100644
index 0000000000..05fc649742
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__buffer.h b/electron32/patches/patch-third__party_electron__node_src_node__buffer.h
new file mode 100644
index 0000000000..fcb1a0cf6c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__builtins.cc b/electron32/patches/patch-third__party_electron__node_src_node__builtins.cc
new file mode 100644
index 0000000000..311273d3b0
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__builtins.h b/electron32/patches/patch-third__party_electron__node_src_node__builtins.h
new file mode 100644
index 0000000000..ecb68af5bb
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/node_builtins.h
+@@ -74,6 +74,8 @@ using BuiltinCodeCacheMap =
+ // Generated by tools/js2c.py 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.py 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/electron32/patches/patch-third__party_electron__node_src_node__constants.cc b/electron32/patches/patch-third__party_electron__node_src_node__constants.cc
new file mode 100644
index 0000000000..ce4b5d8c51
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__contextify.cc b/electron32/patches/patch-third__party_electron__node_src_node__contextify.cc
new file mode 100644
index 0000000000..4aa2f8c013
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node__contextify.cc
@@ -0,0 +1,431 @@
+$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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/node_contextify.cc
+@@ -49,6 +49,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;
+@@ -484,16 +485,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()) {
+@@ -503,22 +508,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;
+@@ -536,8 +550,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
+@@ -556,11 +571,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 &&
+@@ -574,19 +594,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();
+
+@@ -596,19 +620,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();
+@@ -627,7 +655,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();
+@@ -650,6 +678,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>();
+@@ -661,26 +692,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
+@@ -700,76 +737,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(
+@@ -869,16 +914,15 @@ void ContextifyScript::New(const Functio
+ host_defined_options->Set(
+ isolate, loader::HostDefinedOptions::kID, id_symbol);
+
+- ScriptOrigin origin(isolate,
+- filename,
+- line_offset, // line offset
+- column_offset, // column offset
+- true, // is cross origin
+- -1, // script id
+- Local<Value>(), // source map URL
+- false, // is opaque (?)
+- false, // is WASM
+- false, // is ES Module
++ ScriptOrigin origin(filename,
++ line_offset, // line offset
++ column_offset, // column offset
++ true, // is cross origin
++ -1, // script id
++ Local<Value>(), // source map URL
++ false, // is opaque (?)
++ false, // is WASM
++ false, // is ES Module
+ host_defined_options);
+ ScriptCompiler::Source source(code, origin, cached_data);
+ ScriptCompiler::CompileOptions compile_options =
+@@ -990,7 +1034,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,
+@@ -1100,7 +1144,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 =
+@@ -1278,8 +1321,7 @@ void ContextifyContext::CompileFunction(
+ Local<PrimitiveArray> host_defined_options =
+ GetHostDefinedOptions(isolate, id_symbol);
+ ScriptCompiler::Source source =
+- GetCommonJSSourceInstance(isolate,
+- code,
++ GetCommonJSSourceInstance(code,
+ filename,
+ line_offset,
+ column_offset,
+@@ -1334,15 +1376,13 @@ void ContextifyContext::CompileFunction(
+ }
+
+ ScriptCompiler::Source ContextifyContext::GetCommonJSSourceInstance(
+- Isolate* isolate,
+ Local<String> code,
+ Local<String> filename,
+ int line_offset,
+ int column_offset,
+ Local<PrimitiveArray> host_defined_options,
+ ScriptCompiler::CachedData* cached_data) {
+- ScriptOrigin origin(isolate,
+- filename,
++ ScriptOrigin origin(filename,
+ line_offset, // line offset
+ column_offset, // column offset
+ true, // is cross origin
+@@ -1520,7 +1560,7 @@ void ContextifyContext::ContainsModuleSy
+ Local<PrimitiveArray> host_defined_options =
+ GetHostDefinedOptions(isolate, id_symbol);
+ ScriptCompiler::Source source = GetCommonJSSourceInstance(
+- isolate, code, filename, 0, 0, host_defined_options, nullptr);
++ code, filename, 0, 0, host_defined_options, nullptr);
+ ScriptCompiler::CompileOptions options = GetCompileOptions(source);
+
+ std::vector<Local<String>> params = GetCJSParameters(env->isolate_data());
+@@ -1568,7 +1608,7 @@ void ContextifyContext::ContainsModuleSy
+ code,
+ String::NewFromUtf8(isolate, "})();").ToLocalChecked());
+ ScriptCompiler::Source wrapped_source = GetCommonJSSourceInstance(
+- isolate, code, filename, 0, 0, host_defined_options, nullptr);
++ code, filename, 0, 0, host_defined_options, nullptr);
+ std::ignore = ScriptCompiler::CompileFunction(
+ context,
+ &wrapped_source,
+@@ -1621,8 +1661,7 @@ static void CompileFunctionForCJSLoader(
+
+ Local<Symbol> symbol = env->vm_dynamic_import_default_internal();
+ Local<PrimitiveArray> hdo = GetHostDefinedOptions(isolate, symbol);
+- ScriptOrigin origin(isolate,
+- filename,
++ ScriptOrigin origin(filename,
+ 0, // line offset
+ 0, // column offset
+ true, // is cross origin
diff --git a/electron32/patches/patch-third__party_electron__node_src_node__contextify.h b/electron32/patches/patch-third__party_electron__node_src_node__contextify.h
new file mode 100644
index 0000000000..ef9004685a
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node__contextify.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/electron_node/src/node_contextify.h.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/node_contextify.h
+@@ -99,7 +99,6 @@ class ContextifyContext : public BaseObj
+ v8::Local<v8::Symbol> id_symbol,
+ const errors::TryCatchScope& try_catch);
+ static v8::ScriptCompiler::Source GetCommonJSSourceInstance(
+- v8::Isolate* isolate,
+ v8::Local<v8::String> code,
+ v8::Local<v8::String> filename,
+ int line_offset,
+@@ -112,42 +111,39 @@ class ContextifyContext : public BaseObj
+ const v8::FunctionCallbackInfo<v8::Value>& args);
+ 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/electron32/patches/patch-third__party_electron__node_src_node__env__var.cc b/electron32/patches/patch-third__party_electron__node_src_node__env__var.cc
new file mode 100644
index 0000000000..b46ffc8595
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__errors.cc b/electron32/patches/patch-third__party_electron__node_src_node__errors.cc
new file mode 100644
index 0000000000..c8e67d16a3
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/node_errors.cc
+@@ -855,10 +855,6 @@ const char* errno_string(int errorno) {
+ ERRNO_CASE(ENOBUFS);
+ #endif
+
+-#ifdef ENODATA
+- ERRNO_CASE(ENODATA);
+-#endif
+-
+ #ifdef ENODEV
+ ERRNO_CASE(ENODEV);
+ #endif
+@@ -897,14 +893,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
+@@ -987,10 +975,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/electron32/patches/patch-third__party_electron__node_src_node__errors.h b/electron32/patches/patch-third__party_electron__node_src_node__errors.h
new file mode 100644
index 0000000000..1458071847
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__external__reference.h b/electron32/patches/patch-third__party_electron__node_src_node__external__reference.h
new file mode 100644
index 0000000000..85ca40897c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__file.cc b/electron32/patches/patch-third__party_electron__node_src_node__file.cc
new file mode 100644
index 0000000000..cd422c4af7
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__file.h b/electron32/patches/patch-third__party_electron__node_src_node__file.h
new file mode 100644
index 0000000000..3bc8911562
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__i18n.cc b/electron32/patches/patch-third__party_electron__node_src_node__i18n.cc
new file mode 100644
index 0000000000..68fa1f50df
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/src/node_i18n.cc
+@@ -106,7 +106,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;
+
+@@ -183,7 +183,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,
+@@ -228,7 +228,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,
+@@ -252,7 +252,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/electron32/patches/patch-third__party_electron__node_src_node__internals.h b/electron32/patches/patch-third__party_electron__node_src_node__internals.h
new file mode 100644
index 0000000000..3fe762d31c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__messaging.cc b/electron32/patches/patch-third__party_electron__node_src_node__messaging.cc
new file mode 100644
index 0000000000..650c7bb80f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__metadata.h b/electron32/patches/patch-third__party_electron__node_src_node__metadata.h
new file mode 100644
index 0000000000..4a0eb11db9
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__options.cc b/electron32/patches/patch-third__party_electron__node_src_node__options.cc
new file mode 100644
index 0000000000..23d9142b2e
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node__options.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_options.cc.orig 2024-11-18 09:27:56.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
+
+@@ -1405,14 +1405,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/electron32/patches/patch-third__party_electron__node_src_node__options.h b/electron32/patches/patch-third__party_electron__node_src_node__options.h
new file mode 100644
index 0000000000..92a882f74b
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__platform.cc b/electron32/patches/patch-third__party_electron__node_src_node__platform.cc
new file mode 100644
index 0000000000..afdeb2cc79
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node__platform.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/electron_node/src/node_platform.cc.orig 2024-11-18 09:27:56.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());
+ }
diff --git a/electron32/patches/patch-third__party_electron__node_src_node__platform.h b/electron32/patches/patch-third__party_electron__node_src_node__platform.h
new file mode 100644
index 0000000000..4e112fc0ef
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_src_node__platform.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
+
+--- third_party/electron_node/src/node_platform.h.orig 2024-11-18 09:27:56.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,
diff --git a/electron32/patches/patch-third__party_electron__node_src_node__process__object.cc b/electron32/patches/patch-third__party_electron__node_src_node__process__object.cc
new file mode 100644
index 0000000000..dcb5b0c97c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__serdes.cc b/electron32/patches/patch-third__party_electron__node_src_node__serdes.cc
new file mode 100644
index 0000000000..5d159c5a08
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_node__trace__events.cc b/electron32/patches/patch-third__party_electron__node_src_node__trace__events.cc
new file mode 100644
index 0000000000..5315625851
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_stream__base.cc b/electron32/patches/patch-third__party_electron__node_src_stream__base.cc
new file mode 100644
index 0000000000..3e18d81e1b
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_stream__base.h b/electron32/patches/patch-third__party_electron__node_src_stream__base.h
new file mode 100644
index 0000000000..4ad5650a24
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_agent.cc b/electron32/patches/patch-third__party_electron__node_src_tracing_agent.cc
new file mode 100644
index 0000000000..f0b4ef1b29
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_agent.h b/electron32/patches/patch-third__party_electron__node_src_tracing_agent.h
new file mode 100644
index 0000000000..0fcfa945a3
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc b/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__buffer.cc
new file mode 100644
index 0000000000..1f61a113e1
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc b/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.cc
new file mode 100644
index 0000000000..8aab1d55a3
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h b/electron32/patches/patch-third__party_electron__node_src_tracing_node__trace__writer.h
new file mode 100644
index 0000000000..b5264d54b2
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_src_tracing_trace__event.h b/electron32/patches/patch-third__party_electron__node_src_tracing_trace__event.h
new file mode 100644
index 0000000000..23c41077c3
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc b/electron32/patches/patch-third__party_electron__node_test_addons_cppgc-object_binding.cc
new file mode 100644
index 0000000000..258b1bb5c9
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc b/electron32/patches/patch-third__party_electron__node_test_cctest_test__cppgc.cc
new file mode 100644
index 0000000000..5af36b1367
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_cctest_test__environment.cc b/electron32/patches/patch-third__party_electron__node_test_cctest_test__environment.cc
new file mode 100644
index 0000000000..924a830304
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_common_assertSnapshot.js b/electron32/patches/patch-third__party_electron__node_test_common_assertSnapshot.js
new file mode 100644
index 0000000000..1413bd099d
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_common_assertSnapshot.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/assertSnapshot.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/common/assertSnapshot.js
+@@ -83,6 +83,7 @@ async function spawnAndAssert(filename,
+ tty ?
+ [path.join(__dirname, '../..', 'tools/pseudo-tty.py'), process.execPath, ...flags, filename] :
+ [...flags, filename];
++ if (options && options.env) options.env.ELECTRON_RUN_AS_NODE = 1;
+ const { stdout, stderr } = await common.spawnPromisified(executable, args, options);
+ await assertSnapshot(transform(`${stdout}${stderr}`), filename);
+ }
diff --git a/electron32/patches/patch-third__party_electron__node_test_common_debugger.js b/electron32/patches/patch-third__party_electron__node_test_common_debugger.js
new file mode 100644
index 0000000000..decc6e1ab8
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_common_globals.js b/electron32/patches/patch-third__party_electron__node_test_common_globals.js
new file mode 100644
index 0000000000..90c463de5a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js b/electron32/patches/patch-third__party_electron__node_test_es-module_test-cjs-legacyMainResolve.js
new file mode 100644
index 0000000000..c9b96c11bf
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js b/electron32/patches/patch-third__party_electron__node_test_fixtures_test-runner_output_arbitrary-output-colored.js
new file mode 100644
index 0000000000..9a48fff35a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_parallel.status b/electron32/patches/patch-third__party_electron__node_test_parallel_parallel.status
new file mode 100644
index 0000000000..390baafe5e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-buffer-tostring-range.js
new file mode 100644
index 0000000000..d4d8a8d3f6
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-async-sign-verify.js
new file mode 100644
index 0000000000..d92ece897e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-authenticated.js
new file mode 100644
index 0000000000..cdf0d1a078
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-certificate.js
new file mode 100644
index 0000000000..5225ff355a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipher-decipher.js
new file mode 100644
index 0000000000..1fa0fbf365
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-cipheriv-decipheriv.js
new file mode 100644
index 0000000000..c20c0e612f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-classes.js
new file mode 100644
index 0000000000..47ccb5087c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-curves.js
new file mode 100644
index 0000000000..2e0b0069bd
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
new file mode 100644
index 0000000000..73a642106a
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh-errors.js
@@ -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/test/parallel/test-crypto-dh-errors.js.orig 2024-11-18 09:27:56.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/,
+ });
+ }
+ }
+@@ -43,7 +43,7 @@ for (const g of [-1, 1]) {
+ const ex = {
+ code: 'ERR_OSSL_DH_BAD_GENERATOR',
+ name: 'Error',
+- message: /bad generator/,
++ message: /bad generator|BAD_GENERATOR/,
+ };
+ assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex);
+ assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex);
+@@ -55,7 +55,7 @@ for (const g of [Buffer.from([]),
+ const ex = {
+ code: 'ERR_OSSL_DH_BAD_GENERATOR',
+ name: 'Error',
+- message: /bad generator/,
++ message: /bad generator|BAD_GENERATOR/,
+ };
+ assert.throws(() => crypto.createDiffieHellman('abcdef', g), ex);
+ assert.throws(() => crypto.createDiffieHellman('abcdef', 'hex', g), ex);
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-dh.js
new file mode 100644
index 0000000000..4018fcba2c
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-getcipherinfo.js
new file mode 100644
index 0000000000..367ba8f807
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash-stream-pipe.js
new file mode 100644
index 0000000000..e276c86bc4
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hash.js
new file mode 100644
index 0000000000..1eba96cfe0
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-hash.js
+@@ -182,6 +182,7 @@ assert.throws(
+
+ // Test XOF hash functions and the outputLength option.
+ {
++ /*
+ // Default outputLengths.
+ assert.strictEqual(crypto.createHash('shake128').digest('hex'),
+ '7f9c2ba4e88f827d616045507605853e');
+@@ -236,6 +237,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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-hkdf.js
new file mode 100644
index 0000000000..4cab0dffc8
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-padding.js
new file mode 100644
index 0000000000..7f62ea8fd9
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-private-decrypt-gh32240.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-private-decrypt-gh32240.js
new file mode 100644
index 0000000000..b6aefad8e2
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-private-decrypt-gh32240.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-private-decrypt-gh32240.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-private-decrypt-gh32240.js
+@@ -24,7 +24,7 @@ const pkeyEncrypted =
+ pair.privateKey.export({
+ type: 'pkcs1',
+ format: 'pem',
+- cipher: 'aes128',
++ cipher: 'aes-128-cbc',
+ passphrase: 'secret',
+ });
+
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-rsa-dsa.js
new file mode 100644
index 0000000000..f3941d5ff5
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-scrypt.js
new file mode 100644
index 0000000000..4235dcdd3a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-sign-verify.js
new file mode 100644
index 0000000000..58d0a9d29b
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-stream.js
new file mode 100644
index 0000000000..20f1a16b3e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
new file mode 100644
index 0000000000..ce0161f8ad
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto-x509.js
@@ -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/electron_node/test/parallel/test-crypto-x509.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-crypto-x509.js
+@@ -111,7 +111,7 @@ const der = Buffer.from(
+ '5A:42:63:E0:21:2F:D6:70:63:07:96:6F:27:A7:78:12:08:02:7A:8B'
+ );
+ assert.strictEqual(x509.keyUsage, undefined);
+- assert.strictEqual(x509.serialNumber, '147D36C1C2F74206DE9FAB5F2226D78ADB00A426');
++ assert.match(x509.serialNumber, /147D36C1C2F74206DE9FAB5F2226D78ADB00A426/i);
+
+ assert.deepStrictEqual(x509.raw, der);
+
+@@ -253,6 +253,16 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ });
+ mc.port2.postMessage(x509);
+
++ const modulusOSSL = 'D456320AFB20D3827093DC2C4284ED04DFBABD56E1DDAE529E28B790CD42' +
++ '56DB273349F3735FFD337C7A6363ECCA5A27B7F73DC7089A96C6D886DB0C' +
++ '62388F1CDD6A963AFCD599D5800E587A11F908960F84ED50BA25A28303EC' +
++ 'DA6E684FBE7BAEDC9CE8801327B1697AF25097CEE3F175E400984C0DB6A8' +
++ 'EB87BE03B4CF94774BA56FFFC8C63C68D6ADEB60ABBE69A7B14AB6A6B9E7' +
++ 'BAA89B5ADAB8EB07897C07F6D4FA3D660DFF574107D28E8F63467A788624' +
++ 'C574197693E959CEA1362FFAE1BBA10C8C0D88840ABFEF103631B2E8F5C3' +
++ '9B5548A7EA57E8A39F89291813F45A76C448033A2B7ED8403F4BAA147CF3' +
++ '5E2D2554AA65CE49695797095BF4DC6B';
++
+ // Verify that legacy encoding works
+ const legacyObjectCheck = {
+ subject: Object.assign({ __proto__: null }, {
+@@ -277,15 +287,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ 'OCSP - URI': ['http://ocsp.nodejs.org/'],
+ 'CA Issuers - URI': ['http://ca.nodejs.org/ca.cert']
+ }),
+- modulus: 'D456320AFB20D3827093DC2C4284ED04DFBABD56E1DDAE529E28B790CD42' +
+- '56DB273349F3735FFD337C7A6363ECCA5A27B7F73DC7089A96C6D886DB0C' +
+- '62388F1CDD6A963AFCD599D5800E587A11F908960F84ED50BA25A28303EC' +
+- 'DA6E684FBE7BAEDC9CE8801327B1697AF25097CEE3F175E400984C0DB6A8' +
+- 'EB87BE03B4CF94774BA56FFFC8C63C68D6ADEB60ABBE69A7B14AB6A6B9E7' +
+- 'BAA89B5ADAB8EB07897C07F6D4FA3D660DFF574107D28E8F63467A788624' +
+- 'C574197693E959CEA1362FFAE1BBA10C8C0D88840ABFEF103631B2E8F5C3' +
+- '9B5548A7EA57E8A39F89291813F45A76C448033A2B7ED8403F4BAA147CF3' +
+- '5E2D2554AA65CE49695797095BF4DC6B',
++ modulusPattern: new RegExp(modulusOSSL, 'i'),
+ bits: 2048,
+ exponent: '0x10001',
+ valid_from: 'Sep 3 21:40:37 2022 GMT',
+@@ -298,7 +300,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ '51:62:18:39:E2:E2:77:F5:86:11:E8:C0:CA:54:43:7C:76:83:19:05:D0:03:' +
+ '24:21:B8:EB:14:61:FB:24:16:EB:BD:51:1A:17:91:04:30:03:EB:68:5F:DC:' +
+ '86:E1:D1:7C:FB:AF:78:ED:63:5F:29:9C:32:AF:A1:8E:22:96:D1:02',
+- serialNumber: '147D36C1C2F74206DE9FAB5F2226D78ADB00A426'
++ serialNumberPattern: /147D36C1C2F74206DE9FAB5F2226D78ADB00A426/i
+ };
+
+ const legacyObject = x509.toLegacyObject();
+@@ -307,7 +309,7 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ assert.deepStrictEqual(legacyObject.subject, legacyObjectCheck.subject);
+ assert.deepStrictEqual(legacyObject.issuer, legacyObjectCheck.issuer);
+ assert.deepStrictEqual(legacyObject.infoAccess, legacyObjectCheck.infoAccess);
+- assert.strictEqual(legacyObject.modulus, legacyObjectCheck.modulus);
++ assert.match(legacyObject.modulus, legacyObjectCheck.modulusPattern);
+ assert.strictEqual(legacyObject.bits, legacyObjectCheck.bits);
+ assert.strictEqual(legacyObject.exponent, legacyObjectCheck.exponent);
+ assert.strictEqual(legacyObject.valid_from, legacyObjectCheck.valid_from);
+@@ -316,11 +318,12 @@ oans248kpal88CGqsN2so/wZKxVnpiXlPHMdiNL7
+ assert.strictEqual(
+ legacyObject.fingerprint256,
+ legacyObjectCheck.fingerprint256);
+- assert.strictEqual(
++ assert.match(
+ legacyObject.serialNumber,
+- legacyObjectCheck.serialNumber);
++ 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
+@@ -359,3 +362,4 @@ UcXd/5qu2GhokrKU2cPttU+XAN2Om6a0
+
+ assert.strictEqual(cert.checkIssued(cert), false);
+ }
++*/
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-crypto.js
new file mode 100644
index 0000000000..61962f0994
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs b/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-address.mjs
new file mode 100644
index 0000000000..f4255b4657
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-break.js
new file mode 100644
index 0000000000..96485ad8c1
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-random-port-with-inspect-port.js
new file mode 100644
index 0000000000..ffaf87b441
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-debugger-run-after-quit-restart.js
new file mode 100644
index 0000000000..22e3d3ddd9
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-fs-write.js
new file mode 100644
index 0000000000..16481f911a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-additional-options.js
new file mode 100644
index 0000000000..3316230a6f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-https-agent-session-eviction.js
new file mode 100644
index 0000000000..21de76b23f
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-console.mjs b/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-console.mjs
new file mode 100644
index 0000000000..8a98ae7925
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-console.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-node-output-console.mjs.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-node-output-console.mjs
+@@ -31,6 +31,7 @@ describe('console output', { concurrency
+ .transform(snapshot.replaceWindowsLineEndings, snapshot.replaceWindowsPaths, replaceStackTrace);
+ for (const { name, transform, env } of tests) {
+ it(name, async () => {
++ if (env) env.ELECTRON_RUN_AS_NODE = 1;
+ await snapshot.spawnAndAssert(
+ fixtures.path(name),
+ transform ?? defaultTransform,
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs b/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.mjs
new file mode 100644
index 0000000000..2c8d435979
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-errors.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-errors.mjs.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-node-output-errors.mjs
+@@ -59,21 +59,22 @@ describe('errors output', { concurrency:
+ { name: 'errors/events_unhandled_error_subclass.js', transform: errTransform },
+ { name: 'errors/if-error-has-good-stack.js', transform: errTransform },
+ { name: 'errors/throw_custom_error.js', transform: errTransform },
+- { name: 'errors/throw_error_with_getter_throw.js', transform: errTransform },
++ // { name: 'errors/throw_error_with_getter_throw.js', transform: errTransform },
+ { name: 'errors/throw_in_line_with_tabs.js', transform: errTransform },
+ { name: 'errors/throw_non_error.js', transform: errTransform },
+- { name: 'errors/throw_null.js', transform: errTransform },
+- { name: 'errors/throw_undefined.js', transform: errTransform },
++ // { name: 'errors/throw_null.js', transform: errTransform },
++ // { name: 'errors/throw_undefined.js', transform: errTransform },
+ { name: 'errors/timeout_throw.js', transform: errTransform },
+ { name: 'errors/undefined_reference_in_new_context.js', transform: errTransform },
+ { name: 'errors/promise_always_throw_unhandled.js', transform: promiseTransform },
+- { name: 'errors/promise_unhandled_warn_with_error.js', transform: promiseTransform },
++ // { name: 'errors/promise_unhandled_warn_with_error.js', transform: promiseTransform },
+ { name: 'errors/unhandled_promise_trace_warnings.js', transform: promiseTransform },
+- { skip: skipForceColors, name: 'errors/force_colors.js',
+- transform: forceColorsTransform, env: { FORCE_COLOR: 1 } },
++ // { skip: skipForceColors, name: 'errors/force_colors.js',
++ // transform: forceColorsTransform, env: { FORCE_COLOR: 1 } },
+ ];
+ for (const { name, transform = defaultTransform, env, skip = false } of tests) {
+ it(name, { skip }, async () => {
++ if (env) env.ELECTRON_RUN_AS_NODE = 1;
+ await snapshot.spawnAndAssert(fixtures.path(name), transform, { env: { ...env, ...process.env } });
+ });
+ }
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs b/electron32/patches/patch-third__party_electron__node_test_parallel_test-node-output-v8-warning.mjs
new file mode 100644
index 0000000000..4c9c317d01
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getcertificate-x509.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getcertificate-x509.js
new file mode 100644
index 0000000000..8bcf428cde
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getcertificate-x509.js
@@ -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/test/parallel/test-tls-getcertificate-x509.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-tls-getcertificate-x509.js
+@@ -20,9 +20,7 @@ const server = tls.createServer(options,
+ server.once('secureConnection', common.mustCall(function(socket) {
+ const cert = socket.getX509Certificate();
+ assert(cert instanceof X509Certificate);
+- assert.strictEqual(
+- cert.serialNumber,
+- '5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE');
++ assert.match(cert.serialNumber, /5B75D77EDC7FB5B7FA9F1424DA4C64FB815DCBDE/i)
+ }));
+
+ server.listen(0, common.mustCall(function() {
+@@ -33,10 +31,7 @@ server.listen(0, common.mustCall(functio
+ const peerCert = socket.getPeerX509Certificate();
+ assert(peerCert.issuerCertificate instanceof X509Certificate);
+ assert.strictEqual(peerCert.issuerCertificate.issuerCertificate, undefined);
+- assert.strictEqual(
+- peerCert.issuerCertificate.serialNumber,
+- '147D36C1C2F74206DE9FAB5F2226D78ADB00A425'
+- );
++ assert.match(peerCert.issuerCertificate.serialNumber, /147D36C1C2F74206DE9FAB5F2226D78ADB00A425/i);
+ server.close();
+ }));
+ socket.end('Hello');
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-getprotocol.js
new file mode 100644
index 0000000000..d48d43b687
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-tls-write-error.js
new file mode 100644
index 0000000000..c99a70541e
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-serdes.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-serdes.js
new file mode 100644
index 0000000000..5250f4cca3
--- /dev/null
+++ b/electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-serdes.js
@@ -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/test/parallel/test-v8-serdes.js.orig 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/test/parallel/test-v8-serdes.js
+@@ -163,11 +163,11 @@ const hostObject = new (internalBinding(
+
+ {
+ // Test that an old serialized value can still be deserialized.
+- const buf = Buffer.from('ff0d6f2203666f6f5e007b01', 'hex');
++ const buf = Buffer.from('ff0f6f2203666f6f5e007b01', 'hex');
+
+ const des = new v8.DefaultDeserializer(buf);
+ des.readHeader();
+- assert.strictEqual(des.getWireFormatVersion(), 0x0d);
++ assert.strictEqual(des.getWireFormatVersion(), 0x0f);
+
+ const value = des.readValue();
+ assert.strictEqual(value, value.foo);
+@@ -202,7 +202,7 @@ const hostObject = new (internalBinding(
+ {
+ // Unaligned Uint16Array read, with padding in the underlying array buffer.
+ let buf = Buffer.alloc(32 + 9);
+- buf.write('ff0d5c0404addeefbe', 32, 'hex');
++ buf.write('ff0e5c0404addeefbe', 32, 'hex');
+ buf = buf.slice(32);
+
+ const expectedResult = os.endianness() === 'LE' ?
diff --git a/electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-v8-stats.js
new file mode 100644
index 0000000000..13542c3dbc
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivebits.js
new file mode 100644
index 0000000000..48dd109a6a
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-derivekey.js
new file mode 100644
index 0000000000..b298664f75
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-sign-verify.js
new file mode 100644
index 0000000000..4ce2e20630
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-webcrypto-wrap-unwrap.js
new file mode 100644
index 0000000000..faae357480
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-worker-unsupported-things.js
new file mode 100644
index 0000000000..133b7808bf
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js b/electron32/patches/patch-third__party_electron__node_test_parallel_test-x509-escaping.js
new file mode 100644
index 0000000000..00d440118d
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_sequential_sequential.status b/electron32/patches/patch-third__party_electron__node_test_sequential_sequential.status
new file mode 100644
index 0000000000..4ba502600d
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js b/electron32/patches/patch-third__party_electron__node_test_sequential_test-debugger-pid.js
new file mode 100644
index 0000000000..183bd40070
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_test_wpt_status_streams.json b/electron32/patches/patch-third__party_electron__node_test_wpt_status_streams.json
new file mode 100644
index 0000000000..2b0267d7a1
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_electron__node_tools_install.py b/electron32/patches/patch-third__party_electron__node_tools_install.py
new file mode 100644
index 0000000000..ecf2251782
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.000000000 +0000
++++ third_party/electron_node/tools/install.py
+@@ -264,6 +264,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',
+@@ -284,6 +285,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',
+@@ -390,7 +393,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/electron32/patches/patch-third__party_electron__node_tools_js2c.cc b/electron32/patches/patch-third__party_electron__node_tools_js2c.cc
new file mode 100644
index 0000000000..2a762467b4
--- /dev/null
+++ b/electron32/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 2024-11-18 09:27:56.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/electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__mac.cfg
new file mode 100644
index 0000000000..e8af426bbc
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_chromium-browser-clang_rewrapper__windows.cfg
new file mode 100644
index 0000000000..1b76470f24
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py b/electron32/patches/patch-third__party_engflow-reclient-configs_configure__reclient.py
new file mode 100644
index 0000000000..7ad9ec1b68
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__linux.cfg
new file mode 100644
index 0000000000..a0c8d31979
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__mac.cfg
new file mode 100644
index 0000000000..2a0aaa72ed
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_python_rewrapper__windows.cfg
new file mode 100644
index 0000000000..e6b08026a9
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg b/electron32/patches/patch-third__party_engflow-reclient-configs_reproxy.cfg
new file mode 100644
index 0000000000..c4ef76d990
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_ffmpeg_BUILD.gn b/electron32/patches/patch-third__party_ffmpeg_BUILD.gn
new file mode 100644
index 0000000000..2da54806c7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:43.847674400 +0000
++++ third_party/ffmpeg/BUILD.gn
+@@ -343,7 +343,6 @@ target(link_target_type, "ffmpeg_interna
+ libs += [
+ "m",
+ "z",
+- "rt",
+ ]
+ }
+ if (is_component_ffmpeg) {
+@@ -441,7 +440,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/electron32/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h b/electron32/patches/patch-third__party_ffmpeg_libavcodec_x86_cabac.h
new file mode 100644
index 0000000000..7df0afa6ef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:46.782722700 +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/electron32/patches/patch-third__party_ffmpeg_libavutil_cpu.c b/electron32/patches/patch-third__party_ffmpeg_libavutil_cpu.c
new file mode 100644
index 0000000000..9cdf41bdae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:47.438510200 +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/electron32/patches/patch-third__party_ffmpeg_libavutil_mem.c b/electron32/patches/patch-third__party_ffmpeg_libavutil_mem.c
new file mode 100644
index 0000000000..12d3a6b4db
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:47.486494500 +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/electron32/patches/patch-third__party_ffmpeg_libavutil_random__seed.c b/electron32/patches/patch-third__party_ffmpeg_libavutil_random__seed.c
new file mode 100644
index 0000000000..d4e823a131
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:47.502489300 +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/electron32/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm b/electron32/patches/patch-third__party_ffmpeg_libavutil_x86_x86inc.asm
new file mode 100644
index 0000000000..cbcc1fe290
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:47.534479100 +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/electron32/patches/patch-third__party_fontconfig_include_config.h b/electron32/patches/patch-third__party_fontconfig_include_config.h
new file mode 100644
index 0000000000..008169268e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:04.419624300 +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/electron32/patches/patch-third__party_fontconfig_src_src_fccompat.c b/electron32/patches/patch-third__party_fontconfig_src_src_fccompat.c
new file mode 100644
index 0000000000..590833fa29
--- /dev/null
+++ b/electron32/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 2024-10-18 12:37:39.652621300 +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/electron32/patches/patch-third__party_ipcz_src_reference__drivers_random.cc b/electron32/patches/patch-third__party_ipcz_src_reference__drivers_random.cc
new file mode 100644
index 0000000000..cb7ea23069
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:05.447204400 +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/electron32/patches/patch-third__party_ipcz_src_standalone_base_logging.cc b/electron32/patches/patch-third__party_ipcz_src_standalone_base_logging.cc
new file mode 100644
index 0000000000..8cc57122b3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:05.447204400 +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/electron32/patches/patch-third__party_leveldatabase_env__chromium.cc b/electron32/patches/patch-third__party_leveldatabase_env__chromium.cc
new file mode 100644
index 0000000000..93671814cd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:05.479191300 +0000
++++ third_party/leveldatabase/env_chromium.cc
+@@ -326,7 +326,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/electron32/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c b/electron32/patches/patch-third__party_libaom_source_libaom_aom__ports_aarch64__cpudetect.c
new file mode 100644
index 0000000000..4344e03c92
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:32.104065700 +0000
++++ third_party/libaom/source/libaom/aom_ports/aarch64_cpudetect.c
+@@ -99,10 +99,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/electron32/patches/patch-third__party_libc++_src_src_chrono.cpp b/electron32/patches/patch-third__party_libc++_src_src_chrono.cpp
new file mode 100644
index 0000000000..2fbcc79e32
--- /dev/null
+++ b/electron32/patches/patch-third__party_libc++_src_src_chrono.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/libc++/src/src/chrono.cpp.orig 2024-10-18 12:38:47.538477700 +0000
++++ third_party/libc++/src/src/chrono.cpp
+@@ -33,7 +33,8 @@
+
+ // OpenBSD does 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(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
++#if defined(__APPLE__) || defined(__gnu_hurd__) || defined(__OpenBSD__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) || \
++ defined(__FreeBSD__) || defined(__NetBSD__)
+ # define _LIBCPP_HAS_CLOCK_GETTIME
+ #endif
+
diff --git a/electron32/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp b/electron32/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.cpp
new file mode 100644
index 0000000000..1533774bdb
--- /dev/null
+++ b/electron32/patches/patch-third__party_libc++_src_src_filesystem_filesystem__clock.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/libc++/src/src/filesystem/filesystem_clock.cpp.orig 2024-10-18 12:38:47.550474000 +0000
++++ third_party/libc++/src/src/filesystem/filesystem_clock.cpp
+@@ -29,7 +29,8 @@
+ # include <sys/time.h> // for gettimeofday and timeval
+ #endif
+
+-#if defined(__APPLE__) || defined(__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0)
++#if defined(__APPLE__) || defined(__gnu_hurd__) || (defined(_POSIX_TIMERS) && _POSIX_TIMERS > 0) || defined(__OpenBSD__) || \
++ defined(__FreeBSD__) || defined(__NetBSD__)
+ # define _LIBCPP_HAS_CLOCK_GETTIME
+ #endif
+
diff --git a/electron32/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h b/electron32/patches/patch-third__party_libc++abi_src_src_cxa__guard__impl.h
new file mode 100644
index 0000000000..9b4d792009
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:35.082518300 +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/electron32/patches/patch-third__party_libdrm_src_xf86drmMode.c b/electron32/patches/patch-third__party_libdrm_src_xf86drmMode.c
new file mode 100644
index 0000000000..c02dd86ba9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:38:43.951640600 +0000
++++ third_party/libdrm/src/xf86drmMode.c
+@@ -966,7 +966,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;
+@@ -1119,7 +1119,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/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h b/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_memory_singleton.h
new file mode 100644
index 0000000000..f18f614b9a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:24.770433700 +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/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h b/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_synchronization_lock.h
new file mode 100644
index 0000000000..60b6e44f91
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:24.770433700 +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/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h b/electron32/patches/patch-third__party_libphonenumber_dist_cpp_src_phonenumbers_base_thread__checker.h
new file mode 100644
index 0000000000..57cde4eece
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:24.774432400 +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/electron32/patches/patch-third__party_libsync_src_include_sync_sync.h b/electron32/patches/patch-third__party_libsync_src_include_sync_sync.h
new file mode 100644
index 0000000000..a179e31dca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:00.158390500 +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/electron32/patches/patch-third__party_libsync_src_sync.c b/electron32/patches/patch-third__party_libsync_src_sync.c
new file mode 100644
index 0000000000..aac75c90e7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:00.158390500 +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/electron32/patches/patch-third__party_libusb_BUILD.gn b/electron32/patches/patch-third__party_libusb_BUILD.gn
new file mode 100644
index 0000000000..36ab53f3a7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:06.114932000 +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/electron32/patches/patch-third__party_libusb_src_libusb_core.c b/electron32/patches/patch-third__party_libusb_src_libusb_core.c
new file mode 100644
index 0000000000..567e580445
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:06.114932000 +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/electron32/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c b/electron32/patches/patch-third__party_libusb_src_libusb_os_threads__posix.c
new file mode 100644
index 0000000000..6bbfc3fc32
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:06.118930600 +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/electron32/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c b/electron32/patches/patch-third__party_libvpx_source_libvpx_vpx__ports_aarch64__cpudetect.c
new file mode 100644
index 0000000000..28f08be397
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:27.485556800 +0000
++++ third_party/libvpx/source/libvpx/vpx_ports/aarch64_cpudetect.c
+@@ -92,10 +92,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/electron32/patches/patch-third__party_lzma__sdk_C_CpuArch.c b/electron32/patches/patch-third__party_lzma__sdk_C_CpuArch.c
new file mode 100644
index 0000000000..1d200b6bba
--- /dev/null
+++ b/electron32/patches/patch-third__party_lzma__sdk_C_CpuArch.c
@@ -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/lzma_sdk/C/CpuArch.c.orig 2024-10-18 12:35:06.266870300 +0000
++++ third_party/lzma_sdk/C/CpuArch.c
+@@ -412,12 +412,40 @@ 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(ARMV8_OS_FUCHSIA)
++#if !defined(ARMV8_OS_FUCHSIA) && !defined(__FreeBSD__) && !defined(__NetBSD__)
+ #define USE_HWCAP
+ #endif // !defined(ARMV8_OS_FUCHSIA)
+
diff --git a/electron32/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc b/electron32/patches/patch-third__party_material__color__utilities_src_cpp_palettes_tones.cc
new file mode 100644
index 0000000000..ab68eea70e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:32.691876000 +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/electron32/patches/patch-third__party_nan_nan.h b/electron32/patches/patch-third__party_nan_nan.h
new file mode 100644
index 0000000000..1dba9f2d71
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_nan__callbacks__12__inl.h b/electron32/patches/patch-third__party_nan_nan__callbacks__12__inl.h
new file mode 100644
index 0000000000..278585da95
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_nan__persistent__12__inl.h b/electron32/patches/patch-third__party_nan_nan__persistent__12__inl.h
new file mode 100644
index 0000000000..2ca7cf5881
--- /dev/null
+++ b/electron32/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)
++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/electron32/patches/patch-third__party_nan_nan__scriptorigin.h b/electron32/patches/patch-third__party_nan_nan__scriptorigin.h
new file mode 100644
index 0000000000..5424f69e1b
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp b/electron32/patches/patch-third__party_nan_test_cpp_indexedinterceptors.cpp
new file mode 100644
index 0000000000..29319131bc
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp b/electron32/patches/patch-third__party_nan_test_cpp_namedinterceptors.cpp
new file mode 100644
index 0000000000..09f0d0acc5
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_test_cpp_news.cpp b/electron32/patches/patch-third__party_nan_test_cpp_news.cpp
new file mode 100644
index 0000000000..446d69fd6b
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nan_test_js_accessors-test.js b/electron32/patches/patch-third__party_nan_test_js_accessors-test.js
new file mode 100644
index 0000000000..a9c6c37777
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_nasm_BUILD.gn b/electron32/patches/patch-third__party_nasm_BUILD.gn
new file mode 100644
index 0000000000..a9b784f5ef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:35.894842100 +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/electron32/patches/patch-third__party_nasm_config_config-linux.h b/electron32/patches/patch-third__party_nasm_config_config-linux.h
new file mode 100644
index 0000000000..4468b597a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:39:35.934829200 +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/electron32/patches/patch-third__party_node_node.gni b/electron32/patches/patch-third__party_node_node.gni
new file mode 100644
index 0000000000..449205b87c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:06.622725700 +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/electron32/patches/patch-third__party_node_node.py b/electron32/patches/patch-third__party_node_node.py
new file mode 100644
index 0000000000..e8e07de969
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:06.622725700 +0000
++++ third_party/node/node.py
+@@ -20,6 +20,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/electron32/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp b/electron32/patches/patch-third__party_pdfium_core_fxge_cfx__fontmapper.cpp
new file mode 100644
index 0000000000..c53b95cadd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:14.638135400 +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/electron32/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp b/electron32/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.cpp
new file mode 100644
index 0000000000..02610af5e9
--- /dev/null
+++ b/electron32/patches/patch-third__party_pdfium_core_fxge_linux_fx__linux__impl.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/pdfium/core/fxge/linux/fx_linux_impl.cpp.orig 2024-10-18 12:40:14.666251400 +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,9 +173,8 @@ 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/X11R6/lib/X11/fonts/Type1");
++ pInfo->AddPath("/usr/X11R6/lib/X11/fonts/TTF");
+ pInfo->AddPath("/usr/local/share/fonts");
+ }
+ return pInfo;
diff --git a/electron32/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp b/electron32/patches/patch-third__party_pdfium_fxjs_fx__date__helpers.cpp
new file mode 100644
index 0000000000..ae80148927
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:14.722483600 +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/electron32/patches/patch-third__party_pdfium_pdfium.gni b/electron32/patches/patch-third__party_pdfium_pdfium.gni
new file mode 100644
index 0000000000..5855491897
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:14.738550000 +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/electron32/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp b/electron32/patches/patch-third__party_pdfium_xfa_fxfa_parser_cxfa__timezoneprovider.cpp
new file mode 100644
index 0000000000..0979cc175d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:14.983561800 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_base_build__config.h
new file mode 100644
index 0000000000..22212ed11b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.127774700 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_base_thread__utils.h
new file mode 100644
index 0000000000..037a02eab9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.131785600 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_base_time.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_base_time.h
new file mode 100644
index 0000000000..449ae8b458
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.131785600 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_event__fd.h
new file mode 100644
index 0000000000..f6baa113f7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.131785600 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_sys__types.h
new file mode 100644
index 0000000000..8b11276fb5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.139807500 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_ext_base_thread__utils.h
new file mode 100644
index 0000000000..583ac07eae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.139807500 +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/electron32/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h b/electron32/patches/patch-third__party_perfetto_include_perfetto_tracing_internal_track__event__legacy.h
new file mode 100644
index 0000000000..dae6e5818c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.175905700 +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/electron32/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto b/electron32/patches/patch-third__party_perfetto_protos_perfetto_trace_ftrace_v4l2.proto
new file mode 100644
index 0000000000..bbcf1b9bd0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.236069200 +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/electron32/patches/patch-third__party_perfetto_src_base_event__fd.cc b/electron32/patches/patch-third__party_perfetto_src_base_event__fd.cc
new file mode 100644
index 0000000000..23fafa255f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.260134700 +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/electron32/patches/patch-third__party_perfetto_src_base_periodic__task.cc b/electron32/patches/patch-third__party_perfetto_src_base_periodic__task.cc
new file mode 100644
index 0000000000..342e6800d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.264145600 +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/electron32/patches/patch-third__party_perfetto_src_base_string__utils.cc b/electron32/patches/patch-third__party_perfetto_src_base_string__utils.cc
new file mode 100644
index 0000000000..f3402d7528
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.264145600 +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/electron32/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc b/electron32/patches/patch-third__party_perfetto_src_base_subprocess__posix.cc
new file mode 100644
index 0000000000..4fdbacd396
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.264145600 +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/electron32/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc b/electron32/patches/patch-third__party_perfetto_src_base_test_vm__test__utils.cc
new file mode 100644
index 0000000000..7b639c5e23
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.264145600 +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/electron32/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc b/electron32/patches/patch-third__party_perfetto_src_base_thread__task__runner.cc
new file mode 100644
index 0000000000..7dcdd8508f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.268156500 +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/electron32/patches/patch-third__party_perfetto_src_base_unix__socket.cc b/electron32/patches/patch-third__party_perfetto_src_base_unix__socket.cc
new file mode 100644
index 0000000000..44278b4956
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.268156500 +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/electron32/patches/patch-third__party_perfetto_src_base_utils.cc b/electron32/patches/patch-third__party_perfetto_src_base_utils.cc
new file mode 100644
index 0000000000..0764f7661f
--- /dev/null
+++ b/electron32/patches/patch-third__party_perfetto_src_base_utils.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/perfetto/src/base/utils.cc.orig 2024-10-18 12:40:28.268156500 +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 <linux/prctl.h>
+ #include <sys/prctl.h>
+
+@@ -338,8 +339,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/electron32/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc b/electron32/patches/patch-third__party_perfetto_src_trace__processor_importers_ftrace_v4l2__tracker.cc
new file mode 100644
index 0000000000..6ef4379a44
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:28.352385500 +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/electron32/patches/patch-third__party_perfetto_src_tracing_core_clock__snapshots.cc b/electron32/patches/patch-third__party_perfetto_src_tracing_core_clock__snapshots.cc
new file mode 100644
index 0000000000..43cd15213d
--- /dev/null
+++ b/electron32/patches/patch-third__party_perfetto_src_tracing_core_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/tracing/core/clock_snapshots.cc.orig 2024-10-18 12:40:29.054290000 +0000
++++ third_party/perfetto/src/tracing/core/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/electron32/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc b/electron32/patches/patch-third__party_perfetto_src_tracing_ipc_memfd.cc
new file mode 100644
index 0000000000..966f2956bb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:40:29.062311200 +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/electron32/patches/patch-third__party_perfetto_src_tracing_track.cc b/electron32/patches/patch-third__party_perfetto_src_tracing_track.cc
new file mode 100644
index 0000000000..651e50b913
--- /dev/null
+++ b/electron32/patches/patch-third__party_perfetto_src_tracing_track.cc
@@ -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/tracing/track.cc.orig 2024-10-18 12:40:29.078353600 +0000
++++ third_party/perfetto/src/tracing/track.cc
+@@ -155,7 +155,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/electron32/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h b/electron32/patches/patch-third__party_protobuf_src_google_protobuf_stubs_platform__macros.h
new file mode 100644
index 0000000000..f93daaa711
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:07.294453000 +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/electron32/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h b/electron32/patches/patch-third__party_skia_src_gpu_ganesh_GrAutoLocaleSetter.h
new file mode 100644
index 0000000000..14cc636a99
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:56.826851600 +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/electron32/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp b/electron32/patches/patch-third__party_skia_src_ports_SkMemory__malloc.cpp
new file mode 100644
index 0000000000..d8c21eb3fe
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:57.094835000 +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/electron32/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp b/electron32/patches/patch-third__party_skia_src_ports_SkOSFile__posix.cpp
new file mode 100644
index 0000000000..5d64f183dd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:57.094835000 +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/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.cpp b/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.cpp
new file mode 100644
index 0000000000..92df345220
--- /dev/null
+++ b/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.cpp
@@ -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/skia/src/sksl/codegen/SkSLRasterPipelineBuilder.cpp.orig 2024-10-18 12:42:57.126833200 +0000
++++ third_party/skia/src/sksl/codegen/SkSLRasterPipelineBuilder.cpp
+@@ -6,11 +6,15 @@
+ */
+
+ #include "src/sksl/codegen/SkSLRasterPipelineBuilder.h"
++#include <cstdint>
++#include <optional>
+
+ #include "include/core/SkStream.h"
+ #include "include/private/base/SkMalloc.h"
++#include "include/private/base/SkTFitsIn.h"
+ #include "include/private/base/SkTo.h"
+ #include "src/base/SkArenaAlloc.h"
++#include "src/base/SkSafeMath.h"
+ #include "src/core/SkOpts.h"
+ #include "src/core/SkRasterPipelineContextUtils.h"
+ #include "src/core/SkRasterPipelineOpContexts.h"
+@@ -1664,13 +1668,17 @@ static void* context_bit_pun(intptr_t va
+ return sk_bit_cast<void*>(val);
+ }
+
+-Program::SlotData Program::allocateSlotData(SkArenaAlloc* alloc) const {
++std::optional<Program::SlotData> Program::allocateSlotData(SkArenaAlloc* alloc) const {
+ // Allocate a contiguous slab of slot data for immutables, values, and stack entries.
+ const int N = SkOpts::raster_pipeline_highp_stride;
+ const int scalarWidth = 1 * sizeof(float);
+ const int vectorWidth = N * sizeof(float);
+- const int allocSize = vectorWidth * (fNumValueSlots + fNumTempStackSlots) +
+- scalarWidth * fNumImmutableSlots;
++ SkSafeMath safe;
++ size_t allocSize = safe.add(safe.mul(vectorWidth, safe.add(fNumValueSlots, fNumTempStackSlots)),
++ safe.mul(scalarWidth, fNumImmutableSlots));
++ if (!safe || !SkTFitsIn<int>(allocSize)) {
++ return std::nullopt;
++ }
+ float* slotPtr = static_cast<float*>(alloc->makeBytesAlignedTo(allocSize, vectorWidth));
+ sk_bzero(slotPtr, allocSize);
+
+@@ -1691,8 +1699,11 @@ bool Program::appendStages(SkRasterPipel
+ #else
+ // Convert our Instruction list to an array of ProgramOps.
+ TArray<Stage> stages;
+- SlotData slotData = this->allocateSlotData(alloc);
+- this->makeStages(&stages, alloc, uniforms, slotData);
++ std::optional<SlotData> slotData = this->allocateSlotData(alloc);
++ if (!slotData) {
++ return false;
++ }
++ this->makeStages(&stages, alloc, uniforms, *slotData);
+
+ // Allocate buffers for branch targets and labels; these are needed to convert labels into
+ // actual offsets into the pipeline and fix up branches.
+@@ -1706,7 +1717,7 @@ bool Program::appendStages(SkRasterPipel
+ auto resetBasePointer = [&]() {
+ // Whenever we hand off control to another shader, we have to assume that it might overwrite
+ // the base pointer (if it uses SkSL, it will!), so we reset it on return.
+- pipeline->append(SkRasterPipelineOp::set_base_pointer, slotData.values.data());
++ pipeline->append(SkRasterPipelineOp::set_base_pointer, (*slotData).values.data());
+ };
+
+ resetBasePointer();
+@@ -2896,7 +2907,7 @@ void Program::Dumper::dump(SkWStream* ou
+ // executed. The program requires pointer ranges for managing its data, and ASAN will report
+ // errors if those pointers are pointing at unallocated memory.
+ SkArenaAlloc alloc(/*firstHeapAllocation=*/1000);
+- fSlots = fProgram.allocateSlotData(&alloc);
++ fSlots = fProgram.allocateSlotData(&alloc).value();
+ float* uniformPtr = alloc.makeArray<float>(fProgram.fNumUniformSlots);
+ fUniforms = SkSpan(uniformPtr, fProgram.fNumUniformSlots);
+
diff --git a/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.h b/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.h
new file mode 100644
index 0000000000..a3f1631773
--- /dev/null
+++ b/electron32/patches/patch-third__party_skia_src_sksl_codegen_SkSLRasterPipelineBuilder.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/skia/src/sksl/codegen/SkSLRasterPipelineBuilder.h.orig 2024-10-18 12:42:57.126833200 +0000
++++ third_party/skia/src/sksl/codegen/SkSLRasterPipelineBuilder.h
+@@ -19,6 +19,7 @@
+ #include <cstddef>
+ #include <cstdint>
+ #include <memory>
++#include <optional>
+
+ class SkArenaAlloc;
+ class SkRasterPipeline;
+@@ -176,7 +177,7 @@ private:
+ SkSpan<float> stack;
+ SkSpan<float> immutable;
+ };
+- SlotData allocateSlotData(SkArenaAlloc* alloc) const;
++ std::optional<SlotData> allocateSlotData(SkArenaAlloc* alloc) const;
+
+ struct Stage {
+ ProgramOp op;
diff --git a/electron32/patches/patch-third__party_skia_tests_RasterPipelineCodeGeneratorTest.cpp b/electron32/patches/patch-third__party_skia_tests_RasterPipelineCodeGeneratorTest.cpp
new file mode 100644
index 0000000000..49e9a85683
--- /dev/null
+++ b/electron32/patches/patch-third__party_skia_tests_RasterPipelineCodeGeneratorTest.cpp
@@ -0,0 +1,97 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- third_party/skia/tests/RasterPipelineCodeGeneratorTest.cpp.orig 2024-10-18 12:42:57.290823500 +0000
++++ third_party/skia/tests/RasterPipelineCodeGeneratorTest.cpp
+@@ -22,6 +22,7 @@
+
+ #include <memory>
+ #include <optional>
++#include <sstream>
+ #include <string>
+
+ //#define DUMP_PROGRAMS 1
+@@ -250,3 +251,80 @@ DEF_TEST(SkSLRasterPipelineCodeGenerator
+ /*startingColor=*/SkColor4f{0.0, 0.0, 0.0, 0.0},
+ /*expectedResult=*/SkColor4f{0.0, 1.0, 0.0, 1.0});
+ }
++
++DEF_TEST(SkSLRasterPipelineSlotOverflow_355465305, r) {
++ constexpr int kStructMembers1 = 6200;
++ constexpr int kStructMembers2 = 433;
++ std::stringstream str;
++ str << "struct M { float4x4 m";
++ for (int i = 1; i < kStructMembers1; ++i) {
++ str << ",m" << i;
++ }
++ str << ";};";
++ str << "struct M2 { float4x4 m";
++ for (int i = 1; i < kStructMembers2; ++i) {
++ str << ",m" << i;
++ }
++ str << ";};";
++ str << "M f() { M m; return m; }";
++ constexpr int kConstMembers = 40;
++ str << "struct T { float4x4 m0";
++ for (int i = 1; i < kConstMembers; ++i) {
++ str << ",m" << i;
++ }
++ str << ";};";
++ str << "const T K = T(";
++ for (int i = 0; i < kConstMembers; ++i) {
++ if (i > 0) {
++ str << ",";
++ }
++ str << "mat4x4(1337)";
++ }
++ str << ");";
++ str << "half4 main(half4 color) {";
++ str << "float4x4 a = M2(";
++ for (int j = 0; j < kStructMembers2; ++j) {
++ if (j > 0) {
++ str << ",";
++ }
++ const int numAddOps = (j == kStructMembers1 - 1) ? 23 : 25;
++ for (int i = 0; i < numAddOps; ++i) {
++ if (i > 0) {
++ str << "+";
++ }
++ str << "f().m";
++ }
++ }
++ str << ").m;";
++ str << "return half4(a[0]+(K.m0+K.m1+K.m2+K.m3)[0]);";
++ str << "}";
++ std::string src = str.str();
++
++ SkSL::Compiler compiler;
++ std::unique_ptr<SkSL::Program> program =
++ compiler.convertProgram(SkSL::ProgramKind::kRuntimeColorFilter, src, {});
++ if (!program) {
++ ERRORF(r, "Unexpected error compiling %s\n%s", src.c_str(), compiler.errorText().c_str());
++ return;
++ }
++ const SkSL::FunctionDeclaration* main = program->getFunction("main");
++ if (!main) {
++ ERRORF(r, "Program must have a 'main' function");
++ return;
++ }
++ SkArenaAlloc alloc(1000);
++ SkRasterPipeline pipeline(&alloc);
++ pipeline.appendConstantColor(&alloc, SkColors::kWhite);
++ std::unique_ptr<SkSL::RP::Program> rasterProg =
++ SkSL::MakeRasterPipelineProgram(*program, *main->definition());
++ // Ideally, this program would fail in the front-end, because of the number of slots needed
++ // for expression evaluation. For now, it succeeds (but then fails in appendStages).
++ if (!rasterProg) {
++ ERRORF(r, "MakeRasterPipelineProgram failed");
++ return;
++ }
++
++ // Append the SkSL program to the raster pipeline.
++ bool success = rasterProg->appendStages(&pipeline, &alloc, /*callbacks=*/nullptr, {});
++ REPORTER_ASSERT(r, !success, "appendStages should fail for very large program");
++}
diff --git a/electron32/patches/patch-third__party_speech-dispatcher_libspeechd__version.h b/electron32/patches/patch-third__party_speech-dispatcher_libspeechd__version.h
new file mode 100644
index 0000000000..37fda08b34
--- /dev/null
+++ b/electron32/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-01-06 07:57:05.302678927 +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/electron32/patches/patch-third__party_speech-dispatcher_speechd__types.h b/electron32/patches/patch-third__party_speech-dispatcher_speechd__types.h
new file mode 100644
index 0000000000..3049ecb292
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:08.637909400 +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/electron32/patches/patch-third__party_sqlite_BUILD.gn b/electron32/patches/patch-third__party_sqlite_BUILD.gn
new file mode 100644
index 0000000000..8c07459c37
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:08.637909400 +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/electron32/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c b/electron32/patches/patch-third__party_sqlite_src_amalgamation__dev_sqlite3.c
new file mode 100644
index 0000000000..238e250da1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:03.346590300 +0000
++++ third_party/sqlite/src/amalgamation_dev/sqlite3.c
+@@ -20545,6 +20545,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/electron32/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c b/electron32/patches/patch-third__party_sqlite_src_amalgamation_sqlite3.c
new file mode 100644
index 0000000000..7928762862
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:03.218550200 +0000
++++ third_party/sqlite/src/amalgamation/sqlite3.c
+@@ -14119,7 +14119,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
+
+@@ -20532,6 +20532,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)
+@@ -44777,6 +44780,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);
+@@ -44793,6 +44801,7 @@ static int unixRandomness(sqlite3_vfs *N
+ }
+ }
+ #endif
++#endif
+ return nBuf;
+ }
+
diff --git a/electron32/patches/patch-third__party_squirrel.mac_.gitignore b/electron32/patches/patch-third__party_squirrel.mac_.gitignore
new file mode 100644
index 0000000000..1035550dde
--- /dev/null
+++ b/electron32/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/
++vendor
diff --git a/electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.h
new file mode 100644
index 0000000000..2e896ac311
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_RACSignal+SQRLTransactionExtensions.m
new file mode 100644
index 0000000000..e93c61633a
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLCodeSignature.m
new file mode 100644
index 0000000000..c8a5795dc6
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDirectoryManager.m
new file mode 100644
index 0000000000..4763e911a3
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLDownloadedUpdate.m
new file mode 100644
index 0000000000..13475beaeb
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.h
new file mode 100644
index 0000000000..34ffc31208
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLInstaller.m
new file mode 100644
index 0000000000..e10bd2bc31
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItLauncher.m
new file mode 100644
index 0000000000..a2db3f57c4
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLShipItRequest.m
new file mode 100644
index 0000000000..fcc1c139b5
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLTerminationListener.m
new file mode 100644
index 0000000000..2fc2bb6e5f
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdate.m
new file mode 100644
index 0000000000..3756a9bf6e
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.h
new file mode 100644
index 0000000000..705a93625f
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLUpdater.m
new file mode 100644
index 0000000000..5d1ae7a05e
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_SQRLZipArchiver.m
new file mode 100644
index 0000000000..80bb64141c
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
new file mode 100644
index 0000000000..886ce92595
--- /dev/null
+++ b/electron32/patches/patch-third__party_squirrel.mac_Squirrel_ShipIt-main.m
@@ -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/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,11 +153,35 @@ 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 {
+@@ -158,8 +199,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 +219,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;
+ }
+
diff --git a/electron32/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h b/electron32/patches/patch-third__party_squirrel.mac_vendor_Mantle_Mantle_Mantle.h
new file mode 100644
index 0000000000..3ff32fccc8
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSControl+RACTextSignalSupport.m
new file mode 100644
index 0000000000..989c92100b
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSNotificationCenter+RACSupport.m
new file mode 100644
index 0000000000..54017a5fbd
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACAppKitBindings.m
new file mode 100644
index 0000000000..5466b87159
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACKVOWrapper.m
new file mode 100644
index 0000000000..16995eff57
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACLifting.m
new file mode 100644
index 0000000000..a41f7a42ac
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.h
new file mode 100644
index 0000000000..53546df40d
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACPropertySubscribing.m
new file mode 100644
index 0000000000..28e97f936c
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSObject+RACSelectorSignal.m
new file mode 100644
index 0000000000..2ce6afb905
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSText+RACSignalSupport.m
new file mode 100644
index 0000000000..4b6e92e5e2
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_NSUserDefaults+RACSupport.m
new file mode 100644
index 0000000000..5a252c1f56
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACCommand.m
new file mode 100644
index 0000000000..0050b55501
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACDynamicSignal.m
new file mode 100644
index 0000000000..9f44b84add
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.h
new file mode 100644
index 0000000000..5463d05b06
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACKVOChannel.m
new file mode 100644
index 0000000000..b3541f491d
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACQueueScheduler.m
new file mode 100644
index 0000000000..c8a381344d
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubject.m
new file mode 100644
index 0000000000..32d93cd056
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriber.m
new file mode 100644
index 0000000000..4ebb91be9b
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACSubscriptingAssignmentTrampoline.h
new file mode 100644
index 0000000000..2b7c18bc04
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTestScheduler.m
new file mode 100644
index 0000000000..455c0583c2
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACTuple.m
new file mode 100644
index 0000000000..20507599ba
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_RACUnarySequence.m
new file mode 100644
index 0000000000..80addd36f4
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIBarButtonItem+RACCommandSupport.m
new file mode 100644
index 0000000000..a962ba4438
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIButton+RACCommandSupport.m
new file mode 100644
index 0000000000..f7b866c0da
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIControl+RACSignalSupport.m
new file mode 100644
index 0000000000..8bd701b398
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIDatePicker+RACSignalSupport.m
new file mode 100644
index 0000000000..266b9c76ed
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIGestureRecognizer+RACSignalSupport.m
new file mode 100644
index 0000000000..a8f456d12b
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIRefreshControl+RACCommandSupport.m
new file mode 100644
index 0000000000..ab3d7891b3
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISegmentedControl+RACSignalSupport.m
new file mode 100644
index 0000000000..2d867bcc75
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISlider+RACSignalSupport.m
new file mode 100644
index 0000000000..1287cb3de9
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UIStepper+RACSignalSupport.m
new file mode 100644
index 0000000000..94418a04ab
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UISwitch+RACSignalSupport.m
new file mode 100644
index 0000000000..4899260cf3
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextField+RACSignalSupport.m
new file mode 100644
index 0000000000..49b4c3594e
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m b/electron32/patches/patch-third__party_squirrel.mac_vendor_ReactiveObjC_ReactiveObjC_UITextView+RACSignalSupport.m
new file mode 100644
index 0000000000..6d2cb14aa6
--- /dev/null
+++ b/electron32/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/electron32/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp b/electron32/patches/patch-third__party_swiftshader_src_Reactor_Debug.cpp
new file mode 100644
index 0000000000..974cf76064
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:17.135230300 +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/electron32/patches/patch-third__party_swiftshader_src_System_Configurator.cpp b/electron32/patches/patch-third__party_swiftshader_src_System_Configurator.cpp
new file mode 100644
index 0000000000..0084bda8ff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:17.147232000 +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/electron32/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp b/electron32/patches/patch-third__party_swiftshader_src_System_Linux_MemFd.cpp
new file mode 100644
index 0000000000..333f8b6db7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:17.147232000 +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/electron32/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp b/electron32/patches/patch-third__party_swiftshader_src_Vulkan_VkSemaphoreExternalLinux.hpp
new file mode 100644
index 0000000000..0bba84d1a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:17.167234700 +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/electron32/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp b/electron32/patches/patch-third__party_swiftshader_src_WSI_libXCB.cpp
new file mode 100644
index 0000000000..bdac50c535
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:17.171235300 +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/electron32/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h b/electron32/patches/patch-third__party_swiftshader_third__party_llvm-10.0_configs_linux_include_llvm_Config_config.h
new file mode 100644
index 0000000000..7bf3130927
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:20.559695200 +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/electron32/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h b/electron32/patches/patch-third__party_swiftshader_third__party_llvm-subzero_build_Linux_include_llvm_Config_config.h
new file mode 100644
index 0000000000..ba3f8d2b73
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:23.852143500 +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/electron32/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp b/electron32/patches/patch-third__party_swiftshader_third__party_marl_src_memory.cpp
new file mode 100644
index 0000000000..b4aa3c1d78
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:23.960158000 +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/electron32/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp b/electron32/patches/patch-third__party_swiftshader_third__party_marl_src_thread.cpp
new file mode 100644
index 0000000000..52320be896
--- /dev/null
+++ b/electron32/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 2024-10-18 12:46:23.960158000 +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/electron32/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn b/electron32/patches/patch-third__party_test__fonts_fontconfig_BUILD.gn
new file mode 100644
index 0000000000..6dd7063263
--- /dev/null
+++ b/electron32/patches/patch-third__party_test__fonts_fontconfig_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
+
+--- third_party/test_fonts/fontconfig/BUILD.gn.orig 2024-10-18 12:35:09.169695000 +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) {
diff --git a/electron32/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc b/electron32/patches/patch-third__party_test__fonts_fontconfig_fontconfig__util__linux.cc
new file mode 100644
index 0000000000..7afe7e9d2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:09.169695000 +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/electron32/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc b/electron32/patches/patch-third__party_test__fonts_fontconfig_generate__fontconfig__caches.cc
new file mode 100644
index 0000000000..971c1f0b3c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:09.173693400 +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/electron32/patches/patch-third__party_tflite_features.gni b/electron32/patches/patch-third__party_tflite_features.gni
new file mode 100644
index 0000000000..fd6cd49acb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:09.173693400 +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/electron32/patches/patch-third__party_unrar_src_crypt.cpp b/electron32/patches/patch-third__party_unrar_src_crypt.cpp
new file mode 100644
index 0000000000..334a64356b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.345222000 +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/electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h b/electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_external_vma_vk__mem__alloc.h
new file mode 100644
index 0000000000..03772fc3f4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:13.357554700 +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/electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp b/electron32/patches/patch-third__party_vulkan-validation-layers_src_layers_vulkan_generated_vk__function__pointers.cpp
new file mode 100644
index 0000000000..46b3699662
--- /dev/null
+++ b/electron32/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 2024-10-18 12:42:13.437577000 +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/electron32/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h b/electron32/patches/patch-third__party_vulkan__memory__allocator_include_vk__mem__alloc.h
new file mode 100644
index 0000000000..699555d55d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:41:17.264824000 +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/electron32/patches/patch-third__party_wayland_BUILD.gn b/electron32/patches/patch-third__party_wayland_BUILD.gn
new file mode 100644
index 0000000000..a2dcf32e2f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.385206000 +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/electron32/patches/patch-third__party_wayland_include_config.h b/electron32/patches/patch-third__party_wayland_include_config.h
new file mode 100644
index 0000000000..2f50062315
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.385206000 +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/electron32/patches/patch-third__party_webrtc_BUILD.gn b/electron32/patches/patch-third__party_webrtc_BUILD.gn
new file mode 100644
index 0000000000..b507d44c02
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:43.446776200 +0000
++++ third_party/webrtc/BUILD.gn
+@@ -215,6 +215,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/electron32/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn b/electron32/patches/patch-third__party_webrtc_modules_audio__device_BUILD.gn
new file mode 100644
index 0000000000..9cc67d6342
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.306815600 +0000
++++ third_party/webrtc/modules/audio_device/BUILD.gn
+@@ -333,7 +333,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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_desktop__capturer.cc
new file mode 100644
index 0000000000..fe81e1cae7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.442822000 +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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_base__capturer__pipewire.cc
new file mode 100644
index 0000000000..575d72b0fa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.442822000 +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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_wayland_egl__dmabuf.cc
new file mode 100644
index 0000000000..22659bf382
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.442822000 +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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_linux_x11_x__server__pixel__buffer.cc
new file mode 100644
index 0000000000..2584eded9b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.454822500 +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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_screen__capturer__linux.cc
new file mode 100644
index 0000000000..1865aaee3f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.458822700 +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/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc b/electron32/patches/patch-third__party_webrtc_modules_desktop__capture_window__capturer__linux.cc
new file mode 100644
index 0000000000..c02a045eee
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.466823000 +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/electron32/patches/patch-third__party_webrtc_rtc__base_byte__order.h b/electron32/patches/patch-third__party_webrtc_rtc__base_byte__order.h
new file mode 100644
index 0000000000..a5285371bc
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.978847300 +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/electron32/patches/patch-third__party_webrtc_rtc__base_ip__address.cc b/electron32/patches/patch-third__party_webrtc_rtc__base_ip__address.cc
new file mode 100644
index 0000000000..6cc35a27df
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:44.998848200 +0000
++++ third_party/webrtc/rtc_base/ip_address.cc
+@@ -13,7 +13,8 @@
+ #include <sys/socket.h>
+
+ #include "absl/strings/string_view.h"
+-#ifdef OPENBSD
++#if defined(WEBRTC_BSD)
++#include <sys/types.h>
+ #include <netinet/in_systm.h>
+ #endif
+ #ifndef __native_client__
diff --git a/electron32/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc b/electron32/patches/patch-third__party_webrtc_rtc__base_net__test__helpers.cc
new file mode 100644
index 0000000000..630509fd62
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.002848400 +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/electron32/patches/patch-third__party_webrtc_rtc__base_network.cc b/electron32/patches/patch-third__party_webrtc_rtc__base_network.cc
new file mode 100644
index 0000000000..07fbd9cd2e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.002848400 +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/electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc b/electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.cc
new file mode 100644
index 0000000000..295bce819c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.022849300 +0000
++++ third_party/webrtc/rtc_base/physical_socket_server.cc
+@@ -54,7 +54,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
+
+@@ -74,7 +74,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;
+@@ -329,7 +329,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) {
+@@ -358,7 +358,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) {
+@@ -389,7 +389,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
+@@ -418,7 +418,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
+@@ -697,7 +697,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)
+@@ -746,7 +746,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;
+@@ -766,10 +766,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;
+@@ -777,12 +786,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/electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h b/electron32/patches/patch-third__party_webrtc_rtc__base_physical__socket__server.h
new file mode 100644
index 0000000000..7187c00f3c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.022849300 +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/electron32/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc b/electron32/patches/patch-third__party_webrtc_rtc__base_platform__thread__types.cc
new file mode 100644
index 0000000000..36cf060aec
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.022849300 +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/electron32/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h b/electron32/patches/patch-third__party_webrtc_rtc__base_third__party_sigslot_sigslot.h
new file mode 100644
index 0000000000..dadb41da1a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.038850300 +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/electron32/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn b/electron32/patches/patch-third__party_webrtc_system__wrappers_BUILD.gn
new file mode 100644
index 0000000000..c5991f0f66
--- /dev/null
+++ b/electron32/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 2024-10-18 12:43:45.398867600 +0000
++++ third_party/webrtc/system_wrappers/BUILD.gn
+@@ -63,8 +63,6 @@ rtc_library("system_wrappers") {
+ if (!build_with_chromium) {
+ sources += [ "source/cpu_features_linux.cc" ]
+ }
+-
+- libs += [ "rt" ]
+ }
+
+ if (is_win) {
diff --git a/electron32/patches/patch-third__party_widevine_cdm_widevine.gni b/electron32/patches/patch-third__party_widevine_cdm_widevine.gni
new file mode 100644
index 0000000000..21afb77546
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.569132300 +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/electron32/patches/patch-third__party_zlib_BUILD.gn b/electron32/patches/patch-third__party_zlib_BUILD.gn
new file mode 100644
index 0000000000..f6e18c7115
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.801039200 +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/electron32/patches/patch-third__party_zlib_cpu__features.c b/electron32/patches/patch-third__party_zlib_cpu__features.c
new file mode 100644
index 0000000000..2bfc54c33b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.805037500 +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/electron32/patches/patch-tools_clang_scripts_update.py b/electron32/patches/patch-tools_clang_scripts_update.py
new file mode 100644
index 0000000000..42a5122616
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.877008700 +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/electron32/patches/patch-tools_generate__shim__headers_generate__shim__headers.py b/electron32/patches/patch-tools_generate__shim__headers_generate__shim__headers.py
new file mode 100644
index 0000000000..88691bfc2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.900999000 +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/electron32/patches/patch-tools_generate__stubs_rules.gni b/electron32/patches/patch-tools_generate__stubs_rules.gni
new file mode 100644
index 0000000000..0b141a7e2a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.900999000 +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/electron32/patches/patch-tools_gn_build_build__linux.ninja.template b/electron32/patches/patch-tools_gn_build_build__linux.ninja.template
new file mode 100644
index 0000000000..534d4e8634
--- /dev/null
+++ b/electron32/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 2024-09-10 19:04:57.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/electron32/patches/patch-tools_gn_build_gen.py b/electron32/patches/patch-tools_gn_build_gen.py
new file mode 100644
index 0000000000..74d5a31e0b
--- /dev/null
+++ b/electron32/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 2024-09-10 19:04:57.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/electron32/patches/patch-tools_gn_src_base_files_file__posix.cc b/electron32/patches/patch-tools_gn_src_base_files_file__posix.cc
new file mode 100644
index 0000000000..20fd254c0e
--- /dev/null
+++ b/electron32/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 2024-09-10 19:04:57.000000000 +0000
++++ tools/gn/src/base/files/file_posix.cc
+@@ -371,7 +371,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/electron32/patches/patch-tools_gn_src_gn_version.h b/electron32/patches/patch-tools_gn_src_gn_version.h
new file mode 100644
index 0000000000..d5bdc0bbfb
--- /dev/null
+++ b/electron32/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 2024-09-10 19:04:57.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/electron32/patches/patch-tools_gn_src_util_exe__path.cc b/electron32/patches/patch-tools_gn_src_util_exe__path.cc
new file mode 100644
index 0000000000..e50bae2c9d
--- /dev/null
+++ b/electron32/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 2024-09-10 19:04:57.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/electron32/patches/patch-tools_grit_grit_node_base.py b/electron32/patches/patch-tools_grit_grit_node_base.py
new file mode 100644
index 0000000000..8d9528e87b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.908995900 +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/electron32/patches/patch-tools_gritsettings_resource__ids.spec b/electron32/patches/patch-tools_gritsettings_resource__ids.spec
new file mode 100644
index 0000000000..d654aa8e4c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.952978100 +0000
++++ tools/gritsettings/resource_ids.spec
+@@ -1342,6 +1342,11 @@
+ "includes": [8460],
+ },
+
++ "electron/electron_resources.grd": {
++ "messages": [31750],
++ "includes": [31950],
++ },
++
+ # END "everything else" section.
+ # Everything but chrome/, components/, content/, and ios/
+
diff --git a/electron32/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py b/electron32/patches/patch-tools_json__schema__compiler_cpp__bundle__generator.py
new file mode 100644
index 0000000000..b4245c9e3f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.956976700 +0000
++++ tools/json_schema_compiler/cpp_bundle_generator.py
+@@ -149,7 +149,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/electron32/patches/patch-tools_json__schema__compiler_feature__compiler.py b/electron32/patches/patch-tools_json__schema__compiler_feature__compiler.py
new file mode 100644
index 0000000000..ab00a02c11
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.956976700 +0000
++++ tools/json_schema_compiler/feature_compiler.py
+@@ -277,6 +277,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/electron32/patches/patch-tools_licenses_licenses.py b/electron32/patches/patch-tools_licenses_licenses.py
new file mode 100644
index 0000000000..7a01b01582
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.960975000 +0000
++++ tools/licenses/licenses.py
+@@ -335,6 +335,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/electron32/patches/patch-tools_memory_partition__allocator_inspect__utils.h b/electron32/patches/patch-tools_memory_partition__allocator_inspect__utils.h
new file mode 100644
index 0000000000..a864ed7237
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:10.972970200 +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/electron32/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn b/electron32/patches/patch-tools_perf_chrome__telemetry__build_BUILD.gn
new file mode 100644
index 0000000000..0aa602c127
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:11.116912600 +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/electron32/patches/patch-tools_protoc__wrapper_protoc__wrapper.py b/electron32/patches/patch-tools_protoc__wrapper_protoc__wrapper.py
new file mode 100644
index 0000000000..4643ec6115
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:11.512754200 +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/electron32/patches/patch-tools_v8__context__snapshot_BUILD.gn b/electron32/patches/patch-tools_v8__context__snapshot_BUILD.gn
new file mode 100644
index 0000000000..8bc95eea8e
--- /dev/null
+++ b/electron32/patches/patch-tools_v8__context__snapshot_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
+
+--- tools/v8_context_snapshot/BUILD.gn.orig 2024-10-18 12:35:11.544741400 +0000
++++ tools/v8_context_snapshot/BUILD.gn
+@@ -36,6 +36,24 @@ 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),
++ ]
++}
++
+ if (use_v8_context_snapshot) {
+ if (v8_snapshot_toolchain == current_toolchain) {
+ action("generate_v8_context_snapshot") {
+@@ -52,7 +70,11 @@ if (use_v8_context_snapshot) {
+ "--output_file=$output_path",
+ ]
+
+- deps = [ ":v8_context_snapshot_generator" ]
++ if (target_os == "netbsd") {
++ deps = [ ":v8_context_snapshot_generator", ":run_paxctl_v8_context_snapshot_generator" ]
++ } else {
++ deps = [ ":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/electron32/patches/patch-tools_variations_fieldtrial__to__struct.py b/electron32/patches/patch-tools_variations_fieldtrial__to__struct.py
new file mode 100644
index 0000000000..276f6b0664
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:11.548739700 +0000
++++ tools/variations/fieldtrial_to_struct.py
+@@ -41,6 +41,9 @@ _platforms = [
+ 'linux',
+ 'mac',
+ 'windows',
++ 'openbsd',
++ 'freebsd',
++ 'netbsd',
+ ]
+
+ _form_factors = [
diff --git a/electron32/patches/patch-ui_accelerated__widget__mac_BUILD.gn b/electron32/patches/patch-ui_accelerated__widget__mac_BUILD.gn
new file mode 100644
index 0000000000..f13818f268
--- /dev/null
+++ b/electron32/patches/patch-ui_accelerated__widget__mac_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/accelerated_widget_mac/BUILD.gn.orig 2024-10-18 12:35:11.560735000 +0000
++++ ui/accelerated_widget_mac/BUILD.gn
+@@ -33,6 +33,8 @@ component("accelerated_widget_mac") {
+ "QuartzCore.framework",
+ ]
+
++ configs += ["//electron/build/config:mas_build"]
++
+ if (is_ios) {
+ sources += [ "ca_layer_frame_sink_provider.h" ]
+ }
diff --git a/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h b/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.h
new file mode 100644
index 0000000000..1b3a60f02c
--- /dev/null
+++ b/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.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/accelerated_widget_mac/ca_layer_tree_coordinator.h.orig 2024-10-18 12:35:11.560735000 +0000
++++ ui/accelerated_widget_mac/ca_layer_tree_coordinator.h
+@@ -14,7 +14,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 +112,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/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm b/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.mm
new file mode 100644
index 0000000000..b9f1d66043
--- /dev/null
+++ b/electron32/patches/patch-ui_accelerated__widget__mac_ca__layer__tree__coordinator.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
+
+--- ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm.orig 2024-10-18 12:35:11.560735000 +0000
++++ ui/accelerated_widget_mac/ca_layer_tree_coordinator.mm
+@@ -33,6 +33,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 +62,7 @@ CALayerTreeCoordinator::CALayerTreeCoord
+ #endif
+ ca_context_.layer = root_ca_layer_;
+ }
++#endif
+ }
+
+ CALayerTreeCoordinator::~CALayerTreeCoordinator() = default;
+@@ -164,9 +166,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/electron32/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm b/electron32/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
new file mode 100644
index 0000000000..640037d81f
--- /dev/null
+++ b/electron32/patches/patch-ui_accelerated__widget__mac_display__ca__layer__tree.mm
@@ -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/accelerated_widget_mac/display_ca_layer_tree.mm.orig 2024-10-18 12:35:11.560735000 +0000
++++ ui/accelerated_widget_mac/display_ca_layer_tree.mm
+@@ -121,6 +121,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 +151,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/electron32/patches/patch-ui_accessibility_platform_BUILD.gn b/electron32/patches/patch-ui_accessibility_platform_BUILD.gn
new file mode 100644
index 0000000000..b73bbc4c8d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:11.944581500 +0000
++++ ui/accessibility/platform/BUILD.gn
+@@ -255,6 +255,7 @@ component("platform") {
+ weak_frameworks = [
+ "Accessibility.framework", # macOS 11
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_ios) {
diff --git a/electron32/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm b/electron32/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
new file mode 100644
index 0000000000..d91c927f35
--- /dev/null
+++ b/electron32/patches/patch-ui_accessibility_platform_inspect_ax__transform__mac.mm
@@ -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/accessibility/platform/inspect/ax_transform_mac.mm.orig 2024-10-18 12:35:12.260455400 +0000
++++ ui/accessibility/platform/inspect/ax_transform_mac.mm
+@@ -108,6 +108,7 @@ base::Value AXNSObjectToBaseValue(id val
+ }
+ }
+
++#if !IS_MAS_BUILD()
+ // AXTextMarker
+ if (IsAXTextMarker(value)) {
+ return AXTextMarkerToBaseValue(value, indexer);
+@@ -117,6 +118,7 @@ base::Value AXNSObjectToBaseValue(id val
+ if (IsAXTextMarkerRange(value)) {
+ return AXTextMarkerRangeToBaseValue(value, indexer);
+ }
++#endif
+
+ // Accessible object
+ if (AXElementWrapper::IsValidElement(value)) {
diff --git a/electron32/patches/patch-ui_aura_client_drag__drop__client.h b/electron32/patches/patch-ui_aura_client_drag__drop__client.h
new file mode 100644
index 0000000000..09922b6138
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.332426500 +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/electron32/patches/patch-ui_aura_screen__ozone.cc b/electron32/patches/patch-ui_aura_screen__ozone.cc
new file mode 100644
index 0000000000..94e885db6b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.336425000 +0000
++++ ui/aura/screen_ozone.cc
+@@ -107,7 +107,7 @@ display::Display ScreenOzone::GetPrimary
+ return platform_screen_->GetPrimaryDisplay();
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ ScreenOzone::ScreenSaverSuspenderOzone::ScreenSaverSuspenderOzone(
+ std::unique_ptr<ui::PlatformScreen::PlatformScreenSaverSuspender> suspender)
+ : suspender_(std::move(suspender)) {}
diff --git a/electron32/patches/patch-ui_aura_screen__ozone.h b/electron32/patches/patch-ui_aura_screen__ozone.h
new file mode 100644
index 0000000000..48ce65499c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.336425000 +0000
++++ ui/aura/screen_ozone.h
+@@ -45,7 +45,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_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ std::unique_ptr<display::Screen::ScreenSaverSuspender> SuspendScreenSaver()
+ override;
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
+@@ -74,7 +74,7 @@ class AURA_EXPORT ScreenOzone : public d
+ ui::PlatformScreen* platform_screen() { return platform_screen_.get(); }
+
+ private:
+-#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ class ScreenSaverSuspenderOzone
+ : public display::Screen::ScreenSaverSuspender {
+ public:
diff --git a/electron32/patches/patch-ui_base_BUILD.gn b/electron32/patches/patch-ui_base_BUILD.gn
new file mode 100644
index 0000000000..da0db36f9f
--- /dev/null
+++ b/electron32/patches/patch-ui_base_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/base/BUILD.gn.orig 2024-10-18 12:35:12.344421900 +0000
++++ ui/base/BUILD.gn
+@@ -363,6 +363,7 @@ component("base") {
+ "interaction/element_tracker_mac.mm",
+ "resource/resource_bundle_mac.mm",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_apple) {
+@@ -380,6 +381,13 @@ component("base") {
+ sources += [ "resource/resource_bundle_lacros.cc" ]
+ }
+
++ if (is_mas_build) {
++ sources -= [
++ "cocoa/remote_accessibility_api.h",
++ "cocoa/remote_accessibility_api.mm",
++ ]
++ }
++
+ if (is_ios) {
+ sources += [
+ "device_form_factor_ios.mm",
diff --git a/electron32/patches/patch-ui_base_accelerators_accelerator.cc b/electron32/patches/patch-ui_base_accelerators_accelerator.cc
new file mode 100644
index 0000000000..6740c864e7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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 "build/build_config.h"
+ #include "build/chromeos_buildflags.h"
+@@ -184,6 +185,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
+@@ -207,6 +213,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)
+@@ -391,7 +401,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.
+@@ -399,7 +409,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()) {
+@@ -409,6 +419,8 @@ 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) || BUILDFLAG(IS_BSD)
++ result = ApplyModifierToAcceleratorString(result, IDS_APP_SUPER_KEY);
+ #else
+ NOTREACHED_IN_MIGRATION();
+ #endif
diff --git a/electron32/patches/patch-ui_base_accelerators_accelerator.h b/electron32/patches/patch-ui_base_accelerators_accelerator.h
new file mode 100644
index 0000000000..9b4e78c05a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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"
+@@ -130,6 +131,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/electron32/patches/patch-ui_base_accelerators_accelerator__unittest.cc b/electron32/patches/patch-ui_base_accelerators_accelerator__unittest.cc
new file mode 100644
index 0000000000..82898d9d68
--- /dev/null
+++ b/electron32/patches/patch-ui_base_accelerators_accelerator__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
+
+--- ui/base/accelerators/accelerator_unittest.cc.orig 2024-10-18 12:35:12.344421900 +0000
++++ ui/base/accelerators/accelerator_unittest.cc
+@@ -59,6 +59,9 @@ TEST(AcceleratorTest, MAYBE_GetShortcutT
+ #if BUILDFLAG(IS_MAC)
+ {VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, nullptr, u"⌃⌘T"},
+ #endif
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
++ {VKEY_T, EF_COMMAND_DOWN | EF_CONTROL_DOWN, u"Super+Ctrl+T", nullptr},
++#endif
+ };
+
+ for (const auto& key : keys) {
diff --git a/electron32/patches/patch-ui_base_accelerators_media__keys__listener.cc b/electron32/patches/patch-ui_base_accelerators_media__keys__listener.cc
new file mode 100644
index 0000000000..e94caa506c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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/electron32/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm b/electron32/patches/patch-ui_base_accelerators_media__keys__listener__mac.mm
new file mode 100644
index 0000000000..94d1a1aced
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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/electron32/patches/patch-ui_base_clipboard_clipboard__constants.cc b/electron32/patches/patch-ui_base_clipboard_clipboard__constants.cc
new file mode 100644
index 0000000000..0ffada374f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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/electron32/patches/patch-ui_base_clipboard_clipboard__constants.h b/electron32/patches/patch-ui_base_clipboard_clipboard__constants.h
new file mode 100644
index 0000000000..a6ba0b3f10
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +0000
++++ ui/base/clipboard/clipboard_constants.h
+@@ -48,7 +48,7 @@ extern const char kMimeTypeDataTransferE
+
+ // ----- 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/electron32/patches/patch-ui_base_clipboard_clipboard__non__backed.cc b/electron32/patches/patch-ui_base_clipboard_clipboard__non__backed.cc
new file mode 100644
index 0000000000..6f6164217b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.344421900 +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/electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc b/electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.cc
new file mode 100644
index 0000000000..210902cb29
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.348420100 +0000
++++ ui/base/clipboard/scoped_clipboard_writer.cc
+@@ -229,6 +229,16 @@ void ScopedClipboardWriter::WriteEncoded
+ }
+ #endif // BUILDFLAG(IS_CHROMEOS_ASH)
+
++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/electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h b/electron32/patches/patch-ui_base_clipboard_scoped__clipboard__writer.h
new file mode 100644
index 0000000000..4091a0950c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.348420100 +0000
++++ ui/base/clipboard/scoped_clipboard_writer.h
+@@ -89,6 +89,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);
+
+ #if BUILDFLAG(IS_CHROMEOS_LACROS)
diff --git a/electron32/patches/patch-ui_base_cocoa_remote__accessibility__api.h b/electron32/patches/patch-ui_base_cocoa_remote__accessibility__api.h
new file mode 100644
index 0000000000..0020be21cb
--- /dev/null
+++ b/electron32/patches/patch-ui_base_cocoa_remote__accessibility__api.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/base/cocoa/remote_accessibility_api.h.orig 2024-10-18 12:35:12.352418700 +0000
++++ ui/base/cocoa/remote_accessibility_api.h
+@@ -13,6 +13,8 @@
+
+ // NSAccessibilityRemoteUIElement is a private class in AppKit.
+
++#if !IS_MAS_BUILD()
++
+ @interface NSAccessibilityRemoteUIElement : NSObject
+ + (void)setRemoteUIApp:(BOOL)flag;
+ + (BOOL)isRemoteUIApp;
+@@ -38,4 +40,6 @@ class COMPONENT_EXPORT(UI_BASE) RemoteAc
+
+ } // namespace ui
+
++#endif // MAS_BUILD
++
+ #endif // UI_BASE_COCOA_REMOTE_ACCESSIBILITY_API_H_
diff --git a/electron32/patches/patch-ui_base_cocoa_remote__layer__api.h b/electron32/patches/patch-ui_base_cocoa_remote__layer__api.h
new file mode 100644
index 0000000000..1a3bc17d45
--- /dev/null
+++ b/electron32/patches/patch-ui_base_cocoa_remote__layer__api.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/cocoa/remote_layer_api.h.orig 2024-10-18 12:35:12.352418700 +0000
++++ ui/base/cocoa/remote_layer_api.h
+@@ -17,6 +17,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 +69,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/electron32/patches/patch-ui_base_cocoa_remote__layer__api.mm b/electron32/patches/patch-ui_base_cocoa_remote__layer__api.mm
new file mode 100644
index 0000000000..0b39dccfae
--- /dev/null
+++ b/electron32/patches/patch-ui_base_cocoa_remote__layer__api.mm
@@ -0,0 +1,37 @@
+$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 2024-10-18 12:35:12.352418700 +0000
++++ ui/base/cocoa/remote_layer_api.mm
+@@ -10,6 +10,7 @@
+
+ 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 +18,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 +58,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/electron32/patches/patch-ui_base_cursor_cursor__factory.cc b/electron32/patches/patch-ui_base_cursor_cursor__factory.cc
new file mode 100644
index 0000000000..b6d4952566
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.352418700 +0000
++++ ui/base/cursor/cursor_factory.cc
+@@ -97,7 +97,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/electron32/patches/patch-ui_base_cursor_cursor__factory.h b/electron32/patches/patch-ui_base_cursor_cursor__factory.h
new file mode 100644
index 0000000000..f08cdec70f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.352418700 +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/electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc b/electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__factory.cc
new file mode 100644
index 0000000000..3b208c261d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.352418700 +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/electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc b/electron32/patches/patch-ui_base_dragdrop_os__exchange__data__provider__non__backed.cc
new file mode 100644
index 0000000000..931f6a6f91
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.352418700 +0000
++++ ui/base/dragdrop/os_exchange_data_provider_non_backed.cc
+@@ -99,7 +99,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/electron32/patches/patch-ui_base_ime_dummy__text__input__client.cc b/electron32/patches/patch-ui_base_ime_dummy__text__input__client.cc
new file mode 100644
index 0000000000..b8c046ffc4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.360415500 +0000
++++ ui/base/ime/dummy_text_input_client.cc
+@@ -159,7 +159,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/electron32/patches/patch-ui_base_ime_dummy__text__input__client.h b/electron32/patches/patch-ui_base_ime_dummy__text__input__client.h
new file mode 100644
index 0000000000..a913c68dd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.360415500 +0000
++++ ui/base/ime/dummy_text_input_client.h
+@@ -65,7 +65,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/electron32/patches/patch-ui_base_ime_fake__text__input__client.cc b/electron32/patches/patch-ui_base_ime_fake__text__input__client.cc
new file mode 100644
index 0000000000..dc45c09968
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.360415500 +0000
++++ ui/base/ime/fake_text_input_client.cc
+@@ -210,7 +210,7 @@ bool FakeTextInputClient::ShouldDoLearni
+ 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 FakeTextInputClient::SetCompositionFromExistingText(
+ const gfx::Range& range,
+ const std::vector<ui::ImeTextSpan>& ui_ime_text_spans) {
diff --git a/electron32/patches/patch-ui_base_ime_fake__text__input__client.h b/electron32/patches/patch-ui_base_ime_fake__text__input__client.h
new file mode 100644
index 0000000000..831bf56480
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.360415500 +0000
++++ ui/base/ime/fake_text_input_client.h
+@@ -98,7 +98,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/electron32/patches/patch-ui_base_ime_init_input__method__initializer.cc b/electron32/patches/patch-ui_base_ime_init_input__method__initializer.cc
new file mode 100644
index 0000000000..8428c82037
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.360415500 +0000
++++ ui/base/ime/init/input_method_initializer.cc
+@@ -10,7 +10,7 @@
+ #include "build/chromeos_buildflags.h"
+
+ #if !BUILDFLAG(IS_CHROMEOS_ASH) && defined(USE_AURA) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || 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)
+@@ -33,7 +33,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> {
+@@ -46,7 +46,7 @@ void InitializeInputMethodForTesting() {
+
+ void ShutdownInputMethodForTesting() {
+ #if !BUILDFLAG(IS_CHROMEOS_ASH) && defined(USE_AURA) && \
+- (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS))
++ (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS) || 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/electron32/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc b/electron32/patches/patch-ui_base_ime_linux_linux__input__method__context__factory.cc
new file mode 100644
index 0000000000..37726928f9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.364414000 +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/electron32/patches/patch-ui_base_ime_text__input__client.h b/electron32/patches/patch-ui_base_ime_text__input__client.h
new file mode 100644
index 0000000000..1fe81968c0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.364414000 +0000
++++ ui/base/ime/text_input_client.h
+@@ -266,7 +266,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/electron32/patches/patch-ui_base_models_simple__menu__model.cc b/electron32/patches/patch-ui_base_models_simple__menu__model.cc
new file mode 100644
index 0000000000..c732da128b
--- /dev/null
+++ b/electron32/patches/patch-ui_base_models_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/base/models/simple_menu_model.cc.orig 2024-10-18 12:35:12.372410800 +0000
++++ ui/base/models/simple_menu_model.cc
+@@ -53,6 +53,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();
+@@ -338,6 +343,11 @@ void SimpleMenuModel::SetLabel(size_t in
+ 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;
+@@ -429,6 +439,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/electron32/patches/patch-ui_base_models_simple__menu__model.h b/electron32/patches/patch-ui_base_models_simple__menu__model.h
new file mode 100644
index 0000000000..035b29da14
--- /dev/null
+++ b/electron32/patches/patch-ui_base_models_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/base/models/simple_menu_model.h.orig 2024-10-18 12:35:12.372410800 +0000
++++ ui/base/models/simple_menu_model.h
+@@ -99,6 +99,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMe
+ // 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;
+
+@@ -218,6 +219,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMe
+ // Sets the label for the item at |index|.
+ void SetLabel(size_t index, const std::u16string& label);
+
++ // 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);
+
+@@ -260,6 +264,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMe
+ 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;
+@@ -299,6 +304,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMe
+ int command_id = 0;
+ ItemType type = TYPE_COMMAND;
+ std::u16string label;
++ std::u16string secondary_label;
+ std::u16string minor_text;
+ ImageModel minor_icon;
+ ImageModel icon;
diff --git a/electron32/patches/patch-ui_base_resource_resource__bundle.cc b/electron32/patches/patch-ui_base_resource_resource__bundle.cc
new file mode 100644
index 0000000000..7fc3896cf4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.376409000 +0000
++++ ui/base/resource/resource_bundle.cc
+@@ -926,7 +926,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/electron32/patches/patch-ui_base_test_skia__gold__pixel__diff.cc b/electron32/patches/patch-ui_base_test_skia__gold__pixel__diff.cc
new file mode 100644
index 0000000000..d3dd5d8039
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/test/skia_gold_pixel_diff.cc
+@@ -115,7 +115,7 @@ const char* GetPlatformName() {
+ return "macOS";
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#elif BUILDFLAG(IS_LINUX)
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ return "linux";
+ #elif BUILDFLAG(IS_CHROMEOS_LACROS)
+ return "lacros";
diff --git a/electron32/patches/patch-ui_base_test_ui__controls.h b/electron32/patches/patch-ui_base_test_ui__controls.h
new file mode 100644
index 0000000000..845220d982
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/test/ui_controls.h
+@@ -186,7 +186,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/electron32/patches/patch-ui_base_ui__base__features.cc b/electron32/patches/patch-ui_base_ui__base__features.cc
new file mode 100644
index 0000000000..fbbf728e1d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/ui_base_features.cc
+@@ -157,7 +157,7 @@ BASE_FEATURE(kWaylandPerSurfaceScale,
+ 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)
+@@ -259,7 +259,7 @@ BASE_FEATURE(kExperimentalFlingAnimation
+ "ExperimentalFlingAnimation",
+ // TODO(crbug.com/40118868): Revisit the macro expression once build flag switch
+ // of lacros-chrome is complete.
+-#if BUILDFLAG(IS_WIN) || \
++#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD) || \
+ (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_ASH) && \
+ !BUILDFLAG(IS_CHROMEOS_LACROS))
+ base::FEATURE_ENABLED_BY_DEFAULT
+@@ -363,7 +363,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/electron32/patches/patch-ui_base_ui__base__features.h b/electron32/patches/patch-ui_base_ui__base__features.h
new file mode 100644
index 0000000000..5590c0f4d9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/ui_base_features.h
+@@ -138,7 +138,7 @@ COMPONENT_EXPORT(UI_BASE_FEATURES)
+ BASE_DECLARE_FEATURE(kWaylandPerSurfaceScale);
+ #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/electron32/patches/patch-ui_base_ui__base__switches.cc b/electron32/patches/patch-ui_base_ui__base__switches.cc
new file mode 100644
index 0000000000..0a597d2aa8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/ui_base_switches.cc
+@@ -31,13 +31,13 @@ const char kShowMacOverlayBorders[] = "s
+ const char kEnableResourcesFileSharing[] = "enable-resources-file-sharing";
+ #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/electron32/patches/patch-ui_base_ui__base__switches.h b/electron32/patches/patch-ui_base_ui__base__switches.h
new file mode 100644
index 0000000000..1da861c06f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/ui_base_switches.h
+@@ -27,11 +27,11 @@ COMPONENT_EXPORT(UI_BASE) extern const c
+ COMPONENT_EXPORT(UI_BASE) extern const char kEnableResourcesFileSharing[];
+ #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/electron32/patches/patch-ui_base_webui_web__ui__util.cc b/electron32/patches/patch-ui_base_webui_web__ui__util.cc
new file mode 100644
index 0000000000..896b7722ca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.380407600 +0000
++++ ui/base/webui/web_ui_util.cc
+@@ -39,7 +39,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();
+@@ -216,7 +216,7 @@ std::string GetFontFamily() {
+
+ // 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 font_name = ui::ResourceBundle::GetSharedInstance()
+ .GetFont(ui::ResourceBundle::BaseFont)
+ .GetFontName();
diff --git a/electron32/patches/patch-ui_base_x_x11__cursor__factory.cc b/electron32/patches/patch-ui_base_x_x11__cursor__factory.cc
new file mode 100644
index 0000000000..e372cf417d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +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/electron32/patches/patch-ui_base_x_x11__cursor__factory.h b/electron32/patches/patch-ui_base_x_x11__cursor__factory.h
new file mode 100644
index 0000000000..4eb372b9a3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +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/electron32/patches/patch-ui_base_x_x11__cursor__loader.cc b/electron32/patches/patch-ui_base_x_x11__cursor__loader.cc
new file mode 100644
index 0000000000..c70648a199
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +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/electron32/patches/patch-ui_base_x_x11__display__manager.cc b/electron32/patches/patch-ui_base_x_x11__display__manager.cc
new file mode 100644
index 0000000000..3870940a5f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +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/electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.cc b/electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.cc
new file mode 100644
index 0000000000..0e04d6351f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +0000
++++ ui/base/x/x11_global_shortcut_listener.cc
+@@ -31,11 +31,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
+@@ -81,8 +83,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);
+
+@@ -107,7 +110,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;
+ }
+@@ -115,8 +118,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);
+
+@@ -124,7 +128,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) {
+@@ -134,14 +138,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/electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.h b/electron32/patches/patch-ui_base_x_x11__global__shortcut__listener.h
new file mode 100644
index 0000000000..63fdbe8327
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +0000
++++ ui/base/x/x11_global_shortcut_listener.h
+@@ -41,18 +41,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
+@@ -61,7 +64,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/electron32/patches/patch-ui_base_x_x11__shm__image__pool.cc b/electron32/patches/patch-ui_base_x_x11__shm__image__pool.cc
new file mode 100644
index 0000000000..a5ba3a7aff
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.384405900 +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 "build/chromeos_buildflags.h"
+ #include "net/base/url_util.h"
+@@ -45,10 +46,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() {
+@@ -57,14 +62,19 @@ std::size_t MaxShmSegmentSize() {
+ }
+
+ #if !BUILDFLAG(IS_CHROMEOS_ASH)
++#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
+@@ -93,6 +103,7 @@ bool ShouldUseMitShm(x11::Connection* co
+ return false;
+
+ return true;
++#endif
+ }
+ #endif
+
+@@ -183,7 +194,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.
+@@ -202,7 +213,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/electron32/patches/patch-ui_color_color__id.h b/electron32/patches/patch-ui_color_color__id.h
new file mode 100644
index 0000000000..1654c2847c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.440383700 +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) \
+@@ -509,6 +513,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) \
+@@ -621,7 +626,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/electron32/patches/patch-ui_color_color__provider__utils.cc b/electron32/patches/patch-ui_color_color__provider__utils.cc
new file mode 100644
index 0000000000..892fbabd8c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.440383700 +0000
++++ ui/color/color_provider_utils.cc
+@@ -187,7 +187,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/electron32/patches/patch-ui_color_system__theme.h b/electron32/patches/patch-ui_color_system__theme.h
new file mode 100644
index 0000000000..1fe53eac23
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.444382000 +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/electron32/patches/patch-ui_color_ui__color__mixer.cc b/electron32/patches/patch-ui_color_ui__color__mixer.cc
new file mode 100644
index 0000000000..a6dc7fa3db
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.444382000 +0000
++++ ui/color/ui_color_mixer.cc
+@@ -180,6 +180,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] =
+@@ -291,6 +302,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/electron32/patches/patch-ui_color_win_native__color__mixers__win.cc b/electron32/patches/patch-ui_color_win_native__color__mixers__win.cc
new file mode 100644
index 0000000000..ce75ed2a7c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.444382000 +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/electron32/patches/patch-ui_compositor_compositor.cc b/electron32/patches/patch-ui_compositor_compositor.cc
new file mode 100644
index 0000000000..800df8ddd2
--- /dev/null
+++ b/electron32/patches/patch-ui_compositor_compositor.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
+
+--- ui/compositor/compositor.cc.orig 2024-10-18 12:35:12.444382000 +0000
++++ ui/compositor/compositor.cc
+@@ -342,7 +342,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) {
+ for (auto& observer : observer_list_) {
+@@ -923,7 +926,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) {
+ for (auto& observer : observer_list_)
+ observer.OnCompositingCompleteSwapWithNewSize(this, size);
+@@ -1016,4 +1019,13 @@ 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);
++ }
++}
++
+ } // namespace ui
diff --git a/electron32/patches/patch-ui_compositor_compositor.h b/electron32/patches/patch-ui_compositor_compositor.h
new file mode 100644
index 0000000000..56c23382b4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.444382000 +0000
++++ ui/compositor/compositor.h
+@@ -90,6 +90,7 @@ namespace mojom {
+ class DisplayPrivate;
+ class ExternalBeginFrameController;
+ } // namespace mojom
++class HostDisplayClient;
+ class HostFrameSinkManager;
+ class LocalSurfaceId;
+ class RasterContextProvider;
+@@ -141,6 +142,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
+@@ -184,6 +195,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)
+
+@@ -494,6 +508,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();
+ }
+@@ -548,6 +566,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;
+
+@@ -622,6 +642,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/electron32/patches/patch-ui_compositor_compositor__observer.h b/electron32/patches/patch-ui_compositor_compositor__observer.h
new file mode 100644
index 0000000000..449b6e8645
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.444382000 +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/electron32/patches/patch-ui_display_BUILD.gn b/electron32/patches/patch-ui_display_BUILD.gn
new file mode 100644
index 0000000000..0eea1dd237
--- /dev/null
+++ b/electron32/patches/patch-ui_display_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
+
+--- ui/display/BUILD.gn.orig 2024-10-18 12:35:12.452378700 +0000
++++ ui/display/BUILD.gn
+@@ -72,6 +72,10 @@ component("display") {
+ "mac/display_link_mac.mm",
+ "mac/screen_mac.mm",
+ ]
++
++ configs += [
++ "//electron/build/config:mas_build"
++ ]
+ }
+
+ if (is_win) {
diff --git a/electron32/patches/patch-ui_display_mac_screen__mac.mm b/electron32/patches/patch-ui_display_mac_screen__mac.mm
new file mode 100644
index 0000000000..3b54188cd3
--- /dev/null
+++ b/electron32/patches/patch-ui_display_mac_screen__mac.mm
@@ -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/mac/screen_mac.mm.orig 2024-10-18 12:35:12.452378700 +0000
++++ ui/display/mac/screen_mac.mm
+@@ -171,7 +171,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.
+ {
diff --git a/electron32/patches/patch-ui_display_screen.cc b/electron32/patches/patch-ui_display_screen.cc
new file mode 100644
index 0000000000..a77d74fc31
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.460375500 +0000
++++ ui/display/screen.cc
+@@ -86,7 +86,7 @@ void Screen::SetDisplayForNewWindows(int
+ display_id_for_new_windows_ = display_id;
+ }
+
+-#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ Screen::ScreenSaverSuspender::~ScreenSaverSuspender() = default;
+
+ std::unique_ptr<Screen::ScreenSaverSuspender> Screen::SuspendScreenSaver() {
diff --git a/electron32/patches/patch-ui_display_screen.h b/electron32/patches/patch-ui_display_screen.h
new file mode 100644
index 0000000000..031960684c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.460375500 +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_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // Object which suspends the platform-specific screensaver for the duration of
+ // its existence.
+ class ScreenSaverSuspender {
+@@ -248,7 +248,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_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ uint32_t screen_saver_suspension_count_ = 0;
+ #endif // BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
+ };
diff --git a/electron32/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc b/electron32/patches/patch-ui_events_devices_x11_device__data__manager__x11.cc
new file mode 100644
index 0000000000..6d67a338b8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.552338800 +0000
++++ ui/events/devices/x11/device_data_manager_x11.cc
+@@ -844,6 +844,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/electron32/patches/patch-ui_events_event.cc b/electron32/patches/patch-ui_events_event.cc
new file mode 100644
index 0000000000..9d6a4177a9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.556337400 +0000
++++ ui/events/event.cc
+@@ -365,7 +365,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)) {
+@@ -621,7 +621,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
+@@ -881,7 +881,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/electron32/patches/patch-ui_events_event__switches.cc b/electron32/patches/patch-ui_events_event__switches.cc
new file mode 100644
index 0000000000..ffb401d810
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.560335600 +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/electron32/patches/patch-ui_events_event__switches.h b/electron32/patches/patch-ui_events_event__switches.h
new file mode 100644
index 0000000000..7f4c336646
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.560335600 +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/electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.cc b/electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.cc
new file mode 100644
index 0000000000..8d50a9d6b1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.572331000 +0000
++++ ui/events/keycodes/dom/keycode_converter.cc
+@@ -13,7 +13,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
+
+@@ -26,7 +26,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)
+@@ -65,7 +65,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;
+@@ -186,7 +186,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/electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.h b/electron32/patches/patch-ui_events_keycodes_dom_keycode__converter.h
new file mode 100644
index 0000000000..71da52511a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.572331000 +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/electron32/patches/patch-ui_events_x_events__x__utils.cc b/electron32/patches/patch-ui_events_x_events__x__utils.cc
new file mode 100644
index 0000000000..86fa0d2efd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.600319900 +0000
++++ ui/events/x/events_x_utils.cc
+@@ -594,6 +594,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/electron32/patches/patch-ui_gfx_BUILD.gn b/electron32/patches/patch-ui_gfx_BUILD.gn
new file mode 100644
index 0000000000..31d306f370
--- /dev/null
+++ b/electron32/patches/patch-ui_gfx_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
+
+--- ui/gfx/BUILD.gn.orig 2024-10-18 12:35:12.652299200 +0000
++++ ui/gfx/BUILD.gn
+@@ -204,6 +204,7 @@ component("gfx") {
+ "scoped_ns_graphics_context_save_gstate_mac.h",
+ "scoped_ns_graphics_context_save_gstate_mac.mm",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+ if (is_win) {
+ sources += [
+@@ -664,7 +665,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/electron32/patches/patch-ui_gfx_ca__layer__params.h b/electron32/patches/patch-ui_gfx_ca__layer__params.h
new file mode 100644
index 0000000000..5dba09ba0c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.660296000 +0000
++++ ui/gfx/ca_layer_params.h
+@@ -6,6 +6,7 @@
+ #define UI_GFX_CA_LAYER_PARAMS_H_
+
+ #include "build/build_config.h"
++#include "ui/gfx/geometry/rect.h"
+ #include "ui/gfx/geometry/size.h"
+ #include "ui/gfx/gfx_export.h"
+
+@@ -51,6 +52,8 @@ struct GFX_EXPORT CALayerParams {
+ 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/electron32/patches/patch-ui_gfx_canvas__skia.cc b/electron32/patches/patch-ui_gfx_canvas__skia.cc
new file mode 100644
index 0000000000..50f64a5c4f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.660296000 +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/electron32/patches/patch-ui_gfx_font__fallback__linux.cc b/electron32/patches/patch-ui_gfx_font__fallback__linux.cc
new file mode 100644
index 0000000000..6a10aabda8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.664294200 +0000
++++ ui/gfx/font_fallback_linux.cc
+@@ -27,6 +27,8 @@
+ #include "ui/gfx/linux/fontconfig_util.h"
+ #include "ui/gfx/platform_font.h"
+
++#include <unistd.h>
++
+ namespace gfx {
+
+ namespace {
diff --git a/electron32/patches/patch-ui_gfx_font__render__params.h b/electron32/patches/patch-ui_gfx_font__render__params.h
new file mode 100644
index 0000000000..abd11cbf97
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.664294200 +0000
++++ ui/gfx/font_render_params.h
+@@ -115,7 +115,7 @@ GFX_EXPORT FontRenderParams GetFontRende
+ 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.
+ GFX_EXPORT void ClearFontRenderParamsCacheForTest();
+@@ -125,7 +125,7 @@ GFX_EXPORT void ClearFontRenderParamsCac
+ GFX_EXPORT 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.
+ GFX_EXPORT void SetFontRenderParamsDeviceScaleFactor(
diff --git a/electron32/patches/patch-ui_gfx_font__render__params__linux.cc b/electron32/patches/patch-ui_gfx_font__render__params__linux.cc
new file mode 100644
index 0000000000..b14e7a619b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.664294200 +0000
++++ ui/gfx/font_render_params_linux.cc
+@@ -25,7 +25,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
+
+@@ -212,7 +212,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/electron32/patches/patch-ui_gfx_font__util.cc b/electron32/patches/patch-ui_gfx_font__util.cc
new file mode 100644
index 0000000000..4b4444a44b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.668292800 +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/electron32/patches/patch-ui_gfx_gpu__memory__buffer.cc b/electron32/patches/patch-ui_gfx_gpu__memory__buffer.cc
new file mode 100644
index 0000000000..b8cb15734e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.676289600 +0000
++++ ui/gfx/gpu_memory_buffer.cc
+@@ -55,7 +55,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/electron32/patches/patch-ui_gfx_gpu__memory__buffer.h b/electron32/patches/patch-ui_gfx_gpu__memory__buffer.h
new file mode 100644
index 0000000000..8ded66cefa
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.676289600 +0000
++++ ui/gfx/gpu_memory_buffer.h
+@@ -15,7 +15,7 @@
+ #include "ui/gfx/geometry/rect.h"
+ #include "ui/gfx/gfx_export.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 GFX_EXPORT GpuMemoryBufferHandle
+ 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/electron32/patches/patch-ui_gfx_linux_dmabuf__uapi.h b/electron32/patches/patch-ui_gfx_linux_dmabuf__uapi.h
new file mode 100644
index 0000000000..8dd3ee254d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.684286400 +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/electron32/patches/patch-ui_gfx_linux_gbm__wrapper.cc b/electron32/patches/patch-ui_gfx_linux_gbm__wrapper.cc
new file mode 100644
index 0000000000..d6c3c0016c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.688284600 +0000
++++ ui/gfx/linux/gbm_wrapper.cc
+@@ -314,7 +314,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/electron32/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc b/electron32/patches/patch-ui_gfx_mojom_buffer__types__mojom__traits.cc
new file mode 100644
index 0000000000..1fb639b343
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.688284600 +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/electron32/patches/patch-ui_gfx_mojom_ca__layer__params.mojom b/electron32/patches/patch-ui_gfx_mojom_ca__layer__params.mojom
new file mode 100644
index 0000000000..bb069a6edf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.688284600 +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/electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc b/electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.cc
new file mode 100644
index 0000000000..cdc0b9a2fb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.688284600 +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/electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h b/electron32/patches/patch-ui_gfx_mojom_ca__layer__params__mojom__traits.h
new file mode 100644
index 0000000000..60421ade9f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.688284600 +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/electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc b/electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.cc
new file mode 100644
index 0000000000..e4aaf773b7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +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/electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h b/electron32/patches/patch-ui_gfx_mojom_native__handle__types__mojom__traits.h
new file mode 100644
index 0000000000..605fdca47d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +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/electron32/patches/patch-ui_gfx_native__pixmap__handle.cc b/electron32/patches/patch-ui_gfx_native__pixmap__handle.cc
new file mode 100644
index 0000000000..c94cfc3832
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +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/electron32/patches/patch-ui_gfx_native__pixmap__handle.h b/electron32/patches/patch-ui_gfx_native__pixmap__handle.h
new file mode 100644
index 0000000000..f34603fedd
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +0000
++++ ui/gfx/native_pixmap_handle.h
+@@ -14,7 +14,7 @@
+ #include "ui/gfx/buffer_types.h"
+ #include "ui/gfx/gfx_export.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 GFX_EXPORT 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)
+@@ -55,7 +55,7 @@ struct GFX_EXPORT NativePixmapPlane {
+ // 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 GFX_EXPORT NativePixmapHandle {
+
+ 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/electron32/patches/patch-ui_gfx_native__widget__types.h b/electron32/patches/patch-ui_gfx_native__widget__types.h
new file mode 100644
index 0000000000..afc5726a8d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +0000
++++ ui/gfx/native_widget_types.h
+@@ -104,7 +104,7 @@ class SkBitmap;
+
+ // 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)
+ extern "C" {
+ struct _AtkObject;
+ using AtkObject = struct _AtkObject;
+@@ -219,7 +219,7 @@ using NativeViewAccessible = struct objc
+ #endif
+ // 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)
+ // Linux doesn't have a native font type.
+ using NativeViewAccessible = AtkObject*;
+ #else
diff --git a/electron32/patches/patch-ui_gfx_platform__font__mac.mm b/electron32/patches/patch-ui_gfx_platform__font__mac.mm
new file mode 100644
index 0000000000..9ec843f4af
--- /dev/null
+++ b/electron32/patches/patch-ui_gfx_platform__font__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/gfx/platform_font_mac.mm.orig 2024-10-18 12:35:12.692283200 +0000
++++ ui/gfx/platform_font_mac.mm
+@@ -28,9 +28,11 @@ namespace gfx {
+
+ using Weight = Font::Weight;
+
++#if !IS_MAS_BUILD()
+ extern "C" {
+ bool CTFontDescriptorIsSystemUIFont(CTFontDescriptorRef);
+ }
++#endif
+
+ namespace {
+
+@@ -245,7 +247,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/electron32/patches/patch-ui_gfx_platform__font__skia.cc b/electron32/patches/patch-ui_gfx_platform__font__skia.cc
new file mode 100644
index 0000000000..3d03383dd8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.692283200 +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/electron32/patches/patch-ui_gfx_render__text__api__fuzzer.cc b/electron32/patches/patch-ui_gfx_render__text__api__fuzzer.cc
new file mode 100644
index 0000000000..b3f4146fb7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.696281400 +0000
++++ ui/gfx/render_text_api_fuzzer.cc
+@@ -20,7 +20,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
+
+@@ -47,7 +47,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/electron32/patches/patch-ui_gfx_render__text__fuzzer.cc b/electron32/patches/patch-ui_gfx_render__text__fuzzer.cc
new file mode 100644
index 0000000000..9a5295ab01
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.696281400 +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/electron32/patches/patch-ui_gfx_switches.cc b/electron32/patches/patch-ui_gfx_switches.cc
new file mode 100644
index 0000000000..da34e43fd9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.700280000 +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/electron32/patches/patch-ui_gfx_switches.h b/electron32/patches/patch-ui_gfx_switches.h
new file mode 100644
index 0000000000..8e61acd131
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.700280000 +0000
++++ ui/gfx/switches.h
+@@ -19,7 +19,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/electron32/patches/patch-ui_gfx_x_generated__protos_dri3.cc b/electron32/patches/patch-ui_gfx_x_generated__protos_dri3.cc
new file mode 100644
index 0000000000..71fffc86b2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.704278200 +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/electron32/patches/patch-ui_gfx_x_generated__protos_shm.cc b/electron32/patches/patch-ui_gfx_x_generated__protos_shm.cc
new file mode 100644
index 0000000000..ea4881e1ab
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.708276700 +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/electron32/patches/patch-ui_gfx_x_xlib__support.cc b/electron32/patches/patch-ui_gfx_x_xlib__support.cc
new file mode 100644
index 0000000000..9849e17833
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.712275000 +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/electron32/patches/patch-ui_gl_BUILD.gn b/electron32/patches/patch-ui_gl_BUILD.gn
new file mode 100644
index 0000000000..61db8f056c
--- /dev/null
+++ b/electron32/patches/patch-ui_gl_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
+
+--- ui/gl/BUILD.gn.orig 2024-10-18 12:35:12.712275000 +0000
++++ ui/gl/BUILD.gn
+@@ -149,8 +149,6 @@ component("gl") {
+ defines += [ "GPU_ENABLE_SERVICE_LOGGING" ]
+ }
+
+- include_dirs = [ "//third_party/mesa_headers" ]
+-
+ public_configs = [ "//third_party/khronos:khronos_headers" ]
+
+ deps = [
+@@ -165,7 +163,6 @@ component("gl") {
+ ]
+ public_deps = [
+ "//base",
+- "//third_party/mesa_headers",
+ "//ui/events/platform",
+ "//ui/gfx",
+ "//ui/gfx/geometry",
+@@ -313,7 +310,6 @@ component("gl") {
+ data_deps += [
+ "//third_party/angle:libEGL",
+ "//third_party/angle:libGLESv2",
+- "//third_party/mesa_headers",
+ ]
+ if (enable_swiftshader) {
+ data_deps += [
+@@ -538,7 +534,6 @@ test("gl_unittests") {
+
+ data_deps = [
+ "//testing/buildbot/filters:gl_unittests_filters",
+- "//third_party/mesa_headers",
+ ]
+
+ if (is_win) {
diff --git a/electron32/patches/patch-ui_gl_gl__context.cc b/electron32/patches/patch-ui_gl_gl__context.cc
new file mode 100644
index 0000000000..28c53dcc5a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.720271800 +0000
++++ ui/gl/gl_context.cc
+@@ -509,7 +509,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/electron32/patches/patch-ui_gl_gl__fence.cc b/electron32/patches/patch-ui_gl_gl__fence.cc
new file mode 100644
index 0000000000..b20287d97b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.720271800 +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/electron32/patches/patch-ui_gl_gl__implementation.cc b/electron32/patches/patch-ui_gl_gl__implementation.cc
new file mode 100644
index 0000000000..9e31ec6644
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.720271800 +0000
++++ ui/gl/gl_implementation.cc
+@@ -254,7 +254,7 @@ GetRequestedGLImplementationFromCommandL
+ *fallback_to_software_gl = false;
+ 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/electron32/patches/patch-ui_gl_gl__switches.cc b/electron32/patches/patch-ui_gl_gl__switches.cc
new file mode 100644
index 0000000000..80c4e506c2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.724270300 +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
+@@ -299,7 +299,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;
+@@ -311,7 +311,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/electron32/patches/patch-ui_gl_sync__control__vsync__provider.cc b/electron32/patches/patch-ui_gl_sync__control__vsync__provider.cc
new file mode 100644
index 0000000000..f325014cea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.724270300 +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/electron32/patches/patch-ui_gl_sync__control__vsync__provider.h b/electron32/patches/patch-ui_gl_sync__control__vsync__provider.h
new file mode 100644
index 0000000000..c51c13ee7e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.724270300 +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/electron32/patches/patch-ui_gtk_gtk__compat.cc b/electron32/patches/patch-ui_gtk_gtk__compat.cc
new file mode 100644
index 0000000000..6e9a26a6b0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_gtk_gtk__compat.h b/electron32/patches/patch-ui_gtk_gtk__compat.h
new file mode 100644
index 0000000000..81b2007ac9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_gtk_gtk__ui.cc b/electron32/patches/patch-ui_gtk_gtk__ui.cc
new file mode 100644
index 0000000000..2d8d7429d8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +0000
++++ ui/gtk/gtk_ui.cc
+@@ -577,11 +577,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/electron32/patches/patch-ui_gtk_gtk__ui.h b/electron32/patches/patch-ui_gtk_gtk__ui.h
new file mode 100644
index 0000000000..d185189882
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_gtk_gtk__util.cc b/electron32/patches/patch-ui_gtk_gtk__util.cc
new file mode 100644
index 0000000000..bb903f5635
--- /dev/null
+++ b/electron32/patches/patch-ui_gtk_gtk__util.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_util.cc.orig 2024-10-18 12:35:12.728268900 +0000
++++ ui/gtk/gtk_util.cc
+@@ -222,9 +222,13 @@ aura::Window* GetAuraTransientParent(Gtk
+ }
+
+ void ClearAuraTransientParent(GtkWidget* dialog, aura::Window* parent) {
++ if (!parent || !parent->GetHost()) {
++ return;
++ }
++
+ g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, nullptr);
+- GtkUi::GetPlatform()->ClearTransientFor(
+- parent->GetHost()->GetAcceleratedWidget());
++ gfx::AcceleratedWidget parent_id = parent->GetHost()->GetAcceleratedWidget();
++ GtkUi::GetPlatform()->ClearTransientFor(parent_id);
+ }
+
+ base::OnceClosure DisableHostInputHandling(GtkWidget* dialog,
diff --git a/electron32/patches/patch-ui_gtk_printing_print__dialog__gtk.cc b/electron32/patches/patch-ui_gtk_printing_print__dialog__gtk.cc
new file mode 100644
index 0000000000..100c75353c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +0000
++++ ui/gtk/printing/print_dialog_gtk.cc
+@@ -242,6 +242,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());
+@@ -434,7 +452,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/electron32/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc b/electron32/patches/patch-ui_gtk_select__file__dialog__linux__gtk.cc
new file mode 100644
index 0000000000..bc6034ff5b
--- /dev/null
+++ b/electron32/patches/patch-ui_gtk_select__file__dialog__linux__gtk.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
+
+--- ui/gtk/select_file_dialog_linux_gtk.cc.orig 2024-10-18 12:35:12.728268900 +0000
++++ ui/gtk/select_file_dialog_linux_gtk.cc
+@@ -408,9 +408,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));
+
+@@ -426,6 +428,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;
+ }
+
+@@ -441,11 +444,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,
+@@ -467,7 +474,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;
+ }
+
+@@ -504,10 +512,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);
+
+@@ -533,9 +542,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;
+ }
+
diff --git a/electron32/patches/patch-ui_gtk_window__frame__provider__gtk.cc b/electron32/patches/patch-ui_gtk_window__frame__provider__gtk.cc
new file mode 100644
index 0000000000..d94defde89
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_gtk_window__frame__provider__gtk.h b/electron32/patches/patch-ui_gtk_window__frame__provider__gtk.h
new file mode 100644
index 0000000000..34efbe97da
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_linux_fallback__linux__ui.cc b/electron32/patches/patch-ui_linux_fallback__linux__ui.cc
new file mode 100644
index 0000000000..33d866963d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_linux_fallback__linux__ui.h b/electron32/patches/patch-ui_linux_fallback__linux__ui.h
new file mode 100644
index 0000000000..60ccc14dbf
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +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/electron32/patches/patch-ui_linux_linux__ui.h b/electron32/patches/patch-ui_linux_linux__ui.h
new file mode 100644
index 0000000000..f093153929
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.728268900 +0000
++++ ui/linux/linux_ui.h
+@@ -307,7 +307,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/electron32/patches/patch-ui_message__center_views_message__popup__view.cc b/electron32/patches/patch-ui_message__center_views_message__popup__view.cc
new file mode 100644
index 0000000000..3631084072
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.732267100 +0000
++++ ui/message_center/views/message_popup_view.cc
+@@ -137,7 +137,7 @@ void MessagePopupView::Show() {
+ params.z_order = ui::ZOrderLevel::kFloatingWindow;
+ // 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)
+ // 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/electron32/patches/patch-ui_native__theme_native__theme.cc b/electron32/patches/patch-ui_native__theme_native__theme.cc
new file mode 100644
index 0000000000..14701b25a2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.736265700 +0000
++++ ui/native_theme/native_theme.cc
+@@ -209,6 +209,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/electron32/patches/patch-ui_native__theme_native__theme.h b/electron32/patches/patch-ui_native__theme_native__theme.h
new file mode 100644
index 0000000000..644b0055f0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.736265700 +0000
++++ ui/native_theme/native_theme.h
+@@ -63,7 +63,7 @@ class NATIVE_THEME_EXPORT NativeTheme {
+ kCheckbox,
+ // 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)
+ kFrameTopArea,
+ #endif
+ kInnerSpinButton,
+@@ -436,6 +436,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
+@@ -664,6 +681,7 @@ class NATIVE_THEME_EXPORT NativeTheme {
+ PreferredColorScheme preferred_color_scheme_ = PreferredColorScheme::kLight;
+ PreferredContrast preferred_contrast_ = PreferredContrast::kNoPreference;
+ std::optional<base::TimeDelta> caret_blink_interval_;
++ ThemeSource theme_source_ = ThemeSource::kSystem;
+
+ SEQUENCE_CHECKER(sequence_checker_);
+ };
diff --git a/electron32/patches/patch-ui_native__theme_native__theme__base.cc b/electron32/patches/patch-ui_native__theme_native__theme__base.cc
new file mode 100644
index 0000000000..e10b214eea
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.736265700 +0000
++++ ui/native_theme/native_theme_base.cc
+@@ -236,7 +236,7 @@ void NativeThemeBase::Paint(cc::PaintCan
+ break;
+ // 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 kFrameTopArea:
+ PaintFrameTopArea(canvas, state, rect,
+ absl::get<FrameTopAreaExtraParams>(extra),
diff --git a/electron32/patches/patch-ui_native__theme_native__theme__features.cc b/electron32/patches/patch-ui_native__theme_native__theme__features.cc
new file mode 100644
index 0000000000..43f841bda0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.736265700 +0000
++++ ui/native_theme/native_theme_features.cc
+@@ -54,7 +54,7 @@ bool IsOverlayScrollbarEnabled() {
+
+ 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
+@@ -63,7 +63,7 @@ bool IsFluentScrollbarEnabled() {
+ }
+ 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;
diff --git a/electron32/patches/patch-ui_native__theme_native__theme__win.cc b/electron32/patches/patch-ui_native__theme_native__theme__win.cc
new file mode 100644
index 0000000000..b1ab33818e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.736265700 +0000
++++ ui/native_theme/native_theme_win.cc
+@@ -677,6 +677,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/electron32/patches/patch-ui_ozone_common_egl__util.cc b/electron32/patches/patch-ui_ozone_common_egl__util.cc
new file mode 100644
index 0000000000..b3cf1507de
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.740264000 +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/electron32/patches/patch-ui_ozone_common_features.cc b/electron32/patches/patch-ui_ozone_common_features.cc
new file mode 100644
index 0000000000..749d3bcb40
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_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
+
+--- ui/ozone/common/features.cc.orig 2024-10-18 12:35:12.740264000 +0000
++++ ui/ozone/common/features.cc
+@@ -30,7 +30,7 @@ BASE_FEATURE(kWaylandSurfaceSubmissionIn
+ // enabled.
+ BASE_FEATURE(kWaylandFractionalScaleV1,
+ "WaylandFractionalScaleV1",
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ base::FEATURE_ENABLED_BY_DEFAULT
+ #else
+ base::FEATURE_DISABLED_BY_DEFAULT
diff --git a/electron32/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc b/electron32/patches/patch-ui_ozone_platform_headless_headless__surface__factory.cc
new file mode 100644
index 0000000000..c12d36d31f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +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
+
+@@ -280,7 +280,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/electron32/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc b/electron32/patches/patch-ui_ozone_platform_headless_ozone__platform__headless.cc
new file mode 100644
index 0000000000..954e95dcef
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +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/electron32/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc b/electron32/patches/patch-ui_ozone_platform_headless_vulkan__implementation__headless.cc
new file mode 100644
index 0000000000..cb5e485f20
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +0000
++++ ui/ozone/platform/headless/vulkan_implementation_headless.cc
+@@ -118,7 +118,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;
+@@ -128,7 +128,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) &&
+@@ -151,7 +151,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/electron32/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc b/electron32/patches/patch-ui_ozone_platform_wayland_common_wayland__util.cc
new file mode 100644
index 0000000000..2ce4d36efc
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_platform_wayland_common_wayland__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
+
+--- ui/ozone/platform/wayland/common/wayland_util.cc.orig 2024-10-18 12:35:12.752259300 +0000
++++ ui/ozone/platform/wayland/common/wayland_util.cc
+@@ -336,7 +336,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.
diff --git a/electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc b/electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.cc
new file mode 100644
index 0000000000..9aba0c4ab3
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +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/electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h b/electron32/patches/patch-ui_ozone_platform_wayland_emulate_wayland__input__emulate.h
new file mode 100644
index 0000000000..e824478e6a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +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/electron32/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc b/electron32/patches/patch-ui_ozone_platform_wayland_gpu_vulkan__implementation__wayland.cc
new file mode 100644
index 0000000000..b116bf1cb5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.752259300 +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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__connection.cc
new file mode 100644
index 0000000000..69923ef00d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.756257500 +0000
++++ ui/ozone/platform/wayland/host/wayland_connection.cc
+@@ -532,7 +532,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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.cc
new file mode 100644
index 0000000000..771da5c1e7
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.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
+
+--- ui/ozone/platform/wayland/host/wayland_data_drag_controller.cc.orig 2024-10-18 12:35:12.760256000 +0000
++++ ui/ozone/platform/wayland/host/wayland_data_drag_controller.cc
+@@ -54,6 +54,16 @@ namespace {
+ using mojom::DragEventSource;
+ using mojom::DragOperation;
+
++// Used for compatibility between W3C and Wayland drag-and-drop specifications.
++// Since wl_data_offer version >= 3, Wayland dnd sessions with no accepted mime
++// type always end as cancelled. W3C drag-and-drop spec on the other hand does
++// not require drag data to be set in order to proceed with drop and drag-end
++// events. Thus, the special mime type below is used to ensure such behavior is
++// supported by the Wayland backend. Further context can be found at
++// https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API and
++// https://wayland.app/protocols/wayland#wl_data_offer:request:accept.
++constexpr char kMimeTypeEmptyDragData[] = "chromium/x-empty-drag-data";
++
+ DragOperation DndActionToDragOperation(uint32_t action) {
+ // Prevent the usage of this function for an operation mask.
+ DCHECK_LE(std::bitset<32>(action).count(), 1u);
+@@ -158,9 +168,17 @@ bool WaylandDataDragController::StartSes
+ << ", serial tracker=" << connection_->serial_tracker().ToString();
+
+ // Create new data source and offers |data|.
+- SetOfferedExchangeDataProvider(data);
++ offered_exchange_data_provider_ = data.provider().Clone();
++ auto mime_types = GetOfferedExchangeDataProvider()->BuildMimeTypesList();
++ if (mime_types.empty()) {
++ // Add placeholder mime type to ensure the drag-and-drop session can end
++ // successfully, even if no drag data was set by the application. See
++ // `kMimeTypeEmptyDragData` declaration for more details.
++ mime_types.push_back(kMimeTypeEmptyDragData);
++ }
++
+ data_source_ = data_device_manager_->CreateSource(this);
+- data_source_->Offer(GetOfferedExchangeDataProvider()->BuildMimeTypesList());
++ data_source_->Offer(mime_types);
+ data_source_->SetDndActions(DragOperationsToDndActions(operations));
+
+ // Create drag icon surface (if any) and store the data to be exchanged.
+@@ -774,11 +792,6 @@ WaylandDataDragController::GetAndValidat
+ : std::nullopt;
+ }
+
+-void WaylandDataDragController::SetOfferedExchangeDataProvider(
+- const OSExchangeData& data) {
+- offered_exchange_data_provider_ = data.provider().Clone();
+-}
+-
+ const WaylandExchangeDataProvider*
+ WaylandDataDragController::GetOfferedExchangeDataProvider() const {
+ DCHECK(offered_exchange_data_provider_);
diff --git a/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.h b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__controller.h
new file mode 100644
index 0000000000..56b0c7eeac
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__data__drag__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/ozone/platform/wayland/host/wayland_data_drag_controller.h.orig 2024-10-18 12:35:12.760256000 +0000
++++ ui/ozone/platform/wayland/host/wayland_data_drag_controller.h
+@@ -216,7 +216,6 @@ class WaylandDataDragController : public
+ std::optional<wl::Serial> GetAndValidateSerialForDrag(
+ mojom::DragEventSource source);
+
+- void SetOfferedExchangeDataProvider(const OSExchangeData& data);
+ const WaylandExchangeDataProvider* GetOfferedExchangeDataProvider() const;
+
+ // Checks whether |data| holds information about a window dragging session.
diff --git a/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__context.cc
new file mode 100644
index 0000000000..4f51780d77
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__input__method__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/ozone/platform/wayland/host/wayland_input_method_context.cc.orig 2024-10-18 12:35:12.760256000 +0000
++++ ui/ozone/platform/wayland/host/wayland_input_method_context.cc
+@@ -55,7 +55,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;
diff --git a/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__popup.cc
new file mode 100644
index 0000000000..0d8dd437f5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.760256000 +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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.cc
new file mode 100644
index 0000000000..71c2b2b5a7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.764254300 +0000
++++ ui/ozone/platform/wayland/host/wayland_toplevel_window.cc
+@@ -620,7 +620,7 @@ void WaylandToplevelWindow::HandleAuraTo
+ const bool did_active_change = is_active_ != window_states.is_activated;
+ is_active_ = window_states.is_activated;
+
+-#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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__toplevel__window.h
new file mode 100644
index 0000000000..19f4d0bfb8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.764254300 +0000
++++ ui/ozone/platform/wayland/host/wayland_toplevel_window.h
+@@ -259,7 +259,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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.cc
new file mode 100644
index 0000000000..d4d9feffe9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.764254300 +0000
++++ ui/ozone/platform/wayland/host/wayland_window.cc
+@@ -317,7 +317,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_));
+@@ -575,7 +575,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) {
+@@ -786,7 +786,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) {
+@@ -1274,12 +1274,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/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h b/electron32/patches/patch-ui_ozone_platform_wayland_host_wayland__window.h
new file mode 100644
index 0000000000..257e420736
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.764254300 +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
+
+@@ -283,7 +283,7 @@ class WaylandWindow : public PlatformWin
+ bool is_snapped_secondary = false;
+ bool is_floated = false;
+ bool is_pip = false;
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ WindowTiledEdges tiled_edges;
+ #endif
+
+@@ -561,7 +561,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
+@@ -630,7 +630,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/electron32/patches/patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__impl.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__impl.cc
new file mode 100644
index 0000000000..c447fc1f90
--- /dev/null
+++ b/electron32/patches/patch-ui_ozone_platform_wayland_host_xdg__toplevel__wrapper__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
+
+--- ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc.orig 2024-10-18 12:35:12.768252800 +0000
++++ ui/ozone/platform/wayland/host/xdg_toplevel_wrapper_impl.cc
+@@ -316,7 +316,7 @@ void XDGToplevelWrapperImpl::OnToplevelC
+ window_states.is_activated =
+ CheckIfWlArrayHasValue(states, XDG_TOPLEVEL_STATE_ACTIVATED);
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ if (xdg_toplevel_get_version(toplevel) >=
+ XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION) {
+ // All four tiled states have the same since version, so it is enough to
diff --git a/electron32/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc b/electron32/patches/patch-ui_ozone_platform_wayland_host_zwp__text__input__wrapper__v1.cc
new file mode 100644
index 0000000000..3fc842319a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.768252800 +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/electron32/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc b/electron32/patches/patch-ui_ozone_platform_wayland_ozone__platform__wayland.cc
new file mode 100644
index 0000000000..d92a83069b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.768252800 +0000
++++ ui/ozone/platform/wayland/ozone_platform_wayland.cc
+@@ -66,13 +66,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
+
+@@ -267,7 +267,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>();
+@@ -277,7 +277,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
+@@ -343,7 +343,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
+@@ -538,7 +538,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/electron32/patches/patch-ui_ozone_platform_x11_BUILD.gn b/electron32/patches/patch-ui_ozone_platform_x11_BUILD.gn
new file mode 100644
index 0000000000..d07d1d95ae
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.772251100 +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/electron32/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc b/electron32/patches/patch-ui_ozone_platform_x11_ozone__platform__x11.cc
new file mode 100644
index 0000000000..2bfbe7074f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.772251100 +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/electron32/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc b/electron32/patches/patch-ui_ozone_platform_x11_vulkan__implementation__x11.cc
new file mode 100644
index 0000000000..b2c1cba238
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc b/electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.cc
new file mode 100644
index 0000000000..95b7fe32b0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h b/electron32/patches/patch-ui_ozone_platform_x11_x11__global__shortcut__listener__ozone.h
new file mode 100644
index 0000000000..32b00b646f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc b/electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.cc
new file mode 100644
index 0000000000..823eea2ba6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h b/electron32/patches/patch-ui_ozone_platform_x11_x11__screen__ozone.h
new file mode 100644
index 0000000000..ecf43305ca
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_platform_x11_x11__window.cc b/electron32/patches/patch-ui_ozone_platform_x11_x11__window.cc
new file mode 100644
index 0000000000..a84fc844ed
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +0000
++++ ui/ozone/platform/x11/x11_window.cc
+@@ -1499,7 +1499,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/electron32/patches/patch-ui_ozone_public_ozone__platform.h b/electron32/patches/patch-ui_ozone_public_ozone__platform.h
new file mode 100644
index 0000000000..7b10c5a6ed
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h b/electron32/patches/patch-ui_ozone_public_platform__global__shortcut__listener.h
new file mode 100644
index 0000000000..3d45bb11a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.776249600 +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/electron32/patches/patch-ui_ozone_test_mock__platform__window__delegate.h b/electron32/patches/patch-ui_ozone_test_mock__platform__window__delegate.h
new file mode 100644
index 0000000000..7e73258d65
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.780248000 +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/electron32/patches/patch-ui_platform__window_platform__window__delegate.cc b/electron32/patches/patch-ui_platform__window_platform__window__delegate.cc
new file mode 100644
index 0000000000..fb80bad20b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.780248000 +0000
++++ ui/platform_window/platform_window_delegate.cc
+@@ -61,7 +61,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/electron32/patches/patch-ui_platform__window_platform__window__delegate.h b/electron32/patches/patch-ui_platform__window_platform__window__delegate.h
new file mode 100644
index 0000000000..3020197bb9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.780248000 +0000
++++ ui/platform_window/platform_window_delegate.h
+@@ -181,7 +181,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/electron32/patches/patch-ui_platform__window_platform__window__init__properties.h b/electron32/patches/patch-ui_platform__window_platform__window__init__properties.h
new file mode 100644
index 0000000000..aef84e7c8e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.780248000 +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/electron32/patches/patch-ui_qt_BUILD.gn b/electron32/patches/patch-ui_qt_BUILD.gn
new file mode 100644
index 0000000000..4ec756926f
--- /dev/null
+++ b/electron32/patches/patch-ui_qt_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/qt/BUILD.gn.orig 2024-10-18 12:35:12.780248000 +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",
diff --git a/electron32/patches/patch-ui_qt_qt.gni b/electron32/patches/patch-ui_qt_qt.gni
new file mode 100644
index 0000000000..a5501eac90
--- /dev/null
+++ b/electron32/patches/patch-ui_qt_qt.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
+
+--- ui/qt/qt.gni.orig 2024-10-18 12:35:12.780248000 +0000
++++ ui/qt/qt.gni
+@@ -14,7 +14,7 @@ declare_args() {
+
+ declare_args() {
+ if (!use_sysroot && use_qt) {
+- moc_qt5_path = ""
++ moc_qt5_path = "@QTDIR@/bin"
+ }
+ }
+
diff --git a/electron32/patches/patch-ui_shell__dialogs_select__file__dialog.h b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog.h
new file mode 100644
index 0000000000..8e5aea430c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.788244700 +0000
++++ ui/shell_dialogs/select_file_dialog.h
+@@ -220,6 +220,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/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.cc
new file mode 100644
index 0000000000..bc0378f0b4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.788244700 +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/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux.h
new file mode 100644
index 0000000000..d16e94318b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.788244700 +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/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
new file mode 100644
index 0000000000..b3dab54266
--- /dev/null
+++ b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__kde.cc
@@ -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/shell_dialogs/select_file_dialog_linux_kde.cc.orig 2024-10-18 12:35:12.788244700 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_kde.cc
+@@ -468,7 +468,7 @@ void SelectFileDialogLinuxKde::CreateSel
+ KDialogParams(
+ "--getexistingdirectory", GetTitle(title, title_message_id),
+ default_path.empty() ? *last_opened_path() : default_path, parent,
+- false, false)),
++ false, allow_multiple_selection())),
+ base::BindOnce(
+ &SelectFileDialogLinuxKde::OnSelectSingleFolderDialogResponse, this,
+ parent));
diff --git a/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.cc
new file mode 100644
index 0000000000..a68c13a027
--- /dev/null
+++ b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.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
+
+--- ui/shell_dialogs/select_file_dialog_linux_portal.cc.orig 2024-10-18 12:35:12.788244700 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_portal.cc
+@@ -39,7 +39,7 @@ constexpr char kMethodStartServiceByName
+ constexpr char kXdgPortalService[] = "org.freedesktop.portal.Desktop";
+ constexpr char kXdgPortalObject[] = "/org/freedesktop/portal/desktop";
+
+-constexpr int kXdgPortalRequiredVersion = 3;
++constexpr int kXdgPortalRequiredVersion = 4;
+
+ constexpr char kXdgPortalRequestInterfaceName[] =
+ "org.freedesktop.portal.Request";
+@@ -216,6 +216,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()) {
+@@ -552,7 +554,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));
+ }
+@@ -561,12 +565,13 @@ 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);
+ }
+
+- if (type == SelectFileDialog::Type::SELECT_SAVEAS_FILE &&
+- !default_path.empty()) {
++ if (!default_path.empty()) {
+ if (default_path_exists) {
+ // If this is an existing directory, navigate to that directory, with no
+ // filename.
diff --git a/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.h
new file mode 100644
index 0000000000..24cfcac1a7
--- /dev/null
+++ b/electron32/patches/patch-ui_shell__dialogs_select__file__dialog__linux__portal.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/shell_dialogs/select_file_dialog_linux_portal.h.orig 2024-10-18 12:35:12.788244700 +0000
++++ ui/shell_dialogs/select_file_dialog_linux_portal.h
+@@ -117,6 +117,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>;
diff --git a/electron32/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__bn.xtb
new file mode 100644
index 0000000000..94830262ee
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__ja.xtb
new file mode 100644
index 0000000000..26dbd1ff07
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__ko.xtb
new file mode 100644
index 0000000000..091506e6d2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__ml.xtb
new file mode 100644
index 0000000000..23c8112ae6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__th.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__th.xtb
new file mode 100644
index 0000000000..1f578e453a
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-CN.xtb
new file mode 100644
index 0000000000..d8f81fd02d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb b/electron32/patches/patch-ui_strings_translations_app__locale__settings__zh-TW.xtb
new file mode 100644
index 0000000000..9cd3fcdd45
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.792243200 +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/electron32/patches/patch-ui_strings_ui__strings.grd b/electron32/patches/patch-ui_strings_ui__strings.grd
new file mode 100644
index 0000000000..47ff5bc223
--- /dev/null
+++ b/electron32/patches/patch-ui_strings_ui__strings.grd
@@ -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/strings/ui_strings.grd.orig 2024-10-18 12:35:12.812235400 +0000
++++ ui/strings/ui_strings.grd
+@@ -764,6 +764,11 @@ need to be translated for each locale.--
+ Win
+ </message>
+ </if>
++ <if expr="is_posix">
++ <message name="IDS_APP_SUPER_KEY" desc="Windows key on Windows keyboards, and Command key on Mac keyboards.">
++ Super
++ </message>
++ </if>
+ <if expr="chromeos_ash">
+ <message name="IDS_APP_META_KEY" desc="External Meta key (Search key on ChromeOS keyboards, Windows key on Windows keyboards, and Command key on Mac keyboards)">
+ Meta
diff --git a/electron32/patches/patch-ui_views_BUILD.gn b/electron32/patches/patch-ui_views_BUILD.gn
new file mode 100644
index 0000000000..90a7afc3b2
--- /dev/null
+++ b/electron32/patches/patch-ui_views_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
+
+--- ui/views/BUILD.gn.orig 2024-10-18 12:35:12.812235400 +0000
++++ ui/views/BUILD.gn
+@@ -716,6 +716,7 @@ component("views") {
+ "IOSurface.framework",
+ "QuartzCore.framework",
+ ]
++ configs += ["//electron/build/config:mas_build"]
+ }
+
+ if (is_win) {
+@@ -1145,6 +1146,8 @@ source_set("test_support") {
+ "//testing/gtest",
+ ]
+
++ configs += ["//electron/build/config:mas_build"]
++
+ if (is_win) {
+ sources += [
+ "test/desktop_window_tree_host_win_test_api.cc",
diff --git a/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h b/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.h
new file mode 100644
index 0000000000..d597232fab
--- /dev/null
+++ b/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.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/views/cocoa/native_widget_mac_ns_window_host.h.orig 2024-10-18 12:35:12.824230400 +0000
++++ ui/views/cocoa/native_widget_mac_ns_window_host.h
+@@ -31,7 +31,9 @@
+ #include "ui/views/window/dialog_observer.h"
+
+ @class NativeWidgetMacNSWindow;
++#if !IS_MAS_BUILD()
+ @class NSAccessibilityRemoteUIElement;
++#endif
+ @class NSView;
+
+ namespace remote_cocoa {
+@@ -483,10 +485,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/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm b/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
new file mode 100644
index 0000000000..0fae10e6e0
--- /dev/null
+++ b/electron32/patches/patch-ui_views_cocoa_native__widget__mac__ns__window__host.mm
@@ -0,0 +1,73 @@
+$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 2024-10-18 12:35:12.824230400 +0000
++++ ui/views/cocoa/native_widget_mac_ns_window_host.mm
+@@ -349,7 +349,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 +368,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 +1341,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)
+@@ -1498,17 +1508,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();
+
+@@ -1521,6 +1534,7 @@ bool NativeWidgetMacNSWindowHost::GetRoo
+ }
+
+ *token = ui::RemoteAccessibility::GetTokenForLocalElement(element_id);
++#endif
+ return true;
+ }
+
diff --git a/electron32/patches/patch-ui_views_controls_menu_menu__controller.cc b/electron32/patches/patch-ui_views_controls_menu_menu__controller.cc
new file mode 100644
index 0000000000..cd0965845d
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__controller.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
+
+--- ui/views/controls/menu/menu_controller.cc.orig 2024-10-18 12:35:12.832227200 +0000
++++ ui/views/controls/menu/menu_controller.cc
+@@ -578,6 +578,7 @@ void MenuController::Run(Widget* parent,
+ MenuAnchorPosition position,
+ bool context_menu,
+ bool is_nested_drag,
++ ui::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures) {
+ exit_type_ = ExitType::kNone;
+ possible_drag_ = false;
+@@ -642,6 +643,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::MENU_SOURCE_KEYBOARD && 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));
+@@ -2277,19 +2286,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/electron32/patches/patch-ui_views_controls_menu_menu__controller.h b/electron32/patches/patch-ui_views_controls_menu_menu__controller.h
new file mode 100644
index 0000000000..4c4d985e9d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.832227200 +0000
++++ ui/views/controls/menu/menu_controller.h
+@@ -137,6 +137,7 @@ class VIEWS_EXPORT MenuController final
+ MenuAnchorPosition position,
+ bool context_menu,
+ bool is_nested_drag,
++ ui::MenuSourceType source_type,
+ gfx::NativeView native_view_for_gestures = gfx::NativeView());
+
+ bool for_drop() const { return for_drop_; }
diff --git a/electron32/patches/patch-ui_views_controls_menu_menu__runner.cc b/electron32/patches/patch-ui_views_controls_menu_menu__runner.cc
new file mode 100644
index 0000000000..09e4765687
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.832227200 +0000
++++ ui/views/controls/menu/menu_runner.cc
+@@ -89,7 +89,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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.cc b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.cc
new file mode 100644
index 0000000000..86418c4e2c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.832227200 +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::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl.h
new file mode 100644
index 0000000000..c7f0323d12
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__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
+
+--- ui/views/controls/menu/menu_runner_impl.h.orig 2024-10-18 12:35:12.832227200 +0000
++++ ui/views/controls/menu/menu_runner_impl.h
+@@ -52,6 +52,7 @@ class VIEWS_EXPORT MenuRunnerImpl : publ
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.cc
new file mode 100644
index 0000000000..273eaf3006
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +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::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.h
new file mode 100644
index 0000000000..153fb5b6a9
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__adapter.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_runner_impl_adapter.h.orig 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/menu/menu_runner_impl_adapter.h
+@@ -43,6 +43,7 @@ class VIEWS_EXPORT MenuRunnerImplAdapter
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.h
new file mode 100644
index 0000000000..5ee82d39cb
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.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_runner_impl_cocoa.h.orig 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/menu/menu_runner_impl_cocoa.h
+@@ -42,6 +42,7 @@ class VIEWS_EXPORT MenuRunnerImplCocoa :
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__cocoa.mm
new file mode 100644
index 0000000000..ffd21dc4c7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +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::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.h
new file mode 100644
index 0000000000..652c1d0843
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__interface.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_runner_impl_interface.h.orig 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/menu/menu_runner_impl_interface.h
+@@ -46,6 +46,7 @@ class MenuRunnerImplInterface {
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.h
new file mode 100644
index 0000000000..e8c8eadc05
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__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
+
+--- ui/views/controls/menu/menu_runner_impl_mac.h.orig 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/menu/menu_runner_impl_mac.h
+@@ -39,6 +39,7 @@ class VIEWS_EXPORT MenuRunnerImplMac : p
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__mac.mm
new file mode 100644
index 0000000000..399ef59db6
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +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::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.h
new file mode 100644
index 0000000000..5917b59a40
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.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_runner_impl_remote_cocoa.h.orig 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/menu/menu_runner_impl_remote_cocoa.h
+@@ -57,6 +57,7 @@ class VIEWS_EXPORT MenuRunnerImplRemoteC
+ const gfx::Rect& bounds,
+ MenuAnchorPosition anchor,
+ int32_t run_types,
++ ui::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/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm b/electron32/patches/patch-ui_views_controls_menu_menu__runner__impl__remote__cocoa.mm
new file mode 100644
index 0000000000..47293192a5
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +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::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/electron32/patches/patch-ui_views_controls_prefix__selector.cc b/electron32/patches/patch-ui_views_controls_prefix__selector.cc
new file mode 100644
index 0000000000..d2f04b0599
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/prefix_selector.cc
+@@ -174,7 +174,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/electron32/patches/patch-ui_views_controls_prefix__selector.h b/electron32/patches/patch-ui_views_controls_prefix__selector.h
new file mode 100644
index 0000000000..4ac38998d7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.836225700 +0000
++++ ui/views/controls/prefix_selector.h
+@@ -83,7 +83,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/electron32/patches/patch-ui_views_controls_textfield_textfield.cc b/electron32/patches/patch-ui_views_controls_textfield_textfield.cc
new file mode 100644
index 0000000000..4e9230d548
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.840224000 +0000
++++ ui/views/controls/textfield/textfield.cc
+@@ -85,7 +85,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"
+@@ -183,7 +183,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;
+@@ -756,7 +756,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 &&
+@@ -939,7 +939,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;
+@@ -1999,7 +1999,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(
+@@ -2505,14 +2505,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/electron32/patches/patch-ui_views_controls_textfield_textfield.h b/electron32/patches/patch-ui_views_controls_textfield_textfield.h
new file mode 100644
index 0000000000..124dff7d53
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.840224000 +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
+
+@@ -462,7 +462,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/electron32/patches/patch-ui_views_controls_webview_BUILD.gn b/electron32/patches/patch-ui_views_controls_webview_BUILD.gn
new file mode 100644
index 0000000000..211d1a4b91
--- /dev/null
+++ b/electron32/patches/patch-ui_views_controls_webview_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
+
+--- ui/views/controls/webview/BUILD.gn.orig 2024-10-18 12:35:12.844222500 +0000
++++ ui/views/controls/webview/BUILD.gn
+@@ -19,6 +19,9 @@ component("webview") {
+
+ if (is_mac) {
+ sources += [ "unhandled_keyboard_event_handler_mac.mm" ]
++ configs += [
++ "//electron/build/config:mas_build",
++ ]
+ }
+
+ if (is_win) {
diff --git a/electron32/patches/patch-ui_views_controls_webview_web__dialog__view.cc b/electron32/patches/patch-ui_views_controls_webview_web__dialog__view.cc
new file mode 100644
index 0000000000..9ec728ecac
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.844222500 +0000
++++ ui/views/controls/webview/web_dialog_view.cc
+@@ -448,8 +448,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/electron32/patches/patch-ui_views_controls_webview_web__dialog__view.h b/electron32/patches/patch-ui_views_controls_webview_web__dialog__view.h
new file mode 100644
index 0000000000..e70046df9d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.844222500 +0000
++++ ui/views/controls/webview/web_dialog_view.h
+@@ -165,8 +165,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/electron32/patches/patch-ui_views_corewm_tooltip__aura.cc b/electron32/patches/patch-ui_views_corewm_tooltip__aura.cc
new file mode 100644
index 0000000000..b39510fb18
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.844222500 +0000
++++ ui/views/corewm/tooltip_aura.cc
+@@ -36,7 +36,7 @@ namespace {
+ bool CanUseTranslucentTooltipWidget() {
+ // 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)) || BUILDFLAG(IS_WIN)
++#if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_BSD)
+ return false;
+ #else
+ return true;
diff --git a/electron32/patches/patch-ui_views_examples_widget__example.cc b/electron32/patches/patch-ui_views_examples_widget__example.cc
new file mode 100644
index 0000000000..b944dc4497
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.852219300 +0000
++++ ui/views/examples/widget_example.cc
+@@ -49,7 +49,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/electron32/patches/patch-ui_views_focus_focus__manager.cc b/electron32/patches/patch-ui_views_focus_focus__manager.cc
new file mode 100644
index 0000000000..32ae36c1a1
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.852219300 +0000
++++ ui/views/focus/focus_manager.cc
+@@ -585,7 +585,7 @@ bool FocusManager::RedirectAcceleratorTo
+
+ // 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)
+ // 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
+@@ -602,7 +602,7 @@ bool FocusManager::RedirectAcceleratorTo
+
+ // 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)
+ // 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/electron32/patches/patch-ui_views_style_platform__style.cc b/electron32/patches/patch-ui_views_style_platform__style.cc
new file mode 100644
index 0000000000..6ed3e6ab20
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.860216100 +0000
++++ ui/views/style/platform_style.cc
+@@ -17,7 +17,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
+
+@@ -50,7 +50,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;
+@@ -59,7 +59,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/electron32/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc b/electron32/patches/patch-ui_views_test_ui__controls__factory__desktop__aura__ozone.cc
new file mode 100644
index 0000000000..b7d920c702
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.864214400 +0000
++++ ui/views/test/ui_controls_factory_desktop_aura_ozone.cc
+@@ -296,7 +296,7 @@ void UpdateDisplaySync(const std::string
+ }
+ #endif
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ // static
+ void ForceUseScreenCoordinatesOnce() {
+ g_ozone_ui_controls_test_helper->ForceUseScreenCoordinatesOnce();
diff --git a/electron32/patches/patch-ui_views_views__delegate.cc b/electron32/patches/patch-ui_views_views__delegate.cc
new file mode 100644
index 0000000000..f4ad3c5f1d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.868213000 +0000
++++ ui/views/views_delegate.cc
+@@ -95,7 +95,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/electron32/patches/patch-ui_views_views__delegate.h b/electron32/patches/patch-ui_views_views__delegate.h
new file mode 100644
index 0000000000..39b03ef05d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.868213000 +0000
++++ ui/views/views_delegate.h
+@@ -146,7 +146,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/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.cc
new file mode 100644
index 0000000000..c9c3fd190c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.868213000 +0000
++++ ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc
+@@ -197,7 +197,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/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__drag__drop__client__ozone.h
new file mode 100644
index 0000000000..3099aaf61f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.868213000 +0000
++++ ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h
+@@ -65,7 +65,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()
+@@ -86,7 +86,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/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform.cc
new file mode 100644
index 0000000000..82466edcbb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.872211500 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+@@ -48,7 +48,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
+
+@@ -358,7 +358,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);
+@@ -1174,7 +1174,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/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc
new file mode 100644
index 0000000000..891e65dce7
--- /dev/null
+++ b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__platform__impl__interactive__uitest.cc
@@ -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_window_tree_host_platform_impl_interactive_uitest.cc.orig 2024-10-18 12:35:12.872211500 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform_impl_interactive_uitest.cc
+@@ -23,7 +23,7 @@
+ #include "ui/views/widget/widget_delegate.h"
+ #include "ui/views/window/native_frame_view.h"
+
+-#if BUILDFLAG(IS_LINUX)
++#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_BSD)
+ #include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
+ #include "ui/views/widget/desktop_aura/window_event_filter_linux.h"
+ using DesktopWindowTreeHostPlatformImpl = views::DesktopWindowTreeHostLinux;
diff --git a/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.cc
new file mode 100644
index 0000000000..f28f321c39
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.872211500 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+@@ -581,7 +581,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);
+ }
+@@ -1228,6 +1228,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/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h b/electron32/patches/patch-ui_views_widget_desktop__aura_desktop__window__tree__host__win.h
new file mode 100644
index 0000000000..2fbc15be30
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.872211500 +0000
++++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+@@ -263,6 +263,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/electron32/patches/patch-ui_views_widget_root__view.cc b/electron32/patches/patch-ui_views_widget_root__view.cc
new file mode 100644
index 0000000000..55a6c4136f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.872211500 +0000
++++ ui/views/widget/root_view.cc
+@@ -129,7 +129,7 @@ class AnnounceTextView : public View {
+ #if BUILDFLAG(IS_CHROMEOS)
+ // On ChromeOS, kAlert role can invoke an unnecessary event on reparenting.
+ node_data->role = 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".
+ node_data->role = ax::mojom::Role::kAlert;
diff --git a/electron32/patches/patch-ui_views_widget_widget.cc b/electron32/patches/patch-ui_views_widget_widget.cc
new file mode 100644
index 0000000000..636e2e5c3c
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.876209700 +0000
++++ ui/views/widget/widget.cc
+@@ -57,7 +57,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
+
+@@ -2182,7 +2182,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/electron32/patches/patch-ui_views_win_hwnd__message__handler.cc b/electron32/patches/patch-ui_views_win_hwnd__message__handler.cc
new file mode 100644
index 0000000000..f100ec966a
--- /dev/null
+++ b/electron32/patches/patch-ui_views_win_hwnd__message__handler.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
+
+--- ui/views/win/hwnd_message_handler.cc.orig 2024-10-18 12:35:12.876209700 +0000
++++ ui/views/win/hwnd_message_handler.cc
+@@ -907,13 +907,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,
+@@ -965,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;
+
+@@ -1737,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();
+@@ -2242,17 +2261,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) {
+@@ -3129,15 +3149,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;
+ }
+
+@@ -3679,14 +3703,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/electron32/patches/patch-ui_views_win_hwnd__message__handler__delegate.h b/electron32/patches/patch-ui_views_win_hwnd__message__handler__delegate.h
new file mode 100644
index 0000000000..d50fbe9db4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.876209700 +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/electron32/patches/patch-ui_views_window_custom__frame__view.cc b/electron32/patches/patch-ui_views_window_custom__frame__view.cc
new file mode 100644
index 0000000000..6f135aa43e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.880208300 +0000
++++ ui/views/window/custom_frame_view.cc
+@@ -268,7 +268,7 @@ int CustomFrameView::CaptionButtonY() co
+ // drawn flush with the screen edge, they still obey Fitts' Law.
+ // 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)
+ return FrameBorderThickness();
+ #else
+ return frame_->IsMaximized() ? FrameBorderThickness() : kFrameShadowThickness;
diff --git a/electron32/patches/patch-ui_views_window_dialog__delegate.cc b/electron32/patches/patch-ui_views_window_dialog__delegate.cc
new file mode 100644
index 0000000000..6bc278422f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.880208300 +0000
++++ ui/views/window/dialog_delegate.cc
+@@ -103,7 +103,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/electron32/patches/patch-ui_views_window_frame__background.cc b/electron32/patches/patch-ui_views_window_frame__background.cc
new file mode 100644
index 0000000000..361895042f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.880208300 +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/electron32/patches/patch-ui_views_window_frame__caption__button.cc b/electron32/patches/patch-ui_views_window_frame__caption__button.cc
new file mode 100644
index 0000000000..5702bf5dc4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.880208300 +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/electron32/patches/patch-ui_views_window_frame__caption__button.h b/electron32/patches/patch-ui_views_window_frame__caption__button.h
new file mode 100644
index 0000000000..96e17980e9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.880208300 +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/electron32/patches/patch-url_url__util.cc b/electron32/patches/patch-url_url__util.cc
new file mode 100644
index 0000000000..429ab2bfe0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.920192200 +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;
+
+@@ -716,6 +719,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/electron32/patches/patch-url_url__util.h b/electron32/patches/patch-url_url__util.h
new file mode 100644
index 0000000000..f06d00078f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:35:12.920192200 +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/electron32/patches/patch-v8_BUILD.gn b/electron32/patches/patch-v8_BUILD.gn
new file mode 100644
index 0000000000..55e2b8b8a8
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.096423600 +0000
++++ v8/BUILD.gn
+@@ -896,6 +896,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 = [
+@@ -972,6 +975,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
+@@ -2396,6 +2408,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.
+@@ -2414,7 +2443,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)" ]
++ }
+
+ script = "tools/run.py"
+
+@@ -2477,6 +2510,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",
++ ]
++ }
+ }
+
+ # This is needed to distinguish between generating code for the simulator
+@@ -4528,7 +4567,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" ]
+@@ -5926,7 +5965,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",
+@@ -6559,7 +6598,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",
+@@ -6570,6 +6609,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/electron32/patches/patch-v8_include_v8-internal.h b/electron32/patches/patch-v8_include_v8-internal.h
new file mode 100644
index 0000000000..bb7bd09120
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.104423500 +0000
++++ v8/include/v8-internal.h
+@@ -213,7 +213,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/electron32/patches/patch-v8_include_v8-microtask-queue.h b/electron32/patches/patch-v8_include_v8-microtask-queue.h
new file mode 100644
index 0000000000..fc4984e183
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.108423500 +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/electron32/patches/patch-v8_include_v8-object.h b/electron32/patches/patch-v8_include_v8-object.h
new file mode 100644
index 0000000000..5a5afc6527
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.108423500 +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/electron32/patches/patch-v8_include_v8config.h b/electron32/patches/patch-v8_include_v8config.h
new file mode 100644
index 0000000000..c0b6ffdff0
--- /dev/null
+++ b/electron32/patches/patch-v8_include_v8config.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
+
+--- v8/include/v8config.h.orig 2024-10-18 12:48:35.112423400 +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,21 @@ 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_NETBSD
++# define V8_TARGET_OS_BSD
++#endif
++
+ #ifdef V8_OS_MACOS
+ # define V8_TARGET_OS_MACOS
+ #endif
+@@ -381,7 +402,8 @@ path. Add it with -I<path> to the comman
+ // preserve_most in clang >= 17 (see https://reviews.llvm.org/D143425).
+ #if (defined(_M_X64) || defined(__x86_64__) /* x64 (everywhere) */ \
+ || ((defined(__AARCH64EL__) || defined(_M_ARM64)) /* arm64, but ... */ \
+- && !defined(_WIN32))) /* not on windows */ \
++ && !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/electron32/patches/patch-v8_src_api_api.cc b/electron32/patches/patch-v8_src_api_api.cc
new file mode 100644
index 0000000000..cb8cd30cc2
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.116423600 +0000
++++ v8/src/api/api.cc
+@@ -148,7 +148,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>
+
+@@ -6372,14 +6372,33 @@ Local<Data> v8::Object::SlowGetInternalF
+ 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);
+@@ -6511,7 +6530,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/electron32/patches/patch-v8_src_base_atomicops.h b/electron32/patches/patch-v8_src_base_atomicops.h
new file mode 100644
index 0000000000..88ea36ec4b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.120423600 +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/electron32/patches/patch-v8_src_base_platform_memory.h b/electron32/patches/patch-v8_src_base_platform_memory.h
new file mode 100644
index 0000000000..d31604fc6b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.124423500 +0000
++++ v8/src/base/platform/memory.h
+@@ -19,13 +19,13 @@
+
+ #if V8_OS_DARWIN
+ #include <malloc/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_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/electron32/patches/patch-v8_src_base_platform_platform-freebsd.cc b/electron32/patches/patch-v8_src_base_platform_platform-freebsd.cc
new file mode 100644
index 0000000000..88ae82320d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.124423500 +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/electron32/patches/patch-v8_src_base_platform_platform-openbsd.cc b/electron32/patches/patch-v8_src_base_platform_platform-openbsd.cc
new file mode 100644
index 0000000000..f4ef26ef40
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.124423500 +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/electron32/patches/patch-v8_src_base_platform_platform-posix.cc b/electron32/patches/patch-v8_src_base_platform_platform-posix.cc
new file mode 100644
index 0000000000..5950064eb9
--- /dev/null
+++ b/electron32/patches/patch-v8_src_base_platform_platform-posix.cc
@@ -0,0 +1,110 @@
+$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 2024-10-18 12:48:35.128423500 +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"
+@@ -54,7 +57,7 @@
+ #if V8_OS_DARWIN
+ #include <mach/mach.h>
+ #include <malloc/malloc.h>
+-#elif !V8_OS_ZOS
++#elif !V8_OS_ZOS && !V8_OS_BSD
+ #include <malloc.h>
+ #endif
+
+@@ -72,9 +75,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__)
+@@ -311,6 +316,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;
+@@ -407,6 +419,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
+@@ -681,7 +694,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.
+@@ -836,6 +849,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
+@@ -1136,7 +1151,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());
+ }
+@@ -1151,7 +1170,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.
+@@ -1326,7 +1345,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/electron32/patches/patch-v8_src_base_small-vector.h b/electron32/patches/patch-v8_src_base_small-vector.h
new file mode 100644
index 0000000000..b2e31189a0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.128423500 +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/electron32/patches/patch-v8_src_base_strings.h b/electron32/patches/patch-v8_src_base_strings.h
new file mode 100644
index 0000000000..896e476a2e
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.128423500 +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/electron32/patches/patch-v8_src_base_sys-info.cc b/electron32/patches/patch-v8_src_base_sys-info.cc
new file mode 100644
index 0000000000..e5f394cc5d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.128423500 +0000
++++ v8/src/base/sys-info.cc
+@@ -37,8 +37,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/electron32/patches/patch-v8_src_base_utils_random-number-generator.cc b/electron32/patches/patch-v8_src_base_utils_random-number-generator.cc
new file mode 100644
index 0000000000..86ed433a77
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.128423500 +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/electron32/patches/patch-v8_src_compiler_access-info.cc b/electron32/patches/patch-v8_src_compiler_access-info.cc
new file mode 100644
index 0000000000..0a9926e562
--- /dev/null
+++ b/electron32/patches/patch-v8_src_compiler_access-info.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
+
+--- v8/src/compiler/access-info.cc.orig 2024-10-18 12:48:35.208423000 +0000
++++ v8/src/compiler/access-info.cc
+@@ -924,6 +924,7 @@ PropertyAccessInfo AccessInfoFactory::Co
+ return PropertyAccessInfo::NotFound(zone(), receiver_map, holder);
+ }
+
++ CHECK(prototype.IsJSObject());
+ holder = prototype.AsJSObject();
+ map = map_prototype_map;
+
diff --git a/electron32/patches/patch-v8_src_compiler_heap-refs.cc b/electron32/patches/patch-v8_src_compiler_heap-refs.cc
new file mode 100644
index 0000000000..7c7f877220
--- /dev/null
+++ b/electron32/patches/patch-v8_src_compiler_heap-refs.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
+
+--- v8/src/compiler/heap-refs.cc.orig 2024-10-18 12:48:35.240422700 +0000
++++ v8/src/compiler/heap-refs.cc
+@@ -1682,6 +1682,7 @@ HolderLookupResult FunctionTemplateInfoR
+ if (!expected_receiver_type->IsTemplateFor(prototype.object()->map())) {
+ return not_found;
+ }
++ CHECK(prototype.IsJSObject());
+ return HolderLookupResult(CallOptimization::kHolderFound,
+ prototype.AsJSObject());
+ }
diff --git a/electron32/patches/patch-v8_src_compiler_js-call-reducer.cc b/electron32/patches/patch-v8_src_compiler_js-call-reducer.cc
new file mode 100644
index 0000000000..ba53b0db30
--- /dev/null
+++ b/electron32/patches/patch-v8_src_compiler_js-call-reducer.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
+
+--- v8/src/compiler/js-call-reducer.cc.orig 2024-10-18 12:48:35.244422700 +0000
++++ v8/src/compiler/js-call-reducer.cc
+@@ -3787,14 +3787,13 @@ bool CanInlineJSToWasmCall(const wasm::F
+ return false;
+ }
+
+- wasm::ValueType externRefNonNull = wasm::kWasmExternRef.AsNonNull();
+ for (auto type : wasm_signature->all()) {
+ #if defined(V8_TARGET_ARCH_32_BIT)
+ if (type == wasm::kWasmI64) return false;
+ #endif
+ if (type != wasm::kWasmI32 && type != wasm::kWasmI64 &&
+ type != wasm::kWasmF32 && type != wasm::kWasmF64 &&
+- type != wasm::kWasmExternRef && type != externRefNonNull) {
++ type != wasm::kWasmExternRef) {
+ return false;
+ }
+ }
diff --git a/electron32/patches/patch-v8_src_compiler_js-native-context-specialization.cc b/electron32/patches/patch-v8_src_compiler_js-native-context-specialization.cc
new file mode 100644
index 0000000000..49b7eb7f3d
--- /dev/null
+++ b/electron32/patches/patch-v8_src_compiler_js-native-context-specialization.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
+
+--- v8/src/compiler/js-native-context-specialization.cc.orig 2024-10-18 12:48:35.248422600 +0000
++++ v8/src/compiler/js-native-context-specialization.cc
+@@ -880,7 +880,9 @@ JSNativeContextSpecialization::InferHasI
+ // might be a different object each time, so it's much simpler to include
+ // {prototype}. That does, however, mean that we must check {prototype}'s
+ // map stability.
+- if (!prototype.map(broker()).is_stable()) return kMayBeInPrototypeChain;
++ if (!prototype.IsJSObject() || !prototype.map(broker()).is_stable()) {
++ return kMayBeInPrototypeChain;
++ }
+ last_prototype = prototype.AsJSObject();
+ }
+ WhereToStart start = result == NodeProperties::kUnreliableMaps
diff --git a/electron32/patches/patch-v8_src_diagnostics_perf-jit.cc b/electron32/patches/patch-v8_src_diagnostics_perf-jit.cc
new file mode 100644
index 0000000000..3a0b07de91
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.296422500 +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/electron32/patches/patch-v8_src_diagnostics_perf-jit.h b/electron32/patches/patch-v8_src_diagnostics_perf-jit.h
new file mode 100644
index 0000000000..1406a351b0
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.296422500 +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/electron32/patches/patch-v8_src_execution_isolate.cc b/electron32/patches/patch-v8_src_execution_isolate.cc
new file mode 100644
index 0000000000..48890b5ee9
--- /dev/null
+++ b/electron32/patches/patch-v8_src_execution_isolate.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
+
+--- v8/src/execution/isolate.cc.orig 2024-10-18 12:48:35.308422300 +0000
++++ v8/src/execution/isolate.cc
+@@ -159,6 +159,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_[];
+@@ -2523,6 +2527,13 @@ HandlerTable::CatchPrediction PredictExc
+
+ HandlerTable::CatchPrediction PredictException(const FrameSummary& summary,
+ Isolate* isolate) {
++ if (!summary.IsJavaScript()) {
++ // This can happen when WASM is inlined by TurboFan. For now we ignore
++ // frames that are not JavaScript.
++ // TODO(https://crbug.com/349588762): We should also check Wasm code
++ // for exception handling.
++ return HandlerTable::UNCAUGHT;
++ }
+ PtrComprCageBase cage_base(isolate);
+ DirectHandle<AbstractCode> code = summary.AsJavaScript().abstract_code();
+ if (code->kind(cage_base) == CodeKind::BUILTIN) {
+@@ -4829,6 +4840,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/electron32/patches/patch-v8_src_execution_microtask-queue.h b/electron32/patches/patch-v8_src_execution_microtask-queue.h
new file mode 100644
index 0000000000..8eb67a3420
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.308422300 +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/electron32/patches/patch-v8_src_flags_flags.cc b/electron32/patches/patch-v8_src_flags_flags.cc
new file mode 100644
index 0000000000..f2d7e83c7d
--- /dev/null
+++ b/electron32/patches/patch-v8_src_flags_flags.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
+
+--- v8/src/flags/flags.cc.orig 2024-10-18 12:48:35.320422200 +0000
++++ v8/src/flags/flags.cc
+@@ -15,6 +15,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"
+@@ -34,7 +38,11 @@
+ namespace v8::internal {
+
+ // Define {v8_flags}, declared in flags.h.
++#if V8_OS_OPENBSD
++FlagValues v8_flags __attribute__((section(".openbsd.mutable")));
++#else
+ FlagValues v8_flags;
++#endif
+
+ // {v8_flags} needs to be aligned to a memory page, and the size needs to be a
+ // multiple of a page size. This is required for memory-protection of the memory
+@@ -806,6 +814,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/electron32/patches/patch-v8_src_maglev_maglev-graph-builder.cc b/electron32/patches/patch-v8_src_maglev_maglev-graph-builder.cc
new file mode 100644
index 0000000000..52f6539d24
--- /dev/null
+++ b/electron32/patches/patch-v8_src_maglev_maglev-graph-builder.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
+
+--- v8/src/maglev/maglev-graph-builder.cc.orig 2024-10-18 12:48:35.380421900 +0000
++++ v8/src/maglev/maglev-graph-builder.cc
+@@ -1347,7 +1347,14 @@ DeoptFrame MaglevGraphBuilder::GetDeoptF
+ if (result_size == 0 ||
+ !base::IsInRange(reg.index(), result_location.index(),
+ result_location.index() + result_size - 1)) {
+- AddDeoptUse(node);
++ // Receiver and closure values have to be materialized, even if
++ // they don't otherwise escape.
++ if (reg == interpreter::Register::receiver() ||
++ reg == interpreter::Register::function_closure()) {
++ node->add_use();
++ } else {
++ AddDeoptUse(node);
++ }
+ }
+ });
+ AddDeoptUse(ret.closure());
diff --git a/electron32/patches/patch-v8_src_runtime_runtime-wasm.cc b/electron32/patches/patch-v8_src_runtime_runtime-wasm.cc
new file mode 100644
index 0000000000..dbc95c30f2
--- /dev/null
+++ b/electron32/patches/patch-v8_src_runtime_runtime-wasm.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
+
+--- v8/src/runtime/runtime-wasm.cc.orig 2024-10-18 12:48:35.456421400 +0000
++++ v8/src/runtime/runtime-wasm.cc
+@@ -626,9 +626,23 @@ RUNTIME_FUNCTION(Runtime_TierUpWasmToJSW
+ Handle<WasmTrustedInstanceData> trusted_data(ref->instance_data(), isolate);
+ if (IsTuple2(*origin)) {
+ auto tuple = Cast<Tuple2>(origin);
+- trusted_data =
+- handle(Cast<WasmInstanceObject>(tuple->value1())->trusted_data(isolate),
+- isolate);
++ Handle<WasmTrustedInstanceData> call_origin_trusted_data(
++ Cast<WasmInstanceObject>(tuple->value1())->trusted_data(isolate),
++ isolate);
++ // TODO(371565065): We do not tier up the wrapper if the JS function wasn't
++ // imported in the current instance but the signature is specific to the
++ // importing instance. Remove this bailout again.
++ if (trusted_data->module() != call_origin_trusted_data->module()) {
++ for (wasm::ValueType type : sig.all()) {
++ if (type.has_index()) {
++ // Reset the tiering budget, so that we don't have to deal with the
++ // underflow.
++ ref->set_wrapper_budget(Smi::kMaxValue);
++ return ReadOnlyRoots(isolate).undefined_value();
++ }
++ }
++ }
++ trusted_data = call_origin_trusted_data;
+ origin = direct_handle(tuple->value2(), isolate);
+ }
+ const wasm::WasmModule* module = trusted_data->module();
diff --git a/electron32/patches/patch-v8_src_sandbox_sandbox.cc b/electron32/patches/patch-v8_src_sandbox_sandbox.cc
new file mode 100644
index 0000000000..9849deab9f
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.460421300 +0000
++++ v8/src/sandbox/sandbox.cc
+@@ -48,7 +48,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/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc b/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.cc
new file mode 100644
index 0000000000..93a536ae9d
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.460421300 +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/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h b/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-base.h
new file mode 100644
index 0000000000..950917ee56
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.460421300 +0000
++++ v8/src/snapshot/embedded/platform-embedded-file-writer-base.h
+@@ -32,6 +32,7 @@ enum class EmbeddedTargetOs {
+ kWin,
+ kStarboard,
+ kZOS,
++ kOpenBSD,
+ kGeneric, // Everything not covered above falls in here.
+ };
+
diff --git a/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc b/electron32/patches/patch-v8_src_snapshot_embedded_platform-embedded-file-writer-generic.cc
new file mode 100644
index 0000000000..960cb6d5e4
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.460421300 +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/electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.cc b/electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.cc
new file mode 100644
index 0000000000..5774adaaf7
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.476421400 +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/electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.h b/electron32/patches/patch-v8_src_trap-handler_handler-inside-posix.h
new file mode 100644
index 0000000000..91e1de4bcb
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.476421400 +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/electron32/patches/patch-v8_src_trap-handler_trap-handler.h b/electron32/patches/patch-v8_src_trap-handler_trap-handler.h
new file mode 100644
index 0000000000..75aa3802d9
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.480421300 +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 Mac and Linux.
+ #elif V8_TARGET_ARCH_ARM64 && V8_HOST_ARCH_ARM64 && \
diff --git a/electron32/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h b/electron32/patches/patch-v8_src_wasm_baseline_ia32_liftoff-assembler-ia32-inl.h
new file mode 100644
index 0000000000..bf5b7e7a4b
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:35.484421300 +0000
++++ v8/src/wasm/baseline/ia32/liftoff-assembler-ia32-inl.h
+@@ -503,7 +503,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) {
+@@ -583,7 +583,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 */) {
+@@ -662,7 +662,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) {
+@@ -680,7 +680,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());
+@@ -750,7 +750,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);
+@@ -818,7 +818,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);
+@@ -933,7 +933,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
+@@ -1029,7 +1029,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) {
+@@ -1043,7 +1043,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) {
+@@ -1056,7 +1056,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) {
+@@ -1070,7 +1070,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) {
+@@ -1084,7 +1084,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) {
+@@ -1098,7 +1098,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 */) {
+@@ -1113,7 +1113,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/electron32/patches/patch-v8_src_wasm_wasm-js.cc b/electron32/patches/patch-v8_src_wasm_wasm-js.cc
new file mode 100644
index 0000000000..68c5f01c27
--- /dev/null
+++ b/electron32/patches/patch-v8_src_wasm_wasm-js.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/wasm/wasm-js.cc.orig 2024-10-18 12:48:35.504421200 +0000
++++ v8/src/wasm/wasm-js.cc
+@@ -1314,9 +1314,12 @@ i::Handle<i::HeapObject> DefaultReferenc
+ DCHECK(type.is_object_reference());
+ // Use undefined for JS type (externref) but null for wasm types as wasm does
+ // not know undefined.
+- if (type.heap_representation() == i::wasm::HeapType::kExtern ||
+- type.heap_representation() == i::wasm::HeapType::kNoExtern) {
++ if (type.heap_representation() == i::wasm::HeapType::kExtern) {
+ return isolate->factory()->undefined_value();
++ } else if (type.heap_representation() == i::wasm::HeapType::kNoExtern ||
++ type.heap_representation() == i::wasm::HeapType::kExn ||
++ type.heap_representation() == i::wasm::HeapType::kNoExn) {
++ return isolate->factory()->null_value();
+ }
+ return isolate->factory()->wasm_null();
+ }
diff --git a/electron32/patches/patch-v8_test_mjsunit_regress_wasm_regress-366635354.js b/electron32/patches/patch-v8_test_mjsunit_regress_wasm_regress-366635354.js
new file mode 100644
index 0000000000..784d5949a1
--- /dev/null
+++ b/electron32/patches/patch-v8_test_mjsunit_regress_wasm_regress-366635354.js
@@ -0,0 +1,41 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/test/mjsunit/regress/wasm/regress-366635354.js.orig 2025-01-06 07:57:05.998608438 +0000
++++ v8/test/mjsunit/regress/wasm/regress-366635354.js
+@@ -0,0 +1,32 @@
++// Copyright 2024 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.
++
++// Flags: --always-turbofan --allow-natives-syntax
++
++d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
++
++let builder = new WasmModuleBuilder();
++builder.addFunction('foo', makeSig([wasmRefType(kWasmExternRef)], []))
++ .addBody([kExprUnreachable])
++ .exportFunc();
++let instance = builder.instantiate();
++const wasm_caller = () => instance.exports.foo(null);
++
++%PrepareFunctionForOptimization(wasm_caller);
++testCallStack();
++%OptimizeFunctionOnNextCall(wasm_caller);
++testCallStack();
++
++function testCallStack() {
++ try {
++ wasm_caller();
++ assertUnreachable();
++ } catch (e) {
++ assertMatches(
++`TypeError: type incompatibility when transforming from/to JS
++ at wasm_caller .*\\.js:14:44\\)
++ at testCallStack .*\\.js:23:5\\).*`,
++ e.stack,);
++ }
++}
diff --git a/electron32/patches/patch-v8_test_mjsunit_wasm_regress-367818758.js b/electron32/patches/patch-v8_test_mjsunit_wasm_regress-367818758.js
new file mode 100644
index 0000000000..df3958c3bb
--- /dev/null
+++ b/electron32/patches/patch-v8_test_mjsunit_wasm_regress-367818758.js
@@ -0,0 +1,230 @@
+$NetBSD$
+
+* Part of patchset to build electron on NetBSD
+* Based on OpenBSD's chromium patches, and
+ FreeBSD's electron patches
+
+--- v8/test/mjsunit/wasm/regress-367818758.js.orig 2025-01-06 07:57:05.999115762 +0000
++++ v8/test/mjsunit/wasm/regress-367818758.js
+@@ -0,0 +1,221 @@
++// Copyright 2024 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.
++//
++// Flags: --allow-natives-syntax
++
++var kWasmH0 = 0;
++var kWasmH1 = 0x61;
++var kWasmH2 = 0x73;
++var kWasmH3 = 0x6d;
++var kWasmV0 = 0x1;
++var kWasmV1 = 0;
++var kWasmV2 = 0;
++var kWasmV3 = 0;
++let kTypeSectionCode = 1; // Function signature declarations
++let kFunctionSectionCode = 3; // Function declarations
++let kExportSectionCode = 7; // Exports
++let kCodeSectionCode = 10; // Function code
++let kWasmFunctionTypeForm = 0x60;
++let kWasmStructTypeForm = 0x5f;
++let kNoSuperType = 0xFFFFFFFF;
++let kWasmI32 = 0x7f;
++let kWasmExternRef = -0x11;
++let kLeb128Mask = 0x7f;
++let kExternalFunction = 0;
++function makeSig(params, results) {
++ return {params: params, results: results};
++}
++const kWasmOpcodes = {
++ 'End': 0x0b,
++ 'I32Const': 0x41,
++};
++function defineWasmOpcode(name, value) {
++ Object.defineProperty(globalThis, name, {value: value});
++}
++for (let name in kWasmOpcodes) {
++ defineWasmOpcode(`kExpr${name}`, kWasmOpcodes[name]);
++}
++const kPrefixOpcodes = {
++ 'GC': 0xfb,
++};
++for (let prefix in kPrefixOpcodes) {
++ defineWasmOpcode(`k${prefix}Prefix`, kPrefixOpcodes[prefix]);
++}
++let kExprStructNew = 0x00;
++let kExprExternConvertAny = 0x1b;
++class Binary {
++ constructor() {
++ this.length = 0;
++ this.buffer = new Uint8Array(8192);
++ }
++ trunc_buffer() {
++ return new Uint8Array(this.buffer.buffer, 0, this.length);
++ }
++ emit_u8(val) {
++ this.buffer[this.length++] = val;
++ }
++ emit_leb_u(val) {
++ let v = val & 0xff;
++ this.buffer[this.length++] = v;
++ }
++ emit_u32v(val) {
++ this.emit_leb_u(val);
++ }
++ emit_bytes(data) {
++ this.buffer.set(data, this.length);
++ this.length += data.length;
++ }
++ emit_string(string) {
++ let string_utf8 = string;
++ this.emit_u32v(string_utf8.length);
++ for (let i = 0; i < string_utf8.length; i++) {
++ this.emit_u8(string_utf8.charCodeAt(i));
++ }
++ }
++ emit_type(type) {
++ this.emit_u8(type >= 0 ? type : type & kLeb128Mask);
++ }
++ emit_header() {
++ this.emit_bytes([
++ kWasmH0, kWasmH1, kWasmH2, kWasmH3, kWasmV0, kWasmV1, kWasmV2, kWasmV3
++ ]);
++ }
++ emit_section(section_code, content_generator) {
++ this.emit_u8(section_code);
++ const section = new Binary;
++ content_generator(section);
++ this.emit_u32v(section.length);
++ this.emit_bytes(section.trunc_buffer());
++ }
++}
++class WasmFunctionBuilder {
++ constructor(module, name, type_index, arg_names) {
++ this.module = module;
++ this.name = name;
++ this.type_index = type_index;
++ }
++ exportAs(name) {
++ this.module.addExport(name, this.index);
++ }
++ exportFunc() {
++ this.exportAs(this.name);
++ return this;
++ }
++ addBody(body) {
++ this.body = body.concat([kExprEnd]);
++ }
++}
++function makeField(type, mutability) {
++ return {type: type, mutability: mutability};
++}
++class WasmStruct {
++ constructor(fields) {
++ this.fields = fields;
++ }
++}
++class WasmModuleBuilder {
++ constructor() {
++ this.types = [];
++ this.exports = [];
++ this.functions = [];
++ }
++ addType(type, supertype_idx = kNoSuperType, is_final = true,
++ is_shared = false) {
++ var type_copy = {params: type.params, results: type.results,
++ is_final: is_final, is_shared: is_shared,
++ supertype: supertype_idx};
++ this.types.push(type_copy);
++ return this.types.length - 1;
++ }
++ addStruct(fields = kNoSuperType = false, is_shared = false) {
++ this.types.push(new WasmStruct(fields));
++ }
++ addFunction(name, type, arg_names) {
++ let type_index =typeof type == 'number' ? type : this.addType(type);
++ let func = new WasmFunctionBuilder(this, name, type_index);
++ this.functions.push(func);
++ return func;
++ }
++ addExport(name, index) {
++ this.exports.push({name: name, kind: kExternalFunction, index: index});
++ }
++ toBuffer() {
++ let binary = new Binary;
++ let wasm = this;
++ binary.emit_header();
++ binary.emit_section(kTypeSectionCode, section => {
++ let length_with_groups = wasm.types.length;
++ section.emit_u32v(length_with_groups);
++ for (let i = 0; i < wasm.types.length; i++) {
++ let type = wasm.types[i];
++ if (type instanceof WasmStruct) {
++ section.emit_u8(kWasmStructTypeForm);
++ section.emit_u32v(type.fields.length);
++ for (let field of type.fields) {
++ section.emit_type(field.type);
++ section.emit_u8();
++ }
++ } else {
++ section.emit_u8(kWasmFunctionTypeForm);
++ section.emit_u32v();
++ section.emit_u32v(type.results.length);
++ for (let result of type.results) {
++ section.emit_type(result);
++ }
++ }
++ }
++ });
++ binary.emit_section(kFunctionSectionCode, section => {
++ section.emit_u32v(wasm.functions.length);
++ for (let func of wasm.functions) {
++ section.emit_u32v(func.type_index);
++ }
++ });
++ var exports_count = wasm.exports.length;
++ binary.emit_section(kExportSectionCode, section => {
++ section.emit_u32v(exports_count);
++ for (let exp of wasm.exports) {
++ section.emit_string(exp.name);
++ section.emit_u8();
++ section.emit_u32v();
++ }
++ });
++ binary.emit_section(kCodeSectionCode, section => {
++ section.emit_u32v(wasm.functions.length);
++ for (let func of wasm.functions) {
++ section.emit_u32v(func.body.length + 1);
++ section.emit_u8(); // 0 locals.
++ section.emit_bytes(func.body);
++ }
++ });
++ return binary.trunc_buffer();
++ }
++ instantiate() {
++ let module = this.toModule();
++ let instance = new WebAssembly.Instance(module);
++ return instance;
++ }
++ toModule() {
++ return new WebAssembly.Module(this.toBuffer());
++ }
++}
++let builder = new WasmModuleBuilder();
++let struct_type = builder.addStruct([makeField(kWasmI32)]);
++builder.addFunction('MakeStruct', makeSig([], [kWasmExternRef])).exportFunc()
++ .addBody([kExprI32Const, 42, kGCPrefix, kExprStructNew, struct_type,
++ kGCPrefix, kExprExternConvertAny]);
++let instance = builder.instantiate();
++let evil_wasm_object = instance.exports.MakeStruct();
++function evil_ctor(){
++}
++function evil_cast_jit(evil_o){
++ global_collect_node_info = evil_o; // get nodeinfo from PropertyCellStore
++ return evil_o instanceof evil_ctor;
++}
++evil_ctor.prototype = evil_wasm_object;
++%PrepareFunctionForOptimization(evil_cast_jit);
++evil_cast_jit(new evil_ctor());
++evil_cast_jit(new evil_ctor());
++%OptimizeFunctionOnNextCall(evil_cast_jit);
++evil_cast_jit();
diff --git a/electron32/patches/patch-v8_tools_run-paxctl.py b/electron32/patches/patch-v8_tools_run-paxctl.py
new file mode 100644
index 0000000000..3da06f2a9b
--- /dev/null
+++ b/electron32/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-01-06 07:57:06.000179578 +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/electron32/patches/patch-v8_tools_run.py b/electron32/patches/patch-v8_tools_run.py
new file mode 100644
index 0000000000..85c1d45ada
--- /dev/null
+++ b/electron32/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 2024-10-18 12:48:36.152417400 +0000
++++ v8/tools/run.py
+@@ -9,7 +9,7 @@ scripts."""
+ import subprocess
+ import sys
+
+-result = subprocess.call(sys.argv[1:])
++sys.exit(subprocess.call(sys.argv[1:], env={"LD_LIBRARY_PATH":"${WRKSRC}/out/Release"}))
+ if result != 0:
+ # Windows error codes such as 0xC0000005 and 0xC0000409 are much easier
+ # to recognize and differentiate in hex.
Home |
Main Index |
Thread Index |
Old Index