detached 0b00d6c

content: apply safe simplify follow-ups

commit
0b00d6c69a02f2e9c8391e1a5c7b393289bfd282
author
brice · · 2026-04-23 04:43 UTC
parent
71feac4
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
4 files · +16 -29
M internal/infrastructure/cef/popup_opener_bridge.go +2 -6
@@ -92,12 +92,8 @@ func (wv *WebView) runOpenerNavigationCallbacks(uri string) {
9292
9393 // HasActivePopupOpenerBridge implements port.PopupOpenerCapable.
9494 func (wv *WebView) HasActivePopupOpenerBridge() bool {
95- if wv == nil {
96- return false
97- }
98- wv.mu.RLock()
99- defer wv.mu.RUnlock()
100- return !wv.popupNoJavaScriptAccess && wv.popupOpenerBridgeParent != nil
95+ _, active, _ := wv.popupOpenerBridgeState()
96+ return active
10197 }
10298
10399 func (wv *WebView) popupOpenerBridgeState() (parentURI string, active bool, blocked bool) {
@@ -92,12 +92,8 @@ func (wv *WebView) runOpenerNavigationCallbacks(uri string) {
92 92
93 // HasActivePopupOpenerBridge implements port.PopupOpenerCapable.93 // HasActivePopupOpenerBridge implements port.PopupOpenerCapable.
94 func (wv *WebView) HasActivePopupOpenerBridge() bool {94 func (wv *WebView) HasActivePopupOpenerBridge() bool {
95- if wv == nil {95+ _, active, _ := wv.popupOpenerBridgeState()
96- return false96+ return active
97- }
98- wv.mu.RLock()
99- defer wv.mu.RUnlock()
100- return !wv.popupNoJavaScriptAccess && wv.popupOpenerBridgeParent != nil
101 }97 }
102 98
103 func (wv *WebView) popupOpenerBridgeState() (parentURI string, active bool, blocked bool) {99 func (wv *WebView) popupOpenerBridgeState() (parentURI string, active bool, blocked bool) {
M internal/infrastructure/cef/webview_popup_proxy.go +3 -6
@@ -9,10 +9,9 @@ import (
99 )
1010
1111 type syntheticPopupState struct {
12- WebView port.WebView
13- PendingURI string
14- NoJavaScriptAccess bool
15- Closed bool
12+ WebView port.WebView
13+ PendingURI string
14+ Closed bool
1615 }
1716
1817 func (wv *WebView) syntheticPopupState(proxyID string) *syntheticPopupState {
@@ -67,7 +66,6 @@ func (wv *WebView) handleSyntheticPopupOpen(targetURL, frameName, proxyID string
6766 wv.syntheticPopupMu.Unlock()
6867 return
6968 }
70- state.NoJavaScriptAccess = noJavaScriptAccess
7169 wv.syntheticPopupMu.Unlock()
7270
7371 wv.runOnGTK(func() {
@@ -116,7 +114,6 @@ func (wv *WebView) handleSyntheticPopupOpen(targetURL, frameName, proxyID string
116114 return
117115 }
118116 state.WebView = popupWV
119- state.NoJavaScriptAccess = noJavaScriptAccess
120117 pendingURI = strings.TrimSpace(state.PendingURI)
121118 wv.syntheticPopupMu.Unlock()
122119
@@ -9,10 +9,9 @@ import (
9 )9 )
10 10
11 type syntheticPopupState struct {11 type syntheticPopupState struct {
12- WebView port.WebView12+ WebView port.WebView
13- PendingURI string13+ PendingURI string
14- NoJavaScriptAccess bool14+ Closed bool
15- Closed bool
16 }15 }
17 16
18 func (wv *WebView) syntheticPopupState(proxyID string) *syntheticPopupState {17 func (wv *WebView) syntheticPopupState(proxyID string) *syntheticPopupState {
@@ -67,7 +66,6 @@ func (wv *WebView) handleSyntheticPopupOpen(targetURL, frameName, proxyID string
67 wv.syntheticPopupMu.Unlock()66 wv.syntheticPopupMu.Unlock()
68 return67 return
69 }68 }
70- state.NoJavaScriptAccess = noJavaScriptAccess
71 wv.syntheticPopupMu.Unlock()69 wv.syntheticPopupMu.Unlock()
72 70
73 wv.runOnGTK(func() {71 wv.runOnGTK(func() {
@@ -116,7 +114,6 @@ func (wv *WebView) handleSyntheticPopupOpen(targetURL, frameName, proxyID string
116 return114 return
117 }115 }
118 state.WebView = popupWV116 state.WebView = popupWV
119- state.NoJavaScriptAccess = noJavaScriptAccess
120 pendingURI = strings.TrimSpace(state.PendingURI)117 pendingURI = strings.TrimSpace(state.PendingURI)
121 wv.syntheticPopupMu.Unlock()118 wv.syntheticPopupMu.Unlock()
122 119
M internal/ui/coordinator/content/popup.go +1 -1
@@ -229,7 +229,7 @@ func (c *Coordinator) createPopupWebView(
229229 parentID port.WebViewID,
230230 targetURI string,
231231 noJavaScriptAccess bool,
232-) (port.WebView, string, bool, error) {
232+) (port.WebView, bool, error) {
233233 return c.ensurePopupManager().createPopupWebView(ctx, parentID, targetURI, noJavaScriptAccess)
234234 }
235235
@@ -229,7 +229,7 @@ func (c *Coordinator) createPopupWebView(
229 parentID port.WebViewID,229 parentID port.WebViewID,
230 targetURI string,230 targetURI string,
231 noJavaScriptAccess bool,231 noJavaScriptAccess bool,
232-) (port.WebView, string, bool, error) {232+) (port.WebView, bool, error) {
233 return c.ensurePopupManager().createPopupWebView(ctx, parentID, targetURI, noJavaScriptAccess)233 return c.ensurePopupManager().createPopupWebView(ctx, parentID, targetURI, noJavaScriptAccess)
234 }234 }
235 235
M internal/ui/coordinator/content/popup_manager.go +10 -16
@@ -348,9 +348,9 @@ func (pm *popupManager) createPopupWebView(
348348 parentID port.WebViewID,
349349 targetURI string,
350350 noJavaScriptAccess bool,
351-) (port.WebView, string, bool, error) {
351+) (port.WebView, bool, error) {
352352 if pm == nil || pm.factory == nil {
353- return nil, targetURI, false, fmt.Errorf("no webview factory configured")
353+ return nil, false, fmt.Errorf("no webview factory configured")
354354 }
355355
356356 log := logging.FromContext(ctx)
@@ -360,7 +360,7 @@ func (pm *popupManager) createPopupWebView(
360360 popupWV, err := pm.factory.CreateRelated(ctx, parentID)
361361 if err == nil && popupWV != nil {
362362 pm.markRelatedPopupSupported()
363- return popupWV, targetURI, false, nil
363+ return popupWV, false, nil
364364 }
365365 if err == nil {
366366 relatedErr = fmt.Errorf("related popup webview factory returned nil without error")
@@ -399,18 +399,18 @@ func (pm *popupManager) createPopupWebView(
399399 popupWV, fallbackErr := pm.factory.Create(ctx)
400400 if fallbackErr != nil {
401401 if relatedErr != nil {
402- return nil, targetURI, false, fmt.Errorf("create popup webview: related failed: %w; fallback failed: %w", relatedErr, fallbackErr)
402+ return nil, false, fmt.Errorf("create popup webview: related failed: %w; fallback failed: %w", relatedErr, fallbackErr)
403403 }
404- return nil, targetURI, false, fmt.Errorf("create popup webview: fallback failed: %w", fallbackErr)
404+ return nil, false, fmt.Errorf("create popup webview: fallback failed: %w", fallbackErr)
405405 }
406406 if popupWV == nil {
407407 if relatedErr != nil {
408- return nil, targetURI, false, fmt.Errorf("create popup webview: related failed: %w; fallback returned nil", relatedErr)
408+ return nil, false, fmt.Errorf("create popup webview: related failed: %w; fallback returned nil", relatedErr)
409409 }
410- return nil, targetURI, false, fmt.Errorf("create popup webview: fallback returned nil")
410+ return nil, false, fmt.Errorf("create popup webview: fallback returned nil")
411411 }
412412
413- return popupWV, targetURI, true, nil
413+ return popupWV, true, nil
414414 }
415415
416416 func (pm *popupManager) reuseNamedPopup(
@@ -481,15 +481,11 @@ func (pm *popupManager) handlePopupCreate(
481481 }
482482 }
483483
484- popupWV, effectiveTargetURI, usedRegularFallback, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, req.NoJavaScriptAccess)
484+ popupWV, usedRegularFallback, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, req.NoJavaScriptAccess)
485485 if err != nil {
486486 log.Error().Err(err).Msg("failed to create webview for popup")
487487 return nil
488488 }
489-
490- if effectiveTargetURI != req.TargetURI {
491- req.TargetURI = effectiveTargetURI
492- }
493489 if usedRegularFallback {
494490 if openerBridge, ok := popupWV.(port.PopupOpenerCapable); ok {
495491 openerBridge.EnablePopupOpenerBridge(parentWV, req.NoJavaScriptAccess)
@@ -679,9 +675,7 @@ func (pm *popupManager) handlePopupClose(ctx context.Context, hooks popupCoordin
679675 fields = fields.
680676 Str("current_uri", logging.TruncateURL(wv.URI(), logURLMaxLen)).
681677 Bool("is_loading", wv.IsLoading())
682- if opener, ok := wv.(port.PopupOpenerCapable); ok {
683- fields = fields.Bool("synthetic_opener_active", opener.HasActivePopupOpenerBridge())
684- }
678+ fields = fields.Bool("synthetic_opener_active", popupUsesSyntheticOpenerSignals(wv))
685679 }
686680 }
687681 }
@@ -348,9 +348,9 @@ func (pm *popupManager) createPopupWebView(
348 parentID port.WebViewID,348 parentID port.WebViewID,
349 targetURI string,349 targetURI string,
350 noJavaScriptAccess bool,350 noJavaScriptAccess bool,
351-) (port.WebView, string, bool, error) {351+) (port.WebView, bool, error) {
352 if pm == nil || pm.factory == nil {352 if pm == nil || pm.factory == nil {
353- return nil, targetURI, false, fmt.Errorf("no webview factory configured")353+ return nil, false, fmt.Errorf("no webview factory configured")
354 }354 }
355 355
356 log := logging.FromContext(ctx)356 log := logging.FromContext(ctx)
@@ -360,7 +360,7 @@ func (pm *popupManager) createPopupWebView(
360 popupWV, err := pm.factory.CreateRelated(ctx, parentID)360 popupWV, err := pm.factory.CreateRelated(ctx, parentID)
361 if err == nil && popupWV != nil {361 if err == nil && popupWV != nil {
362 pm.markRelatedPopupSupported()362 pm.markRelatedPopupSupported()
363- return popupWV, targetURI, false, nil363+ return popupWV, false, nil
364 }364 }
365 if err == nil {365 if err == nil {
366 relatedErr = fmt.Errorf("related popup webview factory returned nil without error")366 relatedErr = fmt.Errorf("related popup webview factory returned nil without error")
@@ -399,18 +399,18 @@ func (pm *popupManager) createPopupWebView(
399 popupWV, fallbackErr := pm.factory.Create(ctx)399 popupWV, fallbackErr := pm.factory.Create(ctx)
400 if fallbackErr != nil {400 if fallbackErr != nil {
401 if relatedErr != nil {401 if relatedErr != nil {
402- return nil, targetURI, false, fmt.Errorf("create popup webview: related failed: %w; fallback failed: %w", relatedErr, fallbackErr)402+ return nil, false, fmt.Errorf("create popup webview: related failed: %w; fallback failed: %w", relatedErr, fallbackErr)
403 }403 }
404- return nil, targetURI, false, fmt.Errorf("create popup webview: fallback failed: %w", fallbackErr)404+ return nil, false, fmt.Errorf("create popup webview: fallback failed: %w", fallbackErr)
405 }405 }
406 if popupWV == nil {406 if popupWV == nil {
407 if relatedErr != nil {407 if relatedErr != nil {
408- return nil, targetURI, false, fmt.Errorf("create popup webview: related failed: %w; fallback returned nil", relatedErr)408+ return nil, false, fmt.Errorf("create popup webview: related failed: %w; fallback returned nil", relatedErr)
409 }409 }
410- return nil, targetURI, false, fmt.Errorf("create popup webview: fallback returned nil")410+ return nil, false, fmt.Errorf("create popup webview: fallback returned nil")
411 }411 }
412 412
413- return popupWV, targetURI, true, nil413+ return popupWV, true, nil
414 }414 }
415 415
416 func (pm *popupManager) reuseNamedPopup(416 func (pm *popupManager) reuseNamedPopup(
@@ -481,15 +481,11 @@ func (pm *popupManager) handlePopupCreate(
481 }481 }
482 }482 }
483 483
484- popupWV, effectiveTargetURI, usedRegularFallback, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, req.NoJavaScriptAccess)484+ popupWV, usedRegularFallback, err := pm.createPopupWebView(ctx, parentID, req.TargetURI, req.NoJavaScriptAccess)
485 if err != nil {485 if err != nil {
486 log.Error().Err(err).Msg("failed to create webview for popup")486 log.Error().Err(err).Msg("failed to create webview for popup")
487 return nil487 return nil
488 }488 }
489-
490- if effectiveTargetURI != req.TargetURI {
491- req.TargetURI = effectiveTargetURI
492- }
493 if usedRegularFallback {489 if usedRegularFallback {
494 if openerBridge, ok := popupWV.(port.PopupOpenerCapable); ok {490 if openerBridge, ok := popupWV.(port.PopupOpenerCapable); ok {
495 openerBridge.EnablePopupOpenerBridge(parentWV, req.NoJavaScriptAccess)491 openerBridge.EnablePopupOpenerBridge(parentWV, req.NoJavaScriptAccess)
@@ -679,9 +675,7 @@ func (pm *popupManager) handlePopupClose(ctx context.Context, hooks popupCoordin
679 fields = fields.675 fields = fields.
680 Str("current_uri", logging.TruncateURL(wv.URI(), logURLMaxLen)).676 Str("current_uri", logging.TruncateURL(wv.URI(), logURLMaxLen)).
681 Bool("is_loading", wv.IsLoading())677 Bool("is_loading", wv.IsLoading())
682- if opener, ok := wv.(port.PopupOpenerCapable); ok {678+ fields = fields.Bool("synthetic_opener_active", popupUsesSyntheticOpenerSignals(wv))
683- fields = fields.Bool("synthetic_opener_active", opener.HasActivePopupOpenerBridge())
684- }
685 }679 }
686 }680 }
687 }681 }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close