/firefox-ios

Firefox for iOS

Primary LanguageSwiftMozilla Public License 2.0MPL-2.0

Firefox for iOS codebeat badge BuddyBuild codecov

Download on the App Store.

This branch (master)

This branch is for mainline development that will ship in v14.0.

This branch only works with Xcode 9.4 and supports iOS 10.3, and 11.x.

This branch is written in Swift 4

Please make sure you aim your pull requests in the right direction.

For bug fixes and features for the upcoming v13.0 release, please see the v13.x branch.

Getting involved

We encourage you to participate in this open source project. We love Pull Requests, Bug Reports, ideas, (security) code reviews or any kind of positive contribution. Please read the Community Participation Guidelines.

Want to contribute but don't know where to start? Here is a list of Good First Bugs.

Likewise, the design and UX is still in flux. Don't get attached to them. They will change tomorrow! https://mozilla.invisionapp.com/share/HA254M642#/screens/63057282?maintainScrollPosition=false

GitHub issues are enabled on this repository, but we encourage you to file a bug (see above). We'll accept issues to track work items that don't yet have a pull request, and also as an early funnel for bug reports, but Bugzilla is the source of truth for lots of good reasons — issues will be shifted into Bugzilla, and pull requests need a bug number.

Building the code

As of April 2018, this project requires Xcode 9.3.

  1. Install the latest Xcode developer tools from Apple.
  2. Install Carthage
    brew update
    brew install carthage
  3. Clone the repository:
    git clone https://github.com/mozilla-mobile/firefox-ios
  4. Pull in the project dependencies:
    cd firefox-ios
    sh ./bootstrap.sh
  5. Open Client.xcodeproj in Xcode.
  6. Build the Fennec scheme in Xcode.

Building User Scripts

User Scripts (JavaScript injected into the WKWebView) are compiled, concatenated and minified using webpack. User Scripts to be aggregated are placed in the following directories:

/Client
|-- /Frontend
    |-- /UserContent
        |-- /UserScripts
            |-- /AllFrames
            |   |-- /AtDocumentEnd
            |   |-- /AtDocumentStart
            |-- /MainFrame
                |-- /AtDocumentEnd
                |-- /AtDocumentStart

This reduces the total possible number of User Scripts down to four. The compiled output from concatenating and minifying the User Scripts placed in these folders resides in /Client/Assets and are named accordingly:

  • AllFramesAtDocumentEnd.js
  • AllFramesAtDocumentStart.js
  • MainFrameAtDocumentEnd.js
  • MainFrameAtDocumentStart.js

To simplify the build process, these compiled files are checked-in to this repository. When adding or editing User Scripts, these files can be re-compiled with webpack manually. This requires Node.js to be installed and all required npm packages can be installed by running npm install in the root directory of the project. User Scripts can be compiled by running the following npm command in the root directory of the project:

npm run build

Contributor guidelines

Creating a pull request

  • All pull requests must be associated with a specific bug in Bugzilla.
  • If a bug corresponding to the fix does not yet exist, please file it.
  • You'll need to be logged in to create/update bugs, but note that Bugzilla allows you to sign in with your GitHub account.
  • Use the bug number/title as the name of pull request. For example, a pull request for bug 1135920 would be titled "Bug 1135920 - Create a top sites panel".
  • Finally, upload an attachment to the bug pointing to the GitHub pull request.
  1. Click Add an attachment.
  2. Next to File, click Paste text as attachment.
  3. Paste the URL of the GitHub pull request.
  4. Enter "Pull request" as the description.
  5. Finally, flag the pull request for review. Set the review field to "?", then enter the name of the person you'd like to review your patch. If you don't know whom to add as the reviewer, click suggested reviewers and select a name from the dropdown list.

Pro tip: To simplify the attachment step, install the Github Bugzilla Tweaks addon. This will add a button that takes care of the first four attachment steps for you.

Swift style

Whitespace

  • New code should not contain any trailing whitespace.
  • We recommend enabling both the "Automatically trim trailing whitespace" and "Including whitespace-only lines" preferences in Xcode (under Text Editing).
  • git rebase --whitespace=fix can also be used to remove whitespace from your commits before issuing a pull request.

Commits

  • Each commit should have a single clear purpose. If a commit contains multiple unrelated changes, those changes should be split into separate commits.
  • If a commit requires another commit to build properly, those commits should be squashed.
  • Follow-up commits for any review comments should be squashed. Do not include "Fixed PR comments", merge commits, or other "temporary" commits in pull requests.