this would require to retrieve the JSGlobalContextRef and some functions as well as access to the required header files at compile time.
It sounds like this is basically the functionality that -[WebFrame windowObject], -[WebFrame globalContex] and the webView:didClearWindowObject:forFrame: delegate method available in the Mac port. This would seem to map to two WebKitFrame methods and a signal in the Gtk API.
I mailed Michael a patch that implements most of this functionality recently. It was blocked by a few minor issues. Are you able to complete it and attach it for review?
This looks like a tracking bug for a few distinct bugs for which I've added dependencies.
Created attachment 17639 [details]
Landed in r28313.
http://bugs.webkit.org/show_bug.cgi?id=16029 is fixed, applications will have to do:
Comment on attachment 17639 [details]
Already r'ed by aroben, bug closed.