Fix for https://bugs.webkit.org/show_bug.cgi?id=40630
WebKit2: Add mechanism to inject code into the WebProcess on startup
Reviewed by Anders Carlsson.
Add initial InjectedBundle support.
WebKit2:
* Shared/CoreIPCSupport/WebProcessMessageKinds.h:
(WebProcessMessage::):
Add new LoadInjectedBundle message kind.
* UIProcess/API/C/WKContext.cpp:
(toWK):
(WKContextCreate):
(WKContextCreateWithInjectedBundlePath):
* UIProcess/API/C/WKContext.h:
Rename WKContextCreateWithProcessModel to WKContextCreate and add
WKContextCreateWithInjectedBundlePath for creating a context with
a bundle.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::WebContext):
* UIProcess/WebContext.h:
(WebKit::WebContext::create):
(WebKit::WebContext::processModel):
(WebKit::WebContext::bundlePath):
* UIProcess/WebPageNamespace.cpp:
(WebKit::WebPageNamespace::ensureWebProcess):
(WebKit::WebPageNamespace::reviveIfNecessary):
* UIProcess/WebProcessManager.cpp:
(WebKit::WebProcessManager::getWebProcess):
* UIProcess/WebProcessManager.h:
* UIProcess/WebProcessProxy.cpp:
(WebKit::WebProcessProxy::create):
(WebKit::WebProcessProxy::WebProcessProxy):
* UIProcess/WebProcessProxy.h:
Thread the bundle path through process creation.
* WebProcess/InjectedBundle: Added.
* WebProcess/InjectedBundle/API: Added.
* WebProcess/InjectedBundle/API/c: Added.
* WebProcess/InjectedBundle/API/c/WKBundle.cpp: Added.
(WKBundleSetClient):
* WebProcess/InjectedBundle/API/c/WKBundle.h: Added.
* WebProcess/InjectedBundle/API/c/WKBundleAPICast.h: Added.
(WebKit::):
(toWK):
(toRef):
* WebProcess/InjectedBundle/API/c/WKBundleBase.h: Added.
* WebProcess/InjectedBundle/API/c/WKBundleInitialize.h: Added.
* WebProcess/InjectedBundle/InjectedBundle.cpp: Added.
(WebKit::InjectedBundle::InjectedBundle):
(WebKit::InjectedBundle::~InjectedBundle):
(WebKit::InjectedBundle::initializeClient):
(WebKit::InjectedBundle::didCreatePage):
* WebProcess/InjectedBundle/InjectedBundle.h: Added.
(WebKit::InjectedBundle::create):
Add bundle boilerplate.
* WebProcess/InjectedBundle/mac: Added.
* WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp: Added.
(WebKit::InjectedBundle::load):
Load the InjectedBundle using CFBundle.
* WebProcess/InjectedBundle/win: Added.
* WebProcess/InjectedBundle/win/InjectedBundleWin.cpp: Added.
(WebKit::pathGetFileName):
(WebKit::directoryName):
(WebKit::InjectedBundle::load):
Load the InjectedBundle using HMODULE.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
Add initial bundle callback for page creation. More to come.
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::loadInjectedBundle):
(WebKit::WebProcess::didReceiveMessage):
* WebProcess/WebProcess.h:
(WebKit::WebProcess::injectedBundle):
Load the InjectedBundle on LoadInjectedBundle message.
* WebKit2.xcodeproj/project.pbxproj:
* mac/WebKit2.exp:
* win/WebKit2.vcproj:
* win/WebKit2Generated.make:
Add the new files.
WebKitTools:
* MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj:
* MiniBrowser/WebBundle-Info.plist: Added.
Add test InjectedBundle to the project.
* MiniBrowser/mac/AppDelegate.m:
(-[BrowserAppDelegate init]):
Get the path to the WebBundle from the the main bundle and pass it to the new
WKContextCreateWithInjectedBundlePath function.
* MiniBrowser/mac/BrowserWindowController.m:
(_didChangeProgress):
Fix the build. This has been broken for a while.
* MiniBrowser/mac/WebBundle: Added.
* MiniBrowser/mac/WebBundle/WebBundleMain.c: Added.
(_didCreatePage):
(WKBundleInitialize):
Add really basic InjectedBundle.
* MiniBrowser/win/BrowserView.cpp:
(BrowserView::create):
Switch from WKContextCreateWithProcessModel to WKContextCreate and remove commented out code.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@61222
268f45cc-cd09-0410-ab3c-
d52691b4dbfc