Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Support Symbol.asyncDispose method (the using keyword) in addition to close() #27141

Closed
dtinth opened this issue Sep 17, 2023 · 1 comment · Fixed by #27766
Closed
Assignees
Labels

Comments

@dtinth
Copy link

dtinth commented Sep 17, 2023

This allows us to write this:

await using context = await browser.newContext()
// Code

which is more concise than:

const context = await browser.newContext()
try {
  // Code
} finally {
  await context.close();
}
@mxschmitt
Copy link
Member

There scope for this issue is to:

a) support it on all our objects which have a close() method.
b) Make it possible to use the using keyword inside our test runner.

If I forgot something, let us know!

pavelfeldman added a commit that referenced this issue Oct 24, 2023
This change assumes that the user has Node 18 with Symbol.dispose
available.

Fixes #27141
Germandrummer92 pushed a commit to OctoMind-dev/playwright that referenced this issue Oct 27, 2023
This change assumes that the user has Node 18 with Symbol.dispose
available.

Fixes microsoft#27141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants