cl-webkit icon indicating copy to clipboard operation
cl-webkit copied to clipboard

A binding to WebKitGTK+ for Common Lisp

  • cl-webkit - WebKitGTK+ binding for Common Lisp

** About cl-webkit is a binding to [WebKitGTK+] for Common Lisp, currently targeting WebKit version 2. The WebKitGTK+ library adds web browsing capabilities to an application, leveraging the full power of the WebKit browsing engine.

** API overview The cl-webkit API closely follows the WebKit2 API, with the exception that class based interfaces are preferred over functional interfaces in cases where both are provided.

That is, ~*_{new,get,set}~ methods are excluded in favour of ~make-instance~ and slot accessors wherever possible.

For documentation on how to use the WebKit2 API, please refer to the C API documentation.

Backwards compatibility (with older WebKit2 API versions) is not a priority. The binding targets the latest version of Webkit2Gtk+ available on mainstream distributions.

** Dependencies

  • A working installation of WebKit2GTK+ (whichever package provides ~libwebkit2gtk-4.0.so~, e.g., ~libwebkit2gtk~ on Debian).
  • A [CFFI] compatible Common Lisp implementation. The package is developed using [SBCL] but should work on any implementation that supports CFFI.
  • A recent checkout of [cl-cffi-gtk]

** Installation Assuming you have [Quicklisp] installed, do

  1. Clone to =~/common-lisp/quicklisp/local-projects/cl-webkit=
  2. lisp

  3. (ql:quickload :cl-webkit2)

*** Testing To run tests, you need to additionally install [[https://github.com/hawkir/calispel][Calispel]], [[https://github.com/Shinmera/float-features][float-features]] and [[https://github.com/lispci/fiveam][FiveAM]] (all of these are available via Quicklisp). After that, simply running =(asdf:test-system :cl-webkit2)= should be enough.

** Contributing Contributing implies an agreement to redistribute the work under the project's license (see below); please make sure that you own the rights to the work you contribute.

** Resources

  • [[WebKit2GTK+ Stable API reference]]
  • [[http://common-lisp.net/project/cffi/manual/html_node/index.html][CFFI User Manual]]

** Change Log *** 3.5.10

  • Add message sending to all extensions in WebkitWebWebContext.
  • Add user script handlers support.
  • Fix the type passed to language-related functions. *** 3.5.9
  • Add micro Webkit version to =features=. *** 3.5.8
  • Remove support for Webkit shared lib version 5.0 due to libsoup conflicts. *** 3.5.7
  • Add bindings for WebKitUserContentFilterStore.
  • Add more properties for WebKitWebView.
  • Add WEBKIT_HIT_TEST_RESULT_CONTEXT_SELECTION value for WebKitHitTestResult enum.
  • Fix several implicit dependency issues. *** 3.5.6
  • Fix SoapMessageHeaders' access from WebKitURIResponse. *** 3.5.5
  • Add SoapMessageHeaders bindings.
  • Use them everywhere, in custom scheme processing too. *** 3.5.4
  • Add WebKitWebResource bindings.
  • Add WebKitUriSchemeResponse bindings and use them in scheme callbacks by default.
  • Add GAction-related functions for WebKitContextMenuAction. *** 3.5.3
  • Fix typing for context menu item-related functions. *** 3.5.2
  • Fix string processing for custom URLs -- no longer segfaulting on long strings. *** 3.5.1
  • Add support for libwebkit2gtk-5.0.
  • Add advanced editing commands with =webkit-web-view-execute-editing-command-with-arguments= as the way to execute those.
  • Bugfixes in custom schemes and color chooser requests. *** 3.5.0
  • Add webkit-web-view-set-cors-allowlist, a binding for a recently (2.34.1) introduced =webkit_web_view_set_cors_allowlist=.
  • Bug Fix: Catch any condition in C callbacks to avoid crashing the whole Lisp process due to unhandled conditions. *** 3.4.0
  • Add a binding for =webkit_web_view_try_close=. *** 3.3.0
  • Add full bindings for =WebKitURIRequest= and =WebKitNotification=.
  • Support libwebkit2gtk-4.1.
  • Rename starred functions to non-starred for consistency:
    • =webkit-web-view-can-execute-editing-command*= -> =webkit-web-view-can-execute-editing-command=.
    • =webkit-web-view-send-message-to-page*= -> =webkit-web-view-send-message-to-page= *** 3.2.0
  • Add =webkit-web-view-can-execute-editing-command*= for easier execution command checking. *** 3.1.1
  • Export =webkit-web-view-execute-editing-command= properly. *** 3.1.0 Additions:
  • =webkit-web-view-send-message-to-page*= to send =WebKitUserMesssages= in a nicer Lispy way.
  • More =WebKitSettings= settings.
  • Bind all the subtypes of =WebKitPermissionRequest=.
  • Bindings for:
    • =webkit_user_content_manager_remove_script=
    • =webkit_user_content_manager_remove_style_sheet=
  • New =g-variant-get-maybe-string=: checks =GVariant= for nullness and returns a contained string if possible.
  • The =WebKitURISchemeRequest= callbacks run on separate thread now.
  • =make-jsc-function= should return the original =JSCValue= as a second value. Minor API-breaking changes:
  • =webkit-web-context-register-uri-scheme-callback= now has one less optional arguments. Bug Fixes:
  • Fix mistyped JSC-related exports.
  • Use :string type instead of :pointer for =WebKitUserMessage= names.
  • webkit2.uri-response is not loaded in cl-webkit.asd. *** 3.0.0
  • Make =webkit-web-view-evaluate-javascript= process the returned values and turn them into the matching Lisp values (see =jsc-value-to-lisp= docstring for transformation rules).
  • The callback to the =webkit-web-view-evaluate-javascript= now accepts two required arguments -- the Lispy data, transformed from the results of code evaluation, and an original [[https://webkitgtk.org/reference/jsc-glib/2.32.1/JSCValue.html][JSCValue]] it was transformed from.
  • Add tests (webkit2/tests/ subdirectory and =cl-webkit2/tests= system), mostly for JS evaluation results.

** Copying cl-webkit is distributed under the MIT license.

Please note that this licence only covers the binding itself. Refer to the distribution terms of the third-party dependencies for details.