Commit 513e9456 authored by ap@apple.com's avatar ap@apple.com
Browse files

<rdar://problem/12407920> Need to keep track of messages posted to...

        <rdar://problem/12407920> Need to keep track of messages posted to injected bundle before creating a page
        https://bugs.webkit.org/show_bug.cgi?id=98210

        Reviewed by Anders Carlsson.

        Restore the pending message functionality, but only for shared process mode, and
        under a different name.

        * UIProcess/WebContext.cpp:
        (WebKit::WebContext::setProcessModel):
        (WebKit::WebContext::createNewWebProcess):
        (WebKit::WebContext::postMessageToInjectedBundle):
        * UIProcess/WebContext.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130232 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d22f961f
2012-10-02 Alexey Proskuryakov <ap@apple.com>
<rdar://problem/12407920> Need to keep track of messages posted to injected bundle before creating a page
https://bugs.webkit.org/show_bug.cgi?id=98210
Reviewed by Anders Carlsson.
Restore the pending message functionality, but only for shared process mode, and
under a different name.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::setProcessModel):
(WebKit::WebContext::createNewWebProcess):
(WebKit::WebContext::postMessageToInjectedBundle):
* UIProcess/WebContext.h:
2012-10-02 Adrian Perez de Castro <aperez@igalia.com>
 
Unix plugin process: xErrorString does not need to be defined in release builds
......
......@@ -263,6 +263,8 @@ void WebContext::setProcessModel(ProcessModel processModel)
// Guard against API misuse.
if (!m_processes.isEmpty())
CRASH();
if (processModel != ProcessModelSharedSecondaryProcess && !m_messagesToInjectedBundlePostedToEmptyContext.isEmpty())
CRASH();
#if !ENABLE(PLUGIN_PROCESS)
// Plugin process is required for multiple web process mode.
......@@ -368,6 +370,16 @@ PassRefPtr<WebProcessProxy> WebContext::createNewWebProcess()
m_processes.append(process);
if (m_processModel == ProcessModelSharedSecondaryProcess) {
for (size_t i = 0; i != m_messagesToInjectedBundlePostedToEmptyContext.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_messagesToInjectedBundlePostedToEmptyContext[i];
process->deprecatedSend(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
}
m_messagesToInjectedBundlePostedToEmptyContext.clear();
} else
ASSERT(m_messagesToInjectedBundlePostedToEmptyContext.isEmpty());
return process.release();
}
......@@ -560,8 +572,11 @@ DownloadProxy* WebContext::download(WebPageProxy* initiatingPage, const Resource
void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
{
if (m_processes.isEmpty())
if (m_processes.isEmpty()) {
if (m_processModel == ProcessModelSharedSecondaryProcess)
m_messagesToInjectedBundlePostedToEmptyContext.append(std::make_pair(messageName, messageBody));
return;
}
// FIXME: Return early if the message body contains any references to WKPageRefs/WKFrameRefs etc. since they're local to a process.
......
......@@ -307,6 +307,10 @@ private:
bool m_alwaysUsesComplexTextCodePath;
bool m_shouldUseFontSmoothing;
// Messages that were posted before any pages were created.
// The client should use initialization messages instead, so that a restarted process would get the same state.
Vector<pair<String, RefPtr<APIObject> > > m_messagesToInjectedBundlePostedToEmptyContext;
CacheModel m_cacheModel;
WebDownloadClient m_downloadClient;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment