<!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>[198913] 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/198913">198913</a></dd>
<dt>Author</dt> <dd>timothy@apple.com</dd>
<dt>Date</dt> <dd>2016-03-31 13:52:38 -0700 (Thu, 31 Mar 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>Web Automation: Add support for script timeouts to the evaluateJavaScriptFunction command
https://bugs.webkit.org/show_bug.cgi?id=156052
rdar://problem/25457151
Reviewed by Brian Burg.
* UIProcess/Automation/Automation.json: Added callbackTimeout to evaluateJavaScriptFunction.
Also made expectsImplicitCallbackArgument optional, since it is not required. Added JavaScriptTimeout error.
* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::evaluateJavaScriptFunction): Added callbackTimeout.
* UIProcess/Automation/WebAutomationSession.h:
* WebProcess/Automation/WebAutomationSessionProxy.cpp:
(WebKit::evaluateJavaScriptCallback): Send JavaScriptTimeout error if the timeout fired.
(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Added callbackTimeout.
* WebProcess/Automation/WebAutomationSessionProxy.h:
* WebProcess/Automation/WebAutomationSessionProxy.js:
(AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Set a timeout to fire if the
callback is not called, then return an error.
* WebProcess/Automation/WebAutomationSessionProxy.messages.in:
(EvaluateJavaScriptFunction): Added callbackTimeout parameter.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</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="#trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxycpp">trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxyh">trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxyjs">trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js</a></li>
<li><a href="#trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxymessagesin">trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.messages.in</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2016-03-30 Timothy Hatcher <timothy@apple.com>
+
+ Web Automation: Add support for script timeouts to the evaluateJavaScriptFunction command
+
+ https://bugs.webkit.org/show_bug.cgi?id=156052
+ rdar://problem/25457151
+
+ Reviewed by Brian Burg.
+
+ * UIProcess/Automation/Automation.json: Added callbackTimeout to evaluateJavaScriptFunction.
+ Also made expectsImplicitCallbackArgument optional, since it is not required. Added JavaScriptTimeout error.
+ * UIProcess/Automation/WebAutomationSession.cpp:
+ (WebKit::WebAutomationSession::evaluateJavaScriptFunction): Added callbackTimeout.
+ * UIProcess/Automation/WebAutomationSession.h:
+ * WebProcess/Automation/WebAutomationSessionProxy.cpp:
+ (WebKit::evaluateJavaScriptCallback): Send JavaScriptTimeout error if the timeout fired.
+ (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction): Added callbackTimeout.
+ * WebProcess/Automation/WebAutomationSessionProxy.h:
+ * WebProcess/Automation/WebAutomationSessionProxy.js:
+ (AutomationSessionProxy.prototype.evaluateJavaScriptFunction): Set a timeout to fire if the
+ callback is not called, then return an error.
+ * WebProcess/Automation/WebAutomationSessionProxy.messages.in:
+ (EvaluateJavaScriptFunction): Added callbackTimeout parameter.
+
</ins><span class="cx"> 2016-03-31 Jiewen Tan <jiewen_tan@apple.com>
</span><span class="cx">
</span><span class="cx"> WebKit should set Original URL of a download request correctly
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationAutomationjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> "enum": [
</span><span class="cx"> "InternalError",
</span><span class="cx"> "JavaScriptError",
</span><ins>+ "JavaScriptTimeout",
</ins><span class="cx"> "WindowNotFound",
</span><span class="cx"> "FrameNotFound",
</span><span class="cx"> "NodeNotFound",
</span><span class="lines">@@ -280,7 +281,8 @@
</span><span class="cx"> { "name": "frameHandle", "$ref": "FrameHandle", "optional": true, "description": "The handle for the frame the script should be evaluated. The main frame is used if this parameter empty string or excluded." },
</span><span class="cx"> { "name": "function", "type": "string", "description": "The script to evaluate in the browsing context. It must be a function result." },
</span><span class="cx"> { "name": "arguments", "type": "array", "items": { "type": "string" }, "description": "The arguments to pass to the function when called. They will be parsed as JSON before calling the function." },
</span><del>- { "name": "expectsImplicitCallbackArgument", "type": "boolean", "description": "The function expects a callback function as the last argument. It is expected to call this callback with a result." }
</del><ins>+ { "name": "expectsImplicitCallbackArgument", "type": "boolean", "optional": true, "description": "The function expects a callback function as the last argument. It is expected to call this callback with a result." },
+ { "name": "callbackTimeout", "type": "integer", "optional": true, "description": "The timeout in milliseconds that the implicit callback is expected to be called in, otherwise a <code>JavaScriptTimeout</code> error is returned." }
</ins><span class="cx"> ],
</span><span class="cx"> "returns": [
</span><span class="cx"> { "name": "result", "type": "string", "description": "The result returned by the called function. It is JSON encoded after the function returns or calls the callback." }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationWebAutomationSessioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -395,7 +395,7 @@
</span><span class="cx"> page->reload(reloadFromOrigin, contentBlockersEnabled);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebAutomationSession::evaluateJavaScriptFunction(Inspector::ErrorString& errorString, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, bool expectsImplicitCallbackArgument, Ref<EvaluateJavaScriptFunctionCallback>&& callback)
</del><ins>+void WebAutomationSession::evaluateJavaScriptFunction(Inspector::ErrorString& errorString, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<EvaluateJavaScriptFunctionCallback>&& callback)
</ins><span class="cx"> {
</span><span class="cx"> WebPageProxy* page = webPageProxyForHandle(browsingContextHandle);
</span><span class="cx"> if (!page)
</span><span class="lines">@@ -414,10 +414,13 @@
</span><span class="cx"> argumentsVector.uncheckedAppend(argumentString);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ bool expectsImplicitCallbackArgument = optionalExpectsImplicitCallbackArgument ? *optionalExpectsImplicitCallbackArgument : false;
+ int callbackTimeout = optionalCallbackTimeout ? *optionalCallbackTimeout : 0;
+
</ins><span class="cx"> uint64_t callbackID = m_nextEvaluateJavaScriptCallbackID++;
</span><span class="cx"> m_evaluateJavaScriptFunctionCallbacks.set(callbackID, WTFMove(callback));
</span><span class="cx">
</span><del>- page->process().send(Messages::WebAutomationSessionProxy::EvaluateJavaScriptFunction(frame->frameID(), function, argumentsVector, expectsImplicitCallbackArgument, callbackID), 0);
</del><ins>+ page->process().send(Messages::WebAutomationSessionProxy::EvaluateJavaScriptFunction(frame->frameID(), function, argumentsVector, expectsImplicitCallbackArgument, callbackTimeout, callbackID), 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebAutomationSession::didEvaluateJavaScriptFunction(uint64_t callbackID, const String& result, const String& errorType)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAutomationWebAutomationSessionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.h        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -103,7 +103,7 @@
</span><span class="cx"> void goBackInBrowsingContext(Inspector::ErrorString&, const String&) override;
</span><span class="cx"> void goForwardInBrowsingContext(Inspector::ErrorString&, const String&) override;
</span><span class="cx"> void reloadBrowsingContext(Inspector::ErrorString&, const String&) override;
</span><del>- void evaluateJavaScriptFunction(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, bool expectsImplicitCallbackArgument, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
</del><ins>+ void evaluateJavaScriptFunction(Inspector::ErrorString&, const String& browsingContextHandle, const String* optionalFrameHandle, const String& function, const Inspector::InspectorArray& arguments, const bool* optionalExpectsImplicitCallbackArgument, const int* optionalCallbackTimeout, Ref<Inspector::AutomationBackendDispatcherHandler::EvaluateJavaScriptFunctionCallback>&&) override;
</ins><span class="cx"> void performMouseInteraction(Inspector::ErrorString&, const String& handle, const Inspector::InspectorObject& requestedPosition, const String& mouseButton, const String& mouseInteraction, const Inspector::InspectorArray& keyModifiers, RefPtr<Inspector::Protocol::Automation::Point>& updatedPosition) override;
</span><span class="cx"> void performKeyboardInteractions(Inspector::ErrorString&, const String& handle, const Inspector::InspectorArray& interactions) override;
</span><span class="cx"> void takeScreenshot(Inspector::ErrorString&, const String& handle, Ref<Inspector::AutomationBackendDispatcherHandler::TakeScreenshotCallback>&&) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -126,10 +126,11 @@
</span><span class="cx">
</span><span class="cx"> static JSValueRef evaluateJavaScriptCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
</span><span class="cx"> {
</span><del>- ASSERT_ARG(argumentCount, argumentCount == 3);
</del><ins>+ ASSERT_ARG(argumentCount, argumentCount == 4);
</ins><span class="cx"> ASSERT_ARG(arguments, JSValueIsNumber(context, arguments[0]));
</span><span class="cx"> ASSERT_ARG(arguments, JSValueIsNumber(context, arguments[1]));
</span><span class="cx"> ASSERT_ARG(arguments, JSValueIsString(context, arguments[2]));
</span><ins>+ ASSERT_ARG(arguments, JSValueIsBoolean(context, arguments[3]));
</ins><span class="cx">
</span><span class="cx"> auto automationSessionProxy = WebProcess::singleton().automationSessionProxy();
</span><span class="cx"> if (!automationSessionProxy)
</span><span class="lines">@@ -139,8 +140,20 @@
</span><span class="cx"> uint64_t callbackID = JSValueToNumber(context, arguments[1], exception);
</span><span class="cx"> JSRetainPtr<JSStringRef> result(Adopt, JSValueToStringCopy(context, arguments[2], exception));
</span><span class="cx">
</span><del>- automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, result->string(), String());
</del><ins>+ bool resultIsErrorName = JSValueToBoolean(context, arguments[3]);
</ins><span class="cx">
</span><ins>+ if (resultIsErrorName) {
+ if (result->string() == "JavaScriptTimeout") {
+ String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptTimeout);
+ automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
+ } else {
+ ASSERT_NOT_REACHED();
+ String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError);
+ automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
+ }
+ } else
+ automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, result->string(), String());
+
</ins><span class="cx"> return JSValueMakeUndefined(context);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -212,7 +225,7 @@
</span><span class="cx"> WebProcess::singleton().parentProcessConnection()->send(Messages::WebAutomationSession::DidEvaluateJavaScriptFunction(callbackID, String(), errorType), 0);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebAutomationSessionProxy::evaluateJavaScriptFunction(uint64_t frameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, uint64_t callbackID)
</del><ins>+void WebAutomationSessionProxy::evaluateJavaScriptFunction(uint64_t frameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID)
</ins><span class="cx"> {
</span><span class="cx"> WebFrame* frame = WebProcess::singleton().webFrame(frameID);
</span><span class="cx"> if (!frame)
</span><span class="lines">@@ -225,8 +238,6 @@
</span><span class="cx"> JSValueRef exception = nullptr;
</span><span class="cx"> JSGlobalContextRef context = frame->jsContext();
</span><span class="cx">
</span><del>- JSObjectRef callbackFunction = JSObjectMakeFunctionWithCallback(context, nullptr, evaluateJavaScriptCallback);
-
</del><span class="cx"> if (expectsImplicitCallbackArgument) {
</span><span class="cx"> auto result = m_webFramePendingEvaluateJavaScriptCallbacksMap.add(frameID, Vector<uint64_t>());
</span><span class="cx"> result.iterator->value.append(callbackID);
</span><span class="lines">@@ -238,7 +249,8 @@
</span><span class="cx"> JSValueMakeBoolean(context, expectsImplicitCallbackArgument),
</span><span class="cx"> JSValueMakeNumber(context, frameID),
</span><span class="cx"> JSValueMakeNumber(context, callbackID),
</span><del>- callbackFunction
</del><ins>+ JSObjectMakeFunctionWithCallback(context, nullptr, evaluateJavaScriptCallback),
+ JSValueMakeNumber(context, callbackTimeout)
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> callPropertyFunction(context, scriptObject, ASCIILiteral("evaluateJavaScriptFunction"), WTF_ARRAY_LENGTH(functionArguments), functionArguments, &exception);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.h (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.h        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.h        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> void didReceiveMessage(IPC::Connection&, IPC::MessageDecoder&);
</span><span class="cx">
</span><span class="cx"> // Called by WebAutomationSessionProxy messages
</span><del>- void evaluateJavaScriptFunction(uint64_t frameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, uint64_t callbackID);
</del><ins>+ void evaluateJavaScriptFunction(uint64_t frameID, const String& function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID);
</ins><span class="cx"> void resolveChildFrameWithOrdinal(uint64_t frameID, uint32_t ordinal, uint64_t callbackID);
</span><span class="cx"> void resolveChildFrameWithNodeHandle(uint64_t frameID, const String& nodeHandle, uint64_t callbackID);
</span><span class="cx"> void resolveChildFrameWithName(uint64_t frameID, const String& name, uint64_t callbackID);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><del>- evaluateJavaScriptFunction(functionString, argumentStrings, expectsImplicitCallbackArgument, frameID, callbackID, resultCallback)
</del><ins>+ evaluateJavaScriptFunction(functionString, argumentStrings, expectsImplicitCallbackArgument, frameID, callbackID, resultCallback, callbackTimeout)
</ins><span class="cx"> {
</span><span class="cx"> // The script is expected to be a function declaration. Evaluate it inside parenthesis to get the function value.
</span><span class="cx"> let functionValue = evaluate("(" + functionString + ")");
</span><span class="lines">@@ -47,13 +47,19 @@
</span><span class="cx"> throw new TypeError("Script did not evaluate to a function.");
</span><span class="cx">
</span><span class="cx"> let argumentValues = argumentStrings.map(this._jsonParse, this);
</span><del>- let callback = (result) => resultCallback(frameID, callbackID, this._jsonStringify(result));
</del><span class="cx">
</span><ins>+ let timeoutIdentifier = 0;
+
+ let reportResult = (result) => { clearTimeout(timeoutIdentifier); resultCallback(frameID, callbackID, this._jsonStringify(result), false); }
+ let reportTimeoutError = () => { clearTimeout(timeoutIdentifier); resultCallback(frameID, callbackID, "JavaScriptTimeout", true); }
+
</ins><span class="cx"> if (expectsImplicitCallbackArgument) {
</span><del>- argumentValues.push(callback);
</del><ins>+ timeoutIdentifier = setTimeout(reportTimeoutError, callbackTimeout);
+
+ argumentValues.push(reportResult);
</ins><span class="cx"> functionValue.apply(null, argumentValues);
</span><span class="cx"> } else
</span><del>- callback(functionValue.apply(null, argumentValues));
</del><ins>+ reportResult(functionValue.apply(null, argumentValues));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> nodeForIdentifier(identifier)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessAutomationWebAutomationSessionProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.messages.in (198912 => 198913)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.messages.in        2016-03-31 20:43:41 UTC (rev 198912)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.messages.in        2016-03-31 20:52:38 UTC (rev 198913)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><span class="cx"> messages -> WebAutomationSessionProxy {
</span><del>- EvaluateJavaScriptFunction(uint64_t frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, uint64_t callbackID)
</del><ins>+ EvaluateJavaScriptFunction(uint64_t frameID, String function, Vector<String> arguments, bool expectsImplicitCallbackArgument, int callbackTimeout, uint64_t callbackID)
</ins><span class="cx">
</span><span class="cx"> ResolveChildFrameWithOrdinal(uint64_t frameID, uint32_t ordinal, uint64_t callbackID)
</span><span class="cx"> ResolveChildFrameWithNodeHandle(uint64_t frameID, String nodeHandle, uint64_t callbackID)
</span></span></pre>
</div>
</div>
</body>
</html>