[webkit-help] headless port

Derek B. Noonburg derekn at glyphandcog.com
Fri Aug 30 11:35:55 PDT 2013


I'm working on a custom WebKit port that converts HTML to a list of
drawing operations (essentially each GraphicsContext call generates an
entry on the list).  The ultimate goal is an HTML-to-PDF converter.  The
second part of the project will convert the list of drawing operations
to PDF.

This is all being done "headless", without any sort of GUI.

One problem I'm running into is the event loop.  Right now, my code
loads a URL (FrameLoader::load()), and then goes into a loop to handle
timer callbacks (which are set with
WebCore::setSharedTimerFireInterval()).  When loading is finished
(FrameLoaderClient::dispatchDidFinishLoad()), the event loop exits.

That works fine for basic stuff, but doesn't handle asynchronous
JavaScript (e.g., if JavaScript code is waiting on a timer, or for
WebSocket data, etc.) at all.

Is there a good way to handle this?

I have the possibility of adding some JavaScript code to emit some sort
of "finished" signal (as long as the code can still run in a regular
browser).  What would be the easiest way to pick up that signal from the
WebKit side?  I haven't really looked into the JSC code very much yet.

(If this post would be more appropriate on webkit-dev, please let me
know.)

- Derek



More information about the webkit-help mailing list