Repository: tauri-apps/tauri
File: core/tauri/src/ipc/protocol.rs (Rust)

Code before:
              ) {
                let eval_js = match js {
                  Ok(js) => js,
                  Err(e) => format_callback(error, &e.to_string())
                    .expect("unable to serialize response error string to json"),
                };

                let _ = window.eval(&eval_js);
              }

              match &response {
                InvokeResponse::Ok(InvokeBody::Json(v)) => {
                  if !(cfg!(target_os = "macos") || cfg!(target_os = "ios"))
                    && matches!(v, JsonValue::Object(_) | JsonValue::Array(_))
                  {
                    let _ = Channel::from_ipc(window.clone(), callback).send(v);
                  } else {
                    responder_eval(
                      &window,
                      format_callback_result(Result::<_, ()>::Ok(v), callback, error),
                      error,
                    )
                  }
                }
                InvokeResponse::Ok(InvokeBody::Raw(v)) => {
                  if (cfg!(target_os = "macos") || cfg!(target_os = "ios")) {
                    responder_eval(
                      &window,
                      format_callback_result(Result::<_, ()>::Ok(v), callback, error),
                      error,
                    );
                  } else {
                    let _ =
                      Channel::from_ipc(window.clone(), callback).send(InvokeBody::Raw(v.clone()));
                  }
                }
                InvokeResponse::Err(e) => responder_eval(
                  &window,
                  format_callback_result(Result::<(), _>::Err(&e.0), callback, error),
                  error,
                ),
              }
            }
          }),
        );
      }
      Err(e) => {
        let _ = window.eval(&format!(
          r#"console.error({})"#,
          serde_json::Value::String(e.to_string())
        ));

Review comment (suggestion):
```suggestion
                  if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
```

Code after:
              ) {
                let eval_js = match js {
                  Ok(js) => js,
                  Err(e) => format_callback(error, &e.to_string())
                    .expect("unable to serialize response error string to json"),
                };

                let _ = window.eval(&eval_js);
              }

              match &response {
                InvokeResponse::Ok(InvokeBody::Json(v)) => {
                  if !(cfg!(target_os = "macos") || cfg!(target_os = "ios"))
                    && matches!(v, JsonValue::Object(_) | JsonValue::Array(_))
                  {
                    let _ = Channel::from_ipc(window.clone(), callback).send(v);
                  } else {
                    responder_eval(
                      &window,
                      format_callback_result(Result::<_, ()>::Ok(v), callback, error),
                      error,
                    )
                  }
                }
                InvokeResponse::Ok(InvokeBody::Raw(v)) => {
                  if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
                    responder_eval(
                      &window,
                      format_callback_result(Result::<_, ()>::Ok(v), callback, error),
                      error,
                    );
                  } else {
                    let _ =
                      Channel::from_ipc(window.clone(), callback).send(InvokeBody::Raw(v.clone()));
                  }
                }
                InvokeResponse::Err(e) => responder_eval(
                  &window,
                  format_callback_result(Result::<(), _>::Err(&e.0), callback, error),
                  error,
                ),
              }
            }
          }),
        );
      }
      Err(e) => {
        let _ = window.eval(&format!(
          r#"console.error({})"#,
          serde_json::Value::String(e.to_string())
        ));