joachifm / cl-webkit

A binding to WebKitGTK+ for Common Lisp
MIT License
53 stars 16 forks source link

Browser lock-up/gray screen of death when running custom javascript #32

Open ahungry opened 9 years ago

ahungry commented 9 years ago

Hi @joachifm, when I modify your #'simple-browser-main function as follows and run it (after loading the cl-webkit2 and simple-browser.lisp libraries) the browser opens, gives the alert, and then freezes as soon as I click on the alert (which does not close).

If I then tab off the alert to the browser, the browser grays out and is unusable (even a window manager kill command will not close it).

The modified function:

(defun simple-browser-main ()
  "A single-window browser with no keyboard or mouse input.                                                                    
Loads and renders a single web page."
  (gtk:within-main-loop
    (let ((win (make-instance 'gtk:gtk-window))
          (view (make-instance 'webkit2:webkit-web-view)))
      (gobject:g-signal-connect win "destroy"
                                #'(lambda (widget)
                                    (declare (ignore widget))
                                    (gtk:leave-gtk-main)))
      (gtk:gtk-container-add win view)
      (webkit2:webkit-web-view-load-uri view "http://www.example.com")
      (webkit2:webkit-web-view-run-javascript
       view
       "alert(1);"
       (cffi:null-pointer)
       (cffi:null-pointer)
       (cffi:null-pointer))
      (gtk:gtk-widget-show-all win))))

Please also find my own repository I wrote in C to make sure this was an issue with the cl-webkit bindings and not the underlying webkit2 libraries.

https://github.com/ahungry/puny-browser/blob/master/main.c

I'm running Arch Linux and it uses the 4.0.so file for webkit2.

joachifm commented 9 years ago

Thanks for the report. The webkit binding doesn't do anything except call C, so the lisp version should be equivalent to the C version. This is quite vexing ... Seeing as lispkit is switching to QT, I'm not too motivated to look into this problem, however, unless you have some other use for it.

ahungry commented 9 years ago

No urgency, my bug tracking was a result of frustration at being unable to try out and use lispkit.

Probably an issue with cl-cffi-gtk or something :)

Thanks.

joachifm commented 9 years ago

Okay, cool. If you choose to proceed debugging, let me know if you have any questions about the code.