Title: [233600] trunk/Source/WebKit
- Revision
- 233600
- Author
- [email protected]
- Date
- 2018-07-06 16:11:02 -0700 (Fri, 06 Jul 2018)
Log Message
WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
https://bugs.webkit.org/show_bug.cgi?id=187418
<rdar://problem/41909520>
Reviewed by Timothy Hatcher.
Per the W3C specification, “User prompts that are spawned from beforeunload event handlers,
are dismissed implicitly upon navigation or close window, regardless of the defined user prompt handler.”
This behavior differs from legacy Selenium behavior where (as in the test) it's expected that
a test can accept or dismiss a beforeunload alert manually.
Prior to this patch, beforeunload alerts hang because Safari uses a nested modal run loop, which does
not process incoming Automation messages, so there was no way for the test to manually dismiss
the alert.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
Don't show beforeunload alerts for pages being controlled by automation.
Modified Paths
Diff
Modified: trunk/Source/WebKit/ChangeLog (233599 => 233600)
--- trunk/Source/WebKit/ChangeLog 2018-07-06 22:54:38 UTC (rev 233599)
+++ trunk/Source/WebKit/ChangeLog 2018-07-06 23:11:02 UTC (rev 233600)
@@ -1,3 +1,26 @@
+2018-07-06 Brian Burg <[email protected]>
+
+ WebDriver: hang in Selenium test alerts_tests.py::testShouldHandleAlertOnPageBeforeUnload
+ https://bugs.webkit.org/show_bug.cgi?id=187418
+ <rdar://problem/41909520>
+
+ Reviewed by Timothy Hatcher.
+
+ Per the W3C specification, “User prompts that are spawned from beforeunload event handlers,
+ are dismissed implicitly upon navigation or close window, regardless of the defined user prompt handler.”
+
+ This behavior differs from legacy Selenium behavior where (as in the test) it's expected that
+ a test can accept or dismiss a beforeunload alert manually.
+
+ Prior to this patch, beforeunload alerts hang because Safari uses a nested modal run loop, which does
+ not process incoming Automation messages, so there was no way for the test to manually dismiss
+ the alert.
+
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::runBeforeUnloadConfirmPanel):
+ Don't show beforeunload alerts for pages being controlled by automation.
+
+
2018-07-06 Chris Dumez <[email protected]>
ASSERTION FAILED: contextConnection under WebCore::SWServer::terminateWorkerInternal
Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (233599 => 233600)
--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-07-06 22:54:38 UTC (rev 233599)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp 2018-07-06 23:11:02 UTC (rev 233600)
@@ -4523,14 +4523,18 @@
WebFrameProxy* frame = m_process->webFrame(frameID);
MESSAGE_CHECK(frame);
- // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
- m_process->responsivenessTimer().stop();
-
+ // Per §18 User Prompts in the WebDriver spec, "User prompts that are spawned from beforeunload
+ // event handlers, are dismissed implicitly upon navigation or close window, regardless of the
+ // defined user prompt handler." So, always allow the unload to proceed if the page is being automated.
if (m_controlledByAutomation) {
- if (auto* automationSession = process().processPool().automationSession())
- automationSession->willShowJavaScriptDialog(*this);
+ if (auto* automationSession = process().processPool().automationSession()) {
+ reply(true);
+ return;
+ }
}
+ // Since runBeforeUnloadConfirmPanel() can spin a nested run loop we need to turn off the responsiveness timer.
+ m_process->responsivenessTimer().stop();
m_uiClient->runBeforeUnloadConfirmPanel(this, message, frame, securityOrigin, WTFMove(reply));
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes