Skip to content

feat(url): support Firefox-based browsers in per-URL rules#14

Merged
BlackHole1 merged 1 commit into
mainfrom
feat/gecko-url-rules
Jun 12, 2026
Merged

feat(url): support Firefox-based browsers in per-URL rules#14
BlackHole1 merged 1 commit into
mainfrom
feat/gecko-url-rules

Conversation

@BlackHole1

Copy link
Copy Markdown
Member

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.

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>
@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Added Firefox support for URL rules, extending compatibility to Safari, Firefox, and Chromium-based browsers.
    • Improved accessibility integration for Firefox to ensure reliable URL detection.
  • Documentation

    • Updated localized text describing browser support for URL rules across multiple languages.

Walkthrough

This 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)
Check name Status Explanation
Title check ✅ Passed The title follows the required format and accurately summarizes the main change: adding Firefox/Gecko support to per-URL rules.
Description check ✅ Passed The description clearly explains the technical rationale for supporting Firefox, the accessibility API changes needed, and the browser set covered.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feat/gecko-url-rules

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
Tests/LockIMEKitTests/URLMatcherTests.swift (1)

98-113: ⚡ Quick win

Add test coverage for Firefox Nightly.

The test validates isGecko for 8 of the 9 Gecko bundle IDs defined in the implementation but is missing org.mozilla.nightly (defined in BrowserBundleIDs.gecko per URLMatcher.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

📥 Commits

Reviewing files that changed from the base of the PR and between 68ecef3 and d4d7786.

📒 Files selected for processing (5)
  • Sources/LockIME/Localizable.xcstrings
  • Sources/LockIME/UI/Settings/URLRulesSettingsPane.swift
  • Sources/LockIMEKit/Enhanced/AccessibilityBrowserURLReader.swift
  • Sources/LockIMEKit/Enhanced/URLMatcher.swift
  • Tests/LockIMEKitTests/URLMatcherTests.swift

@BlackHole1 BlackHole1 merged commit 806ff28 into main Jun 12, 2026
3 checks passed
@BlackHole1 BlackHole1 deleted the feat/gecko-url-rules branch June 12, 2026 15:43
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.

1 participant