Skip to content

Add Firefox compatibility support #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mohit200008
Copy link
Member

@mohit200008 mohit200008 commented Jul 30, 2025

  • Add browser compatibility layer (browser-compat.js)
  • Update manifest.json to use background.scripts for Firefox
  • Replace chrome.* API calls with browserAPI.* calls
  • Add Firefox-specific settings in manifest
  • Create testing guides and documentation
  • Update package.json with testing scripts

📌 Fixes

Fixes #220


📝 Summary of Changes

  • Short description of what was changed
  • Include links to related issues/discussions if any

👀 Reviewer Notes

Add any special notes for the reviewer here

Summary by Sourcery

Add Firefox compatibility support by creating a unified browser compatibility layer, updating manifest and scripts, and providing documentation and test scripts for cross-browser validation.

New Features:

  • Support Firefox through browser_specific_settings in manifest and background.scripts
  • Introduce a unified browserAPI wrapper (browser-compat.js) to abstract Chrome and Firefox API differences

Enhancements:

  • Replace all chrome.* calls with browserAPI.* across popup, main, scrumHelper, and gitlabHelper scripts
  • Include browser-compat.js in popup.html and adjust manifest.json to maintain backward compatibility with Chrome

Build:

  • Add npm scripts for Firefox testing and build in package.json

Documentation:

  • Add a comprehensive Firefox testing guide and compatibility summary documentation

Tests:

  • Introduce test-compatibility.js script to validate the browserAPI compatibility layer

- Add browser compatibility layer (browser-compat.js)
- Update manifest.json to use background.scripts for Firefox
- Replace chrome.* API calls with browserAPI.* calls
- Add Firefox-specific settings in manifest
- Create testing guides and documentation
- Update package.json with testing scripts
Copy link
Contributor

sourcery-ai bot commented Jul 30, 2025

Reviewer's Guide

This PR implements Firefox compatibility by introducing a cross-browser API wrapper, migrating all chrome.* calls to browserAPI.*, updating the manifest to meet Firefox requirements, and adding dedicated testing documentation and scripts.

Class diagram for the new browser compatibility layer (browser-compat.js)

classDiagram
    class browserAPI {
        +storage
        +runtime
        +i18n
    }
    class Storage {
        +local
    }
    class LocalStorage {
        +get(keys, callback)
        +set(items, callback)
        +remove(keys, callback)
        +onChanged
    }
    class Runtime {
        +onMessage
        +lastError
        +sendMessage(message)
    }
    class I18n {
        +getMessage(messageName, substitutions)
    }
    browserAPI --> Storage : has
    Storage --> LocalStorage : has
    browserAPI --> Runtime : has
    browserAPI --> I18n : has
Loading

File-Level Changes

Change Details Files
Add and integrate a cross-browser compatibility layer
  • Create browser-compat.js with unified chrome/firefox API wrapper
  • Expose browserAPI globally or via module for all scripts
  • Include browser-compat.js in popup.html before other scripts
  • Add test-compatibility.js to validate browserAPI functionality
src/scripts/browser-compat.js
src/popup.html
src/scripts/test-compatibility.js
Replace chrome.* API calls with browserAPI.* across codebase
  • Swap chrome.storage, chrome.runtime, chrome.i18n calls to browserAPI equivalents
  • Ensure callback and Promise semantics are preserved for Firefox
  • Update all event listeners and message handlers to use browserAPI
src/scripts/popup.js
src/scripts/scrumHelper.js
src/scripts/main.js
src/scripts/gitlabHelper.js
src/scripts/emailClientAdapter.js
Adjust manifest.json for Firefox support
  • Change background.service_worker to background.scripts array
  • Add browser_specific_settings.gecko with extension ID and min version
  • Retain permissions and default_locale
src/manifest.json
Add Firefox testing guides and package scripts
  • Add firefox-testing-guide.md and FIREFOX_COMPATIBILITY_SUMMARY.md with detailed instructions
  • Update package.json with test:firefox, test:chrome, build:firefox scripts
  • Include cross-browser troubleshooting and deployment notes
firefox-testing-guide.md
FIREFOX_COMPATIBILITY_SUMMARY.md
package.json

Assessment against linked issues

Issue Objective Addressed Explanation
#220 Test the extension on Mozilla Firefox and fix any browser-specific issues to ensure Firefox compatibility.
#220 Implement a browser compatibility layer to abstract Chrome/Firefox API differences in the codebase.
#220 Update documentation to include Firefox-specific testing and compatibility instructions.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions github-actions bot added dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code core frontend extension documentation config labels Jul 30, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mohit200008 - I've reviewed your changes and they look great!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `src/scripts/browser-compat.js:1` </location>
<code_context>
+// Browser compatibility layer for Chrome/Firefox differences
+
+// Detect browser
</code_context>

<issue_to_address>
No support for asynchronous sendMessage with callback in Chrome.

Please update the sendMessage wrapper to support both callback and Promise-based signatures for compatibility with Chrome's API.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

mohit200008 and others added 4 commits July 30, 2025 13:23
- Update sendMessage wrapper to support both callback and Promise patterns
- Add sendMessagePromise helper for consistent Promise-based API
- Improve error handling for Firefox Promise-to-callback conversion
- Add comprehensive sendMessage tests to compatibility test suite
- Ensure Chrome compatibility with callback-based sendMessage API
@mohit200008
Copy link
Member Author

please review the changes and also the merge conflicts have been resolved, of everything seems right please merge my pr @hpdang

@mohit200008
Copy link
Member Author

please merge the pr if everything seems correct @hpdang

@hpdang
Copy link
Member

hpdang commented Aug 5, 2025

@mohit200008 this need to be approved by one of the core contributors, maybe @Preeti9764 can check

@hpdang hpdang requested a review from Preeti9764 August 5, 2025 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config core dependencies Pull requests that update a dependency file documentation extension frontend javascript Pull requests that update javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Firefox Compatibility and Testing for Scrum Helper Extension
2 participants