refactor(cef): integrate purego-cef v0.10.0
- commit
- 569144ff67a16fd79a26f08e6d50576d3ff29358
- author
- brice · · 2026-04-20 18:34 UTC
- committer
- brice · · 2026-04-21 05:43 UTC
- parent
- c7fa36e
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
15 files · +104 -85
M cmd/dumber/main.go +12 -2
| @@ -126,8 +126,18 @@ func main() { | |||
| 126 | 126 | // engine can also be selected via config. | |
| 127 | 127 | if isCEFSubprocess(os.Args) { | |
| 128 | 128 | runtime.LockOSThread() | |
| 129 | - | cef.MaybeExitSubprocessWithApp(infracef.NewSubprocessApp()) | |
| 130 | - | os.Exit(1) | |
| 129 | + | executed, exitCode, err := cef.ExecuteSubprocessWithApp(infracef.NewSubprocessApp()) | |
| 130 | + | if err != nil { | |
| 131 | + | _, _ = fmt.Fprintf(os.Stderr, "cef: ExecuteSubprocessWithApp: %v\n", err) | |
| 132 | + | os.Exit(1) | |
| 133 | + | } | |
| 134 | + | if executed { | |
| 135 | + | os.Exit(exitCode) | |
| 136 | + | } | |
| 137 | + | // If Chromium-style helper args were present but purego-cef declined to | |
| 138 | + | // handle them as a subprocess, drop them before normal startup so Cobra | |
| 139 | + | // and the GUI bootstrap do not choke on unknown --type/... flags. | |
| 140 | + | os.Args = os.Args[:1] | |
| 131 | 141 | } | |
| 132 | 142 | ||
| 133 | 143 | enableCrashForensics() | |
| @@ -126,8 +126,18 @@ func main() { | |||||
| 126 | // engine can also be selected via config. | 126 | // engine can also be selected via config. | ||
| 127 | if isCEFSubprocess(os.Args) { | 127 | if isCEFSubprocess(os.Args) { | ||
| 128 | runtime.LockOSThread() | 128 | runtime.LockOSThread() | ||
| 129 | - | cef.MaybeExitSubprocessWithApp(infracef.NewSubprocessApp()) | 129 | + | executed, exitCode, err := cef.ExecuteSubprocessWithApp(infracef.NewSubprocessApp()) |
| 130 | - | os.Exit(1) | 130 | + | if err != nil { |
| 131 | + | _, _ = fmt.Fprintf(os.Stderr, "cef: ExecuteSubprocessWithApp: %v\n", err) | |||
| 132 | + | os.Exit(1) | |||
| 133 | + | } | |||
| 134 | + | if executed { | |||
| 135 | + | os.Exit(exitCode) | |||
| 136 | + | } | |||
| 137 | + | // If Chromium-style helper args were present but purego-cef declined to | |||
| 138 | + | // handle them as a subprocess, drop them before normal startup so Cobra | |||
| 139 | + | // and the GUI bootstrap do not choke on unknown --type/... flags. | |||
| 140 | + | os.Args = os.Args[:1] | |||
| 131 | } | 141 | } | ||
| 132 | 142 | ||||
| 133 | enableCrashForensics() | 143 | enableCrashForensics() | ||
M go.mod +1 -1
| @@ -4,7 +4,7 @@ go 1.26.1 | |||
| 4 | 4 | ||
| 5 | 5 | require ( | |
| 6 | 6 | github.com/bnema/purego v0.11.0-bnema.2 | |
| 7 | - | github.com/bnema/purego-cef v0.9.1 | |
| 7 | + | github.com/bnema/purego-cef v0.10.0 | |
| 8 | 8 | github.com/bnema/purego-ffmpeg v0.3.1 | |
| 9 | 9 | github.com/bnema/purego-pipewire v0.1.2 | |
| 10 | 10 | github.com/bnema/purego-sqlite v0.1.2 | |
| @@ -4,7 +4,7 @@ go 1.26.1 | |||||
| 4 | 4 | ||||
| 5 | require ( | 5 | require ( | ||
| 6 | github.com/bnema/purego v0.11.0-bnema.2 | 6 | github.com/bnema/purego v0.11.0-bnema.2 | ||
| 7 | - | github.com/bnema/purego-cef v0.9.1 | 7 | + | github.com/bnema/purego-cef v0.10.0 |
| 8 | github.com/bnema/purego-ffmpeg v0.3.1 | 8 | github.com/bnema/purego-ffmpeg v0.3.1 | ||
| 9 | github.com/bnema/purego-pipewire v0.1.2 | 9 | github.com/bnema/purego-pipewire v0.1.2 | ||
| 10 | github.com/bnema/purego-sqlite v0.1.2 | 10 | github.com/bnema/purego-sqlite v0.1.2 | ||
M go.sum +2 -4
| @@ -6,10 +6,8 @@ github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3v | |||
| 6 | 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | |
| 7 | 7 | github.com/bnema/purego v0.11.0-bnema.2 h1:7pzcdOJ8bGtLrCz6V582oyleP6css1ICQoGgj+/Ve4o= | |
| 8 | 8 | github.com/bnema/purego v0.11.0-bnema.2/go.mod h1:5BnOIUj+0fvk/vwv45iottFoGfkDT7cnLXnpM2s6Hng= | |
| 9 | - | github.com/bnema/purego-cef v0.9.0 h1:pFTxOa0nvoDkXsqIzUWCjzPTCaQwPnJaXqZk0kMt1ts= | |
| 10 | - | github.com/bnema/purego-cef v0.9.0/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= | |
| 11 | - | github.com/bnema/purego-cef v0.9.1 h1:yP5wkw6+9PPV6THDzn3d2p+nn6ED3J6IxG4x/JfikJE= | |
| 12 | - | github.com/bnema/purego-cef v0.9.1/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= | |
| 9 | + | github.com/bnema/purego-cef v0.10.0 h1:9uztAhPIEO99rAu/SWf7ghooPLCODZOvRJ/vQBjxB7c= | |
| 10 | + | github.com/bnema/purego-cef v0.10.0/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= | |
| 13 | 11 | github.com/bnema/purego-ffmpeg v0.3.1 h1:BWqRQvRXH3Lu7atem71Ai//fOYdNwuFofVF7uz/0XF0= | |
| 14 | 12 | github.com/bnema/purego-ffmpeg v0.3.1/go.mod h1:0/PCk5gYU0Dl1taBgiJd8ttR7A3SFSJXeNJBljeqFGc= | |
| 15 | 13 | github.com/bnema/purego-pipewire v0.1.2 h1:U057iOlpQatwlis6nfrZQJVrT3aGDFdagRLUz+ll7Ik= | |
| @@ -6,10 +6,8 @@ github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3v | |||||
| 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | ||
| 7 | github.com/bnema/purego v0.11.0-bnema.2 h1:7pzcdOJ8bGtLrCz6V582oyleP6css1ICQoGgj+/Ve4o= | 7 | github.com/bnema/purego v0.11.0-bnema.2 h1:7pzcdOJ8bGtLrCz6V582oyleP6css1ICQoGgj+/Ve4o= | ||
| 8 | github.com/bnema/purego v0.11.0-bnema.2/go.mod h1:5BnOIUj+0fvk/vwv45iottFoGfkDT7cnLXnpM2s6Hng= | 8 | github.com/bnema/purego v0.11.0-bnema.2/go.mod h1:5BnOIUj+0fvk/vwv45iottFoGfkDT7cnLXnpM2s6Hng= | ||
| 9 | - | github.com/bnema/purego-cef v0.9.0 h1:pFTxOa0nvoDkXsqIzUWCjzPTCaQwPnJaXqZk0kMt1ts= | 9 | + | github.com/bnema/purego-cef v0.10.0 h1:9uztAhPIEO99rAu/SWf7ghooPLCODZOvRJ/vQBjxB7c= |
| 10 | - | github.com/bnema/purego-cef v0.9.0/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= | 10 | + | github.com/bnema/purego-cef v0.10.0/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= |
| 11 | - | github.com/bnema/purego-cef v0.9.1 h1:yP5wkw6+9PPV6THDzn3d2p+nn6ED3J6IxG4x/JfikJE= | |||
| 12 | - | github.com/bnema/purego-cef v0.9.1/go.mod h1:AIW4lrXr4f2vesO4WnMDN49yAyfivYHV4x6hxpu5SmM= | |||
| 13 | github.com/bnema/purego-ffmpeg v0.3.1 h1:BWqRQvRXH3Lu7atem71Ai//fOYdNwuFofVF7uz/0XF0= | 11 | github.com/bnema/purego-ffmpeg v0.3.1 h1:BWqRQvRXH3Lu7atem71Ai//fOYdNwuFofVF7uz/0XF0= | ||
| 14 | github.com/bnema/purego-ffmpeg v0.3.1/go.mod h1:0/PCk5gYU0Dl1taBgiJd8ttR7A3SFSJXeNJBljeqFGc= | 12 | github.com/bnema/purego-ffmpeg v0.3.1/go.mod h1:0/PCk5gYU0Dl1taBgiJd8ttR7A3SFSJXeNJBljeqFGc= | ||
| 15 | github.com/bnema/purego-pipewire v0.1.2 h1:U057iOlpQatwlis6nfrZQJVrT3aGDFdagRLUz+ll7Ik= | 13 | github.com/bnema/purego-pipewire v0.1.2 h1:U057iOlpQatwlis6nfrZQJVrT3aGDFdagRLUz+ll7Ik= | ||
M internal/infrastructure/cef/app.go +1 -1
| @@ -222,7 +222,7 @@ func (h *dumberBPH) OnAlreadyRunningAppRelaunch(commandLine purecef.CommandLine, | |||
| 222 | 222 | ||
| 223 | 223 | return 0 | |
| 224 | 224 | } | |
| 225 | - | func (h *dumberBPH) GetDefaultClient() purecef.Client { return nil } | |
| 225 | + | func (h *dumberBPH) GetDefaultClient() purecef.RawClient { return nil } | |
| 226 | 226 | func (h *dumberBPH) GetDefaultRequestContextHandler() purecef.RequestContextHandler { return nil } | |
| 227 | 227 | ||
| 228 | 228 | // OnScheduleMessagePumpWork is a no-op — multi-threaded message loop drives | |
| @@ -222,7 +222,7 @@ func (h *dumberBPH) OnAlreadyRunningAppRelaunch(commandLine purecef.CommandLine, | |||||
| 222 | 222 | ||||
| 223 | return 0 | 223 | return 0 | ||
| 224 | } | 224 | } | ||
| 225 | - | func (h *dumberBPH) GetDefaultClient() purecef.Client { return nil } | 225 | + | func (h *dumberBPH) GetDefaultClient() purecef.RawClient { return nil } |
| 226 | func (h *dumberBPH) GetDefaultRequestContextHandler() purecef.RequestContextHandler { return nil } | 226 | func (h *dumberBPH) GetDefaultRequestContextHandler() purecef.RequestContextHandler { return nil } | ||
| 227 | 227 | ||||
| 228 | // OnScheduleMessagePumpWork is a no-op — multi-threaded message loop drives | 228 | // OnScheduleMessagePumpWork is a no-op — multi-threaded message loop drives | ||
M internal/infrastructure/cef/app_test.go +4 -4
| @@ -31,19 +31,19 @@ func (c relaunchCommandLineStub) Copy() purecef.CommandLine { return c | |||
| 31 | 31 | func (c relaunchCommandLineStub) InitFromArgv(int32, unsafe.Pointer) {} | |
| 32 | 32 | func (c relaunchCommandLineStub) InitFromString(string) {} | |
| 33 | 33 | func (c relaunchCommandLineStub) Reset() {} | |
| 34 | - | func (c relaunchCommandLineStub) GetArgv(uintptr) {} | |
| 34 | + | func (c relaunchCommandLineStub) GetArgv(purecef.StringList) {} | |
| 35 | 35 | func (c relaunchCommandLineStub) GetCommandLineString() string { return c.commandLineString } | |
| 36 | 36 | func (c relaunchCommandLineStub) GetProgram() string { return "dumber" } | |
| 37 | 37 | func (c relaunchCommandLineStub) SetProgram(string) {} | |
| 38 | 38 | func (c relaunchCommandLineStub) HasSwitches() bool { return false } | |
| 39 | 39 | func (c relaunchCommandLineStub) HasSwitch(string) bool { return false } | |
| 40 | 40 | func (c relaunchCommandLineStub) GetSwitchValue(string) string { return "" } | |
| 41 | - | func (c relaunchCommandLineStub) GetSwitches(uintptr) {} | |
| 41 | + | func (c relaunchCommandLineStub) GetSwitches(purecef.StringMap) {} | |
| 42 | 42 | func (c relaunchCommandLineStub) AppendSwitch(string) {} | |
| 43 | 43 | func (c relaunchCommandLineStub) AppendSwitchWithValue(string, string) { | |
| 44 | 44 | } | |
| 45 | - | func (c relaunchCommandLineStub) HasArguments() bool { return true } | |
| 46 | - | func (c relaunchCommandLineStub) GetArguments(uintptr) {} | |
| 45 | + | func (c relaunchCommandLineStub) HasArguments() bool { return true } | |
| 46 | + | func (c relaunchCommandLineStub) GetArguments(purecef.StringList) {} | |
| 47 | 47 | func (c relaunchCommandLineStub) AppendArgument(string) { | |
| 48 | 48 | } | |
| 49 | 49 | func (c relaunchCommandLineStub) PrependWrapper(string) {} | |
| @@ -31,19 +31,19 @@ func (c relaunchCommandLineStub) Copy() purecef.CommandLine { return c | |||||
| 31 | func (c relaunchCommandLineStub) InitFromArgv(int32, unsafe.Pointer) {} | 31 | func (c relaunchCommandLineStub) InitFromArgv(int32, unsafe.Pointer) {} | ||
| 32 | func (c relaunchCommandLineStub) InitFromString(string) {} | 32 | func (c relaunchCommandLineStub) InitFromString(string) {} | ||
| 33 | func (c relaunchCommandLineStub) Reset() {} | 33 | func (c relaunchCommandLineStub) Reset() {} | ||
| 34 | - | func (c relaunchCommandLineStub) GetArgv(uintptr) {} | 34 | + | func (c relaunchCommandLineStub) GetArgv(purecef.StringList) {} |
| 35 | func (c relaunchCommandLineStub) GetCommandLineString() string { return c.commandLineString } | 35 | func (c relaunchCommandLineStub) GetCommandLineString() string { return c.commandLineString } | ||
| 36 | func (c relaunchCommandLineStub) GetProgram() string { return "dumber" } | 36 | func (c relaunchCommandLineStub) GetProgram() string { return "dumber" } | ||
| 37 | func (c relaunchCommandLineStub) SetProgram(string) {} | 37 | func (c relaunchCommandLineStub) SetProgram(string) {} | ||
| 38 | func (c relaunchCommandLineStub) HasSwitches() bool { return false } | 38 | func (c relaunchCommandLineStub) HasSwitches() bool { return false } | ||
| 39 | func (c relaunchCommandLineStub) HasSwitch(string) bool { return false } | 39 | func (c relaunchCommandLineStub) HasSwitch(string) bool { return false } | ||
| 40 | func (c relaunchCommandLineStub) GetSwitchValue(string) string { return "" } | 40 | func (c relaunchCommandLineStub) GetSwitchValue(string) string { return "" } | ||
| 41 | - | func (c relaunchCommandLineStub) GetSwitches(uintptr) {} | 41 | + | func (c relaunchCommandLineStub) GetSwitches(purecef.StringMap) {} |
| 42 | func (c relaunchCommandLineStub) AppendSwitch(string) {} | 42 | func (c relaunchCommandLineStub) AppendSwitch(string) {} | ||
| 43 | func (c relaunchCommandLineStub) AppendSwitchWithValue(string, string) { | 43 | func (c relaunchCommandLineStub) AppendSwitchWithValue(string, string) { | ||
| 44 | } | 44 | } | ||
| 45 | - | func (c relaunchCommandLineStub) HasArguments() bool { return true } | 45 | + | func (c relaunchCommandLineStub) HasArguments() bool { return true } |
| 46 | - | func (c relaunchCommandLineStub) GetArguments(uintptr) {} | 46 | + | func (c relaunchCommandLineStub) GetArguments(purecef.StringList) {} |
| 47 | func (c relaunchCommandLineStub) AppendArgument(string) { | 47 | func (c relaunchCommandLineStub) AppendArgument(string) { | ||
| 48 | } | 48 | } | ||
| 49 | func (c relaunchCommandLineStub) PrependWrapper(string) {} | 49 | func (c relaunchCommandLineStub) PrependWrapper(string) {} | ||
M internal/infrastructure/cef/context_menu_adapter_test.go +5 -5
| @@ -35,11 +35,11 @@ func (p stubContextMenuParams) GetMediaType() purecef.ContextMenuMediaType { ret | |||
| 35 | 35 | func (p stubContextMenuParams) GetMediaStateFlags() purecef.ContextMenuMediaStateFlags { | |
| 36 | 36 | return 0 | |
| 37 | 37 | } | |
| 38 | - | func (p stubContextMenuParams) GetSelectionText() string { return p.selection } | |
| 39 | - | func (p stubContextMenuParams) GetMisspelledWord() string { return "" } | |
| 40 | - | func (p stubContextMenuParams) GetDictionarySuggestions(uintptr) int32 { return 0 } | |
| 41 | - | func (p stubContextMenuParams) IsEditable() bool { return p.editable } | |
| 42 | - | func (p stubContextMenuParams) IsSpellCheckEnabled() bool { return false } | |
| 38 | + | func (p stubContextMenuParams) GetSelectionText() string { return p.selection } | |
| 39 | + | func (p stubContextMenuParams) GetMisspelledWord() string { return "" } | |
| 40 | + | func (p stubContextMenuParams) GetDictionarySuggestions(purecef.StringList) int32 { return 0 } | |
| 41 | + | func (p stubContextMenuParams) IsEditable() bool { return p.editable } | |
| 42 | + | func (p stubContextMenuParams) IsSpellCheckEnabled() bool { return false } | |
| 43 | 43 | func (p stubContextMenuParams) GetEditStateFlags() purecef.ContextMenuEditStateFlags { | |
| 44 | 44 | return 0 | |
| 45 | 45 | } | |
| @@ -35,11 +35,11 @@ func (p stubContextMenuParams) GetMediaType() purecef.ContextMenuMediaType { ret | |||||
| 35 | func (p stubContextMenuParams) GetMediaStateFlags() purecef.ContextMenuMediaStateFlags { | 35 | func (p stubContextMenuParams) GetMediaStateFlags() purecef.ContextMenuMediaStateFlags { | ||
| 36 | return 0 | 36 | return 0 | ||
| 37 | } | 37 | } | ||
| 38 | - | func (p stubContextMenuParams) GetSelectionText() string { return p.selection } | 38 | + | func (p stubContextMenuParams) GetSelectionText() string { return p.selection } |
| 39 | - | func (p stubContextMenuParams) GetMisspelledWord() string { return "" } | 39 | + | func (p stubContextMenuParams) GetMisspelledWord() string { return "" } |
| 40 | - | func (p stubContextMenuParams) GetDictionarySuggestions(uintptr) int32 { return 0 } | 40 | + | func (p stubContextMenuParams) GetDictionarySuggestions(purecef.StringList) int32 { return 0 } |
| 41 | - | func (p stubContextMenuParams) IsEditable() bool { return p.editable } | 41 | + | func (p stubContextMenuParams) IsEditable() bool { return p.editable } |
| 42 | - | func (p stubContextMenuParams) IsSpellCheckEnabled() bool { return false } | 42 | + | func (p stubContextMenuParams) IsSpellCheckEnabled() bool { return false } |
| 43 | func (p stubContextMenuParams) GetEditStateFlags() purecef.ContextMenuEditStateFlags { | 43 | func (p stubContextMenuParams) GetEditStateFlags() purecef.ContextMenuEditStateFlags { | ||
| 44 | return 0 | 44 | return 0 | ||
| 45 | } | 45 | } | ||
M internal/infrastructure/cef/engine_init.go +2 -3
| @@ -144,11 +144,10 @@ func prepareCEFSettings( | |||
| 144 | 144 | if bootstrapLogFile, err := prepareCEFInitTraceFile(paths.LogFile, cfg.LogFile); err != nil { | |
| 145 | 145 | logger.Warn().Err(err).Msg("cef: failed to prepare init trace file") | |
| 146 | 146 | } else if bootstrapLogFile != "" { | |
| 147 | - | settings.InitTraceFile = bootstrapLogFile | |
| 148 | - | logger.Info(). | |
| 147 | + | logger.Warn(). | |
| 149 | 148 | Str("bootstrap_log_file", bootstrapLogFile). | |
| 150 | 149 | Str("env_var", puregoCEFInitTraceEnvVar). | |
| 151 | - | Msg("cef: init bootstrap diagnostics enabled") | |
| 150 | + | Msg("cef: init bootstrap diagnostics requested, but current purego-cef no longer consumes this trace file") | |
| 152 | 151 | } | |
| 153 | 152 | if cfg.LogSeverity != 0 { | |
| 154 | 153 | settings.LogSeverity = cfg.LogSeverity | |
| @@ -144,11 +144,10 @@ func prepareCEFSettings( | |||||
| 144 | if bootstrapLogFile, err := prepareCEFInitTraceFile(paths.LogFile, cfg.LogFile); err != nil { | 144 | if bootstrapLogFile, err := prepareCEFInitTraceFile(paths.LogFile, cfg.LogFile); err != nil { | ||
| 145 | logger.Warn().Err(err).Msg("cef: failed to prepare init trace file") | 145 | logger.Warn().Err(err).Msg("cef: failed to prepare init trace file") | ||
| 146 | } else if bootstrapLogFile != "" { | 146 | } else if bootstrapLogFile != "" { | ||
| 147 | - | settings.InitTraceFile = bootstrapLogFile | 147 | + | logger.Warn(). |
| 148 | - | logger.Info(). | |||
| 149 | Str("bootstrap_log_file", bootstrapLogFile). | 148 | Str("bootstrap_log_file", bootstrapLogFile). | ||
| 150 | Str("env_var", puregoCEFInitTraceEnvVar). | 149 | Str("env_var", puregoCEFInitTraceEnvVar). | ||
| 151 | - | Msg("cef: init bootstrap diagnostics enabled") | 150 | + | Msg("cef: init bootstrap diagnostics requested, but current purego-cef no longer consumes this trace file") |
| 152 | } | 151 | } | ||
| 153 | if cfg.LogSeverity != 0 { | 152 | if cfg.LogSeverity != 0 { | ||
| 154 | settings.LogSeverity = cfg.LogSeverity | 153 | settings.LogSeverity = cfg.LogSeverity | ||
M internal/infrastructure/cef/factory.go +1 -1
| @@ -156,7 +156,7 @@ func (f *WebViewFactory) Create(ctx context.Context) (port.WebView, error) { | |||
| 156 | 156 | } | |
| 157 | 157 | ||
| 158 | 158 | func (f *WebViewFactory) configureInitialBrowserCreation( | |
| 159 | - | ctx context.Context, wv *WebView, pipeline *renderPipeline, client purecef.Client, | |
| 159 | + | ctx context.Context, wv *WebView, pipeline *renderPipeline, client purecef.RawClient, | |
| 160 | 160 | windowInfo *purecef.WindowInfo, settings *purecef.BrowserSettings, | |
| 161 | 161 | ) { | |
| 162 | 162 | wv.pendingCreate = &pendingBrowserCreate{ | |
| @@ -156,7 +156,7 @@ func (f *WebViewFactory) Create(ctx context.Context) (port.WebView, error) { | |||||
| 156 | } | 156 | } | ||
| 157 | 157 | ||||
| 158 | func (f *WebViewFactory) configureInitialBrowserCreation( | 158 | func (f *WebViewFactory) configureInitialBrowserCreation( | ||
| 159 | - | ctx context.Context, wv *WebView, pipeline *renderPipeline, client purecef.Client, | 159 | + | ctx context.Context, wv *WebView, pipeline *renderPipeline, client purecef.RawClient, |
| 160 | windowInfo *purecef.WindowInfo, settings *purecef.BrowserSettings, | 160 | windowInfo *purecef.WindowInfo, settings *purecef.BrowserSettings, | ||
| 161 | ) { | 161 | ) { | ||
| 162 | wv.pendingCreate = &pendingBrowserCreate{ | 162 | wv.pendingCreate = &pendingBrowserCreate{ | ||
M internal/infrastructure/cef/scheme_handler.go +14 -8
| @@ -555,9 +555,11 @@ func (h *dumbSchemeHandler) newAPIJSONResourceHandler(status int, v any) purecef | |||
| 555 | 555 | } | |
| 556 | 556 | ||
| 557 | 557 | // Open handles the request immediately (synchronous). | |
| 558 | - | func (rh *staticResourceHandler) Open(_ purecef.Request, handleRequest unsafe.Pointer, _ purecef.Callback) int32 { | |
| 558 | + | func (rh *staticResourceHandler) Open(_ purecef.Request, handleRequest *int32, _ purecef.Callback) int32 { | |
| 559 | 559 | // Set handleRequest = true (1) to indicate we handle it immediately. | |
| 560 | - | *(*int32)(handleRequest) = 1 | |
| 560 | + | if handleRequest != nil { | |
| 561 | + | *handleRequest = 1 | |
| 562 | + | } | |
| 561 | 563 | return 1 | |
| 562 | 564 | } | |
| 563 | 565 | ||
| @@ -569,7 +571,7 @@ func (rh *staticResourceHandler) ProcessRequest(_ purecef.Request, _ purecef.Cal | |||
| 569 | 571 | // GetResponseHeaders sets status code, MIME type, and content length. | |
| 570 | 572 | // CEF's SetMimeType expects the MIME type without charset parameters; | |
| 571 | 573 | // the charset must be set separately via SetCharset. | |
| 572 | - | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength unsafe.Pointer, _ uintptr) { | |
| 574 | + | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength *int64, _ uintptr) { | |
| 573 | 575 | response.SetStatus(int32(rh.statusCode)) | |
| 574 | 576 | if text := http.StatusText(rh.statusCode); text != "" { | |
| 575 | 577 | response.SetStatusText(text) | |
| @@ -582,18 +584,20 @@ func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, r | |||
| 582 | 584 | for name, value := range rh.headers { | |
| 583 | 585 | response.SetHeaderByName(name, value, 1) | |
| 584 | 586 | } | |
| 585 | - | *(*int64)(responseLength) = int64(len(rh.data)) | |
| 587 | + | if responseLength != nil { | |
| 588 | + | *responseLength = int64(len(rh.data)) | |
| 589 | + | } | |
| 586 | 590 | } | |
| 587 | 591 | ||
| 588 | 592 | // Skip is not used for static content. | |
| 589 | - | func (rh *staticResourceHandler) Skip(_ int64, _ unsafe.Pointer, _ purecef.ResourceSkipCallback) int32 { | |
| 593 | + | func (rh *staticResourceHandler) Skip(_ int64, _ *int64, _ purecef.ResourceSkipCallback) int32 { | |
| 590 | 594 | return 0 | |
| 591 | 595 | } | |
| 592 | 596 | ||
| 593 | 597 | // Read copies data into the output buffer. | |
| 594 | 598 | func (rh *staticResourceHandler) Read( | |
| 595 | 599 | dataOut unsafe.Pointer, bytesToRead int32, | |
| 596 | - | bytesRead unsafe.Pointer, _ purecef.ResourceReadCallback, | |
| 600 | + | bytesRead *int32, _ purecef.ResourceReadCallback, | |
| 597 | 601 | ) int32 { | |
| 598 | 602 | if rh.offset >= len(rh.data) { | |
| 599 | 603 | return 0 | |
| @@ -610,12 +614,14 @@ func (rh *staticResourceHandler) Read( | |||
| 610 | 614 | copy(dst, rh.data[rh.offset:rh.offset+toRead]) | |
| 611 | 615 | rh.offset += toRead | |
| 612 | 616 | ||
| 613 | - | *(*int32)(bytesRead) = int32(toRead) | |
| 617 | + | if bytesRead != nil { | |
| 618 | + | *bytesRead = int32(toRead) | |
| 619 | + | } | |
| 614 | 620 | return 1 | |
| 615 | 621 | } | |
| 616 | 622 | ||
| 617 | 623 | // ReadResponse is deprecated; Read is used instead. | |
| 618 | - | func (rh *staticResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ unsafe.Pointer, _ purecef.Callback) int32 { | |
| 624 | + | func (rh *staticResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ *int32, _ purecef.Callback) int32 { | |
| 619 | 625 | return 0 | |
| 620 | 626 | } | |
| 621 | 627 | ||
| @@ -555,9 +555,11 @@ func (h *dumbSchemeHandler) newAPIJSONResourceHandler(status int, v any) purecef | |||||
| 555 | } | 555 | } | ||
| 556 | 556 | ||||
| 557 | // Open handles the request immediately (synchronous). | 557 | // Open handles the request immediately (synchronous). | ||
| 558 | - | func (rh *staticResourceHandler) Open(_ purecef.Request, handleRequest unsafe.Pointer, _ purecef.Callback) int32 { | 558 | + | func (rh *staticResourceHandler) Open(_ purecef.Request, handleRequest *int32, _ purecef.Callback) int32 { |
| 559 | // Set handleRequest = true (1) to indicate we handle it immediately. | 559 | // Set handleRequest = true (1) to indicate we handle it immediately. | ||
| 560 | - | *(*int32)(handleRequest) = 1 | 560 | + | if handleRequest != nil { |
| 561 | + | *handleRequest = 1 | |||
| 562 | + | } | |||
| 561 | return 1 | 563 | return 1 | ||
| 562 | } | 564 | } | ||
| 563 | 565 | ||||
| @@ -569,7 +571,7 @@ func (rh *staticResourceHandler) ProcessRequest(_ purecef.Request, _ purecef.Cal | |||||
| 569 | // GetResponseHeaders sets status code, MIME type, and content length. | 571 | // GetResponseHeaders sets status code, MIME type, and content length. | ||
| 570 | // CEF's SetMimeType expects the MIME type without charset parameters; | 572 | // CEF's SetMimeType expects the MIME type without charset parameters; | ||
| 571 | // the charset must be set separately via SetCharset. | 573 | // the charset must be set separately via SetCharset. | ||
| 572 | - | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength unsafe.Pointer, _ uintptr) { | 574 | + | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength *int64, _ uintptr) { |
| 573 | response.SetStatus(int32(rh.statusCode)) | 575 | response.SetStatus(int32(rh.statusCode)) | ||
| 574 | if text := http.StatusText(rh.statusCode); text != "" { | 576 | if text := http.StatusText(rh.statusCode); text != "" { | ||
| 575 | response.SetStatusText(text) | 577 | response.SetStatusText(text) | ||
| @@ -582,18 +584,20 @@ func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, r | |||||
| 582 | for name, value := range rh.headers { | 584 | for name, value := range rh.headers { | ||
| 583 | response.SetHeaderByName(name, value, 1) | 585 | response.SetHeaderByName(name, value, 1) | ||
| 584 | } | 586 | } | ||
| 585 | - | *(*int64)(responseLength) = int64(len(rh.data)) | 587 | + | if responseLength != nil { |
| 588 | + | *responseLength = int64(len(rh.data)) | |||
| 589 | + | } | |||
| 586 | } | 590 | } | ||
| 587 | 591 | ||||
| 588 | // Skip is not used for static content. | 592 | // Skip is not used for static content. | ||
| 589 | - | func (rh *staticResourceHandler) Skip(_ int64, _ unsafe.Pointer, _ purecef.ResourceSkipCallback) int32 { | 593 | + | func (rh *staticResourceHandler) Skip(_ int64, _ *int64, _ purecef.ResourceSkipCallback) int32 { |
| 590 | return 0 | 594 | return 0 | ||
| 591 | } | 595 | } | ||
| 592 | 596 | ||||
| 593 | // Read copies data into the output buffer. | 597 | // Read copies data into the output buffer. | ||
| 594 | func (rh *staticResourceHandler) Read( | 598 | func (rh *staticResourceHandler) Read( | ||
| 595 | dataOut unsafe.Pointer, bytesToRead int32, | 599 | dataOut unsafe.Pointer, bytesToRead int32, | ||
| 596 | - | bytesRead unsafe.Pointer, _ purecef.ResourceReadCallback, | 600 | + | bytesRead *int32, _ purecef.ResourceReadCallback, |
| 597 | ) int32 { | 601 | ) int32 { | ||
| 598 | if rh.offset >= len(rh.data) { | 602 | if rh.offset >= len(rh.data) { | ||
| 599 | return 0 | 603 | return 0 | ||
| @@ -610,12 +614,14 @@ func (rh *staticResourceHandler) Read( | |||||
| 610 | copy(dst, rh.data[rh.offset:rh.offset+toRead]) | 614 | copy(dst, rh.data[rh.offset:rh.offset+toRead]) | ||
| 611 | rh.offset += toRead | 615 | rh.offset += toRead | ||
| 612 | 616 | ||||
| 613 | - | *(*int32)(bytesRead) = int32(toRead) | 617 | + | if bytesRead != nil { |
| 618 | + | *bytesRead = int32(toRead) | |||
| 619 | + | } | |||
| 614 | return 1 | 620 | return 1 | ||
| 615 | } | 621 | } | ||
| 616 | 622 | ||||
| 617 | // ReadResponse is deprecated; Read is used instead. | 623 | // ReadResponse is deprecated; Read is used instead. | ||
| 618 | - | func (rh *staticResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ unsafe.Pointer, _ purecef.Callback) int32 { | 624 | + | func (rh *staticResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ *int32, _ purecef.Callback) int32 { |
| 619 | return 0 | 625 | return 0 | ||
| 620 | } | 626 | } | ||
| 621 | 627 | ||||
M internal/infrastructure/cef/scheme_handler_test.go +6 -7
| @@ -6,7 +6,6 @@ import ( | |||
| 6 | 6 | "errors" | |
| 7 | 7 | "net/http" | |
| 8 | 8 | "testing" | |
| 9 | - | "unsafe" | |
| 10 | 9 | ||
| 11 | 10 | purecef "github.com/bnema/purego-cef/cef" | |
| 12 | 11 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | |
| @@ -103,7 +102,7 @@ func TestSchemeHandler_APIClipboardSetPathWritesClipboardPayload(t *testing.T) { | |||
| 103 | 102 | require.NotNil(t, handler) | |
| 104 | 103 | ||
| 105 | 104 | var responseLength int64 | |
| 106 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 105 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 107 | 106 | require.Positive(t, responseLength) | |
| 108 | 107 | require.Equal(t, "copied from js", copied) | |
| 109 | 108 | } | |
| @@ -129,7 +128,7 @@ func TestSchemeHandler_APIFocusSyncRejectsRequestsWithoutTrustedBridgeHeader(t * | |||
| 129 | 128 | require.NotNil(t, handler) | |
| 130 | 129 | ||
| 131 | 130 | var responseLength int64 | |
| 132 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 131 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 133 | 132 | require.Positive(t, responseLength) | |
| 134 | 133 | } | |
| 135 | 134 | ||
| @@ -164,7 +163,7 @@ func TestSchemeHandler_APIFocusSyncInvokesEditableFocusCallback(t *testing.T) { | |||
| 164 | 163 | require.NotNil(t, handler) | |
| 165 | 164 | ||
| 166 | 165 | var responseLength int64 | |
| 167 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 166 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 168 | 167 | require.Positive(t, responseLength) | |
| 169 | 168 | require.Same(t, browser, focused) | |
| 170 | 169 | } | |
| @@ -203,7 +202,7 @@ func TestSchemeHandler_Create_ConceptualAPIRequestBypassesRedirect(t *testing.T) | |||
| 203 | 202 | require.NotNil(t, handler) | |
| 204 | 203 | ||
| 205 | 204 | var responseLength int64 | |
| 206 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 205 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 207 | 206 | require.Positive(t, responseLength) | |
| 208 | 207 | require.Equal(t, "copied from create", copied) | |
| 209 | 208 | } | |
| @@ -232,7 +231,7 @@ func TestSchemeHandler_APIClipboardSetRejectsInvalidBridgeNonce(t *testing.T) { | |||
| 232 | 231 | require.NotNil(t, handler) | |
| 233 | 232 | ||
| 234 | 233 | var responseLength int64 | |
| 235 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 234 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 236 | 235 | require.Positive(t, responseLength) | |
| 237 | 236 | } | |
| 238 | 237 | ||
| @@ -256,6 +255,6 @@ func TestSchemeHandler_APIOptionsReturnsCORSPreflightHeaders(t *testing.T) { | |||
| 256 | 255 | require.NotNil(t, handler) | |
| 257 | 256 | ||
| 258 | 257 | var responseLength int64 | |
| 259 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | |
| 258 | + | handler.GetResponseHeaders(response, &responseLength, 0) | |
| 260 | 259 | require.Zero(t, responseLength) | |
| 261 | 260 | } | |
| @@ -6,7 +6,6 @@ import ( | |||||
| 6 | "errors" | 6 | "errors" | ||
| 7 | "net/http" | 7 | "net/http" | ||
| 8 | "testing" | 8 | "testing" | ||
| 9 | - | "unsafe" | |||
| 10 | 9 | ||||
| 11 | purecef "github.com/bnema/purego-cef/cef" | 10 | purecef "github.com/bnema/purego-cef/cef" | ||
| 12 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | 11 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | ||
| @@ -103,7 +102,7 @@ func TestSchemeHandler_APIClipboardSetPathWritesClipboardPayload(t *testing.T) { | |||||
| 103 | require.NotNil(t, handler) | 102 | require.NotNil(t, handler) | ||
| 104 | 103 | ||||
| 105 | var responseLength int64 | 104 | var responseLength int64 | ||
| 106 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 105 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 107 | require.Positive(t, responseLength) | 106 | require.Positive(t, responseLength) | ||
| 108 | require.Equal(t, "copied from js", copied) | 107 | require.Equal(t, "copied from js", copied) | ||
| 109 | } | 108 | } | ||
| @@ -129,7 +128,7 @@ func TestSchemeHandler_APIFocusSyncRejectsRequestsWithoutTrustedBridgeHeader(t * | |||||
| 129 | require.NotNil(t, handler) | 128 | require.NotNil(t, handler) | ||
| 130 | 129 | ||||
| 131 | var responseLength int64 | 130 | var responseLength int64 | ||
| 132 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 131 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 133 | require.Positive(t, responseLength) | 132 | require.Positive(t, responseLength) | ||
| 134 | } | 133 | } | ||
| 135 | 134 | ||||
| @@ -164,7 +163,7 @@ func TestSchemeHandler_APIFocusSyncInvokesEditableFocusCallback(t *testing.T) { | |||||
| 164 | require.NotNil(t, handler) | 163 | require.NotNil(t, handler) | ||
| 165 | 164 | ||||
| 166 | var responseLength int64 | 165 | var responseLength int64 | ||
| 167 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 166 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 168 | require.Positive(t, responseLength) | 167 | require.Positive(t, responseLength) | ||
| 169 | require.Same(t, browser, focused) | 168 | require.Same(t, browser, focused) | ||
| 170 | } | 169 | } | ||
| @@ -203,7 +202,7 @@ func TestSchemeHandler_Create_ConceptualAPIRequestBypassesRedirect(t *testing.T) | |||||
| 203 | require.NotNil(t, handler) | 202 | require.NotNil(t, handler) | ||
| 204 | 203 | ||||
| 205 | var responseLength int64 | 204 | var responseLength int64 | ||
| 206 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 205 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 207 | require.Positive(t, responseLength) | 206 | require.Positive(t, responseLength) | ||
| 208 | require.Equal(t, "copied from create", copied) | 207 | require.Equal(t, "copied from create", copied) | ||
| 209 | } | 208 | } | ||
| @@ -232,7 +231,7 @@ func TestSchemeHandler_APIClipboardSetRejectsInvalidBridgeNonce(t *testing.T) { | |||||
| 232 | require.NotNil(t, handler) | 231 | require.NotNil(t, handler) | ||
| 233 | 232 | ||||
| 234 | var responseLength int64 | 233 | var responseLength int64 | ||
| 235 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 234 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 236 | require.Positive(t, responseLength) | 235 | require.Positive(t, responseLength) | ||
| 237 | } | 236 | } | ||
| 238 | 237 | ||||
| @@ -256,6 +255,6 @@ func TestSchemeHandler_APIOptionsReturnsCORSPreflightHeaders(t *testing.T) { | |||||
| 256 | require.NotNil(t, handler) | 255 | require.NotNil(t, handler) | ||
| 257 | 256 | ||||
| 258 | var responseLength int64 | 257 | var responseLength int64 | ||
| 259 | - | handler.GetResponseHeaders(response, unsafe.Pointer(&responseLength), 0) | 258 | + | handler.GetResponseHeaders(response, &responseLength, 0) |
| 260 | require.Zero(t, responseLength) | 259 | require.Zero(t, responseLength) | ||
| 261 | } | 260 | } | ||
M internal/infrastructure/cef/testutil_test.go +2 -4
| @@ -1,8 +1,6 @@ | |||
| 1 | 1 | package cef | |
| 2 | 2 | ||
| 3 | 3 | import ( | |
| 4 | - | "unsafe" | |
| 5 | - | ||
| 6 | 4 | purecef "github.com/bnema/purego-cef/cef" | |
| 7 | 5 | ) | |
| 8 | 6 | ||
| @@ -76,10 +74,10 @@ func (stubMenuModel) SetAcceleratorAt(_ int, _, _, _, _ int32) int32 { | |||
| 76 | 74 | } | |
| 77 | 75 | func (stubMenuModel) RemoveAccelerator(_ int32) int32 { panic("unexpected call") } | |
| 78 | 76 | func (stubMenuModel) RemoveAcceleratorAt(_ int) int32 { panic("unexpected call") } | |
| 79 | - | func (stubMenuModel) GetAccelerator(_ int32, _, _, _, _ unsafe.Pointer) int32 { | |
| 77 | + | func (stubMenuModel) GetAccelerator(_ int32, _, _, _, _ *int32) int32 { | |
| 80 | 78 | panic("unexpected call") | |
| 81 | 79 | } | |
| 82 | - | func (stubMenuModel) GetAcceleratorAt(_ int, _, _, _, _ unsafe.Pointer) int32 { | |
| 80 | + | func (stubMenuModel) GetAcceleratorAt(_ int, _, _, _, _ *int32) int32 { | |
| 83 | 81 | panic("unexpected call") | |
| 84 | 82 | } | |
| 85 | 83 | func (stubMenuModel) SetColor(_ int32, _ purecef.MenuColorType, _ uintptr) int32 { | |
| @@ -1,8 +1,6 @@ | |||||
| 1 | package cef | 1 | package cef | ||
| 2 | 2 | ||||
| 3 | import ( | 3 | import ( | ||
| 4 | - | "unsafe" | |||
| 5 | - | ||||
| 6 | purecef "github.com/bnema/purego-cef/cef" | 4 | purecef "github.com/bnema/purego-cef/cef" | ||
| 7 | ) | 5 | ) | ||
| 8 | 6 | ||||
| @@ -76,10 +74,10 @@ func (stubMenuModel) SetAcceleratorAt(_ int, _, _, _, _ int32) int32 { | |||||
| 76 | } | 74 | } | ||
| 77 | func (stubMenuModel) RemoveAccelerator(_ int32) int32 { panic("unexpected call") } | 75 | func (stubMenuModel) RemoveAccelerator(_ int32) int32 { panic("unexpected call") } | ||
| 78 | func (stubMenuModel) RemoveAcceleratorAt(_ int) int32 { panic("unexpected call") } | 76 | func (stubMenuModel) RemoveAcceleratorAt(_ int) int32 { panic("unexpected call") } | ||
| 79 | - | func (stubMenuModel) GetAccelerator(_ int32, _, _, _, _ unsafe.Pointer) int32 { | 77 | + | func (stubMenuModel) GetAccelerator(_ int32, _, _, _, _ *int32) int32 { |
| 80 | panic("unexpected call") | 78 | panic("unexpected call") | ||
| 81 | } | 79 | } | ||
| 82 | - | func (stubMenuModel) GetAcceleratorAt(_ int, _, _, _, _ unsafe.Pointer) int32 { | 80 | + | func (stubMenuModel) GetAcceleratorAt(_ int, _, _, _, _ *int32) int32 { |
| 83 | panic("unexpected call") | 81 | panic("unexpected call") | ||
| 84 | } | 82 | } | ||
| 85 | func (stubMenuModel) SetColor(_ int32, _ purecef.MenuColorType, _ uintptr) int32 { | 83 | func (stubMenuModel) SetColor(_ int32, _ purecef.MenuColorType, _ uintptr) int32 { | ||
M internal/infrastructure/cef/transcoding_handler.go +15 -9
| @@ -47,10 +47,12 @@ type transcodingResourceHandler struct { | |||
| 47 | 47 | // Open starts the transcode session asynchronously. CEF will call | |
| 48 | 48 | // GetResponseHeaders and Read once the callback fires. | |
| 49 | 49 | func (rh *transcodingResourceHandler) Open( | |
| 50 | - | _ purecef.Request, handleRequest unsafe.Pointer, callback purecef.Callback, | |
| 50 | + | _ purecef.Request, handleRequest *int32, callback purecef.Callback, | |
| 51 | 51 | ) int32 { | |
| 52 | 52 | // Signal async handling: set handleRequest = 0. | |
| 53 | - | *(*int32)(handleRequest) = 0 | |
| 53 | + | if handleRequest != nil { | |
| 54 | + | *handleRequest = 0 | |
| 55 | + | } | |
| 54 | 56 | ||
| 55 | 57 | log := rh.logger() | |
| 56 | 58 | sourceURL := logging.TruncateURL(rh.sourceURL, maxTranscodingURLLength) | |
| @@ -84,7 +86,7 @@ func (rh *transcodingResourceHandler) Open( | |||
| 84 | 86 | ||
| 85 | 87 | // GetResponseHeaders sets the streaming response metadata. | |
| 86 | 88 | func (rh *transcodingResourceHandler) GetResponseHeaders( | |
| 87 | - | response purecef.Response, responseLength unsafe.Pointer, _ uintptr, | |
| 89 | + | response purecef.Response, responseLength *int64, _ uintptr, | |
| 88 | 90 | ) { | |
| 89 | 91 | response.SetStatus(httpStatusOK) | |
| 90 | 92 | response.SetStatusText("OK") | |
| @@ -96,13 +98,15 @@ func (rh *transcodingResourceHandler) GetResponseHeaders( | |||
| 96 | 98 | response.SetHeaderByName("Access-Control-Allow-Origin", "*", 1) | |
| 97 | 99 | response.SetHeaderByName("Cache-Control", "no-store", 1) | |
| 98 | 100 | // Streaming — unknown length. | |
| 99 | - | *(*int64)(responseLength) = -1 | |
| 101 | + | if responseLength != nil { | |
| 102 | + | *responseLength = -1 | |
| 103 | + | } | |
| 100 | 104 | } | |
| 101 | 105 | ||
| 102 | 106 | // Read copies transcoded data from the session into the CEF output buffer. | |
| 103 | 107 | func (rh *transcodingResourceHandler) Read( | |
| 104 | 108 | dataOut unsafe.Pointer, bytesToRead int32, | |
| 105 | - | bytesRead unsafe.Pointer, _ purecef.ResourceReadCallback, | |
| 109 | + | bytesRead *int32, _ purecef.ResourceReadCallback, | |
| 106 | 110 | ) int32 { | |
| 107 | 111 | if rh.session == nil { | |
| 108 | 112 | return 0 | |
| @@ -118,7 +122,9 @@ func (rh *transcodingResourceHandler) Read( | |||
| 118 | 122 | Int("first_chunk_bytes", n). | |
| 119 | 123 | Msg("cef: transcoding resource stream produced first bytes") | |
| 120 | 124 | } | |
| 121 | - | *(*int32)(bytesRead) = int32(n) | |
| 125 | + | if bytesRead != nil { | |
| 126 | + | *bytesRead = int32(n) | |
| 127 | + | } | |
| 122 | 128 | return 1 | |
| 123 | 129 | } | |
| 124 | 130 | if err != nil { | |
| @@ -166,12 +172,12 @@ func (rh *transcodingResourceHandler) ProcessRequest(_ purecef.Request, _ purece | |||
| 166 | 172 | } | |
| 167 | 173 | ||
| 168 | 174 | // ReadResponse is deprecated; Read is used instead. | |
| 169 | - | func (rh *transcodingResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ unsafe.Pointer, _ purecef.Callback) int32 { | |
| 175 | + | func (rh *transcodingResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ *int32, _ purecef.Callback) int32 { | |
| 170 | 176 | return 0 | |
| 171 | 177 | } | |
| 172 | 178 | ||
| 173 | 179 | // Skip is not used for streaming content. | |
| 174 | - | func (rh *transcodingResourceHandler) Skip(_ int64, _ unsafe.Pointer, _ purecef.ResourceSkipCallback) int32 { | |
| 180 | + | func (rh *transcodingResourceHandler) Skip(_ int64, _ *int64, _ purecef.ResourceSkipCallback) int32 { | |
| 175 | 181 | return 0 | |
| 176 | 182 | } | |
| 177 | 183 | ||
| @@ -360,7 +366,7 @@ func (h *transcodingRequestHandler) OnResourceLoadComplete( | |||
| 360 | 366 | ) { | |
| 361 | 367 | } | |
| 362 | 368 | ||
| 363 | - | func (h *transcodingRequestHandler) OnProtocolExecution(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ unsafe.Pointer) { | |
| 369 | + | func (h *transcodingRequestHandler) OnProtocolExecution(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ *int32) { | |
| 364 | 370 | } | |
| 365 | 371 | ||
| 366 | 372 | func buildRequestInfo(request purecef.Request) requestInfo { | |
| @@ -47,10 +47,12 @@ type transcodingResourceHandler struct { | |||||
| 47 | // Open starts the transcode session asynchronously. CEF will call | 47 | // Open starts the transcode session asynchronously. CEF will call | ||
| 48 | // GetResponseHeaders and Read once the callback fires. | 48 | // GetResponseHeaders and Read once the callback fires. | ||
| 49 | func (rh *transcodingResourceHandler) Open( | 49 | func (rh *transcodingResourceHandler) Open( | ||
| 50 | - | _ purecef.Request, handleRequest unsafe.Pointer, callback purecef.Callback, | 50 | + | _ purecef.Request, handleRequest *int32, callback purecef.Callback, |
| 51 | ) int32 { | 51 | ) int32 { | ||
| 52 | // Signal async handling: set handleRequest = 0. | 52 | // Signal async handling: set handleRequest = 0. | ||
| 53 | - | *(*int32)(handleRequest) = 0 | 53 | + | if handleRequest != nil { |
| 54 | + | *handleRequest = 0 | |||
| 55 | + | } | |||
| 54 | 56 | ||||
| 55 | log := rh.logger() | 57 | log := rh.logger() | ||
| 56 | sourceURL := logging.TruncateURL(rh.sourceURL, maxTranscodingURLLength) | 58 | sourceURL := logging.TruncateURL(rh.sourceURL, maxTranscodingURLLength) | ||
| @@ -84,7 +86,7 @@ func (rh *transcodingResourceHandler) Open( | |||||
| 84 | 86 | ||||
| 85 | // GetResponseHeaders sets the streaming response metadata. | 87 | // GetResponseHeaders sets the streaming response metadata. | ||
| 86 | func (rh *transcodingResourceHandler) GetResponseHeaders( | 88 | func (rh *transcodingResourceHandler) GetResponseHeaders( | ||
| 87 | - | response purecef.Response, responseLength unsafe.Pointer, _ uintptr, | 89 | + | response purecef.Response, responseLength *int64, _ uintptr, |
| 88 | ) { | 90 | ) { | ||
| 89 | response.SetStatus(httpStatusOK) | 91 | response.SetStatus(httpStatusOK) | ||
| 90 | response.SetStatusText("OK") | 92 | response.SetStatusText("OK") | ||
| @@ -96,13 +98,15 @@ func (rh *transcodingResourceHandler) GetResponseHeaders( | |||||
| 96 | response.SetHeaderByName("Access-Control-Allow-Origin", "*", 1) | 98 | response.SetHeaderByName("Access-Control-Allow-Origin", "*", 1) | ||
| 97 | response.SetHeaderByName("Cache-Control", "no-store", 1) | 99 | response.SetHeaderByName("Cache-Control", "no-store", 1) | ||
| 98 | // Streaming — unknown length. | 100 | // Streaming — unknown length. | ||
| 99 | - | *(*int64)(responseLength) = -1 | 101 | + | if responseLength != nil { |
| 102 | + | *responseLength = -1 | |||
| 103 | + | } | |||
| 100 | } | 104 | } | ||
| 101 | 105 | ||||
| 102 | // Read copies transcoded data from the session into the CEF output buffer. | 106 | // Read copies transcoded data from the session into the CEF output buffer. | ||
| 103 | func (rh *transcodingResourceHandler) Read( | 107 | func (rh *transcodingResourceHandler) Read( | ||
| 104 | dataOut unsafe.Pointer, bytesToRead int32, | 108 | dataOut unsafe.Pointer, bytesToRead int32, | ||
| 105 | - | bytesRead unsafe.Pointer, _ purecef.ResourceReadCallback, | 109 | + | bytesRead *int32, _ purecef.ResourceReadCallback, |
| 106 | ) int32 { | 110 | ) int32 { | ||
| 107 | if rh.session == nil { | 111 | if rh.session == nil { | ||
| 108 | return 0 | 112 | return 0 | ||
| @@ -118,7 +122,9 @@ func (rh *transcodingResourceHandler) Read( | |||||
| 118 | Int("first_chunk_bytes", n). | 122 | Int("first_chunk_bytes", n). | ||
| 119 | Msg("cef: transcoding resource stream produced first bytes") | 123 | Msg("cef: transcoding resource stream produced first bytes") | ||
| 120 | } | 124 | } | ||
| 121 | - | *(*int32)(bytesRead) = int32(n) | 125 | + | if bytesRead != nil { |
| 126 | + | *bytesRead = int32(n) | |||
| 127 | + | } | |||
| 122 | return 1 | 128 | return 1 | ||
| 123 | } | 129 | } | ||
| 124 | if err != nil { | 130 | if err != nil { | ||
| @@ -166,12 +172,12 @@ func (rh *transcodingResourceHandler) ProcessRequest(_ purecef.Request, _ purece | |||||
| 166 | } | 172 | } | ||
| 167 | 173 | ||||
| 168 | // ReadResponse is deprecated; Read is used instead. | 174 | // ReadResponse is deprecated; Read is used instead. | ||
| 169 | - | func (rh *transcodingResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ unsafe.Pointer, _ purecef.Callback) int32 { | 175 | + | func (rh *transcodingResourceHandler) ReadResponse(_ unsafe.Pointer, _ int32, _ *int32, _ purecef.Callback) int32 { |
| 170 | return 0 | 176 | return 0 | ||
| 171 | } | 177 | } | ||
| 172 | 178 | ||||
| 173 | // Skip is not used for streaming content. | 179 | // Skip is not used for streaming content. | ||
| 174 | - | func (rh *transcodingResourceHandler) Skip(_ int64, _ unsafe.Pointer, _ purecef.ResourceSkipCallback) int32 { | 180 | + | func (rh *transcodingResourceHandler) Skip(_ int64, _ *int64, _ purecef.ResourceSkipCallback) int32 { |
| 175 | return 0 | 181 | return 0 | ||
| 176 | } | 182 | } | ||
| 177 | 183 | ||||
| @@ -360,7 +366,7 @@ func (h *transcodingRequestHandler) OnResourceLoadComplete( | |||||
| 360 | ) { | 366 | ) { | ||
| 361 | } | 367 | } | ||
| 362 | 368 | ||||
| 363 | - | func (h *transcodingRequestHandler) OnProtocolExecution(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ unsafe.Pointer) { | 369 | + | func (h *transcodingRequestHandler) OnProtocolExecution(_ purecef.Browser, _ purecef.Frame, _ purecef.Request, _ *int32) { |
| 364 | } | 370 | } | ||
| 365 | 371 | ||||
| 366 | func buildRequestInfo(request purecef.Request) requestInfo { | 372 | func buildRequestInfo(request purecef.Request) requestInfo { | ||
M internal/infrastructure/cef/webview.go +2 -2
| @@ -68,7 +68,7 @@ type WebView struct { | |||
| 68 | 68 | engine *Engine | |
| 69 | 69 | browser purecef.Browser | |
| 70 | 70 | host purecef.BrowserHost | |
| 71 | - | client purecef.Client // prevent GC from collecting the client before CEF AddRef's it | |
| 71 | + | client purecef.RawClient // prevent GC from collecting the client before CEF AddRef's it | |
| 72 | 72 | pipeline *renderPipeline | |
| 73 | 73 | input *inputBridge | |
| 74 | 74 | handlers *handlerSet | |
| @@ -140,7 +140,7 @@ type WebView struct { | |||
| 140 | 140 | // deferred until the GL area has a non-zero size. | |
| 141 | 141 | type pendingBrowserCreate struct { | |
| 142 | 142 | windowInfo *purecef.WindowInfo | |
| 143 | - | client purecef.Client | |
| 143 | + | client purecef.RawClient | |
| 144 | 144 | settings *purecef.BrowserSettings | |
| 145 | 145 | } | |
| 146 | 146 | ||
| @@ -68,7 +68,7 @@ type WebView struct { | |||||
| 68 | engine *Engine | 68 | engine *Engine | ||
| 69 | browser purecef.Browser | 69 | browser purecef.Browser | ||
| 70 | host purecef.BrowserHost | 70 | host purecef.BrowserHost | ||
| 71 | - | client purecef.Client // prevent GC from collecting the client before CEF AddRef's it | 71 | + | client purecef.RawClient // prevent GC from collecting the client before CEF AddRef's it |
| 72 | pipeline *renderPipeline | 72 | pipeline *renderPipeline | ||
| 73 | input *inputBridge | 73 | input *inputBridge | ||
| 74 | handlers *handlerSet | 74 | handlers *handlerSet | ||
| @@ -140,7 +140,7 @@ type WebView struct { | |||||
| 140 | // deferred until the GL area has a non-zero size. | 140 | // deferred until the GL area has a non-zero size. | ||
| 141 | type pendingBrowserCreate struct { | 141 | type pendingBrowserCreate struct { | ||
| 142 | windowInfo *purecef.WindowInfo | 142 | windowInfo *purecef.WindowInfo | ||
| 143 | - | client purecef.Client | 143 | + | client purecef.RawClient |
| 144 | settings *purecef.BrowserSettings | 144 | settings *purecef.BrowserSettings | ||
| 145 | } | 145 | } | ||
| 146 | 146 | ||||
M internal/infrastructure/cef/webview_handlers.go +14 -14
| @@ -29,16 +29,16 @@ type handlerSet struct { | |||
| 29 | 29 | ||
| 30 | 30 | // Compile-time interface checks. | |
| 31 | 31 | var ( | |
| 32 | - | _ purecef.SafeClient = (*handlerSet)(nil) | |
| 33 | - | _ purecef.RenderHandler = (*handlerSet)(nil) | |
| 34 | - | _ purecef.DisplayHandler = (*handlerSet)(nil) | |
| 35 | - | _ purecef.LoadHandler = (*handlerSet)(nil) | |
| 36 | - | _ purecef.SafeLifeSpanHandler = (*handlerSet)(nil) | |
| 37 | - | _ purecef.RequestHandler = (*handlerSet)(nil) | |
| 38 | - | _ purecef.AudioHandler = (*handlerSet)(nil) | |
| 39 | - | _ purecef.ContextMenuHandler = (*handlerSet)(nil) | |
| 40 | - | _ purecef.DownloadHandler = (*handlerSet)(nil) | |
| 41 | - | _ purecef.FindHandler = (*handlerSet)(nil) | |
| 32 | + | _ purecef.Client = (*handlerSet)(nil) | |
| 33 | + | _ purecef.RenderHandler = (*handlerSet)(nil) | |
| 34 | + | _ purecef.DisplayHandler = (*handlerSet)(nil) | |
| 35 | + | _ purecef.LoadHandler = (*handlerSet)(nil) | |
| 36 | + | _ purecef.LifeSpanHandler = (*handlerSet)(nil) | |
| 37 | + | _ purecef.RequestHandler = (*handlerSet)(nil) | |
| 38 | + | _ purecef.AudioHandler = (*handlerSet)(nil) | |
| 39 | + | _ purecef.ContextMenuHandler = (*handlerSet)(nil) | |
| 40 | + | _ purecef.DownloadHandler = (*handlerSet)(nil) | |
| 41 | + | _ purecef.FindHandler = (*handlerSet)(nil) | |
| 42 | 42 | ) | |
| 43 | 43 | ||
| 44 | 44 | // =========================================================================== | |
| @@ -69,7 +69,7 @@ func (h *handlerSet) GetFrameHandler() purecef.FrameHandler { return n | |||
| 69 | 69 | func (h *handlerSet) GetPermissionHandler() purecef.PermissionHandler { return nil } | |
| 70 | 70 | func (h *handlerSet) GetJsdialogHandler() purecef.JsdialogHandler { return nil } | |
| 71 | 71 | func (h *handlerSet) GetKeyboardHandler() purecef.KeyboardHandler { return nil } | |
| 72 | - | func (h *handlerSet) GetLifeSpanHandler() purecef.SafeLifeSpanHandler { return h } | |
| 72 | + | func (h *handlerSet) GetLifeSpanHandler() purecef.LifeSpanHandler { return h } | |
| 73 | 73 | func (h *handlerSet) GetLoadHandler() purecef.LoadHandler { return h } | |
| 74 | 74 | func (h *handlerSet) GetPrintHandler() purecef.PrintHandler { return nil } | |
| 75 | 75 | func (h *handlerSet) GetRenderHandler() purecef.RenderHandler { return h } | |
| @@ -424,7 +424,7 @@ func (h *handlerSet) OnTitleChange(_ purecef.Browser, title string) { | |||
| 424 | 424 | h.wv.updateTitle(title) | |
| 425 | 425 | } | |
| 426 | 426 | ||
| 427 | - | func (h *handlerSet) OnFaviconUrlchange(_ purecef.Browser, _ uintptr) {} | |
| 427 | + | func (h *handlerSet) OnFaviconUrlchange(_ purecef.Browser, _ purecef.StringList) {} | |
| 428 | 428 | ||
| 429 | 429 | // OnFullscreenModeChange toggles the fullscreen atomic and fires callbacks. | |
| 430 | 430 | func (h *handlerSet) OnFullscreenModeChange(_ purecef.Browser, fullscreen int32) { | |
| @@ -656,7 +656,7 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E | |||
| 656 | 656 | func (h *handlerSet) OnBeforePopup( | |
| 657 | 657 | _ purecef.Browser, _ purecef.Frame, _ int32, targetURL, targetFrameName string, | |
| 658 | 658 | _ purecef.WindowOpenDisposition, userGesture int32, _ *purecef.PopupFeatures, | |
| 659 | - | _ *purecef.WindowInfo, _ *purecef.Client, _ *purecef.BrowserSettings, | |
| 659 | + | _ *purecef.WindowInfo, _ *purecef.RawClientWriteSlot, _ *purecef.BrowserSettings, | |
| 660 | 660 | _ *purecef.DictionaryValue, _ *bool, | |
| 661 | 661 | ) bool { | |
| 662 | 662 | if targetURL == "" { | |
| @@ -685,7 +685,7 @@ func (h *handlerSet) OnBeforePopup( | |||
| 685 | 685 | func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {} | |
| 686 | 686 | ||
| 687 | 687 | func (h *handlerSet) OnBeforeDevToolsPopup( | |
| 688 | - | _ purecef.Browser, _ *purecef.WindowInfo, _ *purecef.Client, | |
| 688 | + | _ purecef.Browser, _ *purecef.WindowInfo, _ *purecef.RawClientWriteSlot, | |
| 689 | 689 | _ *purecef.BrowserSettings, _ *purecef.DictionaryValue, _ *bool, | |
| 690 | 690 | ) { | |
| 691 | 691 | } | |
| @@ -29,16 +29,16 @@ type handlerSet struct { | |||||
| 29 | 29 | ||||
| 30 | // Compile-time interface checks. | 30 | // Compile-time interface checks. | ||
| 31 | var ( | 31 | var ( | ||
| 32 | - | _ purecef.SafeClient = (*handlerSet)(nil) | 32 | + | _ purecef.Client = (*handlerSet)(nil) |
| 33 | - | _ purecef.RenderHandler = (*handlerSet)(nil) | 33 | + | _ purecef.RenderHandler = (*handlerSet)(nil) |
| 34 | - | _ purecef.DisplayHandler = (*handlerSet)(nil) | 34 | + | _ purecef.DisplayHandler = (*handlerSet)(nil) |
| 35 | - | _ purecef.LoadHandler = (*handlerSet)(nil) | 35 | + | _ purecef.LoadHandler = (*handlerSet)(nil) |
| 36 | - | _ purecef.SafeLifeSpanHandler = (*handlerSet)(nil) | 36 | + | _ purecef.LifeSpanHandler = (*handlerSet)(nil) |
| 37 | - | _ purecef.RequestHandler = (*handlerSet)(nil) | 37 | + | _ purecef.RequestHandler = (*handlerSet)(nil) |
| 38 | - | _ purecef.AudioHandler = (*handlerSet)(nil) | 38 | + | _ purecef.AudioHandler = (*handlerSet)(nil) |
| 39 | - | _ purecef.ContextMenuHandler = (*handlerSet)(nil) | 39 | + | _ purecef.ContextMenuHandler = (*handlerSet)(nil) |
| 40 | - | _ purecef.DownloadHandler = (*handlerSet)(nil) | 40 | + | _ purecef.DownloadHandler = (*handlerSet)(nil) |
| 41 | - | _ purecef.FindHandler = (*handlerSet)(nil) | 41 | + | _ purecef.FindHandler = (*handlerSet)(nil) |
| 42 | ) | 42 | ) | ||
| 43 | 43 | ||||
| 44 | // =========================================================================== | 44 | // =========================================================================== | ||
| @@ -69,7 +69,7 @@ func (h *handlerSet) GetFrameHandler() purecef.FrameHandler { return n | |||||
| 69 | func (h *handlerSet) GetPermissionHandler() purecef.PermissionHandler { return nil } | 69 | func (h *handlerSet) GetPermissionHandler() purecef.PermissionHandler { return nil } | ||
| 70 | func (h *handlerSet) GetJsdialogHandler() purecef.JsdialogHandler { return nil } | 70 | func (h *handlerSet) GetJsdialogHandler() purecef.JsdialogHandler { return nil } | ||
| 71 | func (h *handlerSet) GetKeyboardHandler() purecef.KeyboardHandler { return nil } | 71 | func (h *handlerSet) GetKeyboardHandler() purecef.KeyboardHandler { return nil } | ||
| 72 | - | func (h *handlerSet) GetLifeSpanHandler() purecef.SafeLifeSpanHandler { return h } | 72 | + | func (h *handlerSet) GetLifeSpanHandler() purecef.LifeSpanHandler { return h } |
| 73 | func (h *handlerSet) GetLoadHandler() purecef.LoadHandler { return h } | 73 | func (h *handlerSet) GetLoadHandler() purecef.LoadHandler { return h } | ||
| 74 | func (h *handlerSet) GetPrintHandler() purecef.PrintHandler { return nil } | 74 | func (h *handlerSet) GetPrintHandler() purecef.PrintHandler { return nil } | ||
| 75 | func (h *handlerSet) GetRenderHandler() purecef.RenderHandler { return h } | 75 | func (h *handlerSet) GetRenderHandler() purecef.RenderHandler { return h } | ||
| @@ -424,7 +424,7 @@ func (h *handlerSet) OnTitleChange(_ purecef.Browser, title string) { | |||||
| 424 | h.wv.updateTitle(title) | 424 | h.wv.updateTitle(title) | ||
| 425 | } | 425 | } | ||
| 426 | 426 | ||||
| 427 | - | func (h *handlerSet) OnFaviconUrlchange(_ purecef.Browser, _ uintptr) {} | 427 | + | func (h *handlerSet) OnFaviconUrlchange(_ purecef.Browser, _ purecef.StringList) {} |
| 428 | 428 | ||||
| 429 | // OnFullscreenModeChange toggles the fullscreen atomic and fires callbacks. | 429 | // OnFullscreenModeChange toggles the fullscreen atomic and fires callbacks. | ||
| 430 | func (h *handlerSet) OnFullscreenModeChange(_ purecef.Browser, fullscreen int32) { | 430 | func (h *handlerSet) OnFullscreenModeChange(_ purecef.Browser, fullscreen int32) { | ||
| @@ -656,7 +656,7 @@ func (h *handlerSet) OnLoadError(_ purecef.Browser, _ purecef.Frame, _ purecef.E | |||||
| 656 | func (h *handlerSet) OnBeforePopup( | 656 | func (h *handlerSet) OnBeforePopup( | ||
| 657 | _ purecef.Browser, _ purecef.Frame, _ int32, targetURL, targetFrameName string, | 657 | _ purecef.Browser, _ purecef.Frame, _ int32, targetURL, targetFrameName string, | ||
| 658 | _ purecef.WindowOpenDisposition, userGesture int32, _ *purecef.PopupFeatures, | 658 | _ purecef.WindowOpenDisposition, userGesture int32, _ *purecef.PopupFeatures, | ||
| 659 | - | _ *purecef.WindowInfo, _ *purecef.Client, _ *purecef.BrowserSettings, | 659 | + | _ *purecef.WindowInfo, _ *purecef.RawClientWriteSlot, _ *purecef.BrowserSettings, |
| 660 | _ *purecef.DictionaryValue, _ *bool, | 660 | _ *purecef.DictionaryValue, _ *bool, | ||
| 661 | ) bool { | 661 | ) bool { | ||
| 662 | if targetURL == "" { | 662 | if targetURL == "" { | ||
| @@ -685,7 +685,7 @@ func (h *handlerSet) OnBeforePopup( | |||||
| 685 | func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {} | 685 | func (h *handlerSet) OnBeforePopupAborted(_ purecef.Browser, _ int32) {} | ||
| 686 | 686 | ||||
| 687 | func (h *handlerSet) OnBeforeDevToolsPopup( | 687 | func (h *handlerSet) OnBeforeDevToolsPopup( | ||
| 688 | - | _ purecef.Browser, _ *purecef.WindowInfo, _ *purecef.Client, | 688 | + | _ purecef.Browser, _ *purecef.WindowInfo, _ *purecef.RawClientWriteSlot, |
| 689 | _ *purecef.BrowserSettings, _ *purecef.DictionaryValue, _ *bool, | 689 | _ *purecef.BrowserSettings, _ *purecef.DictionaryValue, _ *bool, | ||
| 690 | ) { | 690 | ) { | ||
| 691 | } | 691 | } | ||
M internal/infrastructure/cef/webview_handlers_test.go +23 -20
| @@ -314,26 +314,29 @@ func (n stubEditableDomnode) IsElement() bool | |||
| 314 | 314 | func (n stubEditableDomnode) IsEditable() bool { return n.editable } | |
| 315 | 315 | func (n stubEditableDomnode) IsFormControlElement() bool { return false } | |
| 316 | 316 | func (n stubEditableDomnode) GetFormControlElementType() purecef.DomFormControlType { return 0 } | |
| 317 | - | func (n stubEditableDomnode) IsSame(that purecef.Domnode) bool { return n == that } | |
| 318 | - | func (n stubEditableDomnode) GetName() string { return "" } | |
| 319 | - | func (n stubEditableDomnode) GetValue() string { return "" } | |
| 320 | - | func (n stubEditableDomnode) SetValue(string) int32 { return 0 } | |
| 321 | - | func (n stubEditableDomnode) GetAsMarkup() string { return "" } | |
| 322 | - | func (n stubEditableDomnode) GetDocument() purecef.Domdocument { return nil } | |
| 323 | - | func (n stubEditableDomnode) GetParent() purecef.Domnode { return nil } | |
| 324 | - | func (n stubEditableDomnode) GetPreviousSibling() purecef.Domnode { return nil } | |
| 325 | - | func (n stubEditableDomnode) GetNextSibling() purecef.Domnode { return nil } | |
| 326 | - | func (n stubEditableDomnode) HasChildren() bool { return false } | |
| 327 | - | func (n stubEditableDomnode) GetFirstChild() purecef.Domnode { return nil } | |
| 328 | - | func (n stubEditableDomnode) GetLastChild() purecef.Domnode { return nil } | |
| 329 | - | func (n stubEditableDomnode) GetElementTagName() string { return "" } | |
| 330 | - | func (n stubEditableDomnode) HasElementAttributes() bool { return false } | |
| 331 | - | func (n stubEditableDomnode) HasElementAttribute(string) bool { return false } | |
| 332 | - | func (n stubEditableDomnode) GetElementAttribute(string) string { return "" } | |
| 333 | - | func (n stubEditableDomnode) GetElementAttributes(uintptr) {} | |
| 334 | - | func (n stubEditableDomnode) SetElementAttribute(string, string) int32 { return 0 } | |
| 335 | - | func (n stubEditableDomnode) GetElementInnerText() string { return "" } | |
| 336 | - | func (n stubEditableDomnode) GetElementBounds() uintptr { return 0 } | |
| 317 | + | func (n stubEditableDomnode) IsSame(that purecef.Domnode) bool { | |
| 318 | + | other, ok := that.(stubEditableDomnode) | |
| 319 | + | return ok && n == other | |
| 320 | + | } | |
| 321 | + | func (n stubEditableDomnode) GetName() string { return "" } | |
| 322 | + | func (n stubEditableDomnode) GetValue() string { return "" } | |
| 323 | + | func (n stubEditableDomnode) SetValue(string) int32 { return 0 } | |
| 324 | + | func (n stubEditableDomnode) GetAsMarkup() string { return "" } | |
| 325 | + | func (n stubEditableDomnode) GetDocument() purecef.Domdocument { return nil } | |
| 326 | + | func (n stubEditableDomnode) GetParent() purecef.Domnode { return nil } | |
| 327 | + | func (n stubEditableDomnode) GetPreviousSibling() purecef.Domnode { return nil } | |
| 328 | + | func (n stubEditableDomnode) GetNextSibling() purecef.Domnode { return nil } | |
| 329 | + | func (n stubEditableDomnode) HasChildren() bool { return false } | |
| 330 | + | func (n stubEditableDomnode) GetFirstChild() purecef.Domnode { return nil } | |
| 331 | + | func (n stubEditableDomnode) GetLastChild() purecef.Domnode { return nil } | |
| 332 | + | func (n stubEditableDomnode) GetElementTagName() string { return "" } | |
| 333 | + | func (n stubEditableDomnode) HasElementAttributes() bool { return false } | |
| 334 | + | func (n stubEditableDomnode) HasElementAttribute(string) bool { return false } | |
| 335 | + | func (n stubEditableDomnode) GetElementAttribute(string) string { return "" } | |
| 336 | + | func (n stubEditableDomnode) GetElementAttributes(purecef.StringMap) {} | |
| 337 | + | func (n stubEditableDomnode) SetElementAttribute(string, string) int32 { return 0 } | |
| 338 | + | func (n stubEditableDomnode) GetElementInnerText() string { return "" } | |
| 339 | + | func (n stubEditableDomnode) GetElementBounds() uintptr { return 0 } | |
| 337 | 340 | ||
| 338 | 341 | func TestGetViewRectUsesDIPCoordinates(t *testing.T) { | |
| 339 | 342 | rect := &purecef.Rect{} | |
| @@ -314,26 +314,29 @@ func (n stubEditableDomnode) IsElement() bool | |||||
| 314 | func (n stubEditableDomnode) IsEditable() bool { return n.editable } | 314 | func (n stubEditableDomnode) IsEditable() bool { return n.editable } | ||
| 315 | func (n stubEditableDomnode) IsFormControlElement() bool { return false } | 315 | func (n stubEditableDomnode) IsFormControlElement() bool { return false } | ||
| 316 | func (n stubEditableDomnode) GetFormControlElementType() purecef.DomFormControlType { return 0 } | 316 | func (n stubEditableDomnode) GetFormControlElementType() purecef.DomFormControlType { return 0 } | ||
| 317 | - | func (n stubEditableDomnode) IsSame(that purecef.Domnode) bool { return n == that } | 317 | + | func (n stubEditableDomnode) IsSame(that purecef.Domnode) bool { |
| 318 | - | func (n stubEditableDomnode) GetName() string { return "" } | 318 | + | other, ok := that.(stubEditableDomnode) |
| 319 | - | func (n stubEditableDomnode) GetValue() string { return "" } | 319 | + | return ok && n == other |
| 320 | - | func (n stubEditableDomnode) SetValue(string) int32 { return 0 } | 320 | + | } |
| 321 | - | func (n stubEditableDomnode) GetAsMarkup() string { return "" } | 321 | + | func (n stubEditableDomnode) GetName() string { return "" } |
| 322 | - | func (n stubEditableDomnode) GetDocument() purecef.Domdocument { return nil } | 322 | + | func (n stubEditableDomnode) GetValue() string { return "" } |
| 323 | - | func (n stubEditableDomnode) GetParent() purecef.Domnode { return nil } | 323 | + | func (n stubEditableDomnode) SetValue(string) int32 { return 0 } |
| 324 | - | func (n stubEditableDomnode) GetPreviousSibling() purecef.Domnode { return nil } | 324 | + | func (n stubEditableDomnode) GetAsMarkup() string { return "" } |
| 325 | - | func (n stubEditableDomnode) GetNextSibling() purecef.Domnode { return nil } | 325 | + | func (n stubEditableDomnode) GetDocument() purecef.Domdocument { return nil } |
| 326 | - | func (n stubEditableDomnode) HasChildren() bool { return false } | 326 | + | func (n stubEditableDomnode) GetParent() purecef.Domnode { return nil } |
| 327 | - | func (n stubEditableDomnode) GetFirstChild() purecef.Domnode { return nil } | 327 | + | func (n stubEditableDomnode) GetPreviousSibling() purecef.Domnode { return nil } |
| 328 | - | func (n stubEditableDomnode) GetLastChild() purecef.Domnode { return nil } | 328 | + | func (n stubEditableDomnode) GetNextSibling() purecef.Domnode { return nil } |
| 329 | - | func (n stubEditableDomnode) GetElementTagName() string { return "" } | 329 | + | func (n stubEditableDomnode) HasChildren() bool { return false } |
| 330 | - | func (n stubEditableDomnode) HasElementAttributes() bool { return false } | 330 | + | func (n stubEditableDomnode) GetFirstChild() purecef.Domnode { return nil } |
| 331 | - | func (n stubEditableDomnode) HasElementAttribute(string) bool { return false } | 331 | + | func (n stubEditableDomnode) GetLastChild() purecef.Domnode { return nil } |
| 332 | - | func (n stubEditableDomnode) GetElementAttribute(string) string { return "" } | 332 | + | func (n stubEditableDomnode) GetElementTagName() string { return "" } |
| 333 | - | func (n stubEditableDomnode) GetElementAttributes(uintptr) {} | 333 | + | func (n stubEditableDomnode) HasElementAttributes() bool { return false } |
| 334 | - | func (n stubEditableDomnode) SetElementAttribute(string, string) int32 { return 0 } | 334 | + | func (n stubEditableDomnode) HasElementAttribute(string) bool { return false } |
| 335 | - | func (n stubEditableDomnode) GetElementInnerText() string { return "" } | 335 | + | func (n stubEditableDomnode) GetElementAttribute(string) string { return "" } |
| 336 | - | func (n stubEditableDomnode) GetElementBounds() uintptr { return 0 } | 336 | + | func (n stubEditableDomnode) GetElementAttributes(purecef.StringMap) {} |
| 337 | + | func (n stubEditableDomnode) SetElementAttribute(string, string) int32 { return 0 } | |||
| 338 | + | func (n stubEditableDomnode) GetElementInnerText() string { return "" } | |||
| 339 | + | func (n stubEditableDomnode) GetElementBounds() uintptr { return 0 } | |||
| 337 | 340 | ||||
| 338 | func TestGetViewRectUsesDIPCoordinates(t *testing.T) { | 341 | func TestGetViewRectUsesDIPCoordinates(t *testing.T) { | ||
| 339 | rect := &purecef.Rect{} | 342 | rect := &purecef.Rect{} | ||