There are several issues to fix when switching to a browser context: 1- The spec has changed and now we should always keep the current parent browsing context. 2- The spec says we should focus the new frame after switching to a frame or parent frame, but we are just resolving the frame and updating the handle internally. 3- We are keeping stale frame handles and ids in the automation session, they should be removed when frames are destroyed. 4- We are clearing all frame references in the automation session when a navigation happens in any main frame. We should only clear the frames of the page that completed the navigation. All theses cases are covered by new tests added to imported/w3c/webdriver/tests/switch_to_parent_frame/
Created attachment 410315 [details] Patch
Comment on attachment 410315 [details] Patch r=me, thanks!
Committed r267918: <https://trac.webkit.org/changeset/267918>
<rdar://problem/69908860>