diff --git a/v3/go.mod b/v3/go.mod index b19d3beac1a..5e9928d3cb5 100644 --- a/v3/go.mod +++ b/v3/go.mod @@ -30,11 +30,11 @@ require ( github.com/pterm/pterm v0.12.51 github.com/samber/lo v1.38.1 github.com/tc-hib/winres v0.3.1 - github.com/wailsapp/go-webview2 v1.0.17 + github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1 github.com/wailsapp/mimetype v1.4.1 - golang.org/x/sys v0.26.0 golang.org/x/term v0.25.0 golang.org/x/tools v0.23.0 + golang.org/x/sys v0.27.0 gopkg.in/yaml.v3 v3.0.1 modernc.org/sqlite v1.21.0 ) diff --git a/v3/go.sum b/v3/go.sum index 750a8d926d1..614c68ae100 100644 --- a/v3/go.sum +++ b/v3/go.sum @@ -352,8 +352,8 @@ github.com/tc-hib/winres v0.3.1 h1:CwRjEGrKdbi5CvZ4ID+iyVhgyfatxFoizjPhzez9Io4= github.com/tc-hib/winres v0.3.1/go.mod h1:C/JaNhH3KBvhNKVbvdlDWkbMDO9H4fKKDaN7/07SSuk= github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc= github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= -github.com/wailsapp/go-webview2 v1.0.17 h1:DkLnUKqW7J///OBXkInMq1fzC88G6ZjHwKuHXThuaco= -github.com/wailsapp/go-webview2 v1.0.17/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo= +github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1 h1:El7t3J32//oQIsdvXAmbgeNKqgmKfKzU2SVp50yn0UM= +github.com/wailsapp/go-webview2 v1.0.18-0.20241130004144-dd8667af33c1/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc= github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs= github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o= github.com/whilp/git-urls v1.0.0 h1:95f6UMWN5FKW71ECsXRUd3FVYiXdrE7aX4NZKcPmIjU= @@ -438,10 +438,8 @@ golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= -golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= -golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= diff --git a/v3/pkg/application/application.go b/v3/pkg/application/application.go index 9d575a14536..2f2f062da4a 100644 --- a/v3/pkg/application/application.go +++ b/v3/pkg/application/application.go @@ -344,6 +344,13 @@ type App struct { wailsEventListeners []WailsEventListener } +func (a *App) handleWarning(msg string) { + if a.options.WarningHandler != nil { + a.options.WarningHandler(msg) + } else { + a.Logger.Warn(msg) + } +} func (a *App) handleError(err error) { if a.options.ErrorHandler != nil { a.options.ErrorHandler(err) @@ -508,6 +515,10 @@ func (a *App) fatal(message string, args ...any) { err := fmt.Errorf(message, args...) a.handleFatalError(err) } +func (a *App) warning(message string, args ...any) { + msg := fmt.Sprintf(message, args...) + a.handleWarning(msg) +} func (a *App) error(message string, args ...any) { a.handleError(fmt.Errorf(message, args...)) diff --git a/v3/pkg/application/application_options.go b/v3/pkg/application/application_options.go index 3fb304badd5..171b7e8a543 100644 --- a/v3/pkg/application/application_options.go +++ b/v3/pkg/application/application_options.go @@ -106,6 +106,9 @@ type Options struct { // This is useful for implementing custom frontend-to-backend communication. RawMessageHandler func(window Window, message string) + // WarningHandler is called when a warning occurs + WarningHandler func(string) + // ErrorHandler is called when an error occurs ErrorHandler func(err error) diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index dd823f3b554..04d3597fdc7 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -1503,14 +1503,23 @@ func (w *windowsWebviewWindow) setupChromium() { if opts.GeneralAutofillEnabled { err = chromium.PutIsGeneralAutofillEnabled(true) if err != nil { - globalApplication.error(err.Error()) + if errors.Is(edge.UnsupportedCapabilityError, err) { + // warning + globalApplication.warning("unsupported capability: GeneralAutofillEnabled") + } else { + globalApplication.fatal(err.Error()) + } } } if opts.PasswordAutosaveEnabled { err = chromium.PutIsPasswordAutosaveEnabled(true) if err != nil { - globalApplication.error(err.Error()) + if errors.Is(edge.UnsupportedCapabilityError, err) { + globalApplication.warning("unsupported capability: PasswordAutosaveEnabled") + } else { + globalApplication.fatal(err.Error()) + } } }