diff options
author | Teddy Wing | 2023-11-16 21:06:26 +0100 |
---|---|---|
committer | Teddy Wing | 2023-11-16 21:07:02 +0100 |
commit | 88334b4f12dab5d3b1068cbaf7619582ea864155 (patch) | |
tree | a25a1ac05c3fa71220cb160eb6dffaf9cdfcd259 /internal/swextreload.go | |
parent | bbbf957f675c9373db184052b9f21ddfd552aae0 (diff) | |
download | swextreload-88334b4f12dab5d3b1068cbaf7619582ea864155.tar.bz2 |
Try not cancelling context
Turns out this is what was closing the extension background page
DevTools window. We shouldn't run the context cancel function.
Diffstat (limited to 'internal/swextreload.go')
-rw-r--r-- | internal/swextreload.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/swextreload.go b/internal/swextreload.go index e8af38a..b66be95 100644 --- a/internal/swextreload.go +++ b/internal/swextreload.go @@ -67,6 +67,7 @@ func Reload( err = reloadTab( allocatorContext, extensionIDs[0], + firstExtensionTarget, isExtensionManifestV2(firstExtensionTarget), ) if err != nil { @@ -111,7 +112,7 @@ func reloadExtension( } targetCtx, cancel := chromedp.NewContext(ctx, chromedp.WithTargetID(targetID)) - defer cancel() + // defer cancel() log.Printf("Connected to target") @@ -141,6 +142,7 @@ func reloadExtension( func reloadTab( ctx context.Context, extensionID string, + letarget *target.Info, isExtensionManifestV2 bool, ) error { ctx, cancel := chromedp.NewContext(ctx) @@ -183,6 +185,9 @@ func reloadTab( defer cancel() } + ctx, cancel = chromedp.NewContext(ctx, chromedp.WithTargetID(letarget.TargetID)) + // defer cancel() + var tabsResp []byte err := chromedp.Run( ctx, |