joachifm / cl-webkit

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

Add WebsiteData and WebsiteDataManager #39

Closed aartaka closed 4 years ago

aartaka commented 4 years ago

This add two connected classes form WebKit 2.10+ -- WebsiteData and WebsiteDataManager. These classes can ge useful, given that they simplify the complicated storage management necessary for the modern Web to work.

How Has This Been Tested

(define-public cl-webkit (let ((commit "0ca9d7e469d7a5c5b7ae27dad6a5c1257fe688c8")) (package (name "cl-webkit") (version (git-version "2.4" "3" commit)) (source (origin (method git-fetch) (uri (git-reference (url "https://github.com/aartaka/cl-webkit") (commit commit))) (file-name (git-file-name "cl-webkit" version)) (sha256 (base32 "123cwnj7c3fbmc0yk1rwa6ka4x75i6p8y8hbrpd3hnrf88w35gax")))) (build-system asdf-build-system/sbcl) (inputs (("cffi" ,sbcl-cffi) ("cl-cffi-gtk" ,sbcl-cl-cffi-gtk) ("webkitgtk" ,webkitgtk))) (arguments (#:asd-file "webkit2/cl-webkit2.asd"

:asd-system-name "cl-webkit2"

     #:phases
     (modify-phases %standard-phases
       (add-after 'unpack 'fix-paths
         (lambda* (#:key inputs #:allow-other-keys)
           (substitute* "webkit2/webkit2.init.lisp"
             (("libwebkit2gtk" all)
              (string-append
               (assoc-ref inputs "webkitgtk") "/lib/" all))))))))
  (home-page "https://github.com/joachifm/cl-webkit")
  (synopsis "Binding to WebKitGTK+ for Common Lisp")
  (description
   "@command{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.") (license license:expat))))

cl-webkit


- These objects are tied to the runtime and testing them in a demo provided with the `cl-webkit` seemed inadequate, so I took the idea "it compiles means it works" as a satisfactory testing mechanism in this case :)

I'll be glad to know what you think of it!
Ambrevar commented 4 years ago

Looking great! This is a very welcome change!

It's also a significant change, so I'd very much like to see a test before merging this. Could you add a demo in which you instantiate the browser with a data manager, say, that stores the data somewhere else?

aartaka commented 4 years ago

Here it is. I've altered the demo to meet the changes. It works and even creates the necessary directory if it's not present!

aartaka commented 4 years ago

I've noticed several Data-Manager-related functions (webkit_web_view_get_website_data_manager and webkit_web_context_get_website_data_manager) and added them here. Also, there were several deprecated pieces of code.

One of these deprecated pieces was defcfun of webkit_web_context_set_disk_cache_directory. Is it used anywhere? Is it safe to remove it?

Ambrevar commented 4 years ago

Looks good to me! :) Please fix the docstring then we can merge.

By the way, this may be the solution to a few important issues in Nyxt, so thank you in advance for taking a shot at this!

aartaka commented 4 years ago

Here you go -- docstring is there. Was it only about the webkit_web_context_set_disk_cache_directory or are there other deprecated functions?

Ambrevar commented 4 years ago

There may be other deprecated functions but as far as this patch is concerned, that's the only one! We'll see later for the rest.