This file was deleted.

This file was deleted.

@@ -49,6 +49,5 @@ int main(int argc, char** argv)
#if USE(GCRYPT)
PAL::GCrypt::initialize();
#endif

return WebProcessMainUnix(argc, argv);
}
@@ -221,7 +221,7 @@ void NetworkProcessConnection::didFinishPreconnection(uint64_t preconnectionIden
}

void NetworkProcessConnection::setOnLineState(bool isOnLine)
{
{fprintf(stderr,"\n$$$$$$$$$$$$ %s $$$$$$$$$$$$ \n",__PRETTY_FUNCTION__);
WebProcess::singleton().webLoaderStrategy().setOnLineState(isOnLine);
}

@@ -31,12 +31,12 @@
namespace WebKit {
using namespace WebCore;

void WebEditorClient::handleKeyboardEvent(KeyboardEvent* event)
void WebEditorClient::handleKeyboardEvent(KeyboardEvent& event)
{
notImplemented();
}

void WebEditorClient::handleInputMethodKeydown(KeyboardEvent* event)
void WebEditorClient::handleInputMethodKeydown(KeyboardEvent& event)
{
notImplemented();
}
@@ -90,6 +90,8 @@ void WebInspector::setFrontendConnection(IPC::Attachment encodedConnectionIdenti
IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.port());
#elif OS(WINDOWS)
IPC::Connection::Identifier connectionIdentifier(encodedConnectionIdentifier.handle());
#elif PLATFORM(HAIKU)
IPC::Connection::Identifier connectionIdentifier({NULL,NULL});
#else
notImplemented();
return;
@@ -96,12 +96,15 @@ void WebInspectorUI::updateConnection()
IPC::Connection::Identifier connectionIdentifier, connClient;
IPC::Connection::createServerAndClientIdentifiers(connectionIdentifier, connClient);
IPC::Attachment connectionClientPort(connClient);
#elif PLATFORM(HAIKU)
IPC::Connection::Identifier connectionIdentifier;
IPC::Attachment connectionClientPort;
#else
notImplemented();
return;
#endif

#if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN)
#if USE(UNIX_DOMAIN_SOCKETS) || OS(DARWIN) || PLATFORM(WIN) || PLATFORM(HAIKU)
m_backendConnection = IPC::Connection::createServerConnection(connectionIdentifier, *this);
m_backendConnection->open();
#endif
@@ -1561,9 +1561,9 @@ void WebPage::loadDataImpl(uint64_t navigationID, bool shouldTreatAsContinuingLo
}

void WebPage::loadData(LoadParameters&& loadParameters)
{
{fprintf(stderr,"\n$$$$$$$$$ %s -- %d $$$$$$$$$$$\n",__PRETTY_FUNCTION__,loadParameters.baseURLString.isEmpty());
platformDidReceiveLoadParameters(loadParameters);

fprintf(stderr,"\n$$$$$$$$$ %s -- %d $$$$$$$$$$$\n",__PRETTY_FUNCTION__,loadParameters.baseURLString.isEmpty());
auto sharedBuffer = SharedBuffer::create(reinterpret_cast<const char*>(loadParameters.data.data()), loadParameters.data.size());
URL baseURL = loadParameters.baseURLString.isEmpty() ? WTF::blankURL() : URL(URL(), loadParameters.baseURLString);
loadDataImpl(loadParameters.navigationID, loadParameters.shouldTreatAsContinuingLoad, WTFMove(loadParameters.websitePolicies), WTFMove(sharedBuffer), loadParameters.MIMEType, loadParameters.encodingName, baseURL, URL(), loadParameters.userData);
@@ -278,7 +278,7 @@ void WebProcess::initializeConnection(IPC::Connection* connection)
void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
{
TraceScope traceScope(InitializeWebProcessStart, InitializeWebProcessEnd);

fprintf(stderr,"%s\n",__PRETTY_FUNCTION__);
ASSERT(m_pageMap.isEmpty());

WebCore::setPresentingApplicationPID(parameters.presentingApplicationPID);
@@ -395,7 +395,7 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
setShouldUseFontSmoothing(parameters.shouldUseFontSmoothing);

ensureNetworkProcessConnection();

fprintf(stderr,"%p - WebProcess::initializeWebProcess: Presenting process = %d\n", this, WebCore::presentingApplicationPID());
#if ENABLE(RESOURCE_LOAD_STATISTICS)
ResourceLoadObserver::shared().setLogUserInteractionNotificationCallback([this] (PAL::SessionID sessionID, const RegistrableDomain& domain) {
ensureNetworkProcessConnection().connection().send(Messages::NetworkConnectionToWebProcess::LogUserInteraction(sessionID, domain), 0);
@@ -459,7 +459,7 @@ void WebProcess::initializeWebProcess(WebProcessCreationParameters&& parameters)
}

void WebProcess::setWebsiteDataStoreParameters(WebProcessDataStoreParameters&& parameters)
{
{fprintf(stderr,"%s\n",__PRETTY_FUNCTION__);
auto& databaseManager = DatabaseManager::singleton();
databaseManager.initialize(parameters.webSQLDatabaseDirectory);

@@ -1126,7 +1126,7 @@ void WebProcess::mainThreadPing()
}

void WebProcess::backgroundResponsivenessPing()
{
{fprintf(stderr,"%s\n",__PRETTY_FUNCTION__);
parentProcessConnection()->send(Messages::WebProcessProxy::DidReceiveBackgroundResponsivenessPing(), 0);
}

@@ -1204,7 +1204,10 @@ void WebProcess::setInjectedBundleParameters(const IPC::DataReference& value)
static IPC::Connection::Identifier getNetworkProcessConnection(IPC::Connection& connection)
{
IPC::Attachment encodedConnectionIdentifier;
fprintf(stderr,"%s outside crashing 0\n",__PRETTY_FUNCTION__);

if (!connection.sendSync(Messages::WebProcessProxy::GetNetworkProcessConnection(), Messages::WebProcessProxy::GetNetworkProcessConnection::Reply(encodedConnectionIdentifier), 0)) {
fprintf(stderr,"%s outside crashing 1\n",__PRETTY_FUNCTION__);
#if PLATFORM(GTK) || PLATFORM(WPE)
// GTK+ and WPE ports don't exit on send sync message failure.
// In this particular case, the network process can be terminated by the UI process while the
@@ -1213,6 +1216,7 @@ static IPC::Connection::Identifier getNetworkProcessConnection(IPC::Connection&
// See https://bugs.webkit.org/show_bug.cgi?id=183348.
exit(0);
#else
fprintf(stderr,"%s outside crashing 2\n",__PRETTY_FUNCTION__);
CRASH();
#endif
}
@@ -1223,6 +1227,12 @@ static IPC::Connection::Identifier getNetworkProcessConnection(IPC::Connection&
return encodedConnectionIdentifier.port();
#elif OS(WINDOWS)
return encodedConnectionIdentifier.handle();
#elif PLATFORM(HAIKU)
//Maybe try cut shorting down
IPC::Connection::Identifier conn;
conn.connectedProcess = encodedConnectionIdentifier.connectionID();
conn.key.SetToFormat("%u",encodedConnectionIdentifier.key());
return conn;
#else
ASSERT_NOT_REACHED();
return IPC::Connection::Identifier();
@@ -1234,7 +1244,7 @@ NetworkProcessConnection& WebProcess::ensureNetworkProcessConnection()
RELEASE_ASSERT(RunLoop::isMain());

// If we've lost our connection to the network process (e.g. it crashed) try to re-establish it.
if (!m_networkProcessConnection) {
if (!m_networkProcessConnection) {fprintf(stderr,"%s\n",__PRETTY_FUNCTION__);
IPC::Connection::Identifier connectionIdentifier = getNetworkProcessConnection(*parentProcessConnection());

// Retry once if the IPC to get the connectionIdentifier succeeded but the connectionIdentifier we received
@@ -30,17 +30,25 @@

namespace WebKit {

void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&& parameters)
void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters& parameters)
{
fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
notImplemented();
}

void WebProcess::platformSetWebsiteDataStoreParameters(WebProcessDataStoreParameters&&)
{
fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
}

void WebProcess::platformTerminate()
{
fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
}

void WebProcess::platformSetCacheModel(CacheModel cacheModel)
{
fprintf(stderr, "%s\n", __PRETTY_FUNCTION__);
notImplemented();
}

@@ -26,25 +26,31 @@
#include "config.h"
#include "WebProcessMainUnix.h"

#include "AuxiliaryProcessMain.h"
#include "AuxiliaryProcessMainHaiku.h"
#include "WebProcess.h"

#include <Application.h>
namespace WebKit {

using namespace WebCore;

class WebProcessMain final : public AuxiliaryProcessMainBase {
public:
bool platformInitialize() override
{
BApplication* app = new BApplication("application/x-vnd.haiku-webkit.webprocess");
return true;
}
namespace WebKit {
class WebProcessMainBase: public AuxiliaryProcessMainBase
{
public:
ProcessApp* app = nullptr;
bool platformInitialize(char* sign) override
{
app = new ProcessApp(sign);
return true;
}
void runApp()
{
app->Run();
}
};

int WebProcessMainUnix(int argc, char** argv)
{
return AuxiliaryProcessMain<WebProcess, WebProcessMain>(argc, argv);
return AuxiliaryProcessMain<WebProcess,WebProcessMainBase>(argc,argv);
}

} // namespace WebKit
@@ -0,0 +1,12 @@
resource app_signature "application/x-vnd.haiku-webkit.webprocess";
resource app_version {
major = 1,
middle = 7,
minor = 0,

variety = B_APPV_DEVELOPMENT,
internal = 0,

short_info = "WebProcess backend for Haiku WebKit",
long_info = "Copyright 2014-2019 Haiku, Inc."
};
@@ -38,7 +38,6 @@ LIST(APPEND WebKitLegacy_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/svg"
"${WEBCORE_DIR}/svg/animation"
"${WEBCORE_DIR}/svg/properties"
"${WEBCORE_DIR}/style"
"${WTF_DIR}"
"${LIBXML2_INCLUDE_DIR}"
"${LIBXSLT_INCLUDE_DIR}"
@@ -18,6 +18,8 @@ add_definitions(-D_GLIBCXX_USE_C99_MATH)
set(ENABLE_WEBKIT ON)
set(ENABLE_WEBKIT_LEGACY ON)

set(USE_ANGLE_EGL ON)

if ("${CMAKE_BUILD_TYPE}" STREQUAL "debug" AND NOT SHARED_CORE)
message(FATAL_ERROR "Turn on the SHARED_CORE flag to make a debug build - e.g.\n build-webkit --haiku --debug --cmakeargs=\"-DSHARED_CORE=ON\".\n")
endif ()
@@ -0,0 +1,118 @@
/*
* Copyright 2019, RAJAGOPALAN-GANGADHARAN <g.raju2000@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/



#include <Window.h>
#include <View.h>

#include "App.h"



enum
{
M_BUTTON_GO_URL = 'urlg'
};

App::App(void)
: BApplication("application/x-vnd.lh-MiniBrowser")
{
//initialize counter
fCount = 0;

//create window
frame.Set(100,100,500,400);
myWindow = new BWindow(frame,"MiniBrowser"
, B_TITLED_WINDOW
, B_ASYNCHRONOUS_CONTROLS
| B_QUIT_ON_WINDOW_CLOSE);
myWindow->Show();
}

void App::LocalMessage(BMessage* message)
{
const char* idTempStr;
BLooper* looperTemp;
message->FindString("identifier",&idTempStr);
message->FindPointer("looper",(void**)&looperTemp);
string id(idTempStr);
message = DetachCurrentMessage();
if(messengerMapping[id])
{
/*
We have recieved the other process's BMessenger data just send it to our workqueue
*/
looperTemp->PostMessage(messengerMapping[id],looperTemp->PreferredHandler());
}
else
{
/*
Messenger is not yet known save it for later use
*/
looperMapping[id] = looperTemp;
}

}
void App::GlobalMessage(BMessage* message)
{
const char* idTempStr;
message->FindString("identifier",&idTempStr);
string id(idTempStr);
message = DetachCurrentMessage();
if(looperMapping[id])
{
/*
We know about the looper so send the message directly then
*/
BLooper* temp = looperMapping[id];
temp->PostMessage(message,temp->PreferredHandler());
}
else
{
/*
We dont know about the looper yet so put in the mapping of messengers
*/
messengerMapping[id] = message;
}
}

void
App::MessageReceived(BMessage *message)
{
switch(message->what)
{
case 'inil':
LocalMessage(message);
break;
case 'inig':
GlobalMessage(message);
break;

default:
BApplication::MessageReceived(message);

}
}
void App::ReadyToRun()
{
webView = new BWebView(frame,myWindow);
this->testLoader();
}
void
App::testLoader()
{
webView->loadHTML();
}

int
main (void)
{
App *app = new App();
app->Run();
delete app;
return 0;
}

@@ -0,0 +1,37 @@
/*
* Copyright 2019, RAJAGOPALAN-GANGADHARAN <g.raju2000@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef APP_H
#define APP_H

#include <Application.h>
#include <Button.h>
#include <String.h>
#include <TextControl.h>
#include <map>
#include <MessageQueue.h>

#include "WebView.h"
using namespace std;

class App : public BApplication
{
public:
App(void);
void MessageReceived(BMessage *message);
void ReadyToRun();
void testLoader();
void LocalMessage(BMessage*);
void GlobalMessage(BMessage*);
private:
int32 fCount;
BWindow *myWindow;
BWebView* webView;
BRect frame;
status_t result;
map<string,BLooper*> looperMapping;
map<string,BMessage*> messengerMapping;
};

#endif
@@ -0,0 +1,8 @@
/*
* Copyright 2019, RAJAGOPALAN-GANGADHARAN <g.raju2000@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/

#include "BrowserWindow.h"

BrowserWindow::
@@ -0,0 +1,19 @@
/*
* Copyright 2019, RAJAGOPALAN-GANGADHARAN <g.raju2000@gmail.com>
* All rights reserved. Distributed under the terms of the MIT license.
*/
#ifndef BrowserWindow_H
#define BrowserWindow_H

#include <Window.h>
#include <View.h>
#include <WebKit/WebView.h>

class BrowserWindow:public BWindow{
public:
BWebView* webView;

};


#endif // _H
@@ -1,9 +1,34 @@
SET(MiniBrowser_SOURCES
${TOOLS_DIR}/MiniBrowser/haiku/App.cpp
)

INCLUDE_DIRECTORIES(
"${WEBKIT_DIR}/UIProcess/API/haiku"
)

SET(MiniBrowser_LIBRARIES
WebKit
WebCore
JavaScriptCore
${LIBXML2_LIBRARIES}
${LIBXSLT_LIBRARIES}
${SQLITE_LIBRARIES}
${ICU_I18N_LIBRARIES}
${ICU_LIBRARIES}
be bsd network stdc++ translation tracker
)

set(MiniBrowser_LOCAL_INCLUDE_DIRECTORIES
"${WEBCORE_DIR}/css"
"${WEBCORE_DIR}/platform/graphics"
"${WEBCORE_DIR}/platform/graphics/transforms"
"${WEBCORE_DIR}/rendering/shapes"
)

foreach(inc ${MiniBrowser_LOCAL_INCLUDE_DIRECTORIES})
ADD_DEFINITIONS(-iquote ${inc})
endforeach(inc)

ADD_EXECUTABLE(MiniBrowser ${MiniBrowser_SOURCES})
TARGET_LINK_LIBRARIES(MiniBrowser ${MiniBrowser_LIBRARIES})
SET_TARGET_PROPERTIES(MiniBrowser PROPERTIES FOLDER "Tools")