Skip to content

Refactor FXIOS-15851 WindowManager tabManager API should return an optional value#33928

Open
mattreaganmozilla wants to merge 2 commits into
mozilla-mobile:mainfrom
mattreaganmozilla:mr/15851
Open

Refactor FXIOS-15851 WindowManager tabManager API should return an optional value#33928
mattreaganmozilla wants to merge 2 commits into
mozilla-mobile:mainfrom
mattreaganmozilla:mr/15851

Conversation

@mattreaganmozilla
Copy link
Copy Markdown
Collaborator

📜 Tickets

Jira ticket

💡 Description

Refactors the tabManager API in our WindowManager adopters to return an optional value. I've kept the Sentry logging in that func in place, so that unexpected or invalid UUIDs should still be visible to us.

Because we're still logging in that func, in most cases early returns are still reasonable and are preferable to us doing something like returning some other window's tabManager (which is very unsafe).

📝 Checklist

  • I filled in the ticket numbers and a description of my work
  • I updated the PR name to follow our PR naming guidelines
  • I ensured unit tests pass and wrote tests for new code
  • If working on UI, I checked and implemented accessibility (Dynamic Text and VoiceOver)
  • If adding telemetry, I read the data stewardship requirements and will request a data review
  • If adding or modifying strings, I read the guidelines and will request a string review from l10n
  • If needed, I updated documentation and added comments to complex code

@mattreaganmozilla mattreaganmozilla requested a review from a team as a code owner May 20, 2026 21:03
@mattreaganmozilla
Copy link
Copy Markdown
Collaborator Author

+cc @lmarceau Since this is ultimately more of a Tab change than an actual WindowManager change.

@mobiletest-ci-bot
Copy link
Copy Markdown

Messages
📖 Project coverage: 42.3%

💪 Quality guardian

2 tests files modified. You're a champion of test coverage! 🚀

🥇 Perfect PR size

Smaller PRs are easier to review. Thanks for making life easy for reviewers! ✨

💬 Description craftsman

Great PR description! Reviewers salute you 🫡

✅ New file code coverage

No new file detected so code coverage gate wasn't ran.

✅ Existing file code coverage

All modified files meet their thresholds.

Client.app: Coverage: 40.74

File Coverage
TabManagerMiddleware.swift 40.19% ⚠️
WindowManager+DebugUtilities.swift 0.0% ⚠️
SceneDelegate.swift 33.78% ⚠️
StartAtHomeMiddleware.swift 90.0%
NativeErrorPageMiddleware.swift 0.0% ⚠️
TabErrorTelemetryHelper.swift 46.02% ⚠️
TranslationsMiddleware.swift 89.13%
AppDelegate.swift 0.0% ⚠️
ToolbarMiddleware.swift 93.81%
SummarizeMiddleware.swift 97.71%
TranslationsService.swift 37.82% ⚠️
WindowManager.swift 86.92%

Generated by 🚫 Danger Swift against ec838e8


/// Convenience. Provides opportunity for safety checks or window validation.
@MainActor
func windowExists(uuid: WindowUUID) -> Bool
Copy link
Copy Markdown
Collaborator Author

@mattreaganmozilla mattreaganmozilla May 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed windowExists() because I think it was a code smell. Generally callers should not need to directly check this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants