Skip to content

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant