Skip to content

Commit 65c4b47

Browse files
committed
browser: handle wait with unstarted env
1 parent 5f5e01a commit 65c4b47

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/browser/browser.zig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,10 @@ pub const Page = struct {
204204
try_catch.init(self.session.env);
205205
defer try_catch.deinit();
206206

207-
self.session.env.wait() catch {
207+
self.session.env.wait() catch |err| {
208+
// the js env could not be started if the document wasn't an HTML.
209+
if (err == error.EnvNotStarted) return;
210+
208211
const alloc = self.arena.allocator();
209212
if (try try_catch.err(alloc, self.session.env)) |msg| {
210213
defer alloc.free(msg);

0 commit comments

Comments
 (0)