WebKit Porting

Web browsers require lots of GNU software; most notably GLib. Because of this we need to create our own WebKit port. We are using WPE as a starting point because it’s the closet to what we want but it still requires GLib and friends in many places.

Current Status

JavaScriptCore

JavaScriptCore builds, runs and the public API works perfectly; the example code below can be built with c99 a.c -lJavaScriptCore; one can also run /usr/bin/jsc to test it.

#include <stdio.h>
#include <JavaScriptCore/JavaScriptCore.h>

#define N "\n"

JSValueRef ObjectCallAsFunctionCallback(
	JSContextRef ctx, JSObjectRef function,
	JSObjectRef thisObject, size_t argumentCount,
	const JSValueRef arguments[],
	JSValueRef* exception
) {
	puts("Hello, World!");
	return JSValueMakeUndefined(ctx);
}


int main() {
	JSContextGroupRef contextGroup = JSContextGroupCreate();
	JSGlobalContextRef globalContext = JSGlobalContextCreateInGroup(
    		contextGroup, NULL
	);
	JSObjectRef globalObject = JSContextGetGlobalObject(globalContext);
	JSStringRef logFunctionName = JSStringCreateWithUTF8CString("log");
	JSObjectRef functionObject = JSObjectMakeFunctionWithCallback(
    		globalContext,
    		logFunctionName,
    		&ObjectCallAsFunctionCallback
	);

	JSObjectSetProperty(
    		globalContext,
    		globalObject,
    		logFunctionName,
    		functionObject,
    		kJSPropertyAttributeNone,
    		NULL
	);

	JSStringRef logCallStatement = JSStringCreateWithUTF8CString(
   	 	"log()" N
		"log()" N
		"log()" N
		"log()" N
		"log()" N
		"log()" N
	);

	JSEvaluateScript(globalContext, logCallStatement, NULL, NULL, 1, NULL);
}

WebKit

Although the actual meat of WebKit does now build; it can not be used yet due to the lack of proper API. This still needs a lot of work to allow applications suchk as browsers to use WebKit.

TODO: