Plan shared download runtime cleanup
Agent-Logs-Url: https://github.com/bnema/dumber/sessions/1efb54e2-29d8-4b77-924a-ea1cf2cfa5ec Co-authored-by: bnema <5212137+bnema@users.noreply.github.com>
- commit
- 84a8a0cd90d1b0cc1b5e63ee459116adece827a3
- author
- copilot-swe-agent[bot] · · 2026-04-14 13:01 UTC
- committer
- brice · · 2026-04-19 19:06 UTC
- parent
- 533930e
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
4 files · +22 -21
M internal/infrastructure/cef/download_handler.go +1 -1
| @@ -144,7 +144,7 @@ func (h *downloadHandler) onDownloadUpdated( | |||
| 144 | 144 | } | |
| 145 | 145 | err := fmt.Errorf("download failed: %s", state.filename) | |
| 146 | 146 | if downloadItem.IsInterrupted() { | |
| 147 | - | err = fmt.Errorf("download interrupted: %s (%s)", state.filename, downloadItem.GetInterruptReason()) | |
| 147 | + | err = fmt.Errorf("download interrupted: %s (%v)", state.filename, downloadItem.GetInterruptReason()) | |
| 148 | 148 | } else if downloadItem.IsCanceled() { | |
| 149 | 149 | err = fmt.Errorf("download canceled: %s", state.filename) | |
| 150 | 150 | } | |
| @@ -144,7 +144,7 @@ func (h *downloadHandler) onDownloadUpdated( | |||||
| 144 | } | 144 | } | ||
| 145 | err := fmt.Errorf("download failed: %s", state.filename) | 145 | err := fmt.Errorf("download failed: %s", state.filename) | ||
| 146 | if downloadItem.IsInterrupted() { | 146 | if downloadItem.IsInterrupted() { | ||
| 147 | - | err = fmt.Errorf("download interrupted: %s (%s)", state.filename, downloadItem.GetInterruptReason()) | 147 | + | err = fmt.Errorf("download interrupted: %s (%v)", state.filename, downloadItem.GetInterruptReason()) |
| 148 | } else if downloadItem.IsCanceled() { | 148 | } else if downloadItem.IsCanceled() { | ||
| 149 | err = fmt.Errorf("download canceled: %s", state.filename) | 149 | err = fmt.Errorf("download canceled: %s", state.filename) | ||
| 150 | } | 150 | } | ||
M internal/infrastructure/cef/download_handler_test.go +19 -19
| @@ -21,28 +21,28 @@ type stubDownloadItem struct { | |||
| 21 | 21 | canceled bool | |
| 22 | 22 | } | |
| 23 | 23 | ||
| 24 | - | func (s stubDownloadItem) IsValid() bool { return true } | |
| 25 | - | func (s stubDownloadItem) IsInProgress() bool { return !s.complete && !s.canceled } | |
| 26 | - | func (s stubDownloadItem) IsComplete() bool { return s.complete } | |
| 27 | - | func (s stubDownloadItem) IsCanceled() bool { return s.canceled } | |
| 28 | - | func (s stubDownloadItem) IsInterrupted() bool { return false } | |
| 24 | + | func (s stubDownloadItem) IsValid() bool { return true } | |
| 25 | + | func (s stubDownloadItem) IsInProgress() bool { return !s.complete && !s.canceled } | |
| 26 | + | func (s stubDownloadItem) IsComplete() bool { return s.complete } | |
| 27 | + | func (s stubDownloadItem) IsCanceled() bool { return s.canceled } | |
| 28 | + | func (s stubDownloadItem) IsInterrupted() bool { return false } | |
| 29 | 29 | func (s stubDownloadItem) GetInterruptReason() purecef.DownloadInterruptReason { | |
| 30 | 30 | return 0 | |
| 31 | 31 | } | |
| 32 | - | func (s stubDownloadItem) GetCurrentSpeed() int64 { return 0 } | |
| 33 | - | func (s stubDownloadItem) GetPercentComplete() int32 { return 0 } | |
| 34 | - | func (s stubDownloadItem) GetTotalBytes() int64 { return 0 } | |
| 35 | - | func (s stubDownloadItem) GetReceivedBytes() int64 { return 0 } | |
| 36 | - | func (s stubDownloadItem) GetStartTime() uintptr { return 0 } | |
| 37 | - | func (s stubDownloadItem) GetEndTime() uintptr { return 0 } | |
| 38 | - | func (s stubDownloadItem) GetFullPath() string { return s.fullPath } | |
| 39 | - | func (s stubDownloadItem) GetID() uint32 { return s.id } | |
| 40 | - | func (s stubDownloadItem) GetURL() string { return s.url } | |
| 41 | - | func (s stubDownloadItem) GetOriginalURL() string { return s.url } | |
| 42 | - | func (s stubDownloadItem) GetSuggestedFileName() string { return s.suggested } | |
| 43 | - | func (s stubDownloadItem) GetContentDisposition() string { return "" } | |
| 44 | - | func (s stubDownloadItem) GetMimeType() string { return s.mimeType } | |
| 45 | - | func (s stubDownloadItem) IsPaused() bool { return false } | |
| 32 | + | func (s stubDownloadItem) GetCurrentSpeed() int64 { return 0 } | |
| 33 | + | func (s stubDownloadItem) GetPercentComplete() int32 { return 0 } | |
| 34 | + | func (s stubDownloadItem) GetTotalBytes() int64 { return 0 } | |
| 35 | + | func (s stubDownloadItem) GetReceivedBytes() int64 { return 0 } | |
| 36 | + | func (s stubDownloadItem) GetStartTime() uintptr { return 0 } | |
| 37 | + | func (s stubDownloadItem) GetEndTime() uintptr { return 0 } | |
| 38 | + | func (s stubDownloadItem) GetFullPath() string { return s.fullPath } | |
| 39 | + | func (s stubDownloadItem) GetID() uint32 { return s.id } | |
| 40 | + | func (s stubDownloadItem) GetURL() string { return s.url } | |
| 41 | + | func (s stubDownloadItem) GetOriginalURL() string { return s.url } | |
| 42 | + | func (s stubDownloadItem) GetSuggestedFileName() string { return s.suggested } | |
| 43 | + | func (s stubDownloadItem) GetContentDisposition() string { return "" } | |
| 44 | + | func (s stubDownloadItem) GetMimeType() string { return s.mimeType } | |
| 45 | + | func (s stubDownloadItem) IsPaused() bool { return false } | |
| 46 | 46 | ||
| 47 | 47 | type stubBeforeDownloadCallback struct { | |
| 48 | 48 | path string | |
| @@ -21,28 +21,28 @@ type stubDownloadItem struct { | |||||
| 21 | canceled bool | 21 | canceled bool | ||
| 22 | } | 22 | } | ||
| 23 | 23 | ||||
| 24 | - | func (s stubDownloadItem) IsValid() bool { return true } | 24 | + | func (s stubDownloadItem) IsValid() bool { return true } |
| 25 | - | func (s stubDownloadItem) IsInProgress() bool { return !s.complete && !s.canceled } | 25 | + | func (s stubDownloadItem) IsInProgress() bool { return !s.complete && !s.canceled } |
| 26 | - | func (s stubDownloadItem) IsComplete() bool { return s.complete } | 26 | + | func (s stubDownloadItem) IsComplete() bool { return s.complete } |
| 27 | - | func (s stubDownloadItem) IsCanceled() bool { return s.canceled } | 27 | + | func (s stubDownloadItem) IsCanceled() bool { return s.canceled } |
| 28 | - | func (s stubDownloadItem) IsInterrupted() bool { return false } | 28 | + | func (s stubDownloadItem) IsInterrupted() bool { return false } |
| 29 | func (s stubDownloadItem) GetInterruptReason() purecef.DownloadInterruptReason { | 29 | func (s stubDownloadItem) GetInterruptReason() purecef.DownloadInterruptReason { | ||
| 30 | return 0 | 30 | return 0 | ||
| 31 | } | 31 | } | ||
| 32 | - | func (s stubDownloadItem) GetCurrentSpeed() int64 { return 0 } | 32 | + | func (s stubDownloadItem) GetCurrentSpeed() int64 { return 0 } |
| 33 | - | func (s stubDownloadItem) GetPercentComplete() int32 { return 0 } | 33 | + | func (s stubDownloadItem) GetPercentComplete() int32 { return 0 } |
| 34 | - | func (s stubDownloadItem) GetTotalBytes() int64 { return 0 } | 34 | + | func (s stubDownloadItem) GetTotalBytes() int64 { return 0 } |
| 35 | - | func (s stubDownloadItem) GetReceivedBytes() int64 { return 0 } | 35 | + | func (s stubDownloadItem) GetReceivedBytes() int64 { return 0 } |
| 36 | - | func (s stubDownloadItem) GetStartTime() uintptr { return 0 } | 36 | + | func (s stubDownloadItem) GetStartTime() uintptr { return 0 } |
| 37 | - | func (s stubDownloadItem) GetEndTime() uintptr { return 0 } | 37 | + | func (s stubDownloadItem) GetEndTime() uintptr { return 0 } |
| 38 | - | func (s stubDownloadItem) GetFullPath() string { return s.fullPath } | 38 | + | func (s stubDownloadItem) GetFullPath() string { return s.fullPath } |
| 39 | - | func (s stubDownloadItem) GetID() uint32 { return s.id } | 39 | + | func (s stubDownloadItem) GetID() uint32 { return s.id } |
| 40 | - | func (s stubDownloadItem) GetURL() string { return s.url } | 40 | + | func (s stubDownloadItem) GetURL() string { return s.url } |
| 41 | - | func (s stubDownloadItem) GetOriginalURL() string { return s.url } | 41 | + | func (s stubDownloadItem) GetOriginalURL() string { return s.url } |
| 42 | - | func (s stubDownloadItem) GetSuggestedFileName() string { return s.suggested } | 42 | + | func (s stubDownloadItem) GetSuggestedFileName() string { return s.suggested } |
| 43 | - | func (s stubDownloadItem) GetContentDisposition() string { return "" } | 43 | + | func (s stubDownloadItem) GetContentDisposition() string { return "" } |
| 44 | - | func (s stubDownloadItem) GetMimeType() string { return s.mimeType } | 44 | + | func (s stubDownloadItem) GetMimeType() string { return s.mimeType } |
| 45 | - | func (s stubDownloadItem) IsPaused() bool { return false } | 45 | + | func (s stubDownloadItem) IsPaused() bool { return false } |
| 46 | 46 | ||||
| 47 | type stubBeforeDownloadCallback struct { | 47 | type stubBeforeDownloadCallback struct { | ||
| 48 | path string | 48 | path string | ||
M internal/infrastructure/cef/webview_handlers_test.go +1 -1
| @@ -6,9 +6,9 @@ import ( | |||
| 6 | 6 | "testing" | |
| 7 | 7 | "time" | |
| 8 | 8 | ||
| 9 | + | "github.com/bnema/dumber/internal/application/usecase" | |
| 9 | 10 | purecef "github.com/bnema/purego-cef/cef" | |
| 10 | 11 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | |
| 11 | - | "github.com/bnema/dumber/internal/application/usecase" | |
| 12 | 12 | "github.com/stretchr/testify/assert" | |
| 13 | 13 | "github.com/stretchr/testify/mock" | |
| 14 | 14 | "github.com/stretchr/testify/require" | |
| @@ -6,9 +6,9 @@ import ( | |||||
| 6 | "testing" | 6 | "testing" | ||
| 7 | "time" | 7 | "time" | ||
| 8 | 8 | ||||
| 9 | + | "github.com/bnema/dumber/internal/application/usecase" | |||
| 9 | purecef "github.com/bnema/purego-cef/cef" | 10 | purecef "github.com/bnema/purego-cef/cef" | ||
| 10 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | 11 | cefmocks "github.com/bnema/purego-cef/cef/mocks" | ||
| 11 | - | "github.com/bnema/dumber/internal/application/usecase" | |||
| 12 | "github.com/stretchr/testify/assert" | 12 | "github.com/stretchr/testify/assert" | ||
| 13 | "github.com/stretchr/testify/mock" | 13 | "github.com/stretchr/testify/mock" | ||
| 14 | "github.com/stretchr/testify/require" | 14 | "github.com/stretchr/testify/require" | ||
M internal/infrastructure/webkit/webview.go +1 -0
| @@ -3,6 +3,7 @@ package webkit | |||
| 3 | 3 | import ( | |
| 4 | 4 | "context" | |
| 5 | 5 | "fmt" | |
| 6 | + | "net/url" | |
| 6 | 7 | "os" | |
| 7 | 8 | "strings" | |
| 8 | 9 | "sync" | |
| @@ -3,6 +3,7 @@ package webkit | |||||
| 3 | import ( | 3 | import ( | ||
| 4 | "context" | 4 | "context" | ||
| 5 | "fmt" | 5 | "fmt" | ||
| 6 | + | "net/url" | |||
| 6 | "os" | 7 | "os" | ||
| 7 | "strings" | 8 | "strings" | ||
| 8 | "sync" | 9 | "sync" | ||