Fix exec context adoption #5084
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
Having looked at how Playwright works through adoption, I've realised that it only adopts when:
utilityWorld
.I've made the change to ensure that adoption only occurs when the handle is part of the current frame's
utilityWorld
exec context.Why?
While working on #5032, the current implementation is causing an issue whereby it is trying to adopt a handle from a nested frame to the page's frame (different origin), which isn't possible and is preventing APIs from working when using
locators
iniframe
s.Adoption only works when adopting between
mainWorld
andutilityWorld
from within the same frame. Each frame has these two execution contexts. We cannot adopt elements/handles from one frame to another, and there should be no reason to do so.Checklist
make check
) and all pass.Checklist: Documentation (only for k6 maintainers and if relevant)
Please do not merge this PR until the following items are filled out.
Related PR(s)/Issue(s)
Linked to, but doesn't close: #5085