Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,10 @@ export class Page extends EventTarget {
if (index > -1) {
this.#browser.pages.splice(index, 1);
}
await this.#celestial.close();
return;
}

await this.#celestial.close();

throw new Error(`Page has already been closed or doesn't exist (${res})`);
}

Expand Down
11 changes: 11 additions & 0 deletions tests/leak_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { launch } from "../mod.ts";

const browser = await launch();

addEventListener("unload", async () => {
await browser.close();
});

Deno.test("Opening and closing a page without closing the browser isn't leak", async () => {
await using _ = await browser.newPage();
});