I have enabled serial and returned an empty devices list.
I have tested in electron (make test only).

patch-services_device_BUILD_gn
patch-services_device_serial_BUILD_gn
patch-services_device_serial_serial_device_enumerator_cc
patch-services_device_serial_serial_port_manager_impl_cc

I also look how we could disable the feature.
https://chromium.googlesource.com/chromium/src/+/main/third_party/blink/renderer/platform/RuntimeEnabledFeatures.md

I didn't test this one, it could work.

patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5

I'm going to test both in chromium.

On 7/10/26 18:28, Fabien Romano wrote:
> 
> 
> On 7/10/26 13:25, Kirill A. Korinsky wrote:
>> On Fri, 10 Jul 2026 10:37:45 +0200,
>> Fabien Romano <[email protected]> wrote:
>>>
>>>
>>> An AI found the crash is related to a web serial.
>>>
>>> I have no idea why it randomly fails on my side.
>>> But yes, after trying a few times, I also get the crash.
>>>
>>> Crash:
>>> rm -rf /tmp/chrome-vinted-serial && \
>>> /usr/local/bin/chrome \
>>>     --user-data-dir=/tmp/chrome-vinted-serial \
>>>     --no-first-run \
>>>     https://www.vinted.com/
>>>
>>> No crash:
>>> rm -rf /tmp/chrome-vinted-noserial && \
>>> /usr/local/bin/chrome \
>>>     --user-data-dir=/tmp/chrome-vinted-noserial \
>>>     --no-first-run \
>>>     --disable-blink-features=Serial \
>>>     --disable-features=WebSerialAPI \
>>>     https://www.vinted.com/
>>>
>>> From my first test, --disable-blink-features=Serial is enough.
>>>
>>> Please test those flags and confirm it fixes your issue.
>>>
>>> I also get this crash while looking for WASM stuff online.
>>> https://patrickelectric.work/mavlink2rest-wasm/
>>>
>>> This one crashes all the time as it explicitly tests the serial.
>>>
>>> rm -rf /tmp/chrome-serial && \
>>> /usr/local/bin/chrome \
>>>     --user-data-dir=/tmp/chrome-serial \
>>>     --no-first-run \
>>>     https://patrickelectric.work/mavlink2rest-wasm/
>>>
>>> Also, I do not understand why, but --js-flags=--jitless prevents the crash.
>>> I guess this is specific to this test.
>>>
>>> The below diff isn't enough, but it show where to look.
>>> Next we have to handle the failure and return / close properly.
>>> Otherwise tests fail on a timeout, which sounds not correct.
>>>
>>> Except if someone wants to implement serial ...

>>
>> Am I reading it right: a some random website tries to use Web Serial API and
>> because it is not implemented, it literally crashed the web browser?
> 
> Yes, exactly.
> 
> https://chromium.googlesource.com/chromium/src/+/HEAD/styleguide/c++/checks.md
> 
> CHECK(), DCHECK() and NOTREACHED() are all used to ensure that invariants 
> hold.
> They document (and verify) programmer expectations that either some statement
> always holds true at the point of (D)CHECKing or that a piece of code is
> unreachable (for NOTREACHED). CHECK failures and reachable NOTREACHEDs result 
> in
> an application crash (generating a crash report).
> 
> I don't remember when they switched NOTREACHED() to be fatal (recently, I 
> think).
> If you try to use BindSerialPortManager on OpenBSD, you crash.
> 
>>
>> Anyway, I had added robert@ in case if he missed it.
>>
> 

-- 
Fabien Romano

Index: Makefile
===================================================================
RCS file: /mnt/ext/cvs/ports/www/chromium/Makefile,v
diff -u -p -r1.917 Makefile
--- Makefile    10 Jul 2026 07:47:01 -0000      1.917
+++ Makefile    12 Jul 2026 16:41:29 -0000
@@ -13,6 +13,7 @@ DPB_PROPERTIES+=      lonesome
 COMMENT=               Chromium browser
 
 V=                     150.0.7871.114
+REVISION=              0
 
 DISTNAME=              chromium-${V}
 
Index: patches/patch-services_device_BUILD_gn
===================================================================
RCS file: 
/mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_BUILD_gn,v
diff -u -p -r1.7 patch-services_device_BUILD_gn
--- patches/patch-services_device_BUILD_gn      31 May 2025 05:14:03 -0000      
1.7
+++ patches/patch-services_device_BUILD_gn      12 Jul 2026 16:36:22 -0000
@@ -6,7 +6,7 @@ Index: services/device/BUILD.gn
  
  is_serial_enabled_platform =
 -    is_win || ((is_linux || is_chromeos) && use_udev) || is_mac || is_android
-+    is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || 
is_android
++    is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || 
is_android || is_openbsd
  
  source_set("lib") {
    # This should be visible only to embedders of the Device Service, and the
Index: patches/patch-services_device_serial_BUILD_gn
===================================================================
RCS file: 
/mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_serial_BUILD_gn,v
diff -u -p -r1.12 patch-services_device_serial_BUILD_gn
--- patches/patch-services_device_serial_BUILD_gn       13 Mar 2026 12:50:17 
-0000      1.12
+++ patches/patch-services_device_serial_BUILD_gn       12 Jul 2026 16:36:22 
-0000
@@ -6,7 +6,7 @@ Index: services/device/serial/BUILD.gn
  }
  
 -if (is_win || ((is_linux || is_chromeos) && use_udev) || is_mac || 
is_android) {
-+if (is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || 
is_android) {
++if (is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || 
is_android || is_openbsd) {
    config("platform_support") {
      visibility = [ ":serial" ]
      if (is_win) {
Index: patches/patch-services_device_serial_serial_device_enumerator_cc
===================================================================
RCS file: 
/mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_serial_serial_device_enumerator_cc,v
diff -u -p -r1.11 patch-services_device_serial_serial_device_enumerator_cc
--- patches/patch-services_device_serial_serial_device_enumerator_cc    2 Jul 
2025 12:47:40 -0000       1.11
+++ patches/patch-services_device_serial_serial_device_enumerator_cc    12 Jul 
2026 16:39:22 -0000
@@ -1,21 +1,27 @@
+un-break build, NOTREACHED()
+
 Index: services/device/serial/serial_device_enumerator.cc
 --- services/device/serial/serial_device_enumerator.cc.orig
 +++ services/device/serial/serial_device_enumerator.cc
-@@ -12,7 +12,7 @@
+@@ -12,7 +12,9 @@
  #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)
++#if BUILDFLAG(IS_OPENBSD)
++// none
++#elif 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"
-@@ -27,7 +27,7 @@ namespace device {
+@@ -27,7 +29,9 @@ 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)
++#if BUILDFLAG(IS_OPENBSD)
++  NOTREACHED() << "SerialDeviceEnumerator not supported on this platform.";
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
    return SerialDeviceEnumeratorLinux::Create();
  #elif BUILDFLAG(IS_MAC)
    return std::make_unique<SerialDeviceEnumeratorMac>();
Index: patches/patch-services_device_serial_serial_port_manager_impl_cc
===================================================================
RCS file: patches/patch-services_device_serial_serial_port_manager_impl_cc
diff -N patches/patch-services_device_serial_serial_port_manager_impl_cc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-services_device_serial_serial_port_manager_impl_cc    12 Jul 
2026 16:40:20 -0000
@@ -0,0 +1,39 @@
+Return empty devices list and fallback on mojo::NullRemote().
+
+Index: services/device/serial/serial_port_manager_impl.cc
+--- services/device/serial/serial_port_manager_impl.cc.orig
++++ services/device/serial/serial_port_manager_impl.cc
+@@ -85,6 +85,9 @@ void SerialPortManagerImpl::SetClient(
+ void SerialPortManagerImpl::GetDevices(bool allow_bluetooth_system_prompt,
+                                        GetDevicesCallback callback) {
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++#if BUILDFLAG(IS_OPENBSD)
++  std::move(callback).Run({});
++#else
+   if (!enumerator_) {
+     enumerator_ = SerialDeviceEnumerator::Create(ui_task_runner_);
+     observed_enumerator_.AddObservation(enumerator_.get());
+@@ -107,6 +110,7 @@ void SerialPortManagerImpl::GetDevices(bool allow_blue
+   }
+   bluetooth_enumerator_->GetDevicesAfterInitialEnumeration(base::BindOnce(
+       &FinishGetDevices, std::move(callback), std::move(devices)));
++#endif
+ }
+ 
+ void SerialPortManagerImpl::OpenPort(
+@@ -117,6 +121,7 @@ void SerialPortManagerImpl::OpenPort(
+     mojo::PendingRemote<mojom::SerialPortConnectionWatcher> watcher,
+     OpenPortCallback callback) {
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++#if !BUILDFLAG(IS_OPENBSD)
+   if (!enumerator_) {
+     enumerator_ = SerialDeviceEnumerator::Create(ui_task_runner_);
+     observed_enumerator_.AddObservation(enumerator_.get());
+@@ -156,6 +161,7 @@ void SerialPortManagerImpl::OpenPort(
+                            base::SequencedTaskRunner::GetCurrentDefault())));
+     return;
+   }
++#endif
+ 
+   std::move(callback).Run(mojo::NullRemote());
+ }
Index: 
patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
===================================================================
RCS file: 
patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
diff -N 
patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ 
patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
   12 Jul 2026 17:07:26 -0000
@@ -0,0 +1,20 @@
+Change Serial feature status from stable to test.
+Serial will only be available with --run-web-tests, 
--enable-blink-test-features.
+
+Index: 
third_party/blink/renderer/platform/runtime_enabled_features.override.json5
+--- 
third_party/blink/renderer/platform/runtime_enabled_features.override.json5.orig
++++ third_party/blink/renderer/platform/runtime_enabled_features.override.json5
+@@ -45,6 +45,10 @@
+   // ]
+ 
+   data: [
+-    // Entries go here.
++    {
++      name: "Serial",
++      status: "test",
++      base_feature: "WebSerialAPI",
++    },
+   ]
+-}
+\ No newline at end of file
++}
Index: Makefile
===================================================================
RCS file: /mnt/ext/cvs/ports/www/chromium/Makefile,v
diff -u -p -r1.917 Makefile
--- Makefile	10 Jul 2026 07:47:01 -0000	1.917
+++ Makefile	12 Jul 2026 16:41:29 -0000
@@ -13,6 +13,7 @@ DPB_PROPERTIES+=	lonesome
 COMMENT=		Chromium browser
 
 V=			150.0.7871.114
+REVISION=		0
 
 DISTNAME=		chromium-${V}
 
Index: patches/patch-services_device_BUILD_gn
===================================================================
RCS file: /mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_BUILD_gn,v
diff -u -p -r1.7 patch-services_device_BUILD_gn
--- patches/patch-services_device_BUILD_gn	31 May 2025 05:14:03 -0000	1.7
+++ patches/patch-services_device_BUILD_gn	12 Jul 2026 16:36:22 -0000
@@ -6,7 +6,7 @@ Index: services/device/BUILD.gn
  
  is_serial_enabled_platform =
 -    is_win || ((is_linux || is_chromeos) && use_udev) || is_mac || is_android
-+    is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || is_android
++    is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || is_android || is_openbsd
  
  source_set("lib") {
    # This should be visible only to embedders of the Device Service, and the
Index: patches/patch-services_device_serial_BUILD_gn
===================================================================
RCS file: /mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_serial_BUILD_gn,v
diff -u -p -r1.12 patch-services_device_serial_BUILD_gn
--- patches/patch-services_device_serial_BUILD_gn	13 Mar 2026 12:50:17 -0000	1.12
+++ patches/patch-services_device_serial_BUILD_gn	12 Jul 2026 16:36:22 -0000
@@ -6,7 +6,7 @@ Index: services/device/serial/BUILD.gn
  }
  
 -if (is_win || ((is_linux || is_chromeos) && use_udev) || is_mac || is_android) {
-+if (is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || is_android) {
++if (is_win || ((!is_bsd && is_linux || is_chromeos) && use_udev) || is_mac || is_android || is_openbsd) {
    config("platform_support") {
      visibility = [ ":serial" ]
      if (is_win) {
Index: patches/patch-services_device_serial_serial_device_enumerator_cc
===================================================================
RCS file: /mnt/ext/cvs/ports/www/chromium/patches/patch-services_device_serial_serial_device_enumerator_cc,v
diff -u -p -r1.11 patch-services_device_serial_serial_device_enumerator_cc
--- patches/patch-services_device_serial_serial_device_enumerator_cc	2 Jul 2025 12:47:40 -0000	1.11
+++ patches/patch-services_device_serial_serial_device_enumerator_cc	12 Jul 2026 16:39:22 -0000
@@ -1,21 +1,27 @@
+un-break build, NOTREACHED()
+
 Index: services/device/serial/serial_device_enumerator.cc
 --- services/device/serial/serial_device_enumerator.cc.orig
 +++ services/device/serial/serial_device_enumerator.cc
-@@ -12,7 +12,7 @@
+@@ -12,7 +12,9 @@
  #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)
++#if BUILDFLAG(IS_OPENBSD)
++// none
++#elif 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"
-@@ -27,7 +27,7 @@ namespace device {
+@@ -27,7 +29,9 @@ 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)
++#if BUILDFLAG(IS_OPENBSD)
++  NOTREACHED() << "SerialDeviceEnumerator not supported on this platform.";
++#elif BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_BSD)
    return SerialDeviceEnumeratorLinux::Create();
  #elif BUILDFLAG(IS_MAC)
    return std::make_unique<SerialDeviceEnumeratorMac>();
Index: patches/patch-services_device_serial_serial_port_manager_impl_cc
===================================================================
RCS file: patches/patch-services_device_serial_serial_port_manager_impl_cc
diff -N patches/patch-services_device_serial_serial_port_manager_impl_cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-services_device_serial_serial_port_manager_impl_cc	12 Jul 2026 16:40:20 -0000
@@ -0,0 +1,39 @@
+Return empty devices list and fallback on mojo::NullRemote().
+
+Index: services/device/serial/serial_port_manager_impl.cc
+--- services/device/serial/serial_port_manager_impl.cc.orig
++++ services/device/serial/serial_port_manager_impl.cc
+@@ -85,6 +85,9 @@ void SerialPortManagerImpl::SetClient(
+ void SerialPortManagerImpl::GetDevices(bool allow_bluetooth_system_prompt,
+                                        GetDevicesCallback callback) {
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++#if BUILDFLAG(IS_OPENBSD)
++  std::move(callback).Run({});
++#else
+   if (!enumerator_) {
+     enumerator_ = SerialDeviceEnumerator::Create(ui_task_runner_);
+     observed_enumerator_.AddObservation(enumerator_.get());
+@@ -107,6 +110,7 @@ void SerialPortManagerImpl::GetDevices(bool allow_blue
+   }
+   bluetooth_enumerator_->GetDevicesAfterInitialEnumeration(base::BindOnce(
+       &FinishGetDevices, std::move(callback), std::move(devices)));
++#endif
+ }
+ 
+ void SerialPortManagerImpl::OpenPort(
+@@ -117,6 +121,7 @@ void SerialPortManagerImpl::OpenPort(
+     mojo::PendingRemote<mojom::SerialPortConnectionWatcher> watcher,
+     OpenPortCallback callback) {
+   DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
++#if !BUILDFLAG(IS_OPENBSD)
+   if (!enumerator_) {
+     enumerator_ = SerialDeviceEnumerator::Create(ui_task_runner_);
+     observed_enumerator_.AddObservation(enumerator_.get());
+@@ -156,6 +161,7 @@ void SerialPortManagerImpl::OpenPort(
+                            base::SequencedTaskRunner::GetCurrentDefault())));
+     return;
+   }
++#endif
+ 
+   std::move(callback).Run(mojo::NullRemote());
+ }
Index: patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
===================================================================
RCS file: patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
diff -N patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-third_party_blink_renderer_platform_runtime_enabled_features_override_json5	12 Jul 2026 17:07:26 -0000
@@ -0,0 +1,20 @@
+Change Serial feature status from stable to test.
+Serial will only be available with --run-web-tests, --enable-blink-test-features.
+
+Index: third_party/blink/renderer/platform/runtime_enabled_features.override.json5
+--- third_party/blink/renderer/platform/runtime_enabled_features.override.json5.orig
++++ third_party/blink/renderer/platform/runtime_enabled_features.override.json5
+@@ -45,6 +45,10 @@
+   // ]
+ 
+   data: [
+-    // Entries go here.
++    {
++      name: "Serial",
++      status: "test",
++      base_feature: "WebSerialAPI",
++    },
+   ]
+-}
+\ No newline at end of file
++}

Reply via email to