Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional load-change webkit2 events (v3-alpha events) #3896

Open
Place1 opened this issue Nov 20, 2024 · 0 comments
Open

additional load-change webkit2 events (v3-alpha events) #3896

Place1 opened this issue Nov 20, 2024 · 0 comments
Labels
Enhancement New feature or request

Comments

@Place1
Copy link

Place1 commented Nov 20, 2024

Is your feature request related to a problem? Please describe.

Hello, I have been testing out the v3-alpha branch locally and the new events system is really nice to use! I was thinking to contribute the addition of the following additional load-change events but I have some follow-on questions:

Describe the solution you'd like

I want to add:

type linuxEvents struct {
	WindowLoadStarted    WindowEventType // new
	WindowLoadRedirected WindowEventType // new
	WindowLoadComitted   WindowEventType // new
	WindowLoadChanged    WindowEventType // Consider renaming to WindowLoadFinished for consistency with webkit?
	// <snip>
}

These are documented here: https://webkitgtk.org/reference/webkit2gtk/2.4.2/WebKitWebView.html#WebKitWebView-load-changed

And then I'd make this change to handleLoadChanged()

func handleLoadChanged(webview *C.WebKitWebView, event C.WebKitLoadEvent, data C.uintptr_t) {
	switch event {
	case C.WEBKIT_LOAD_STARTED:
		// provisional_uri = webkit_web_view_get_uri (web_view);
		processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadStarted))
	case C.WEBKIT_LOAD_REDIRECTED:
		// redirected_uri = webkit_web_view_get_uri (web_view);
		processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadRedirected))
	case C.WEBKIT_LOAD_COMMITTED:
		// uri = webkit_web_view_get_uri (web_view);
		processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadComitted))
	case C.WEBKIT_LOAD_FINISHED:
		processWindowEvent(C.uint(data), C.uint(events.Linux.WindowLoadChanged))
	}
}

Questions:

  • How can we pass additional information like the provisional_uri or redirected_uri on the events?
  • My ultimate goal is to cancel the WEBKIT_LOAD_STARTED event in my go application.
    • The loading event can be cancelled with C.webkit_web_view_stop_loading(webview).
    • How should this work?

Any guidance would be appreciated :)

Describe alternatives you've considered

Additional context

@Place1 Place1 added the Enhancement New feature or request label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant