pywebkitgtk - adding DOM javascript executing and evaluation; next step, addEventListener etc.
folks, hi, i realise it's bad form to reply to your own posts but i thought i'd keep people updated, being more important than worrying about that. _really_ long day but i worked out that yes, Document::addEventListener is the right place, yes, adding this: gboolean webkit_web_frame_add_event_listener(WebKitWebFrame* frame) is reasonable, yes, grabbing the frame->document() is ok, and yes, i now have a printf statement in c-code which prints "hacked event callback click" when you have called, from pywebkitgtk, main_frame.add_window_event_listener() and subsequently click on the document. i.e. i done it. hooray. next stop is to add in a python function callback to WebFrame.add_window_event_listener, and to work out how that gets called with WebCore::Event. might just do it as gdk signals. this _should_ be quite straightforward. regarding the javascript execution and evaluation, whilst i realise that it's not ideal - to have potentially tens of thousands of snippets of javascript code being executed, as a "first cut" it'll do nicely, and, whilst ultimately i'll not end up using it - because there will be some lovely DOM functions in c that can be wrapped in python hint hint - that doesn't mean "throw away the javascript execution" i've added, because you can guarantee it has more uses than wot i want it for. creating and executing random bits of javascript should always be nice for some poor bugger to give themselves a headache over, bless 'em. l.
participants (1)
-
Luke Kenneth Casson Leighton