From 119fad9a94d75c62313a941985f177a7fd44207f Mon Sep 17 00:00:00 2001 From: Levi Date: Tue, 15 Sep 2026 00:54:12 +0800 Subject: [PATCH] Use explicit WebView2 shutdown and verify persistent cookie expiration --- go.mod | 4 ++-- go.sum | 4 ++-- internal/webview/integrationtest/profiles.go | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index dda65f07..d2facd51 100644 --- a/go.mod +++ b/go.mod @@ -3,13 +3,14 @@ module github.com/GopeedLab/gopeed go 1.25.4 require ( - github.com/GopeedLab/webview_go v0.0.0-20260914021003-80e1a0717dbc + github.com/GopeedLab/webview_go v0.0.0-20260914165316-129f7544ce98 github.com/anacrolix/torrent v1.60.1-0.20251217073903-486bcbe758e0 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 github.com/bodgit/sevenzip v1.6.1 github.com/dop251/goja v0.0.0-20260106131823-651366fbe6e3 github.com/dop251/goja_nodejs v0.0.0-20240728170619-29b559befffc github.com/go-git/go-git/v5 v5.8.1 + github.com/google/jsonschema-go v0.4.3 github.com/gorilla/handlers v1.5.1 github.com/gorilla/mux v1.8.0 github.com/imroc/req/v3 v3.52.2 @@ -38,7 +39,6 @@ require ( github.com/felixge/fgprof v0.9.5 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/jsonschema-go v0.4.3 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect diff --git a/go.sum b/go.sum index c8f554b2..f01e7811 100644 --- a/go.sum +++ b/go.sum @@ -23,8 +23,8 @@ filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmG filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/GopeedLab/webview_go v0.0.0-20260914021003-80e1a0717dbc h1:YDlMnhe2WyTmSJF2g2QCM8GbzYYrz9id0SyQgwdUulM= -github.com/GopeedLab/webview_go v0.0.0-20260914021003-80e1a0717dbc/go.mod h1:FvV19lu9rQ9NcbczN5y8pbWecURRRbWa8tbfFARBDa0= +github.com/GopeedLab/webview_go v0.0.0-20260914165316-129f7544ce98 h1:Yh9Ghcmbj559odeZlYd8HweRbsLsnrVL0Xao74T0xm4= +github.com/GopeedLab/webview_go v0.0.0-20260914165316-129f7544ce98/go.mod h1:FvV19lu9rQ9NcbczN5y8pbWecURRRbWa8tbfFARBDa0= github.com/Masterminds/semver/v3 v3.2.1 h1:RN9w6+7QoMeJVGyfmbcgs28Br8cvmnucEXnY0rYXWg0= github.com/Masterminds/semver/v3 v3.2.1/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= diff --git a/internal/webview/integrationtest/profiles.go b/internal/webview/integrationtest/profiles.go index 35a42752..72d297ba 100644 --- a/internal/webview/integrationtest/profiles.go +++ b/internal/webview/integrationtest/profiles.go @@ -49,6 +49,10 @@ func RunProfileContract(t *testing.T, provider webview.Provider) { assertProfileValue(t, shared, `() => localStorage.getItem('owner')`, "a") assertProfileValue(t, shared, profileDatabaseScript(false), "saved") assertProfileCookies(t, shared, "a", "shared profile A") + storedCookies, err := shared.GetCookies() + if err != nil || len(storedCookies) != 1 || storedCookies[0].Expires.Before(time.Now()) { + t.Fatalf("persistent cookie lost its expiration: %#v, error %v", storedCookies, err) + } assertProfileValue(t, shared, `() => document.cookie`, "") // HttpOnly stays hidden. if err := second.ClearCookies(); err != nil { t.Fatal(err)