Skip to content

Commit 853b7f8

Browse files
committed
Ensure extra_socket can't happen when exit_when_done == true
exit_when_done is pretty much a sneaky way to get CDP knowledge into the page. exit_when_done == true means "this isn't a CDP session". extra_socket is another sneaky weay to get CDP knowledge into the page. When we get an `extra_socket` message it means "Return control to the CDP server". Therefore it should be impossible to get an `extra_socket` message (return to CDP) when `exit_when_done == true` (this isn't a CDP session).
1 parent 8a2efde commit 853b7f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/browser/page.zig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ pub const Page = struct {
312312
// mode with an extra socket. Either way, we're waiting
313313
// for http traffic
314314
if (try http_client.tick(ms_remaining) == .extra_socket) {
315+
// exit_when_done is explicitly set when there isn't
316+
// an extra socket, so it should not be possibl to
317+
// get an extra_socket message when exit_when_done
318+
// is true.
319+
std.debug.assert(exit_when_done == false);
320+
315321
// data on a socket we aren't handling, return to caller
316322
return .extra_socket;
317323
}

0 commit comments

Comments
 (0)