Clipboard on http: copy and paste work without the Clipboard API

Over plain http on a tailnet address the page is not a secure context and
navigator.clipboard is undefined, so the web engine refused every copy.
ClipboardReportingMessenger now answers clipboard calls through the
browser's legacy clipboard when the API is missing (web only, conditional
import): copy uses execCommand('copy') with a one-shot copy-event listener
(no focus or selection change); a paste key's Clipboard.getData takes the
browser's own paste event, the key reported not-handled so the browser
still fires it. A Paste button/menu says to use Ctrl+V or the https address.
Secure pages keep the engine path. Capture kit: --insecure and clipboard=.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-29 19:06:58 +00:00
parent 3d739c3bfc
commit 18807b8ac2
14 changed files with 714 additions and 26 deletions
@@ -0,0 +1,26 @@
{
"params": "chats=2",
"steps": [
{ "open": "/chat/perf-chat-0@1000x800" },
{ "wait": 1500 },
{ "expect": "window.isSecureContext === false && navigator.clipboard === undefined", "name": "insecure page without the Clipboard API" },
{ "clipboard": "write:SENTINEL" },
{ "hover": "700,480" },
{ "click": "key:chat-code-copy", "wait": 300 },
{ "shot": "c1-code-copied" },
{ "clipboard": "read:code-block-copy" },
{ "clipboard": "write:SENTINEL" },
{ "hover": "700,640" },
{ "click": "491,681", "wait": 300 },
{ "clipboard": "read:message-copy" },
{ "clipboard": "write:[composer-ctrl-v]" },
{ "click": "700,747" },
{ "keys": [
{ "type": "rawKeyDown", "key": "Control", "code": "ControlLeft", "modifiers": 2, "windowsVirtualKeyCode": 17 },
{ "type": "rawKeyDown", "key": "v", "code": "KeyV", "modifiers": 2, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "v", "code": "KeyV", "modifiers": 2, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "Control", "code": "ControlLeft", "modifiers": 0, "windowsVirtualKeyCode": 17 }
], "wait": 800 },
{ "shot": "c2-composer-ctrl-v" }
]
}
@@ -0,0 +1,56 @@
{
"params": "chats=2&terminals=1&terminal=panel",
"steps": [
{ "open": "/chat/perf-chat-0@1000x800" },
{ "wait": 2000 },
{ "expect": "window.isSecureContext === false && navigator.clipboard === undefined", "name": "insecure page without the Clipboard API" },
{ "clipboard": "write:[ctrl-v]" },
{ "click": "500,720" },
{ "keys": [
{ "type": "rawKeyDown", "key": "Control", "code": "ControlLeft", "modifiers": 2, "windowsVirtualKeyCode": 17 },
{ "type": "rawKeyDown", "key": "v", "code": "KeyV", "modifiers": 2, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "v", "code": "KeyV", "modifiers": 2, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "Control", "code": "ControlLeft", "modifiers": 0, "windowsVirtualKeyCode": 17 }
], "wait": 800 },
{ "clipboard": "write:[shift-insert]" },
{ "keys": [
{ "type": "rawKeyDown", "key": "Shift", "code": "ShiftLeft", "modifiers": 8, "windowsVirtualKeyCode": 16 },
{ "type": "rawKeyDown", "key": "Insert", "code": "Insert", "modifiers": 8, "windowsVirtualKeyCode": 45 },
{ "type": "keyUp", "key": "Insert", "code": "Insert", "modifiers": 8, "windowsVirtualKeyCode": 45 },
{ "type": "keyUp", "key": "Shift", "code": "ShiftLeft", "modifiers": 0, "windowsVirtualKeyCode": 16 }
], "wait": 800 },
{ "clipboard": "write:[ctrl-shift-v]" },
{ "keys": [
{ "type": "rawKeyDown", "key": "Control", "code": "ControlLeft", "modifiers": 2, "windowsVirtualKeyCode": 17 },
{ "type": "rawKeyDown", "key": "Shift", "code": "ShiftLeft", "modifiers": 10, "windowsVirtualKeyCode": 16 },
{ "type": "rawKeyDown", "key": "V", "code": "KeyV", "modifiers": 10, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "V", "code": "KeyV", "modifiers": 10, "windowsVirtualKeyCode": 86 },
{ "type": "keyUp", "key": "Shift", "code": "ShiftLeft", "modifiers": 2, "windowsVirtualKeyCode": 16 },
{ "type": "keyUp", "key": "Control", "code": "ControlLeft", "modifiers": 0, "windowsVirtualKeyCode": 17 }
], "wait": 800 },
{ "shot": "p1-three-paste-keys" },
{ "clipboard": "write:SENTINEL" },
{ "drag": "96,570", "dx": 200, "dy": 0 },
{ "keys": [
{ "type": "rawKeyDown", "key": "Control", "code": "ControlLeft", "modifiers": 2, "windowsVirtualKeyCode": 17 },
{ "type": "rawKeyDown", "key": "Shift", "code": "ShiftLeft", "modifiers": 10, "windowsVirtualKeyCode": 16 },
{ "type": "rawKeyDown", "key": "C", "code": "KeyC", "modifiers": 10, "windowsVirtualKeyCode": 67 },
{ "type": "keyUp", "key": "C", "code": "KeyC", "modifiers": 10, "windowsVirtualKeyCode": 67 },
{ "type": "keyUp", "key": "Shift", "code": "ShiftLeft", "modifiers": 2, "windowsVirtualKeyCode": 16 },
{ "type": "keyUp", "key": "Control", "code": "ControlLeft", "modifiers": 0, "windowsVirtualKeyCode": 17 }
], "wait": 600 },
{ "clipboard": "read:ctrl-shift-c", "expect": "TestTerminalOverWebsocket" },
{ "type": " typed-after-copy" },
{ "shot": "p2-copied-then-typed" },
{ "rightclick": "500,700" },
{ "shot": "p3-context-menu" },
{ "press": "Escape" },
{ "clipboard": "write:SENTINEL" },
{ "rightclick": "500,700" },
{ "click": "400,552" },
{ "clipboard": "read:menu-copy", "expect": "TestTerminalOverWebsocket" },
{ "rightclick": "500,700" },
{ "click": "400,600", "wait": 400 },
{ "shot": "p4-menu-paste-message" }
]
}