<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198740] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198740">198740</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2016-03-28 08:57:49 -0700 (Mon, 28 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Automation: Add Automation protocol commands to handle JavaScript dialogs
https://bugs.webkit.org/show_bug.cgi?id=155888
rdar://problem/25360218
Reviewed by Brian Burg.
* UIProcess/API/APIAutomationSessionClient.h:
(API::AutomationSessionClient::isShowingJavaScriptDialogOnPage): Added.
(API::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage): Added.
(API::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage): Added.
(API::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage): Added.
(API::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage): Added.
* UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
* UIProcess/Automation/Automation.json: Added new commands.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::isShowingJavaScriptDialog): Added.
(WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog): Added.
(WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog): Added.
(WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog): Added.
(WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt): Added.
* UIProcess/Automation/WebAutomationSession.h:
* UIProcess/Cocoa/AutomationSessionClient.h:
* UIProcess/Cocoa/AutomationSessionClient.mm:
(WebKit::AutomationSessionClient::AutomationSessionClient): Added.
(WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage): Added.
(WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage): Added.
(WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage): Added.
(WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage): Added.
(WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage): Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIAPIAutomationSessionClienth">trunk/Source/WebKit2/UIProcess/API/APIAutomationSessionClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoa_WKAutomationSessionDelegateh">trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAutomationAutomationjson">trunk/Source/WebKit2/UIProcess/Automation/Automation.json</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAutomationWebAutomationSessioncpp">trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAutomationWebAutomationSessionh">trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaAutomationSessionClienth">trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaAutomationSessionClientmm">trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.mm</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2016-03-25 Timothy Hatcher <timothy@apple.com>
+
+ Web Automation: Add Automation protocol commands to handle JavaScript dialogs
+
+ https://bugs.webkit.org/show_bug.cgi?id=155888
+ rdar://problem/25360218
+
+ Reviewed by Brian Burg.
+
+ * UIProcess/API/APIAutomationSessionClient.h:
+ (API::AutomationSessionClient::isShowingJavaScriptDialogOnPage): Added.
+ (API::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage): Added.
+ (API::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage): Added.
+ (API::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage): Added.
+ (API::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage): Added.
+
+ * UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h:
+
+ * UIProcess/Automation/Automation.json: Added new commands.
+
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::isShowingJavaScriptDialog): Added.
+ (WebKit::WebAutomationSession::dismissCurrentJavaScriptDialog): Added.
+ (WebKit::WebAutomationSession::acceptCurrentJavaScriptDialog): Added.
+ (WebKit::WebAutomationSession::messageOfCurrentJavaScriptDialog): Added.
+ (WebKit::WebAutomationSession::setUserInputForCurrentJavaScriptPrompt): Added.
+ * UIProcess/Automation/WebAutomationSession.h:
+
+ * UIProcess/Cocoa/AutomationSessionClient.h:
+ * UIProcess/Cocoa/AutomationSessionClient.mm:
+ (WebKit::AutomationSessionClient::AutomationSessionClient): Added.
+ (WebKit::AutomationSessionClient::isShowingJavaScriptDialogOnPage): Added.
+ (WebKit::AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage): Added.
+ (WebKit::AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage): Added.
+ (WebKit::AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage): Added.
+ (WebKit::AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage): Added.
+
</ins><span class="cx"> 2016-03-24 Timothy Hatcher <timothy@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Automation: Add commands to compute layout of an element
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIAPIAutomationSessionClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/APIAutomationSessionClient.h (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/APIAutomationSessionClient.h        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/API/APIAutomationSessionClient.h        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -42,6 +42,11 @@
</span><span class="cx"> virtual String sessionIdentifier() const { return String(); }
</span><span class="cx"> virtual void didDisconnectFromRemote(WebKit::WebAutomationSession*) { }
</span><span class="cx"> virtual WebKit::WebPageProxy* didRequestNewWindow(WebKit::WebAutomationSession*) { return nullptr; }
</span><ins>+ virtual bool isShowingJavaScriptDialogOnPage(WebKit::WebAutomationSession*, WebKit::WebPageProxy*) { return false; }
+ virtual void dismissCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession*, WebKit::WebPageProxy*) { }
+ virtual void acceptCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession*, WebKit::WebPageProxy*) { }
+ virtual String messageOfCurrentJavaScriptDialogOnPage(WebKit::WebAutomationSession*, WebKit::WebPageProxy*) { return String(); }
+ virtual void setUserInputForCurrentJavaScriptPromptOnPage(WebKit::WebAutomationSession*, WebKit::WebPageProxy*, const String&) { }
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace API
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoa_WKAutomationSessionDelegateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/_WKAutomationSessionDelegate.h        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -36,6 +36,12 @@
</span><span class="cx"> @optional
</span><span class="cx"> - (WKPageRef)_automationSessionDidRequestNewWindow:(_WKAutomationSession *)automationSession;
</span><span class="cx"> - (void)_automationSessionDidDisconnectFromRemote:(_WKAutomationSession *)automationSession;
</span><ins>+
+- (BOOL)_automationSession:(_WKAutomationSession *)automationSession isShowingJavaScriptDialogOnPage:(WKPageRef)page;
+- (void)_automationSession:(_WKAutomationSession *)automationSession dismissCurrentJavaScriptDialogOnPage:(WKPageRef)page;
+- (void)_automationSession:(_WKAutomationSession *)automationSession acceptCurrentJavaScriptDialogOnPage:(WKPageRef)page;
+- (NSString *)_automationSession:(_WKAutomationSession *)automationSession messageOfCurrentJavaScriptDialogOnPage:(WKPageRef)page;
+- (void)_automationSession:(_WKAutomationSession *)automationSession setUserInput:(NSString *)value forCurrentJavaScriptDialogOnPage:(WKPageRef)page;
</ins><span class="cx"> @end
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationAutomationjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> "WindowNotFound",
</span><span class="cx"> "FrameNotFound",
</span><span class="cx"> "NodeNotFound",
</span><ins>+ "NoJavaScriptDialog",
</ins><span class="cx"> "NotImplemented",
</span><span class="cx"> "MissingParameter"
</span><span class="cx"> ]
</span><span class="lines">@@ -191,6 +192,48 @@
</span><span class="cx"> { "name": "rect", "$ref": "Rect", "description": "The layout rect for the requested element. Specified in page or viewport coordinates based on the useViewportCoordinates parameter." }
</span><span class="cx"> ],
</span><span class="cx"> "async": true
</span><ins>+ },
+ {
+ "name": "isShowingJavaScriptDialog",
+ "description": "Checks if a browsing context is showing a JavaScript alert, confirm, or prompt dialog.",
+ "parameters": [
+ { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." }
+ ],
+ "returns": [
+ { "name": "result", "type": "boolean", "description": "If the browsing context is showing a JavaScript dialog or not." }
+ ]
+ },
+ {
+ "name": "dismissCurrentJavaScriptDialog",
+ "description": "Dismisses a JavaScript alert, confirm, or prompt dialog currently showing in a browsing context. Equivalent to clicking the 'Cancel' button.",
+ "parameters": [
+ { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." }
+ ]
+ },
+ {
+ "name": "acceptCurrentJavaScriptDialog",
+ "description": "Accepts a JavaScript alert, confirm, or prompt dialog currently showing in a browsing context. Equivalent to clicking the 'OK' button.",
+ "parameters": [
+ { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." }
+ ]
+ },
+ {
+ "name": "messageOfCurrentJavaScriptDialog",
+ "description": "Returns the text displayed in a JavaScript alert, confirm, or prompt dialog currently showing in a browsing context.",
+ "parameters": [
+ { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." }
+ ],
+ "returns": [
+ { "name": "message", "type": "string", "description": "Text being displayed in the current JavaScript dialog." }
+ ]
+ },
+ {
+ "name": "setUserInputForCurrentJavaScriptPrompt",
+ "description": "Sets the user entered value in a JavaScript prompt dialog currently showing in a browsing context.",
+ "parameters": [
+ { "name": "browsingContextHandle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context." },
+ { "name": "userInput", "type": "string", "description": "The text to enter in the prompt." }
+ ]
</ins><span class="cx"> }
</span><span class="cx"> ]
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationWebAutomationSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -465,4 +465,81 @@
</span><span class="cx"> callback->sendSuccess(WTFMove(rectObject));
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebAutomationSession::isShowingJavaScriptDialog(Inspector::ErrorString& errorString, const String& browsingContextHandle, bool* result)
+{
+ ASSERT(m_client);
+ if (!m_client)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InternalError);
+
+ WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
+
+ *result = m_client->isShowingJavaScriptDialogOnPage(this, page);
+}
+
+void WebAutomationSession::dismissCurrentJavaScriptDialog(Inspector::ErrorString& errorString, const String& browsingContextHandle)
+{
+ ASSERT(m_client);
+ if (!m_client)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InternalError);
+
+ WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
+
+ if (!m_client->isShowingJavaScriptDialogOnPage(this, page))
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NoJavaScriptDialog);
+
+ m_client->dismissCurrentJavaScriptDialogOnPage(this, page);
+}
+
+void WebAutomationSession::acceptCurrentJavaScriptDialog(Inspector::ErrorString& errorString, const String& browsingContextHandle)
+{
+ ASSERT(m_client);
+ if (!m_client)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InternalError);
+
+ WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
+
+ if (!m_client->isShowingJavaScriptDialogOnPage(this, page))
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NoJavaScriptDialog);
+
+ m_client->acceptCurrentJavaScriptDialogOnPage(this, page);
+}
+
+void WebAutomationSession::messageOfCurrentJavaScriptDialog(Inspector::ErrorString& errorString, const String& browsingContextHandle, String* text)
+{
+ ASSERT(m_client);
+ if (!m_client)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InternalError);
+
+ WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
+
+ if (!m_client->isShowingJavaScriptDialogOnPage(this, page))
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NoJavaScriptDialog);
+
+ *text = m_client->messageOfCurrentJavaScriptDialogOnPage(this, page);
+}
+
+void WebAutomationSession::setUserInputForCurrentJavaScriptPrompt(Inspector::ErrorString& errorString, const String& browsingContextHandle, const String& promptValue)
+{
+ ASSERT(m_client);
+ if (!m_client)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InternalError);
+
+ WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
+ if (!page)
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
+
+ if (!m_client->isShowingJavaScriptDialogOnPage(this, page))
+ FAIL_WITH_PREDEFINED_ERROR_MESSAGE(NoJavaScriptDialog);
+
+ m_client->setUserInputForCurrentJavaScriptPromptOnPage(this, page, promptValue);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationWebAutomationSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -95,6 +95,11 @@
</span><span class="cx"> void resolveChildFrameHandle(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const int* optionalOrdinal, const String* optionalName, const String* optionalNodeHandle, Ref<ResolveChildFrameHandleCallback>&&) override;
</span><span class="cx"> void resolveParentFrameHandle(Inspector::ErrorString&, const String& browsingContextHandle, const String& frameHandle, Ref<ResolveParentFrameHandleCallback>&&) override;
</span><span class="cx"> void computeElementLayout(Inspector::ErrorString&, const String& browsingContextHandle, const String& frameHandle, const String& nodeHandle, const bool* optionalScrollIntoViewIfNeeded, const bool* useViewportCoordinates, Ref<Inspector::AutomationBackendDispatcherHandler::ComputeElementLayoutCallback>&&) override;
</span><ins>+ void isShowingJavaScriptDialog(Inspector::ErrorString&, const String& browsingContextHandle, bool* result) override;
+ void dismissCurrentJavaScriptDialog(Inspector::ErrorString&, const String& browsingContextHandle) override;
+ void acceptCurrentJavaScriptDialog(Inspector::ErrorString&, const String& browsingContextHandle) override;
+ void messageOfCurrentJavaScriptDialog(Inspector::ErrorString&, const String& browsingContextHandle, String* text) override;
+ void setUserInputForCurrentJavaScriptPrompt(Inspector::ErrorString&, const String& browsingContextHandle, const String& text) override;
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> WebPageProxy* webPageProxyForHandle(const String&);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaAutomationSessionClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.h (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.h        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.h        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -43,14 +43,25 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> // From API::AutomationSessionClient
</span><del>- WebPageProxy* didRequestNewWindow(WebKit::WebAutomationSession*) override;
- void didDisconnectFromRemote(WebKit::WebAutomationSession *) override;
</del><ins>+ WebPageProxy* didRequestNewWindow(WebAutomationSession*) override;
+ void didDisconnectFromRemote(WebAutomationSession *) override;
</ins><span class="cx">
</span><ins>+ bool isShowingJavaScriptDialogOnPage(WebAutomationSession*, WebPageProxy*) override;
+ void dismissCurrentJavaScriptDialogOnPage(WebAutomationSession*, WebPageProxy*) override;
+ void acceptCurrentJavaScriptDialogOnPage(WebAutomationSession*, WebPageProxy*) override;
+ String messageOfCurrentJavaScriptDialogOnPage(WebAutomationSession*, WebPageProxy*) override;
+ void setUserInputForCurrentJavaScriptPromptOnPage(WebAutomationSession*, WebPageProxy*, const String&) override;
+
</ins><span class="cx"> WeakObjCPtr<id <_WKAutomationSessionDelegate>> m_delegate;
</span><span class="cx">
</span><span class="cx"> struct {
</span><span class="cx"> bool didRequestNewWindow : 1;
</span><span class="cx"> bool didDisconnectFromRemote : 1;
</span><ins>+ bool isShowingJavaScriptDialogOnPage : 1;
+ bool dismissCurrentJavaScriptDialogOnPage : 1;
+ bool acceptCurrentJavaScriptDialogOnPage : 1;
+ bool messageOfCurrentJavaScriptDialogOnPage : 1;
+ bool setUserInputForCurrentJavaScriptPromptOnPage : 1;
</ins><span class="cx"> } m_delegateMethods;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaAutomationSessionClientmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.mm (198739 => 198740)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.mm        2016-03-28 15:57:37 UTC (rev 198739)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/AutomationSessionClient.mm        2016-03-28 15:57:49 UTC (rev 198740)
</span><span class="lines">@@ -41,6 +41,11 @@
</span><span class="cx"> {
</span><span class="cx"> m_delegateMethods.didRequestNewWindow = [delegate respondsToSelector:@selector(_automationSessionDidRequestNewWindow:)];
</span><span class="cx"> m_delegateMethods.didDisconnectFromRemote = [delegate respondsToSelector:@selector(_automationSessionDidDisconnectFromRemote:)];
</span><ins>+ m_delegateMethods.isShowingJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:isShowingJavaScriptDialogOnPage:)];
+ m_delegateMethods.dismissCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:dismissCurrentJavaScriptDialogOnPage:)];
+ m_delegateMethods.acceptCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:acceptCurrentJavaScriptDialogOnPage:)];
+ m_delegateMethods.messageOfCurrentJavaScriptDialogOnPage = [delegate respondsToSelector:@selector(_automationSession:messageOfCurrentJavaScriptDialogOnPage:)];
+ m_delegateMethods.setUserInputForCurrentJavaScriptPromptOnPage = [delegate respondsToSelector:@selector(_automationSession:setUserInput:forCurrentJavaScriptDialogOnPage:)];
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> WebPageProxy* AutomationSessionClient::didRequestNewWindow(WebAutomationSession* session)
</span><span class="lines">@@ -56,6 +61,38 @@
</span><span class="cx"> [m_delegate.get() _automationSessionDidDisconnectFromRemote:wrapper(*session)];
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool AutomationSessionClient::isShowingJavaScriptDialogOnPage(WebAutomationSession* session, WebPageProxy* page)
+{
+ if (m_delegateMethods.isShowingJavaScriptDialogOnPage)
+ return [m_delegate.get() _automationSession:wrapper(*session) isShowingJavaScriptDialogOnPage:toAPI(page)];
+ return false;
+}
+
+void AutomationSessionClient::dismissCurrentJavaScriptDialogOnPage(WebAutomationSession* session, WebPageProxy* page)
+{
+ if (m_delegateMethods.dismissCurrentJavaScriptDialogOnPage)
+ [m_delegate.get() _automationSession:wrapper(*session) dismissCurrentJavaScriptDialogOnPage:toAPI(page)];
+}
+
+void AutomationSessionClient::acceptCurrentJavaScriptDialogOnPage(WebAutomationSession* session, WebPageProxy* page)
+{
+ if (m_delegateMethods.acceptCurrentJavaScriptDialogOnPage)
+ [m_delegate.get() _automationSession:wrapper(*session) acceptCurrentJavaScriptDialogOnPage:toAPI(page)];
+}
+
+String AutomationSessionClient::messageOfCurrentJavaScriptDialogOnPage(WebAutomationSession* session, WebPageProxy* page)
+{
+ if (m_delegateMethods.messageOfCurrentJavaScriptDialogOnPage)
+ return [m_delegate.get() _automationSession:wrapper(*session) messageOfCurrentJavaScriptDialogOnPage:toAPI(page)];
+ return String();
+}
+
+void AutomationSessionClient::setUserInputForCurrentJavaScriptPromptOnPage(WebAutomationSession* session, WebPageProxy* page, const String& value)
+{
+ if (m_delegateMethods.setUserInputForCurrentJavaScriptPromptOnPage)
+ [m_delegate.get() _automationSession:wrapper(*session) setUserInput:value forCurrentJavaScriptDialogOnPage:toAPI(page)];
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx">
</span><span class="cx"> #endif // WK_API_ENABLED
</span></span></pre>
</div>
</div>
</body>
</html>