diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:14:29 +0000 |
commit | fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8 (patch) | |
tree | 4c1ccaf5486d4f2009f9a338a98a83e886e29c97 /testing/web-platform/tests/resources/chromium/fake-serial.js | |
parent | Releasing progress-linux version 124.0.1-1~progress7.99u1. (diff) | |
download | firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.tar.xz firefox-fbaf0bb26397aa498eb9156f06d5a6fe34dd7dd8.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/resources/chromium/fake-serial.js')
-rw-r--r-- | testing/web-platform/tests/resources/chromium/fake-serial.js | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/testing/web-platform/tests/resources/chromium/fake-serial.js b/testing/web-platform/tests/resources/chromium/fake-serial.js index 29c8168fb5..8614b4d64f 100644 --- a/testing/web-platform/tests/resources/chromium/fake-serial.js +++ b/testing/web-platform/tests/resources/chromium/fake-serial.js @@ -356,6 +356,10 @@ class FakeSerialService { portInfo.hasUsbProductId = true; portInfo.usbProductId = info.usbProductId; } + portInfo.connected = true; + if (info?.connected !== undefined) { + portInfo.connected = info.connected; + } let token = ++this.nextToken_; portInfo.token = {high: 0n, low: BigInt(token)}; @@ -366,8 +370,10 @@ class FakeSerialService { }; this.ports_.set(token, record); - for (let client of this.clients_) { - client.onPortAdded(portInfo); + if (portInfo.connected) { + for (let client of this.clients_) { + client.onPortConnectedStateChanged(portInfo); + } } return token; @@ -381,8 +387,26 @@ class FakeSerialService { this.ports_.delete(token); + record.portInfo.connected = false; + for (let client of this.clients_) { + client.onPortConnectedStateChanged(record.portInfo); + } + } + + setPortConnectedState(token, connected) { + let record = this.ports_.get(token); + if (record === undefined) { + return; + } + + let was_connected = record.portInfo.connected; + if (was_connected === connected) { + return; + } + + record.portInfo.connected = connected; for (let client of this.clients_) { - client.onPortRemoved(record.portInfo); + client.onPortConnectedStateChanged(record.portInfo); } } |