feat(url): support Firefox-based browsers in per-URL rules#14
Conversation
The reader previously excluded Firefox on the assumption that it does not expose the active tab URL over the macOS Accessibility API. That is outdated: modern Gecko exposes AXURL on its AXWebArea just like Safari and Chromium, but builds the tree lazily and wakes on a different signal — AXEnhancedUserInterface on the app element, not Chromium's AXManualAccessibility. The reader now sets that wake signal for Gecko apps and reuses the existing AXURL walk; activation stays scoped to the existing enhanced-mode + URL-rule gating, so no new toggle is needed. The Gecko set covers Firefox (stable/dev/nightly), Zen, Floorp, and Waterfox, plus the privacy forks LibreWolf, Tor Browser, and Mullvad Browser — included deliberately, since reading their URL requires waking accessibility. Bundle ids come from each project's own build config; the mechanism was confirmed against Firefox source and a live Firefox probe. Signed-off-by: Kevin Cui <bh@bugs.cc>
Summary by CodeRabbitRelease Notes
WalkthroughThis pull request extends the LockIME URL reading system to support Firefox and Gecko-based browsers. The implementation defines a new gecko bundle ID set containing Firefox and its forks, expands the all bundle ID set to include gecko alongside chromium and Safari, and implements Gecko-specific accessibility wake handling via AXEnhancedUserInterface. User-facing UI text and localization strings across nine languages were updated to reflect Firefox support. Test coverage was expanded to validate the new gecko bundle detection and predicate functionality, and authority-less URL handling. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches✨ Simplify code
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
Tests/LockIMEKitTests/URLMatcherTests.swift (1)
98-113: ⚡ Quick winAdd test coverage for Firefox Nightly.
The test validates
isGeckofor 8 of the 9 Gecko bundle IDs defined in the implementation but is missingorg.mozilla.nightly(defined inBrowserBundleIDs.geckoperURLMatcher.swift:18).🧪 Add missing bundle ID assertion
func gecko() { `#expect`(BrowserBundleIDs.isGecko("org.mozilla.firefox")) `#expect`(BrowserBundleIDs.isGecko("org.mozilla.firefoxdeveloperedition")) + `#expect`(BrowserBundleIDs.isGecko("org.mozilla.nightly")) `#expect`(BrowserBundleIDs.isGecko("app.zen-browser.zen"))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@Tests/LockIMEKitTests/URLMatcherTests.swift` around lines 98 - 113, The gecko() test is missing coverage for the "org.mozilla.nightly" bundle ID declared in BrowserBundleIDs.gecko; add an assertion calling BrowserBundleIDs.isGecko("org.mozilla.nightly") (i.e., mirror the other `#expect`(...) checks) inside the gecko() test to ensure all Gecko bundle IDs are validated; locate the gecko() function in URLMatcherTests.swift and add the `#expect`(BrowserBundleIDs.isGecko("org.mozilla.nightly")) line alongside the other isGecko assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@Tests/LockIMEKitTests/URLMatcherTests.swift`:
- Around line 98-113: The gecko() test is missing coverage for the
"org.mozilla.nightly" bundle ID declared in BrowserBundleIDs.gecko; add an
assertion calling BrowserBundleIDs.isGecko("org.mozilla.nightly") (i.e., mirror
the other `#expect`(...) checks) inside the gecko() test to ensure all Gecko
bundle IDs are validated; locate the gecko() function in URLMatcherTests.swift
and add the `#expect`(BrowserBundleIDs.isGecko("org.mozilla.nightly")) line
alongside the other isGecko assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9a7b56d1-cac1-4325-a82a-3f8f174fd591
📒 Files selected for processing (5)
Sources/LockIME/Localizable.xcstringsSources/LockIME/UI/Settings/URLRulesSettingsPane.swiftSources/LockIMEKit/Enhanced/AccessibilityBrowserURLReader.swiftSources/LockIMEKit/Enhanced/URLMatcher.swiftTests/LockIMEKitTests/URLMatcherTests.swift
The reader previously excluded Firefox on the assumption that it does not expose the active tab URL over the macOS Accessibility API. That is outdated: modern Gecko exposes AXURL on its AXWebArea just like Safari and Chromium, but builds the tree lazily and wakes on a different signal — AXEnhancedUserInterface on the app element, not Chromium's AXManualAccessibility. The reader now sets that wake signal for Gecko apps and reuses the existing AXURL walk; activation stays scoped to the existing enhanced-mode + URL-rule gating, so no new toggle is needed.
The Gecko set covers Firefox (stable/dev/nightly), Zen, Floorp, and Waterfox, plus the privacy forks LibreWolf, Tor Browser, and Mullvad Browser — included deliberately, since reading their URL requires waking accessibility. Bundle ids come from each project's own build config; the mechanism was confirmed against Firefox source and a live Firefox probe.