Repository navigation
fix(cef): report page loads only for the webview's own page - #4
Merged
Conversation
TauriCefLoadHandler fired Tauri's on_page_load for two kinds of load that are not the webview's page: - The INITIAL_LOAD_URL placeholder every browser is created at before its real navigation. The display and request handlers already skip it. - Browsers the webview does not own. CEF routes a DevTools window opened with F12 or Inspect in a Chrome style browser through the opener's client; every other handler on the client checks has_browser_id. Plugins that read on_page_load saw a data: URL, or a DevTools page, as the webview's current page. Both on_load_start and on_load_end now require the main frame of the owned browser and skip the placeholder. The frame observer still sees every commit.
peterchinman
merged commit Nov 25, 2026
30e735a
into
macro-cef-desktop-capture
12 of 18 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
TauriCefLoadHandler::on_load_startandon_load_endfire Tauri'son_page_loadfor loads that are not the webview's own page, unlike every other handler onTauriCefBrowserClient:INITIAL_LOAD_URLplaceholder. Every browser is created at thisdata:page before its real navigation (webview.rs).display.rsandrequest_handler.rsskip it; the load handler did not, so plugins saw aStarted/Finishedpair for adata:URL whose origin serializes to"null". This is the bug that is live on macOS.ChromeBrowserDelegate::CreateDevToolsBrowser), so itsdevtools://page reachedon_page_loadas the webview's page. The display, command, life span and IPC paths already checkhas_browser_id. On macOS this does not happen today: browsers are Alloy style there, which has no F12 accelerator and no Inspect entry, andshow_dev_tools(None, ...)creates the DevTools browser without a client. The check is kept for Windows and Linux and to match the other handlers.What
TauriCefLoadHandlertakes the webview'sFrameNavigationState.INITIAL_LOAD_URL, through onereports_page_loadpredicate.on_load_startstill emitsDocumentCommittedfor every commit before the check, so the frame observer is unchanged and the browser identity is bound before it is read.Stacked on
macro-cef-desktop-capture(macro-cefplus 4b8a46f, the commit Macro pins), so this diff is only the fix.