CEF pitfalls
Things CEF, Chromium and the cef crate do that cost time to find out. Add to this page when you hit one, next to the area it belongs to.
Views and windows
- A preferred size with a 0 width or height counts as unset. The view then takes its large default and squeezes the page out of the layout. Always return a non-empty size (
window::bar_size). - Dropping the last reference to a
BrowserViewcloses its browser synchronously, which re-enters our handlers. The shell's state is a UI-threadRefCell, so never drop CEF objects, or call CEF methods that fire callbacks, while it's borrowed (shell::with). - The
cefcrate answers 0 forcan_resize,can_maximizeandcan_minimizeunless the delegate implements them, where CEF's own default is 1. Windows then ask for a fixed size and tiling window managers float them. Both window delegates return 1. - A Chrome-style
BrowserViewdoesn't exist until it's added to a window, so callingset_focusableon it first crashes. A Chrome-style window takes one Chrome-style view, which must be added before any Alloy view (the first view sets the window's profile). Popups must match their opener's style. Seewindow::create_callandtabs::add_call_view. - Overlay views are opaque and only as big as their bounds. Rounded corners show square ones behind them, and there's no dimming the page behind a box.
- A hidden view pauses
requestAnimationFrame. A page that measures itself before it's shown must do it synchronously (ui/float.html). - A panel lays its children out with a fill layout unless told otherwise, which gives every visible child the panel's whole bounds on each layout pass. Placing children by hand fights it: splits once had every pane's page resized to the full page area and back several times per tab switch, and pages went blank on a GPU. Each pane is a panel of its own, and each split a panel whose box layout sizes its panes and the handles between them (
panes::arrange). - A
BrowserViewcan move to another parent in the same window and keeps its page (remove it, then add it), which is how a tab moves between panes. - A window doesn't finish closing while any browser in it is open, overlay views included. Floats and panels are closed in the window's
can_close(float::close_window,panel::close_window), or:quithangs.
Keys and input
- The command line is a Rust-owned buffer; keys are consumed in
OnPreKeyEvent, so UI pages never need keyboard focus. - Chromium ignores input to a page while it shows a JavaScript dialog, so prompt keys go through the status bar's browser, which gets focus for the duration.
- Focus riptide gives a tab is reported to
FocusHandler::on_got_focusjust like a click, and so is focus Chromium moves by itself when the focused view is hidden. Acting on those as clicks once made two panes hand focus back and forth for good.panes::focus_viewnotes each request so its report is passed over, andshow_current_infocuses the new tab before hiding the old one. View::has_focuson a call window's Chrome-style view crashes (SIGSEGV).- A new tab can miss focus requested before its browser existed;
on_after_createdfocuses it again. send_key_eventto a hidden tab is dropped (keys go to the window's focused view), and DevTools'Input.dispatchKeyEventreports success without reaching the page in windowed browsers. The first key a page ever gets starts something that drops keys for about 400 ms (client::send_when_ready).- Under Xvfb, a key sent just as a page finishes loading could be lost below Views (about 1 in 5 in October 2026, for tabs opened from a typed
:open -t). It didn't reproduce in 100 tries on 2026-10-23, so the smoke test no longer pauses for it; the e2e harness still waits two animation frames after each load. - Middle-clicks and Ctrl+clicks come through
OnOpenURLFromTab, not popups, and Alloy loads them in the same tab if it isn't handled. - On X11, reading the clipboard on the UI thread hangs for 4 s when a page copied the text: Chromium answers for its pages' clipboard on that same thread. Commands that need it (
rl-paste,{clipboard},{primary}) stop withEffect::ReadClipboard, andclipboard::read_then_runreads on another thread before running them. - CEF picks X11 even on a Wayland desktop: without
--ozone-platform=waylandit runs on Xwayland, and with noDISPLAYit exits ("Missing X server"). As a native Wayland client, the X11 clipboard isn't the one Wayland apps paste from, soarboardis built withwayland-data-controland talks to the compositor directly where it supports the protocol (wlroots compositors, KDE), falling back to X11 (GNOME). - Ctrl+wheel over a bar zooms every
riptide://uipage (Chromium saves zoom per host). The bar pages refuse it, andon_load_endresets a saved zoom for non-tab roles.
Pages and navigation
- Loading a
data:error page fromOnLoadErroradds a history entry, sobackloops into the error. Draw into Chromium's own error document fromOnLoadEndinstead. BrowserHost::Findwithfind_next = falsenever activates or scrolls to a match. Every call passestrue; a repeated search first callsStopFinding.- CEF passes a browser's original
extra_infotoon_browser_createdagain on reload, which would undo a:greasemonkey-reload. Script lists carry a generation number. Page.addScriptToEvaluateOnNewDocumentsilently does nothing withoutPage.enablefirst (adblock::before_navigation).- DevTools refuses a command whose
idis still pending ("Duplicateidin protocol request"), so every message needs its own id (adblock::send). - A frame from another site paused by
Target.setAutoAttach(waitForDebuggerOnStart) never starts ifRuntime.runIfWaitingForDebuggeris sent from inside theTarget.attachedToTargetcallback, while Chromium is still pausing it. Answer from a posted task. ItstargetInfo.urlis empty then too;Page.frameStartedNavigatingon its parent's session has it (adblock::frame_attached). waitForDebuggerOnStartpauses a page's new dedicated workers even when the auto-attachfilterleaves workers out, and nothing resumes them. Google Meet's camera pipeline runs in workers and hung on "Camera starting". The filter includesworker, and each one is resumed at once (adblock::frame_attached).- A frame from the page's own site shares its process and target, so
Target.setAutoAttachnever pauses it. Registering its host's script whenPage.frameStartedNavigatingarrives still comes before its document is made (adblock::same_process_frame). Notificationis defined after the context is created, so the renderer's stand-in takes its place on the first microtask,DOMContentLoadedandload.- A page starting to load clears every status message, so startup messages wait for the first load (
shell::show_message_after_load). - A stored default for Chromium's
PROTOCOL_HANDLERScontent setting fails aCHECKwhen a private window's profile inherits it.
Profiles, preferences and services
- Chromium names its profile folder
Defaultwhatevercache_pathsays, socache_pathpoints there. - Services start within 100 ms, so privacy preferences are written into
Local StateandDefault/Preferencesbefore CEF starts.SetPreferencefromon_context_initializedis too late, and through thecefcrate it fails silently unless the error out-string is non-empty (an emptyCefStringis passed as NULL). - Feature names in
libcef.sostrings carry akprefix that Chromium strips (kAimEnabled→AimEnabled). - Chrome's login prompt swallows HTTP auth unless
--disable-chrome-login-promptis set (cef#3603). GetAuthCredentialsruns on the IO thread; the prompt is posted to the UI thread.- Chromium saves permission answers per site, but camera and microphone requests go through a separate API that isn't saved; riptide keeps its own per-site answers. Chromium also holds non-media permission prompts from hidden tabs until they show.
The cef crate
CefStringList::clonecopies the opaque C struct, so iterating a clone is always empty; read lists through the C API.- An empty
CefStringis passed to C as NULL.
Extensions
- Manifest V2 is gone in Chromium 154: MV2 extensions silently don't load.
- Alloy tabs are invisible to
chrome.tabs.query, though messages reach them (sender.tabis set). Popups and keyboard commands that act on "the active tab" can't find riptide's tabs. - With a
declarativeNetRequestextension, a page opened during startup may never start loading;extensions::after_startupreloads such tabs. - Letting Chromium finish a
.crxdownload hands it to its own installer, which deletes the file. riptide cancels the download and fetches the URL itself.
Crashes
chrome://crashwith the sandbox on leaves the tab loading instead of crashing it; the test channel'sCrashTababorts the renderer instead.- Crashpad reads
crash_reporter.cfgnext to the executable, and keeps dumps with no size or age limit on Linux (rt_storage::crash_reports::dumpsprunes them). - A panic that reaches CEF's C callers panics again ("cannot unwind"); only the first panic on a thread is reported.
Building and releasing
- CEF's
libcef.socarries debug info (1.4 GB); stripping it gives 260 MB. - Inside an AppImage,
chrome-sandboxcan't be setuid, so the sandbox needs user namespaces there. - A tag pushed with a workflow's own token doesn't trigger other workflows, and GitHub Actions can't bypass a ruleset on a personal repository; see Releasing.
- mdBook's smart punctuation turns
--forceinto an en dash, so it's off.
Testing
- Unix socket paths must fit in about 108 bytes, so the e2e harness uses a short
XDG_RUNTIME_DIR. - CEF's zygote leaves the process group; the harness also stops the helpers that carry its
--user-data-dir. cargo test -p rt-e2edrives the builttarget/debug/riptideand doesn't rebuild it: runcargo buildfirst, or./task e2e.