Skip to content

Open-source AI browser agent for Chrome and Firefox (monorepo) 🧠

3.8 KB
Raw Blame

Literal editor verification

An installed Chrome MV3 save flow reproduced an actual data error: Chromium's multiline Input.insertText added blank lines to an ordinary contenteditable document, while permissive readback marked that different document verified. The application saved the changed body.

Ordinary contenteditable writes now use native insertion of escaped literal text with whitespace preserved. A clear-and-replace write selects the whole existing document and replaces it in one native insertion: a separate Delete could leave a pure-LF text node or trailing caret BR that contaminated the replacement. Writes keep native input events and undo handling, retain existing rich nodes when appending, and require the complete settled rendered value to equal the authorized text. Browser CRLF becomes LF; extra blank lines and other character changes fail verification. Model-backed paragraph editors keep their distinct semantic readback and trusted typing path.

test/contenteditable-literal.mjs exercises the production content handlers in Chromium and Firefox: 144 writes and 132 actual application POSTs, including double/triple and boundary blank lines, tabs/NBSP, combining marks, Unicode, emoji, and literal markup. It also verifies cancellable input, selection ownership, preserved rich nodes, and rejection of application-added corruption.

test/native-chat-empty-editor.mjs additionally reproduces an explicit native-chat clear that left a browser caret BR and falsely armed an uncertain-write fence. Only a successful explicit Delete in a freshly verified native conversation may create a private empty-caret receipt. It binds the actual caret node and current peer/root/header/transcript; replaced nodes, recipient switches, authored LF/multiple BR, and generic or unbound editors cannot inherit it. Fresh field verification and the owned native app's actual empty draft POST prove the logical empty result. This exception does not normalize generic raw innerText saves. The tests also exercise immediate append after clear, sequential literal LF replacements, and cancelled deletion in both engines.

test/quality/literal-frame-mv3.mjs uses the installed extension's normal planner, background, Agent, content, and completion gates with a controlled application and deterministic provider. Its ordinary and Trusted Types rich-editor cases each save an 11,646-character body exactly once, compare the actual application state/POST/preview digest, and finish successfully. The strict main-world Trusted Types policy remains enforced; the extension creates no policy and changes no CSP.

The nested three-origin case additionally exposed unfenced focus during legacy iframe marker preparation. Focus now occurs after the frame dispatch fence, and cancellation is checked again after that awaited fence. test/iframe-preparation-focus.mjs verifies these boundaries in both browser engines, including physical edits and document replacement.

The installed three-origin flow now also completes successfully after its one exact native application POST. Independent completion proof binds the actual submitted frame, task, run, action sequence, fresh document and success receipt. The frame is refreshed after the completion evaluator waits; a changed or missing frame cannot preserve success. test/completion-iframe-submit.mjs covers those receipt boundaries in both builds.

These controlled applications do not establish support for every third-party editor, sandbox, closed shadow tree, or canvas. contenteditable="plaintext-only" can sanitize native insertion differently; an altered settled value is never accepted as exact. It is reported as an unverified write with a note (a failure with text-write debt under Settings → Strict checks; see docs/rich-text-input.md). The saved-state assertions cover the production routes they exercise without claiming live authenticated service verification.