chore(deps): bump purego-cef to v0.14.1
v0.14.0 pinned the CEF API 15000 contract and fixed the struct ABI corruption that made BrowserSettings.BackgroundColor land on chrome_status_bubble (transparent windowless canvas). v0.14.1 restores the global function bindings dropped by that regeneration (DictionaryValueCreate, V8ContextGetCurrentContext, all *Create factories) and fixes global factory ownership so created objects are adopted without a leaked reference. This makes the white-canvas fix in this branch effective: the opaque white BrowserSettings.BackgroundColor now actually reaches libcef.
- commit
- 902c404508da47722a324d2f14b2a4cfc04a2812
- author
- brice · · 2026-07-21 19:07 UTC
- parent
- 1dc7dd4
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
75 files · +1836 -1983
M go.mod +1 -1
| @@ -6,7 +6,7 @@ require ( | |||
| 6 | 6 | github.com/a-h/templ v0.3.1020 | |
| 7 | 7 | github.com/andybalholm/brotli v1.2.2 | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | |
| 9 | - | github.com/bnema/purego-cef v0.13.4 | |
| 9 | + | github.com/bnema/purego-cef v0.14.1 | |
| 10 | 10 | github.com/bnema/purego-cef2gtk v0.8.5 | |
| 11 | 11 | github.com/bnema/purego-pipewire v0.1.5 | |
| 12 | 12 | github.com/bnema/purego-sqlite v0.1.4 | |
| @@ -6,7 +6,7 @@ require ( | |||||
| 6 | github.com/a-h/templ v0.3.1020 | 6 | github.com/a-h/templ v0.3.1020 | ||
| 7 | github.com/andybalholm/brotli v1.2.2 | 7 | github.com/andybalholm/brotli v1.2.2 | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.4 | 8 | github.com/bnema/purego v0.11.0-bnema.4 | ||
| 9 | - | github.com/bnema/purego-cef v0.13.4 | 9 | + | github.com/bnema/purego-cef v0.14.1 |
| 10 | github.com/bnema/purego-cef2gtk v0.8.5 | 10 | github.com/bnema/purego-cef2gtk v0.8.5 | ||
| 11 | github.com/bnema/purego-pipewire v0.1.5 | 11 | github.com/bnema/purego-pipewire v0.1.5 | ||
| 12 | github.com/bnema/purego-sqlite v0.1.4 | 12 | github.com/bnema/purego-sqlite v0.1.4 | ||
M go.sum +2 -2 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_browser_gen.go +15 -2 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_command_line_gen.go +15 -2 generated file: collapsed
A vendor/github.com/bnema/purego-cef/cef/cef_component_updater_gen.go +323 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_cookie_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_drag_data_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_image_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_media_router_gen.go +24 -41 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_menu_model_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_parser_gen.go +10 -4 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_preference_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_print_settings_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_process_message_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_request_context_gen.go +16 -3 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_request_gen.go +42 -3 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_resource_bundle_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_response_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_shared_memory_region_gen.go +3 -3 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_shared_process_message_builder_gen.go +20 -4 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_stream_gen.go +34 -5 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_task_gen.go +15 -2 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_task_manager_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_thread_gen.go +14 -1 generated file: collapsed
A vendor/github.com/bnema/purego-cef/cef/cef_types_component_gen.go +45 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_types_content_settings_gen.go +72 -79 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_types_gen.go +59 -52 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_urlrequest_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_v8_gen.go +166 -19 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_values_gen.go +62 -7 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_waitable_event_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_xml_reader_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/cef_zip_reader_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/test_cef_api_version_test__gen.go +86 -871 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/test_cef_test_server_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/test_cef_translator_test__gen.go +92 -50 generated file: collapsed
A vendor/github.com/bnema/purego-cef/cef/v8_helpers.go +19 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_browser_view_gen.go +15 -2 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_display_gen.go +17 -4 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_label_button_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_menu_button_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_panel_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_scroll_view_gen.go +14 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_textfield_gen.go +14 -60 generated file: collapsed
M vendor/github.com/bnema/purego-cef/cef/views_cef_window_gen.go +14 -1 generated file: collapsed
A vendor/github.com/bnema/purego-cef/internal/capi/cef_component_updater_gen.go +130 -0 generated file: collapsed
A vendor/github.com/bnema/purego-cef/internal/capi/cef_types_component_gen.go +11 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/capi/cef_types_gen.go +1 -1 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/capi/cef_v8_gen.go +44 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/capi/register_gen.go +2 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/capi/test_cef_api_version_test__gen.go +0 -459 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/capi/views_cef_textfield_gen.go +33 -107 generated file: collapsed
A vendor/github.com/bnema/purego-cef/internal/cefapi/contract.go +11 -0 generated file: collapsed
M vendor/github.com/bnema/purego-cef/internal/loader/loader.go +23 -18
| @@ -6,13 +6,16 @@ import ( | |||
| 6 | 6 | "fmt" | |
| 7 | 7 | "os" | |
| 8 | 8 | "path/filepath" | |
| 9 | - | "strconv" | |
| 9 | + | "unsafe" | |
| 10 | 10 | ||
| 11 | 11 | "github.com/bnema/purego" | |
| 12 | + | "github.com/bnema/purego-cef/internal/cefapi" | |
| 12 | 13 | ) | |
| 13 | 14 | ||
| 14 | - | const defaultCEFVersion = 147 | |
| 15 | + | const defaultCEFVersion = cefapi.MinimumMajor | |
| 15 | 16 | const cefVersionInfoChromeMajor = 4 | |
| 17 | + | const cefAPIVersion = cefapi.Version | |
| 18 | + | const cefAPILinuxHash = cefapi.LinuxHash | |
| 16 | 19 | ||
| 17 | 20 | var ( | |
| 18 | 21 | userHomeDir = os.UserHomeDir | |
| @@ -72,18 +75,8 @@ func defaultPathExists(path string) bool { | |||
| 72 | 75 | return !errors.Is(err, os.ErrNotExist) | |
| 73 | 76 | } | |
| 74 | 77 | ||
| 75 | - | func targetMajor() int32 { | |
| 76 | - | if raw := os.Getenv("CEF_VERSION"); raw != "" { | |
| 77 | - | if n, err := strconv.ParseInt(raw, 10, 32); err == nil && n >= 0 { | |
| 78 | - | return int32(n) | |
| 79 | - | } | |
| 80 | - | } | |
| 81 | - | return defaultCEFVersion | |
| 82 | - | } | |
| 83 | - | ||
| 84 | - | // configureAPIVersion calls cef_api_hash to configure the API version. | |
| 85 | - | // CEF 133+ requires this before cef_initialize — without it, | |
| 86 | - | // cef_api_version() returns -1 and every versioned CToCpp wrapper FATALs. | |
| 78 | + | // configureAPIVersion configures the generated API contract and verifies the | |
| 79 | + | // platform ABI hash returned by libcef before any C API symbols are used. | |
| 87 | 80 | func configureAPIVersion(handle uintptr) error { | |
| 88 | 81 | sym, err := purego.Dlsym(handle, "cef_api_hash") | |
| 89 | 82 | if err != nil { | |
| @@ -91,9 +84,21 @@ func configureAPIVersion(handle uintptr) error { | |||
| 91 | 84 | } | |
| 92 | 85 | var apiHash func(int32, int32) uintptr | |
| 93 | 86 | purego.RegisterFunc(&apiHash, sym) | |
| 94 | - | // 999999 = CEF_API_VERSION_EXPERIMENTAL (use all available API). | |
| 95 | - | // entry 0 = CEF_API_HASH_PLATFORM; return value ignored. | |
| 96 | - | apiHash(999999, 0) | |
| 87 | + | // entry 0 is CEF_API_HASH_PLATFORM. | |
| 88 | + | return validateAPIHashPointer(apiHash(cefAPIVersion, 0)) | |
| 89 | + | } | |
| 90 | + | ||
| 91 | + | func validateAPIHashPointer(value uintptr) error { | |
| 92 | + | if value == 0 { | |
| 93 | + | return fmt.Errorf("CEF API %d returned a nil Linux platform hash", cefAPIVersion) | |
| 94 | + | } | |
| 95 | + | return validateAPIHash(unsafe.String((*byte)(unsafe.Pointer(value)), len(cefAPILinuxHash))) | |
| 96 | + | } | |
| 97 | + | ||
| 98 | + | func validateAPIHash(got string) error { | |
| 99 | + | if got != cefAPILinuxHash { | |
| 100 | + | return fmt.Errorf("CEF API %d Linux platform hash mismatch: got %q want %q", cefAPIVersion, got, cefAPILinuxHash) | |
| 101 | + | } | |
| 97 | 102 | return nil | |
| 98 | 103 | } | |
| 99 | 104 | ||
| @@ -104,7 +109,7 @@ func validateVersion(handle uintptr) error { | |||
| 104 | 109 | } | |
| 105 | 110 | var versionInfo func(int32) int32 | |
| 106 | 111 | purego.RegisterFunc(&versionInfo, sym) | |
| 107 | - | return ensureMinimumVersion(versionInfo(cefVersionInfoChromeMajor), targetMajor()) | |
| 112 | + | return ensureMinimumVersion(versionInfo(cefVersionInfoChromeMajor), defaultCEFVersion) | |
| 108 | 113 | } | |
| 109 | 114 | ||
| 110 | 115 | func ensureMinimumVersion(got, minimum int32) error { | |
| @@ -6,13 +6,16 @@ import ( | |||||
| 6 | "fmt" | 6 | "fmt" | ||
| 7 | "os" | 7 | "os" | ||
| 8 | "path/filepath" | 8 | "path/filepath" | ||
| 9 | - | "strconv" | 9 | + | "unsafe" |
| 10 | 10 | ||||
| 11 | "github.com/bnema/purego" | 11 | "github.com/bnema/purego" | ||
| 12 | + | "github.com/bnema/purego-cef/internal/cefapi" | |||
| 12 | ) | 13 | ) | ||
| 13 | 14 | ||||
| 14 | - | const defaultCEFVersion = 147 | 15 | + | const defaultCEFVersion = cefapi.MinimumMajor |
| 15 | const cefVersionInfoChromeMajor = 4 | 16 | const cefVersionInfoChromeMajor = 4 | ||
| 17 | + | const cefAPIVersion = cefapi.Version | |||
| 18 | + | const cefAPILinuxHash = cefapi.LinuxHash | |||
| 16 | 19 | ||||
| 17 | var ( | 20 | var ( | ||
| 18 | userHomeDir = os.UserHomeDir | 21 | userHomeDir = os.UserHomeDir | ||
| @@ -72,18 +75,8 @@ func defaultPathExists(path string) bool { | |||||
| 72 | return !errors.Is(err, os.ErrNotExist) | 75 | return !errors.Is(err, os.ErrNotExist) | ||
| 73 | } | 76 | } | ||
| 74 | 77 | ||||
| 75 | - | func targetMajor() int32 { | 78 | + | // configureAPIVersion configures the generated API contract and verifies the |
| 76 | - | if raw := os.Getenv("CEF_VERSION"); raw != "" { | 79 | + | // platform ABI hash returned by libcef before any C API symbols are used. |
| 77 | - | if n, err := strconv.ParseInt(raw, 10, 32); err == nil && n >= 0 { | |||
| 78 | - | return int32(n) | |||
| 79 | - | } | |||
| 80 | - | } | |||
| 81 | - | return defaultCEFVersion | |||
| 82 | - | } | |||
| 83 | - | ||||
| 84 | - | // configureAPIVersion calls cef_api_hash to configure the API version. | |||
| 85 | - | // CEF 133+ requires this before cef_initialize — without it, | |||
| 86 | - | // cef_api_version() returns -1 and every versioned CToCpp wrapper FATALs. | |||
| 87 | func configureAPIVersion(handle uintptr) error { | 80 | func configureAPIVersion(handle uintptr) error { | ||
| 88 | sym, err := purego.Dlsym(handle, "cef_api_hash") | 81 | sym, err := purego.Dlsym(handle, "cef_api_hash") | ||
| 89 | if err != nil { | 82 | if err != nil { | ||
| @@ -91,9 +84,21 @@ func configureAPIVersion(handle uintptr) error { | |||||
| 91 | } | 84 | } | ||
| 92 | var apiHash func(int32, int32) uintptr | 85 | var apiHash func(int32, int32) uintptr | ||
| 93 | purego.RegisterFunc(&apiHash, sym) | 86 | purego.RegisterFunc(&apiHash, sym) | ||
| 94 | - | // 999999 = CEF_API_VERSION_EXPERIMENTAL (use all available API). | 87 | + | // entry 0 is CEF_API_HASH_PLATFORM. |
| 95 | - | // entry 0 = CEF_API_HASH_PLATFORM; return value ignored. | 88 | + | return validateAPIHashPointer(apiHash(cefAPIVersion, 0)) |
| 96 | - | apiHash(999999, 0) | 89 | + | } |
| 90 | + | ||||
| 91 | + | func validateAPIHashPointer(value uintptr) error { | |||
| 92 | + | if value == 0 { | |||
| 93 | + | return fmt.Errorf("CEF API %d returned a nil Linux platform hash", cefAPIVersion) | |||
| 94 | + | } | |||
| 95 | + | return validateAPIHash(unsafe.String((*byte)(unsafe.Pointer(value)), len(cefAPILinuxHash))) | |||
| 96 | + | } | |||
| 97 | + | ||||
| 98 | + | func validateAPIHash(got string) error { | |||
| 99 | + | if got != cefAPILinuxHash { | |||
| 100 | + | return fmt.Errorf("CEF API %d Linux platform hash mismatch: got %q want %q", cefAPIVersion, got, cefAPILinuxHash) | |||
| 101 | + | } | |||
| 97 | return nil | 102 | return nil | ||
| 98 | } | 103 | } | ||
| 99 | 104 | ||||
| @@ -104,7 +109,7 @@ func validateVersion(handle uintptr) error { | |||||
| 104 | } | 109 | } | ||
| 105 | var versionInfo func(int32) int32 | 110 | var versionInfo func(int32) int32 | ||
| 106 | purego.RegisterFunc(&versionInfo, sym) | 111 | purego.RegisterFunc(&versionInfo, sym) | ||
| 107 | - | return ensureMinimumVersion(versionInfo(cefVersionInfoChromeMajor), targetMajor()) | 112 | + | return ensureMinimumVersion(versionInfo(cefVersionInfoChromeMajor), defaultCEFVersion) |
| 108 | } | 113 | } | ||
| 109 | 114 | ||||
| 110 | func ensureMinimumVersion(got, minimum int32) error { | 115 | func ensureMinimumVersion(got, minimum int32) error { | ||