long startTime = System.currentTimeMillis();
// wait for load
while (true) {
messageProcessor.run();
if (m_doneLoading && m_code != 0) {
throw new HostedModeException(HostedModeException.OSX_BROWSER_ERROR, new String[]{
"" + m_code,
m_description});
}
boolean exit1 = m_windowScriptObject != 0 && m_doneInitializing;
boolean exit2 = System.currentTimeMillis() - startTime >= timeout;
if (exit1 || exit2 || m_exception[0] != null) {
break;
}
}
if (m_windowScriptObject == 0) {
throw new HostedModeException(HostedModeException.GWT_INIT_TIMEOUT, m_exception[0]);
}
if (!m_doneLoading || !m_doneInitializing) {
if (m_exception[0] != null) {
if (m_exception[0] instanceof HostedModeException) {
throw (HostedModeException) m_exception[0];
}
throw new HostedModeException(HostedModeException.MODULE_LOADING_ERROR, m_exception[0]);
} else {
throw new HostedModeException(HostedModeException.OSX_UNKNOWN_BROWSER_ERROR);
}
}
}