<html>
<head>
<base href="https://bugs.webkit.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - Add WebAutomationSessionProxy for WebProcess side automation tasks"
href="https://bugs.webkit.org/show_bug.cgi?id=155221#c7">Comment # 7</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - Add WebAutomationSessionProxy for WebProcess side automation tasks"
href="https://bugs.webkit.org/show_bug.cgi?id=155221">bug 155221</a>
from <span class="vcard"><a class="email" href="mailto:timothy@apple.com" title="Timothy Hatcher <timothy@apple.com>"> <span class="fn">Timothy Hatcher</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=273551&action=diff" name="attach_273551" title="WIP Sketch v2">attachment 273551</a> <a href="attachment.cgi?id=273551&action=edit" title="WIP Sketch v2">[details]</a></span>
WIP Sketch v2
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=273551&action=review">https://bugs.webkit.org/attachment.cgi?id=273551&action=review</a>
<span class="quote">> Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp:258
> + page->process().send(Messages::WebAutomationSessionProxy::EvaluateJavaScript(page->mainFrame()->frameID(), WTF::emptyString()), 0);</span >
Note: mainFrame can be null. It is null when the WebPageProxy is first created. I am not sure on when it is available yet, be we should null check it.
<span class="quote">> Source/WebKit2/UIProcess/Automation/WebAutomationSession.messages.in:25
> +messages -> WebAutomationSession {
> + Test()
> +}</span >
We will likely need these messages to the UIProcess to implement execute_async or any other events.
<span class="quote">> Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp:101
> + JSRetainPtr<JSStringRef> testString(Adopt, JSStringCreateWithUTF8CString("test"));
> + JSObjectRef testFunction = (JSObjectRef)JSObjectGetProperty(context, scriptObject, testString.get(), &exception);
> + RELEASE_ASSERT(!exception);
> + RELEASE_ASSERT(JSObjectIsFunction(context, testFunction));
> +
> + JSObjectCallAsFunction(context, testFunction, nullptr, 0, nullptr, &exception);
> + RELEASE_ASSERT(!exception);</span >
Just a test. This would call JSEvaluateScript and pass the result to the injected script for processing (turning elements into handles, etc.)
<span class="quote">> Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js:43
> + test()
> + {
> + console.log("Hello World!");
> + }</span >
This gets called in the end by requesting the refresh endpoint right now.
<span class="quote">> Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:1584
> + if (auto automationSessionProxy = WebProcess::singleton().automationSessionProxy())
> + automationSessionProxy->didClearWindowObjectForFrame(*m_frame);</span >
Needed so we unprotect our script object ref.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>