Skip to content

fix: resolve several issues in message router#348

Merged
wravery merged 4 commits intotauri-apps:devfrom
tasuren:message-router-patch
Feb 16, 2026
Merged

fix: resolve several issues in message router#348
wravery merged 4 commits intotauri-apps:devfrom
tasuren:message-router-patch

Conversation

@tasuren
Copy link
Contributor

@tasuren tasuren commented Feb 3, 2026

Summary

This Pull Request addresses critical issues in the Message Router component to align its behavior with the original CEF C++ implementation. These fixes prevent application panics during startup and ensure correct data type mapping for IPC responses.

Linked Issues

Changes

  1. Added missing early returns in BrowserSideRouter and BrowserInfoMap

  2. Fixed response type mapping in RendererSideRouter

    • Updated execute_success_callback to return MessagePayload::String as a V8 string instead of an ArrayBuffer.
    • This ensures JavaScript's onSuccess callback receives a proper string, matching standard CEF behavior.
    • Reference: cef_message_router.cc#L1034-L1057

Verification

Verified using a port of the official CEF message_router example: tasuren/cef-rs-message-router

  • Before: The application panics on startup, or (if forced to run) returns [object ArrayBuffer] to JavaScript.
  • After: The application initializes correctly and JavaScript receives string responses as expected.

Ensures behavior matches the original CEF C++ implementation by adding
early returns when maps are empty or entries are missing. This fixes
a panic in `BrowserSideRouter::find_browser_all`.

Reference C++ implementation:
- BrowserSideRouter: https://github.com/chromiumembedded/cef/blob/5f93c2b090d19659451de4dfe44896ad7dbfd832/libcef_dll/wrapper/cef_message_router.cc#L535-L537
- BrowserInfoMap: https://github.com/chromiumembedded/cef/blob/5f93c2b090d19659451de4dfe44896ad7dbfd832/libcef_dll/wrapper/cef_browser_info_map.h#L159-L167
…m RendererSideRouter

When sending a success response back to JavaScript, MessagePayload::String
should be created as a V8 string to match the original CEF behavior.
This commit fixes the issue where MessagePayload::String was incorrectly
handled as binary data.
jdboyer added a commit to jdboyer/cef-rs that referenced this pull request Feb 15, 2026
Update code snippet for Bug 2 to match the actual implementation from
PR tauri-apps#348 (tasuren/cef-rs:message-router-patch).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@wravery wravery merged commit 18d6458 into tauri-apps:dev Feb 16, 2026
5 checks passed
@wravery
Copy link
Contributor

wravery commented Feb 16, 2026

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants