playwright-community / playwright-go

Playwright for Go a browser automation library to control Chromium, Firefox and WebKit with a single API.
https://playwright-community.github.io/playwright-go/
MIT License
2.25k stars 163 forks source link

[Bug]: ExposeBinding in page.go risks a concurrent map write #475

Closed sam-ulrich1 closed 4 months ago

sam-ulrich1 commented 4 months ago

Environments

Bug description There is risk of concurrent map writes in the bindings map of the page.go file. The API caller can handle this by syncing the calls to page.go API functions but it would seems simpler to implement a sync.Map in the file.

To Reproduce Create a new Page and call ExposeBinding concurrently from multiple threads

Additional context I understand you may take the position of "this is user error" with that said just consider that it is a small change to increase the reliability of the Page instance in a highly concurrent programming langauge