diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 00000000..ce9dfc0a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [magreenblatt] diff --git a/.gitignore b/.gitignore index e7bc7d07..d9565ba0 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,6 @@ Thumbs.db /tools/buildtools/external_bin /tools/buildtools/linux64/clang-format /tools/buildtools/mac/clang-format +# Misc working directories +/tmp /tools/buildtools/win/clang-format.exe diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..60a79ab6 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,81 @@ +# CLAUDE.md + +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. + +## Project overview + +JCEF is a Java wrapper around the C++ Chromium Embedded Framework (CEF). It is a hybrid Java + native (C++/Obj-C) project bound together by JNI. JCEF tracks a specific CEF release branch — the active version is set by `CEF_VERSION` in `CMakeLists.txt`, and the matching CEF binary distribution is downloaded by `cmake/DownloadCEF.cmake` into `third_party/cef/` at configure time. + +## Build + +The build is driven by CMake and **must** run inside a directory literally named `jcef_build/` at the repo root — `tools/run.sh`, `tools/make_distrib.sh`, etc. hard-code that path. + +```sh +mkdir jcef_build && cd jcef_build + +# macOS (arm64 host): +cmake -G "Ninja" -DPROJECT_ARCH="arm64" -DCMAKE_BUILD_TYPE=Release .. +ninja +# Or generate Xcode: cmake -G "Xcode" -DPROJECT_ARCH="arm64" .. + +# Linux: +cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release .. +ninja + +# Windows (x64): +cmake -G "Visual Studio 17" -A x64 .. +# build via VS or ninja with vcvars64.bat +``` + +Configure-time side effects to be aware of: +- Downloads + extracts the CEF binary distribution. +- Generates `native/jcef_version.h` from CEF headers via `tools/make_version_header.py`. +- Downloads `clang-format` from Google Storage into `tools/buildtools//`. + +Java compilation differs by platform: +- **macOS:** the CMake build invokes Ant (`build.xml`) as a post-build step. It produces `jcef.jar` + `jcef-tests.jar`, bundles everything into `jcef_app.app` via `third_party/appbundler`, and copies the CEF framework + helper apps into the bundle. Requires `ant` (`brew install ant`). +- **Linux/Windows:** Java is compiled separately with `tools/compile.{sh,bat} ` (e.g. `linux64`, `win64`); the CMake build only handles native code. + +## Run / test / package + +```sh +# Launch the test app (Linux/Windows). On macOS run jcef_build/native/Release/jcef_app.app. +tools/run.sh [args...] + +# JUnit tests under java/tests/junittests via junit-platform-console-standalone. +tools/run_tests.sh [extra junit args...] + +# Build a redistributable in binary_distrib//. +tools/make_distrib.sh +``` + +`` is `linux32`, `linux64`, `macosx64`, `win32`, or `win64`. + +## Code style + +Chromium coding style for both C++ and Java. Run `tools/fix_style.sh [path...]` (which calls `tools/fix_style.py`) to apply clang-format. clang-format is downloaded by CMake into `tools/buildtools/`, so a configure step must have run first. + +## Architecture + +The project is organized as **Java API ↔ JNI bridge ↔ CEF C++**. + +### Java side (`java/org/cef/`) +- `CefApp` — global singleton; owns CEF process lifecycle and state machine (`CefAppState`). +- `CefClient` — per-browser client object that fans handler callbacks out to user-registered `Cef*Handler` interfaces. +- `browser/` — `CefBrowser` interface plus two implementations: `CefBrowserOsr` (off-screen rendering, OpenGL via JOGL) and `CefBrowserWr` (windowed rendering); `CefBrowserFactory` picks one. macOS uses the extra `browser/mac/CefBrowserWindowMac.java`. +- `handler/` — observer-style callback interfaces (`CefLifeSpanHandler`, `CefLoadHandler`, `CefRequestHandler`, …) each paired with an `*Adapter` no-op base class. +- `callback/`, `misc/`, `network/` — value/callback types mirrored to native. + +### Native side (`native/`) +- Files ending in `_N.cpp/.h` (e.g. `CefBrowser_N.cpp`) implement the JNI methods of the matching Java class with the `_N` suffix (e.g. `org.cef.browser.CefBrowser_N`). Headers are machine-generated via `javah`/`javac -h` — regenerate with `tools/make_all_jni_headers.{sh,bat} ` (or `make_jni_header.{sh,bat} ` for one class). When you add a new `_N` Java class, also add it to `make_all_jni_headers.*`. +- Non-`_N.cpp` files (`client_handler.cpp`, `*_handler.cpp`, `client_app.cpp`, `context.cpp`, …) implement the CEF C++ side: they receive callbacks from CEF and dispatch them up into Java via the helpers in `jni_util.{h,cpp}` and `jni_scoped_helpers.{h,cpp}`. +- Platform-specific code is split into `*_linux.cpp`, `*_mac.mm`, `*_win.cpp`, `*_posix.cpp`, plus `temp_window_{x11,mac,win}` and `critical_wait_{posix,win}`. CMake's `APPEND_PLATFORM_SOURCES` selects the right set per OS. +- `jcef_helper.cpp` builds a separate `jcef_helper`/`jcef Helper` executable — Chromium's multi-process model requires a helper binary for renderer/GPU/etc. processes. + +### Build outputs +- `jcef_build/native//` — `libjcef.{so,dylib}` / `jcef.dll`, the helper executable(s), and (on macOS) `jcef_app.app` containing the framework + Helper bundles. +- `out/` — Ant-produced Java class files / jars on macOS; mirrored layout used by `tools/compile.sh` on other platforms. + +## Other notes + +- macOS app launches require these JVM flags (already wired into `build.xml` and `run.sh`): `--add-opens=java.desktop/sun.{awt,lwawt,lwawt.macosx}=ALL-UNNAMED`, `--add-opens=java.desktop/java.awt=ALL-UNNAMED`, `--enable-native-access=ALL-UNNAMED`. Anything that calls JCEF off-bundle needs the same flags. diff --git a/CMakeLists.txt b/CMakeLists.txt index c7be0cb1..a1cd92d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -129,7 +129,7 @@ set_property(GLOBAL PROPERTY OS_FOLDERS ON) # Specify the CEF distribution version. if(NOT DEFINED CEF_VERSION) - set(CEF_VERSION "143.0.14+gdd46a37+chromium-143.0.7499.193") + set(CEF_VERSION "146.0.10+g8219561+chromium-146.0.7680.179") endif() # Determine the platform. diff --git a/README.md b/README.md index aa44352e..d6ee5836 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ The Java Chromium Embedded Framework (JCEF) is a simple framework for embedding * Issue Tracker - https://github.com/chromiumembedded/java-cef/issues * Downloads - https://github.com/jcefmaven/jcefbuild * Maven/Gradle Artifacts - https://github.com/jcefmaven/jcefmaven -* Donations - http://www.magpcss.org/ceforum/donate.php +* Donations - https://github.com/sponsors/magreenblatt # Introduction diff --git a/java/org/cef/handler/CefLoadHandler.java b/java/org/cef/handler/CefLoadHandler.java index 4f0bb831..a70faf0f 100644 --- a/java/org/cef/handler/CefLoadHandler.java +++ b/java/org/cef/handler/CefLoadHandler.java @@ -56,7 +56,6 @@ enum ErrorCode { ERR_ADDRESS_UNREACHABLE(-109), ERR_SSL_CLIENT_AUTH_CERT_NEEDED(-110), ERR_TUNNEL_CONNECTION_FAILED(-111), - ERR_NO_SSL_VERSIONS_ENABLED(-112), ERR_SSL_VERSION_OR_CIPHER_MISMATCH(-113), ERR_SSL_RENEGOTIATION_REQUESTED(-114), ERR_PROXY_AUTH_UNSUPPORTED(-115), @@ -80,13 +79,10 @@ enum ErrorCode { ERR_NAME_RESOLUTION_FAILED(-137), ERR_NETWORK_ACCESS_DENIED(-138), ERR_TEMPORARILY_THROTTLED(-139), - ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT(-140), ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED(-141), ERR_MSG_TOO_BIG(-142), ERR_WS_PROTOCOL_ERROR(-145), ERR_ADDRESS_IN_USE(-147), - ERR_SSL_HANDSHAKE_NOT_COMPLETED(-148), - ERR_SSL_BAD_PEER_PUBLIC_KEY(-149), ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN(-150), ERR_CLIENT_AUTH_CERT_TYPE_UNSUPPORTED(-151), ERR_SSL_DECRYPT_ERROR_ALERT(-153), @@ -151,9 +147,6 @@ enum ErrorCode { ERR_MALFORMED_IDENTITY(-329), ERR_CONTENT_DECODING_FAILED(-330), ERR_NETWORK_IO_SUSPENDED(-331), - ERR_SYN_REPLY_NOT_RECEIVED(-332), - ERR_ENCODING_CONVERSION_FAILED(-333), - ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT(-334), ERR_NO_SUPPORTED_PROXIES(-336), ERR_HTTP2_PROTOCOL_ERROR(-337), ERR_INVALID_AUTH_CREDENTIALS(-338), @@ -228,7 +221,6 @@ enum ErrorCode { ERR_CERT_DATABASE_CHANGED(-714), ERR_DNS_MALFORMED_RESPONSE(-800), ERR_DNS_SERVER_REQUIRES_TCP(-801), - ERR_DNS_SERVER_FAILED(-802), ERR_DNS_TIMED_OUT(-803), ERR_DNS_CACHE_MISS(-804), ERR_DNS_SEARCH_EMPTY(-805), diff --git a/native/jni_util.cpp b/native/jni_util.cpp index 0b2fcfd0..02e24a51 100644 --- a/native/jni_util.cpp +++ b/native/jni_util.cpp @@ -521,8 +521,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) { ERR_SSL_CLIENT_AUTH_CERT_NEEDED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_TUNNEL_CONNECTION_FAILED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_NO_SSL_VERSIONS_ENABLED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_SSL_VERSION_OR_CIPHER_MISMATCH, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", @@ -569,8 +567,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) { ERR_NETWORK_ACCESS_DENIED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_TEMPORARILY_THROTTLED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_HTTPS_PROXY_TUNNEL_RESPONSE_REDIRECT, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_MSG_TOO_BIG, @@ -579,10 +575,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) { ERR_WS_PROTOCOL_ERROR, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_ADDRESS_IN_USE, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_SSL_HANDSHAKE_NOT_COMPLETED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_SSL_BAD_PEER_PUBLIC_KEY, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", @@ -709,12 +701,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) { ERR_CONTENT_DECODING_FAILED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_NETWORK_IO_SUSPENDED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_SYN_REPLY_NOT_RECEIVED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_ENCODING_CONVERSION_FAILED, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_UNRECOGNIZED_FTP_DIRECTORY_LISTING_FORMAT, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_NO_SUPPORTED_PROXIES, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", @@ -864,8 +850,6 @@ jobject NewJNIErrorCode(JNIEnv* env, cef_errorcode_t errorCode) { ERR_DNS_MALFORMED_RESPONSE, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_DNS_SERVER_REQUIRES_TCP, jerrorCode); - JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", - ERR_DNS_SERVER_FAILED, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode", ERR_DNS_TIMED_OUT, jerrorCode); JNI_CASE(env, "org/cef/handler/CefLoadHandler$ErrorCode",