Commit 18be5b81 authored by jberlin@webkit.org's avatar jberlin@webkit.org

Fix the WebKit2 API tests.

https://bugs.webkit.org/show_bug.cgi?id=48461

Reviewed by Sam Weinig.

The API tests were failing because the tests expect to be able to send messages before the
WebProcess finishes launching.

Instead of dispatching the pending messages in processDidFinishLaunching, dispatch them in
ensureWebProcess but do not make messages pending if the process is launching.

* UIProcess/WebContext.cpp:
(WebKit::WebContext::processDidFinishLaunching):
Move dispatching the pending messages back from here ...
(WebKit::WebContext::ensureWebProcess):
... to here.
(WebKit::WebContext::postMessageToInjectedBundle):
Check whether the process can send messages in order to determine if a message needs to be
sent later.

* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::canSendMessage):
The WebProcessProxy can send a message if it is valid or if it is launching.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70702 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent d99b55ed
2010-10-27 Jessie Berlin <jberlin@apple.com>
Reviewed by Sam Weinig.
Fix the WebKit2 API tests.
https://bugs.webkit.org/show_bug.cgi?id=48461
The API tests were failing because the tests expect to be able to send messages before the
WebProcess finishes launching.
Instead of dispatching the pending messages in processDidFinishLaunching, dispatch them in
ensureWebProcess but do not make messages pending if the process is launching.
* UIProcess/WebContext.cpp:
(WebKit::WebContext::processDidFinishLaunching):
Move dispatching the pending messages back from here ...
(WebKit::WebContext::ensureWebProcess):
... to here.
(WebKit::WebContext::postMessageToInjectedBundle):
Check whether the process can send messages in order to determine if a message needs to be
sent later.
* UIProcess/WebProcessProxy.h:
(WebKit::WebProcessProxy::canSendMessage):
The WebProcessProxy can send a message if it is valid or if it is launching.
2010-10-27 Anders Carlsson <andersca@apple.com>
Reviewed by Sam Weinig.
......
......@@ -178,6 +178,12 @@ void WebContext::ensureWebProcess()
platformInitializeWebProcess(parameters);
m_process->send(Messages::WebProcess::InitializeWebProcess(parameters), 0);
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
}
m_pendingMessagesToPostToInjectedBundle.clear();
}
void WebContext::processDidFinishLaunching(WebProcessProxy* process)
......@@ -186,12 +192,6 @@ void WebContext::processDidFinishLaunching(WebProcessProxy* process)
ASSERT(process == m_process);
m_visitedLinkProvider.populateVisitedLinksIfNeeded();
for (size_t i = 0; i != m_pendingMessagesToPostToInjectedBundle.size(); ++i) {
pair<String, RefPtr<APIObject> >& message = m_pendingMessagesToPostToInjectedBundle[i];
m_process->send(InjectedBundleMessage::PostMessage, 0, CoreIPC::In(message.first, WebContextUserMessageEncoder(message.second.get())));
}
m_pendingMessagesToPostToInjectedBundle.clear();
}
void WebContext::processDidClose(WebProcessProxy* process)
......@@ -260,7 +260,7 @@ void WebContext::preferencesDidChange()
void WebContext::postMessageToInjectedBundle(const String& messageName, APIObject* messageBody)
{
if (!hasValidProcess()) {
if (!m_process || !m_process->canSendMessage()) {
m_pendingMessagesToPostToInjectedBundle.append(make_pair(messageName, messageBody));
return;
}
......
......@@ -90,6 +90,7 @@ public:
bool isValid() const { return m_connection; }
bool isLaunching() const;
bool canSendMessage() const { return isValid() || isLaunching(); }
WebFrameProxy* webFrame(uint64_t) const;
void frameCreated(uint64_t, WebFrameProxy*);
......
Markdown is supported
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