Skip to content

Commit 9b59b15

Browse files
committed
Fix stale toolbar pin for unpacked extensions
1 parent 49a7abe commit 9b59b15

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

server/lib/policy/policy.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,16 @@ func (p *Policy) AddExtension(extensionName, chromeExtensionID, extensionPath st
242242

243243
// Extensions on this path are loaded via --load-extension, where Chrome
244244
// assigns an ID derived from the install path rather than extensionName.
245-
// toolbar_pin is keyed by that real ID, so pin under the computed ID.
245+
// toolbar_pin is keyed by that real ID.
246+
pinnedID := UnpackedExtensionID(extensionPath)
246247
if pinned {
247-
pinnedID := UnpackedExtensionID(extensionPath)
248248
pinnedSetting := current.ExtensionSettings[pinnedID]
249249
pinnedSetting.ToolbarPin = forcePinned
250250
current.ExtensionSettings[pinnedID] = pinnedSetting
251+
} else if pinnedSetting, exists := current.ExtensionSettings[pinnedID]; exists {
252+
// Explicitly clear stale force_pinned when callers unpin.
253+
pinnedSetting.ToolbarPin = ""
254+
current.ExtensionSettings[pinnedID] = pinnedSetting
251255
}
252256
}
253257

0 commit comments

Comments
 (0)