Commit Detail
Commit 8e4f3ed
JSRPC: Allow passing plain objects and Proxies to `new RpcStub`. Before this, you could not pass in a `Proxy` that mimicked `RpcTarget`, because this would not pass the native type check, because the `Proxy` is not actually an instance of `RpcTarget` no matter what the prototype chain says. But since `RpcTarget` is only being used as a marker, and we don't actually need to access the underlying C++ `JsRpcTarget` object, it makes sense to allow Proxies here. So, we implement our own type check based on the prototype chain. Additionally, this change permits an `RpcStub` to be created from a plain object. This is a new feature, but I think it makes sense as a way to force an object to be passed by stub rather than by value. Previously, we exposed similar functionality when you wrapped a plain object in a `Proxy`, but (per the comment in this commit) in retrospect that seems like the wrong way to do it.
Files changed
3 files changed~3 modified