tabby-rdp 0.5.2 → 0.5.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,145 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.5
4
+
5
+ **Fixed**
6
+ - **The development Angular dependency is updated to 21.2.25**, replacing the vulnerable 15.2.10 pin. The complete
7
+ locked dependency tree passes the npm advisory audit, including the seven Angular advisories reported against
8
+ 0.5.4. This updates the plugin's build dependency; Tabby's bundled Angular remains controlled by Tabby.
9
+ - **Published dependency metadata includes only the plugin's runtime dependencies.** Build/test dependencies and
10
+ build scripts stay in the source checkout. The published shrinkwrap retains exact runtime versions, download URLs
11
+ and integrity hashes, and omits development-only entries. Playwright's browser installer helpers no longer belong
12
+ to the published plugin's dependency graph.
13
+ - **Publication checks verify the exact metadata transformation against the tagged source**, and still compare all
14
+ other packaged source files and vendor binaries. CI audits all development dependencies and tests the packed plugin
15
+ in native Tabby on macOS, Windows and Linux.
16
+
17
+ Version 0.5.4 was deprecated and unpublished from npm while these findings were addressed; its GitHub release was
18
+ returned to draft. The scanner's separate warning about the presence of a shrinkwrap remains an intentional packaging
19
+ tradeoff; this release retains the reviewed runtime lock.
20
+
21
+ ## 0.5.4
22
+
23
+ Expanded Linux desktop qualification, cross-platform visual QA and RDP security hardening.
24
+
25
+ **Added**
26
+ - **Cross-platform visual QA against real desktops:** native Tabby clients on macOS, Windows and Linux cover
27
+ Ubuntu 24.04 / GNOME 46, Fedora 44 / GNOME 50, Debian 13.7 / GNOME 48, Rocky Linux 9 / Xfce with xrdp, and
28
+ Windows 11. Checks capture desktop pixels, keyboard input, resize, tab return and reconnect with reviewed baselines
29
+ and recorded client, server and plugin identities. RDP qualification currently uses ARM64 clients.
30
+ - **A local visual QA dashboard** runs tests and opens screenshot evidence, HTML reports and traces. It includes
31
+ history, scheduling, retention, automatic failure investigation and optional AI review. Credentials, private target
32
+ configuration and run artifacts stay outside the published package and repository.
33
+ - **Tests of the visual tests:** controlled defect injection verifies that the deterministic checks detect all 13
34
+ tested defects on all three client platforms. Optional AI review remains advisory, with its misses recorded.
35
+ - **Hosted native smoke checks on macOS, Windows and Linux** validate plugin loading and settings in CI. Real RDP
36
+ tests use separately configured machines; hosted smoke results do not stand in for desktop qualification.
37
+ - **An experimental Fedora KDE / KRDP testbed** covers H.264 with FreeRDP 3.32.1 on the server, using two opt-in
38
+ server patches for color and authentication compatibility. The fixed-monitor profile passes on all three native
39
+ client platforms. Stock server variants and live remote monitor resizing remain unqualified. The plugin's RDP
40
+ client remains IronRDP; Rocky Linux's tested traditional desktop stack is Xfce with xrdp.
41
+
42
+ **Changed**
43
+ - **Standard dialogs use Tabby's own window drag region**, available in Tabby 1.0.238
44
+ ([upstream #11766](https://github.com/Eugeny/tabby/pull/11766)). The plugin no longer adds a fallback to host dialogs.
45
+ Older Tabby versions still work, but need updating to move the window while a standard dialog is open.
46
+ The plugin's custom settings overlays retain their own drag strips.
47
+
48
+ **Security** (the rest of the review of 0.5.3-rc.1; all of these were in 0.5.2 too)
49
+ - **The RD Gateway's NTLM sign-in is always bound to its TLS connection.** A challenge without the target information
50
+ or the time that the binding goes with is refused, rather than answered without the binding and the integrity code.
51
+ - **A server can no longer fill Tabby's memory with clipboard answers it doesn't read.** The local proxy stopped
52
+ reading the client when the server fell behind, so answers piled up uncounted in the window until it crashed. It
53
+ now goes on reading, counts what waits for the server against the room file transfers already keep within, and
54
+ ends the connection once 104 MB waits.
55
+ - **H.264 decoders are held to 16 per desktop**, including decoders still finishing frames after their surfaces end.
56
+ A surface gets one only with a key frame. IronRDP owns admission, accounting and cleanup through its public decoder
57
+ configuration; the earlier wrapper that evicted surfaces by editing private decoder state is removed.
58
+ Exceeding the cap fails H.264 and takes the existing reconnect-without-H.264 path.
59
+ - **A shared folder's listing gives the server at most 10,000 names**, read a few at a time, rather than the whole
60
+ folder for each listing the server asks for. A name past those is still there to open by its path, though not to
61
+ find by a query of the folder. How many listings the server may have open at once (one per folder handle) isn't
62
+ bounded yet, so this slows what a server can have the desktop keep rather than ends it.
63
+
64
+ **Additional security hardening** (#77–87)
65
+
66
+ - **CredSSP requires version 5 or later** before authentication continues. Servers offering only versions 2–4
67
+ must be updated; accepting their TLS certificate does not enable the legacy authentication binding.
68
+ - **Graphics decoding and caches have dimension, allocation and retained-state limits.** Static and dynamic
69
+ virtual-channel reassembly also has per-message limits and an aggregate incomplete-dynamic-message budget.
70
+ These limits are per session, not a total memory ceiling for Tabby's window.
71
+ - **Clipboard format lists are bounded and supported formats are selected in one pass.** Shared-drive work is
72
+ limited to 1,024 queued or in-flight requests and 64 MiB of encoded request data, with a resource error when full.
73
+ - **Generated GNOME credentials are stored per machine identifier.** Each host rotates to fresh credentials when
74
+ next set up; this does not isolate hosts from someone who can read or modify their shared home directory.
75
+ - **Runtime dependencies are pinned and shipped with an npm shrinkwrap.** Testbed images require verified hashes,
76
+ WinRM dependencies and the Electron CI tree are locked, and testbed credential media is privately staged and cleaned.
77
+ The internal-name CI check receives its secret only on protected branch pushes; it is inactive on an unprotected RC.
78
+
79
+ **EGFX/H.264 integration** (#88)
80
+
81
+ - **Graphics work waiting behind asynchronous decoding is bounded by count and bytes.** PDUs are processed
82
+ incrementally, AVC regions and frames per message are limited, and completions no longer scan the command queue.
83
+ - **Browser decoder input, creation rate, picture readbacks and decoded-pixel events have separate budgets.**
84
+ Surface deletion/reset closes ended streams even without a later H.264 frame. Failure and close release retained
85
+ pictures and suppress late readback callbacks. These budgets are per session and add together; they are not one
86
+ total renderer memory ceiling.
87
+ - **The combined patch series is rebuilt into the shipped JavaScript/WASM**, including the public decoder-cap
88
+ integration and bounded key-frame admission tests.
89
+
90
+ **Known limits:** the aggregate open-listing limit above and live Windows H.264/shared-folder checks remain pending.
91
+ The visual QA matrix does not qualify those paths; KDE qualification is limited to the patched, fixed-monitor profile.
92
+ See [visual QA coverage](docs/visual-qa.md) for the checks actually performed.
93
+
94
+ ## 0.5.3
95
+
96
+ **Added**
97
+ - **Each desktop connection has its own WebAssembly instance**, while sharing compiled IronRDP code. Reconnecting
98
+ or recovering from an instance fault creates a fresh backend for that desktop without replacing other desktops.
99
+ - **Instance lifecycle checks** cover independent memories, cleanup, reconnects and collection after disposal,
100
+ with a browser smoke test and a live two-desktop isolation suite.
101
+
102
+ **Security** (a review of 0.5.3-rc.1; all of these were in 0.5.2 too)
103
+ - **Moving the pointer over a desktop no longer gives it the keyboard and the clipboard.** IronRDP's canvas took the
104
+ focus without a click, so keys typed into the terminal next to it (a password at a prompt that doesn't echo
105
+ included) and this computer's clipboard went to that remote server; also from behind a maximized pane. A desktop
106
+ now takes the keyboard only in the pane in front, and gives it back to where it came from otherwise.
107
+ - **A desktop lets go of the keyboard when its tab is left by keyboard** for one that takes no focus (Settings, the
108
+ welcome tab): it went on taking the keys typed and the clipboard copied, view only included. Keys that reach a
109
+ desktop not in front now stop at the plugin. The shortcut's modifier, still down as the tab goes, is let go of on
110
+ the remote too, whichever tab is left for: its keyup goes where the user went, and IronRDP lets go of nothing as its
111
+ canvas loses the focus, so the modifier stayed held there until it was pressed again (a held Alt has the next key
112
+ open a menu on Windows).
113
+ - **A crafted .rdp file can't hang Tabby's window**: a line of whitespace took time that grew with the cube of its
114
+ length to parse (seconds for a few thousand spaces). Files over 1 MB are refused unread.
115
+
116
+ **Fixed**
117
+ - **Removing a profile without an address no longer forgets what was saved for 127.0.0.1:3389.**
118
+ - **The architecture document gives the update check's real limit** (4 MB for the version catalog, not 256 KB).
119
+ - **Tabby's window no longer crashes when a desktop reached directly is refused after TLS** (#69): on Linux, the
120
+ first connection to any desktop in a remote desktop tab (a profile, quick connect, an .rdp file), whose certificate
121
+ is asked about before anything of the sign-in goes to it, closed the window and left Tabby running in the
122
+ background. A changed certificate did the same. The plugin now closes TLS before the socket under it. Desktops
123
+ behind an SSH host were not affected.
124
+ - **Removing a saved gateway account keeps gateway credentials separate.** Inherited gateway uses are listed in
125
+ the removal confirmation; affected desktops and group defaults ask for a gateway account on the next connection.
126
+ Missing named gateway accounts also ask separately instead of silently using the destination credentials.
127
+ - **The desktop inventory shows effective profile settings**, including inherited gateway routing, gateway accounts,
128
+ SSH profiles, sign-in names and connection kinds.
129
+ - **Ended connections release their backend and browser resources**, including timers, global listeners, media,
130
+ and the statistics indicator's canvas hook, while retaining the last picture for the disconnected pane.
131
+ - **Profile Save validates the address and RD Gateway before committing either field.** Invalid edits keep the
132
+ editor open and focus the field to correct, instead of saving an invalid gateway or silently keeping an old address.
133
+ Blank destinations preserve custom and inherited default ports when saving unrelated changes.
134
+
135
+ **Changed**
136
+ - **The rollback minimum is 0.5.3.** Updates persists this minimum to protect saved separate gateway prompts
137
+ from older versions that would reuse desktop credentials, and records a target release's minimum on installation.
138
+ - **Preview publishing uses npm's beta tag** for both beta and release-candidate versions. GitHub release drafts
139
+ remain unpublished until the staged npm package is approved and verified.
140
+
141
+ Qualification and remaining stable-release checks are tracked in [#49](https://github.com/meanaverage/tabby-rdp/issues/49).
142
+
3
143
  ## 0.5.2
4
144
 
5
145
  **Added**
package/README.md CHANGED
@@ -25,7 +25,8 @@ remote desktop profiles can also connect directly or through an RD Gateway.
25
25
 
26
26
  - **Linux desktops without a monitor or a login.** The plugin starts a headless GNOME session for your SSH user with
27
27
  GNOME Remote Desktop, on the fly, without root. A server in a rack works as well as a workstation.
28
- - **Other Linux desktops** (KDE, XFCE, MATE, Cinnamon, …) through xrdp, where it runs: the plugin finds it by itself.
28
+ - **Other Linux desktops** through xrdp, including tested Rocky Linux 9 with Xfce. KDE, MATE, Cinnamon and
29
+ other desktops can also run in xrdp sessions; the plugin finds the server by itself.
29
30
  - **Windows desktops** behind any SSH host, such as a VM on your build server, and the desktop of a Windows machine
30
31
  you SSH into.
31
32
  - **Remote desktop profiles** for machines you reach without SSH (LAN, VPN): in Tabby's profile list, in a tab of their
@@ -62,6 +63,7 @@ Making it work with GNOME took fixes in IronRDP, which we contribute upstream ([
62
63
  - [desk: the console on the desktop](#desk-the-console-on-the-desktop)
63
64
  - [Settings](#settings)
64
65
  - [Requirements](#requirements)
66
+ - [Tested environments](#tested-environments)
65
67
  - [Built on IronRDP](#built-on-ironrdp)
66
68
  - [Development](#development)
67
69
  - [Limitations](#limitations)
@@ -86,7 +88,8 @@ Open **Settings › Remote Desktop › Updates** to manage the installed version
86
88
  - **Stable** is the default. **Preview** also offers beta releases and release candidates when available.
87
89
  - Automatic checks look for updates once a day. **Check now** checks manually; installation is always your choice.
88
90
  - Choose an exact compatible version, **Return to stable**, or **Restore previous version** after an installation
89
- from this page. Version changes currently support **0.5.1 or newer**.
91
+ from this page. After running **0.5.3**, version changes require **0.5.3 or newer** to preserve separate
92
+ gateway sign-in prompts; returning to an older stable release is blocked.
90
93
  - **Uninstall plugin…** removes the package. **Manage in Tabby…** opens Tabby's plugin controls to disable it.
91
94
  Saved connections, settings, passwords and remote setup are kept.
92
95
 
@@ -111,6 +114,17 @@ The first connection to a machine takes a few seconds while it prepares GNOME Re
111
114
  ones take well under a second. The same shortcut switches between the desktop and the console, and the desktop keeps
112
115
  running in the background until you disconnect or close the tab.
113
116
 
117
+ GNOME's generated password and TLS key belong to each SSH user and machine. They are kept under
118
+ `~/.local/share/tabby-rdp/hosts/<machine-id>/`, with private directory/file permissions. Linux needs a valid,
119
+ initialized `/etc/machine-id`; cloned machines must have distinct IDs. On the first connection after this change,
120
+ each machine gets new credentials and GNOME Remote Desktop restarts, disconnecting any existing RDP clients.
121
+ Reconnect to **every** machine using a shared home to rotate all active credentials. Old home-wide credential files
122
+ are preserved for machines still using an earlier version, but this version never imports them.
123
+
124
+ Separate credentials prevent accidental reuse across machines; they do not isolate machines that let the same
125
+ account read or write the shared home. That account can still read every machine's stored secrets and GNOME's own
126
+ shared configuration. Use separate accounts or host-local homes when those machines need independent trust.
127
+
114
128
  A machine without GNOME but with [xrdp](https://github.com/neutrinolabs/xrdp) running (the usual RDP server for KDE,
115
129
  XFCE, MATE and the rest) gets xrdp's desktop instead: sign in with your Linux password, which the plugin can remember
116
130
  in the system keychain. xrdp takes the password without Network Level Authentication, and that the machine's desktop
@@ -555,15 +569,35 @@ are local to this computer:
555
569
  - **Windows desktops:** Windows 10 or 11 Pro, or Windows Server, with Remote Desktop turned on, reachable from an SSH
556
570
  host or running OpenSSH Server itself.
557
571
 
558
- Tested with Ubuntu 24.04 (GNOME Remote Desktop 46.3) and Windows 11 (Pro and Enterprise), from Tabby on macOS,
559
- Windows 11 and Ubuntu 24.04 (arm64). Recent host compatibility tests cover official Tabby **1.0.238** on macOS
560
- with xterm 5, and upstream xterm 6 builds on macOS and Linux. The new package installation dialog is tested on
561
- macOS with Tabby 1.0.238; Windows qualification of these changes remains pending. See the
562
- [host test matrix](test/README.md#host-qualification) for the exact builds and coverage.
563
-
564
572
  The plugin checks the host's available features through a shared compatibility layer. Connection logs include the
565
573
  host and runtime versions, declared xterm dependency and observed capabilities to help diagnose forks and nightlies.
566
574
 
575
+ ## Tested environments
576
+
577
+ The visual QA matrix runs real remote desktops in native Tabby clients on **macOS, Windows and Linux**. The current
578
+ RDP matrix uses ARM64 Tabby 1.0.236 / Electron 43.7.0 on all three client platforms:
579
+
580
+ | Remote desktop | Server stack | Visual QA coverage |
581
+ |---|---|---|
582
+ | Ubuntu 24.04 | GNOME 46 / GNOME Remote Desktop | Desktop pixels, keyboard input, resize, tab return and reconnect |
583
+ | Fedora 44 | GNOME 50 / GNOME Remote Desktop | Same RDP lifecycle checks |
584
+ | Debian 13.7 | GNOME 48 / GNOME Remote Desktop | Same RDP lifecycle checks |
585
+ | Rocky Linux 9 | Xfce 4.18 / xrdp 0.10.6.1 / xorgxrdp 0.10.5 | Same RDP lifecycle checks |
586
+ | Windows 11 | Windows Remote Desktop | Same RDP lifecycle checks, with H.264 disabled |
587
+ | Fedora 44 KDE Plasma | KRDP / KPipeWire 6.7.5, FreeRDP 3.32.1; two opt-in server patches | H.264 pixels, input, tab return, reconnect and fixed-monitor client fitting |
588
+
589
+ The KDE row is experimental: the tested profile needs server-side color and authentication compatibility patches.
590
+ Stock KDE builds and live remote monitor resizing are not qualified. FreeRDP is a dependency of that KRDP server;
591
+ tabby-rdp's client continues to use IronRDP. Rocky's Xfce desktop uses **xrdp**, a different RDP server.
592
+ The testbed includes the opt-in KDE patches and reproducible setup instructions; see the
593
+ [visual QA guide](docs/visual-qa.md) for exact identities, evidence and remaining gaps.
594
+
595
+ Hosted CI also runs native settings and plugin smoke checks on macOS, Windows and Linux; those checks do not qualify
596
+ x86_64 RDP sessions. Recent host compatibility tests cover official Tabby **1.0.238** on macOS with xterm 5, and
597
+ upstream xterm 6 builds on macOS and Linux. The package installation dialog is tested on macOS with Tabby 1.0.238;
598
+ Windows qualification of that dialog remains pending. See the [host test matrix](test/README.md#host-qualification).
599
+ These focused checks do not establish clipboard, shared-folder, audio or microphone coverage across every matrix cell.
600
+
567
601
  ## Built on IronRDP
568
602
 
569
603
  The desktop is [IronRDP](https://github.com/Devolutions/IronRDP)'s web client: an RDP implementation in Rust, compiled
@@ -603,11 +637,15 @@ npm ci --ignore-scripts
603
637
  npm run build # TypeScript to dist/
604
638
  npm run typecheck # plugin and test TypeScript
605
639
  npm run test:unit # standard unit suite; no remote machine needed
640
+ npm run pack:release # publishable package with runtime-only dependency metadata
606
641
  scripts/sandbox.sh # a separate Tabby with this plugin linked in (macOS), DevTools on port 9334
607
642
  npm test # end-to-end suites against a test machine: see test/README.md
608
643
  npm run build:ironrdp # rebuild vendor/ from IronRDP and ironrdp/patches: see ironrdp/README.md
609
644
  ```
610
645
 
646
+ - [docs/visual-qa.md](docs/visual-qa.md): the local visual QA dashboard, native client/server matrix, reviewed screenshot
647
+ baselines, defect injection, optional AI review, scheduling and evidence retention. Run `npm run test:qa` for its
648
+ service tests; follow the guide to configure real desktop targets. Private credentials and run artifacts stay local.
611
649
  - [docs/architecture.md](docs/architecture.md): how the pieces fit, the remote setup, and security notes.
612
650
  - [docs/desk.md](docs/desk.md): `desk` and trd-pty.
613
651
  - [test/README.md](test/README.md) and [testbed/README.md](testbed/README.md): the tests, and setting up test
@@ -64,12 +64,17 @@ In **0.5.2 or newer**, open **Settings › Remote Desktop › Updates**. **Stabl
64
64
 
65
65
  The confirmation dialog stays open through progress and the verified result. If installation fails, the dialog shows the cause. After success, close remote desktops and restart Tabby; Updates shows the running version and the installed version waiting for restart until then.
66
66
 
67
- Use **0.5.1 or newer** with current account and certificate settings, and respect any higher minimum documented by a later data migration.
67
+ After running **0.5.3**, use **0.5.3 or newer**, including after uninstalling and reinstalling. This version
68
+ can save a separate gateway sign-in prompt (`@ask`) in desktops, profiles and defaults, including when a saved gateway
69
+ account is removed. Versions **0.5.1 and 0.5.2** can silently use the desktop's credentials for that gateway instead.
70
+ Updates records this minimum on startup even if update checks are paused, and retains the highest recorded minimum.
71
+ The safeguard applies to this computer's Updates page; manual npm installation, Tabby's plugin controls and older
72
+ installations on other computers can bypass it. Use the same minimum wherever this configuration is copied or synced.
68
73
 
69
74
  If the plugin cannot load:
70
75
 
71
76
  1. Open **Tabby › Settings › Plugins**. Disable **tabby-rdp** to stop it loading, or uninstall and reinstall it there. Restart Tabby after changing plugins. Tabby’s [configuration locations](https://github.com/Eugeny/tabby/wiki/Config-file) help locate your profile when the application cannot open.
72
- 2. For a specific known compatible version, open a terminal in **Tabby's plugin folder** (the folder containing the plugin installation's `package.json`, with `node_modules/tabby-rdp` below it). Run `npm install tabby-rdp@0.5.1`, replacing `0.5.1` with your known compatible exact version. Do not run this in the tabby-rdp source checkout, the application bundle, or inside `node_modules/tabby-rdp` itself. Fully quit and reopen Tabby afterwards.
77
+ 2. For a specific known compatible version, open a terminal in **Tabby's plugin folder** (the folder containing the plugin installation's `package.json`, with `node_modules/tabby-rdp` below it). Run `npm install tabby-rdp@0.5.3`, replacing `0.5.3` with your known compatible exact version at or above the minimum above. Do not run this in the tabby-rdp source checkout, the application bundle, or inside `node_modules/tabby-rdp` itself. Fully quit and reopen Tabby afterwards.
73
78
  3. If a later version has migrated saved data, respect that version's documented minimum. Reinstall a compatible stable version or the last working preview; do not force an older version across a migration boundary.
74
79
 
75
80
  Disabling or uninstalling keeps desktops, profiles, settings, remembered certificates and saved credentials. It also leaves any remote helpers and remote applications in place. To remove saved entries, use **Remote Desktop › Desktops** and **Accounts**, and **Profiles & connections** for profiles, before uninstalling. Unlock the credential store first if required; check any reported failure rather than assuming a credential was deleted. Data synced to other computers may need attention there too.
package/dist/accounts.js CHANGED
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ASK_GATEWAY_ACCOUNT = void 0;
3
4
  exports.accountsOf = accountsOf;
4
5
  exports.newAccountId = newAccountId;
5
6
  exports.signInName = signInName;
6
7
  exports.accountKey = accountKey;
8
+ /** A separate gateway sign-in prompt. The '@' cannot occur in a saved account's id. */
9
+ exports.ASK_GATEWAY_ACCOUNT = '@ask';
7
10
  /** The usable entries of `remoteDesktop.accounts` (hand-written ones may lack fields). */
8
11
  function accountsOf(store) {
9
12
  const list = Array.isArray(store?.accounts) ? store.accounts : [];
@@ -34,7 +34,7 @@ class ConnectionStatus {
34
34
  this.ticks = 0;
35
35
  this.last = null;
36
36
  this.frames = 0;
37
- this.hooked = null;
37
+ this.frameHook = null;
38
38
  this.latency = null;
39
39
  this.pinging = false;
40
40
  this.active = false;
@@ -57,6 +57,9 @@ class ConnectionStatus {
57
57
  if (active && canvas) {
58
58
  this.countFrames(canvas);
59
59
  }
60
+ else if (!active) {
61
+ this.releaseCanvas();
62
+ }
60
63
  if (active === this.active) {
61
64
  return;
62
65
  }
@@ -90,13 +93,16 @@ class ConnectionStatus {
90
93
  */
91
94
  countFrames(canvas) {
92
95
  const ctx = canvas.getContext('2d');
93
- if (!ctx || ctx === this.hooked) {
96
+ if (ctx === this.frameHook?.context) {
97
+ return;
98
+ }
99
+ this.releaseCanvas();
100
+ if (!ctx) {
94
101
  return;
95
102
  }
96
- this.hooked = ctx;
97
103
  const original = ctx.putImageData;
98
104
  let batch = false;
99
- ctx.putImageData = ((...args) => {
105
+ const wrapped = ((...args) => {
100
106
  if (!batch) {
101
107
  batch = true;
102
108
  this.frames++;
@@ -104,6 +110,17 @@ class ConnectionStatus {
104
110
  }
105
111
  return original.apply(ctx, args);
106
112
  });
113
+ ctx.putImageData = wrapped;
114
+ this.frameHook = { context: ctx, original, wrapped };
115
+ }
116
+ /** A detached canvas's handlers retain its backend, even after its component has been removed. */
117
+ releaseCanvas() {
118
+ const hook = this.frameHook;
119
+ this.frameHook = null;
120
+ // Leave a later owner's replacement alone.
121
+ if (hook && hook.context.putImageData === hook.wrapped) {
122
+ hook.context.putImageData = hook.original;
123
+ }
107
124
  }
108
125
  tick() {
109
126
  const now = performance.now();