Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cef/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- port missing early returns in BrowserSideRouter and BrowserInfoMap to prevent panics during startup
- return string responses as V8 strings instead of ArrayBuffer from RendererSideRouter

## [144.0.1+144.0.6](https://github.com/tauri-apps/cef-rs/compare/cef-v144.0.0+144.0.6...cef-v144.0.1+144.0.6) - 2026-01-22

### Other
Expand Down
11 changes: 7 additions & 4 deletions cef/src/wrapper/browser_info_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ impl<K: Copy + Ord, V: Clone> BrowserInfoMap<K, V> {
/// Find all objects associated with the specified browser. If any objects are
/// removed using the Visitor the caller is responsible for destroying them.
pub fn find_browser_all(&mut self, browser_id: i32, visitor: &dyn BrowserInfoMapVisitor<K, V>) {
let info_map = self
.map
.get_mut(&browser_id)
.expect("missing browser info map");
if self.map.is_empty() {
return;
}

let Some(info_map) = self.map.get_mut(&browser_id) else {
return;
};

let mut removed = vec![];
let keys: Vec<_> = info_map.keys().copied().collect();
Expand Down
49 changes: 30 additions & 19 deletions cef/src/wrapper/message_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,10 @@ impl BrowserSideRouter {
return;
};

if browser_query_info_map.is_empty() {
return;
}

struct Visitor {
router: Arc<BrowserSideRouter>,
handler_id: Option<HandlerId>,
Expand Down Expand Up @@ -1322,28 +1326,35 @@ impl RendererSideRouter {
let Some(mut context) = self.get_context_by_id(context_id) else {
return;
};
if context.enter() == 0 {
return;
}

let data = match &response {
mru::MessagePayload::Empty => &[],
mru::MessagePayload::String(s) => s.as_slice().unwrap_or(&[]),
mru::MessagePayload::Binary(b) => b.data(),
};
let value = match &response {
mru::MessagePayload::String(s) => v8_value_create_string(Some(&s.into())),
mru::MessagePayload::Empty | mru::MessagePayload::Binary(_) => {
let data = match &response {
mru::MessagePayload::Binary(b) => b.data(),
_ => &[],
};

#[cfg(feature = "sandbox")]
let value = v8_value_create_array_buffer_with_copy(data.as_ptr() as *mut u8, data.len());
#[cfg(not(feature = "sandbox"))]
let value = v8_value_create_array_buffer(
data.as_ptr() as *mut u8,
data.len(),
Some(&mut mru::BinaryValueArrayBufferReleaseCallback::new(
response,
)),
);
if context.enter() == 0 {
return;
}

context.exit();
#[cfg(feature = "sandbox")]
let value =
v8_value_create_array_buffer_with_copy(data.as_ptr() as *mut u8, data.len());
#[cfg(not(feature = "sandbox"))]
let value = v8_value_create_array_buffer(
data.as_ptr() as *mut u8,
data.len(),
Some(&mut mru::BinaryValueArrayBufferReleaseCallback::new(
response,
)),
);

context.exit();
value
}
};

success_callback.execute_function_with_context(Some(&mut context), None, Some(&[value]));
}
Expand Down