Add WebAutomationSessionProxy for WebProcess side automation tasks
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Mar 2016 15:56:53 +0000 (15:56 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 28 Mar 2016 15:56:53 +0000 (15:56 +0000)
commit63c2254d5eefa2a8d33b4a3c3242cc4d01e39407
tree12fbb6a578e195553995d6779bbb40dceb916b78
parent4f5c44b900078153d8d732bf702a4de0d23fc010
Add WebAutomationSessionProxy for WebProcess side automation tasks

https://bugs.webkit.org/show_bug.cgi?id=155221
rdar://problem/25054868

Reviewed by Joseph Pecoraro.

* CMakeLists.txt: Add build step to build-in WebAutomationSessionProxy.js.
* DerivedSources.make: Ditto.

* UIProcess/Automation/WebAutomationSession.cpp:
(WebKit::WebAutomationSession::~WebAutomationSession):
(WebKit::WebAutomationSession::setProcessPool): Add / remove message receiver.
* UIProcess/Automation/WebAutomationSession.h:

* UIProcess/Automation/WebAutomationSession.messages.in: Added.
Test message to get things to build.

* UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::removeMessageReceiver):
(WebKit::WebProcessPool::setAutomationSession):
* UIProcess/WebProcessPool.h:

* WebKit2.xcodeproj/project.pbxproj: Added new files.

* WebProcess/Automation/WebAutomationSessionProxy.cpp: Added.
(WebKit::toJSString):
(WebKit::toJSValue):
(WebKit::WebAutomationSessionProxy::WebAutomationSessionProxy):
(WebKit::WebAutomationSessionProxy::~WebAutomationSessionProxy):
(WebKit::evaluate):
(WebKit::createUUID):
(WebKit::WebAutomationSessionProxy::scriptObjectForFrame):
(WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
Create a script object per frame that is evaluated from WebAutomationSessionProxy.js.
Clear the script object when the window object is cleared.

* WebProcess/Automation/WebAutomationSessionProxy.h: Added.
(WebKit::WebAutomationSessionProxy::test):
Added test message to let the messages files build.

* WebProcess/Automation/WebAutomationSessionProxy.js: Added.

* WebProcess/Automation/WebAutomationSessionProxy.messages.in: Added.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld):
Call WebAutomationSessionProxy::didClearWindowObjectForFrame to clear the script object.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::ensureAutomationSessionProxy):
(WebKit::WebProcess::destroyAutomationSessionProxy):
Creates and destroys the WebAutomationSessionProxy when the UIProcess WebAutomationSession
is set or removed on the WebProcessPool.

* WebProcess/WebProcess.h:
(WebKit::WebProcess::automationSessionProxy): Added.

* WebProcess/WebProcess.messages.in: Added. Test message to get things to build.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@198736 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
Source/WebKit2/CMakeLists.txt
Source/WebKit2/ChangeLog
Source/WebKit2/DerivedSources.make
Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp
Source/WebKit2/UIProcess/Automation/WebAutomationSession.h
Source/WebKit2/UIProcess/Automation/WebAutomationSession.messages.in [new file with mode: 0644]
Source/WebKit2/UIProcess/WebProcessPool.cpp
Source/WebKit2/UIProcess/WebProcessPool.h
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.h [new file with mode: 0644]
Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.js [new file with mode: 0644]
Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.messages.in [new file with mode: 0644]
Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit2/WebProcess/WebProcess.cpp
Source/WebKit2/WebProcess/WebProcess.h
Source/WebKit2/WebProcess/WebProcess.messages.in