Title: [219723] trunk/Source/WebKit
- Revision
- 219723
- Author
- [email protected]
- Date
- 2017-07-21 03:22:25 -0700 (Fri, 21 Jul 2017)
Log Message
Web Automation: implicit navigations don't cause browsing context switch
https://bugs.webkit.org/show_bug.cgi?id=174633
<rdar://problem/33387797>
Reviewed by Brian Burg.
When a new page load replaces the current frameset, for example when a link in the current browser context has a
_top target, there's no explicit context switch, so the web driver doesn't know that the current browsing
context is no longer valid. Following commands will still be using the previous frame as the current browsing
context, but they don't fail with no such frame because the frame is still alive in the page cache and
referenced in the internal maps used in both UI and web processes. This causes test
testShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargetedPage to fail, since it expects a no such
frame exception. When a new page navigation happens we can simply remove references to frames from
m_handleWebFrameMap in WebAutomationSession, because any existing frame reference in the map should be for a
previous page. With this, before the next command is executed, waitForNavigationToComplete will be called and it
will fail with no such frame, condition that is handled to switch to the top level browser context. The test
still fails, because the find element command is called with the top level browsing context, returning no such
element, instead of no such frame. This is consistent with Chrome.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::navigationOccurredForFrame): Clear the m_handleWebFrameMap when a new page load
finished.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (219722 => 219723)
--- trunk/Source/WebKit/ChangeLog 2017-07-21 09:50:49 UTC (rev 219722)
+++ trunk/Source/WebKit/ChangeLog 2017-07-21 10:22:25 UTC (rev 219723)
@@ -1,5 +1,30 @@
2017-07-21 Carlos Garcia Campos <[email protected]>
+ Web Automation: implicit navigations don't cause browsing context switch
+ https://bugs.webkit.org/show_bug.cgi?id=174633
+ <rdar://problem/33387797>
+
+ Reviewed by Brian Burg.
+
+ When a new page load replaces the current frameset, for example when a link in the current browser context has a
+ _top target, there's no explicit context switch, so the web driver doesn't know that the current browsing
+ context is no longer valid. Following commands will still be using the previous frame as the current browsing
+ context, but they don't fail with no such frame because the frame is still alive in the page cache and
+ referenced in the internal maps used in both UI and web processes. This causes test
+ testShouldFocusOnTheReplacementWhenAFrameFollowsALinkToA_TopTargetedPage to fail, since it expects a no such
+ frame exception. When a new page navigation happens we can simply remove references to frames from
+ m_handleWebFrameMap in WebAutomationSession, because any existing frame reference in the map should be for a
+ previous page. With this, before the next command is executed, waitForNavigationToComplete will be called and it
+ will fail with no such frame, condition that is handled to switch to the top level browser context. The test
+ still fails, because the find element command is called with the top level browsing context, returning no such
+ element, instead of no such frame. This is consistent with Chrome.
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::navigationOccurredForFrame): Clear the m_handleWebFrameMap when a new page load
+ finished.
+
+2017-07-21 Carlos Garcia Campos <[email protected]>
+
WebDriver: wait until navigation is complete before running new commands and after a click
https://bugs.webkit.org/show_bug.cgi?id=174670
Modified: trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp (219722 => 219723)
--- trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2017-07-21 09:50:49 UTC (rev 219722)
+++ trunk/Source/WebKit/UIProcess/Automation/WebAutomationSession.cpp 2017-07-21 10:22:25 UTC (rev 219723)
@@ -464,6 +464,9 @@
void WebAutomationSession::navigationOccurredForFrame(const WebFrameProxy& frame)
{
if (frame.isMainFrame()) {
+ // New page loaded, clear frame handles previously cached.
+ m_handleWebFrameMap.clear();
+ m_webFrameHandleMap.clear();
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(frame.page()->pageID()))
callback->sendSuccess(InspectorObject::create());
} else {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes