fix(popup): satisfy routing lint checks
- commit
- 1ee31e617df70806e137b2b0ed3d88d8d671113e
- author
- brice · · 2026-07-25 08:32 UTC
- committer
- brice · · 2026-07-26 16:42 UTC
- parent
- 82824ac
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +18 -10
M internal/infrastructure/cef/webview_handlers.go +2 -0
| @@ -638,6 +638,8 @@ func mapCEFWindowDisposition(disposition purecef.WindowOpenDisposition) dto.Wind | |||
| 638 | 638 | // client back to CEF and allow native popup creation so opener semantics are | |
| 639 | 639 | // preserved. Otherwise we keep blocking and let the coordinator's fallback | |
| 640 | 640 | // pane handle the navigation. | |
| 641 | + | // | |
| 642 | + | //nolint:funlen // Popup ownership transitions stay linear to keep CEF callback semantics auditable. | |
| 641 | 643 | func (h *handlerSet) OnBeforePopup( | |
| 642 | 644 | browser purecef.Browser, frame purecef.Frame, popupID int32, targetURL, targetFrameName string, | |
| 643 | 645 | targetDisposition purecef.WindowOpenDisposition, userGesture int32, popupFeatures *purecef.PopupFeatures, | |
| @@ -638,6 +638,8 @@ func mapCEFWindowDisposition(disposition purecef.WindowOpenDisposition) dto.Wind | |||||
| 638 | // client back to CEF and allow native popup creation so opener semantics are | 638 | // client back to CEF and allow native popup creation so opener semantics are | ||
| 639 | // preserved. Otherwise we keep blocking and let the coordinator's fallback | 639 | // preserved. Otherwise we keep blocking and let the coordinator's fallback | ||
| 640 | // pane handle the navigation. | 640 | // pane handle the navigation. | ||
| 641 | + | // | |||
| 642 | + | //nolint:funlen // Popup ownership transitions stay linear to keep CEF callback semantics auditable. | |||
| 641 | func (h *handlerSet) OnBeforePopup( | 643 | func (h *handlerSet) OnBeforePopup( | ||
| 642 | browser purecef.Browser, frame purecef.Frame, popupID int32, targetURL, targetFrameName string, | 644 | browser purecef.Browser, frame purecef.Frame, popupID int32, targetURL, targetFrameName string, | ||
| 643 | targetDisposition purecef.WindowOpenDisposition, userGesture int32, popupFeatures *purecef.PopupFeatures, | 645 | targetDisposition purecef.WindowOpenDisposition, userGesture int32, popupFeatures *purecef.PopupFeatures, | ||
M internal/ui/app.go +5 -5
| @@ -615,16 +615,16 @@ func (a *App) ownerOrLastFocusedBrowserWindow(tabID entity.TabID, paneID entity. | |||
| 615 | 615 | return a.lastFocusedBrowserWindow() | |
| 616 | 616 | } | |
| 617 | 617 | ||
| 618 | - | func (a *App) openPopupNativeWindow(ctx context.Context, input content.NativePopupInput) error { | |
| 619 | - | if err := a.openNativePopupWindow(ctx, input); err != nil { | |
| 618 | + | func (a *App) openPopupNativeWindow(ctx context.Context, popupInput content.NativePopupInput) error { | |
| 619 | + | if err := a.openNativePopupWindow(ctx, popupInput); err != nil { | |
| 620 | 620 | return err | |
| 621 | 621 | } | |
| 622 | 622 | // Deferred WebKit classification runs from ready-to-show. The native host | |
| 623 | 623 | // is attached after that signal, so it must be revealed immediately rather | |
| 624 | 624 | // than waiting for an already-delivered lifecycle callback. | |
| 625 | - | if input.Request.Engine == dto.BrowserEngineWebKit && | |
| 626 | - | input.Request.PopupFeatures.State == dto.PopupFeaturesSpecified { | |
| 627 | - | a.showNativePopupWindow(input.PopupWebView.ID()) | |
| 625 | + | if popupInput.Request.Engine == dto.BrowserEngineWebKit && | |
| 626 | + | popupInput.Request.PopupFeatures.State == dto.PopupFeaturesSpecified { | |
| 627 | + | a.showNativePopupWindow(popupInput.PopupWebView.ID()) | |
| 628 | 628 | } | |
| 629 | 629 | return nil | |
| 630 | 630 | } | |
| @@ -615,16 +615,16 @@ func (a *App) ownerOrLastFocusedBrowserWindow(tabID entity.TabID, paneID entity. | |||||
| 615 | return a.lastFocusedBrowserWindow() | 615 | return a.lastFocusedBrowserWindow() | ||
| 616 | } | 616 | } | ||
| 617 | 617 | ||||
| 618 | - | func (a *App) openPopupNativeWindow(ctx context.Context, input content.NativePopupInput) error { | 618 | + | func (a *App) openPopupNativeWindow(ctx context.Context, popupInput content.NativePopupInput) error { |
| 619 | - | if err := a.openNativePopupWindow(ctx, input); err != nil { | 619 | + | if err := a.openNativePopupWindow(ctx, popupInput); err != nil { |
| 620 | return err | 620 | return err | ||
| 621 | } | 621 | } | ||
| 622 | // Deferred WebKit classification runs from ready-to-show. The native host | 622 | // Deferred WebKit classification runs from ready-to-show. The native host | ||
| 623 | // is attached after that signal, so it must be revealed immediately rather | 623 | // is attached after that signal, so it must be revealed immediately rather | ||
| 624 | // than waiting for an already-delivered lifecycle callback. | 624 | // than waiting for an already-delivered lifecycle callback. | ||
| 625 | - | if input.Request.Engine == dto.BrowserEngineWebKit && | 625 | + | if popupInput.Request.Engine == dto.BrowserEngineWebKit && |
| 626 | - | input.Request.PopupFeatures.State == dto.PopupFeaturesSpecified { | 626 | + | popupInput.Request.PopupFeatures.State == dto.PopupFeaturesSpecified { |
| 627 | - | a.showNativePopupWindow(input.PopupWebView.ID()) | 627 | + | a.showNativePopupWindow(popupInput.PopupWebView.ID()) |
| 628 | } | 628 | } | ||
| 629 | return nil | 629 | return nil | ||
| 630 | } | 630 | } | ||
M internal/ui/coordinator/content/popup_deferred.go +11 -5
| @@ -89,17 +89,17 @@ func (pm *popupManager) cancelDeferredPopupsMatching(match func(*deferredPending | |||
| 89 | 89 | return | |
| 90 | 90 | } | |
| 91 | 91 | pm.mu.Lock() | |
| 92 | - | cancelled := make([]*deferredPendingPopup, 0) | |
| 92 | + | canceled := make([]*deferredPendingPopup, 0) | |
| 93 | 93 | for popupID, pending := range pm.deferredPopups { | |
| 94 | 94 | if pending == nil || !match(pending) { | |
| 95 | 95 | continue | |
| 96 | 96 | } | |
| 97 | 97 | delete(pm.deferredPopups, popupID) | |
| 98 | 98 | delete(pm.pendingPopups, popupID) | |
| 99 | - | cancelled = append(cancelled, pending) | |
| 99 | + | canceled = append(canceled, pending) | |
| 100 | 100 | } | |
| 101 | 101 | pm.mu.Unlock() | |
| 102 | - | for _, pending := range cancelled { | |
| 102 | + | for _, pending := range canceled { | |
| 103 | 103 | pm.cleanupDeferredPending(pending) | |
| 104 | 104 | } | |
| 105 | 105 | } | |
| @@ -181,9 +181,15 @@ func (pm *popupManager) resolvePendingPopupFeatures( | |||
| 181 | 181 | transferred := false | |
| 182 | 182 | switch decision.Kind { | |
| 183 | 183 | case dto.HostDecisionCreateBrowserWindow: | |
| 184 | - | transferred = pm.openExistingPopupInBrowserWindow(ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, pending.WebView, request, decision, true) | |
| 184 | + | transferred = pm.openExistingPopupInBrowserWindow( | |
| 185 | + | ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, | |
| 186 | + | pending.WebView, request, decision, true, | |
| 187 | + | ) | |
| 185 | 188 | case dto.HostDecisionCreateNativePopup: | |
| 186 | - | transferred = pm.openExistingPopupInNativePopup(ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, parentURIAtOpen, pending.WebView, request, decision) | |
| 189 | + | transferred = pm.openExistingPopupInNativePopup( | |
| 190 | + | ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, | |
| 191 | + | parentURIAtOpen, pending.WebView, request, decision, | |
| 192 | + | ) | |
| 187 | 193 | case dto.HostDecisionReuseNamedPane: | |
| 188 | 194 | // Reuse transfers no ownership: the existing context is navigated while | |
| 189 | 195 | // the newly staged WebView remains ours and must be discarded below. | |
| @@ -89,17 +89,17 @@ func (pm *popupManager) cancelDeferredPopupsMatching(match func(*deferredPending | |||||
| 89 | return | 89 | return | ||
| 90 | } | 90 | } | ||
| 91 | pm.mu.Lock() | 91 | pm.mu.Lock() | ||
| 92 | - | cancelled := make([]*deferredPendingPopup, 0) | 92 | + | canceled := make([]*deferredPendingPopup, 0) |
| 93 | for popupID, pending := range pm.deferredPopups { | 93 | for popupID, pending := range pm.deferredPopups { | ||
| 94 | if pending == nil || !match(pending) { | 94 | if pending == nil || !match(pending) { | ||
| 95 | continue | 95 | continue | ||
| 96 | } | 96 | } | ||
| 97 | delete(pm.deferredPopups, popupID) | 97 | delete(pm.deferredPopups, popupID) | ||
| 98 | delete(pm.pendingPopups, popupID) | 98 | delete(pm.pendingPopups, popupID) | ||
| 99 | - | cancelled = append(cancelled, pending) | 99 | + | canceled = append(canceled, pending) |
| 100 | } | 100 | } | ||
| 101 | pm.mu.Unlock() | 101 | pm.mu.Unlock() | ||
| 102 | - | for _, pending := range cancelled { | 102 | + | for _, pending := range canceled { |
| 103 | pm.cleanupDeferredPending(pending) | 103 | pm.cleanupDeferredPending(pending) | ||
| 104 | } | 104 | } | ||
| 105 | } | 105 | } | ||
| @@ -181,9 +181,15 @@ func (pm *popupManager) resolvePendingPopupFeatures( | |||||
| 181 | transferred := false | 181 | transferred := false | ||
| 182 | switch decision.Kind { | 182 | switch decision.Kind { | ||
| 183 | case dto.HostDecisionCreateBrowserWindow: | 183 | case dto.HostDecisionCreateBrowserWindow: | ||
| 184 | - | transferred = pm.openExistingPopupInBrowserWindow(ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, pending.WebView, request, decision, true) | 184 | + | transferred = pm.openExistingPopupInBrowserWindow( |
| 185 | + | ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, | |||
| 186 | + | pending.WebView, request, decision, true, | |||
| 187 | + | ) | |||
| 185 | case dto.HostDecisionCreateNativePopup: | 188 | case dto.HostDecisionCreateNativePopup: | ||
| 186 | - | transferred = pm.openExistingPopupInNativePopup(ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, parentURIAtOpen, pending.WebView, request, decision) | 189 | + | transferred = pm.openExistingPopupInNativePopup( |
| 190 | + | ctx, hooks, pending.ParentPaneID, pending.ParentWebViewID, | |||
| 191 | + | parentURIAtOpen, pending.WebView, request, decision, | |||
| 192 | + | ) | |||
| 187 | case dto.HostDecisionReuseNamedPane: | 193 | case dto.HostDecisionReuseNamedPane: | ||
| 188 | // Reuse transfers no ownership: the existing context is navigated while | 194 | // Reuse transfers no ownership: the existing context is navigated while | ||
| 189 | // the newly staged WebView remains ours and must be discarded below. | 195 | // the newly staged WebView remains ours and must be discarded below. | ||