Add SPI for immediate injection of user scripts
https://bugs.webkit.org/show_bug.cgi?id=173342
<rdar://problem/
29202285>
Patch by Alex Christensen <achristensen@webkit.org> on 2017-06-14
Reviewed by Brady Eidson.
Source/WebCore:
The new SPI is WKUserContentController._addUserScriptImmediately.
It is covered by new API tests.
* page/Frame.cpp:
(WebCore::Frame::injectUserScripts):
(WebCore::Frame::injectUserScriptImmediately):
Move injection functionality to allow us to call it directly from the new SPI.
* page/Frame.h:
* page/Page.cpp:
(WebCore::Page::forEachPage):
* page/Page.h:
Source/WebKit2:
* UIProcess/API/C/WKPageGroup.cpp:
(WKPageGroupAddUserScript):
* UIProcess/API/C/WKUserContentControllerRef.cpp:
(WKUserContentControllerAddUserScript):
* UIProcess/API/Cocoa/WKUserContentController.mm:
(-[WKUserContentController addUserScript:]):
(-[WKUserContentController _addUserScriptImmediately:]):
* UIProcess/API/Cocoa/WKUserContentControllerPrivate.h:
* UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::WebUserContentControllerProxy::addUserScript):
* UIProcess/UserContent/WebUserContentControllerProxy.h:
* WebProcess/UserContent/WebUserContentController.cpp:
(WebKit::WebUserContentController::addUserScripts):
(WebKit::WebUserContentController::addUserScriptInternal):
If we are to inject the script internally, inject it into the appropriate pages.
If we're injecting into the top frame only, there's no need to traverse the frame tree.
(WebKit::WebUserContentController::addUserScript):
* WebProcess/UserContent/WebUserContentController.h:
* WebProcess/UserContent/WebUserContentController.messages.in:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_cpuLimit):
Tools:
* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
(waitForMessage):
(TEST):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@218285
268f45cc-cd09-0410-ab3c-
d52691b4dbfc