Skip to content

[GTK] Call WebKitGTK through the FFM API instead of JNI - #3947

Open
akurtakov wants to merge 4 commits into
eclipse-platform:masterfrom
akurtakov:webkitgtk-ffm
Open

akurtakov wants to merge 4 commits into
eclipse-platform:masterfrom
akurtakov:webkitgtk-ffm

Conversation

@akurtakov

Copy link
Copy Markdown
Member

The new WebKitFFM class looks up the WebKitGTK library with SymbolLookup
and calls its functions, as well as the libsoup and JavaScriptCore ones,
through downcall handles that are all created on the first call of any
of them. A function missing from the installed WebKitGTK version does
nothing and returns 0, as the JNI glue did. WebKitFFM has the same
signatures and constants as WebKitGTK, and WebKit now uses it instead,
with the callbacks still on SWT's Callback. WebKitGTK and its JNI glue
are left unchanged, so they can be removed separately.

To test: run Test_org_eclipse_swt_browser_Browser on GTK3 and GTK4 without libswt-webkit-gtk on the library path.

Stacked on #3946 (Require Java 25), whose commit this PR also contains; only the last commit is new.

@akurtakov

Copy link
Copy Markdown
Member Author

There is no other change but mechanical change to use FFM instead of JNI in order to make the port easier to review and test. Any possible improvement is to be handled later.

@github-actions

github-actions Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

 1 124 files  ±0   1 124 suites  ±0   1h 44m 0s ⏱️ + 5m 37s
 5 402 tests ±0   5 374 ✅ ±0     28 💤 ±0  0 ❌ ±0 
31 778 runs  ±0  28 202 ✅ ±0  3 576 💤 ±0  0 ❌ ±0 

Results for commit 542f31c. ± Comparison against base commit 66873f7.

♻️ This comment has been updated with latest results.

@vogella

vogella commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Please wait with the merge, I want to review

@akurtakov

Copy link
Copy Markdown
Member Author

Sure I don't plan to urge this one , it will take enough time to clean up the noise from moving to Java 25 . I hope that it can't be wrapped up by end of next week.

@vogella

vogella commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Sure I don't plan to urge this one , it will take enough time to clean up the noise from moving to Java 25 . I hope that it can't be wrapped up by end of next week.

if you merge the Java 25, I can help with cleaning up the new warnings in SWT.

Raise the BREE of all bundles to JavaSE-25 and bump their minor
versions. The CI builds already use Java 25. This allows using the
Foreign Function & Memory API (final since Java 22) instead of JNI.
@akurtakov
akurtakov force-pushed the webkitgtk-ffm branch 2 times, most recently from 8a50e85 to 5b74e86 Compare December 4, 2026 11:54
With Java 25 the compiler warns about every lambda parameter that is
not used. Name these parameters _ (unnamed variables, Java 22).
DeflaterOutputStream does not end a Deflater passed to it, so its
native memory was only freed by the cleaner. Close the Deflater with
try-with-resources; it is AutoCloseable since Java 25, and the compiler
reports the leak.
The new WebKitFFM class looks up the WebKitGTK library with SymbolLookup
and calls its functions, as well as the libsoup and JavaScriptCore ones,
through downcall handles that are all created on the first call of any
of them. A function missing from the installed WebKitGTK version does
nothing and returns 0, as the JNI glue did. WebKitFFM has the same
signatures and constants as WebKitGTK, and WebKit now uses it instead,
with the callbacks still on SWT's Callback. WebKitGTK and its JNI glue
are left unchanged, so they can be removed separately.

Assisted-by: Anthropic Claude Code (claude-opus-5-5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants