### Preflight Checklist

- [X] I have read the [Contributing Guidelines](https://github.com/electron/electron/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [Code of Conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project adheres to.
- [X] I have searched the [issue tracker](https://www.github.com/electron/electron/issues) for a bug report that matches the one I want to file, without success.

### Electron Version

16.0.6

### What operating system are you using?

Windows

### Operating System Version

Win 10 Pro

### What arch are you using?

x64

### Last Known Working Electron version

_No response_

### Expected Behavior

```ipcRenderer.postMessage("test",{});``` should successfully post.

### Actual Behavior

`ipcRenderer.postMessage("test",{});` fails with error `TypeError: Invalid value for transfer`.

`ipcRenderer.postMessage("test",{},[]);` succeeds.

The transfer parameter is optional according to the [api docs](https://www.electronjs.org/docs/latest/api/ipc-renderer#ipcrendererpostmessagechannel-message-transfer). I would assume the docs are correct as this approximately matches the standard web postMessage.

### Testcase Gist URL

https://gist.github.com/Stinger-au/8394108f5f6754dad03dbbcfef84e3fe

### Additional Information

_No response_
shell/browser/api/electron_api_web_frame_main.cc
static base::NoDestructor<WebFrameMainIdMap> instance;
  return *instance;
}
WebFrameMain* WebFrameMain::FromFrameTreeNodeId(int frame_tree_node_id) {
  WebFrameMainIdMap& frame_map = GetWebFrameMainMap();
  auto iter = frame_map.find(frame_tree_node_id);
  auto* web_frame = iter == frame_map.end() ? nullptr : iter->second;
  return web_frame;
}
WebFrameMain* WebFrameMain::FromRenderFrameHost(content::RenderFrameHost* rfh) {
  return rfh ? FromFrameTreeNodeId(rfh->GetFrameTreeNodeId()) : nullptr;
}
gin::WrapperInfo WebFrameMain::kWrapperInfo = {gin::kEmbedderNativeGin};
WebFrameMain::WebFrameMain(content::RenderFrameHost* rfh)
    : frame_tree_node_id_(rfh->GetFrameTreeNodeId()), render_frame_(rfh) {
  GetWebFrameMainMap().emplace(frame_tree_node_id_, this);
}
WebFrameMain::~WebFrameMain() {
  Destroyed();
}
void WebFrameMain::Destroyed() {
  MarkRenderFrameDisposed();
  GetWebFrameMainMap().erase(frame_tree_node_id_);
  Unpin();
}
void WebFrameMain::MarkRenderFrameDisposed() {