-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore: builtins #35197
chore: builtins #35197
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather const { Map } = window.builtins
;
This comment has been minimized.
This comment has been minimized.
This introduces a "script to evaluate on new document" that saves certain builtin objects like `Map` into an unguessable global property. Later on, every injected script will try to use the saved builtins. The idea is to workaround pages that mess around with certain objects like `Set` or `Map` and break Playwright's injected code. All injected source files are now subject to an eslint rule that forces the use of `Builtins.Map` instead of `Map` or similar. Many utility functions got a `builtins` argument to be able to construct non-overridden builtins. Pros: - Playwright should work on a broader set of web pages. - Over time, we can cover more builtin classes/functions. Cons: - Passing around `builtins` object in the codebase. - Extra eslint rule. - A tiny but mandatory script evaluated on each page load.
Test results for "tests others"4 flaky21793 passed, 512 skipped Merge workflow run. |
Test results for "tests 1"2 flaky38839 passed, 809 skipped Merge workflow run. |
Test results for "tests 2"9 failed 113 flaky236883 passed, 9312 skipped Merge workflow run. |
This introduces a "script to evaluate on new document" that saves certain builtin objects like
Map
as an unlisted global property. Later on, every injected script will try to use the saved builtins.The idea is to workaround pages that mess around with certain objects like
Set
orMap
and break Playwright's injected code.All injected source files are now subject to an eslint rule that forces the use of
Builtins.Map
instead ofMap
or similar. Many utility functions got abuiltins
argument to be able to construct non-overridden builtins.Pros:
Cons:
builtins
object in the codebase.References #34443. References #34628.