Bug 1864254 [wpt PR 43094] - serial: Fix DCHECK crash when disconnection happens...
commit3449de7ddecc093d7f5cdfb8f8df7b2d51a849d8
authorAlvin Ji <alvinji@chromium.org>
Wed, 22 Nov 2023 22:39:57 +0000 (22 22:39 +0000)
committermoz-wptsync-bot <wptsync@mozilla.com>
Sun, 26 Nov 2023 18:05:35 +0000 (26 18:05 +0000)
treed5f8b13f571b425c845cc6fd1463d64a5f1bb2f6
parentc7c46c740c186132e6f63f6219222428fc0829fd
Bug 1864254 [wpt PR 43094] - serial: Fix DCHECK crash when disconnection happens during abort, a=testonly

Automatic update from web-platform-tests
serial: Fix DCHECK crash when disconnection happens during abort

The original implementation of
`SerialPortUnderlyingSink::OnFlushOrDrain` assumed that a valid
`pending_operation_` would always be available. However, this assumption
was flawed as disconnection could occur before the completion of the
abort operation.

To address this issue, the serialPort-disconnect-during-abort test was
introduced to trigger the crash and demonstrate that the disconnection
handler cleared pending_operation_. The revised code now checks the validity of `pending_operation_` before attempting to resolve it.

This modification ensures that
`SerialPortUnderlyingSink::OnFlushOrDrain` correctly even when
disconnection occurs during an abort operation, preventing potential
crashes.

Bug: 1499045
Change-Id: I5e09595063f8b18f8ff1da82ab23d1b21afdc6d2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5021930
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Alvin Ji <alvinji@chromium.org>
Commit-Queue: Alvin Ji <alvinji@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1227040}

--

wpt-commits: efde45b53b8fe9e66ac59dbe38ac8b34d568f67c
wpt-pr: 43094
testing/web-platform/tests/resources/chromium/fake-serial.js
testing/web-platform/tests/serial/serialPort-disconnect-during-abort.https.any.js [new file with mode: 0644]