Fix for https://bugs.webkit.org/show_bug.cgi?id=40630
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jun 2010 23:17:21 +0000 (23:17 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Jun 2010 23:17:21 +0000 (23:17 +0000)
commitc46f42128f4b3a7ad34fa3b7327af0cabbe642cb
tree742c12057a4c7428060d5b32f6f64b988256452f
parentb3735ced400202c6c9087a7f5195274e6d458edd
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
35 files changed:
WebKit2/ChangeLog
WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h
WebKit2/UIProcess/API/C/WKContext.cpp
WebKit2/UIProcess/API/C/WKContext.h
WebKit2/UIProcess/API/mac/WKView.mm
WebKit2/UIProcess/WebContext.cpp
WebKit2/UIProcess/WebContext.h
WebKit2/UIProcess/WebPageNamespace.cpp
WebKit2/UIProcess/WebProcessManager.cpp
WebKit2/UIProcess/WebProcessManager.h
WebKit2/UIProcess/WebProcessProxy.cpp
WebKit2/UIProcess/WebProcessProxy.h
WebKit2/WebKit2.xcodeproj/project.pbxproj
WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.cpp [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundle.h [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundleAPICast.h [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundleBase.h [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/API/c/WKBundleInitialize.h [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/InjectedBundle.h [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/mac/InjectedBundleMac.cpp [new file with mode: 0644]
WebKit2/WebProcess/InjectedBundle/win/InjectedBundleWin.cpp [new file with mode: 0644]
WebKit2/WebProcess/WebPage/WebPage.cpp
WebKit2/WebProcess/WebProcess.cpp
WebKit2/WebProcess/WebProcess.h
WebKit2/mac/WebKit2.exp
WebKit2/win/WebKit2.vcproj
WebKit2/win/WebKit2Generated.make
WebKitTools/ChangeLog
WebKitTools/MiniBrowser/MiniBrowser.xcodeproj/project.pbxproj
WebKitTools/MiniBrowser/WebBundle-Info.plist [new file with mode: 0644]
WebKitTools/MiniBrowser/mac/AppDelegate.m
WebKitTools/MiniBrowser/mac/BrowserWindowController.m
WebKitTools/MiniBrowser/mac/WebBundle/WebBundleMain.c [new file with mode: 0644]
WebKitTools/MiniBrowser/win/BrowserView.cpp