[hackers] [surf] [PATCH] Support user scripts and user styles.

From: Artyom Bologov <mail_AT_aartaka.me>
Date: Sun, 20 Apr 2025 23:21:46 +0400

Hi y'all,

The attached patch adds support for user styles and scripts, two WebKit
APIs for URL-based style/script injection. Mostly just parsing and
injection of those here, but also a new structure (UserContent) and a
bug:

When applying styles (old SiteSpecific ones, from styledir), current
implementation does webkit_user_content_manager_remove_all_style_sheets
and thus disables the ones I've added. How do we approach this? I'm
thinking either

- Storing the applied script inside the SiteSpecific object and only
  removing it, instead of all styles. Lightweight, but changes the
  struct layout.

- Re-injecting all the styles on every page load, along with the old
  site-specific styles. That's a lot of allocations.

- Moving to the user styles infra exclusively. Not a good decision.
  Deprecating stuff is not fun. And the user content allowlist patterns
  are not as flexible as regex either.


Received on Sun Apr 20 2025 - 21:21:46 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 20 2025 - 21:24:39 CEST