From 1b00a1627727c47a13f75b92241450a6de57a23a Mon Sep 17 00:00:00 2001 From: Levi Date: Fri, 18 Sep 2026 09:00:50 +0800 Subject: [PATCH] fix(webview): update native callback lifetime and test coverage instrumentation --- .github/workflows/test.yml | 10 ++++------ go.mod | 2 +- go.sum | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6083c2c5..0b87348d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -96,16 +96,14 @@ jobs: run: | sudo apt-get update -y sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev xvfb - - name: Resolve native crash address + - name: Test webview if: runner.os == 'Linux' + # Match the full suite's coverage instrumentation and repeat on the same + # GTK event loop to catch queued callbacks after engine destruction. run: | PACKAGES=$(go list ./... | awk '!/\/bind\// && (!/\/cmd\// || /\/cmd\/web$/)') go test -c -tags webview -coverpkg=$(echo "$PACKAGES" | paste -sd "," -) -covermode=count -o "$RUNNER_TEMP/goprovider.test" ./internal/webview/goprovider - addr2line -a -f -C -e "$RUNNER_TEMP/goprovider.test" 0xaaddaf - - name: Test webview - if: runner.os == 'Linux' - # Repeat on the same GTK event loop to catch callbacks after destruction. - run: xvfb-run -a go test -tags webview -v -count=5 -timeout 300s ./internal/webview/goprovider/ + xvfb-run -a "$RUNNER_TEMP/goprovider.test" -test.v -test.count=5 -test.timeout=300s -test.coverprofile="$RUNNER_TEMP/webview-coverage.out" env: CGO_ENABLED: 1 - name: Test webview diff --git a/go.mod b/go.mod index 179214fa..4bb21298 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25.4 require ( codeberg.org/gruf/go-ffmpreg v0.6.23-0.20260827095416-df1836cb5be0 - github.com/GopeedLab/webview_go v0.0.0-20260917161756-2a4f989dcb1d + github.com/GopeedLab/webview_go v0.0.0-20260917163929-ca26c3e6bcfa 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 diff --git a/go.sum b/go.sum index c341802f..bceef0f3 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ github.com/GopeedLab/webview_go v0.0.0-20260917155218-bd16da0d6f53 h1:nMSHKhbrEa github.com/GopeedLab/webview_go v0.0.0-20260917155218-bd16da0d6f53/go.mod h1:oNO07SCX8xgoHLds2OBwML8TU4xils88vMQ4gadKUHQ= github.com/GopeedLab/webview_go v0.0.0-20260917161756-2a4f989dcb1d h1:4fjlhJpBWa6IcdKVPkEMMIDd6Xo9JM09dJHdKU+1V7k= github.com/GopeedLab/webview_go v0.0.0-20260917161756-2a4f989dcb1d/go.mod h1:oNO07SCX8xgoHLds2OBwML8TU4xils88vMQ4gadKUHQ= +github.com/GopeedLab/webview_go v0.0.0-20260917163929-ca26c3e6bcfa h1:VkdBMcNHYTqCMwOOCimA7b3xZKV/qFIGrhh3+vm9n3s= +github.com/GopeedLab/webview_go v0.0.0-20260917163929-ca26c3e6bcfa/go.mod h1:oNO07SCX8xgoHLds2OBwML8TU4xils88vMQ4gadKUHQ= 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=