WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
40630
WebKit2: Add mechanism to inject code into the WebProcess on startup
https://bugs.webkit.org/show_bug.cgi?id=40630
Summary
WebKit2: Add mechanism to inject code into the WebProcess on startup
Sam Weinig
Reported
2010-06-15 10:03:03 PDT
We need a mechanism to allow injecting code into the WebProcess on startup, sort of like a plugin, but for the embedding app instead of the web content.
Attachments
patch
(89.70 KB, patch)
2010-06-15 10:14 PDT
,
Sam Weinig
no flags
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Sam Weinig
Comment 1
2010-06-15 10:14:21 PDT
Created
attachment 58793
[details]
patch
Darin Adler
Comment 2
2010-06-15 12:15:43 PDT
Comment on
attachment 58793
[details]
patch Double change log in this patch.
Anders Carlsson
Comment 3
2010-06-15 13:55:44 PDT
Comment on
attachment 58793
[details]
patch
> Index: WebKit2/ChangeLog > =================================================================== > --- WebKit2/ChangeLog (revision 61196) > +++ WebKit2/ChangeLog (working copy) > @@ -1,3 +1,172 @@ > +2010-06-15 Sam Weinig <
sam@webkit.org
> > + > + Reviewed by NOBODY (OOPS!). > + > + Fix for
https://bugs.webkit.org/show_bug.cgi?id=40630
> + WebKit2: Add mechanism to inject code into the WebProcess on startup > + > + Add initial WebBundle support.
Let's call it "Injected Bundle" instead.
> Index: WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h > =================================================================== > --- WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h (revision 61159) > +++ WebKit2/Shared/CoreIPCSupport/WebProcessMessageKinds.h (working copy) > @@ -33,6 +33,7 @@ > namespace WebProcessMessage { > > enum Kind { > + LoadWebBundle, > Create > }; >
Injected bundle.
> Index: WebKit2/UIProcess/WebContext.cpp > =================================================================== > --- WebKit2/UIProcess/WebContext.cpp (revision 61159) > +++ WebKit2/UIProcess/WebContext.cpp (working copy) > @@ -36,6 +36,8 @@ > #include <wtf/RefCountedLeakCounter.h> > #endif > > +using namespace WebCore; > + > namespace WebKit { > > #ifndef NDEBUG > @@ -55,6 +57,20 @@ WebContext::WebContext(ProcessModel proc > #endif > } > > +WebContext::WebContext(ProcessModel processModel, const WebCore::String& bundlePath) > + : m_processModel(processModel) > + , m_bundlePath(bundlePath) > +{ > + RunLoop::initializeMainRunLoop(); > + > + m_preferences = WebPreferences::shared(); > + m_preferences->addContext(this); > + > +#ifndef NDEBUG > + webContextCounter.increment(); > +#endif > +} > +
No need for an extra constructor, just add a bundlePath parameter to the already existing constructor.
> WebContext::~WebContext() > { > ASSERT(m_pageNamespaces.isEmpty()); > Index: WebKit2/UIProcess/WebContext.h > =================================================================== > --- WebKit2/UIProcess/WebContext.h (revision 61159) > +++ WebKit2/UIProcess/WebContext.h (working copy) > @@ -27,6 +27,7 @@ > #define WebContext_h > > #include "ProcessModel.h" > +#include <WebCore/PlatformString.h> > #include <wtf/HashSet.h> > #include <wtf/PassRefPtr.h> > #include <wtf/RefCounted.h> > @@ -46,26 +47,35 @@ public: > return adoptRef(new WebContext(processModel)); > } > > + static PassRefPtr<WebContext> create(ProcessModel processModel, const WebCore::String& bundlePath) > + { > + return adoptRef(new WebContext(processModel, bundlePath)); > + } > +
No need for an extra ::create function here.
> > +void WebProcess::loadWebBundle(const WebCore::String& path) > +{
InjectedBundle! (I'm gonna stop complaining about that now).
> +void WebBundle::initializeClient(WKBundleClient* client) > +{ > + if (client && !client->version) > + m_client = *client;
Maybe we should log an error if the client version didn't match? r=me!
Sam Weinig
Comment 4
2010-06-15 16:17:41 PDT
Landed in
r61222
.
David Levin
Comment 5
2010-06-15 19:44:53 PDT
Comment on
attachment 58793
[details]
patch Cleared r? since the patch was "r=me" (in comments) and landed.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug