From be2ae30150f8aff8ff9679ba3ef41b2daa884a01 Mon Sep 17 00:00:00 2001 From: Kenton Varda Date: Mon, 26 Feb 2024 08:17:58 -0600 Subject: [PATCH] fixup! JSRPC: Support pipelined access to properties of RPC targets. --- src/workerd/api/http.c++ | 2 ++ src/workerd/api/worker-rpc.c++ | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/workerd/api/http.c++ b/src/workerd/api/http.c++ index d26ebdfbcced..b0e74b60be5a 100644 --- a/src/workerd/api/http.c++ +++ b/src/workerd/api/http.c++ @@ -1897,6 +1897,8 @@ rpc::JsRpcTarget::Client Fetcher::getClientForOneCall( ioContext.addTask(worker->customEvent(kj::mv(event)).attach(kj::mv(worker)) .then([](auto&&) {}, [](kj::Exception&&) {})); + // (Don't extend `path` because we're the root.) + return result; } diff --git a/src/workerd/api/worker-rpc.c++ b/src/workerd/api/worker-rpc.c++ index 59c773f021b5..2f5b709e8b68 100644 --- a/src/workerd/api/worker-rpc.c++ +++ b/src/workerd/api/worker-rpc.c++ @@ -179,6 +179,8 @@ JsRpcProperty::PromiseAndPipleine JsRpcProperty::callImpl(jsg::Lock& js, FillOpF // methods off their source object, even if we change implementations to something where that's // less convenient. + // `path` will be filled in with the path of property names leading from the stub represented by + // `client` to the specific property / method that we're trying to invoke. kj::Vector path; auto client = parent->getClientForOneCall(js, path); @@ -313,6 +315,7 @@ kj::Maybe> JsRpcPromise::getProperty(jsg::Lock& js, kj:: rpc::JsRpcTarget::Client JsRpcStub::getClientForOneCall( jsg::Lock& js, kj::Vector& path) { + // (Don't extend `path` because we're the root.) return *capnpClient; }