aboutsummaryrefslogtreecommitdiffstats
path: root/internal/swextreload.go
diff options
context:
space:
mode:
authorTeddy Wing2023-11-25 14:53:19 +0100
committerTeddy Wing2023-11-25 14:53:19 +0100
commitb02dd4f742ec79a9e885a01579c15a151f5f9ebc (patch)
treea4f3e72cec52d05ce491fa7dcc838de59a0a5e9e /internal/swextreload.go
parenta4ecd256f1297080646bab1f9a29d196ea7e3a75 (diff)
downloadswextreload-b02dd4f742ec79a9e885a01579c15a151f5f9ebc.tar.bz2
swextreload: Explain MV2 vs. MV3 tab reload handling
Diffstat (limited to 'internal/swextreload.go')
-rw-r--r--internal/swextreload.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/internal/swextreload.go b/internal/swextreload.go
index 1d5af22..ffa083d 100644
--- a/internal/swextreload.go
+++ b/internal/swextreload.go
@@ -158,8 +158,14 @@ func reloadTab(
logDebugf("Reload tab (Manifest V2: %t)", isExtensionManifestV2)
+ // If the extension is Manifest V3, its `targetId` reset after we reloaded
+ // the extension from the service worker, presumably because it was
+ // reinstalled. In that case, we need to get targets again, find the new
+ // `targetId`, and connect to it.
+ //
+ // If the extension is Manifest V2, we can just reconnect to the existing
+ // target.
if !isExtensionManifestV2 {
- // TODO: If MV2, then don't re-attach, only do it if "service_worker"
targets, err := chromedp.Targets(ctx)
if err != nil {
return fmt.Errorf(