Prevent nil request panic during resolve

This commit is contained in:
copilot-swe-agent[bot] authored and GitHub committed 2026-07-27 03:34:11 +00:00
1 parent 6f0cfdcd91
commit c2ada7dbaa
3 files changed
+22 -1

No files matched your search

+18
View File
@@ -21,6 +21,24 @@ import (
"github.com/dop251/goja"
)
func TestDownloader_ResolveNilRequest(t *testing.T) {
setupDownloader(func(downloader *Downloader) {
if _, err := downloader.Resolve(nil, nil); err == nil {
t.Fatal("expected invalid request error")
}
})
}
func TestScript_MatchNilRequest(t *testing.T) {
script := &Script{
Event: string(EventOnResolve),
Match: &Match{Urls: []string{"*://*/*"}},
}
if script.match(EventOnResolve, nil) {
t.Fatal("expected nil request not to match")
}
}
func TestDownloader_InstallExtensionByFolder(t *testing.T) {
setupDownloader(func(downloader *Downloader) {
if _, err := downloader.InstallExtensionByFolder("./testdata/extensions/basic", false); err != nil {