feat: support for --remote-debugging-pipe transport#440
feat: support for --remote-debugging-pipe transport#440flotwig wants to merge 2 commits intocyrus-and:masterfrom
Conversation
| @@ -0,0 +1,87 @@ | |||
| 'use strict'; | |||
|
|
|||
| // Adapted from https://github.com/puppeteer/puppeteer/blob/7a2a41f2087b07e8ef1feaf3881bdcc3fd4922ca/src/PipeTransport.js | |||
There was a problem hiding this comment.
if this is objectionable for some reason, this can be rewritten from scratch, it's not too complicated
| // establish the WebSocket connection and start processing user commands | ||
| _connectToWebSocket() { | ||
| _createStdioWrapper() { | ||
| const stdio = new StdioWrapper(this.process.stdio[3], this.process.stdio[4]); |
There was a problem hiding this comment.
i also considered having the user pass the writeStream and readStream directly, but figured that there is not a use case for it
2a84361 to
baad1bd
Compare
Yeah, I still don't see why we should need this. The argument that it is simpler is a weak one IMHO since the WebSocket approach is already implemented and well tested, and on the consumer side is just regular exception handling, which BTW you can't never avoid. What is the real advantage here? The only thing I can think of is that by using the pipe transport you can provide isolation from other users, meaning that only the user that started Chrome can access the CDP, while with the WebSocket approach anyone reaching the endpoint can do that. But this something that can be easily worked around, if really needed, with containerisation. |
Well, for one, using stdio lets you isolate CDP without containerization. It also avoids the need for either (1) detecting the port Chrome chooses with Additionally, I believe Playwright only exposes the CDP implementation in WebKit via stdio, not via port. So this PR is required to use this library with Playwright's patched binaries. I think stdio transport merits adding, even if you don't think it's the best way to do things, because it's part of CDP as implemented in Chrome. IMO, But if you feel differently, that |
62bd9f8 to
21e01d6
Compare
|
Is this PR still alive? |
|
@Kle0s the changes in this PR work correctly if you'd like to use my fork, but my impression is that @cyrus-and doesn't wish to merge them upstream due to a perceived lack of benefit. |
|
@flotwig That's why I also raised another reason to support it - the extension installation in runtime seems to require it according to https://peter.sh/experiments/chromium-command-line-switches/#enable-unsafe-extension-debugging |
feat: Integrate stdio transport from upstream PR cyrus-and#440 (--remote-debugging-pipe)
Closes #381
@cyrus-and I see the conversation in #381 where you expressed that you don't believe
pipesupport is necessary. IMO, using--remote-debugging-pipeis simpler since you don't need to establish a TCP connection or implement network error handling, so here is a patch that enables a user to pass aprocessoption to use stdio instead of websockets.Passing
processalso setslocalto true since there may not be a TCP port listening.Thoughts?
Pre-merge checklist:
P.S. this provides some motivation for #439 - since there is no default target when using the stdio transport